Hi Matt, it´s a mental ray shader. But i need only the layout to convert the values to an other renderer. I read in as example, the color of a marker and it´s position and transfer it to a non mental ray shader which the renderer knows. The shader definition is pure c++. And it works for what i need it for all other shader layouts i have made like this one:
[image: Inline-Bild 1] 2014-04-04 23:21 GMT+02:00 Matt Lind <[email protected]>: > Couple of questions: > > 1) What type of shader are you making? (mental ray, hardware, ...) > > 2) what method are you defining your parameters? (eg; .spdl, shader def, > C++, ...) > > > > > Matt > > > > -----Original Message----- > From: [email protected] [mailto: > [email protected]] On Behalf Of Stephan Woermann > Sent: Friday, April 04, 2014 2:15 PM > To: [email protected] > Subject: Gradient shader c++ > > Hi, > i try to write a shader with a gradient input. > Here is a part from the code which i have made and which is working: > > Context ctxt( in_ctxt ); > Application app; > ShaderDef sdef( ctxt.GetAttribute( L"Definition" ) ); > sdef.AddShaderFamily( siShaderFamilyTexture, true ); > > // PARAMETERS > Factory fact = app.GetFactory(); > ShaderParamDefContainer inpdefs = sdef.GetInputParamDefs(); > ShaderParamDefContainer outpdefs = sdef.GetOutputParamDefs(); > > // Input > ULONG cnt = 12; > CRefArray popts; > ShaderParamDefOptions *opts = new ShaderParamDefOptions[cnt]; > for( ULONG i=0; i < cnt; i++ ) { > > popts.Add( fact.CreateShaderParamDefOptions() ); > opts[i] = ShaderParamDefOptions( popts[i] ); > } > > opts[0].SetInspectable( true ); > opts[0].SetTexturable( false ); > opts[0].SetLongName( L"Gradient" ); > inpdefs.AddParamDef( L"valueGradient", siShaderDataTypeGradient, > popts[0] ); > > opts[1].SetInspectable( true ); > opts[1].SetTexturable( true ); > opts[1].SetAnimatable( true ); > opts[1].SetLongName( L"Color1" ); > inpdefs.AddParamDef( L"inColor1", siShaderDataTypeColor3, popts[1] ); > > ... > > Now i want to define the inColor1 for the marker1 color. > In the spdl file of the gradient shader, i see there is a connection like > this: > > Connection "gradient::color1" = interface "color1"; > > How can i make this in c++? > I have tried some things, but nothing works: > > inpdefs.GetParamDefByName(L"valueGradient").GetAttributes().Set( > L"{210EA5F3-1742-4204-999F-E0750F2289E4}", L"inColor1" ); > inpdefs.GetParamDefByName(L"valueGradient").GetAttributes().Set( > L"gradient::color1", L"inColor1" ); > inpdefs.GetParamDefByName(L"valueGradient").GetAttributes().Set( > L"color1", L"inColor1" ); > opts[0].SetAttribute( L"{210EA5F3-1742-4204-999F-E0750F2289E4}", > L"inColor1" ); > opts[0].SetAttribute( L"color1", L"inColor1" ); > opts[0].SetAttribute( L"gradient::color1", L"inColor1" ); > > > Sorry for the bad layout, but gmail works only with the simple html. > It would be nice to get help from someone. > > Best, > Stephan > >
<<inline: img.gif>>

