Shader programming

Hi,

I am relatively new in jMonkey and started a project a month ago. I started with implementing terrain as I want something special jMonkey does not support yet as far as I know. So I started to search for terrain creation technics. During this I also learned that I can modify vertices via Shaders on the GPU.

Is there another way than materials to use them, like running a shader on all vertices of a specifc mesh, node or even scene? I’d like to have material independent shaders. Or rather I want some shaders to run before the material shaders and be more flexible. Is this possible at all?



And I also wonder if there is a geometry shader support in jMonkey by now. In the docs and tuts it says no but I have found some references in the source for that as if it is at least being worked on.

@xeratos:



as i good know, it is possible, look on filters. (but you will probably need to modify JME common materials and add technique)



BTW: modifying vertices via shader will not affect physics, etc. so it’s bad idea to make terrain creation via it.

and BTW2: there are already terrain creation technics in JME. (but without caves)


And I also wonder if there is a geometry shader support in jMonkey by now

http://hub.jmonkeyengine.org/groups/contribution-depot-jme3/forum/topic/support-for-geometry-and-tesselation-shaders-diff/

shaders should not interfere logic, it should only increase quality of graphic.

Thanks for your fast reply. I will have a closer look on filters and the link looks interesting, too.

Also good to know that physics are not affected … I had kind of feeling for that with my first tests when I recognized that the culling on the node is also not affected. My simple face disappeared a little weired :wink: Makes sense if i only work on vertices haha.



I just found out that Material has a method render(geom, renderer) does it do what it sounds like? applying its shaders to the geom independent from the Material shader set to the Geometry?



For the logic thing I will find proper solutions I think, so nvm, for now.

Material.render() is used internally to render geometry during the full frame rendering. It is not advisable to call this yourself.



If you want to modify the vertexes then you can also do it in code. There is no strong advantage to doing this as a separate step through some weird shader call.