Forums > Javascript

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

May 27, 2010 | 12:07 pm

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?


May 27, 2010 | 5:11 pm

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


May 31, 2010 | 8:12 am

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.

Attachments:
  1. text2D_js.js

June 1, 2010 | 10:33 pm

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


June 2, 2010 | 6:49 am

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


June 8, 2010 | 8:42 am

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.

Attachments:
  1. text3D_js.js

June 8, 2010 | 6:19 pm

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.


Viewing 7 posts - 1 through 7 (of 7 total)