|
![](/i/fill.gif) |
> Sounds a good approach. I started this project cause I wanted to learn
> some C++ (and OO programming). So you can imagine I have re-structured
> my code quite a bit.
I've done a few refactorings on mine too.
The biggest one was then I realised that the bulk of the work in the tracer
used a function with the same parameters as the shaders, so that itself
became a shader. :)
>> For anti-aliasing I do multiple passes, just throwing rays in at
>> completely random coordinates.
>
> Yeah. That works well. You can improve it (and many other random
> things) by not choosing totally random samples but using some
> pseudo-random sampling that gives more evenly spread samples.
Mine does seem to work pretty well as is.
> I'm now implementing direct lighting calculations. The results are
> impressive. So instead of just letting rays bounce randomly and hoping
> that they hit a light source, I now evaluate direct lighting component
> at each bounce. The result is that the noise reduces A LOT faster. If
> the light sources are small, the difference gets bigger. If I used
> point light sources, my original program would never hit them.
I've had this problem - can you please explain this direct lighting
algorithm in more detail?
> Still some nasty bugs I have to figure out but this one is a keeper.
> The downside is that I have no idea if I can implement this feature
> for any kind (shape) of light source. Now it works for spheres as it
> is easy to calculate the solid angle. We'll see...
This sounds promising.
BTW, I implemented simple "rough" reflections earlier today. That algorithm
was trivial:
d = original_reflection_direction
s = surface_smoothness
if (s > 0) {
pt = random_vector();
d += s * pt;
normalize(d);
}
cast_new_ray(d);
I haven't checked that it's mathematically accurate (it's possible that the
distribution of the pertubed ray around the original direction isn't
uniform) but it looks nice enough.
Ray
Post a reply to this message
|
![](/i/fill.gif) |