View Full Version : Render bones?

01 January 2012, 11:32 AM
The script from creativeCrash that places elongated pyramids on top of the bones isn't good enough. Any creative idea for something that looks good, besides using the hardware render buffer?

01 January 2012, 08:05 PM
I was looking for a solution to this for the longest time. Not sure why they decided not to make bones a renderable object. Pretty lame if you ask me. :rolleyes:

01 January 2012, 10:23 PM
The situation is that bad, ah?
Well wait a minute, I'm looking at the bones in the view port, and what's the problem to draw them one-to-one with all the colors and stuff (bit by bit, I'll rewrite maya ... ;) )?
How about making it even better, such as putting real bones (not real-real, real - graphics real...) exactly on top of them? It should be a blast. But surely someone must have done such a thing already?

01 January 2012, 10:39 PM
would viewport 2.0 render them? it render camera for exemple from what I saw.

01 January 2012, 10:39 PM
I think your plugin Maya business will be a smashing success. Now get to work.

01 January 2012, 01:01 AM
It's been done before in Mirai. Bones in Mirai were built off of polygonal primitives thus were renderable. It amazes me how many people are asking for features/tools that have been around for years, but...not in Maya. I truly wish ADSK would have taken the time to do a real in depth analysis of this application.

01 January 2012, 01:30 AM
This is getting ridicules!
Well here is my

Put the

in the script dir, or create your own model named bone inside the scene. Select a joint and run:

import create_bones

It would create bones for the joints and bind them:

I'm opened to suggestions (hierarchy colors?), or better

01 January 2012, 12:49 AM
whipped this up for you to try out.

current working code [MEL]

/*usage select root joint and run script*/

//select all children of parent
string $rootJoint[] = `ls -sl -fl`;
select -hi;
string $sel[] = `ls -sl -fl`;
string $cpm = `createNode closestPointOnMesh`;
select -cl;
group -em -n "skelGeo";
for ($i=0; $i<size($sel); $i++){
//Evaluate for joints only
if (`nodeType $sel[$i]` == "joint"){
//create sphere at each joint
vector $pos = `xform -q -ws -t $sel[$i]`;
vector $rot = `xform -q -ro $sel[$i]`;
polySphere -sx 10 -sy 10 -n ($sel[$i]+"_geo");
float $jointScale = `jointDisplayScale -q`;
float $radius = `getAttr ($sel[$i]+".radius")`;
$radius = ($radius/2)*$jointScale;
xform -ws -t ($pos.x) ($pos.y) ($pos.z) -ro ($rot.x) ($rot.y) ($rot.z) -scale $radius $radius $radius ($sel[$i]+"_geo");
makeIdentity -apply true -t 1 -r 1 -s 1 -n 0 ($sel[$i]+"_geo");

if ($sel[$i] != $rootJoint[0]){
//create lengths to connect child nodes
string $fParent = firstParentOf($sel[$i]);
float $jointScale = `jointDisplayScale -q`;
float $radius = `getAttr ($fParent+".radius")`;
$radius = ($radius/2)*$jointScale;
$cone = `polyCone -sx 4 -h 2 -n ($fParent+"_geo_length")`;
move -r -y (2);
makeIdentity -apply true -t 1 -r 1 -s 1 -n 0 $cone;

//get Position of Parent
vector $pos = `xform -q -ws -t $fParent`;
float $radius = `getAttr ($fParent+".radius")`;
xform -ws -t ($pos.x) ($pos.y) ($pos.z) -scale $radius $radius $radius ($cone);
select -r $sel[$i];
select -add $cone;
aimConstraint -offset 0 0 0 -weight 1 -aimVector 0 1 0 -upVector 0 1 0 -worldUpType "scene";
select -r ($sel[$i]+"_geo");
string $shapeNode[] = `ls -sl -dag -lf`;

connectAttr -f ($shapeNode[0]+".outMesh") ($cpm+".inMesh");
vector $pos = `xform -q -ws -t ($cone[0]+".vtx[4]")`;
setAttr ($cpm+".inPositionX")($pos.x);
setAttr ($cpm+".inPositionY")($pos.y);
setAttr ($cpm+".inPositionZ")($pos.z);
vector $pt = getAttr ($cpm+".position");
xform -ws -t ($pt.x) ($pt.y) ($pt.z) ($cone[0]+".vtx[4]");
select -r -hi $cone;
parent $cone (shortNameOf($fParent)+"_geo");
//clean up nodes
delete $cpm;

for ($i=0; $i<size($sel);$i++){
parent ($sel[$i]+"_geo") "skelGeo";
select -r $sel[$i];
select -add ($sel[$i]+"_geo");


I wasn't sure how you'd want the geometry to be organized so that's pretty flexible for changes. Did you need it actually skinned? it seems like parenting would give a better result in this particular case but I dont know what the particular needs are. Anyway I'm gonna revise some of the code and I'll be posting it to Creative Crash as "Beastly Bones" for anyone whos interested

[edit] I decided to update it to set up a parent constraint from the bone to geometry so you can try it out and see if that works for your needs. Also I corrected a parenting issue for the 'length' geometry. All geo should be dumped into a group called skelGeo. Let me know how it works for you!

01 January 2012, 06:48 AM
If you can, please show a rendered image of your skeleton, and put your code under code tags, and make indented, so it would be more readable.

01 January 2012, 10:20 PM
Ok I reformatted the code and posted a render image based off a maya generated skeleton.

I caught a little oversight in there about the 'joint size' value and I've updated it in the code. Admittedly there's still a small bug in there which is adjusting the cones pivot point to replicate the exact position I'll mess with it a little later when I get some time.

01 January 2012, 03:35 PM
How about making the bones gray, white, blue or green? Something that would stand out even when not rendering them.

or watch some of these videos:

01 January 2012, 10:02 PM
Well in the case that its not rendered, bones do have a drawing override that allows you to change the color to make them more visible. or alternatively you could also place them in a layer and apply a color to that which would change the drawing color (joints, curves, etc)

CGTalk Moderation
01 January 2012, 10:02 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.