How to draw wireframe overlay of a drawable

Just like Unity Editor does to show the geometry of the drawable. e.g. draw the wireframe of a StaticModel.

Any ideas?

I duplicated the mesh in the editor for the mock-up.

You could use a material with fill mode set to wire maybe with a tiny tiny negative depth bias.

1 Like

When you use CollisionShape component with TriangleMesh shape of that object you can see a wireframe in DebugGeometry mode.

1 Like

That assumes the drawable has physics - for cases where the drawable may not have physics, the correct answer is to draw the object twice - once to fill the surfaces, and once to draw the wireframe overlay, using different material settings for the fill mode, and yes, a small negative depth bias

True, but CollisionShape method is easy to set up in editor and try right away if you need to quickly debug something.

1 Like

Yep, debug drawing for physics objects is super easy and useful!
Most of the time, if you care about looking at the wireframe, it has physics - but we have to talk about all the use cases - we can’t assume when we generalize

For some strange reason, if I try to enable the physics debug draw mode, when the game is compile in the “Debug” mode on Visual Studio, the game crashes. Displays fine when compiled in the “Release” mode. Does any one have any idea why this may happen?

Are you using constraints?
There is a bug in our DebugDrawer for drawing the angular limits of constraints, where those constraints are invalid / in a violated state.

I simply disabled debugdrawing of constraints, and no more crashes.
I have no idea why you’re seeing a crash only occurring in Debug mode, but hey, that’s good, you should be able to trace the call stack to find the problem :slight_smile:

There are many issues actually -

  1. Skinning is done in GPU, CPU side positions are not what we see.
  2. How can we draw a material and also draw another wireframe material on it? (I duplicated the model to simulate the effect). ie. If we want to “patch” the drawable and draw wireframe for it, how can we “inject” the patch process?
  3. If we want to enable the wireframe globally in the Editor, we need an extra pass after all post process passes? Otherwise any post process will ruin the wireframe