Page 1 of 1

[2.1] render wire and solid

Posted: Sat Aug 31, 2019 10:25 pm
by nqdev
I have a manual object in 2.1 using vertex and index buffers. I create an Ogre::Item and then set a datablock which in turn has Ogre::HlmsMacroblock.mPolygonMode set to PM_WIREFRAME. From there I create a SceneNode, attach the Item object, set it's position and scale, and it renders as a wire.

What I'd like to do is render the the triangles as a solid with a different color on each side, yet still have the wireframe show through as another color.

Can anyone give some guidelines on that?


Re: [2.1] render wire and solid

Posted: Sun Sep 01, 2019 11:31 am
by Hrenli
A straightforward solution which comes to mind first is to create two items. One with a solid macroblock assigned to it (and then it's up to you how you want to color different sides - using a texture or vertex colors) and another with wireframe macroblock and without depth write/check to avoid z fighting. Downsides are - two draws instead of one and your whole wireframe will be visible trough all other meshes.

Another straightforward solution could be having a special texture for the mesh (with edges drawn on it) but in that case edges might not be as thin as you want them to be and creating such texture might be not trivial.

The most flexible solution would be to use custom shaders to do something like this - ... eframe.pdf, which would require either using a low level material or custom HLMS I suppose.

And then there might be some other approach which I miss. Maybe one of our gurus could come up with something?

Re: [2.1] render wire and solid

Posted: Sun Sep 01, 2019 12:11 pm
by paroj