zhutq Posted January 22, 2017 Share Posted January 22, 2017 Hi, It seems when setting scene.useRightHandedSystem = true; , fog stops to work. Left-handed: http://www.babylonjs-playground.com/#2KPFUX#0 Right-handed: http://www.babylonjs-playground.com/#2KPFUX#1 Do I need to set something else to use fog in a right-handed system? Thank you! Quote Link to comment Share on other sites More sharing options...
zhutq Posted January 23, 2017 Author Share Posted January 23, 2017 I think it's safe to assume that fFogDistance is not negative, because fog is computed according to its distance to the camera. If I modify fogVertex.fx to be #ifdef FOG fFogDistance = abs((view * worldPos).z); #endif and the end of sprites.vertex.fx to be // Fog #ifdef FOG fFogDistance = abs(viewPos.z); #endif I can get correct fog for both left-handed system and right-handed system. Is this solution correct? Wingnut and NasimiAsl 2 Quote Link to comment Share on other sites More sharing options...
Wingnut Posted January 23, 2017 Share Posted January 23, 2017 Wow, interesting, zhutq! Sorry for slow replies. This is a "big dog" issue... for people much smarter than I. But I wanted to say... that it is extra cool that you went digging deep for solutions, and in shader code! Good initiative, and bravery! Good troubleshooting and interesting findings. It has been a "sleepy weekend" on the forum. Now it is a new week - perhaps more readers, soon. I am going to ping @Deltakosh and @NasimiAsl and I should probably ping @Nabroski too. I should ping some other Gods, as well, but we'll start with these 3. I'll bother more people at mid-week, if replies remain low. Again, good code-sniffing, z! Quote Link to comment Share on other sites More sharing options...
Nabroski Posted January 23, 2017 Share Posted January 23, 2017 @Wingnut Thank you for mentoring me, it looks complicated, i dont know how to do it. Quote Link to comment Share on other sites More sharing options...
NasimiAsl Posted January 23, 2017 Share Posted January 23, 2017 FOGMODE_EXP2 scene.fogMode = 2;http://www.babylonjs-playground.com/#2KPFUX#3 but for other modes you most be change that Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted January 23, 2017 Share Posted January 23, 2017 @zhutq this is perfectly correct. Do you want to do a PR? Quote Link to comment Share on other sites More sharing options...
zhutq Posted January 24, 2017 Author Share Posted January 24, 2017 14 hours ago, Deltakosh said: @zhutq this is perfectly correct. Do you want to do a PR? Yes:) I'm honored. I'll do it today. Thank you, @Wingnut ! I feel very encouraged. Thank you all Wingnut 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.