Hello guys,
I’d like to have 3D text objects in my scene similar to simple 3d planes.
I’ve set up a Renderable3DTextComponent
in the hello world demo.
Following the instructions I set the BlendMode
to use AlphaBlend
and DepthMode
to ReadWrite
.
What I’m experiencing is that if the text object transfrom z coordinate is less than equal to the sphere transfrom z coordnate I get nice glyphs with the expected transparent background, however if the text is closer to the camera I will have opaque frames around the glyphs.
(Please see 2 screenshots with the text “Hello world”)
I’m pretty sure this has to do with z-order or me not using the right combination of modes, but couldn’t figure it out. Any hints and tips would be appreciated.
I did a simple plane as well with a transparent texture just to double check the modes, that’s what I would expect from the texts.
(Please see the screenshot with the text: “Texture”)
Hope it makes sense, and let me know what I messed up
Many thanks.
"Type": "nap::Entity",
"mID": "Text3d",
"Components": [
{
"Type": "nap::Renderable3DTextComponent",
"mID": "nap::Renderable3DTextComponent",
"Text": "hello world",
"Font": "Font",
"GlyphUniform": "glyph",
"MaterialInstance": {
"Material": "FontMaterial",
"Uniforms": [],
"BlendMode": "AlphaBlend",
"DepthMode": "ReadWrite"
},
"Normalize": true
},
{
"Type": "nap::TransformComponent",
"mID": "nap::TransformComponent_5",
"Properties": {
"Translate": {
"x": 0.0,
"y": 0.0,
"z": 0.2
},
"Rotate": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"Scale": {
"x": 1.0,
"y": 1.0,
"z": 1.0
},
"UniformScale": 2.0
}
}
],
"Children": []
}
{
std::vector<nap::RenderableComponentInstance*> components_to_render;
nap::RenderableMeshComponentInstance& renderable_world = mWorldEntity->getComponent<nap::RenderableMeshComponentInstance>();
components_to_render.emplace_back(&renderable_world);
nap::RenderableMeshComponentInstance& renderable_plane = mPlaneEntity->getComponent<nap::RenderableMeshComponentInstance>();
components_to_render.emplace_back(&renderable_plane);
nap::RenderableComponentInstance& renderable_text3d = mText3dEntity->getComponent<nap::RenderableComponentInstance>();
components_to_render.emplace_back(&renderable_text3d);
nap::PerspCameraComponentInstance& persp_camera = mPerspectiveCamEntity->getComponent<nap::PerspCameraComponentInstance>();
mRenderService->renderObjects(mRenderWindow->getBackbuffer(), persp_camera, components_to_render);
}