• 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 niclaslovdahl · Sep 10, 2019 at 02:06 PM · shaderrenderingstereoscopic

Single pass stereo rendering shader

Hi! I'm working with the ML1 and have to convert a shader to support single pass rendering. I have followed all the steps at https://docs.unity3d.com/Manual/SinglePassStereoRendering.html but i cannot get it working. I have not prior experience of shaders so would appreciate the help.

When i run in ML Remote shaders work as intended but when i build to device the Gameobject does not show on one eye.

 Shader "Custom/Stencil/Mask OneZLess"
 {
     SubShader
     {
         Tags { "RenderType"="Opaque" "Queue"="Geometry-1" }
         ColorMask 0
         ZWrite off
         
         Stencil
         {
             Ref 1
             Comp always
             Pass replace
         }
         
         Pass
         {
             Cull Back
             ZTest Less
         
             CGPROGRAM
             #pragma vertex vert
             #pragma fragment frag
             
             struct appdata
             {
                 float4 vertex : POSITION;
                 
             };
             struct v2f
             {
                 float4 pos : SV_POSITION;
             };
 
             v2f vert(appdata v)
             {
                 v2f o;
 
                 o.pos = UnityObjectToClipPos(v.vertex);
                 return o;
             }
 
             half4 frag(v2f i) : COLOR
             {
                 return half4(1,1,0,1);
             }
             
             ENDCG
         }
     } 
 }
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 JonPQ · Sep 10, 2019 at 03:48 PM 0
Share

You'll need to supply a little more information first... usually all 3d setups render both eyes separately... e.g. 2 camera's one for each eye, then send all geometry twice, once to camera 1, once to camera 2. or slightly more efficiently... go through each object at a time, process once as much of the pipeline, then send to 2 cameras to render. I can think of a couple of ways you might do a render in one pass.... but you'd have to leaborate on your setup, hardware or software etc.... do you want to interleave raster lines... one for right eye then one for left... or are you passing in 2 cameras to the shader, plus screen information, and assu$$anonymous$$g the screen is split in two, and having the shader render both the left and right polygon? I think that would be possible, but would still need two render passes. Interleaved raster scan lines could work.... but you'd need special hard ware. the only other way that "might" be possible is 2 color red/blue 3d in one render pass. What is your setup ?

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

194 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 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 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 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 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 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 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 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Sprite Mask Shader only renders on one Eye/Display (AR) 1 Answer

custom shader error. copy of "Nature/Tree Soft Occlusion Leaves" 0 Answers

How do I do custom camera render between opaque and transparent objects? 0 Answers

Sprite not visible from behind 0 Answers

shader pass controll 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