EloiStree / HelloAndroidXR

In this repository, I works and search about what we need to learn and explore to use Quest 3 and Lynx R1 that is usable on both of them.
0 stars 0 forks source link

Topic: How to create stereo effect on Open XR or Q3 ? #45

Open EloiStree opened 10 months ago

EloiStree commented 10 months ago

I did not succeed to make stereo like I was able to in the past. So I am looking to do it in the new system of OpenXR or Q3.

https://docs.unity3d.com/Manual/SinglePassInstancing.html

The old way: https://youtu.be/E48PWyujNfI


To create a Shader Graph shader to display two left and right textures with the provided code that uses _LeftEyeColor and _RightEyeColor, you can follow these steps:

Create a Shader Graph:

Open Unity's Shader Graph window.
Create a new Shader Graph.
Add the Shader Properties:

In the Shader Graph, add two properties: _LeftEyeColor and _RightEyeColor of type "Color." These properties will be used to control the colors of the left and right eyes.
Design the Visual Effect:

Use Shader Graph nodes to design your shader. In this case, you want to use _LeftEyeColor and _RightEyeColor to determine the colors for the left and right eyes.
Create Materials:

After designing your Shader Graph, you can create materials based on your shader.
Configure Stereo Rendering:

The code you provided in your question handles stereo rendering. When you create materials using this shader and assign them to objects, Unity will automatically render the left and right eyes as required for your VR headset.
Test in VR:

Ensure you have a compatible VR headset connected and that your project is set up for VR development.
Test your scene in VR mode to see the stereo effect in action.
Here's an outline of how to set up the Shader Graph using the provided code. The code you provided already handles stereo rendering by lerping between _LeftEyeColor and _RightEyeColor based on unity_StereoEyeIndex. You don't need to make any additional modifications to the shader code itself. The key is to set up your materials and Unity's XR system to handle stereo rendering for you.

![Uploading image.png…]()

Must watch (headache a head) video on unity_StereoEyeIndex XR rendering.
https://youtu.be/datOOos-944?t=1191

Some hope over there: -https://gist.github.com/paperli/439a3a5d8828d744a367b349ccc847f4

EloiStree commented 10 months ago

image https://forum.unity.com/threads/render-different-color-depending-on-stereo-eye-index.1037215/

And https://forum.unity.com/threads/boolean-in-shader-graph.856426/

EloiStree commented 10 months ago

My solution: image