Texture scalar shader

This scalar shader gets its value from a texture at shading UV coordinates. If the texture image has multiple channels (for instance R, G and B), only one channel is used and may be chosen.

An optional correction curve is applied to the raw RGB values, similar to a brightness/contrast/gamma adjustment:

  • The value is first applied a gamma curve, controlled by the greypt parameter. The grey value (0.5) is mapped to greypt, hence setting greypt to 0.5 disables this correction

  • Then, the value is scaled by the scale parameter

  • And finally, offset is added to the value

In other words:

  • Black(0) is mapped to offset

  • White(1) is mapped to offset + scale

  • Grey(0.5) is mapped to offset + scale * greypt

Children Nodes

Image image

The image to use as a texture

Parameters

name

type

description

channel

string

The name of the image channel to be used

greypt

real

The non-linear grey point adjustment, between 0.25 and 0.9

scale

rgb

RGB value scaling, or contrast adjustment

offset

rgb

RGB value offset, or brightness adjustment

uvscale

real

The UV coordinates scaling factor. Scales the texture spatially over the geometry

Ocean XML 3.0 example

<scalarshader type="texture" name="exponent">
        <prm channel="G"/>
        <prm scale="1"/>
        <prm offset="0"/>
        <prm greypt="0.5"/>
        <prm uvscale="1"/>
        <image name="image" path="cloth-exp.png"/>
</scalarshader>