Jump to content

VR Shaders mod for better VR experience


Recommended Posts

@modda, got your files to work, then went to multiplayer.... :( so tried to replace the non compliant files with the ones in the back up, did not work. Did notice there was an improvement in single player though. But I mostly play MP

 

@Chandawg I've uploaded a new version that seems to work in MP. I had to update the fake_spot_lights.fx as well.

Note: With this mod it seems that you get excluded from the shielded servers for not having a pure DCS installation.

 

modda

i9-9900KS @5.2GHz | Aorus Z390 Master | MSI RTX 3090 Gaming X Trio | 32GB DDR4 3200MHz | HP Reverb G2 | TM Warthog | Logitech G Pro

Link to comment
Share on other sites

Tested this with my PiMax 5K+. Really helped FPS on the deck of the carrier. I'm running 150x SS and couldn't hold 45 (Brain warp on). Sitting at the start of the Caucus cold start carrier mission. After applying this mod I was able to hold 45 no problem. I did need to make this change in _HMD.hlsl:

#define MASKSIZE 0.590f

This got rid of almost all of the masking for the PiMax in Normal FOV. @modda is there a way to make the mask more oval to better mach wide FOV headsets? increasing to .59 meant the top and bottom had less masking than needed.

 

@DarkClown nice you got it running! I've got a VivePro myself, looking forward to try out a wider FOV :)

 

I've updated the _HMD.hlsl adding two factors for masksize and msaa_masksize.

Find the apropriate width (x) first (0.59f) and adjust the height to higher with Y_FACTOR > 1.0 and lower with Y_FACTOR < 1.0. The values must be clamped to [0.0, 2.0] but close to the extremes will give a very useless viewport.

If I understood your problem correctly you'd want it lower, try the y factors at 0.8f

 

It seems to work as expected in my VivePro, but no guarantees :smilewink:

Let me know how it works for you.

 


#define MASKSIZE_X 0.525f // change this to adjust the size of the mask, 0.525f seems to be ok for the Vive
#define MASKSIZE_Y_FACTOR 1.0f
#define MSAA_MASKSIZE_X 0.25f // Mask size used for MSAA - area outside this circle will not have MSAA applied on it
#define MSAA_MASKSIZE_Y_FACTOR 1.0f
[/Code]

https://drive.google.com/open?id=1bcsWJAyx7ClS0cziFLsF870EEXjeci-N

 

Modda

i9-9900KS @5.2GHz | Aorus Z390 Master | MSI RTX 3090 Gaming X Trio | 32GB DDR4 3200MHz | HP Reverb G2 | TM Warthog | Logitech G Pro

Link to comment
Share on other sites

Cool that did make the shape a bit closer to what is in the visible area. These are the values I ended up with:


#define MASKSIZE_X 0.590f // PiMax Normal FOV ~150
#define MASKSIZE_Y_FACTOR 0.86f
[/Code]

 

 

The PiMax does seem to have a flatter top and bottom than the oblong oval:

attachment.php?attachmentid=212171&stc=1&d=1560810903

And my mom said I would never be an artist ;)

 

Probably not worth investing any more time on it since the perf gain would be negligible at best, if any.

 

Thanks for doing the work on this. This mod has a bigger impact on performance then the map changes that went into the OB.

Shape..jpg.13b1d8e3a603fd4646d5da4dcc83fa01.jpg

Processor: i7-8700K CPU @ 5.1GHz (OC)

Memory: 16384MB RAM DDR 4266

Card name: NVIDIA GeForce RTX 2080TI FE

VR: PiMax 5K+

HDD: Samsung SSD 960 EVO

HDD: WD SSD WDS100T2B0A-00SM50

Link to comment
Share on other sites

There were even more changes needed since last OB 2.5.5.32299.

I've updated the dependencies in the Kegetys vr mod and it seems to be working at least on F/A-18, F-14B, Mig-21bis, M2000 Mirage, P-51D and A-10C.

I haven't tested what the FPS impact really is from vanilla DCS.

 

https://drive.google.com/open?id=1psMHQEFVNy26B6nnYHnwoEYxNclQBzOH

 

EDIT: No doubt, with this mod I'm on pretty steady 45fps downtown Dubai at low altitude (some drops occurs when touching the streets). Without it it's more steady 30-35 with high's at 45.

 

 

Thanks Modda, I have been using the Kegetys mod for a while now and had become used to its performance improvement. But since the 2.5.5 update that stopped working I was disappointed.

 

I tried to make it work but I did not get it: I do not have the necessary programming skills ?!

In case anyone is interested: I prefer to keep the original "glass.hlsl" file. In this way I maintain the reflections in the cockpit dome and the sun does not make strange effects with cockpit clocks ... Maintaining acceptable performance.

 

Apologies for my english: I am using the Google translator ...

 

 

regards

Link to comment
Share on other sites

And my mom said I would never be an artist ;)

 

Probably not worth investing any more time on it since the perf gain would be negligible at best, if any.

 

Thanks for doing the work on this. This mod has a bigger impact on performance then the map changes that went into the OB.

 

Haha, I think that art was awesome! :thumbup:

Maybe it would be best to use a rectangle on those wide displays.

You can try to the _HDM.hlsl with the following code.

Use your regular MASKSIZE_X and experiment with the Y_FACTOR (it's just the height of the rect).

I'll add it to the zip if you find it useful.

 

 


// 0=Rectangle (experimental for wide FOV), 1=Oval
#define MASK_OVAL 0

#define ENABLE_MASK 1
#define MASKSIZE_X 0.525f // change this to adjust the size of the mask, 0.525f seems to be ok for the Vive, both for Rectangle and Oval. Unknown width for Pimax5k

// [Oval] MASK_OVAL=1 Y_FACTOR is the height relative to MASKSIZE_X to make an ellipse
// Vive,VivePro,Rift (FOV=110) 1.0f | Pimax5k+ 0.86f
// [Rectangle] MASK_OVAL=0 (Rectangle) MASKSIZE_Y_FACTOR is the height of the rectangle
// Vive,VivePro,Rift (FOV=110) 0.4f | Pimax5k+ ???f
#define MASKSIZE_Y_FACTOR 0.4f

#define MSAA_MASKSIZE_X 0.25f // Mask size used for MSAA - area outside this circle will not have MSAA applied on it
#define MSAA_MASKSIZE_Y_FACTOR 1.0f // the height relative to MSAA_MASKSIZE_X to make an ellipse, set typically 0.5-1.5 to adjust height

bool inVR()
{
// detect VR (off-center projection)
return any(gProj[2][0]);
}

void _discardHmdMask(float2 vpos, uint2 bufSize, float2 maskSize, int MaskMode)
{
#if ENABLE_MASK
// poor man's invisible area mask for the Vive, similar to the mask from OpenVR SDK (DCS For some reason does not use it)
if (inVR())
{
float2 spos = vpos / (float2) bufSize;
if(MaskMode == 1 || MASK_OVAL == 1) {
if (distance(spos * float2(1.0, 2.0-maskSize.y), float2(0.5 + gProj[2][0] / 2, 0.5) * float2(1.0, 2.0-maskSize.y)) > maskSize.x)
clip(-1);
} else {
if(abs(spos.x - (0.5 + gProj[2][0] / 2)) > maskSize.x || abs(spos.y - (0.5 + gProj[2][0] / 2)) > maskSize.y)
clip(-1);
}
}
#endif
}

uint2 getBufferSize(in TEXTURE_2D(uint2, buf))
{
uint2 bufSize;
#ifdef MSAA
uint samples;
buf.GetDimensions(bufSize.x, bufSize.y, samples);
#else
buf.GetDimensions(bufSize.x, bufSize.y);
#endif
return bufSize;
}

void discardHmdMask(float2 vpos, uint2 bufSize)
{
_discardHmdMask(vpos, bufSize, float2(MASKSIZE_X, MASKSIZE_Y_FACTOR), MASK_OVAL);
}

void discardHmdMaskMSAA(float2 vpos, uint2 bufSize)
{
_discardHmdMask(vpos, bufSize, float2(MSAA_MASKSIZE_X, MSAA_MASKSIZE_Y_FACTOR), 1);
}

void discardHmdMaskWrite(float2 vpos)
{
#if ENABLE_MASK
#endif
}
[/Code]

 

Modda

i9-9900KS @5.2GHz | Aorus Z390 Master | MSI RTX 3090 Gaming X Trio | 32GB DDR4 3200MHz | HP Reverb G2 | TM Warthog | Logitech G Pro

Link to comment
Share on other sites

I tried to make it work but I did not get it

 

Hi!

Doesn't it work at all? If so, do you get any error messages? A screenshot would be very helpful.

 

I prefer to keep the original "glass.hlsl" file.

Does the mod break after keeping the original glass.hlsl?

 

Modda

i9-9900KS @5.2GHz | Aorus Z390 Master | MSI RTX 3090 Gaming X Trio | 32GB DDR4 3200MHz | HP Reverb G2 | TM Warthog | Logitech G Pro

Link to comment
Share on other sites

Hi!

Doesn't it work at all? If so, do you get any error messages? A screenshot would be very helpful.

 

 

Does the mod break after keeping the original glass.hlsl?

 

Modda

 

 

...maybe I do not explain myself well, thanks to your modification that I downloaded from your DRIVE no problem. I can fly again with the same fps as version 2.5.4...THANKS AGAIN!!!

 

 

If I keep the file "glass.hlsl" the mod works perfectly and the sim is still looking perfect. Maybe I do not have so much improvement in performance but I prefer it: better eye candy!!!

Link to comment
Share on other sites

Haha, I think that art was awesome! :thumbup:

Maybe it would be best to use a rectangle on those wide displays.

You can try to the _HDM.hlsl with the following code.

Use your regular MASKSIZE_X and experiment with the Y_FACTOR (it's just the height of the rect).

I'll add it to the zip if you find it useful.

 

Modda

 

Finally had a little bit of time to test this no real FPS difference and I think it was a little easier to get the mask right using the oval.

Processor: i7-8700K CPU @ 5.1GHz (OC)

Memory: 16384MB RAM DDR 4266

Card name: NVIDIA GeForce RTX 2080TI FE

VR: PiMax 5K+

HDD: Samsung SSD 960 EVO

HDD: WD SSD WDS100T2B0A-00SM50

Link to comment
Share on other sites

Finally had a little bit of time to test this no real FPS difference and I think it was a little easier to get the mask right using the oval.

 

Ok! Thanks for testing it, we'll stick to the oval then :thumbup:

 

Modda

i9-9900KS @5.2GHz | Aorus Z390 Master | MSI RTX 3090 Gaming X Trio | 32GB DDR4 3200MHz | HP Reverb G2 | TM Warthog | Logitech G Pro

Link to comment
Share on other sites

Sice the latest update this mod isnt working anymore.
Dcs update would always wipe out any third party mod.

It is advice to reinstall mod like this after update.

Windows 10 Pro 64bit|Ryzen 5600 @3.8Ghz|EVGA RTX 3070 XC3 Ultra|Corair vengence 32G DDR4 @3200mhz|MSI B550|Thrustmaster Flightstick| Virpil CM3 Throttle| Thrustmaster TFRP Rudder Pedal /Samsung Odyssey Plus Headset

Link to comment
Share on other sites

Sice the latest update this mod isnt working anymore.
Did you download the fix from my post #804 or the original kegetys?

 

Modda

 

Sent from my SM-G950F using Tapatalk

i9-9900KS @5.2GHz | Aorus Z390 Master | MSI RTX 3090 Gaming X Trio | 32GB DDR4 3200MHz | HP Reverb G2 | TM Warthog | Logitech G Pro

Link to comment
Share on other sites

this is my error. here is the file:

 

 

 

 

#define GLASS_MATERIAL
#include "common/shader_macroses.hlsl"
#include "common/uniforms.hlsl"
#include "common/textures.hlsl"
#include "functions/glass.hlsl"
#include "functions/lk_shadow.hlsl"
#include "functions/radar.hlsl"
#include "functions/impostor.hlsl"
#include "functions/cockpit_glass_uv.hlsl"
#include "functions/aorms.hlsl"
#include "../common/States11.hlsl"
#include "../common/ShadowStates.hlsl"
// compile shaders
VertexShader_t model_vs_c = COMPILE_VERTEX_SHADER(model_vs());
VertexShader_t lk_shadow_vs_c = COMPILE_VERTEX_SHADER(lk_shadow_vs());
PIXEL_SHADER_GEN_8(forward_ps_pass1);
PIXEL_SHADER_GEN(forward_ps_pass_droplets, 8);
PIXEL_SHADER_GEN(forward_ps_pass_droplets, 9);
PIXEL_SHADER_GEN(forward_ps_pass_droplets, 10);
PIXEL_SHADER_GEN(forward_ps_pass_droplets, 11);
PIXEL_SHADER_GEN(forward_ps_pass_droplets, 12);
PIXEL_SHADER_GEN(forward_ps_pass_droplets, 13);
PIXEL_SHADER_GEN(forward_ps_pass_droplets, 14);
PIXEL_SHADER_GEN(forward_ps_pass_droplets, 15);
PixelShader_t diffuse_sun_ps_map_c = COMPILE_PIXEL_SHADER(diffuse_sun_ps_map());
PixelShader_t diffuse_sun_ps_sat_c = COMPILE_PIXEL_SHADER(diffuse_sun_ps_sat());
#if 1 //IR
PixelShader_t diffuse_sun_ps_ir_c = COMPILE_PIXEL_SHADER(diffuse_sun_ps_ir());
#endif
PixelShader_t lk_shadow_ps_c = COMPILE_PIXEL_SHADER(lk_shadow_ps());
PixelShader_t lk_shadow_transparent_ps_c = COMPILE_PIXEL_SHADER(lk_shadow_transparent_ps());
VertexShader_t radar_vs_c = COMPILE_VERTEX_SHADER(radar_vs());
PixelShader_t radar_ps_c = COMPILE_PIXEL_SHADER(radar_ps());
PixelShader_t radar_edge_ps_c = COMPILE_PIXEL_SHADER(radar_edge_ps());
GeometryShader radar_edge_gs_c = CompileShader(gs_4_0, radar_edge_gs());
PixelShader_t impostor_ps_c = COMPILE_PIXEL_SHADER(impostor_ps());
VertexShader_t cockpit_glass_uv_vs_c = COMPILE_VERTEX_SHADER(cockpit_glass_uv_vs());
PixelShader_t cockpit_glass_uv_ps_c = COMPILE_PIXEL_SHADER(cockpit_glass_uv_ps());
BlendState enableGlassAlphaBlend
{
BlendEnable[0] = TRUE;
SrcBlend = ONE;
DestBlend = SRC1_COLOR;
BlendOp = ADD;
#if BLEND_MODE == BM_TRANSPARENT
SrcBlendAlpha = SRC_ALPHA;
DestBlendAlpha = INV_SRC_ALPHA;
BlendOpAlpha = ADD;
#else
SrcBlendAlpha = SRC_ALPHA;
DestBlendAlpha = ONE;//ZERO;
BlendOpAlpha = ADD;
#endif
RenderTargetWriteMask[0] = 0x0f; //RED | GREEN | BLUE | ALPHA
};
// no depth bias
#ifdef BUILDING_MATERIAL
#define DEPTH_BIAS DEF_DEPTH_BIAS
#endif
#define TECHNIQUE_POSTFIX _cf
#include "./glass_material_techniques.hlsl"
#undef TECHNIQUE_POSTFIX
#undef DEPTH_BIAS
// depth bias
#define DEPTH_BIAS DEF_DEPTH_BIAS
#define TECHNIQUE_POSTFIX _cf_db
#include "./glass_material_techniques.hlsl"
#undef TECHNIQUE_POSTFIX
#undef DEPTH_BIAS
TECHNIQUE lockon_shadows
{
pass P0
{
 COMPILED_VERTEX_SHADER(lk_shadow_vs_c)
 COMPILED_PIXEL_SHADER(lk_shadow_ps_c)
 SetGeometryShader(NULL);
 SetDepthStencilState(shadowmapDepthState, 0);
 SetBlendState(disableAlphaBlend, float4(0.0f, 0.0f, 0.0f, 0.0f), 0xFFFFFFFF);
 SetRasterizerState(shadowmapRasterizerState);
}
}
TECHNIQUE lockon_shadows_transparent
{
pass P0
{
 COMPILED_VERTEX_SHADER(lk_shadow_vs_c)
 COMPILED_PIXEL_SHADER(lk_shadow_transparent_ps_c)
 SetGeometryShader(NULL);
 SetDepthStencilState(shadowmapDepthState, 0);
 SetBlendState(disableAlphaBlend, float4(0.0f, 0.0f, 0.0f, 0.0f), 0xFFFFFFFF);
 SetRasterizerState(shadowmapRasterizerState);
}
}
TECHNIQUE radar
{
pass P0
{
 COMPILED_VERTEX_SHADER(radar_vs_c)
 COMPILED_PIXEL_SHADER(radar_ps_c)
 SetGeometryShader(NULL);
 SetDepthStencilState(enableDepthBuffer, 0);
 SetBlendState(disableAlphaBlend, float4(0.0f, 0.0f, 0.0f, 0.0f), 0xFFFFFFFF);
 SetRasterizerState(cullFront);
}
}
TECHNIQUE impostor
{
pass P0
{
 COMPILED_VERTEX_SHADER(model_vs_c)
 COMPILED_PIXEL_SHADER(impostor_ps_c)
 SetGeometryShader(NULL);
 SetDepthStencilState(enableDepthBuffer, 0);
 SetBlendState(impostorBlend, float4(0.0f, 0.0f, 0.0f, 0.0f), 0xFFFFFFFF);
 SetRasterizerState(cullFront);
}
}
TECHNIQUE cockpit_glass_uv
{
pass P0
{
 COMPILED_VERTEX_SHADER(cockpit_glass_uv_vs_c)
 COMPILED_PIXEL_SHADER(cockpit_glass_uv_ps_c)
 SetGeometryShader(NULL);
 SetDepthStencilState(disableDepthBuffer, 0);
 SetBlendState(disableAlphaBlend, float4(0.0f, 0.0f, 0.0f, 0.0f), 0xFFFFFFFF);
 SetRasterizerState(cullNone);
}
}

glass.JPG.14c087ab3740da752cfac8fe7664daac.JPG


Edited by The_Nephilim

ASRock Z590 Phantom Gaming 4/AC / Intel i7 10700K @ 5.1Ghz / Noctua DHS-14 Heatsinkw/Fan /  Samsung 970plus m.2 1TB  /  eVGA FTW3 2080Ti /  RipJaws - 64GB RAM @3200  /  SoundBlaster Z  / Reverb G2 VR /  ThrustMaster HOTAS Cougar & MFD's / Buttkicker Gamer 2

Link to comment
Share on other sites

I also got that error but if you replace (with original files) all the 3 glass-related files in bazar/shaders/model/

and

glass.hlsl in bazar/shaders/model/functions.

 

This worked for me at least

 

Edit: or remove them from the zip file before adding/overwriting

Link to comment
Share on other sites

Did you download the fix from my post #804 or the original kegetys?

 

Modda

 

Sent from my SM-G950F using Tapatalk

 

 

It works perfectly by following your instructions, as always. I am using the "DCS 2.5.5.33057 Open Beta" version.

 

 

Tested with the F-14

 

 

Regards

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...