psla314 3 Posted February 28, 2022 I am using a TViewport3D on an FMX Form. I am trying to display 2D text floating over a 3d Cube (as a simplification of my project) I need the text projected to Camera (not Screen) because i want it to rotate with the cube. I have tried using - TPlane with a texture of the text on a transparent png, - TTextLayer3d using the text field - TImage3D with the text on a transparent Bitmap, every time the background of the plane containing the text/image obscures the cube. I dont really want to use TText3D because it is so slow, drops frame rate from 50 down to 12 FPS (I need about 8 floating texts) textures are much faster if I can get the transparency to work. The first attachemnt shows the background of the TTextLayer3d hiding the cube and the second image shows the text getting hidden with z-write turned off ( thought this might be the answer) Any Ideas ? Share this post Link to post
corneliusdavid 214 Posted March 1, 2022 Try putting a TLayer3D on the cube (as a child object) and then adding a TLabel to that. To make the TLayer3D transparent, check Transparency property and make sure the Fill.Kind property is set to None (sometimes you have to toggle that to Solid and then back to None to get it realize it really should be transparent). Share this post Link to post
qubits 20 Posted March 1, 2022 On 2/27/2022 at 11:58 PM, psla314 said: I dont really want to use TText3D Had to drop it too, was bugging me out.. If you want to spin the text with the cube, maybe just use a Timage3D and loose all the other layers.. really should be TText3d then you can see all sides. I'm playing in 3d. Github here.. Share this post Link to post
psla314 3 Posted March 2, 2022 (edited) 7 hours ago, corneliusdavid said: Try putting a TLayer3D on the cube (as a child object) and then adding a TLabel to that. To make the TLayer3D transparent, check Transparency property and make sure the Fill.Kind property is set to None (sometimes you have to toggle that to Solid and then back to None to get it realize it really should be transparent). That seems to work, great thanks for that idea. Update - Works in Design mode but when i try to create the objects dynamically the layer is opaque again, see attached image. Here is my code, any ideas how to have the Transparency Property work, i tried your suggestion to toggle the brush and toggle the transparency at runtime, but no luck. var box : TDummy; layer : TLayer3D; textlabel : TLabel; begin box := TDummy.create(Viewport3D1); box.SetSize(1, 1, 1); box.OnMouseDown := CubeMouseDown; box.OnMouseUp := CubeMouseUp; box.OnMouseMove := CubeMouseMove; box.AutoCapture := true; Viewport3D1.AddObject(box); layer := TLayer3D.Create(Viewport3D1); layer.Position.Point := TPoint3D.Create(0, 0, -2); layer.setSize(1, 1, 0); layer.HitTest := false; layer.Fill.Kind := TBrushKind.None; layer.Transparency := true; box.AddObject(layer); textlabel := TLabel.create(layer); textlabel.Align := TAlignLayout.Center; textlabel.AutoSize := True; textlabel.Text := 'My Text'; textlabel.TextAlign := TTextAlign.Center; textlabel.VertTextAlign := TTextAlign.Center; layer.AddObject(textlabel); Edited March 2, 2022 by psla314 Share this post Link to post
psla314 3 Posted March 7, 2022 On 3/2/2022 at 11:24 AM, psla314 said: That seems to work, great thanks for that idea. Update - Works in Design mode but when i try to create the objects dynamically the layer is opaque again, see attached image. Here is my code, any ideas how to have the Transparency Property work, i tried your suggestion to toggle the brush and toggle the transparency at runtime, but no luck. Update: Found my problem, the layer has to be a child of the cube otherwise doesnt work. Once changed the layer3d to be a child of the cube it works. Share this post Link to post
corneliusdavid 214 Posted March 7, 2022 1 hour ago, psla314 said: Found my problem Sorry I hadn't seen your question from a few days ago but glad you found the solution. Share this post Link to post