I’m trying to understand that whole shader stuff now for at least a weak and still not much. I don’t have the slightest clue how it all works.
I tried the Wikipedia article, which is pretty general, as you would expect it.
Then I tried the JME3 Wiki entry. Now I know I can submit textures and properties from Java to my shaders. Great.
I looked at some of the shipped shaders and mat defs. Not much commented in there, especially not in the BasicShadowRenderer stuff, in which I’m particularly interested because I’m trying to implement projected textures. I found I’d best start there while looking through the forums. Only two entries regarding JME3. Seems to be a pretty hot topic.
Still, that’s not my main problem. I’m bugged with even simpler questions like: How do I apply a shader to… something? Where is it attached? I understood you need a material definition for a shader. But… I’m not sure if and how you can assign multiple material definitions to one model. Example (which has nothing to do with my projected texture attempts): Those freeze effects (on first sight seems to be the basic texture multiplied with some… light blue transparent ice texture) you see in some RPG games on character you shot with a frost bolt - is this possible with shaders? If it is, do you create a single shader for the “frozen” state and apply it to whatever model gets frozen? Or does each model require to have that shader definition from the start and it’s only toggle by a boolean because you can’t assign multiple material defs to one model?
Maybe somebody can suggest a good tutorial or whatever for understanding all that shader stuff in JME3?
Sorry for my English. I hope you understand me. ^^ Thanks in advance for any helpful answer.
– Edit –
I just noticed that sneaky link to jME3_materials.pdf. That looks promising. http://hub.jmonkeyengine.org/groups/development-discussion-jme3/forum/topic/jmonkeyengine3-material-system-full-explanation
Hi!!! Actually, shader are not so difficult. Just like C language.
Shader (vertex) → Shader (pixel (fragment)) → MatDef → Mat (material).
Shader (vertex) - is geometry (polygons, vertexes) with UV coordinates.
Shader (pixel(fragment)) - is color, texture of polygons.
MatDef - defined variables of a shader
Mat (material) - material applied to your model.
Start learning basic shaders.
Also, there are some differences between OpenGL-GLSL and JME-GLSL. Just have a read “JME3 and OpenGL 3 & 4 compatibility”:
Don’t know if you read it but there is a doc for jME3 and shaders with a quick intro to general shaders https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:advanced:jme3_shaders
Also for your frozen texture example, there are many ways to do it, and both ways you mentioned are valid.
One thing to understand is that shaders are applied through materials, and are linked in the material definition file
You should really read the section Rendering, Materials, Light and Shadow in this doc https://wiki.jmonkeyengine.org/legacy/doku.php/jme3#tutorials_for_beginners
(it won’t hurt to read all of it though :p)