BabylonJS / Babylon.js

Babylon.js is a powerful, beautiful, simple, and open game and rendering engine packed into a friendly JavaScript framework.
http://www.babylonjs.com
Apache License 2.0
22.78k stars 3.39k forks source link

Materials should use stereo eye position for reflections in multiview #11949

Open rgerd opened 2 years ago

rgerd commented 2 years ago

In this playground, for example: https://playground.babylonjs.com/#9K3MRA#754 We have a PBR material that is rendered in multiview, but the uniform vEyePosition used to calculate reflections is only derived from the current active camera (which in multiview rendering corresponds to the left eye). In order to get proper reflections when rendering in multiview we should have a second uniform vEyePositionR or a matrix that compensates for the stereo offset between the left & right eyes that we'd multiply by vEyePosition in order to create vEyePositionR in the shader.

https://github.com/BabylonJS/Babylon.js/blob/4bc7b8000a3a3a94e8701f96087020d71e1df7aa/src/scene.ts#L786-L791

https://github.com/BabylonJS/Babylon.js/blob/4bc7b8000a3a3a94e8701f96087020d71e1df7aa/src/Shaders/ShadersInclude/reflectionFunction.fx#L132

github-actions[bot] commented 3 months ago

This issue has been automatically staled because it has been inactive for more than 14 days. Please update to "unstale".