File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change 2684
2684
-----------------
2685
2685
< div class='together'>
2686
2686
We can also randomize the reflected direction by using a small sphere and choosing a new endpoint
2687
- for the ray:
2687
+ for the ray.
2688
+ We'll use a random point from the surface of a sphere centered on the original endpoint, scaled by
2689
+ the fuzz factor.
2688
2690
2689
- ![Figure [reflect-fuzzy]: Generating fuzzed reflection rays](../images/fig-1.12-reflect-fuzzy.jpg)
2691
+ ![Figure [reflect-fuzzy]: Generating fuzzed reflection rays
2692
+ ](../images/fig-1.12-reflect-fuzzy.jpg)
2690
2693
2691
2694
</ div>
2692
2695
2707
2710
const override {
2708
2711
vec3 reflected = reflect(unit_vector(r_in.direction()), rec.normal);
2709
2712
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ highlight
2710
- scattered = ray(rec.p, reflected + fuzz*random_in_unit_sphere ());
2713
+ scattered = ray(rec.p, reflected + fuzz*random_unit_vector ());
2711
2714
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
2712
2715
attenuation = albedo;
2713
2716
return (dot(scattered.direction(), rec.normal) > 0);
You can’t perform that action at this time.
0 commit comments