Re: Raytracing: How would I create a matte surface?
Gianni Mariani wrote:
Daniel Pitts wrote:
Hello everyone.
I've decided (for no reason other than experience) to create my own
ray-tracing engine in Java.
So far so good, but my modeling is completely "reflective", which
means only glossy surfaces. What approach should I take to give the
appearance of matte surfaces?
Bump mapping maybe?
Perhaps you can simply use a "material" model like opengl since a matte
comes from diffused light and from a ray tracing perspective it comes
from "everywhere".
Hmm, perhaps, but I'd like to avoid tricks like that if possible (if I
were going for a professional grade app, I would consider that).
My thoughts are: When bouncing a ray, if it is a matte surface,
average the value of rays in several directions, rather than just the
reflected ray. For instance. The current reflective approach:
incoming normal outgoing
\ | /
\ t | t /
\ /-|-\ /
\ | /
where "t" is the angle between the normal and incident vectors.
The matt approach
incoming normal outgoing
\ | /
\ t | Ux /
\ /-|-\ /
\ | /
In bump mapping, it's the normal that changes which does somthing
similat to what you describe.
I'm actually doing that, but using random jitter on the normal instead
of a bit-mapped normal.
where Ux is some angle related to t, but offset somewhat. There will
also need to be Uy for scattering that isn't coplanar with the
incident and normal. For every reflection off a matte surface, the Ux
and Uy will be calculated several times, and the resulting ray-trace
will be merged (color averaged?)
Is this the right approach? If it is, how would I calculate the new
outgoing values? Am I going the completely wrong direction on this?
From my experience, (as for ray tracing, I have none...) experimenting
is a good way to gain insight so it can't be wrong.
True, it's the main reason I love experimenting :-).
--
Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/>