[2.1] render wire and solid

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
Post Reply
Posts: 20
Joined: Sun Sep 09, 2018 12:59 am

[2.1] render wire and solid

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


Posts: 73
Joined: Tue Jun 14, 2016 12:26 pm
x 19

Re: [2.1] render wire and solid

Post 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 - http://developer.download.nvidia.com/SD ... 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?

OGRE Team Member
OGRE Team Member
Posts: 1400
Joined: Sun Mar 30, 2014 2:51 pm
x 610

Re: [2.1] render wire and solid

Post by paroj »

Post Reply