Welcome, Guest.
Username: Password: Remember me

TOPIC: VR universal shader

VR universal shader 9 months 3 weeks ago #1

Hello, I would like to present to you unfinished VR shader that can change any game into VR.

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/blob/master/Shaders/VR.fx
and VR nose:
github.com/Fubaxiusz/fubax-shaders/blob/...r/Shaders/VR_nose.fx
and nose texture:
github.com/Fubaxiusz/fubax-shaders/blob/...er/Textures/nose.png

Just right-click on RAW and save as .fx to your shaders location, same for the texture to textures location.
Last Edit: 9 months 3 weeks ago by Fu-Bama.
The administrator has disabled public write access.
The following user(s) said Thank You: Wicked Sick, brussell, BlueSkyKnight

VR universal shader 9 months 3 weeks ago #2

The administrator has disabled public write access.

VR universal shader 9 months 3 weeks ago #3

^this

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.
The administrator has disabled public write access.
The following user(s) said Thank You: Wicked Sick, Fu-Bama

VR universal shader 9 months 2 weeks ago #4

I'll be sure to give this a try once I get home.

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.
Last Edit: 9 months 2 weeks ago by ShoterXX.
The administrator has disabled public write access.

VR universal shader 9 months 2 weeks ago #5

Good work. Also heads up the shader fails to compile in the OpenGL game I tested it in.
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/
My GitHub page where you can get the Latest release of SuperDepth3D github.com/BlueSkyDefender/Depth3D

My PayPal Me Link If you like to donate paypal.me/BlueSkyDefender

Also my steam page steamcommunity.com/id/BlueSkyDefender

Discord Server discord.gg/W2f7YhX
Last Edit: 9 months 2 weeks ago by BlueSkyKnight.
The administrator has disabled public write access.

VR universal shader 9 months 2 weeks ago #6

@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..
Last Edit: 9 months 2 weeks ago by Fu-Bama.
The administrator has disabled public write access.

VR universal shader 9 months 2 weeks ago #7

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.
My GitHub page where you can get the Latest release of SuperDepth3D github.com/BlueSkyDefender/Depth3D

My PayPal Me Link If you like to donate paypal.me/BlueSkyDefender

Also my steam page steamcommunity.com/id/BlueSkyDefender

Discord Server discord.gg/W2f7YhX
Last Edit: 9 months 2 weeks ago by BlueSkyKnight. Reason: My grammar
The administrator has disabled public write access.

VR universal shader 9 months 2 weeks ago #8

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.
Sure man, you're free to adapt and share your edits, non commercially (CC by-nc-sa 4.0)
The administrator has disabled public write access.

VR universal shader 9 months 2 weeks ago #9

BlueSkyKnight wrote:
Warning: Spoiler! [ Click to expand ]
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 :huh:
while it should be in perspective projection, where the objects in the distance are transformed in lesser degree than those in front.

Warning: Spoiler! [ Click to expand ]

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) :side:
Last Edit: 9 months 2 weeks ago by Fu-Bama.
The administrator has disabled public write access.

VR universal shader 9 months 2 weeks ago #10

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.
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.
Cheers, crosire =)
The administrator has disabled public write access.
The following user(s) said Thank You: Wicked Sick

VR universal shader 9 months 2 weeks ago #11

Fu-Bama wrote:
BlueSkyKnight wrote:
Warning: Spoiler! [ Click to expand ]
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 :huh:
while it should be in perspective projection, where the objects in the distance are transformed in lesser degree than those in front.

Warning: Spoiler! [ Click to expand ]

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) :side:

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.. :dry:

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 :huh:
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.
My GitHub page where you can get the Latest release of SuperDepth3D github.com/BlueSkyDefender/Depth3D

My PayPal Me Link If you like to donate paypal.me/BlueSkyDefender

Also my steam page steamcommunity.com/id/BlueSkyDefender

Discord Server discord.gg/W2f7YhX
Last Edit: 9 months 2 weeks ago by BlueSkyKnight.
The administrator has disabled public write access.

VR universal shader 9 months 2 weeks ago #12

crosire wrote:
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.
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.

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. :side: 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
My GitHub page where you can get the Latest release of SuperDepth3D github.com/BlueSkyDefender/Depth3D

My PayPal Me Link If you like to donate paypal.me/BlueSkyDefender

Also my steam page steamcommunity.com/id/BlueSkyDefender

Discord Server discord.gg/W2f7YhX
Last Edit: 9 months 2 weeks ago by BlueSkyKnight.
The administrator has disabled public write access.

VR universal shader 9 months 2 weeks ago #13

BlueSkyKnight wrote:
Here you go crosir
pastebin.com/NJ6F40d8
Fixed: github.com/crosire/reshade/commit/5dd20c...03ef1eeba144ae477cce

BlueSkyKnight wrote:
Then use WobbleSpeedSix.x in my code. But, I can't anymore. Also Maybe I was using it wrong before. :side: I don't know.
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.
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
It's fixed now: github.com/crosire/reshade/commit/2d179b...13b7445772fcc5ee1c33
Cheers, crosire =)
Last Edit: 9 months 2 weeks ago by crosire.
The administrator has disabled public write access.
The following user(s) said Thank You: BlueSkyKnight