BeginText...EndText

Provides a placeholder for any arbitrary text that can then be interpreted or compiled into a shader by the rendering engine. Anything between these two markers is stored in a text section and is not parsed in any way by the SPDL parser. This is useful for providing quick shaders without having to create multiple files for containment.

For example, to define a render tree, you put the Node and Connection statements in the BeginText..EndText section.

Renderer "mental ray"
{
   Name = "misss_fast_simple_phen";
   BeginText
       # wiring diagram
       Node "diffuse"  = guid "{FAE49B0B-412E-4667-AFB8-B004155ED2C9}"; # misss_lambert_gamma
       Connection "diffuse::ambient" = interface "ambient";
       Connection "diffuse::ambience" = interface "ambience";
       Connection "diffuse::diffuse" = interface "diffuse_color";
       Connection "diffuse::diffuse_curve" = value 1.0;
       Connection "diffuse::indirect" = value off;
       Connection "diffuse::mode" = value 0;
       Connection "diffuse::lights" = interface "lights";

       Node "specular"  = guid "{03CE36D2-0D54-4A95-9F82-1105CB114C38}"; # misss_skin_specular
       Connection "specular::overall_weight" = value 1.0;
       Connection "specular::primary_weight" = value 1.0;
       Connection "specular::primary_spec_color" = interface "specular";
       Connection "specular::primary_shinyness" = interface "exponent";
       Connection "specular::mode" = value 0;
       Connection "specular::lights" = interface "lights";
       ...
   EndText
}

You can also put the implementation of a shader in the BeginText..EndText section:

Renderer "Cg"
{
   Name = "mib_color_average_cg";
   Options
   {
       "param0" = "input";
       "param1" = "factor";
   }
   BeginText
   {
       float4 retcolor;

       retcolor.x = factor.x * (input.x + input.y + input.z) / 3.0;
       retcolor.y = retcolor.x;
       retcolor.z = retcolor.x;
       retcolor.w = retcolor.x;

       return retcolor;
   }
   EndText
}


SOFTIMAGE|XSI v6.01     

Return to Softimage XSI Index