VR universal shader
- Fu-Bama
- Topic Author
Some of the features:
• Stereoscopic view from single image
• Lens distortion correction through Brown-Conrady model
• Chromatic aberration correction
• Stereo 3D parallax occlusion from depth
Since it's only a visual effect, there's no head-tracking, so nausea can occur. To minimize unpleasant effects, use of virtual nose (VR_nose) is recommended.
The shader is not perfect, there is a problem with stereo-parallax geometry (tested on PSVR), but offset effect itself works very well. It's just an alpha version so feel free to contribute.
Known issues:
• Parallax stereo 3D does not 'feel' right
• Parallax offset creates gaps that have to be compensated with "Parallax gaps compensation"
You can download VR shader here:
github.com/Fubaxiusz/fubax-shaders-dev/b...master/Shaders/VR.fx
and VR nose:
github.com/Fubaxiusz/fubax-shaders-dev/b...r/Shaders/VR_nose.fx
and nose texture:
github.com/Fubaxiusz/fubax-shaders-dev/b...er/Textures/nose.png
Just right-click on RAW and save as .fx to your shaders location, same for the texture to textures location.
Please Log in or Create an account to join the conversation.
- Duran.te
Please Log in or Create an account to join the conversation.
- Marty McFly
Fu-Bama Even though I can' use this shader here, I find your other works remarkable. Your coding style is very easy to read as well! Can't wait to see what future projects you can come up with.
Please Log in or Create an account to join the conversation.
- ShoterXX
Also, in case you didn't know, you could get a PSVR, which is a decent VR headset, for around 200€ back during last Black Friday. Then, add Trinus PSVR to use it on PC, a smartphone as webcam (for better head tracking, not required), and look for some ghetto solutions for hand controllers (if required, though I prefer playing Elite with my joystick), and you get yourself a decent VR setup. It's no Vive, but it's way better than the smartphone "VR" that gets often thrown around, and you're not locked to Window$ 10, like the Mixed Reality ones.
Please Log in or Create an account to join the conversation.
- BlueSkyKnight
Amnesia: MfP
Also this is the first time I did hear of Virtual nose. This is good information. I think I will add something like his to my own shader. Since it's a really good idea.
TIL
www.wired.com/2015/04/reduce-vr-sickness-just-add-virtual-nose/
Please Log in or Create an account to join the conversation.
Could not reproduce your issue.
Tested it in Amnesia MfP and Blender, both OpenGL and it compiles fine, both VR and VR_nose on both ReShade 3.4.1 and 4.1.1
Maybe there is something with your drivers..
Please Log in or Create an account to join the conversation.
- BlueSkyKnight
Fu-Bama wrote: @BlueSkyKnight
Could not reproduce your issue.
Tested it in Amnesia MfP and Blender, both OpenGL and it compiles fine, both VR and VR_nose on both ReShade 3.4.1 and 4.1.1
Maybe there is something with your drivers..
I will look into this. Also, just in case I will reinstall my drivers. Just a quick question would it be ok if add and change a few things to your shader? I am interested in the hold/gap filling you are using. Mainly in testing, it's limitations.
I am always happy to see a 3D Shader.
I will submit my changes to your work if you are ok with it.
Added convergence. Keep in mind perspective needs to be changed for VR headsets. Because that screen pop out is a big no no for VR headsets.
Please Log in or Create an account to join the conversation.
Sure man, you're free to adapt and share your edits, non commercially (CC by-nc-sa 4.0)BlueSkyKnight wrote: Just a quick question would it be ok if add and change a few things to your shader? I am interested in the hold/gap filling you are using. Mainly in testing, it's limited.
Please Log in or Create an account to join the conversation.
BlueSkyKnight wrote:
Added convergence. Keep in mind perspective needs to be changed for VR headsets. Because that screen pop out is a big no no for VR headsets.
@BlueSkyKnight
Thanks for the screenshoot. The shader already had Zero Parallax Point adjustment under Parallax rotation center (ZPD).
Fu-Bama wrote: Known issues:
• Parallax stereo 3D does not 'feel' right
I know now what's wrong with the parallax shader, It transforms view for each eye in isometric projection
while it should be in perspective projection, where the objects in the distance are transformed in lesser degree than those in front.
It works like this:
• Cut image into planes accordingly to the depth buffer
(like a Topographic Maps layers)
• Shift each layer by a [ constant offset value * layer number ]
(this one is wrong it should be gradual value, not constant)
• Blend each layer 'jump' nicely to get smooth result (remove stairs effect)
I did not put much thought into the stereoscopic 3D mode, just dumped parallax occlusion shader into it and added little bit of salt (gaps compensation)
Please Log in or Create an account to join the conversation.
- crosire
If there are still errors in OpenGL, please post the error log. There are huge differences in the kind of GLSL code NVIDIA's and AMD's drivers accept, so stuff working on one of them may not work on the other and vice versa. As such it can happen that the ReShade FX compiler generates code that is not working on one of them since it wasn't noticed during testing. Those are bugs in ReShade that need fixing.BlueSkyKnight wrote: I will look into this. Also, just in case I will reinstall my drivers. Just a quick question would it be ok if add and change a few things to your shader? I am interested in the hold/gap filling you are using. Mainly in testing, it's limitations.
Please Log in or Create an account to join the conversation.
- BlueSkyKnight
Fu-Bama wrote:
BlueSkyKnight wrote:
Added convergence. Keep in mind perspective needs to be changed for VR headsets. Because that screen pop out is a big no no for VR headsets.
@BlueSkyKnight
Thanks for the screenshoot. The shader already had Zero Parallax Point adjustment under Parallax rotation center (ZPD).
Fu-Bama wrote: Known issues:
• Parallax stereo 3D does not 'feel' right
I know now what's wrong with the parallax shader, It transforms view for each eye in isometric projection
while it should be in perspective projection, where the objects in the distance are transformed in lesser degree than those in front.
It works like this:
• Cut image into planes accordingly to the depth buffer
(like a Topographic Maps layers)
• Shift each layer by a [ constant offset value * layer number ]
(this one is wrong it should be gradual value, not constant)
• Blend each layer 'jump' nicely to get smooth result (remove stairs effect)
I did not put much thought into the stereoscopic 3D mode, just dumped parallax occlusion shader into it and added little bit of salt (gaps compensation)
I adapted your code into SuperDepth3D.
I also Updated my old WobbleDepth3D Shader with the same code. You can also see my edits here.
github.com/BlueSkyDefender/Depth3D/blob/...Depth3D.fx#L245-L291
It looks really good. Fu-Bama Good work.
Not the best Thumbnail..
I also noticed the issue with AA....
Fu-Bama wrote: I know now what's wrong with the parallax shader, It transforms view for each eye in isometric projection
while it should be in perspective projection, where the objects in the distance are transformed in lesser degree than those in front.
Ya, I been trying to fix this. Do you know where this should be adjusted? Even with this problem it still looks really good BTW. I can somewhat control it using (1 - Z / Depthbuffer). But, I would like to know if there a better way.
Please Log in or Create an account to join the conversation.
- BlueSkyKnight
crosire wrote:
If there are still errors in OpenGL, please post the error log. There are huge differences in the kind of GLSL code NVIDIA's and AMD's drivers accept, so stuff working on one of them may not work on the other and vice versa. As such it can happen that the ReShade FX compiler generates code that is not working on one of them since it wasn't noticed during testing. Those are bugs in ReShade that need fixing.BlueSkyKnight wrote: I will look into this. Also, just in case I will reinstall my drivers. Just a quick question would it be ok if add and change a few things to your shader? I am interested in the hold/gap filling you are using. Mainly in testing, it's limitations.
Here you go crosir
pastebin.com/NJ6F40d8
This issue happens when I try to enable Universal VR shader.
Also, I noticed another issue with the PingPong function special runtime values.
uniform float2 pingpong < source = "pingpong"; min = 0; max = 9; step = 1; >;
//I used to be able to set it from Zero to One and adjust the steps for speed.
uniform float2 WobbleSpeedSix < source = "pingpong"; min = 0; max = 1; step = 10; >;//like this
Then use WobbleSpeedSix.x in my code. But, I can't anymore. Also Maybe I was using it wrong before. I don't know.
So I had to write my own Ping Pong. To get my old shader to work.
github.com/BlueSkyDefender/Depth3D/blob/...Depth3D.fx#L306-L315
Please Log in or Create an account to join the conversation.
- crosire
Fixed: github.com/crosire/reshade/commit/5dd20c...03ef1eeba144ae477cceBlueSkyKnight wrote: Here you go crosir
pastebin.com/NJ6F40d8
This still works. But ReShade doesn't do type conversion on annotations currently. It expects floats for the "min", "max" and "step" values, but you set them to integers, which get reinterpreted to some huge float values and it all falls apart.BlueSkyKnight wrote: Then use WobbleSpeedSix.x in my code. But, I can't anymore. Also Maybe I was using it wrong before. I don't know.
Write it like this for it to work in the current version:
uniform float2 WobbleSpeedSix < source = "pingpong"; min = 0.0; max = 1.0; step = 10.0; >;//like this
Please Log in or Create an account to join the conversation.
- Momsacks
Please Log in or Create an account to join the conversation.
- Thurbo
is there a way to use this shader for old VR games that already produce a 3D SBS image but the distortion doesn't work on Oculus headsets? Games such as Team Fortress 2 or Half-Life, for example.
What this means is I'd like to get the shader to distort the left and right halves of the screen individually rather than assuming that the game needs to be converted to 3D SBS first.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.