XM Magdalena 3D print, GGeorgy (3D)
LC #42 Pipers Alley

View Full Version : DG confusion with shading nodes

12-10-2011, 09:57 PM
I'm really confused with DG evaluation. I wrote simple shading node but i doesnt work as I expected. The node gets value "pointWorld" from shading engine. It sends this value to another node. There it gets modified and then gets value back. Now I want to use this modified value to determine output color.
Problem is that DG is not updated and I get zeros. What is even stranger that the shader works as I want in viewport but not in render. And one more thing that if I don't let shading engine send "pointWorld" value to my node but I enter it manualy by myself I get right answer.

So I'll describe how I did it:

I have node with four attributes:
pointWorld...input...shading engine feeds this attrubute with location where it wants to know color
sampleOrg...output...just copy pointWorld value to the sampleOrg
sampleDef...input....from here I get modified value of sampleOrg

//attribute dependencies

//external connections
sampleOrg affects sampleDef through connection in DG

and my compute function looks like this:

MStatus textureDef::compute( const MPlug& plug, MDataBlock& data )
if(plug == outColor) {
MDataHandle inputHandle = data.inputValue( sampleDef );
float* s = inputHandle.asFloat3();

MDataHandle outputHandle = data.outputValue( outColor );

return MS::kSuccess;
if(plug == sampleOrg){
MDataHandle inputHandle = data.inputValue( pointWorld );
float* s = inputHandle.asFloat3();

MDataHandle outputHandle = data.outputValue( sampleOrg );

return MS::kSuccess;
return MS::kUnknownParameter;

I would be most gratefull for any help!!!

CGTalk Moderation
12-10-2011, 09:57 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.