Examples of Text3D[ ]

Importing Functions

To use Text3D, you need to make sure it is loaded. To avoid repetitive loading, use Needs[].

Needs["Text3D`"]

Then, we can invoke the help with ?Text3D

?Text3D

Produces Line[ ] Primitives

Using Text3D shows what happens. It produces a lot of Line[ ] statements, that will make up the letters when used inside Graphics3D[ ].

txt = 
        Text3D["test", {0, 0, 0}, {1, 1}, {0, 0, 
            0}];
Short[txt,  10]
Text3D[{10, 947}, {0, 0, 0}, { .1,  .1}, {0, 0, 
          0}][[1]]

Displaying Graphics

To display 3D graphics use Show[Graphics3D[{ graphics primitives } ] ], or Show@Graphics3D[{ graphics primitives }] :

Show@
        Graphics3D[{
txt, 
Text3D["test\
", {0, 0, 0}, { .8,  .8}, {0, 0, 0}, 
              RotationMethod -> 
                Euler]
}];

Rotating

The default RotationMethod->Geographic uses intuitions from geography to rotate the Text3D[...{λ,ϵ,τ}] to longitude λ, elevation (latitude) ϵ, and tilt τ .
The text starts on the x-z plane.

teg1 = 
        Table[
Text3D["tilting", {0, 0, 0}, {1, 1}, {0, 
              0, i}], {i, 
            0, π/4, π/16}];
Show@Graphics3D@teg1;

leg1 = 
        Table[
Text3D["longitude", {0, 0, 0}, {1, 
              1}, {i, 0, 0}], {i, 
            0, π/4, π/16}];
Show@Graphics3D@leg1;

leg2 = 
        Table[
Text3D["latitude", {0, 0, 0}, {1, 
              1}, {0, i, 0}], {i, 
            0, π/4, π/16}];
Show@Graphics3D@leg2;

The alternative Euler, rotates first around the z axis, then the x axis, then the z-axis again. The text starts on the x-y plane:

zeg1 = 
        Table[
Text3D["z-axis", {0, 0, 0}, {1, 1}, {i, 
              0, 0}, RotationMethod -> Euler], {i, 
            0, π/4, π/16}];
Show@Graphics3D@zeg1;

eg1 = 
        Table[
Text3D["x-axis", {0, 0, 0}, {1, 1}, {0, 
              i, 0}, RotationMethod -> Euler], {i, 
            0, π/4, π/16}];
Show@Graphics3D@eg1;

zeg1 = 
        Table[
Text3D["x-z-axis", {0, 0, 0}, {1, 
              1}, {0, -π/4, i}, RotationMethod -> Euler], {i, 
            0, π/4, π/16}];
Show@Graphics3D@zeg1;

Using in Graphics

If your graphics object is in primitives, you can just add it next to the Text3D commands. If it is produced by a plotting function, assign it to a name, then use that in an array on which Show[ ] is applied, where Graphics3D[ ] is one more element of that array.

Primitives Example

rantri = 
        Table[
Polygon[
Table[
              5 Random[]  -  
                2, {3}, {3}] ] ,  {10}];
Show@
        Graphics3D[{
rantri, 
            Text3D["test", {0, -1, 0}, { .8,  .8}, {0, 0, 0}, 
              Align3D -> Center]
}];

Example with function for Plotting

plt = 
        Plot3D[Sin[x Cos[y]] + x/4 + y/4, {x, -4, 4}, {y, -4, 
            4}];

\(\(txtplt = 
        Show[{plt, 
            Graphics3D[{
Text3D["Waves", {0.2, 0.3, 
                    1.5}, { .8, 1.2}, {π/8, 0, π/4}, 
                  Font3D -> 
                    TimesBoldFont3D, 
RotationMethod -> Euler, Align3D -> 
                    Center], 
Thickness[ .012], 
Text3D["Waves", {0, 0, 1.5}, { .8,  .8}, {π/8, 
                    0, π/4}, 
                  Font3D -> 
                    TimesBoldFont3D, 
RotationMethod -> Euler, Align3D -> 
                    Center], 
Thickness[ .002], 
Text3D["bobbing", {1.5, \(-2\), 
                    1}, { .3,  .5}, {0, \(-π\)/8, 0}, 
                  Align3D -> Right]
}]}];\)\)

Inspect All Around

Use the undocumented package RealTime3D to be able to rotate it at will. Unfortunately, it confuses coloring.

Needs["RealTime3D`"]

\(\(Show[{plt, 
          Graphics3D[{
Thickness[ .012], 
Text3D["Waves", {0.2, 0.3, 1.5}, { .8, 
                  1.2}, {0, \ \(-π\)/8, \ π/4}, 
                Font3D -> 
                  TimesBoldFont3D, 
RotationMethod -> 
                  Euler, Align3D -> 
                  Center], 
Thickness[ .002], 
Text3D[\ "bobbing", {1.5, \(-2\), 
                  1}, { .3,  .5}, {0, \(-π\)/8, π/4}, 
                Align3D -> Right]
}]}];\)\)

TextPlot3D

The Text3D package also contains the function TextPlot3D[ function, string, {x, y}, {hscale, vscale}, angle ]. Define a function of x and y previously, and it will place the text according to the z-values that function produces. Add some vertical distance for the text to not be obstructed by the surface.

?TextPlot3D

f[x_,  y_] :=  .4 + Sin[x Cos[y]] + x/4 + 
        y/4
txtplt2 = 
        TextPlot3D[
          f, "surf 's up", {-3.8, -1}, { .9,  .9}, -π 3/
              20];
Show[{plt, Graphics3D[{AbsoluteThickness[2],  txtplt2}]}, 
        DisplayFunction -> $DisplayFunction, 
BoxRatios -> {6, 6, 1}, 
        ViewPoint -> {3, -3, 3}];