klaude Posted July 6, 2018 Share Posted July 6, 2018 Hello, I have to control depth of meshes with alphaIndex in my situation. but when meshes are over 10, rendering gets strange. https://www.babylonjs-playground.com/#BTU1J7#1 need your help. thanks. Quote Link to comment Share on other sites More sharing options...
Guest Posted July 6, 2018 Share Posted July 6, 2018 Well it seems to work for me (even with 15) Quote Link to comment Share on other sites More sharing options...
klaude Posted July 7, 2018 Author Share Posted July 7, 2018 hmmm, in my case. It shows blink and not ordered correctly. Tested chrome on macOS and Windows 10. what's your browser? Quote Link to comment Share on other sites More sharing options...
sable Posted July 7, 2018 Share Posted July 7, 2018 Thought I'd just chime in here to confirm that I get the same effect as @klaude, blinking and wrong order. Interestingly it works fine though if I use the distance to the camera as the z-index. https://www.babylonjs-playground.com/#BTU1J7#3 Quote Link to comment Share on other sites More sharing options...
klaude Posted July 7, 2018 Author Share Posted July 7, 2018 Hello, @sable based on camera distance is basic logic, so it works. but i have to order meshes with my logic not based on camera distance. it changes orders like https://www.babylonjs-playground.com/#BTU1J7#4 i'm trying to it runs like 2d which is parallel on screen not camera; i think that although alphaIndex is changed, camera distance logic runs last. so it makes blinking. but it's ok on safari browser. please anybody check this out. thanks. Quote Link to comment Share on other sites More sharing options...
sable Posted July 8, 2018 Share Posted July 8, 2018 Actually pretty sure it's your sort function, needs to return a -ve number, +ve number, or 0, not true or false. https://www.babylonjs-playground.com/#BTU1J7#5 If you log out the position.z of each mesh after sorting the way it was you'll see that they're not in the correct order. It would be less work just using the pos.z - campos directly as the alpha index though, unless there is some other reason you need to sort them. klaude 1 Quote Link to comment Share on other sites More sharing options...
klaude Posted July 8, 2018 Author Share Posted July 8, 2018 It was fully my newbie-like mistake about js array sort function... Thank you @sable Quote Link to comment Share on other sites More sharing options...
Guest Posted July 9, 2018 Share Posted July 9, 2018 I was testing on Edge and this is probably why I did not get the same effect Thanks a lot @sable for the fix! 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.