Maxscript 导入ies文件

dir = @"D:\internet evaluation\3FO4L6FVKCQT\light_config.xml"
iesDir = @"D:\internet evaluation\Eval_Material_1\Eval_Material_1\iesprofile\14.IES"
iesAssetUser = AssetManager.getasset iesDir #Photometric
xmlDoc = dotNetObject "system.xml.xmlDocument"
xmlDoc.load dir
xmlroot = xmlDoc.DocumentElement
lightElements = xmlroot.childNodes
for i = 0 to lightElements.count-1 do(
	local lightElement = lightElements.item i
	if lightElement.getAttribute "Type" == "IESSpotLight" do(
		local sPosition = lightElement.getAttribute "Position"
		local sName = lightElement.getAttribute "Name"
		local sEnergy = lightElement.getAttribute "Energy"
		local sColor = lightElement.getAttribute "Color"
		
		local mLight = VRayIES()
		mLight.name = sName
		mLight.intensity_value = sEnergy as float /16.0 * 5.0
		local mPos = GetLightPos sPosition
		mLight.pos = mPos
		local mColor = GetLightColor sColor sEnergy
		mLight.color = mColor
		mLight.ies_file = iesAssetUser.getAssetID()
		
	)
	if lightElement.getAttribute "Type" == "SunLight" do(
		print "SunLight"
	)
)

fn GetLightPos Position =
(
	local t = FilterString Position ","
	return [t[1] as float,t[2] as float,t[3] as float]		
)

fn GetLightColor sColor sEnergy =
(
	local t = FilterString sColor ","
	local r = t[1] as float / sEnergy as float * 255.0
	local g = t[2] as float / sEnergy as float * 255.0
	local b = t[3] as float / sEnergy as float * 255.0
	return [r as integer,g as integer,b as integer]		
)

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值