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
1
Question by Viluredfish · Apr 05, 2012 at 07:16 AM · cameraterrainblur

How to make foreground blury but not the skybox?

I got a terrain, and i wan't to make it blurry in foreground. But when i do it with DOF my skybox become blurry too. Is it possible to prevent my skybox from blur?

Thx

Comment
Add comment · Show 4
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 blackpag · Jan 08, 2013 at 11:47 PM 0
Share

looking for solution to similar problem, still no answer

avatar image robertbu · Jan 11, 2013 at 05:49 PM 1
Share

How about having the skybox rendered by a different camera?

avatar image $$anonymous$$ · Jan 11, 2013 at 05:51 PM 0
Share

robertbu has the point

avatar image Next Beat Games · Jan 11, 2013 at 05:57 PM 0
Share

you would have to make use of shaders wouldn't you?

2 Replies

· Add your reply
  • Sort: 
avatar image
3

Answer by kpatelPro · Sep 15, 2015 at 01:03 AM

This is fairly easy to accomplish. You'll need to find the part of the shader where it samples the DepthBuffer, and change it such that if it gets back the maximum depth, it uses the focal depth instead.

For example, I am using component "Depth of Field (Lens Blur, Scatter, DX11...)" and with my current settings this is implemented using DepthOfFieldScatter.shader. In that file, making the following change to function fragCaptureCoc will keep the skybox from getting blurred:

 float d = SAMPLE_DEPTH_TEXTURE(_GBuffer, i.uv1.xy);
 d = Linear01Depth (d);
 +float isSkybox = floor(d);
 +d = lerp(d, _CurveParams.w, isSkybox);

(add the lines marked with a +, without the + itself)

Comment
Add comment · Show 3 · 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 SullyTheStrange · Sep 18, 2015 at 08:12 AM 1
Share

This definitely sounds like what I'm looking for, everyone keeps saying it's impossible! I suck at shaders though, could you show how to change $$anonymous$$obileBlur.shader to achieve this? Rather than just leave the skybox unblurred like Viluredfish was trying to do, I'm actually looking for a way to leave everything other than the depth of this one camera unblurred. Thanks a million if you can help @kpatelPro!

avatar image kpatelPro SullyTheStrange · Oct 20, 2015 at 05:18 AM 0
Share

Hi @SullyTheStrange. Sorry for the late reply. I'm not quite sure how to answer. I took a quick look at the shader and it is designed for speed. $$anonymous$$aking a change similar to this might cause the shader to become significantly slower and take more memory.

avatar image SullyTheStrange kpatelPro · Oct 24, 2015 at 05:18 AM 0
Share

No problem @kpatelPro. I ended up cobbling together a method using some rendertexture tomfoolery which is probably also much more inefficient, but it seems there's no efficient way to do it so it'll have to do.

avatar image
0

Answer by Julien-Lynge · Jan 11, 2013 at 06:32 PM

As @robertbu stated, you could do this with different cameras. If you had one rendering your scene (with clear flags set to depth only), and had another camera (with a lower depth) render the skybox only (LayerMask set to none, clear flags set to skybox), then you could render the skybox and then paint the scene over it with the second camera. BTW: both cameras would be in the same position and orientation in the scene (technically position isn't important, just orientation, but it's easiest to make one be the child of the other).

If you have any questions about using multiple cameras, and what layermasks and clear flags are, check the camera documentation and check around here and the forums - there are a number of posts on doing so.

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 ZannaU · May 01, 2015 at 04:50 AM 1
Share

Unfortunately this won't work because applying an effect like DOF or Blur on a camera with higher Depth will affect all the other camera with lower depth including the one with the skybox. I'm trying to find a solution to a similar problem and still investigating...

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

10 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

Related Questions

blur problem with terrain 5 Answers

Prevent third person controller seeing through objects and terrain 1 Answer

Weird ring-shaped artifact on terrain around camera 1 Answer

Pixel Art (Pixel Perfect) Terrain? 0 Answers

How to make camera position relative to a specific target. 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