• 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 Patel-Sagar · Mar 26, 2014 at 09:21 AM · shader

How to use multiple pass in shader forge?

Hi, I recently started using shader forge. it is really good for shader programming and helping a lot. I want to make a diamond shader in it. for that I need 2 pass and different culling in both of these pass. and also how to use zbuffer and all that command in shader forge. you can see shader bellow.

Shader "FX/Diamond" { Properties { _Color ("Color", Color) = (1,1,1,1) _ReflectTex ("Reflection Texture", Cube) = "dummy.jpg" { TexGen CubeReflect } _RefractTex ("Refraction Texture", Cube) = "dummy.jpg" { TexGen CubeReflect } }
SubShader { Tags { "Queue" = "Transparent" } // First pass - here we render the backfaces of the diamonds. Since those diamonds are more-or-less // convex objects, this is effectively rendering the inside of them Pass { Color (0,0,0,0) Offset -1, -1 Cull Front ZWrite Off SetTexture [_RefractTex] { constantColor [_Color] combine texture * constant, primary } SetTexture [_ReflectTex] { combine previous, previous +- texture } }

     // Second pass - here we render the front faces of the diamonds.
     Pass {
         Fog { Color (0,0,0,0)}
         ZWrite on
         Blend One One
         SetTexture [_RefractTex] {
             constantColor [_Color]
             combine texture * constant
         }
         SetTexture [_ReflectTex] {
             combine texture + previous, previous +- texture
         }
     }
 }

 // Older cards. Here we remove the bright specular highlight
 SubShader {
     // First pass - here we render the backfaces of the diamonds. Since those diamonds are more-or-less
     // convex objects, this is effectively rendering the inside of them
     Pass {
         Color (0,0,0,0)
         Cull Front
         SetTexture [_RefractTex] {
             constantColor [_Color]
             combine texture * constant, primary
         }
     }

     // Second pass - here we render the front faces of the diamonds.
     Pass {
         Fog { Color (0,0,0,0)}
         ZWrite on
         Blend One One
         SetTexture [_RefractTex] {
             constantColor [_Color]
             combine texture * constant
         }
     }
 }

 // Ancient cards without cubemapping support
 // We could use a 2D refletction texture, but the chances of getting one of these cards are slim, so we won't bother.
 SubShader {
     Pass {
         Color [_Color]
     }
 }

}

How do I make it shader forge?

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 Patel-Sagar · Mar 28, 2014 at 01:25 PM 0
Share

well I got answer from forum of shader forge that currently multiple pass is not possible in shader forge.

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.

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

20 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

Related Questions

A node in a childnode? 1 Answer

What is the most common shader model (2.0+,3.0+,4.0+) for unity web player users (or an average) 1 Answer

Adding Transparency to Custom Unity Shader 1 Answer

How Add NormalMap 0 Answers

Merging (alpha) Unlit shader with Cutout shader 3 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