DEV Community

Cover image for I built a shader translator: write a shader once, get native nodes in Blender, Godot, Unreal and Unity
Maya
Maya

Posted on

I built a shader translator: write a shader once, get native nodes in Blender, Godot, Unreal and Unity

Every time I move a look from one program to another, I rebuild it by hand. A painterly shader made in Blender has to be remade in Godot, then again in Unreal, and by the third copy they no longer match. So I built Inoscula.

Inosculation: when two branches grow into each other and become one.

You write a shader once, as code or as Blender nodes. Inoscula rebuilds it as native, editable material in Blender, Godot, Unreal, Unity and three.js: real nodes, real parameters you can keyframe, and the same look in each program.

four nodes of different dccs

What it does

  • One graph, every program. A small open format describes the shader. Each program gets its own version: a script that builds Blender Shader Editor nodes, a Godot VisualShader (.tres) or .gdshader, an Unreal script that builds material expressions, a Unity Shader Graph Custom Function file, and GLSL for three.js.

  • The same pattern everywhere. Blender's Noise, Voronoi and White Noise are ported from Blender's own code, so a pattern made in Blender lands in Godot in the same place. Unlit looks match Blender's own bake on 99.3 to 100% of pixels.

  • Round trips. Every export carries its graph inside it. Tweak in Blender, read it back, send it on to Godot, pull the Inspector values back out.

  • A live link. A small bridge passes parameter changes between Blender, Godot, Unreal and anything that speaks OSC, so one slider moves the material everywhere.

  • Object based, never baked. Everything is computed on the object's own surface, so it moves and scales with the object, and painterly looks keep the same stroke size on a pebble and on a building.

Inoscula Studio

The whole tool is one HTML file that works offline. A live preview and the parameters at the top, code and nodes underneath, and a Nodes view that shows the shader the way each program shows it.

preview of the lightweight web based shader engine

It comes with a library of looks: thick impasto oil paint, wet strokes with offset outlines, hand painted, comic print, engraving, claymation with real fingerprint ridges, and more. You can mix one look into another, stand other objects around yours with their own looks, and save your edits as your own looks.

render 1

render 2

render 3

Some renders..

A check script renders a shader in three.js, in real Blender (Cycles) and in real Godot, in one test scene, and puts the three side by side:

dcc shader accuracy comparison

Where it is

Measured: Blender, Godot 4.5 and three.js. Unreal and Unity compile but have not been run in the engines yet, so if you use Unreal or Unity, I would love a test report. The repo's docs/TESTING.md walks through it in about ten minutes.

It is free and open source (Apache 2.0). It works with RICO Engine, my real-time engine for creative tools, but you do not need RICO to use it.

Repo: https://github.com/mayakhalil-cmd/inoscula

Stars, issues and test reports all help. Tell me which look or which program you want next.

Top comments (0)