Jump to content
tar

OpenGL VR shaders

Recommended Posts

Quick question. Is there any barrier to having a VR lens shader in the OpenGL viewport?

Shader Toy talks about it:

Shadertoy shaders can create images for Virtual Reality (VR) mediums seamlessly. For that shaders must implement the mainVR() entry point, which is optional and has this prototype:

void mainVR( out vec4 fragColor, in vec2 fragCoord, in vec3 fragRayOri, in vec3 fragRayDir )

where fragCoord and fracColor work the same as in regular 2D image shaders: they contain the pixel coordinates in surface space and the output pixel color.

the variables fragRayOri and fragRayDir contain the ray origin and ray direction of the ray that goes through that pixel in the virtual world, given in tracker space. The shader is expected to transform these values into camera space if a moving camera is to be moved though the virtual world. The ray origin is given as variable and not uniform for VR systems where the camera is not modelled as a pinhole camera.

Shaders that implement the mainVR entrypoint will automatically be flagged as VR ready and will be searchable though the filter system under the VR qualifier.

https://www.shadertoy.com/howto

Share this post


Link to post
Share on other sites

The main barrier is performance, the lens shaders themselves are pretty simple. Maintaining 90fps at all times when we don't have any control over what is displayed, is the main problem. I suspect we'd have to severely restrict how things are displayed when in any sort of "VR" mode (shaded only, normal quality lighting, no visualizers, etc).

Share this post


Link to post
Share on other sites

Cool. Thanks! Makes sense. Found a 3d roller coaster examples at https://vr.chromeexperiments.com/

Using Nuke's CaraVR tools I'm kind of getting used to looking at LatLongs in the 2d viewport to make some judgments. Crazy thoughts but could that every happen in the Houdini viewport? a LatLong openGL shader even if it's low performance.

Screen Shot 2016-07-21 at 9.02.26 am.png

Share this post


Link to post
Share on other sites

That sort of display is more appropriate for the OpenGL ROP and Flipbooks. In the viewport, it makes selecting things rather challenging :)

Share this post


Link to post
Share on other sites

i second that Marty !

Having the ability to open a VR preview canvas, that open an OpenGL view with a camera compatible with standard HMD would be great.

To have those 2 option would be cool :

1 - Direct HMD access from houdini like UE4 VR preview

https://docs.unrealengine.com/latest/INT/Platforms/Oculus/QuickStart/5/index.html

2 - Extend display with standard Android sensor recognition 

https://developer.android.com/guide/topics/sensors/sensors_motion.html

 

  • Like 1

Share this post


Link to post
Share on other sites
On 21.7.2016 at 2:35 AM, tar said:

Done! Rfe'd as #76680

Thanks Mark.

Hey Mark,

what do you mean with Done?

Did you find a solution for it?
Would be very interested in it.
Thanks

Adrian

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×