I’ve had a search on the forum for this but I can’t find the answer. I would like to create a light source that only lights items near by so it fades out really quickly. I thought this was possible. I have read this
My plan was to have a 180 degree spot light, set it to be at a specific position then use attenuation.
The attenuation has a formula
1/ (GL_CONSTANT_ATTENUATION + (distanceGL_LINEAR_ATTENUATION) + (distance^2GL_QUADRATIC_ATTENUATION))
Does anyone have any good values for these 3 such that you have a bright center and then a rapid tail off brightness (like what a candle would do in real life)
Using legacy GL vertex lights like that is not ideal because it is much more constrained compared to GLSL per fragment lighting.
Make sure you use a highly tesselated “ground” to check the attenuation, to avoid pitfal 2. Poor Tessellation Hurts Lighting.
Then the idea about attenuation is to forget about quadratic and constant, and just play with linear. Less realistic in theory, but much easier to control and in practice more realistic as it will simulate some gamma correction.
Thanks, I’ve played around but there isn’t really a good setting that I can find, the room I have have has so little variation in light its not distinguishable. Can you recommend any good places to find out GLSL information on how to get some good lighting effects?
Can you recommend any good places to find out GLSL information on how to get some good lighting effects?
Well yes, but you’re not going to be able to just drop it into your existing code. It’s intended as an in-depth tutorial, not a copy-and-paste annex.