Flip camera Z will disable shadow

I just recently switched from Babylonjs to Threejs. I love the performance and how light it is, but now I’m facing a problem.

I know that Threejs uses right-handed coordinate system, and I have to switch it to left-handed system to match Babylonjs play replays that I had before and scenarios that players created it will cause me a lot of headache to change all the coords.

So now I decided to fix this and I did fix it by flipping the z axis of the camera.

camera.scale.z = -1;

All worked but 1 issue only, the shadows are gone. I tried everything and I cannot seem to find a solution. I switched the scale of the camera back and I can see the shadow.

Anyone can help me here?

That’s crazy that that even worked! Do your models not render insideout?
Maybe you have to invert shadowSide or something too…

https://threejs.org/docs/#api/en/materials/Material.shadowSide

Woow! Thank you that worked as well!

Yes, I had the issue of render inside-out and finally found a solution: I was also able to fix it few moments ago by flipping both the camera and scene.

scene.scale.z = -1;
camera.scale.z = -1;

Will make the whole system left-handed fully without any issues so far.

Very cool. I’m gonna have to remember this. :smiley: good work!

Just to clarify… when you swapped both scene and camera scale, did you still have to flip shadowSide?

No. Also I removed the side: THREE.Double as well.

It worked perfect without any issues. I don’t know why this is not known yet because I see a lot of people asking how to flip the coords to left-handed.

But I’m not sure if this will cause any issues for any other people, but for me so far everything is rendering fine.

That’s great to know. Hopefully I’ll remember it when someone asks… and/or it will show up in search. :smiley: Churrs!