近期热门
粉丝53
关注 2
获赞 179
【游戏视频】抓摸后的低面花草maxya渲染AO及Z通道(贴图不透明问题解决方案)

[动画] 【游戏视频】抓摸后的低面花草maxya渲染AO及Z通道(贴图不透明问题解决方案)

[复制链接]
2305 4 0 0 8年前 举报
max材质球

游戏里面的场景抓模后如何渲染z通道

游戏里面的场景抓模后如何渲染z通道
maya的材质链接

maya链接

maya链接




0
点赞
0
打赏
0
添加到收藏夹

0

点击复制链接

使用微信扫码分享
一次扣10个券
全部评论4
您需要登录后才可以回帖 登录

感谢楼主分享,谢谢~
8年前
回复

使用道具 举报

感谢分享
8年前
回复

使用道具 举报

//--------------pt1.创建基本zdepth材质,pass-----------------------
shadingNode -asUtility samplerInfo;
shadingNode -asUtility distanceBetween;
connectAttr -f samplerInfo1.pointCamera distanceBetween1.point1;
shadingNode -asUtility setRange;
connectAttr -f distanceBetween1.distance setRange1.valueX;
setAttr "setRange1.maxX" 1;
setAttr "setRange1.oldMinX" 500;
setAttr "setRange1.oldMaxX" 1600;
//这个数据要测量获得
shadingNode -asTexture ramp;
rename ramp1;
removeMultiInstance -break true ramp1.colorEntryList[1];
setAttr "ramp1.colorEntryList[2].color" -type double3 0 0 0 ;
setAttr "ramp1.colorEntryList[2].position" 1;
setAttr "ramp1.colorEntryList[0].color" -type double3 2 2 2 ;
setAttr "ramp1.colorEntryList[0].position" 0;
connectAttr -f setRange1.outValueX ramp1.vCoord;
shadingNode -asShader surfaceShader;
rename zdepthSshaer;
connectAttr -force ramp1.outColor zdepthSshaer.outColor;
//-----------------pt2.下面开始复制材质,并且连接,及指定贴图,pass--------------------------
for ($i = 2; $i < 6; $i++)
{  
shadingNode -asShader layeredShader;
rename ("layeredShader"+$i);
connectAttr -force zdepthSshaer.outColor ("layeredShader"+$i+".inputs[0]"+".color");
setAttr ("layeredShader"+$i+".compositingFlag")1;
shadingNode -asTexture file;
rename ("file"+$i);
setAttr -type "string" ("file"+$i+".fileTextureName") {"tex"+$i+".dds"};
connectAttr -force ("file"+$i+".outTransparency") ("layeredShader"+$i+".inputs[0]"+".transparency");
sets -renderable true -noSurfaceShader true -empty -name ("layeredShader"+$i+"SG");
defaultNavigation -connectToExisting -source ("layeredShader"+$i) -destination ("layeredShader"+$i+"SG");
//connectAttr -f ("layeredShader"+$i+".outColor") ("layeredShader"+$i+"SG"+".surfaceShader");
sets -e -forceElement ("layeredShader"+$i+"SG");
};
//----------点选物体,指定材质error------------------------------
string $select[] = `ls -sl`;
for($in in $select)
{
sets -e -forceElement ("layeredShader"+$in+"SG");
}
//-------------bakup-------------------------------
/*
shadingNode -asShader layeredShader;
connectAttr -f zdepthSshaer.outColor layeredShader1.inputs[1].color;
removeMultiInstance -break true layeredShader1.inputs[0];
shadingNode -asTexture file;
connectAttr -force file1.outTransparency layeredShader1.inputs[1].transparency;
setAttr "layeredShader1.compositingFlag" 1;

duplicate layeredShader1 ;
connectAttr -force surfaceShader1.outColor layeredShader4.inputs[1].color;
connectAttr -force file1.outTransparency layeredShader4.inputs[1].transparency;
sets -renderable true -noSurfaceShader true -empty -name layeredShader4SG;
defaultNavigation -connectToExisting -source layeredShader4 -destination layeredShader4SG;
connectAttr -f layeredShader4.outColor layeredShader4SG.surfaceShader;
sets -e -forceElement layeredShader2SG;
*/
8年前
回复

使用道具 举报

对!没错!都有解决方案,但是MR的方案,渲染太慢了!所以都有sw的解决方案!
但是每个材质都要这样子改,多麻烦那?~于是乎,我就综合归纳出了max脚本来解决这个问题。。场景大的最好小块选,用选择物体修改的脚本,当心场景崩溃,或非类的报错。
-----------------------------------统一改场景材质球颜色脚本为standard.ms---------------------------------------------
for i=1 to scenematerials.count do
(
cmat = scenematerials[i]
if (getClassName cmat) == "Standard" do
(
cmat.diffuseMapEnable = on
                cmat.selfillumMapEnable = off
                cmat.selfillumMap = undefined
                cmat.useSelfIllumColor = off
                cmat.selfIllumColor = color 150 150 150
                cmat.Diffuse = color 150 150 150
                cmat.ambient = color 150 150 150
)
if (getClassName cmat) == "Multi/Sub-Object" do
(
for j = 1 to cmat.numsubs do
if cmat[j] != undefined do
(
bmat = cmat[j]
bmat.diffuseMapEnable = on
               bmat.selfillumMapEnable = off
               bmat.selfillumMap = undefined
               bmat.useSelfIllumColor = off
               bmat.selfIllumColor = color 150 150 150
                bmat.Diffuse = color 150 150 150
               bmat.ambient = color 150 150 150
)
)
if (getClassName cmat) == "Blend" do
(
for h = 1 to cmat.numsubs do
if cmat[h] != undefined do
(
cmat.map1Enabled = off
cmat.map1.diffuseMapEnable = on
cmat.map1.selfillumMapEnable = off
cmat.map1.selfillumMap = undefined
cmat.map1.useSelfIllumColor = off
cmat.map1.selfIllumColor = color 150 150 150
cmat.map1.Diffuse = color 150 150 150
cmat.map1.ambient = color 150 150 150
cmat.map2Enabled = off
cmat.map2.diffuseMapEnable = on
cmat.map2.selfillumMapEnable = off
cmat.map2.selfillumMap = undefined
cmat.map2.useSelfIllumColor = off
cmat.map2.selfIllumColor = color 150 150 150
cmat.map2.Diffuse = color 150 150 150
cmat.map2.ambient = color 150 150 150
)
)
)
-----------------------------------统一改场景材质球颜色脚本为zdepth(sw).ms--------------------------------------------
for i=1 to scenematerials.count do
(
cmat = scenematerials[i]
if (getClassName cmat) == "Standard" do
(
cmat.diffuseMapEnable = off
                cmat.selfillumMapEnable = on
                cmat.selfillumMap = falloff ()
                cmat.selfillumMap.type = 4
                cmat.selfillumMap.direction = 0
                cmat.selfillumMap.farDistance = 9000
                cmat.useSelfIllumColor = on
                cmat.selfIllumColor = color 0 0 0
                cmat.Diffuse = color 0 0 0
                cmat.ambient = color 0 0 0
)
if (getClassName cmat) == "Multi/Sub-Object" do
(
for j = 1 to cmat.numsubs do
if cmat[j] != undefined do
(
bmat = cmat[j]
bmat.diffuseMapEnable = off
               bmat.selfillumMapEnable = on
               bmat.selfillumMap = falloff ()
               bmat.selfillumMap.type = 4
               bmat.selfillumMap.direction = 0
               bmat.selfillumMap.farDistance = 9000
               bmat.useSelfIllumColor = on
               bmat.selfIllumColor = color 0 0 0
                bmat.Diffuse = color 0 0 0
               bmat.ambient = color 0 0 0
)
)
if (getClassName cmat) == "Blend" do
(
for h = 1 to cmat.numsubs do
if cmat[h] != undefined do
(
cmat.map1Enabled = on
cmat.map1.diffuseMapEnable = off
cmat.map1.selfillumMapEnable = on
cmat.map1.selfillumMap = falloff ()
cmat.map1.selfillumMap.type = 4
cmat.map1.selfillumMap.direction = 0
cmat.map1.selfillumMap.farDistance = 9000
cmat.map1.useSelfIllumColor = on
cmat.map1.selfIllumColor = color 0 0 0
cmat.map1.Diffuse = color 0 0 0
cmat.map1.ambient = color 0 0 0
cmat.map2Enabled = on
cmat.map2.diffuseMapEnable = off
cmat.map2.selfillumMapEnable = on
cmat.map2.selfillumMap = falloff ()
cmat.map2.selfillumMap.type = 4
cmat.map2.selfillumMap.direction = 0
cmat.map2.selfillumMap.farDistance = 9000
cmat.map2.useSelfIllumColor = on
cmat.map2.selfIllumColor = color 0 0 0
cmat.map2.Diffuse = color 0 0 0
cmat.map2.ambient = color 0 0 0
)
)
)
-------------------------- 统一改选择的材质球颜色脚本.ms(要把组都open,然后隐藏组框,选择里面的物体)-----------------------------------
for i=1 to $selection.count do
(
cmat = $selection[i].material
if (getClassName cmat) == "Standard" do
(
cmat.diffuseMapEnable = off
            cmat.selfillumMapEnable = on
cmat.selfillumMap = falloff ()
            cmat.selfillumMap.type = 4
            cmat.selfillumMap.direction = 0
            cmat.selfillumMap.farDistance = 9000
            cmat.useSelfIllumColor = on
            cmat.selfIllumColor = color 0 0 0
            cmat.Diffuse = color 0 0 0
            cmat.ambient = color 0 0 0
)
if (getClassName cmat) == "Multi/Sub-Object" do
(
for j = 1 to cmat.numsubs do
if cmat[j] != undefined do
(
bmat = cmat[j]
bmat.diffuseMapEnable = off
               bmat.selfillumMapEnable = on
               bmat.selfillumMap = falloff ()
               bmat.selfillumMap.type = 4
               bmat.selfillumMap.direction = 0
               bmat.selfillumMap.farDistance = 9000
               bmat.useSelfIllumColor = on
               bmat.selfIllumColor = color 0 0 0
                bmat.Diffuse = color 0 0 0
               bmat.ambient = color 0 0 0
)
)
if (getClassName cmat) == "Blend" do
(
for h = 1 to cmat.numsubs do
if cmat[h] != undefined do
(
cmat.map1Enabled = on
cmat.map1.diffuseMapEnable = off
cmat.map1.selfillumMapEnable = on
cmat.map1.selfillumMap = falloff ()
cmat.map1.selfillumMap.type = 4
cmat.map1.selfillumMap.direction = 0
cmat.map1.selfillumMap.farDistance = 9000
cmat.map1.useSelfIllumColor = on
cmat.map1.selfIllumColor = color 0 0 0
cmat.map1.Diffuse = color 0 0 0
cmat.map1.ambient = color 0 0 0
cmat.map2Enabled = on
cmat.map2.diffuseMapEnable = off
cmat.map2.selfillumMapEnable = on
cmat.map2.selfillumMap = falloff ()
cmat.map2.selfillumMap.type = 4
cmat.map2.selfillumMap.direction = 0
cmat.map2.selfillumMap.farDistance = 9000
cmat.map2.useSelfIllumColor = on
cmat.map2.selfIllumColor = color 0 0 0
cmat.map2.Diffuse = color 0 0 0
cmat.map2.ambient = color 0 0 0
)
)
)
8年前
回复

使用道具 举报

您当前使用的浏览器IE内核版本过低会导致网站显示错误

请使用高速内核浏览器或其他浏览器