How to set constant, linear, quadratic

Rak'kar

08-03-2007 02:53:59

The exported scene contains

<attenuation range="2000" constant="0" linear="0.05" quadratic="0" />


But as far as I can tell the only thing you can ever adjust is range, by setting Far attenuation / end.

How do I set constant, linear, and quadratic for oFusion?

Lioric

09-03-2007 22:42:57

This is controlled via the far attenuation range in the light modifier panel

Rak'kar

09-03-2007 22:48:24

Under far attenuation there are 2 checkboxes, and 2 number entry fields. The checkboxes are "Use" "Show". the number entry fields are labled "Start" "End". Changing start has no effect. Changing end affects the output xml attribute "range"

So how do I set constant, linear, and quadratic?

Lioric

12-03-2007 22:13:49

The values (range and linear) are set automatically based on the light attenuation's end value, as there is not direct relation (as of the values) between range, constant, linear, and quadratic and the light attenuation start and end

Do you need full control over the light attenuation values?
do you have any implementation suggestions that may fit your workflow?

Rak'kar

12-03-2007 22:51:46

All I want to do is limit my light to 20 meters. Simply setting 20 gives me a light so dim it's as if there were no light at all, because of the linear value.

To actually see a light 20 meters I have to set the end distance to 2000 meters, but then of course things 2000 meters away are lit, which is not what I want.

I don't know how to implement this - maybe you can use the start distance for something.

Sycle

07-04-2007 04:28:23

I've been running into this problem as well.

My understanding is that while MAX will let you define a start and end attenuation, Ogre (and OpenGL and DX for that matter) only understand it in the form of a quadratic. Since the two systems are fundamentally incompatible, we don't get what we expect.

MAX also uses decay (none, inverse, inverse square) which are less controllable than attenuation but seem like a better fit to what the engine is actually doing, but oFusion doesn't seem to consider this settings.

professor420

07-04-2007 16:10:37

The formula for attenuation is:

attenuation0 = (1 / ((LightAtten0.x) + (LightAtten0.y * LDist0) + (LightAtten0.z * LDist0 * LDist0))) * attenScale;

Those numbers refer to the constant, linear, and quadratic. If you do some sample math, you will understand how those values effect light falloff.

Note that attenuation must be supported in your shaders, if you are using shaders, for it to work.

Lioric

13-04-2007 04:06:12

Rakkar: Custom Light Attenuation has been implemented and its available in the Hotfix #175oECM in your account page

For details on usage see this knowledge base article:

Custom Light Attenuation

Rak'kar

13-04-2007 17:16:43

Thanks. Did you update the OgreOSMScene loader for this? The loader is not included in the hotfix. If you just paste the code to read this I can copy it in as well.

Lioric

13-04-2007 18:07:58

The oSceneLoader library doesnt needs to be updated to use this feature addition, the current version should work correctly

Rak'kar

25-04-2007 20:31:43

Range works. Adjusting constant, linear, and quadratic does nothing. This is even if I select "Update" Is this a bug in the shader or oFusion or potentially both?

Lioric

26-04-2007 22:45:43

Here all options are working correctly (except quadratic, but in Ogre applications tested this dont work either)

I will review this, but as noted above, all options was working

Rak'kar

26-04-2007 23:47:03

I believe this was a shader bug. Please disregard.