Exploring Shader Expert: Procedural 2D Shapes in Unity.
by Vicente C.
Published |
3
Share
Shader Expert makes editable 2D shaders inside Unity, then renders each result so a second model can compare it with the user’s request.
For her master’s thesis in Interactive Media at FH Upper Austria, Niloufar Moradi Jam built Shader Expert, a Unity Editor tool that generates and edits procedural 2D shapes from text or a reference image.
The tool first generates the HLSL needed to draw the requested shape. It uses that code to build a ShaderGraph asset and render a preview in Unity.
These shapes are built with Signed Distance Fields (SDFs). An SDF measures the distance between each point and a shape’s edge. Negative values fall inside the shape, zero marks the edge, and positive values fall outside it.

Shader Expert combines these functions to build more complex drawings. Since each shape is calculated when rendered, it is not tied to the resolution of a source texture.

Before building the tool, Niloufar had to understand how procedural shapes are constructed. Her main reference was Fabrizio Espíndola’s Shaders & Procedural Shapes in Unity 6, which covers HLSL, Shader Graph, and SDFs in Unity. She used what she learned to define the model’s HLSL rules and build a set of verified examples.

Early tests revealed two problems. A general-purpose language model sometimes mixed GLSL syntax into HLSL, causing compilation errors. Other times, the code compiled but drew the wrong shape, such as a star with too many points or a shape placed off-center.

Niloufar limited the model to writing one HLSL function under strict rules. A C# backend reads that function and builds the ShaderGraph file, including its nodes, connections, and exposed properties. The model never edits the graph directly.

Compilation only confirms that the code is valid, not that the requested shape is correct. Shader Expert renders the result on a preview quad and takes a screenshot. A vision model compares it with the original prompt. If the score is low, the vision model describes the mismatch and Shader Expert adds that feedback to the next attempt.
For complex requests, Shader Expert divides the subject into smaller shapes and searches its knowledge base for related HLSL examples. These come from earlier results that met the required score, and the tool adds the closest matches to the prompt as references.

Niloufar works with Shader Expert through a chat window in the Unity Editor. In her walkthrough, she provides a reference image and text prompt for a butterfly. The generated material includes Inspector controls for the butterfly’s colors and wing proportions.

She can also request changes through the chat. When she asks for a different curve on the butterfly’s smile, Shader Expert rewrites the HLSL. The pixelation effect follows a different path. The tool adds ShaderGraph nodes that quantize the UV coordinates, so this step does not call the language model.

To animate the antennae, Shader Expert creates an antennaAngle shader property. It then writes a C# script that updates the property over time. Niloufar can adjust the angle range and speed in the Inspector.
If you want to see more of Shader Expert, you can read Niloufar’s full breakdown, watch the showcase, or follow her work through the links below:

Interested in learning more?
If you’re interested in the technical side of Unity? The Unity Dev Bundle brings together six books covering shaders, math, procedural shapes, editor tools, and character customization.

This is for developers and technical artists who want to build a stronger foundation and work with more advanced graphics and systems in their projects.
Jettelly wishes you success in your professional career! Did you find an error? No worries! Write to us at [email protected], and we'll fix it!

Subscribe to our newsletter to stay up to date with our latest offers

© 2026 Jettelly Inc. All rights reserved. Made with ❤️ in Toronto, Canada