How to apply light models of 3Ds Max to your engine

3DsMax灯光参数导出
本文详细介绍了如何从3DsMax中导出各种类型的灯光参数,并特别关注了衰减公式在不同光源类型中的应用。文章还提供了获取目标位置及计算距离的方法。
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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值