• 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 markfrancombe · Nov 28, 2013 at 11:04 AM · cameraoptimizationskybox

Disabling Fog for 1 Camera?

For optimization reasons I have set my Camera culling quite low, its at night and darkness hides this. Its set to 150.

To hide the cutoff, I use quite a high fog amount in Render Preferences. However, I DO have a skybox I would like to see, AND a moon, that is a simply lit plane in the sky. However these are hidden by the fog too!

Is there a way to have a second camera with a high culling amount, that ONLY renders FAR objects, but that ISNT affected by the fog setting? That way I can still have a low distance set on my main camera, (that shows buildings character and trees and environment) and a high distance set on the SKY-CAM.

Any suggestions for alternative solutions welcomed!

MArk

Comment
Add comment · Show 1
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 markfrancombe · Dec 12, 2013 at 05:45 PM 0
Share

Sorry but... bump?

2 Replies

· Add your reply
  • Sort: 
avatar image
2

Answer by Conect11 · Dec 12, 2013 at 05:48 PM

This helped me out tremendously:

http://answers.unity3d.com/questions/11100/is-it-possible-to-disable-fog-on-a-per-camera-basi.html

Also, here: which is the source to the answer above:

http://wiki.unity3d.com/index.php?title=Fog_Layer

Comment
Add comment · Show 1 · 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 NGC6543 · Mar 28, 2019 at 02:39 AM 0
Share

I tried the same method on Unity2019.1.0b9, but it didn't work on the editor. I didn't check the built app(either standalone or mobile), but there seems to be some changes I guess.

avatar image
0

Answer by reddevilstudios · Apr 15 at 03:35 AM

I have a friend that was having this problem too with latests Unity versions and URP.

Here is a script i wrote for him, it will work if you are using the "Fog" on the "Lighting settings". If you are using an asset like "Enviro Weather" i'm pretty sure the fog there should have a layer setting.

For this script to work, you have to set the camera that you don't want to render the fog. You don't need to attach this script to a camera, but you can if you want, just remember to assign it.

 using UnityEngine;
 using UnityEngine.Rendering;
 
 public class NoFog : MonoBehaviour
 {
     public Camera cameraWithoutFog;
 
     private void Start()
     {
         RenderPipelineManager.beginCameraRendering += OnBeginCameraRendering;
     }
     void OnDestroy()
     {
         RenderPipelineManager.beginCameraRendering -= OnBeginCameraRendering;
     }
     void OnBeginCameraRendering(ScriptableRenderContext context, Camera camera)
     {
         if (camera == cameraWithoutFog)
             RenderSettings.fog = false;
         else
             RenderSettings.fog = true;
     }
 }
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

19 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

Related Questions

How to render severals cameras at differents Frame Rate ? 2 Answers

Can a iOS game camera have the Bloom optimized effect with clear flags = depth only? 0 Answers

Is there a way to write a Demosaicing fragment shader? 1 Answer

new project aren't set up right 1 Answer

Dynamic Skybox 2 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