Page 1 of 1

Texturing by surface normal

Posted: Wed Oct 29, 2008 6:04 am
by ix-ir
There was a QuakeWorld engine mod where surfaces were coloured based on their visible surface angle, green for floors and ceilings, blue for walls, purple for off-axis ramps and so on. I am interested in doing the same thing in Quake 3 but I have no idea what I'm doing with the normal vector test nor how to apply it. I've got the images and shaders in place (built in images in tr_image) and was intending to subvert the r_singleshader command to replace textures based on surface normal. Is this possible? Could anyone give me a few pointers about surface normals and interpreting their output?

Re: Texturing by surface normal

Posted: Fri Oct 31, 2008 3:53 pm
by TTK-Bandit
well, asuming you know how to change the texture/color of a surface, take the surface normals z value to calculate the color.
values should range from -1 (ceiling) to 1 (floor), while 0 would be a wall.