Generate shaders (10 posts)

  • Profile picture of kwando kwando80p said 2 months, 3 weeks ago:

    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?

  • Profile picture of atomix atomix72p said 2 months, 3 weeks ago:

    http://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

  • Profile picture of atomix atomix72p said 2 months, 3 weeks ago:

    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 :p if you interest!

  • Profile picture of kwando kwando80p said 2 months, 3 weeks ago:

    @atomix Almost, but I want to generate shader source at runtime. Having a java program that generates the shader I want =)

  • Profile picture of normen normen1271p said 2 months, 3 weeks ago:

    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)

  • Profile picture of kwando kwando80p said 2 months, 3 weeks ago:

    @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?

  • Profile picture of normen normen1271p said 2 months, 3 weeks ago:

    No you have to upload the new shader to the GPU, so basically a new material, yeah.

  • Profile picture of Empire Phoenix Empire Phoenix156p said 2 months, 3 weeks ago:

    But that could be done on runtime, get old amterial, get textures ect, then create new, set the parameters from the old and done.

  • Profile picture of atomix atomix72p said 2 months, 3 weeks ago:

    @kwando :
    Java program for GLSL shader generation, current NO!

    Java program has “texture” making
    We have NeoTexture(godlike). :p

    ArtOfIllusion have one
    http://aoi.sourceforge.net/scrshots/fullsize/texture.png
    with ability to link directly to a fixed shader!

  • Profile picture of atomix atomix72p said 2 months, 3 weeks ago:

    @kwando said:
    @atomix Almost, but I want to generate shader source at runtime. Having a java program that generates the shader I want =)

    For code generation, I recommend a link here (which do it with Velocity)

    http://onjava.com/pub/a/onjava/2004/05/05/cg-vel1.html?page=2