Is there good way to generate shaders on the fly? Essentially I want to convert a string to a shader at runtime. Is it possible in JME?
http://hub.jmonkeyengine.org/javadoc/com/jme3/material/TechniqueDef.html#setShaderFile(java.lang.String,%20java.lang.String,%20java.lang.String)
<= here we go!
By meaning of “Generate on the fly”, you think about a Node-base Shader Generation System? …
http://www.3dworldmag.com/files/2011/02/TDW137.mach2_.13_shadereditor.jpg
P/s: I didn’t test the method out, so don’t know what penalty the result can come across… By the way, I’m doing the same things like in the figure if you interest!
@atomix Almost, but I want to generate shader source at runtime. Having a java program that generates the shader I want
You could make your own loader for that, basically assembling the text for the shader when you are asked for a certain file. (using asset manager)
@normen ahh, should have thought of that. Can I change the shader for a material at runtime or do I have to load a new material?
No you have to upload the new shader to the GPU, so basically a new material, yeah.
But that could be done on runtime, get old amterial, get textures ect, then create new, set the parameters from the old and done.
@kwando :
Java program for GLSL shader generation, current NO!
Java program has “texture” making
We have NeoTexture(godlike).
ArtOfIllusion have one
with ability to link directly to a fixed shader!