PAX Associations (paxAssoc)

key: paxAssoc

type: s

  1. string: association and parameter string.


The PAX Assocation chunk is used to associate PAX shaders (see skar.pax.*) with instances and classes of materials. The format of the string is:
(<material_class> | <material_name>)=<shader_class>{<param_1>=<value_1>,...},...

The association mechanism is able to associate an instance of a material (named only) with a new instance of a particular shader class. The material is referenced by the string used in the input file as its name, and the shader is reference by the fully qualified java class name. Any parameters that need to be set should be listed inside the curly braces. Note that the parameter setting mechanism only allows for integers, strings, floats, and doubles. Also note that reflection is used to set the values, and as such the parameter names should be exactly the name of the field in the corresponding class.

The parsing is done in a simple, but effective manner. The equals sign, curly braces, and commas are used as token delimeters. Any text in between such delimeters is then trimmed (ie - all whitespace is removed from the ends). The text that is left is assumed to be the resulting token. Note that this can lead to errors in badly formed strings. An example would be "material=skar. pax.shaders.Shader1{}". The space renders the string between the equals sign and curly brace unusable as a fully qualified java class name.


If you have a named material in a MDL file called "MyMaterial", and you want to use a skar.pax.shaders.DirectShader to shade the surface, the whole chunk would be:
If you wanted to make two materials translucent and needed to pass two different sets or parameters to the corresponding materials, you could do the following:
	"TransMaterial1 = skar.pax.shaders.Jensen01Shader{sigmaS=0.02, sigmaT=0.022},
	 TransMaterial2 = skar.pax.shaders.Jensen01Shader{sigmaS=0.04, sigmaT=0.044}"

Other Information

The PAX infrastructure was created in order to allow for non-local computations to take place during light surface interactions. The assumption built into the material class is that this is a local calculation. This limitation first became apparent while trying to implement the 2001 subsurface scattering paper by Jensen et. al. Andy Scukanec (ags at cs dot cornell dot edu) and Steve Marschner (srm at cs dot cornell dot edu) are the people that designed PAX, and questions about it should be directed to them (Andy first).
mdl page