You could move the text to a separate scene and overlay it into the main one, or set a depthbias in the text’s material. But there are likely better ways involving Z-buffer magic and/or arcane depth writing.
Another option would be to use UI elements instead of components, but without more information about the exact goal you’re trying to achieve it’s hard to say which method would make more sense.
Starting my dive in QtCreator at /Source/Urho3D/UI/Text3D.h, I used Ctrl+Shift+U to find all occurrences of material_. I then noticed several if (!material_) lines which seemed worth investigating. This brought me to Text3D::UpdateTextMaterials:
It seems a temporary material is created if none is assigned, so you’d have to make it not null.
…or access the batch instead of the component.
Modanung – I REALLY appreciate your attention and time here. Thank you!
If I set the Material to non-null, will that do anything for me? Will I then be able to set the Material’s Render Order and the Text3D object will comply? That would seem odd.
And regarding accessing the batch - how to do that?
It’s too bad UrhoSharp seems abandoned. Currently for .NET standard 2.0 (and similar), the leading proposal for 3D support is now UrhoSharp – which has these deficiencies/defects. If we could pay someone to fix these UrhoSharp bugs, I think we would. Who is qualified to fix UrhoSharp bugs?
Miguel is busy with other things, and Egorbor too is now busy with other things. Seems Urhosharp is mostly an orphan now – leaving .NET Standard 2.0 apps without a production-quality solution for 3D rendering.
Eugene, using a custom material resolved our RenderOrder issue, however, the custom material I created, doesn’t look the same as the default material. In my screenshot below, the top image is the default material, with bad Z-order. The bottom image is using the new custom material (so Z-order is now on top, but the rendering is all messed up. Looks like it’s no longer getting the Colors… note, I tried to make the StrokeColor Yellow (for testing), but it’s still black.
Here is my C# code for creating this material:
var mat = new Material();
var tech = new Technique(priceNode.Context);
Pass pass = tech.CreatePass("alpha");
pass.VertexShader = "Text";
pass.PixelShader = "Text";
pass.BlendMode = BlendMode.Alpha; // (BLEND_ALPHA);
pass.DepthWrite = false; // SetDepthWrite(false);
mat.CullMode = CullMode.None; // SetCullMode(CULL_NONE);
mat.RenderOrder = 255;
mat.SetShaderParameter("ShadowColor", new Color(1f, 1f, 0, 1));
mat.SetShaderParameter("StrokeColor", new Color(1f, 1f, 0, 1));
text.Material = mat;
However, it was still sorta ugly, so I modified the Text shader to make it smoother around the edges, and looks “OK”. There is still the escalator/dithering effect that occurs when we move the camera pixel-by-pixel (as it tracks your motion on the map).
We may still be making our own Text3D object (based off current one, but fixes this dithering). For now, this will get us by. The Z-Order issue is now fixed.
Thank you Eugene – I wouldn’t have figured this out without your advice!