Adding Texture Diversity

Here is how to add diversity to your crowd textures with the Switch shader.

 

BASIC WORKFLOW

CONFIGURE THE GCHA

- In the Golaem Character Maker  Geometry tab select the piece of geometry on which you want to assign the shader switch variation and select its Shader.  

- Drag and drop a Shader Attribute node and link it to the desired shader node.

- Assuming you want to change the T-shirt texture, name your new attribute MAN_MD_torso_tshirt_blinn_textureIdx_value and give it a range

(0 to 3 if you've plugged 4 textures in the switch shader)

- Don't forget to save your gcha.

SHADING GRAPH INTEGRATION

Depending on your renderer the nodes to feed the Switch Shader will be different, please refer to the associated documentation to know how to plug them:
 
Renderer Node to feed the Switch
Vray VrayUserScalar (can be used to return either an integer or a floating value)
Arnold aiUserDataInt
Redshift RedshiftUserDataInteger
Renderman Studio PxrAttribute (can be used to return either an integer or a floating value)

- In the feeder node (VRayUserScalar for example), query your shader attribute: MAN_MD_torso_tshirt_blinn_textureIdx_value.

- Hit render!

Textures being switched randomly by the Shader attribute

FEEDING THE SWITCH SHADER WITH PP ATTRIBUTE

Here is how to have a much better control over the switch shader by using the PP attributes.

CREATE THE PP ATTRIBUTE

- In the particleShape create a new PP attribute.
 
- In component mode, turn your selection mask to select particles only. Select the particles for which you want to switch the texture.
 
- Go into the component editor and change manually the values the PPattribute PPTshirtTextureIdx.
 
- Check if the PP attribute is working. Go into your entityType Shape and add the PPTshirtTextureIdx as a displayable attribute.

 

CONFIGURE THE GCHA

- Go back in the Golaem Character maker  Geometry tab and select the previously created Shader Attribute Node.  

- In the Asset Properties window check the box "Use value from PP attribute" and query the PP attribute:  PPTshirtTextureIdx. 

- Don't forget to save your gcha!

EXPORT THE SIMULATION

- Finally in the Simulation Exporter, make sure to export the PPAttribute PPTshirtTextureIdx in the Simulation exporter  (in the Addition Per Particle Attributes To Export section)
 
- Hit render!
Switch shader driven by the value (0,1,2...) of the PP attribute
 
 

SWITCHING BETWEEN MORE THAN 10 TEXTURES

Even if the Switch Shader has only 10 inputs, it's possible to switch between an infinite number of inputs, using the Default Shader input and the Start Selector attributes.

The Default Shader input redirects the shading graph if the value of the Selector is out of the bounds of its Switch Shader (comprised between [Selector;Selector+10[ )


Example of a shading graph allowing to plug 30 shaders

And the configuration of the Start Offset for each Switch Shader:

Thus, if the selector value is between [0;9], the value is picked within CrowdSwitch1, between [10;19] within CrowdSwitch2 and between [20;29] within CrowdSwitch3.

 

ADJUSTING TEXTURE DIVERSITY WITH SHADING ATTRIBUTES WEIGHTS

A very easy way to set more texture weight on one character could be to map the same texture multiple times into the switch shader.

the green file has much more chances to be mapped to an entity.

Remember to set the Min/Max values of your shading attributes accordingly:

Render the simulation to see the result: