Procedure for Switching Shaders

  1. Reference UserShader and the Shader Register List to create the shader binary. See VertexShaderReferenceManual.pdf for details on how to create the shader binary.

  2. Create a shader intermediate file from the created shader binary in CreativeStudio.
    Select Create > Expert > User shader to open the Shader Creation panel.
    The item settings for this shader intermediate file are described below.

    Note: Parts surrounded in red in the figure indicate where the UserShader sample has changed.


    • Vertex shader index
      Specify the vertex shader index contained in the shader binary.
      When doing so, you must assign the shader kind in the same order you linked the shaders when generating the shader binary.
      For example, when linking the four vertex shaders gfx_UserShader0.vsh, gfx_UserShader1.vsh, gfx_UserShader2.vsh, and gfx_UserShader3.vsh to the shader binary, create the description by specifying the index numbers for each vertex shader index in order as 0, 1, 2, and 3.

    • Geometry shader index
      Specify the geometry shader index contained in the shader binary.
      What is specified here is the index number of the geometry shader assigned by Shader types.

    • Maximum number of vertex lights
      Specify the maximum number of vertex lights that the shader supports.
      Specify 0 if you are not using vertex lights.
      You can use up to 9 vertex lights (54 registers).

    • Starting offset for user registers
      Specify the starting offset for user registers.
      What is specified is the first register in the universal registers that will be used as a user register.
      You can specify values from 1 through 60, depending on the number of bones and vertex lights.
      You must set the same value as in nw_user_register_start in ShaderConfig.h.

    • Rigid skinning
      Enable this to support rigid skinning.

    • Smooth skinning
      Enable this to support smooth skinning.

    • Hemispherical lighting
      Enable this to support hemispherical lighting.
      Disable this when the register used for hemispherical lighting is to be used for a different purpose.

    • Vertex morphing
      Enable this to support vertex morphing.
      This is not supported in the current version.

  3. Assign the created shader intermediate file to a mesh.
    Select a shader category and apply the the created shader and program index.
    For the program index, specify the shader index number configured in the Shader Creation panel.

  4. Specify shader parameters for the newly added register.
    With UserShader, add NDeform and ExColor as Vector4 values.
    Select Vertex shader output result for the source in the texture combiner settings in order to apply color additions according to the ExColor parameter.


CONFIDENTIAL