Archive 17/01/2023.

How to modify Debug Renderer Colors?

evolgames

Hello, where is the style, perhaps .xml, file for the 2d Debug Renderer? I’d like to modify the colors.

Also, is it possible to pass custom colors for certain shape objects, for example, one color for polygons, one for circles?

I’m using the lua scripting with the Urho3d Player but I can’t figure out where the debug colors come from. Is it a shader?

Also, apparently sending

AddPolygon()

for each rigidbody, without letting the DebugRenderer draw on its own, is magnitudes slower than letting the DebugRenderer do it.

The simulation I’m working on will work totally fine with simple 2d rigid bodies and forces. The built-in debug rendering is very fast and beats calculating rotations/vertex points and drawing all 2d geometry manually with AddPolygon. I tried that, and it’s just far too slow. I really don’t need or want any sprites or images.

From what I understand, U2D is mostly centered on sprites. Also, somehow drawing 200 sprite soccer balls is much faster than sending 200 AddPolygons to the DebugRenderer, but just letting the DebugRenderer do its thing with the Rigid Bodies is faster still. You would think the last two would be the same speed, but they aren’t. That’s weird.

So, I’m faced with two choices to maintain speed:
I create sprite images of 2d primitives, and then stretch and scale those, which seems really silly…
Or I figure out how to edit Debug Renderer colors, because while the rendering is great, I need separate colors to be set.

EDIT: elix22’s answer is correct, and what I was after. In my case, I needed to rebuild the Urho3dPlayer after making changes to the file mentioned. I’m sure there’s a more efficient way to build just the U3dPlayer, but I just modified that file in the Source folder, and then rebuilt the whole Urho3d folder using the “Getting Started” guide. It works exactly how I wanted and now the debug is coloring based on my changes.

Thanks guys

throwawayerino

In cpp I can just pass the debug renderer a class named color when adding a shape. As far as I know, there’s only one debug renderer and it optionally takes in a color. It shouldn’t be different from lua or angelscript

evolgames

I can easily do:
DebugRenderer:AddPolygon(some vector3s, COLOR)
That’s not the problem. My problem is the auto-added geometry colors.

The debug renderer is automatically adding and generating shapes, lines, and colors for rigid bodies if you turn it on. So it’s rendering all my 2d rigid bodies as semi-transparent blueish and then tinted red when activated. Edge lines are rendered as green-cyanish.

Take a look at the Constraints2d sample. All of those lines and polygon shape are being automatically generated by the debug renderer, but I have no idea where those color values actually are.

There has to be a file somewhere that sets those default color values.

elix22

Take a look at :
File : Source/ThirdParty/Box2D/Box2D/Dynamics/b2World.cpp
Function : void b2World::DrawDebugData()