Hey guys,
So question is very simple, not really sure if there’s a solution though.
I was wondering if there was something that could be added or modified in a transparent shader so it doesn’t render any part of the mesh that intersects with another one.
The problem I’m having right now is with this model. He is composed of three big spheres (ignore the inner spheres for the time being). I don’t want the part of the spheres that are inside the adjacent spheres of the body to render. I suppose the best solution would be not to make the mesh this way in the first place. However, this has been the best way for my bone animation to work.
Suggestions? Thanks!
If you learn how to write shaders, you could use stencils to achieve this.
It’s done! Thank you @kkirfield for pointing me int he right direciton.
Stencil buffer + zpriming did the trick. I don’t know if Implemented the following in the right way or if there’s some redundancy that I could’ve done without, there was a lot of intuition+guessing in the process. But basically these the spheres have different shader. The second sphere (the middle one) adds one to the queue and the last one adds to to the queue.
Then is the stencil bit on each shader. First sphere:
This shader always passes and the value of two where it does
Stencil {
Ref 2
Comp always
Pass replace
}
Second Sphere:
This shader will pass only for the pixels the first shader didn’t (since the comparison is set to not equal). It will also increment the value wherever it passes.
Stencil {
Ref 2
Comp notequal
Pass incrwrap
}
Third Sphere
This shader will pass only for the pixels the first and second shader didn’t
Stencil {
Ref 2
Comp notequal
}
The result: