I’m nearly done with a shader that will let you combine all of these effects at once, but since it’s all being packed into one highly customizable glsllib it is taking me a bit longer than if I were to hard code jtus one of the effects into its own unique shader. The last 2 days were also unusually warm for winter in my area so I ended up spending the time I’d usually be coding doing yard work instead.
But so far it’s going well and I should be able to merge my code to your repo in the next few days.
I only ran into 2 issues with the test-case so far but managed to solve them.
First I had trouble trying to set the window’s position, so I had to change your project’s “runtime only” import on lwjgl3 to instead be “implementation” in order to call a screen positioning method. This way I was able to make the screen full sized and centered without using fullscreen mode (probably wasn’t necessary, but that’s just my preference to have a windowed fullscreen type of view as the default in all my apps)
And then I also had some trouble tweaking matParams for the active effect on the models since they consist of more than one material, and the material editor interface only edits one material at a time. So I added some code that will sync any specified matParams (like the blending matParam) across all of a model’s materials.
I also may be going beyond the scope of a test-case, since I’m also splitting each effect into a separate class for convenience and to display the way each effect can be layered ontop of others in any order, and swapped around easily at runtime. And, since some float vars will be packed into a vec4’s x/y/z/w vars, it will also be better to have a java class that automatically does that so the user doesn’t have to understand the shader code as much in order to use the shader.
Here’s a peak at some code and some comments showing how I have it setup to support up to 6 blend layers all on one glsllib, although most of the variable names and types aren’t finalized yet and likely will change a bit:
//support up to 6 blend layers. can easily modify your shader to use more by increasing this value and adding the extra defines to support them
#for i=0..6 ( $0 )
#ifdef BLENDLAYER_$i
uniform vec4 m_BlendLayer_$i_BlendVec; //note that this needs to be a vec4 to store all possible blending vals that change every frame, as to avoid the lag from changing a float parm every frame
uniform float m_BlendLayer_$i_BaseColor;
uniform float m_BlendLayer_$i_NormalIntensity;
uniform float m_BlendLayer_$i_Roughness;
uniform float m_BlendLayer_$i_Metallic;
uniform float m_BlendLayer_$i_EmissiveColor;
uniform float m_BlendLayer_$i_EmissivePower;
#ifdef BLENDLAYER_$i_HEIGHTBLENDMODE
uniform float floorHeightPercent;
uniform float roofHeightPercent;
//probably remove these 2 uniforms, and instead pack into the blending vec's y/z vals when this mode is enabled
uniform float heightEdgeBlend;
#endif
#ifdef BLENDLAYER_$i_NOISEDISSOLVE
//use a noise based map or noise equations for dissolve or dissolve-like blending effects
uniform vec4 DissolveEdgeColor;
uniform float DisolveEdgeThickness;
#endif
#ifdef BLENDLAYER_$i_ALBEDOMAP
uniform sampler2D m_AlbedoMap_$i;
#endif
#ifdef BLENDLAYER_$i_NORMALMAP
uniform sampler2D m_BlendLayer_$i_NormalMap;
#endif
#ifdef BLENDLAYER_$i_ROUGHNESSMETALLICMAP
uniform float m_BlendLayer_$i_RoughnessMetallicAoMap; //not setup to use individual roughness and metallic maps since that is less optimized, but can easily add them if needed
#endif
#ifdef BLENDLAYER_$i_EMISSIVEMAP
uniform float m_BlendLayer_$i_EmissiveMap;
#endif
#endif
#endfor
So this way you can put something like the ghost effect on the first layer, then still have ice or petrify applied on the second and 3rd layer, and also put things like sheild armor or lightning on the 4th and 5th layer (or any order really, depending on your games needs of course). I’ve been reusing a lot of the concepts I learned from making the terrain shaders, however in this case there’s a lot more room to be creative since a character model is waay smaller than a terrain and can handle cool effects without affecting the framerate at all really.
And of course any shaders that use this lib that don’t want to have all the defines set for 6 blend layers can juts leave the defines undeclared in the j3md and the shader will ignore the extra blending layers at no extra cost.
Otherwise I haven’t run into any serious issues or limitations, so I will hopefully be done soon.