我希望使用内置的rendermap函数将使用不透明度材质插槽的黑白地图渲染到漫反射贴图中,并从中创建一个.tga
或.png
文件加上这两个,使其具有原始的R,G,B和不透明度贴图的alpha。
以下是代码(在其中注释):
(
imgD = Bitmaptexture filename:@"W:\SS_3D\Scripts - Plugins - MCGs\Scripts\Examples\leaf-diffuse.tga"
imgO = Bitmaptexture filename:@"W:\SS_3D\Scripts - Plugins - MCGs\Scripts\Examples\leaf-opacity.jpg"
newFilePath = @"W:\SS_3D\Scripts - Plugins - MCGs\Scripts\Examples\leaf-combined.tga"
--This will set-up the .tga to have the alpha channel.
targa.setPreMultAlpha true
--Turns on splitting the maps to help see each channels result.
targa.setAlphaSplit true
--Checks if the two maps are the same size
if ([imgD.bitmap.width,imgD.bitmap.height]) == ([imgO.bitmap.width,imgO.bitmap.height]) do
(
--Render the new diffuse into the new bitmap.
--But this doesn't work as I thought it might.
newDiffuse = rendermap imgD into:imgD.bitmap size:([imgD.bitmap.width,imgD.bitmap.height]) fileName:newFilePath filter:on display:off gamma:2.2 alpha:on
save newDiffuse ; close newDiffuse
)
)
我想使用不透明度贴图,并为.png
文件将漫反射的像素擦除或使其具有相同的透明度,对于.tga
文件,将不透明度贴图添加为Alpha
请参见附件中我所追求的两个选择,以便您更好地了解我希望实现的目标。