7

I'm making my first JavaFX project and I need to render some 3D text. I already put a PerspectiveCamera and I display a text node but it has a Z-dimension of 0 and I don't know how to change this.

Thanks in advance!

José Pereda
  • 44,311
  • 7
  • 104
  • 132
codenoob
  • 257
  • 3
  • 15

1 Answers1

6

Have a look at the FXyz project. It already contains a Text3DMesh class that will allow you generating a 3D mesh for any string and font you need.

Text3D

Under the hood there is a complex process of converting (2D) Text to Path, Delaunay triangulation and mesh extrusion.

Text3D

As a result, you have a 3D mesh that can be easily rendered and textured (solid color, density map, images).

Have a look at the sample to get you started.

José Pereda
  • 44,311
  • 7
  • 104
  • 132
  • Thanks José! I will look at it – codenoob Aug 27 '15 at 19:18
  • Do you know if it will run in a Raspberry Pi 2? – codenoob Aug 27 '15 at 19:20
  • 1
    It should work, you just need to enable 3D flag, since it's an experimental feature. – José Pereda Aug 27 '15 at 19:21
  • Hi @José, I mangaed to compile the project and to render some 3d text but ANT couln't generate the Javadoc and I'm a little confused on how to use FXyz, is there a Javadoc online? – codenoob Aug 27 '15 at 20:49
  • 1
    No, there isn't. We have quite a bunch of tests to try all the shapes and the different options. Also you can have a look at the [Sampler](https://github.com/FXyz/FXyz). Also check this [post](http://jperedadnr.blogspot.com/2015/01/creating-and-texturing-javafx-3d-shapes.html). – José Pereda Aug 27 '15 at 20:54
  • @codenoob If you still have specific questions on the FXyz test examples, by all means ask them via the GitHub site and we will answer there. – Birdasaur Aug 28 '15 at 12:30
  • Thanks for all your help, but isn't there a way to give some kind of 3D perspective to text using what JavaFX already has? – codenoob Aug 31 '15 at 13:57
  • You can apply 3D rotations, like in this [answer](http://stackoverflow.com/a/28762212/3956070)... but still it will be 2D. – José Pereda Aug 31 '15 at 14:34