Delgine 3D Tools & Content DeleD Community Edition
Forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Attenuation For Dummies

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    DeleD Community Edition Forum Index -> DeleD Community Edition
View previous topic :: View next topic  
Author Message
Daaark
DeleD PRO user


Joined: 01 Sep 2004
Posts: 2696
Location: Ottawa, Canada

PostPosted: Sun Dec 05, 2004 8:07 am    Post subject: Attenuation For Dummies Reply with quote

Embarassed

i never quiete understood this attenuation model, even though I have to use it when I code in opengl. I end up fiddling with it forever until it looks right. I even have an opengl book that explains this. Very Happy

Can anyone explain how the 3 attenuations work together, and how they map to world units in deled? Failing that, a good tutorial somewhere?
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Jeroen
Site Admin


Joined: 07 Aug 2004
Posts: 5332
Location: The Netherlands

PostPosted: Sun Dec 05, 2004 8:34 am    Post subject: Reply with quote

I don't know much about the lighting implementation (that was PJ's job Wink) but have you checked the Help? We've included links to DeleD lighting tutorials in there. They will be on our site too after we redesigned parts of it. Smile
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Daaark
DeleD PRO user


Joined: 01 Sep 2004
Posts: 2696
Location: Ottawa, Canada

PostPosted: Sun Dec 05, 2004 8:41 am    Post subject: Reply with quote

Yes I've read the help. Nice job on that. Better than the old one. But you could have chosen a better color for the map file spec where you use the same shade almost in bold to desbribe the parts of the file as the background. Shocked Hard on the eyes.

PErhaps I'll try reading and rereading the explanations in my book. Embarassed
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Paul-Jan
Site Admin


Joined: 08 Aug 2004
Posts: 3066
Location: Lage Zwaluwe

PostPosted: Sun Dec 05, 2004 11:02 am    Post subject: Reply with quote

Attenuation is a simple formula that relates the strength of the light to the distance (in DeleD units) to the light source. The exact formula can be found here:

http://www.delgine.com/index.php?filename=reference_lighting#PointLight

This attenuation factor is then simply multiplied with the colour of the light to get the final colour.

The problem with the large size of DeleD words (as 1 DeleD units is 1 OpenGL Unit) is that you'll need fairly small values for especially the quadratic part of the attenuation. We realise this requires a lot of trial-and-error at the moment, that is why we'll have a quick preview of the light area in future versions of DeleD as a visual aid.

If there is anything specific about the attenuation equation you don't understand, please ask!
Back to top
View user's profile Send private message Visit poster's website
Daaark
DeleD PRO user


Joined: 01 Sep 2004
Posts: 2696
Location: Ottawa, Canada

PostPosted: Sun Dec 05, 2004 11:10 am    Post subject: Reply with quote

Paul-Jan wrote:
Attenuation is a simple formula that relates the strength of the light to the distance (in DeleD units) to the light source. The exact formula can be found here:

http://www.delgine.com/index.php?filename=reference_lighting#PointLight

This attenuation factor is then simply multiplied with the colour of the light to get the final colour.

The problem with the large size of DeleD words (as 1 DeleD units is 1 OpenGL Unit) is that you'll need fairly small values for especially the quadratic part of the attenuation. We realise this requires a lot of trial-and-error at the moment, that is why we'll have a quick preview of the light area in future versions of DeleD as a visual aid.

If there is anything specific about the attenuation equation you don't understand, please ask!


The part I don't get is what the constant, linear, and quadric parts do.

Linear 1.0 means what?
Quadric 0.000030 means what?
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Paul-Jan
Site Admin


Joined: 08 Aug 2004
Posts: 3066
Location: Lage Zwaluwe

PostPosted: Sun Dec 05, 2004 12:15 pm    Post subject: Reply with quote

Let's fill it into the formula. Let's start with a combination of a constant of 1 (don't mess with this constant unless you know what you are doing) and a linear of 0.5 (no quadratic). The formula would then become:

attenuation = 1 / ( 1 + 0.5 * distance ). At a distance of 2 units the attenuation factor would be 1/2, so the light would already have lost half it's strength. At a distance of 64 units the attenuation factor would be 1 / 32, so light would be diminished a lot, and at a distance of 256 units the light would be barely visible. As you can see, the light drops off quickly at short distance, and then slowly fades away the further away you get. As a sidenote, in DeleD you better take a much smaller value for linear, because a light that is at half it's power at 2 units distance won't do you much good Smile

Now let's drop the linear factor, and pick a quadratic of 0.0003. Now the formula is attenuation = 1/ ( 1 + 0.0003 * distance * distance ). At a distance of 2 units the light would still be at full strength, with a factor of only ( 1 / 1.0012 ). At a distance of 64 units, the light would still be going strong ( 1 / 1.2288 ), but at a distance of 256 it would be 1/20.

I just released you probably understand all this in a purely acadamic way, but have problems _visiualising_ what the formule looks like. Just had a brainwave for a new DeleD feature: a little graph in the Object Inspector showing you immediately how distance and attenuation relate, given the factors. Would that help?
Back to top
View user's profile Send private message Visit poster's website
granada
Team member


Joined: 07 Aug 2004
Posts: 1955
Location: England

PostPosted: Sun Dec 05, 2004 12:19 pm    Post subject: Reply with quote

Quote:
Just had a brainwave for a new DeleD feature: a little graph in the Object Inspector showing you immediately how distance and attenuation relate, given the factors. Would that help?


Sounds good to me Very Happy

dave
_________________
AMD Phenom(tm)IIx6 1090t Processor 3.20 GHS
8.00 GB memory
Windows 7 64 bit
Nvida Geforce GTX 580
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    DeleD Community Edition Forum Index -> DeleD Community Edition All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum