Material Editing via Shader Introspection

Last week I started to work on an advanced Material Editor for Vortex. If you remember, one of the objectives of the new V3 Renderer was to completely overhaul the material system of the engine as to support advanced rendering techniques.

New Material Editor exposes the Shader Uniforms so they can be easily tuned.
New Material Editor exposes the Shader Uniforms so they can be easily tuned.

Building a dedicated editor that allows changing the material properties on the fly will help tune shader properties in order to achieve compelling visual results.

Ever since I developed the original Shader Composer project years ago, I’ve been puzzled about how one might go about providing a flexible enough means to supply the shader with meaningful values from a UI. The solution to this problem comes in the form of shader introspection.

The idea is that, once the shaders have been compiled and linked together, we will pull the (referenced) shader Uniforms from the GL. This allows dynamically asking for what properties can be provided to the shader. This allows configuring its behavior at runtime. No need to stop the Editor or App to change values and recompile.

The image above shows a basic textfield-based editor that can be used to set the uniform values for the shader associated to the selected Entity. The plan moving forward is to provide specialized editors that help entering vectors, matrices or even an image reference.

We’ll continue with this next week. Stay tuned for more!