Well, pardon me for using English here for this passage because I need to reuse this for the internal document for my company.
And about the section of Visibility Determination and Collision dection, I will continue with new post later.
3Ds Max, as the most used modeling software, is selected as the standard for the models in the new Engine.
For the most used value, like vertex postion, vertex color, vertex normal, face normal, texture maps, material, helpers and etc, you can easily find
the solution in Maxscript reference.
However, I met a small problem when trying to export the parameters for light in Max.
In 3Ds Max, there are couples of light types: targeted spot light, free spot light, targeted direction light, free direction light, skylight, Omni, Area Omni and Area Spot light.
Free means the light does not get a target. And basically speaking, you can use targeted light instead of free light and it is more convient btw.
Generally, I want to use the formula for decay attenuation:
Light_Intensityd = Original_Light_Intensity * 1.0/(c + d*l + d*d*q), where
c = the attenuation factor for all distances
l = the attenuation factor that drops linearly with distance
q = the attenuation factor that has a quadratic drop-off with distance
d = the distance
In the light property control panel, there is three types of decays.
None means no decay in the distance of light volume but you still can control the Far Attenuation to change the start and end to adjust the decay.
Inverse means the decay of light will happens after the light rays enter the range of the decay (From the farAttenStart to farAttenEnd).
Inverse Square means the decay light will happens sharply ( square power of distance) after the light rays enter the range of the decay.
For 1st condition, l = 0 if no far attenuation is used Or l = 1 / farAttenStart
For 2nd and 3rd, l = 1.0 / DecayRadius
For all conditions, q = l2
And For the distance, we need to get the postion of target which has a naming rule like "[light_name].target".
And call the distance function to get the length between target postion and object postion.
By now, you can freely control the parameters in Max's control panel and export the data to you own engine without problem.
转载于:https://www.cnblogs.com/eric720/archive/2007/05/28/762863.html