enter image description here

enter image description here

I'm trying to create a sort of "hologram" effect. So far, what I have is an additive, three-pass shader that uses ColorMask for each pass to separate the RGB channels. The problem is that doing so requires ZWrite to be off (first image) so that each pass doesn't intersect the others (second image). However, doing so means that the model geometry overlaps itself, which I don't want.

I've tried the various methods of taking depth into consideration with transparency (This, for example) but they all cause problems when trying to separate the RGB channels. Is there some way to have each pass take depth into consideration within itself, but not with the other passes?


You should look into Grab Pass (details here). Basically it grabs the scene before you render for pretty much this exact purpose. It's not the cheapest operation, but unless you're going crazy with it I doubt you'll have any real problems.

  • \$\begingroup\$ I've tried using GrabPass but can't seem to fix anything with it. It doesn't really address the depth problem, unless I'm misunderstanding or overlooking something. What I've tried is drawing the mesh with depth and alpha blending, then added the GrabPass in the frag function. This works with a single pass, but I'm using three passes to draw the mesh three times, offset from each other. The problem is that each of those passes intersect eachother, which GrabPass doesn't seem to help with. \$\endgroup\$
    – IanLarson
    Aug 22 '18 at 22:07
  • \$\begingroup\$ Instead of drawing three meshes to get a chromatic aberration, draw the mesh once to an offscreen texture, and then do a post-fx, chromatic aberration pass (separate colors in frag shader instead of via geometry), then write that offscreen texture (with depth) back into the main scene. That should solve your depth issue. \$\endgroup\$
    – Charly
    Aug 22 at 15:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.