Sometimes it can be useful to generate a texture on the fly using a single, static shader. Trial has specific support to make that easy with the
cubemap-renderer classes. Those classes act as standard
standalone-shader-entitys, but with a special
render method that can be called with a
texture instance as the render target. The shader output will then be directly rendered onto that texture.
Both renderer classes provide two inputs to the fragment shader stage:
world_position, the position of the fragment in world space
uv, the UV coordinate of the texture being rendered to
dynamic-image-renderer class lets you perform the same but with dynamically provided shader code, via
dynamic-shader-entity. This is then used to implement the
shader-image-generator and the
The extra arguments to the
shader-image asset are the texture parameters. Thus, to define an asset that implements a shader image, you would do something like this:
(define-asset (trial brdf-lut) shader-image
The input file path is, as usual, relative to the pool.