Flat Shading in JME

Heh JME Community,

i am trying to find a Material that is flat-shaded to create a landscape like this:


I already searched a lot in the internet and also on the jMonkey Hub, but i didnt came to a solution without learning glsl100. And now what is my question: is there a Material in the standard jme3 libraries or are there other resources i can get a Material from that i can apply to my terrain and other objects that will make them simply flat-shaded?

I hope anyone of you got a solution for me, i would be really thankfull :wink:

Greetings, Pointifix

Did you look at the cartoon shader post effect?

That flat shaded look requires actually flat shaded meshes. It has little to do with the material/shader you use (you could generate that look with a geometry shader but that would be more complicated and slower).
Other than that most of those renders look good because of the global illumination which is difficult to do in realtime, so you’ll have to bake global illumination in blender or some other tool.

Sounds good, but i cant find any information to that, i only found:

jme3/src/test/jme3test/post/TestCartoonEdge.java – CartoonEdgeFilter
jme3/src/test/jme3test/post/TestTransparentCartoonEdge.java – CartoonEdgeFilter

I am knew with jme, normen would you be so kind explaining me how to add this to my terrain mesh?

The same way as in those tests.

To get flat shading like that… you need flat shaded meshes. It cannot work otherwise. The normals have to be aligned as there is no way for the GPU to guess what normals you really want.

…once you have a proper mesh, Lighting.j3md should work.