Customizing MaterialsΒΆ
Although Guerilla comes with a comprehensive set of materials, you may require specific adjustments to those shaders, or you may want to design your own shaders from scratch.
In the Create menu, select Create Material. This command creates an empty material named NewMaterial. Double click it in the browser or drag'n drop it from the Node List to any other view to edit its content.
Guerilla comes with the basic nodes to build a workable shader. Checkout the library/nodes folder.
Textures
Adding details to a material is usually done by driving some of their inputs with texture maps to capture small scale variations. For instance, you can use a wood texture instead of the default light brown Albedo input for the VarnishedWood material. Another use of textures is to add geometric complexity by using bump, normal or displacement maps.
- Go in the material shading network.
- Add the 'SLTexture' shading node. This adds a node that returns the texel value at the surface current st coordinates.
- Connect the output of the SLTexture node to the input to drive.
By default the SLTexture returns a white color. This is perfectly normal since you need to choose an image.
- Select the SLTexture node.
- Choose an image file by clicking on the Browse button then using file dialog in the SLTexture node Properties view.
- Set Gamma, Filter and Mode if needed.
Setting the texture directly in the material is possible but you will most likely need to change the texture on a per node or group of nodes basis. Again this will be done using a RenderGraph.
- Select the SLTexture node.
- Type a keyword in the Name text box in the SLTexture node Properties view. This associates to the texture a string value.
- Go in the RenderGraph node network.
- Override the keyword input by typing the keyword and select Texture type in the Properties view of a MaterialOverride node, then click on the Add button.
- Choose an image file by clicking on the Browse button then using file dialog in the MaterialOverride node Properties view.
It's possible to use a command line executable to previously build all the texture to their .tex equivalent.
Dynamic Attributes
You can retrieve a dynamic attribute's value in a shading network.
To retrieve a dynamic attribute
- Go in the material shading network.
- Add the 'RenderAttr' shading node. This adds a node that returns the dynamic attribute's value of a shaded primitive if available else a default value.
- Retrieve the attribute's value by typing its name in the Attr text box in a Properties view.