Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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
1
Question by Waz · Jun 26, 2011 at 10:50 AM · forwarddeferredantialias

Mixing Deferred Lighting and Forward rendering paths

Unsatisfied with both Deferred Lighting (since it has no anti-aliasing) and Forward rendering (which can only support a limited number of lights), I am trying to use two cameras: one for the bulk of my many-light-lit background scenery (Deferred Lighting), and then a second camera for my lots-of-sharp-edges foreground items (Forward rendering, anti-aliased).

This works as-expected if the second (Forward) camera has Clear Flags of Depth Only, but of course the foreground objects do not go behind anything in the scenery.

But if I set the second (Forward) camera Clear Flags to Don't Clear, it's as if the depth buffer is never cleared. i.e. as if Deferred Rendering does not clear the depth buffer, or is using a different depth buffer.

To "solve" this, I added a third camera, rendered before the other two that just paints to the depth buffer. This works, but seems rather overkill (I'll only be enabling this at quality levels Beautiful and Fantastic).

Has anyone had any better luck mixing the two rendering paths to get the best of both worlds?

Comment
Add comment · Show 2
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 flaviusxvii · Jun 26, 2011 at 12:09 PM 0
Share

I'm pretty sure the deferred rendering pass needs the depth buffer information for some effects. So you think the deferred rendering pass should clear the buffer once it is done? I'm not sure I'm following your assumptions.

avatar image Waz · Jun 26, 2011 at 12:28 PM 0
Share

No, it should leave the depth buffer correct for the next camera. The Clear Flags should dictate what happens before the render. I strongly suspect that DR doesn't use the same depth buffer at all, since my "fix" has no effect on DR (my #2 DR camera even has a solid color Clear Flag, yet the camera #1 depth buffer is still there once the Forward #3 camera renders).

2 Replies

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

Answer by Waz · Jul 26, 2011 at 11:45 PM

While not really an "answer", I have found that the performance loss and the loss of shadows by using two cameras (three, thanks to the depth buffer problem) is not worth it just to get AA.

Instead, I am using, and recommend, using FXAA in Unity to get AA in Deferred Rendering.

Comment
Add comment · 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
0

Answer by Admiral_Face · May 30, 2014 at 12:30 AM

You have discovered an excellent solution, but it does lack shadows. If only Unity supported deffered lighting rendering, rather than just deffered rendering, then you could add all the MSAA you wanted. I do hear there are some Anti Aliasing compatibility bits you could use to force SGSSAA to take care of vegetation jaggies, this combined with SSAA image effect would eliminate most Jaggies, but would still not look as good as traditional 8xMSAA.

Comment
Add comment · 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

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Changing Rendering Path from script 1 Answer

batchmode and screenshots. 0 Answers

Unity Surface Shader - Deferred lighting viewDir and lightDir 0 Answers

combine deferred and forward rendering 0 Answers

Why does SSAO not work in forward rendering? (black screen) 0 Answers


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