3D text with perspective projection
Posted: 04 Aug 2021, 11:34
Hello!
I'm working on 3D text labels, which should be affected by camera view and projection matrices. I'm creating text dynamically in C++ backend and add as a child to a grid (it's kinda a viewport).
The problem is that this text batches with other SDF texts, which are drawn also in UI, and it's only attached ortho matrix.
So it's multiple problems here
1) While experimenting with XAML (but I should use C++, because of dynamic text creation), I've added TextBlock to a Grid (Viewport), which is part of bigger Grid (Whole screen)
But instead it translated whole UI and rotation doesn't work
2) How to provide model and view matrix, and even custom projection matrix? While model and view can be combined into one, should I use ModelTransform3D for this? And for custom projection?
3) While setting CompositeTransform3D from C++ like
Nothing happens, text beign rendered in the top left.
I'm working on 3D text labels, which should be affected by camera view and projection matrices. I'm creating text dynamically in C++ backend and add as a child to a grid (it's kinda a viewport).
The problem is that this text batches with other SDF texts, which are drawn also in UI, and it's only attached ortho matrix.
So it's multiple problems here
1) While experimenting with XAML (but I should use C++, because of dynamic text creation), I've added TextBlock to a Grid (Viewport), which is part of bigger Grid (Whole screen)
Code: Select all
<TextBlock Text="This should be 3d transformed text">
<noesis:Element.Transform3D>
<noesis:CompositeTransform3D TranslateX = "50" TranslateY = "25" RotationY="-40"/>
</noesis:Element.Transform3D>
</TextBlock>
2) How to provide model and view matrix, and even custom projection matrix? While model and view can be combined into one, should I use ModelTransform3D for this? And for custom projection?
3) While setting CompositeTransform3D from C++ like
Code: Select all
_temp_text_block = Noesis::MakePtr<Noesis::TextBlock>();
grid_text_tool->GetChildren()->Add(_temp_text_block);
auto transform3d = Noesis::MakePtr<Noesis::CompositeTransform3D>();
transform3d->SetRotationX(45);
transform3d->SetCenterX(40);
transform3d->SetTranslateX(50);
_temp_text_block->SetText("Dynamic text inserted");
_temp_text_block->SetTransform3D(transform3d);