Invisible shader or other solution?

outoff's icon

Hi, Jitterlist!
Very interesting, how to do particular invisible of model, mesh or primitive controlled by texture like mask. For example if texture black=transparency, if texture white=full visible.
Sorry for bad english!
May be I dont know about microsolution for this megaproblemm )))
Thanks for any tip!
Cheers!

Rob Ramirez's icon
Max Patch
Copy patch and select New From Clipboard in Max.

if you want to create transparency based on luminance, you can utilize the alphaglue shader.
here is a basic example. make sure you pay attention to the depth_enable/blend_enable/automatic attributes on the object you wish to apply transparency to.

outoff's icon
Max Patch
Copy patch and select New From Clipboard in Max.

thank you for the brilliant example!
I've change '@cool_face' to 0 for view "interior" (this is what I need for sure), but blue sphere inside has not exactly inside the textured sphere, how to fix it?
thank you again!

Rob Ramirez's icon

it's a little tricky.
one thing you can try is to duplicate the shape, turn front-face culling on (@cull_face 2) and turn back-face culling on on the the original shape (@cull_face 1).
then bang the front-face cull, the middle sphere, then the back-face cull.

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

might work

outoff's icon
Max Patch
Copy patch and select New From Clipboard in Max.

wow! it's exactly what I mean! you make my day! many thanks!
when I search today the right combination in your patch, I found that diffrent objects little bit dissapointed in space to another one
(look patch 'apple & mushrooms' I've made it before your last tip)
I think that I not exactly understand how 'planes' is works (

Rob Ramirez's icon

well, again, if you want to show an object inside another object, i think the easiest solution is to render the outer object twice, once with cull_face 1, and once with cull_face 2.

you need to turn automatic off for all 3 objects, and bang the cull_face 2 object first, then the inner object, then the cull-face 1 object.

this should work for the most part for gl objects inside other gl objects, but any other circumstances could break the effect.

Andrew Benson's icon
Max Patch
Copy patch and select New From Clipboard in Max.

My new favorite way to get around this is by using alpha-testing via jit.gl.sketch. An example of this is below. The way it works is, the object will only write into the depthbuffer if the alpha value is greater than a certain amount. This doesn't work with translucent objects, since it's really either on or off, but it works great for stencil type textures.

Rob Ramirez's icon

love it!

outoff's icon

great! thank you guys!

Sophia's icon

I have a somewhat similar problem. In the below example, I want to be able to see both spheres entirely, rather than one being covered by the background of the other videoplane. I'm also wondering if there is a way to use the alphaglue shader in jit.gl.shader instead of the slab, since I intend to use this in a poly~ abstraction and not sure if I would get naming errors with the slab.

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

Thanks,
Zach

Rob Ramirez's icon
Max Patch
Copy patch and select New From Clipboard in Max.

@blend_enable 1 on your two videoplanes (should probably also set @depth_enable 0)

Sophia's icon

Thanks, robtherich! I'm trying to implement this in a poly~ abstraction (I think you commented on another thread I had about that), also with a radialblur shader, and am getting some weird shading where the videoplanes overlap leading to obvious vertical lines at the edges of the planes. I'm wondering if anyone has a solution for this.

Also, the colors on my gridshape are acting weird- almost like they're using the first value as both red and alpha. Any ideas what is going on here?

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