Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 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.

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

How do Image shaders interact with UI Canvas draw order? 0 Answers

How can i get my quad to only render my texture without stretching it? 1 Answer

Fade object transparency evenly from the edge inward 0 Answers

How to configure shaders? 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