• 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 psantoki · Apr 08, 2014 at 09:48 PM · filterdepth buffer

How to set Depth Buffer filter?

Unity sets different sampler filters for _CameraDepthTexture based on lighting mode.

In Forward rendering you get linear filtering. In deferred you get point (this is correct)

How can this be set manually?

alt text

PIX reveals the truth

Deferred

IDirect3DDevice9::SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_POINT) IDirect3DDevice9::SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_POINT)

Forward

IDirect3DDevice9::SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR) IDirect3DDevice9::SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR)

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 psantoki · Jun 03, 2014 at 06:47 PM 0
Share

Here's a nicer illustration of the problem.

Linear filtering causes DecodeFloatRG to break down. This isn't a problem in Depth mode, which does not require DecodeFloatRG. And this is only in Forward Rendering. In Deferred Rendering a different sampler is used (point).

I'm supposed to fix this before my game ships. Not sure how to do that though.

alt text

depthnormals linear filtering.jpg (497.8 kB)
avatar image supernat · Jun 03, 2014 at 07:50 PM 0
Share

I don't know a full solution, but you can download the built-in shaders here: http://unity3d.com/unity/download/archive/ and I took a quick search and found the refs to the camera texture in the lighting shaders under DefaultResources. The question is if you can override the "camera" shader with your own. You might be able to pull the default shaders into your project (don't know if they will replace the real default shaders) and modify to see if that helps. I'm pretty sure there is a way to force the built-in components to use your version of the shaders, I think I read it somewhere and may have done it in the past (I suffer from poor memory). By the way, I want to play that game. :)

1 Reply

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

Answer by Aras · Jun 26, 2014 at 07:31 AM

That just sounds like a bug on our side. Will try to fix for 4.5.2.

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 psantoki · Jun 26, 2014 at 06:07 PM 0
Share

Vicious, Aras

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

23 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

Related Questions

Using High Pass Filter with script 2 Answers

How to make some raycasts ignore a layer and others not? 1 Answer

Audio Low Pass Filter Not Working 1 Answer

HDRP High Quality Shadow Filtering really noisy for some reason 0 Answers

Graphics.CopyTexture not working? 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