Exclude Objects From Post Processing - Unity
HTML-код
- Опубликовано: 23 дек 2024
- Remove objects from being affected by your post processing stack by using multiple cameras and layers. Very simple, very quick.
You can create complex visuals by separating your objects into layers and applying certain effects on each layer.
❤️ Become a Tarobro on Patreon: / tarodev
=========
🔔 SUBSCRIBE: bit.ly/3eqG1Z6
🗨️ DISCORD: / discord
✅ MORE TUTORIALS: / tarodev
Hey everyone - if you're using URP, you'll notice there's no "clear flags" option, which is critical to making this work. In URP, you can follow all of these same steps - but when you create your child camera, set its "render type" to "overlay." Then, in your Main Camera's "stack" section, add your new overlay camera to the stack; it should combine with the main camera's output.
You made my day
Pinned!
I was needing to do this in URP just now so I came to my video to realize it's outdated, came down to see your comment. Saved me, lol!
This worked for the most part, however some of my 3D UI is being duplicated in the scene by the NoPostCam, wonder if you might have a fix for that?
In URP post process component is not working. It needs to use volumes directly(in an empty gameobject). And I am not able to isolate the prefabs I need get out from Post process effects. I wonder if any one had done that. Example Scene : suppose there is a Background and over it 3 game objects, i need 3 gameobjects to have bloom but not the background and game objects should be above the background. "sorry for my English"
No intro logo, preface, or lengthy setting up of the scene -- short & sweet, thank you!
You're welcome
wtf... I searched for the answer on unity forums, on stackoverflow, couldn't find it... bro you're a lifesaver
Very important that the no-post cam has higher depth than the main cam. It automatically got set to Main Cam Depth+1 when you created it. Just wanted to point this out as some others mentioned too.
A year later, but thanks, man. I had trouble with the no post camera not showing anything and it was because of the depth.
This is awesome. I looked everywhere trying to find this tutorial, and ended up doing exactly this for the blur out vignette effect in my game.
Glad to know it wasn't as hacky as I felt it was...
Doesn't work. Something is missing in this set up.
Straight to the point, no missing informations; I thanks you sir.
Is there any way to get the same result with 1 camera? I am developing for vr and using a second cam is not an option.
You ever figure this out? Sorry for 2 year bump
Is it possible to have different objects be affected by different post process layers?
To people still having issues with it not working: It was not working for me, meaning the second camera was overriding my post processing effects on main camera. To fix this you have to go in the main camera and uncheck the box: Directly to Camera Target. This allowed my post processing to show again on main camera. This will introduce a little more overhead, but I cannot find another way to make it work.
Awesome video, Short sweet and straight to the point. I love it. Also question, does this also work the other way around? So instead of disabling post with the tag/camera. Only enable post on certain objects with a tag/camera
ok so, first of all thanks for ur video, second, i want to do the same in HDRP and it is possible but the point is it wont affect the volumetric fogs and stuff, like lets say, i have emissive lights of objects, they need to be effected by the environment but not the bloom! , im guessing that i need to make my own post prossecing shader or code over here ?
Thank you Tarodev
You're welcome buddy ❤️
Not bad! Something that would be even cooler (as I believe there is no video tutorial for it yet) is how to exclude everything in a certain 2D area from the posit processing. Or have an object you look through, ignore the post processing. That's useful for example for underwater effects with air pockets or looking into submarines.
Damn! That's a cool idea. I'll need to think about that... If I come up with a good solution I'll make a short
@@Tarodev there's something called a postprocess volume box, I believe anytime the camera is within its bounds you can specify which effects to trigger or not. A scenario where can could be helpful is for eg. When player leaves from a dark cave into a brighter open area, the light intensity shots up
@@kingbling7571 Not exactly what I meant. Volume boxes change the whole screen. I was rather referring to have a part of the image you see, not have the effects applied to. From what I have read, one possible way is to use a stencil buffer with an 2d plane or mesh drawing a fixed value to it where you want to suppress post processing and then selectively apply the processing depending on the stencil buffer with a screen space shader. Haven't got to try this out myself yet but will soon.
@@MiTheMer oh ok, gotcha, sounds like something you can possibly achieve with the help of shaders, I suck at those so cnt really say much about it. Maybe the OP can help
@@kingbling7571 this sounds like the solution, yes. Two cameras, one camera handles the objects which could potentially be in the excluded window, the other camera handles all the rest. The window camera has strategically placed trigger boxes which can be disabled. Good thinking!
Thanks for the video! Additional tip: you need to delete from the second camera.
¿Como puedo aplicar varios post-procesados a diferentes objetos?. Esta buena tu explicacion, sirve para "denegar" o ignorar objetos. Pero para darle a distintos objetos "Bloom" diferentes? al mismo tiempo?
My 3 month problem with glowing UI is now solved :) thanks
If your UI is set to Screen Space - Camera, also set the render camera to the No post camera.
So a few problems I'm having is the fact that lights don't interact across the cameras, and occlusion culling isn't working properly - I specifically need the "no post" layer to be on top of my "post" layer since I'm adding a greyscale effect on my main camera.
Noice dude I was looking for the same and couldn't find the solution with new postprocessing .... and you did it in less than 1:30 min ... Thanks man for this amazing video Keep up the good work ......😊😊
Hi, it seems to work until I hit the play button. then everything gets affected by the PP volume. Any suggestions please?
if u want ur overlay to exclude an effect, u need to have all the other effects enabled in the overlay cam, and the excluded effect on the base camera
for some reason the objects on my no post cam show up in front of the objects of my normal cam. Is there a fix to this?
Thanks for the video! If you're running into a weird problem that objects that use the new "no post" layer get covered by something invisible while moving around (my main camera is a child of the player object), check if the field of view and clipping plains of both cameras use the same values! If your main camera uses e.g. 45° but your "no post" camera uses 60° (default), then you'll get the weird effect I described.
Now I only have to find a way to do it the other way around (no bloom except for specific objects with a specific layer) - does anyone know what settings to use for this, do you just put the post processing stuff on the extra camera and still use the "Don't Clear" flags setting?
It works very good, thank you. If it didn't work for some people it may be because you duplicated your main camera (instead of right click new camera like Tarodev shows ) and you forgot to put the depth of your duplicated camera at 0. Be aware that the depth of your main camera must be at -1 and the ignore post camera must be at 0 for this to work. It was my mistake and i had to figure it out.
I'm not sure if there's been an update which makes this work differently, but the camera with a higher depth number is the camera used for the game view. Meaning, -1 for main and 0 for no post won't work. It doesn't matter the numbers, just make your main cam have a higher depth
@@deadlyorchard I'm using -1 for main and 0 for no post and it's working just fine in Unity 2021.2.
@@Juleru doesnt work for me in 2021.3
Is there a performance impact for this?
So there's an issue with the ignore post processing camera, it ignores fog on the objects that ignore post processing. Is there a way to fix this?
Hi, how do I make the post-processing layer overlap the default layer (no bloom)?
Thank you so much, it worked! Although in the scene view, the bloom is still applied to all the objects
Quick and to the point, great tutorial, thanks
Is there a way to do this in URP with 2 objects, but selecting a different post processing effect for each object. maybe have one object with bloom, and another object with very low saturation. I have tried, in URP 2022 LTS but it does not work for me. I've tried stacking overlay cameras , with the objects under different layers. It does not work for me, all I can get is whichever object excluded from the post processing or one of the objects having a combined post processing effect. Anyway, I don't know if it can be done or if it's a limitation in Unity. I would appreciate any feedback. Thanks a lot!
I don't use URP but basically you would have 2 PP stacks, one would have everything except bloom, the second would have just bloom. things that are using the first stack would have everything (but bloom) so wouldn't glow, the other object would have the bloom stack BUT its additive since its a stack so it would get everything from the first stack. now if you wanted 2 blooms, can't do that... because its post processing, so its all on the same thing, but you can 'creatively' split the stack up and render tings in between which is nice for certain situations
Man, thank you so much for this sweet and short tutorial! Been looking for something like this for days.
can i do the same thing but reverse, like I only want one thing to be affect by post? is that possible?
Thanks! But there have some new problems. For exsample, add a plane under the bloom cuebe. The plane in NonPost layer. Then the bloom on the cube has disappear.
Urp doesn't work if both cameras have different effects, f.e., foreground boom, background blur
How do you do the opposite, include some objects but exclude the rest.
I noticed this kind of tanks the performance though, but I don’t know any better way to achieve the same result
That was incredibly useful for me!
How to do this in HDRP? There is no Clear flag in HDRP, I'm struggling..
Yep no clear flags be here either
I found a not totally working workaround, which is to set another post-processing volume around the object to exclude.
@@kwea123 I have floating numbers. That might not work… instead what I did was just lessen the time they’re out so they don’t float as high… the short animation makes them look like steam.
Just now made this for URP (should work in HDRP). In a nutshell you need main cam without PP, also you need attach to man camera stack two overlay type cameras: camera with pp and excluded layer in culling mask (what needed to show without pp) and camera layer without pp with culling mask only excluded previous layer. Good luck)
@@ВадимАронах I've tried to do this with URP but couldn't get it to work - can you provide more detail about how you did it? I just get weird multiple rendering issues...
I'm developing a 2D game with Adventure Creator which has its own camera setup. How do I achieve this using that addon?
OK. You made my day. I was trying this logic before, but now it's working perfectly. Thank u
how would it work if I'm using StateDriverCamera with multiple cameras?
Can this be implemented in 2D?
Saved my bacon! Many many thanks!!!!
It seems that it can only Exclude post, not include post. cause Global checked i guess. but i cant even do it with global unchecked
Wow very useful. Thanks!
Thanks for this anyway. It would helped me as I've had a problem where the world space UI has a bloom thing on. After watching this tutorial, I shall give it a go.
I did these exact steps before watching, but the bits on the nopost layer are rendering over the the normal camera, then I googled it and it took me to this video lol. I don't get why it works for you but not me.
What abut HDRP?
wow thanks. helped me a lot
Not work with TAA, sadly =(
Lifesaver, thank you!
Also if some people have some problems when they try to implement this to their already existing big projects, matching "Projection", "Size", "Clipping Planes" to the same as parent cam's and setting "Depth" to 1 fixed my problem.
this fixed it for me
I had been scratching my head for a solid hour or two trying to figure out why it simply was not working for me - thank you!
Also don't forget the FOV! My main camera is set to 45° but the new "no post" camera was set to 60° by default and objects that use the new layer were partially invisible while walking around because of it.
Thank you for this.
Doesn't work with rotation. The latter is always rendered in front.
anyone has an idea on how to make this work with Text objects?
did you found out how
@@DinciAnimation i stopped making games and completely lost the memory of making this comment or even having this problem
A lifesaver. Amazing to the point and works perfectly
Thanks for the tutorial!
Thank YOU for watching
not found in deferred
dam why dont they just put ids for things that will be affected by this instead of making this unnecesary complicated way
Simple, easy and straight to the point. You deserve more subs and likes. We need guys like you to spread knowledge/information to the world. Keep up the good work. 👍
This great for normal development, Heads up to those using developing for vr chat. It doesn't work.
Does this work with Unity's internal post processing? The PPv2 stack is not supported in more recent versions of Unity
Thanks!
Legit, ty!
Wont this add lag tho :/
Almost every game uses multiple cameras. Depending on what you're doing though, it's negligible
@@Tarodev hmmm, maybe you are right
Doesn't work for VR
thank you
thanks!
wow thanks
FREAKING FINALLY! Thanks, It really helped! Like + Subscribe!
Muito Obrigado amigo!!!! :)
This hack kills performance on mobile.
You shouldn't be using post processing on mobile. What specifically about "this hack" kills performance?
@@Tarodev True about not using post. But also running two cameras at the same time will really drag down your frame rate. It may be fine on newer iOS devices but Android devices suffer more.
Not likely to be a problem on PCs though.
Great vid, but one for URP would also be great
Thanks, very simple trick.
Thank you for this one