Jump to content
  • Advertisement
Sign in to follow this  
thedigga007

OpenGL D3DLIGHT8 range equivalent in OpenGL

This topic is 3901 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

In D3D there is a "Range" value for point lights, is there a way to emulate this in OpenGL? definition: Range Distance beyond which the light has no effect. The maximum allowable value for this member is the square root of FLT_MAX. This member does not affect directional lights. Thanks edit: I tried this but it just doesnt look the same as it does on d3d...
lights[index].constant_atten = light->Attenuation0;
lights[index].linear_atten = light->Attenuation1/light->Range;
lights[index].quadratic_atten = light->Attenuation2+(1/(light->Range*light->Range));

Share this post


Link to post
Share on other sites
Advertisement
Yeah that was the first thing I did. Unfortunately no such parameter exists in OpenGL for lighting.

quote d3d docs:

D = |VL|

In the preceding formula, D is the distance being calculated, V is the position of the vertex being lit, and L is the light source's position. If D is greater than the light's range, that is, the Range member of a D3DLIGHT8 structure, Direct3D makes no further attenuation calculations and applies no effects from the light to the vertex. If the distance is within the light's range, Direct3D then applies the following formula to calculate light attenuation over distance for point lights and spotlights.

A = 1/atten0 + D*atten1 + d^2*atten2

Now obviously without the ability to tell opengl that I want D = R if D > R I cannot reuse the same lighting data...soo it looks like its just not possible. Bummer.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!