|
Hi,
I’ve started on writing cgfx shaders for use with Motionbuilder’s built in KOGLCgFxShader.
And I’m coming across a few issues. The current issue is in scripts for the techniques.
A script can be used for looping a pass. But I can’t get it to properly work in Motionbuilder.
My (relevant) code looks like this:
float furLayers <
string UIWidget = "slider";
float UIMin = 1;
float UIMax = 100;
float UIStep = 1;
string UIName = "furLayers";
> = 1.0;
float currentCount < string UIWidget="None";>;
vertexOutput VS_TransformAndTexture_loop(vertexInput IN, uniform float furLayers, uniform float currentLayer ) { ...rest of code }
float4 PS_Textured_loop( vertexOutput IN, uniform float furLayers, uniform float currentLayer ): COLOR
{ ...rest of code }
technique Fur_Multi_Layer
<
string ScriptClass = "object";
string ScriptOrder = "standard";
string ScriptOutput = "color";
string Script =
"LoopByCount=furLayers;"
"LoopGetIndex=currentCount;"
"Pass=Shell;"
"LoopEnd=;";
> {
pass Shell
{
VertexShader = compile vp40 VS_TransformAndTexture_loop( furLayers, currentCount );
PixelShader = compile fp40 PS_Textured_loop( furLayers, currentCount );
}
}//End technique Multi_layer_fur
The user can interactively set the number of furLayers to render, and the script in the technique will loop the ‘Shell’ pass by that number sending in to each instance of the shaders the variables ‘furLayers’, ‘currentCount’.
The “LoopByCount=furLayers;” line works, and I am getting looping. However the “LoopGetIndex=currentCount;” line doesn’t work. currentCount is supposed to increment up each iteration of the loop, but it’s staying static. My shader does work if I hard code all the passes instead of using a script.
I’m hoping there’s a mistake in my code that someone here could point out. Much worse would be if Motionbuilder is buggy in supporting this feature.
Also I can’t find anywhere what version of cg Motionbuilder 2012 supports. I know Motionbuilder 7 supported cg 1.4. cg 3.0 came out July 2010 and I’m guessing MotionBuilder 2012 support is somewhere in between.
For cgfx in Motionbuilder where can I find a list of the cgfx semantics that Motionbuilder uses?
‘regards
Simeon.
|