Jump to content

[Unity] XRSettings & supersampling


Fangh

Recommended Posts

Hello.

I would like to have supersampling to render my game twice the default resolution. I think I will use XRSettings.eyeTextureResolutionScale.


Can I use XRSettings.eyeTextureResolutionScale with Unity 2018.2 + Wave SDK 3.0.2 ?

https://docs.unity3d.com/ScriptReference/XR.XRSettings-eyeTextureResolutionScale.html

 

Thank you

Edited by Fangh
Link to comment
Share on other sites

In our experience, changing XRSettings.eyeTextureResolutionScale has no effect, as the Wave SDK uses a more low-level rendering pipeline that disregards a lot of the Unity XR support. We've had success changing the following code in WaveVR_TextureManager:lines 372-378 (although it feels a little inelegant to be hacking around inside the SDK!)

int size = Mathf.Max(Screen.width / 2, Screen.height);
uint w = (uint)size;
uint h = (uint)size;
if (!Application.isEditor)
  Interop.WVR_GetRenderTargetSize(ref w, ref h);
int screenWidth = (int)(w * 0.5);
int screenHeight = (int)(h * 0.5);

I'd recommend against twice the default resolution unless your game is using extremely simple pixel shaders; this will end up rendering 4x the effective pixels! We get pretty decent results with a value of 1.2 when we want to reduce aliasing issues, without affecting performance too much.

  • Thanks 1
Link to comment
Share on other sites

I should add you'd need to make corresponding changes in WaveVR_Render:lines388-392 if you are scaling up. Basically anywhere Interop.WVR_GetRenderTargetSize is used...

// Setup render values
uint w = 0, h = 0;
Interop.WVR_GetRenderTargetSize(ref w, ref h);
sceneWidth = (float)w * 1.2f;
sceneHeight = (float)h * 1.2f;

@Cotta

Link to comment
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
×
×
  • Create New...