Question about Shader Editor

Hi everyone, I’d like to ask you for a suggestion.

  • Do you know programs or sites to write shaders with visual editors?
  • Is there a custom editor besides the SDK on github?
  • What tools do you use in general?

I’d like something like this.

Thanks in advance

4 Likes

JMonkeyBuilder has a shader node editor, jmb-1.8.0.

Remember, its no longer maintained, and no one knows about jmb burden bugs, so use at your risk, unfortunately my version doesn’t have a shader node editor, but i plan to reimplement later.

BTW, this is the jmb-shader node plugin code :

But i think you can still use blender ?

1 Like

Hi Pavl, thanks for the reply. You understand perfectly what I would like.

Do you know if the plugin still works? I took a look at the source code, and it’s a really ambitious and brilliant project. It should certainly be recovered for the benefit of the community.

At the moment I use the online editors to practice the shading language and then convert everything into j3md, vert and frag files. However, this method of work takes a lot of time. I would like to optimize development times. For example, how can I add the Fresnel effect to a PBR Material without having to duplicate all the native .frag code? Is there any way to pass parameters to a method / node / function like in the video?


https://docs.unity3d.com/Packages/com.unity.shadergraph@6.9/manual/PBR-Master-Node.html

I don’t know if Blender is the right way: can the shader graph created in Blender be imported into JME by exporting the model in gltf or glb format?

1 Like

Well, JME have Shader Nodes, but i didnt seen any PBR remake in it.

SDK had shader nodes tool that did work, but i would like use separate tool if there would any exist.

Blender i heard its not strict Shader Node, but its not problem to create custom basic components that reflect Blender, problem is to have more advanced components like pbr/etc in nodes there. (or maybe i just dont know there is written for .j3sn)

Some things like texture i belive you could pin via j3sn into pbr frag, but i never try so im unsure

Anyway it would be nice if some Blender export would exist. (oh it would save much work i did for characters)

1 Like

It works only on 1.3.2 and above versions of jmb.

I have re-maintained jmb recently but revived an older version 0.9.10, i am currently doing bug fixes on it (including a good threading model), if you want to add the feature on the new re-maintained version i will welcome it (you will need to build a plugin system that accept the abstraction layer of jmb shaders) :

3 Likes

Sadly I don’t think there’s currently a functional visual shader editor for jme. There were some attempts, but at least the shader node editor for sdk never really worked to any usable capacity.

While visual editors are important for prototyping, at the end of the day, you’ll probably want to convert node graphs into a code based shader manually for performance reasons. At least that’s the case for Unity’s shadergraph, as last time I checked it spewed out a 2k line shader for something I rewrote manually into a 100-200 line shader.

1 Like

Thanks for your feedback guys, let’s keep talking about it. I’d like to find with you a quick way to write shaders in JME so that everyone can learn from this topic.

The keywords are:

  1. Fast prototyping (even not optimized) perhaps using an online visual editor or something similar.
    Let’s try to compile a list of sites or editors like jmb.
    Here are some sites I tried:
  1. Reuse of PBR and Lighting nodes (j3sn could be the solution Shader Nodes :: jMonkeyEngine Docs). Where can I find a working example that I can study?

  2. A simple jme project to share on github, with an animated model and a static model to quickly test small changes to the j3md file without having to restart the application every time (perhaps using the MaterialDebugAppState class). Something like that, but without the graphic editor.

Let me know what you think.

@Pavl_G why did you start from an older version of jmb? Have you tried the plugin with the latest version?

2 Likes

Due to closure of jcenter (+ the original author is registering broken libs on the gradle file) and unreadable code at some parts of build.gradle, i cannot revive jmb-1.8.0, and i had to roll back to an ANT version which is 0.9.10…so then i converted to simple gradle with jme being only the remote dependencies so i ensure nothing would vanish out one day.

2 Likes

I will reimplement all the missing features soon or later, and its a bonus because i was searching for a while to a drive to dive into jfx, and now here is the chance into shaders and jfx.

2 Likes

well, if you will make really nice ShaderNode editor that support PBR/etc i might use it myself then.
(since jMonkeyBuilder was pre-pbr as i know, where i need just adjust pbr shader with mixes/etc on it)

did check this shaderfrog, but it seems to be too simple, no advanced components there, and had some error without description what is wrong. Or maybe need account there to see more things, idk.

Shadertoy is not Shader Node based as i know, at least i never seen its editor for nodes.

2 Likes

Well, thank you, i will add it to my features milestone, i may start a features milestone after fixing the major bugs and migrating from bullet-native, i am in need to the help of the community to build a good thing, i will let you know when i start the implementation process !

Keep in mind, the idea of “shader nodes” is built right into the engine, meaning composeable wireable shaders. The editor was just a graphical way of editing them but it was just manipulating the “shader pieces” support that was added to the engine.

What would be nice is two things: 1) a set of PBR-based shader nodes (or even one PBR shader node like Blender’s giant BRDF node), 2) a usable graphic editor for JME’s built in shader nodes.

I’ve never looked at jmb so I don’t know what approach it took but hopefully it reused the built-in functionality and just put an editor on top of it.

4 Likes

Thanks for the info, i haven’t touched Alex’s jmb shader nodes plugin yet, and my current version of jmb doesn’t support jmb plugins, so there are high possibilities that i am going to build the shader node editor from scratch on top of the current version, so if you have a good pattern to suggest let me know.

jmb-shader-nodes build uses jMonkeyBuilder as a dependency, so i believe its broken too.

im not sure what jmb-shader-nodes is, but remember that shader nodes are JME core addon, so you just need to make editor + usable Nodes like Paul said (it is PBR one here for sure)

its same like SDK Shader Nodes editor, it exist, but do not have PBR Node as i remember.

and dynamic preview of material ofc.

usable PBR Node, could be added into Engine Source itself later (since there is for example Unshaded.j3sn but there also should be Lightning/PBR i assume too)

2 Likes

Conceptually, It’s just jfx Nodes and Geoms bounded to jfx Controllers (listenable objects) that display thr j3sn file content of different shader files, this is what i would normally think of when seeing the images.

EDIT : but the fact that jmb-shader-nodes uses jMonkeyBuilder as a dependency, raises the suspicion that the plugins api was built as a core feature inside jMonkeyBuilder !

1 Like

I tried the SDK’s built-in shader editor. I have to say it’s not bad. It’s not as intuitive as others, and requires you to understand how the grammar is designed in order to create new function nodes. But it exists and this is already a great advantage.

Should be expanded with other j3sn nodes. I need the help of someone more experienced to understand how to write a PBR component like the one in Unity. Can someone help me?

Here are some details of the tests I did:
I created a test material.

Here is the TestMaterialDef.j3md file.
The ColorMult.j3sn and CommonVert.j3sn files are part of the jme core libraries.

MaterialDef Simple {
    MaterialParameters {
        Color Color : 1.0 0.0 0.0 1.0
        Color BgColor : 1.0 1.0 1.0 1.0
    }
    Technique {
        WorldParameters {
            WorldViewProjectionMatrix
        }
        VertexShaderNodes {
            ShaderNode CommonVert {
                Definition : CommonVert : Common/MatDefs/ShaderNodes/Common/CommonVert.j3sn
                InputMappings {
                    worldViewProjectionMatrix = WorldParam.WorldViewProjectionMatrix
                    modelPosition = Global.position.xyz
                }
                OutputMappings {
                    Global.position = projPosition
                }
            }
        }
        FragmentShaderNodes {
            ShaderNode ColorMult {
                Definition : ColorMult : Common/MatDefs/ShaderNodes/Basic/ColorMult.j3sn
                InputMappings {
                    color1 = MatParam.Color
                    color2 = MatParam.BgColor
                }
                OutputMappings {
                    Global.color = outColor
                }
            }
        }
    }
}
private void addCharacter() {
	// Add model to the scene
	Node model = (Node) assetManager.loadModel("Models/Mixamo/ybot.j3o");
	rootNode.attachChild(model);

	AnimComposer animComposer = GameObject.findControl(model, AnimComposer.class);
	animComposer.setCurrentAction("Idle");

	SkinningControl skControl = GameObject.findControl(model, SkinningControl.class);
	skControl.setHardwareSkinningPreferred(false);

	// 1. Alpha_Surface
	// 2. Alpha_Joints
	Geometry body = (Geometry) model.getChild("Alpha_Surface");
	Material mat = new Material(assetManager, "MatDefs/TestMaterialDef.j3md");
	mat.setColor("Color", ColorRGBA.Green);
	mat.setColor("BgColor", ColorRGBA.White);
	body.setMaterial(mat);
}

5 Likes

yes, exactly what i said, need pbr component and other written for j3sn.

Hope someone can make this addon into core.

2 Likes

I agree, features on core sdk is maintainable, far better than jmb but the problem is knowing how to deal with netbeans modules and build the sdk for testing (this is another dilemma).

Whatever the case, if the “path to enhancing shader nodes UI” is not documented then the next guy will come along and write his own, get it almost to the point of where the current ones are, then abandon it, etc…

Everyone always wants to dive into the “new hotness” without spending even a minute looking at what’s already there if it isn’t push-button ready. It’s unfortunate. (I fall into this trap all the time myself so I’m not being critical just pointing out an unfortunate truth.)

The SDK version needs a hero that will spend an hour or two trying to build the SDK and either document the process or document the issues.

…though honestly, I think the biggest issue with the SDK shader nodes is that it doesn’t have a PBR j3sn and some other quality of life j3sn defs… and that’s something that would benefit any shader nodes editor (or even those who just want to compose a shader in code).

The barrier of entry for that is significantly lower as you shouldn’t need to build the SDK just to implement those, I think.

3 Likes

I rather spend those hours on jfx and learn the design pattern of a simple desktop software, maybe that is my opinion, but you are right everything needs to be documented properly (i have intentions to build a simple wiki for jmb).