Layering system

Hi,

I’ve found a fairly large issue with the current VR implementation: it only permits a single viewport to be rendered.

This is a big problem when trying to draw both very close objects and very far away objects, though it also prevents using a lower resolution for select objects (eg, draw close up objects, player hands and weapons, etc at high resolution and the rest of the world at a lower resolution).

I’m thinking about adding a layer system - different viewports that are rendered sequentially, onto the same texture as the final output.

This would also allow the use of LibOVR’s layer system, which if custom support is added can make text appear significantly sharper.

@seinturier what do you think ?

I wrote something like this a few years back and posted the code here back then. I stacked multiple viewports each with it’s own camera at different ranges. Cameras synched with the main camera and it even had a separate post processor for each layer. For the life of me I can’t find the post right now though. You could then dump the output to your single viewport for your needs.

I’ve just some questions about performance. Layer rendering can be slow don’t you think ?

On the other hand, the VR system is designed to be as independant as possible from underlying vr implementation (OpenVR, OSVR, …). I think that LibOVR functionalities integration has to be controled and should ne an option.

Though I don’t understand:

  1. Why this layering system should be limited to VR.
  2. Why does it need a special integration with a VR lib
  3. Why can’t it be done today? I mean it seems like the viewports already does this, why add a layer system on top of it?

I’m agree with you. Layered rendering could be very interesting even outside VR.

As I sais previously, my aim for the VR module was to link generic Jmonkey application to various VR sdk and devices. And so, implementing layer rendering only for specific SDK within the VR module its not a good idea from my point of view.

However, making the use of Layers for all Jmonkey application more easy could be very interesting.

  1. Why this layering system should be limited to VR.

Outside of VR you can set up multiple viewpoints. This is not supported in VR - you can only have a single camera and a single viewport.

  1. Why does it need a special integration with a VR lib

I misphrased this, it would work fine with all libraries but would take advantage of LibOVR having this support to get better sharpness. No library-specific code would be needed (from the user’s point of view, at least).

  1. Why can’t it be done today? I mean it seems like the viewports already does this, why add a layer system on top of it?

See 1

Thanks.

1 Like