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
0
Question by johan-skold · Mar 09, 2011 at 04:07 PM · shaderdepthsurfacepassonly

Depth-only pass in Surface Shader

I have a shader that I used in Unity 2.x that utilizes transparency and has a depth-only pass that it renders first, so it won't render the faces behind the faces in front. I am now trying to upgrade this to a Unity3 surface shader but surface shaders don't seem to support render passes and as such I cannot make a depth-only pass.

How would I go about producing the same thing with a surface shader?

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

1 Reply

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

Answer by jonas-echterhoff · Mar 09, 2011 at 05:18 PM

In short, you can't. The idea with surface shaders is that you can have one shader which can be used for both forward and deferred rendering. However, the idea of transparency or multiple custom render passes do not quite translate to the deferred rendering model, so shaders like that should still be implemented using vertex and fragment programs, just like you used to do.

Comment
Add comment · Show 2 · 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 johan-skold · Mar 09, 2011 at 05:56 PM 0
Share

The problem there is unity tells me: "SubShader commented out; uses Unity 2.x per-pixel lighting. You should rewrite shader into a Surface Shader." Is there somewhere I can check up on how Unity wants me to implement said vertex/fragment shader, since it obviously doesn't like the old way?

avatar image jonas-echterhoff ♦♦ · Mar 10, 2011 at 09:03 AM 1
Share

Actually, I was not quite correct in my reply. Surface shaders do in fact support transparency (they will just always use forward rendering). But they still won't allow multiple passes. But you can still use normal vertex lighting in passes. Look at the "Alpha-VertexLit.shader" in our builtin shaders for an example.

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

No one has followed this question yet.

Related Questions

Reuse Shader Pass output as input for next Pass 0 Answers

Shader - Writing to Depth issues 0 Answers

Surface Shader, run vertex multiple times 0 Answers

Unity 5 fragment shader that writes custom depth into the depth texture 1 Answer

Shader - Using Multiple Pass for different shader 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