Parallax occlusion with camera.targetScreenOffset unwanted behavior

Hello,
Here I’m back with another of my faen issue/question :thinking: Don’t know what I’m doing wrong here or if it’s anything like a bug. I managed to quickly reproduce the issue in the only featured PG for parallax in the doc. This part doesn’t really have an exhaustive doc, does it? :wink:

The issue: When I use ‘camera.targetScreenOffset’ the computation of parallax occlusion from my UVs is kind of inappropriate. It somehow accounts the camera offset. I can understand it but this is not what I want.

To see/repro, Wait 3sec after load and see the UV angles of the normal map for parallax occlusion account the offset of the camera. How can I avoid this?
Thanks in advance for your help,

https://playground.babylonjs.com/#10I31V#314

I don’t see a way to make it work because when using targetScreenOffset the view matrix translation X and Y components are updated, which, among other things, make the viewDirection computation wrong.

You should try to achieve the same effect by modifying the camera position/direction instead of setting targetScreenOffset.

Ok, thanks for this ‘sad’ answer (because it was working fine), but then perfectly understandable. I will do as you say and thanks for saving me time trying to make work something that will obviously not work :smiley:
Meanwhile, have a great day,

I’m going to mark this as solved. It is in a way. It’s just not possible (and there is nearly always an alternate way in BJS). So let me just take the alternate way :wink:

2 Likes

Still not a solution, but a possible work-around here.