Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by x70x · Mar 24, 2013 at 06:06 PM · transparencyimage effects

Why are all particles drawn behind my global fog?

As far as I can tell, particle effects do not seem to have any interaction with the global fog effect. All particles are always drawn behind the fog.

After doing some research I added the @ImageEffectOpaque to the GlobalFog.js, but that causes all transparent particles in the scene to disappear completely (including the fog). Is there any way to have the global fog effect interact with other transparent objects and particle effects? Did I do something wrong with @ImageEffectOpaque? I followed the advice here. Does my particle shader need to be adjusted also?

Comment
Add comment · Show 3
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image x70x · Mar 24, 2013 at 06:04 PM 0
Share

As a side note. $$anonymous$$y game uses three cameras. One that renders the skybox first. The next renders the scene and has the global fog image effect (as well as a few others). And a third that renders the GUI last on top of everything else.

avatar image x70x · Mar 24, 2013 at 06:45 PM 0
Share

In doing a little more research it seems like perhaps this is part of my problem http://answers.unity3d.com/questions/330892/why-is-the-second-camera-interfering-with-image-ef.html I don't really understand most of what they are saying though. Anyone care to help me figure out what is going on there? I think it's my multiple cameras interfering with each other somehow.

avatar image Benproductions1 · Mar 25, 2013 at 03:46 AM 0
Share

The reason behind things getting rendered out of order, is because global fog works with the Z buffer. Transparent objects/particles do not write to the z buffer, so particles are effected as much as the objects they are covering by the fog. This is impossible to counter

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by x70x · Mar 25, 2013 at 02:27 PM

I found a work-around solution where I change all of my particle effects to their own layer and add another camera that masks only that layer. I set that camera to "Don't Clear" and then render it in front of my scene's camera (global fog is on the scene camera), but behind my GUI camera. Seems to work fine, but I don't know if having 4 cameras rendering on top of each other is a great idea. I guess it's only a problem if I run into performance issues though.

Comment
Add comment · Show 7 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Benproductions1 · Mar 25, 2013 at 09:49 PM 0
Share

Your workaround draws particles Infront of all objects, if you only ever need it to do that, then your solution works, but otherwise there is no way possible to achieve this..

avatar image x70x · Mar 25, 2013 at 10:15 PM 0
Share

I can assure you that it does work. The particle camera's clear flags are set to "Don't Clear" and only renders game objects that have the "particle" label. Here is a screenshot where the particles are clearly behind the terrain. You can't see the fog in that shot, but the particles are indeed rendering in front of the fog also. The particles do render in front of everything else when the clear flags are set to "Depth Only", but "Don't Clear" works perfectly.

avatar image Benproductions1 · Mar 25, 2013 at 10:50 PM 0
Share

Ah, yes Don't Clear still renders everything, but only the flags change the pixels... This method is btw quite slow....

avatar image x70x · Mar 25, 2013 at 11:37 PM 0
Share

Well the good news is that my game doesn't have a ton of complicated stuff to render, and I'm not targeting low end machines. All the same, it runs pretty smooth on Fastest quality settings on a $$anonymous$$acbook Pro so that's good enough for me. If I run into problems I might look into a different way of rendering the environment.

avatar image AlwaysSunny · Jun 29, 2013 at 08:33 AM 0
Share

The limited flexibility of Unity's image effects was frankly a huge let-down following my Pro purchase, so I'm excited to see others having some success at working around their numerous limitations.

However, this scenario isn't working as you've described it on my end, and it never has for me before. Getting multiple cameras with their own independent image effects (or lack thereof) to work together is something I've tried and failed to achieve on numerous occasions, investing many joyless hours with little to show beyond edge-case successes and some killer buyer's remorse.

When I do precisely what you've described in this answer for myself, the "Don't-Clear transparency camera" negates the scene camera's global fog altogether. Using Forward Rendering on that camera draws the fog again, but all the clearing methods result in the particles ignoring their scene depth and drawing atop everything rendered by the scene camera, as Benproductions1 described.

In fact I'm not sure I've ever had an image effect "survive" being drawn this way, "behind" a second camera, no matter their clear flags or culling conditions. At least not without creating a hall-of-mirrors effect, losing depth information, or ruining the scene's draw order continuity.

In my experience, only the camera with the highest draw order has its image effects processed and applied to the final image properly. Any time I somehow broke this rule, for instance by manually rendering, using Blit() to explicitly control draw order, something else would break.

Would you consider putting together an example project demonstrating your cam / fx setup so I and others can learn from your success? It might be a great asset to folks like me who've searched off and on for such things forever. :)

Show more comments

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

12 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

3D Text affected by image effect 0 Answers

Fade object transparency evenly from the edge inward 0 Answers

glass sphere with reflective/specular shader? 2 Answers

How do you get ambient occlusion working with transparency and lightmapping? 0 Answers

Create a shader using mask for sprite 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges