Reputation: 959
I've used the technique described here to grayscale selected objects (by placing them on a different layer): http://blog.theknightsofunity.com/using-multiple-unity-cameras-why-this-may-be-important/
However, I can't find a way to do this that doesn't also grayscale my skybox. It makes sense based on what I know -- the grayscaling is applied to the skybox-cleared first camera image before the color layers are rendered by the second camera.
To be clear, my setup is this:
camera 1:
camera 2:
I've tried adding cameras both above and below these to try to render the skybox separately, but it makes sense based on my understanding of draw order that neither of these worked.
Anyone have any suggestions? Thanks in advance!
PS - if it matters (don't think it does), this project is in Unity 2019.2 and I'm not using LWRP/HDRP (and would prefer not to, for now).
update: in response to the answer from @derHugo -- I've tried this, and it appears to yield all gray (tried it the first time and again following the answer, same results). These are screenshots of the settings suggested by derHugo, as I understand them; the main cam is 1st (with the audio listener), grayscale cam is 2nd:
Upvotes: 0
Views: 693
Reputation: 90580
The skybox is greyscaled in that example and your case since you put the greyscale effect on the same camera that also renderers the skybox (Clear Flags).
Since you do not want your skybox being greyscaled .. let the other not-grescaled camera render the skybox!
You only need these two Cameras:
The MainCamera:
The GreyscaleCamera:
Depth:
The camera’s position in the draw order. Cameras with a larger value will be drawn on top of cameras with a smaller value.
meaning first the MainCamera will be rendered. Then the GreyscaleCamera "on top" of it. But since you used Don't Clear
the depth-buffer will be intact and the objects on other layers (which already are rendered) may still appear in front of the greyscaled objects. And since you don't clear also the not greyscaled skybox will simply be rendered by the other camera and not changed later.
Of course you could further separate also the Skybox into a third Camera with Culling Mask
nothing and set it to Depth = -1
.
In short: Just make sure your Skybox(Background) Camera has always the smallest Depth
value.
Upvotes: 1