Init
This commit is contained in:
639
03-UnrealEngine/卡通渲染相关资料/渲染功能/描边/NomalEditor.mel
Normal file
639
03-UnrealEngine/卡通渲染相关资料/渲染功能/描边/NomalEditor.mel
Normal file
@@ -0,0 +1,639 @@
|
||||
global proc VertexColorToNormalCommand(int $num)
|
||||
{
|
||||
if($num == 1)
|
||||
{
|
||||
string $colorSetsMenuItems[] = `optionMenu -q -ill VertexColorToNormalCurrentColorSet_optionMenu1`;
|
||||
if(size($colorSetsMenuItems))
|
||||
{
|
||||
deleteUI $colorSetsMenuItems;
|
||||
}
|
||||
|
||||
string $allColorSets[] = `polyColorSet -q -acs`;
|
||||
if(size($allColorSets)>0)
|
||||
{
|
||||
for($name in $allColorSets)
|
||||
{
|
||||
menuItem -label $name -p VertexColorToNormalCurrentColorSet_optionMenu1 ;
|
||||
}
|
||||
}
|
||||
string $CurrentColorSets[] = `polyColorSet -q -ccs`;
|
||||
if(size($CurrentColorSets))
|
||||
{
|
||||
optionMenu -e -v $CurrentColorSets[0] VertexColorToNormalCurrentColorSet_optionMenu1;
|
||||
}
|
||||
}
|
||||
if($num == 2)
|
||||
{
|
||||
string $setName = `textField -q -tx VertexColorToNormalCreateColorSet_textField1`;
|
||||
if(size($setName))
|
||||
{
|
||||
polyColorSet -cr -cla 0 -rpt RGBA -cs $setName;
|
||||
}
|
||||
else
|
||||
{
|
||||
polyColorSet -cr -cla 0 -rpt RGBA -cs "colorSet" ;
|
||||
}
|
||||
VertexColorToNormalCommand 1;
|
||||
}
|
||||
if($num == 3)
|
||||
{
|
||||
string $currentVtxColorSet = `optionMenu -q -v VertexColorToNormalCurrentColorSet_optionMenu1`;
|
||||
if(size($currentVtxColorSet))
|
||||
{
|
||||
polyColorSet -delete -colorSet $currentVtxColorSet;
|
||||
VertexColorToNormalCommand 1;
|
||||
}
|
||||
}
|
||||
if($num == 4)
|
||||
{
|
||||
if(size(`ls -sl`))
|
||||
{
|
||||
PolySelectConvert 3;
|
||||
}
|
||||
string $selVtx[] = `ls -sl -fl`;
|
||||
progressWindow -t "ִ<>н<EFBFBD><D0BD><EFBFBD>:" -pr 0 -st "<22><>ǰ<EFBFBD><C7B0><EFBFBD>ȣ<EFBFBD> 0%" -ii 1 -max (size($selVtx));
|
||||
//for($name in $selVtx)
|
||||
for($i=0;$i<size($selVtx);$i++)
|
||||
{
|
||||
if ( `progressWindow -query -isCancelled` ) break;
|
||||
if ( `progressWindow -query -progress` >= (size($selVtx)) ) break;
|
||||
|
||||
float $vtxColor[] = `polyColorPerVertex -q -rgb $selVtx[$i]`;
|
||||
polyNormalPerVertex -xyz $vtxColor[0] $vtxColor[1] $vtxColor[2] $selVtx[$i];
|
||||
|
||||
progressWindow -e -pr $i -st ("<22><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>: "+($i/(size($selVtx)))+"%");
|
||||
}
|
||||
progressWindow -ep;
|
||||
}
|
||||
if($num == 5)
|
||||
{
|
||||
if(size(`ls -sl`))
|
||||
{
|
||||
PolySelectConvert 3;
|
||||
}
|
||||
string $selVtx[] = `ls -sl -fl`;
|
||||
progressWindow -t "ִ<>н<EFBFBD><D0BD><EFBFBD>:" -pr 0 -st "<22><>ǰ<EFBFBD><C7B0><EFBFBD>ȣ<EFBFBD> 0%" -ii 1 -max (size($selVtx));
|
||||
//for($name in $selVtx)
|
||||
for($i=0;$i<size($selVtx);$i++)
|
||||
{
|
||||
if ( `progressWindow -query -isCancelled` ) break;
|
||||
if ( `progressWindow -query -progress` >= (size($selVtx)) ) break;
|
||||
|
||||
float $vtxVector[] = `polyNormalPerVertex -q -xyz $selVtx[$i]`;
|
||||
polyColorPerVertex -rgb $vtxVector[0] $vtxVector[1] $vtxVector[2] $selVtx[$i];
|
||||
|
||||
progressWindow -e -pr $i -st ("<22><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>: "+($i/(size($selVtx)))+"%");
|
||||
}
|
||||
progressWindow -ep;
|
||||
}
|
||||
}
|
||||
/*
|
||||
global proc smoothNomalCommand()
|
||||
{
|
||||
|
||||
if(size(`ls -sl`))
|
||||
{
|
||||
PolySelectConvert 3;
|
||||
}
|
||||
string $selvtx[] = `ls -sl -fl`;
|
||||
float $smoothNum = `floatSliderGrp -q -v nomalSmoothSet_floatSliderGrp1`;
|
||||
for($i=0;$i<size($selvtx);$i++)
|
||||
{
|
||||
select -r $selvtx[$i];
|
||||
polySelectConstraint -pp 1 -t 0x0001;
|
||||
string $result[] = `ls -sl -fl`;
|
||||
float $interimVector[];
|
||||
for($ii=0;$ii<size($result);$ii++)
|
||||
{
|
||||
float $interimVector1[] = `polyNormalPerVertex -q -xyz $result[$ii]`;
|
||||
$interimVector[0] = $interimVector[0] + $interimVector1[0];
|
||||
$interimVector[1] = $interimVector[1] + $interimVector1[1];
|
||||
$interimVector[2] = $interimVector[2] + $interimVector1[2];
|
||||
}
|
||||
$interimVector[0] = $interimVector[0]/size($result);
|
||||
$interimVector[1] = $interimVector[1]/size($result);
|
||||
$interimVector[2] = $interimVector[2]/size($result);
|
||||
for($ii=0;$ii<size($result);$ii++)
|
||||
{
|
||||
float $interimVector1[] = `polyNormalPerVertex -q -xyz $result[$ii]`;
|
||||
polyNormalPerVertex -xyz ($interimVector[0]*$smoothNum + $interimVector1[0]*(1-$smoothNum))
|
||||
($interimVector[1]*$smoothNum + $interimVector1[1]*(1-$smoothNum))
|
||||
($interimVector[2]*$smoothNum + $interimVector1[2]*(1-$smoothNum)) $result[$ii];
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
select -r $selvtx;
|
||||
}
|
||||
*/
|
||||
global proc smoothNomalCommand()
|
||||
{
|
||||
|
||||
if(size(`ls -sl`))
|
||||
{
|
||||
PolySelectConvert 3;
|
||||
}
|
||||
string $selvtx[] = `ls -sl -fl`;
|
||||
float $smoothNum = `floatSliderGrp -q -v nomalSmoothSet_floatSliderGrp1`;
|
||||
progressWindow -t "ִ<>н<EFBFBD><D0BD><EFBFBD>:" -pr 0 -st "<22><>ǰ<EFBFBD><C7B0><EFBFBD>ȣ<EFBFBD> 0%" -ii 1 -max (size($selvtx));
|
||||
for($i=0;$i<size($selvtx);$i++)
|
||||
{
|
||||
if ( `progressWindow -query -isCancelled` ) break;
|
||||
if ( `progressWindow -query -progress` >= (size($selvtx)) ) break;
|
||||
|
||||
select -r $selvtx[$i];
|
||||
polySelectConstraint -pp 1 -t 0x0001;
|
||||
string $result[] = `ls -sl -fl`;
|
||||
float $interimVector[];
|
||||
for($ii=0;$ii<size($result);$ii++)
|
||||
{
|
||||
float $interimVector1[] = `polyNormalPerVertex -q -xyz $result[$ii]`;
|
||||
float $interimAveVector[] = `getAverageNormal $interimVector1`;
|
||||
|
||||
$interimVector[0] = $interimVector[0] + $interimAveVector[0];
|
||||
$interimVector[1] = $interimVector[1] + $interimAveVector[1];
|
||||
$interimVector[2] = $interimVector[2] + $interimAveVector[2];
|
||||
}
|
||||
$interimVector[0] = $interimVector[0]/size($result);
|
||||
$interimVector[1] = $interimVector[1]/size($result);
|
||||
$interimVector[2] = $interimVector[2]/size($result);
|
||||
float $interimVector1[] = `polyNormalPerVertex -q -xyz $selvtx[$i]`;
|
||||
float $interimAveVector1[] = `getAverageNormal $interimVector1`;
|
||||
polyNormalPerVertex -xyz ($interimVector[0]*$smoothNum + $interimAveVector1[0]*(1-$smoothNum))
|
||||
($interimVector[1]*$smoothNum + $interimAveVector1[1]*(1-$smoothNum))
|
||||
($interimVector[2]*$smoothNum + $interimAveVector1[2]*(1-$smoothNum)) $selvtx[$i];
|
||||
|
||||
progressWindow -e -pr $i -st ("<22><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>: "+($i/(size($selvtx)))+"%");
|
||||
}
|
||||
progressWindow -ep;
|
||||
select -r $selvtx;
|
||||
}
|
||||
global proc float [] getAverageNormal(float $getNormalXYZ[])
|
||||
{
|
||||
float $interimAveVector1[];
|
||||
clear $interimAveVector1;
|
||||
for($i=0;$i<size($getNormalXYZ);$i+=3)
|
||||
{
|
||||
$interimAveVector1[0] += $getNormalXYZ[$i];
|
||||
$interimAveVector1[1] += $getNormalXYZ[$i+1];
|
||||
$interimAveVector1[2] += $getNormalXYZ[$i+2];
|
||||
}
|
||||
$interimAveVector1[0] = $interimAveVector1[0]*3/size($getNormalXYZ);
|
||||
$interimAveVector1[1] = $interimAveVector1[1]*3/size($getNormalXYZ);
|
||||
$interimAveVector1[2] = $interimAveVector1[2]*3/size($getNormalXYZ);
|
||||
return $interimAveVector1;
|
||||
}
|
||||
|
||||
global proc nomalOffsetSpherizeCommand(int $num)
|
||||
{
|
||||
if(size(`ls -sl`))
|
||||
{
|
||||
PolySelectConvert 3;
|
||||
}
|
||||
string $sel[] = `ls -sl -fl`;
|
||||
float $nomalOffsetSpherizeValue = `floatSliderGrp -q -v nomalOffsetSpherizeNum_floatSliderGrp1`;
|
||||
float $worldPossition[];
|
||||
if(`objExists "nomalSpherizeLocator"`)
|
||||
{
|
||||
$worldPossition = `xform -q -t nomalSpherizeLocator`;
|
||||
}
|
||||
|
||||
if($num == 1)
|
||||
{
|
||||
float $possition[];
|
||||
if(`objExists "nomalSpherizeLocator"`)
|
||||
{
|
||||
delete nomalSpherizeLocator;
|
||||
}
|
||||
|
||||
if(size($sel))
|
||||
{
|
||||
string $ncluster[] = `newCluster " -envelope 1"`;
|
||||
string $nclusterShapes[] = `listRelatives -s $ncluster[1]`;
|
||||
$possition = `getAttr cluster1HandleShape.origin`;
|
||||
delete $ncluster;
|
||||
}
|
||||
spaceLocator -n "nomalSpherizeLocator";
|
||||
xform -t $possition[0] $possition[1] $possition[2] nomalSpherizeLocator;
|
||||
}
|
||||
else if($num == 11)
|
||||
{
|
||||
if(`objExists "nomalSpherizeLocator"`)
|
||||
{
|
||||
delete nomalSpherizeLocator;
|
||||
}
|
||||
}
|
||||
|
||||
else if($num == 2)
|
||||
{
|
||||
progressWindow -t "ִ<>н<EFBFBD><D0BD><EFBFBD>:" -pr 0 -st "<22><>ǰ<EFBFBD><C7B0><EFBFBD>ȣ<EFBFBD> 0%" -ii 1 -max (size($sel));
|
||||
for($i=0;$i<size($sel);$i++)
|
||||
{
|
||||
if ( `progressWindow -query -isCancelled` ) break;
|
||||
if ( `progressWindow -query -progress` >= (size($sel)) ) break;
|
||||
|
||||
float $pointPossition[] = `pointPosition -w $sel[$i]`;
|
||||
float $bigVector[],$SpherizeVector[];
|
||||
$bigVector[0] = $pointPossition[0] - $worldPossition[0];
|
||||
$bigVector[1] = $pointPossition[1] - $worldPossition[1];
|
||||
$bigVector[2] = $pointPossition[2] - $worldPossition[2];
|
||||
|
||||
float $max;
|
||||
if(abs($bigVector[0])>abs($bigVector[1]))
|
||||
{
|
||||
$max = abs($bigVector[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
$max = abs($bigVector[1]);
|
||||
}
|
||||
if($max<abs($bigVector[2]))
|
||||
{
|
||||
$max = abs($bigVector[2]);
|
||||
}
|
||||
$SpherizeVector[0] = $bigVector[0]/$max;
|
||||
$SpherizeVector[1] = $bigVector[1]/$max;
|
||||
$SpherizeVector[2] = $bigVector[2]/$max;
|
||||
float $oldVector[] = `polyNormalPerVertex -q -xyz $sel[$i]`;
|
||||
polyNormalPerVertex -xyz ($oldVector[0]*(1-$nomalOffsetSpherizeValue)+$SpherizeVector[0]*$nomalOffsetSpherizeValue)
|
||||
($oldVector[1]*(1-$nomalOffsetSpherizeValue)+$SpherizeVector[1]*$nomalOffsetSpherizeValue)
|
||||
($oldVector[2]*(1-$nomalOffsetSpherizeValue)+$SpherizeVector[2]*$nomalOffsetSpherizeValue) $sel[$i];
|
||||
|
||||
progressWindow -e -pr $i -st ("<22><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>: "+($i/(size($sel)))+"%");
|
||||
}
|
||||
progressWindow -ep;
|
||||
}
|
||||
else if($num == 3)
|
||||
{
|
||||
progressWindow -t "ִ<>н<EFBFBD><D0BD><EFBFBD>:" -pr 0 -st "<22><>ǰ<EFBFBD><C7B0><EFBFBD>ȣ<EFBFBD> 0%" -ii 1 -max (size($sel));
|
||||
for($i=0;$i<size($sel);$i++)
|
||||
{
|
||||
if ( `progressWindow -query -isCancelled` ) break;
|
||||
if ( `progressWindow -query -progress` >= (size($sel)) ) break;
|
||||
|
||||
float $pointPossition[] = `pointPosition -w $sel[$i]`;
|
||||
float $bigVector[],$SpherizeVector[];
|
||||
$bigVector[0] = $pointPossition[0] - $worldPossition[0];
|
||||
$bigVector[1] = $pointPossition[1] - $worldPossition[1];
|
||||
$bigVector[2] = $pointPossition[2] - $worldPossition[2];
|
||||
|
||||
float $max;
|
||||
if(abs($bigVector[0])>abs($bigVector[1]))
|
||||
{
|
||||
$max = abs($bigVector[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
$max = abs($bigVector[1]);
|
||||
}
|
||||
if($max<abs($bigVector[2]))
|
||||
{
|
||||
$max = abs($bigVector[2]);
|
||||
}
|
||||
$SpherizeVector[0] = $bigVector[0]/$max;
|
||||
$SpherizeVector[1] = $bigVector[1]/$max;
|
||||
$SpherizeVector[2] = $bigVector[2]/$max;
|
||||
float $oldVector[] = `polyNormalPerVertex -q -xyz $sel[$i]`;
|
||||
polyNormalPerVertex -xyz ($oldVector[0]-$SpherizeVector[0]*$nomalOffsetSpherizeValue)
|
||||
($oldVector[1]-$SpherizeVector[1]*$nomalOffsetSpherizeValue)
|
||||
($oldVector[2]-$SpherizeVector[2]*$nomalOffsetSpherizeValue) $sel[$i];
|
||||
|
||||
progressWindow -e -pr $i -st ("<22><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>: "+($i/(size($sel)))+"%");
|
||||
}
|
||||
progressWindow -ep;
|
||||
}
|
||||
}
|
||||
|
||||
global proc nomalOffsetxyzCommand(int $num)
|
||||
{
|
||||
int $EditMode = `radioButtonGrp -q -sl nomalOffset_radioButtonGrp1`;
|
||||
float $EditValue = `floatSliderGrp -q -v nomalOffsetNum_floatSliderGrp1`;
|
||||
if(size(`ls -sl`))
|
||||
{
|
||||
PolySelectConvert 3;
|
||||
}
|
||||
string $sel[] = `ls -sl -fl`;
|
||||
if($num == 1)
|
||||
{
|
||||
progressWindow -t "ִ<>н<EFBFBD><D0BD><EFBFBD>:" -pr 0 -st "<22><>ǰ<EFBFBD><C7B0><EFBFBD>ȣ<EFBFBD> 0%" -ii 1 -max (size($sel));
|
||||
for($i=0;$i<size($sel);$i++)
|
||||
{
|
||||
if ( `progressWindow -query -isCancelled` ) break;
|
||||
if ( `progressWindow -query -progress` >= (size($sel)) ) break;
|
||||
|
||||
if(`match ".vtx" $sel[$i]`!=".vtx")
|
||||
{
|
||||
warning -n "===<3D><>Ҫѡ<D2AA><D1A1>ģ<EFBFBD>͵<EFBFBD><CDB5>ٽ<EFBFBD><D9BD>в<EFBFBD><D0B2><EFBFBD>===";
|
||||
break;
|
||||
}
|
||||
|
||||
float $lkdasfljasdfje[] = `polyNormalPerVertex -q -xyz $sel[$i]`;
|
||||
if($EditMode == 1)
|
||||
{
|
||||
polyNormalPerVertex -xyz ($lkdasfljasdfje[0] + $EditValue) $lkdasfljasdfje[1] $lkdasfljasdfje[2] $sel[$i];
|
||||
}
|
||||
else if($EditMode == 2)
|
||||
{
|
||||
polyNormalPerVertex -xyz ($lkdasfljasdfje[0] * (1+$EditValue)) $lkdasfljasdfje[1] $lkdasfljasdfje[2] $sel[$i];
|
||||
}
|
||||
progressWindow -e -pr $i -st ("<22><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>: "+($i/(size($sel)))+"%");
|
||||
}
|
||||
progressWindow -ep;
|
||||
}
|
||||
else if($num == 2)
|
||||
{
|
||||
progressWindow -t "ִ<>н<EFBFBD><D0BD><EFBFBD>:" -pr 0 -st "<22><>ǰ<EFBFBD><C7B0><EFBFBD>ȣ<EFBFBD> 0%" -ii 1 -max (size($sel));
|
||||
for($i=0;$i<size($sel);$i++)
|
||||
{
|
||||
|
||||
if ( `progressWindow -query -isCancelled` ) break;
|
||||
if ( `progressWindow -query -progress` >= (size($sel)) ) break;
|
||||
|
||||
if(`match ".vtx" $sel[$i]`!=".vtx")
|
||||
{
|
||||
warning -n "===<3D><>Ҫѡ<D2AA><D1A1>ģ<EFBFBD>͵<EFBFBD><CDB5>ٽ<EFBFBD><D9BD>в<EFBFBD><D0B2><EFBFBD>===";
|
||||
break;
|
||||
}
|
||||
|
||||
float $lkdasfljasdfje[] = `polyNormalPerVertex -q -xyz $sel[$i]`;
|
||||
if($EditMode == 1)
|
||||
{
|
||||
polyNormalPerVertex -xyz $lkdasfljasdfje[0] ($lkdasfljasdfje[1] + $EditValue) $lkdasfljasdfje[2] $sel[$i];
|
||||
}
|
||||
else if($EditMode == 2)
|
||||
{
|
||||
polyNormalPerVertex -xyz $lkdasfljasdfje[0] ($lkdasfljasdfje[1] * (1+$EditValue)) $lkdasfljasdfje[2] $sel[$i];
|
||||
}
|
||||
progressWindow -e -pr $i -st ("<22><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>: "+($i/(size($sel)))+"%");
|
||||
}
|
||||
progressWindow -ep;
|
||||
}
|
||||
else if($num == 3)
|
||||
{
|
||||
progressWindow -t "ִ<>н<EFBFBD><D0BD><EFBFBD>:" -pr 0 -st "<22><>ǰ<EFBFBD><C7B0><EFBFBD>ȣ<EFBFBD> 0%" -ii 1 -max (size($sel));
|
||||
for($i=0;$i<size($sel);$i++)
|
||||
{
|
||||
if ( `progressWindow -query -isCancelled` ) break;
|
||||
if ( `progressWindow -query -progress` >= (size($sel)) ) break;
|
||||
|
||||
if(`match ".vtx" $sel[$i]`!=".vtx")
|
||||
{
|
||||
warning -n "===<3D><>Ҫѡ<D2AA><D1A1>ģ<EFBFBD>͵<EFBFBD><CDB5>ٽ<EFBFBD><D9BD>в<EFBFBD><D0B2><EFBFBD>===";
|
||||
break;
|
||||
}
|
||||
|
||||
float $lkdasfljasdfje[] = `polyNormalPerVertex -q -xyz $sel[$i]`;
|
||||
if($EditMode == 1)
|
||||
{
|
||||
polyNormalPerVertex -xyz $lkdasfljasdfje[0] $lkdasfljasdfje[1] ($lkdasfljasdfje[2] + $EditValue) $sel[$i];
|
||||
}
|
||||
else if($EditMode == 2)
|
||||
{
|
||||
polyNormalPerVertex -xyz $lkdasfljasdfje[0] $lkdasfljasdfje[1] ($lkdasfljasdfje[2] * (1+$EditValue)) $sel[$i];
|
||||
}
|
||||
progressWindow -e -pr $i -st ("<22><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>: "+($i/(size($sel)))+"%");
|
||||
}
|
||||
progressWindow -ep;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
global proc EditVertixNomalUI()
|
||||
{
|
||||
if(`window -ex EditVertixNomalWin`)
|
||||
{
|
||||
deleteUI EditVertixNomalWin;
|
||||
}
|
||||
window -t "<22><>֮<EFBFBD><D6AE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߱༭<DFB1><E0BCAD><EFBFBD><EFBFBD>V1.0" EditVertixNomalWin;
|
||||
window -e -wh 400 646 EditVertixNomalWin;
|
||||
columnLayout -adj 1 -bgc 0.18 0.18 0.18 EditVertixNomalMain_columnLayout1;
|
||||
separator -h 10 EditVertixNomal_separator0;
|
||||
text -l "<22><><EFBFBD><EFBFBD>ƫ<EFBFBD><C6AB>" -bgc 0 0 0 nomalOffset_text1;
|
||||
|
||||
separator -h 10 EditVertixNomal_separator1;
|
||||
|
||||
formLayout -nd 100 nomalOffset_formLayout1;
|
||||
radioButtonGrp -nrb 2 -l "<22>㷨" -la2 "<22><>" "<22><>" -cal 1 "center" -sl 1 nomalOffset_radioButtonGrp1;
|
||||
|
||||
floatSliderGrp -l "<22><><EFBFBD><EFBFBD>:" -f true -cal 1 "center"
|
||||
-min -1.0 -max 1.0 -fmn -10.0 -fmx 10.0 -v 0.2
|
||||
-s 0.01 nomalOffsetNum_floatSliderGrp1;
|
||||
|
||||
button -l "X" -c "nomalOffsetxyzCommand 1;" nomalOffsetx_button1;
|
||||
button -l "Y" -c "nomalOffsetxyzCommand 2;" nomalOffsety_button1;
|
||||
button -l "Z" -c "nomalOffsetxyzCommand 3;" nomalOffsetz_button1;
|
||||
|
||||
formLayout -e
|
||||
-af nomalOffset_radioButtonGrp1 "left" 1
|
||||
-af nomalOffset_radioButtonGrp1 "right" 1
|
||||
|
||||
-af nomalOffsetNum_floatSliderGrp1 "left" 1
|
||||
-af nomalOffsetNum_floatSliderGrp1 "right" 1
|
||||
-ac nomalOffsetNum_floatSliderGrp1 "top" 5 nomalOffset_radioButtonGrp1
|
||||
|
||||
-af nomalOffsetx_button1 "left" 1
|
||||
-ap nomalOffsetx_button1 "right" 3 33
|
||||
-ac nomalOffsetx_button1 "top" 5 nomalOffsetNum_floatSliderGrp1
|
||||
|
||||
-ac nomalOffsety_button1 "left" 3 nomalOffsetx_button1
|
||||
-ap nomalOffsety_button1 "right" 3 66
|
||||
-ac nomalOffsety_button1 "top" 5 nomalOffsetNum_floatSliderGrp1
|
||||
|
||||
-ac nomalOffsetz_button1 "left" 3 nomalOffsety_button1
|
||||
-af nomalOffsetz_button1 "right" 1
|
||||
-ac nomalOffsetz_button1 "top" 5 nomalOffsetNum_floatSliderGrp1
|
||||
|
||||
nomalOffset_formLayout1;
|
||||
|
||||
setParent EditVertixNomalMain_columnLayout1;
|
||||
separator -h 10 EditVertixNomal_separator2;
|
||||
|
||||
text -l "<22><><EFBFBD>䷨<EFBFBD><E4B7A8>" -bgc 0 0 0 nomalOffsetSpherize_text1;
|
||||
separator -h 10 EditVertixNomal_separator3;
|
||||
formLayout -nd 100 nomalOffsetSpherize_formLayout1;
|
||||
|
||||
button -l "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" -c "nomalOffsetSpherizeCommand 1" -ann "<22><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD>Ķ<EFBFBD>λ<EFBFBD>Ķ<EFBFBD>λ<EFBFBD><CEBB>" createNormalCenter_button1;
|
||||
button -l "ɾ<><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" -c "nomalOffsetSpherizeCommand 11" deleteNormalCenter_button1;
|
||||
|
||||
floatSliderGrp -l "<22><><EFBFBD><EFBFBD>:" -f true -cal 1 "center"
|
||||
-min 0 -max 1.0 -fmn 0 -fmx 1 -v 0.2
|
||||
-s 0.01 nomalOffsetSpherizeNum_floatSliderGrp1;
|
||||
|
||||
button -l "<22><><EFBFBD><EFBFBD>" -c "nomalOffsetSpherizeCommand 2" aggregationVertixNomal_button1;
|
||||
button -l "<22><>£" -c "nomalOffsetSpherizeCommand 3" dispersedVertixNomal_button1;
|
||||
|
||||
formLayout -e
|
||||
|
||||
-af createNormalCenter_button1 "left" 1
|
||||
-ap createNormalCenter_button1 "right" 3 50
|
||||
|
||||
-ac deleteNormalCenter_button1 "left" 3 createNormalCenter_button1
|
||||
-af deleteNormalCenter_button1 "right" 1
|
||||
|
||||
-af nomalOffsetSpherizeNum_floatSliderGrp1 "left" 1
|
||||
-af nomalOffsetSpherizeNum_floatSliderGrp1 "right" 1
|
||||
-ac nomalOffsetSpherizeNum_floatSliderGrp1 "top" 1 createNormalCenter_button1
|
||||
|
||||
-af aggregationVertixNomal_button1 "left" 1
|
||||
-ap aggregationVertixNomal_button1 "right" 3 50
|
||||
-ac aggregationVertixNomal_button1 "top" 1 nomalOffsetSpherizeNum_floatSliderGrp1
|
||||
|
||||
-ac dispersedVertixNomal_button1 "left" 3 aggregationVertixNomal_button1
|
||||
-af dispersedVertixNomal_button1 "right" 1
|
||||
-ac dispersedVertixNomal_button1 "top" 1 nomalOffsetSpherizeNum_floatSliderGrp1
|
||||
|
||||
nomalOffsetSpherize_formLayout1;
|
||||
|
||||
setParent EditVertixNomalMain_columnLayout1;
|
||||
separator -h 10 EditVertixNomal_separator4;
|
||||
|
||||
text -l "ƽ<><C6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" -bgc 0 0 0 nomalSmoothSet_text1;
|
||||
|
||||
separator -h 10 EditVertixNomal_separator5;
|
||||
formLayout -nd 100 nomalSmoothSet_formLayout1;
|
||||
|
||||
floatSliderGrp -l "<22><><EFBFBD><EFBFBD>:" -f true -cal 1 "center"
|
||||
-min 0 -max 1.0 -fmn 0 -fmx 1 -v 0.2
|
||||
-s 0.01 nomalSmoothSet_floatSliderGrp1;
|
||||
|
||||
button -l "ƽ<><C6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" -c "smoothNomalCommand" nomalSmoothSet_button1;
|
||||
|
||||
formLayout -e
|
||||
|
||||
-af nomalSmoothSet_floatSliderGrp1 "left" 1
|
||||
-af nomalSmoothSet_floatSliderGrp1 "right" 1
|
||||
|
||||
-af nomalSmoothSet_button1 "left" 1
|
||||
-af nomalSmoothSet_button1 "right" 1
|
||||
-ac nomalSmoothSet_button1 "top" 5 nomalSmoothSet_floatSliderGrp1
|
||||
|
||||
nomalSmoothSet_formLayout1;
|
||||
|
||||
|
||||
setParent EditVertixNomalMain_columnLayout1;
|
||||
separator -h 10 EditVertixNomal_separator6;
|
||||
|
||||
formLayout -nd 100 nomalOffsetReset_formLayout1;
|
||||
button -l "<22><><EFBFBD><EFBFBD>" -c "polySetToFaceNormal" nomalOffsetReset_button1;
|
||||
button -l "<22><><EFBFBD><EFBFBD>" -c "polyAverageNormal -d 0" nomalOffsetSmooth_button1;
|
||||
button -l "<22><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>" -c "polyOptions -dn 1 -pt" disPlayNormal_button1;
|
||||
button -l "<22><><EFBFBD>ط<EFBFBD><D8B7><EFBFBD>" -c "polyOptions -dn 0 -pt" hideNormal_button1;
|
||||
floatSliderGrp -l "<22><><EFBFBD>߳<EFBFBD><DFB3><EFBFBD>:" -f true -cal 1 "center"
|
||||
-min 0 -max 10.0 -fmn 0 -fmx 10 -v 0.3
|
||||
-s 0.01 -cc ("polyOptions -activeObjects -sizeNormal `floatSliderGrp -q -v nomalSizeSet_floatSliderGrp1`") nomalSizeSet_floatSliderGrp1;
|
||||
|
||||
formLayout -e
|
||||
|
||||
-af nomalOffsetReset_button1 "left" 1
|
||||
-ap nomalOffsetReset_button1 "right" 3 50
|
||||
|
||||
-ac nomalOffsetSmooth_button1 "left" 3 nomalOffsetReset_button1
|
||||
-af nomalOffsetSmooth_button1 "right" 1
|
||||
|
||||
-af nomalSizeSet_floatSliderGrp1 "left" 1
|
||||
-af nomalSizeSet_floatSliderGrp1 "right" 1
|
||||
-ac nomalSizeSet_floatSliderGrp1 "top" 3 nomalOffsetSmooth_button1
|
||||
|
||||
-af disPlayNormal_button1 "left" 1
|
||||
-ap disPlayNormal_button1 "right" 3 50
|
||||
-ac disPlayNormal_button1 "top" 3 nomalSizeSet_floatSliderGrp1
|
||||
|
||||
-ac hideNormal_button1 "left" 3 disPlayNormal_button1
|
||||
-af hideNormal_button1 "right" 1
|
||||
-ac hideNormal_button1 "top" 3 nomalSizeSet_floatSliderGrp1
|
||||
|
||||
|
||||
|
||||
nomalOffsetReset_formLayout1;
|
||||
|
||||
setParent EditVertixNomalMain_columnLayout1;
|
||||
|
||||
separator -h 10 EditVertixNomal_separator7;
|
||||
|
||||
text -l "<22><><EFBFBD><EFBFBD>ɫ <=> <20><><EFBFBD><EFBFBD>" -bgc 0 0 0 VertexColorToNormal_text1;
|
||||
|
||||
formLayout -nd 100 VertexColorToNormal_formLayout1;
|
||||
|
||||
separator -h 10 VertexColorToNormalCurrentColorSet_separator1;
|
||||
|
||||
optionMenu -l "<22><>ǰɫ<C7B0><C9AB>" -cc ("polyColorSet -ccs -cs `optionMenu -q -v VertexColorToNormalCurrentColorSet_optionMenu1`") VertexColorToNormalCurrentColorSet_optionMenu1;
|
||||
button -l "ˢ<><CBA2>" -c "VertexColorToNormalCommand 1" VertexColorToNormalRefreshColorSet_button1;
|
||||
|
||||
text -l "<22><><EFBFBD><EFBFBD>" VertexColorToNormalCreateColorSet_text1;
|
||||
textField -text "" VertexColorToNormalCreateColorSet_textField1;
|
||||
button -l "<22>½<EFBFBD>ɫ<EFBFBD><C9AB>" -c "VertexColorToNormalCommand 2" VertexColorToNormalCreateColorSet_button1;
|
||||
|
||||
button -l "ɾ<><C9BE><EFBFBD><EFBFBD>ǰɫ<C7B0><C9AB>" -c "VertexColorToNormalCommand 3" VertexColorToNormalDeleteColorSet_button1;
|
||||
|
||||
separator -h 10 VertexColorToNormalCurrentColorSet_separator2;
|
||||
|
||||
button -l "<22><><EFBFBD>ƶ<EFBFBD><C6B6><EFBFBD>ɫ" -c "PaintVertexColorTool" VertexColorToNormalDrawVertexColor_button1;
|
||||
|
||||
button -l "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" -c "toolPropertyWindow" VertexColorToNormalDrawVertexToolSet_button1;
|
||||
|
||||
button -l "<22><><EFBFBD><EFBFBD>ɫ=><3E><><EFBFBD><EFBFBD>" -c "VertexColorToNormalCommand 4" VertexColorToNormalConvertToNormal_button1;
|
||||
|
||||
button -l "<22><><EFBFBD><EFBFBD>=><3E><><EFBFBD><EFBFBD>ɫ" -c "VertexColorToNormalCommand 5" VertexColorToNormalConvertToVertexColor_button1;
|
||||
|
||||
separator -h 10 VertexColorToNormalCurrentColorSet_separator3;
|
||||
|
||||
formLayout -e
|
||||
|
||||
-af VertexColorToNormalCurrentColorSet_separator1 "left" 1
|
||||
-af VertexColorToNormalCurrentColorSet_separator1 "right" 1
|
||||
|
||||
-af VertexColorToNormalCurrentColorSet_optionMenu1 "left" 1
|
||||
-af VertexColorToNormalCurrentColorSet_optionMenu1 "right" 100
|
||||
-ac VertexColorToNormalCurrentColorSet_optionMenu1 "top" 5 VertexColorToNormalCurrentColorSet_separator1
|
||||
|
||||
-ac VertexColorToNormalRefreshColorSet_button1 "left" 3 VertexColorToNormalCurrentColorSet_optionMenu1
|
||||
-af VertexColorToNormalRefreshColorSet_button1 "right" 1
|
||||
-ac VertexColorToNormalRefreshColorSet_button1 "top" 5 VertexColorToNormalCurrentColorSet_separator1
|
||||
|
||||
-af VertexColorToNormalCreateColorSet_textField1 "left" 55
|
||||
-af VertexColorToNormalCreateColorSet_textField1 "right" 100
|
||||
-ac VertexColorToNormalCreateColorSet_textField1 "top" 5 VertexColorToNormalCurrentColorSet_optionMenu1
|
||||
|
||||
-af VertexColorToNormalCreateColorSet_text1 "left" 1
|
||||
-ac VertexColorToNormalCreateColorSet_text1 "right" 3 VertexColorToNormalCreateColorSet_textField1
|
||||
-ac VertexColorToNormalCreateColorSet_text1 "top" 5 VertexColorToNormalCurrentColorSet_optionMenu1
|
||||
|
||||
-ac VertexColorToNormalCreateColorSet_button1 "left" 3 VertexColorToNormalCreateColorSet_textField1
|
||||
-af VertexColorToNormalCreateColorSet_button1 "right" 1
|
||||
-ac VertexColorToNormalCreateColorSet_button1 "top" 5 VertexColorToNormalCurrentColorSet_optionMenu1
|
||||
|
||||
-af VertexColorToNormalDeleteColorSet_button1 "left" 1
|
||||
-af VertexColorToNormalDeleteColorSet_button1 "right" 1
|
||||
-ac VertexColorToNormalDeleteColorSet_button1 "top" 5 VertexColorToNormalCreateColorSet_button1
|
||||
|
||||
-af VertexColorToNormalCurrentColorSet_separator2 "left" 1
|
||||
-af VertexColorToNormalCurrentColorSet_separator2 "right" 1
|
||||
-ac VertexColorToNormalCurrentColorSet_separator2 "top" 1 VertexColorToNormalDeleteColorSet_button1
|
||||
|
||||
-af VertexColorToNormalDrawVertexColor_button1 "left" 1
|
||||
-ap VertexColorToNormalDrawVertexColor_button1 "right" 3 50
|
||||
-ac VertexColorToNormalDrawVertexColor_button1 "top" 5 VertexColorToNormalCurrentColorSet_separator2
|
||||
|
||||
-ac VertexColorToNormalDrawVertexToolSet_button1 "left" 3 VertexColorToNormalDrawVertexColor_button1
|
||||
-af VertexColorToNormalDrawVertexToolSet_button1 "right" 1
|
||||
-ac VertexColorToNormalDrawVertexToolSet_button1 "top" 5 VertexColorToNormalCurrentColorSet_separator2
|
||||
|
||||
-af VertexColorToNormalConvertToNormal_button1 "left" 1
|
||||
-ap VertexColorToNormalConvertToNormal_button1 "right" 3 50
|
||||
-ac VertexColorToNormalConvertToNormal_button1 "top" 5 VertexColorToNormalDrawVertexToolSet_button1
|
||||
|
||||
-ac VertexColorToNormalConvertToVertexColor_button1 "left" 3 VertexColorToNormalConvertToNormal_button1
|
||||
-af VertexColorToNormalConvertToVertexColor_button1 "right" 1
|
||||
-ac VertexColorToNormalConvertToVertexColor_button1 "top" 5 VertexColorToNormalDrawVertexToolSet_button1
|
||||
|
||||
-af VertexColorToNormalCurrentColorSet_separator3 "left" 1
|
||||
-af VertexColorToNormalCurrentColorSet_separator3 "right" 1
|
||||
-ac VertexColorToNormalCurrentColorSet_separator3 "top" 1 VertexColorToNormalConvertToVertexColor_button1
|
||||
|
||||
VertexColorToNormal_formLayout1;
|
||||
|
||||
showWindow EditVertixNomalWin;
|
||||
|
||||
VertexColorToNormalCommand 1;
|
||||
}
|
||||
EditVertixNomalUI;
|
78
03-UnrealEngine/卡通渲染相关资料/渲染功能/描边/描边.md
Normal file
78
03-UnrealEngine/卡通渲染相关资料/渲染功能/描边/描边.md
Normal file
@@ -0,0 +1,78 @@
|
||||
---
|
||||
title: 描边
|
||||
date: 2023-12-08 16:49:45
|
||||
excerpt:
|
||||
tags:
|
||||
rating: ⭐
|
||||
---
|
||||
# 实现功能
|
||||
- 后处理描边
|
||||
- MeshDraw描边
|
||||
|
||||
# 其他游戏做法
|
||||
## 蓝色协议
|
||||
采用后处理、Backface以及预绘制描边。
|
||||
[[蓝色协议的方案#轮廓]]
|
||||
|
||||
# 概念
|
||||
## 描边概念以及各个算子数学的意义
|
||||
参考:https://zhuanlan.zhihu.com/p/478943345
|
||||
|
||||
### 图像描边的本质
|
||||
根据微积分的定义在二维离散函数中推导出来的。核心目的是得到像素点与其相临像素的灰度值变化情况,并通过这种变化来增强图像。原始定义的梯度只是灰度值变化的度量工具。
|
||||
|
||||
### Sobel
|
||||
- Sobel卷积x方向的因子:
|
||||
|
||||
| -1 | 0 | +1 |
|
||||
| --- | --- | --- |
|
||||
| -2 | 0 | +2 |
|
||||
| -1 | 0 | +1 |
|
||||
|
||||
y方向的因子为:
|
||||
|
||||
|+1|+2|+1|
|
||||
|---|---|---|
|
||||
|0|0|0|
|
||||
|-1|-2|-1|
|
||||
Sobel算子更具像素点上下左右临近灰度加权差,在边缘出达到极值这i一现象检测边缘。对噪声具有平滑作用,提供较为准确的边缘方向信息,边缘定位精度不够高,**当对精度要求不是很高时**,是一种较为常用的边缘检测方法。
|
||||
**如果要求整体x和y方向的图像梯度,只需要将Gx与Gy相加即可。**
|
||||
|
||||
### Robert
|
||||
Robert算子被应用到图像增强总的锐化,其作为一阶微分算子Robert计算简单,对细节的反应敏感。其边缘检测的作用是提供边缘候选点,可以提供相对较细的边缘。Gx 与Gy的表示:
|
||||
|
||||
| -1 | 0 | 0 | -1 |
|
||||
| --- | --- | --- | --- |
|
||||
| 0 | 1 | 1 | 0 |
|
||||
### Laplace
|
||||
拉普拉斯算子是最简单的**各同性微分算子**,具有**旋转不变性**。二维图像的拉普拉斯变换是各向同性的二阶导数。拉普拉斯算子可以增强图像**边缘变化剧烈的位置**,**平缓减弱变换缓慢的变化区域**。因此可以**使用拉普拉斯算子对原图像灰度图像进行处理,然后再与原图像叠加**。
|
||||
|
||||
# 实现记录
|
||||
[[OutlinePass]]
|
||||
|
||||
|
||||
# BackFace描边
|
||||
|
||||
## 调整法线插件
|
||||
### Blender
|
||||
【【Blender】三渲二动漫角色脸部法线修改教程】 https://www.bilibili.com/video/BV1bX4y1y7pP/?share_source=copy_web&vd_source=fe8142e8e12816535feaeabd6f6cdc8e
|
||||
|
||||
### Maya
|
||||
法线编辑工具:https://www.bilibili.com/video/BV1uW411w7tp/?spm_id_from=333.337.search-card.all.click&vd_source=d47c0bb42f9c72fd7d74562185cee290
|
||||
作者还提供代码:![[NomalEditor.mel]]
|
||||
# 杂项
|
||||
|
||||
## 蓝色协议的做法
|
||||
### 模型外扩
|
||||
|
||||
### 后处理
|
||||
1. 使用Sobel算子进行深度检测,**只勾数值差别较大的区域**:脸部顶点色定义区域 与 模型外部轮廓。
|
||||
2. 使用Sobel进行ID贴图检测。**只勾数值差别较大的区域**。
|
||||
3. 进行法线点积(dot)检测。**在 深度差异小 以及 同一个ID区域内进行检测**:手指区域。
|
||||
|
||||
1. 使用Sobel过滤器进行深度检测描边。
|
||||
2. 使用Sobel过滤器进行Id图检测描边。
|
||||
3. 使用Sobel过滤器进行Normal检测描边。用于处理一些难以分ID,深度差又很小的地方,通过获取周围点法线求点乘的方式判断出轮廓。![[08-Assets/Images/ImageBag/UrealEngineNPR/蓝色协议_Normal检测描边.png)
|
||||
4. 预先画好的轮廓(GBuffer)。
|
||||
|
||||
所以使用需要 OutlineId、OutlineWidth(感觉可以传递一个全局Outline信息贴图再通过ID查表来获取,但只能在角色较少时使用)、OutlinePaint 、OutlineZShift(个人感觉不需要)
|
Reference in New Issue
Block a user