Mesh visibility rendering

Hey people,

as i am about to do some work around spline interpolation / subdivision i would be in need of proper methods to do the following:

have a mesh look somewhat like this (, so the lines are visible, as well as the triangles filled… i seem to be able to only accomplish one at a time, either getAdditionalRenderState().setWireframe(true) (which invalidates my textures) or Mesh.Mode.Triangles for the filled triangles, but in that case any line disappears… (what am i missing?)

the other thing is: i need to interact with the vertices (select them, tinker with position etc. and update everything)

Thanks in advance

You either have to render the geometry twice (first render with triangles, then render with lines with an offset), or use single-pass wireframe rendering (don’t know if a jME shader exists for it currently) explains it a bit

1 Like

don’t know if it would be useful to you, but this is what i did for one of my development where the objects had to have a “tron” like look :

Each triangle was UV mapped to a texture, whith coordinate 0,0)(1,0)(0.5,0.5). This texture had the lines between those point set to white, while the rest of the texure was black. In your case, you can invert the colors (black for the lines, white for the rest). Of course this mean you must have each triangle with its own points (to get an UV position), and you must change the UV Map… but is simple to do.

you can create a simple function that take a mesh and return a new mesh with the corresponding UV. you can then swith betwwen the two mesh at will…


Note : the fun part is that you can change a lot of things in this texture. for example in one of my test the black part was fully transparent at (0.5, 0.25) (ie the center of my tirangle, and was fully non transparent near my line. The model looked like a mesh, but with the added value that you knew teh lines in front of the others.

Note 2 : usign white as the color of the texture mean that you can change the look using the vertex color… in my case, the whole terrain was one small texture, with color of the hex vertex depending on the nature of the hex…

thanks a lot mohira, i will definitely look into this as soon as i get back to my system… reads as if there are some cool things possible :wink: and it should not be that hard to implement at first glance… (although i never digged into this until now)