Supporting multiview for VR Quest2 with custom PBR NME material

Is this possible right now ?

If not we were wondering about PBRCustomMaterial would be better for us/work with multiview or just moving to straight code is alright as well but unsure about complexity of hooking up to lighting and environment map and would be helpful to be pointed at example if does exist

@RaananW might know what is required in the shader ?

There is this old thread about doing it through pure code for reference:

I am pretty sure this is not available in not material at the moment, @RaananW, this might be a nice addition ?

@nasimiasl might help with the custom material approach ?

1 Like

Yeah, this would be a great addition to custom materials.

This is what we have in the default material:

#ifdef MULTIVIEW
	if (gl_ViewID_OVR == 0u) {
		gl_Position = viewProjection * worldPos;
	} else {
		gl_Position = viewProjectionR * worldPos;
	}
#else
	gl_Position = viewProjection * worldPos;
#endif

We can move it out to an include, but that’s assuming nothing else should pass to the gl_Position other than the viewProjection and the worldPos (which is correct in the majority of the case)

Would that preclude using vertex position offset for vertices, or does that get evaluated as the input into worldPos as well?

The only different in multiview is the viewProjection variable.

1 Like

Is that something we’re able to do on our end, or is that a change for a future release? :slight_smile:

Are you referring to the change to custom materials?

Yes, if we wanted to have the multiview code in custom NME materials

I’ll discuss with @sebavan how we can cleanly add it to custom materials.

1 Like

Any updates on this ? Just curious the time line on such a thing as trying to prioritize next projects

I think there’s a misunderstanding in the thread.

Multiview is already working with PBRCustomMaterial / CustomMaterial / plugin materials: if multiview is enabled in the scene, the materials will use multiview rendering.

That’s only the NME which needs to be updated to support multiview node materials.

1 Like

Yup, only NME I believe as well which might require a new node to deal with : #ifdef MULTIVIEW
if (gl_ViewID_OVR == 0u) {
gl_Position = viewProjection * worldPos;
} else {
gl_Position = viewProjectionR * worldPos;
}
#else
gl_Position = viewProjection * worldPos;
#endif

or automation in the current one

I think we only need to update the VertexOutput block with a new entry (for the transformed world position by the viewProjectionR matrix) (the code you pasted above would be generated by this block) and a new View x Projection (right) input matrix to retrieve the viewProjectionR matrix.

Yup and we d need the viewProjectionR input has well I believe

Yes, that’s what I called View x Projection (right) (as the regular view projection is called View x Projection):

image

1 Like