jit.gl.text2d coordinates in 3d-space question

mark2e's icon

Greetings you all

I am generating text-labels for some points in 3d space with the jit.text2d object which is working just fine.
But: Now I would like to add some backdrop behind my text for better visibility.
I am doing this using the coordinates i feed into text2d, for a scaled gridshape object.

This is working well as long everything is on Z=0. As soon as things start to move into the back, the gridshapes get smaller (due to perspective) but the text does not (due to screenmode = 1)

So my question is: Is there some way to get the gridshapes behave the same way as the text2d objects do? (coordinate-wise.) E.g. Moving only on the XY-axis but not on Z?

Thanks for the help!

Screen-shot-2013-07-25-at-11.17.12-PM.png
png
diablodale's icon

I want to help, but I'm unclear of your intention.
If you don't want to move the gridshapes on Z, then don't move them.
But what visual effect are you trying to do?
Do you want a gridshape, with a white box overlayed, and on top of the white box have text?
??

If so, there are so so so many ways. In teh OpenGL world, by default, everything is 3d and drawn with perspective. Do you not want to use 3D perspective? If so, then maybe you want Max mgraphics; it is all 2D vector graphics drawing.

If you want to control the text in 3D, then scale, rotate, and change the Z location of your gridshape, textbox, and text as needed.
You can also use the @layer attribute to force a certain drawing order if you want things like transparency control.

mark2e's icon

Hi, Dale

Thanks for your response.

To clarify: I have a cloud of particles (in 3D space), each one having a certain database entry linked to it. Now I can hover around and select groups with the mouse (or whatever) and the Name appears. Everything is working fine, except: As there is much going on, some of the texts are not readable very well. Hence I wanted to add a little "backdrop" between text and particles. (See the attachment above)

But: As the text2d object discards some Transformations (Screenmode = 1) it stays the same size regardless of the Z coordinate. If I now attach a gridshape-backdrop to those same coordinates, it gets scaled due to the perspective transformation (the one text2d disregards). See the attached patch as example.

Now I tried to undo the Perspective with a reversed projection-matrix, and other things, without success. What am I missing?

Max Patch
Copy patch and select New From Clipboard in Max.

Thanks again!

diablodale's icon

Perhaps
- not use @screenmode=1; nothing is perfect
- use jit.gl.text3d

You can use objects like jit.anim.node to group/align the text w/ the box and then position that group using its parent anim.node.

mark2e's icon

Hi,

Thanks again, Then perhaps I indeed will just not use screenmode=1
jit.gl.text3d is too heavy unfortunately as there can be lots of labels depending on the situation.

Cheers