Shader Semantics and Annotations
 
 
 

Semantics are user supplied hints in a shader effect file, that describe a variable. The material uses semantics to define the transforms required by the effect, and also for what style of texture map is present.

Annotations are provided as additional information about variables, and are used by 3ds Max to generate UI elements for hardware materials.

In the following HLSL parser example, there are two semantics Direction and LightColor. The Direction semantic has three annotations: UIName, Object, and RefID. The LightColor semantic has two annotations UIName and LightRef.

// light direction (view space)
float3 lightDir : Direction <  
  stringUIName = "Light Direction";
  stringObject = "TargetLight";
  intRefID = 0;
> = {-0.577, -0.577, 0.577};
 
//diffuse setting controlled by the light if available
float4 k_d : LightColor <
  stringUIName = "Diffuse";
  intLightRef = 0;
> = float4( 1.0f, 1.0f, 1.0f, 1.0f );    

Parsers

The supported semantics and annotations depend on the parser used. The parsers are separated into HLSL and SAS shaders for the purpose of the documentation. The parsers are identified by the paramID value in a shader effect file.

About Standard Annotations and Semantics (SAS)

For more information on the SAS specification see the NVIDIA site (http://developer.nvidia.com/object/using_sas.html). Note that 3ds Max does not support camera semantics and annotations, and has its own lighting setup. 3ds Max specific information can be added to an effects file using #ifdef / #endif blocks using the _MAX_ predefined value. For more information see Supported SAS Shader Semantics.