Skip to main content
GameDev.net gamedev.net
🔒 Locked

Abusing sphere maps, need help

Started by Chapel Feb 27, 2003 at 10:23 PM 0 replies 200+ views
Original Post
Chapel
Chapel
I''ve been toying with doing my lighting using sphere maps (with the help of vertex shaders). The light cannot be joined to the eye (miner''s hat). I also don''t really want to be limited to doing it in object space either. I''d like to have an arbitrary light direction. Using my current know how, I''d have to transform the mesh normals to "light space". Is there a better way of doing this? I suppose if there isn''t I''ll move on to cube maps, but I really like how sphere maps work aside from this apparent limitation. For one you can mock one up in photoshop in no time flat. TIA Chapel
Yann L
Yann L
Hmm, so you want to store lighting around an object in a sphere map, and then index it via the object normals ?

That works indeed, but I would strongly suggest cubemaps for that usage. A spheremap has very poor resolution in backwards direction, if used in a view independent way. It will also lead to artifacts near the poles, since the interpolation of the 2D spheremap is not linear.

It''s a lot easier with cubemaps, and quality is much better. Also, the hardware directly accepts unnormalized 3D direction vectors into the cubemap, that can be computed from the object''s vertex normals. Most 3D hardware even support an automatic texture coordinate generation feature, that will compute the indexing vectors for you (given standard vertex normals). Under OpenGL, check the NORMAL_MAP (or ARB_NORMAL_MAP) parameter.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.