Jump to content

alphaIndex occurs depth problem.


klaude
 Share

Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...