Forums > Jitter

jit.gl.mesh self transparency problem

July 16, 2013 | 7:29 pm

Hi,
I’d like to play with geometry and the mesh object but, I really need transparency of rendered "objects". But as you can see from the attached patch and image, it cannot render transparency properly, it doesn’t render at all…

Thank you.

<code>

– Pasted Max Patch, click to expand. –

</code>

Attachments:
  1. transparency

July 17, 2013 | 4:20 am

transparency in OpenGL (the technology Max uses) is not automatic and perfect. It is just the way that OpenGL is designed and implemented.

A large part of getting transparency to work like you probably want it to work…is to change the drawing order. You need to draw the items furthest away from the camera first, and then draw them in order moving towards the camera. This includes things like the mesh. In your example, the mesh is drawing in an order which makes the transparency not able to perform well. If you rotate the mesh using @rotatexyz -5.469016 -133.987686 55.153473, then the transparency behavior is better. This is because in that rotation, OpenGL is drawing the segments of the mesh furthest away from teh camera first.

This is a normal part of learning OpenGL. And dong self-transparency is a particularily tricky part.


July 17, 2013 | 7:16 am

Try messing around with the @blend enable and the @depth enable settings. I plug my jit.gl.model object into jit.gl.node and then send that to a videoplane. This lets me keep the transparency and makes it easier (for me at least) to decide the drawing order of multiple objects.


July 17, 2013 | 9:21 am

Thank you very much Diablodale, I’ve already met the render order issue, I did not think it was one of those cases.

I’ve solved with a simple GEN patch.

Andro, I think you didn’t get the problem, with other objects the alpha is ok, but, I was looking for self transparency.

Here is the modified patch.

<code>

– Pasted Max Patch, click to expand. –

</code>


July 18, 2013 | 4:45 am

The patch you posted might work for the specific orientation of your sphere. However, if you rotate it in any way, it is likely that the vertices will no longer enable you to just reverse their order (using your gen sampler). To solve the general case that works all the time, you would need to do sorting. And…sorting can be non-trivial because of the many cases of overlapping and slanted polygons.
Its a fun problem to tackle. :-)


July 18, 2013 | 5:48 am

Yes, I know this, ordening in this complex system(for me) can be a problem, I’ve already did some fake 3D or 3D ordening in processing, but it was a system totally generated by me and it was a simple system.

I think I will live with this issue and show to the camera only the right face.

I did this patch just to try, maybe I won’t use the GEN order reverse and I will implement some kind of reverse on the rotatexyz degrees.


August 4, 2013 | 1:33 pm

Hey, I’ve found a workaround just on this forum posted by Rob Ramirez, I’ll try soon.

http://cycling74.com/forums/topic/blend-mode-alpha-jit-gl-texture/#post-238808


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