strange thing with creating jit.gl.text3d in js (bounding box while intersect)

llumen's icon

I've been developing this script where I wanted to be able to change individual letters' color and size and font in js

there is a strange behavior I get when creating an array of jitter text3D objects:
when I create another object (let's say a nurbs) it can intersects with the sentence (composed out of different jit.gl.text3D objects) however around each of the letters there is a kind of bounding bow , colored in the same color as the erase_color which makes that the intersection is not the way I want to.

I create the jit.gl.render in the patch, not in the js

when I recreate this without JS it doesn't happen.
Is there something that I missed in JS about this?

Joshua Kit Clayton's icon

Sounds like a depth buffer issue somehow. As always, please provide a simple example, along with platform details.

llumen's icon

so here is the js we've written and the patch, in the subpatch Connortext there is the javascript object to display the text, when you press spacebar the text should start following your mouse when you're on the screen.

607.text2D_js.js
js
Joshua Kit Clayton's icon

It's a depth buffer issue. In the patcher version, they are probably rendered in different order or something. Use newText[i].depth_enable = 0. You may also need to do something like ensure you draw the text last if it should be on top of the nurbs object. This can be done using either non-automatic mode or the layer attribute (e.g. newText[i].layer = 1).

Anyway hopefully this helps. I found your patch to be relatively complicated and confusing. Please try to simplify next time before sending your report to us.

Thanks,
Joshua

llumen's icon

Joshua,

Sorry for making it such a messy patch to begin with. I'll try to make it easier to understand today. The depth_enable = 0 did fix the bounding boxes, thanks for that.

I don't want the text to be always on top though, I want it to intersect with the nurbs, I'll make a 'simple' patch how I want it to be without the javascript to explain

llumen's icon

Okay it took me longer to skin the patch a bit but I'll upload it now.

The issue that remains is that when text3D is created within the patch (not javascript) it intersects nicely with a nurbs (textGlyphs in front of the vertexes are seen what is behind the vertexes of the nurbs is hidden.

When I create text with the javascript this behaviour is radicaly altered.

So the question is how to fix this with the javascript enabled text.

657.text3D_js.js
js
Joshua Kit Clayton's icon

With jit.gl.text2d you need to *disable* depth buffering for what is rendered in 3D as a blended textured rectangle. With jit.gl.text3d, however, this should be *enabled* for the appropriate results when rendering this 3D geometry. That is the difference in the patch you presented.

I agree that using jit.gl.text3d is the best way for you to achieve your stated results, since there isn't a way to make the alpha channel of jit.gl.text2d modulate the depth buffer, which is what you'd need for the appropriate intersection of jit.gl.nurbs and the text itself.

Hope this helps.