Texture filter shader

This filter shader gets a RGB value from a texture at shading UV coordinates, and convert it to spectral values using the same algorithm as the RGB spectrum

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

This shader only works with RGB image files. For using other formats such as XYZ or spectral images, set a Image filter shader instead.

Some BSDF types such as lambertian use the alpha channel of RGB textures as the material transparency.

Children Nodes

Image image The image to use as a texture

Parameters

name type description
greypt real The non-linear grey point adjustment, between 0.25 and 0.9
scale real Value multiplier, or contrast adjustment
offset real Value offset, or brightness adjustment
uvscale real The UV coordinates scaling factor. Scales the texture spatially over the geometry
stepalpha boolean If checked, alpha values below or above 50% are mapped to 0% and 100%, respectively.

Ocean XML 3.0 example

<filtershader type="texture" name="diffuse" scale="1 1 1" offset="0 0 0" greypt="0.5" uvscale="1">
        <image name="image" path="grid"/>
</filtershader>