To generate cards of random people to give scale to a scene.
Introduction
So I need human sized characters in my scene to give it some scale, there are various ways to do this, but I thought it'd be fun to write a little script that generates card people in various poses, heights etc. Doing a quick search on silhouette on Google Image search turns up this image at Deposit Photos, original link HERE,
Image 1: Various Silhouettes
|
I did a quick edit of the image to make it a square. Not too concerned with the watermarks.
Concept
1. Create shader using image 1 as opacity map
2. Create a polyplane with a dimension of 1x2 meters
3. Map the polyplane UV randomly to a person in image 1
Mel Script
global proc randCardPeople() { string $card1[]; string $shaderName; string $shadingGroup; string $fileName; if (!(`objExists cardPeople`)) { $shadingGroup = `sets -renderable true -noSurfaceShader true -empty -name cardPeopleSG`; $shaderName = `shadingNode -asShader lambert -n cardPeople`; $fileName = `shadingNode -asTexture file`; connectAttr -f ($shaderName + ".outColor") ($shadingGroup + ".surfaceShader"); connectAttr -f ($fileName + ".outColor") ($shaderName + ".incandescence"); connectAttr -f ($fileName + ".outTransparency") ($shaderName + ".transparency"); setAttr ($shaderName + ".color") -type double3 0 0 0 ; setAttr ($shaderName + ".diffuse") 0; setAttr -type "string" ($fileName + ".fileTextureName") "/data/silhoutte.jpg"; setAttr ($fileName + ".invert") 1; setAttr ($fileName + ".alphaIsLuminance") 1; } $card1 = `polyCreateFacet -p 0 0 0 -p 1 0 0 -p 1 0 -2 -p 0 0 -2 -name card`; rotate -r -os 90 0 0 ; makeIdentity -apply true -t 1 -r 1 -s 1 -n 0; sets -e -forceElement cardPeopleSG; select -r ($card1[0] + ".map[0:3]") ; polyEditUV -pu 0.25 -pv 0.5 -su 0.15 -sv 0.15; polyEditUV -u -0.25 -v -0.5; //move to 0 0 polyEditUV -u 0.0613368 -v 0.355; //move to first row int $chooseU = `rand 12`; int $chooseV = `rand 1 4`; polyEditUV -u (0.0815*$chooseU) -v (0.192*$chooseV); select -cl; } randCardPeople;
Conclusion
Results |
0 comments:
Post a Comment