Home Game Development unity – How to make a shader which alpha blends towards solely itself, and is opaque in any other case?

unity – How to make a shader which alpha blends towards solely itself, and is opaque in any other case?

0
unity – How to make a shader which alpha blends towards solely itself, and is opaque in any other case?

[ad_1]

The scene incorporates a set digicam view and a mesh which may have geometry inside itself or in any other case occluded by itself. I desire a option to visualize inside this geometry like x-ray imaginative and prescient so details about that occluded geometry may be proven.

Here is a tough illustration to convey the concept:

Crude example of how I'd like it to look like if there was inside geometry being occluded
This is how it might look if the shader did the next:

  • Render again to entrance
  • The first (furthest depth) fragment has an alpha of 1, and after that every overlapping fragment is alpha blended utilizing an alpha of 0.5 (or possibly of reducing alpha, so e.g. 2nd fragment is 0.5, third is 0.33, 4th is 0.25 so we favor preserving additional fragments info).

So AFAICT, this shader would alpha mix like a standard clear shader, besides that it would not mix/work together with something however itself. How to do this?

I’ve little expertise with shaders however am comfy if I do know the place to learn.
So I’d actually admire it if somebody might level me within the route I can look to create such a shader. The challenge is utilizing Unity in the meanwhile however I do not suppose that adjustments the method to this drawback.

[ad_2]

LEAVE A REPLY

Please enter your comment!
Please enter your name here