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
0
Question by elmanofsuit · Feb 27, 2019 at 01:09 AM · renderingbackgroundqueueweather

Having trouble getting objects to render in the background

I'm working on a 3D, first-person project which uses fog over an empty skybox, in part to hide pop-in by objects beyond the camera view. Since blank fog on its own is pretty bland looking, I've also got some background objects (clouds and mountain silhouettes) which move along with the camera to create a sort of "fake skybox."

It actually looks pretty great, with one major hiccup - the background elements need to always render behind other objects, or the illusion is broken. This seems like it should be easy enough, but I've tried a lot of different approaches, from various forums, none of which has been working. I should note that I'm using Unity 2017, so any approach using the newer "HD Render Pipeline" shaders is not going to work for this project.

What I've already tried:

  • Using a second camera for the background layer. Main camera is set to depth only or don't clear, while the background camera has a Skybox clear flag. Have tried multiple setups for depth, rendering path, etc - but the background camera never seems to render unless its Depth is higher - which of course obscures the rest of the game.

  • Changing the render queue of the material through debug mode or by a script. I've tried it with both standard and legacy shaders, but it also doesn't seem to do anything, aside from sometimes resulting in pixelation. It also seems like Unity likes to reset the custom queue value to 3000 a lot, and that doing it this way creates a new instance of the material rather than editing the base material - leading me to wonder if this is really a workable approach.

  • Creating an alternate shader which turns on ZWrite and tries different ZTest settings. Some ZTest options show no changes, while others result in the texture looking badly pixelated (and still not rendering in the background).

  • Adding a subshader which uses a stencil buffer to cut out parts of objects which are obscured. I'm not particularly great with shader language, but have been able to Frankenstein together some useful shaders in the past, and am pretty sure I've stitched the examples I found in the right place. But still, I'm not having any luck adding this functionality to a standard shader.

All of these seem like practical solutions (if a little convoluted for what seems like it should be a basic feature), and they seemed to work for other people. But none are working for me, and I've tried dozens of variations on these approaches, with absolutely no luck.

So: has anyone else run into a hard time with this, and did you end up finding a solution? Did any of the approaches I tried work for you? If so, was there anything else you had to tweak to get it to work right? Are these just out-of-date approaches from old forum questions, and if so, what would be the "correct" way to do it?

I'm at a complete loss here, even moreso because these solutions have clearly worked for other people. Does anyone have any ideas as to where I'm going wrong?

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

0 Replies

· Add your reply
  • Sort: 

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

116 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image 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

Halo doesn't appear fully when there is a background image 0 Answers

Rendering Order 4 Answers

URP camera changing Clear Flags to solid color when I build apk for android 0 Answers

Transparency shader that also writes to Camera Depth Texture 0 Answers

Sprite Background Lags with Camera Script 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