Archived

This topic is now archived and is closed to further replies.

nooan

Simulating phong lighting with cubemapping

Recommended Posts

Hello, I want to render the specular highlights of sun on water with the phong lighting model. I will not use pixel&vertex shaders by now, but only cubemapping and texgen. Is this possible? My idea is this: Given V = viewpoint - waterpoint N = waternormal R = V reflected by N 1) precalculate a cubemap with the specular color for each possible R 2) use this cubemap in realtime to simulate phong lighting 3) calculate R using D3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR (Dx 8) 4) backtransform R from camera to world space 5) access the cubemap with the world-space R to get the specular highlight Ok, the overall idea seem ok to me. But I''m not sure about the math behind the computation of R. I''ve always done phong lighting using (reflected light) dot (viewpoint-point) and now I want (reflected (viewpoint-point)) dot light. Is this the same? Also is all this calculus space-independent (as I hope)? Thank you guys! Stefano Lanza

Share this post


Link to post
Share on other sites