Shader Node system improvements

I came up with the name while I was typing the message :smiley:

So I’ll wait for you reply then: we can come up with better syntax for all this stuff (and for shader node groups too) and I’ll just make it the way it is good for everyone and will not have to redo it later.

Is there like any chat room or something where it can be discussed live?)

Hi there! So I was busy with more important stuff, but lately I’ve upgraded shader nodes system with shader node packs, they are defined in separate files like that (read comments for more insight):

ShaderNodesPack {
    Documentation {
        // This section is for humans...
    Output {
        color = TextureSplatting.color
    Input {
        // This section is only for documentation purpose
    ShaderNode TextureTriplanarCoords {
        Definition : TextureTriplanarPreFragment : materials/shaders/generic/texture.triplanar.j3sn
        InputMappings {
            divider = vec3(4.0, 4.0, 4.0)
            textureWorldSpace = WorldSpaceTextureCoord.vec3Var
    // Set up atlas
    ShaderNode TextureAtlasLib {
        Definition : TextureAtlasLibFragment : materials/shaders/generic/texture.atlas.j3sn
        Define : AtlasWrapMode as ATLAS_WRAP_MODE
    // Read for first texture
    ShaderNode TextureAtlasFragment1_1 {
        Definition : TextureAtlasFragment : materials/shaders/generic/texture.atlas.j3sn
        Define : ATLAS_MAG_MIN_FILTER = 5
        InputMappings {
            atlasTileData = Input.atlasTileData1 // 'Input' is a special namespace
            atlas = MatParam.ColorAtlas
             // Curent snp's namespaces can be used as is
            texCoord = TextureTriplanarCoords.texCoord1
    // ... And so on, ShaderNode and ShaderCode are allowed in any combination
    Include : materials/shaders/OtherShaderNodePack.snp
    // Includes are just included 'as is`, no second layer of namespacing is present currently

And they can be included in material like that:

        FragmentShaderNodes {
            ShaderNodesPack TextureTriplanarFrag {
                Source : materials/shaders/generic/texture.atlasblend.frag.snp
                InputMappings {
                    atlasTileData1 = TextureTriplanarVert.atlasTileData1
                    atlasTileData2 = TextureTriplanarVert.atlasTileData2
                    atlasTileData3 = TextureTriplanarVert.atlasTileData3
                    textureBlend = TextureTriplanarVert.textureBlend
                    normal = TextureTriplanarVert.normal
            // ... And so on...
            ShaderCode TextureTriplanarFragOutput {
                // We can use outputs from SNP as outputs from any other shader nodes
                // Notice namespace: it is SNP's name, not name of shader node within SNP
                in vec3 color = TextureTriplanarFrag.color.rgb
                out vec3 color2 to Global.color.rgb
                color2 = color

I also fixed constants in shader nodes inputs, they do not require Const namespace now (checked by regexp when parsing).

Still kinda waiting for @nehon


Awesome job! :slight_smile:

This is a really useful feature I’ve been wishing for!
I have a quite complex shader node I would like to use in different materials. This beats copy-pasting.

Edit: Besides, it’s not possible to copy the generated shader code O_o

so… the shader pack is like a reusable shader node composed of several shader nodes right?
I didn’t have that in mind, but that sounds pretty cool.

What do you mean by this?

Yes. Currently I am rewriting it to support better constants and conditions in shader packs and shader packs in shader packs with proper input-output chaining :smiley:

I tried to rewrite my shader with this and found that I need a few more things) It will be cool, I guess I’ll share the code after this.


Sorry to necro this, but I was browsing the forum for Shader Node threads. I bet this never became a PR? Any chance it’s in a repository somewhere?

1 Like

I think @Eirenliel GitHub repo is at

in case you want to check.

1 Like

Sorry we axed the feature after working on it for a while, and I also haven’t been working on the project for some time now.

1 Like

I think I found the branch:


as i see it is about

where it just allow setup all material with shader nodes via code?
idk what it changed there.

Yeah. It seems it was not what I thought it was.

1 Like

From what I recall Nehon plan was to write a Java API to create shader nodes via code then a visual editor could be created upon this API. Some folks here may have more info on this so.

1 Like

yes, sounds logic. Java API is there as i see, but probably no editor were done.

There is a visual editor. See other thread.

but there is no in master.

See other thread.

can you link which one you mean?

I found the original post by Nehon:

Would be cool if someone can go ahead and finish this idea :slightly_smiling_face:

You can follow his work in this branch:


Here is the thread about the Shader Editor:

oxplay2 means, there is no editor done over the API proposed by Nehon. Not any, many, every other editor.

1 Like