Page 1 of 1

Basic question: material that will change the normal

Posted: Mon Oct 26, 2015 9:27 am
by mrluzeiro
Hello, I have a basic question.
If I assigned a material to an object that will perturb the normals, where / how that change of the normals should be applied?

Usually the objects implement a GetNormal( uv coords?) should that GetNormal function call the material function that will perturb the normal or should I only do that at shade moment and keep always the original normal?
Normal should only be used for light shading or/and also shadow and reflection/refractions?

Thanks

Re: Basic question: material that will change the normal

Posted: Tue Oct 27, 2015 4:03 pm
by asyrov
GetNormal(uv...) could return final corrected (based on material) normal. Then this normal could be used for each of mentioned calculations (not sure about shadows, but possibly as minor optimization of hit test).

Re: Basic question: material that will change the normal

Posted: Thu Oct 29, 2015 8:02 am
by patlefort
You definitely need to calculate it before doing any shading calculation as they should be based on this normal. You should keep a copy of the surface real geometric normal along side and use that to displace the starting position of rays to avoid self-intersection.

Re: Basic question: material that will change the normal

Posted: Thu Oct 29, 2015 8:14 am
by szellmann
You should keep a copy of the surface real geometric normal along side and use that to displace the starting position of rays to avoid self-intersection.
Keeping the geometry normal around is good advice in general, because that's the one you need to determine if you process a "back-face" or a "front-face"...