Texturing by surface normal

Locked
ix-ir
Posts: 192
Joined: Wed May 16, 2007 9:43 pm

Texturing by surface normal

Post 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?
TTK-Bandit
Posts: 190
Joined: Sat Sep 07, 2002 7:00 am

Re: Texturing by surface normal

Post 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.
Locked