Jump to content

Why do lines disappear?


Statics
 Share

Recommended Posts

Hi Statics, good to see you again.

   I think this is caused by a type of z-fighting between inactive/null Lines (Lines set to draw from 0,0,0 to 0,0,0)... and active Lines.  You actually have 10 Lines in the scene after the button press (box click).  You have 3 active Lines and 7 null-Lines.  Keep in mind that BJS adds mesh to the scene as soon as it is created.  So... lines 70-77 put five null-LINES into the scene... even if you DO re-define their variable names in the executeCodeAction.  Those 5 null-Lines are in the scene, even if they are set to draw from origin to origin (from 0,0,0 to 0,0,0).

 

It makes no sense that they are z-fighting because the null-lines are not in the same position as the active lines.  All z-fighting I have seen... was due to one mesh being atop another, position-wise.  Your null-Lines are not positioned atop your active Lines (Or maybe the are!  See my retarded theory further below).  All in all, removing the null-Lines seems to have improved things.

 

http://www.babylonjs-playground.com/#PDWUQ#2  -  Here I have remarked-out the code-lines 70-77, and it seems to be working much better.  Now your box click produces 5 Lines, 3 are positioned and 2 are null.  Generally speaking, I would avoid making null Lines (Lines between 0,0,0 and 0,0,0).  They seem to be getting in the way of the active Lines.

 

Speaking-of "getting in the way", here is a theory.  ALL Lines... are probably positioned at 0,0,0... no matter where they stride FROM/TO.  They probably use vertexData to set the positioning of the Line.  This same-positioning could cause a z-fighting phenomena, regarding null-Lines.  But, more likely, there is an issue with depthRendering, here.  The null-Lines are actually blocking the active Lines... from view.  No z-fighting.  Actually, z-ordering.  The world famous hidden line algorithm (determining what is visible in a scene and what is hidden)... has come to haunt you.  :)

 

Avoid null-Lines is my advice.  Hope this helps.  If not, we'll keep experimenting and talking about it... because you made us this cool playground where we could easily see the issue.  Well done.  You have a good looking truss, an interesting subject-matter, and a fine start to your structural stress visualizer.  Keep us posted.

Link to comment
Share on other sites

Thanks for the help, and for the nice comments.

 

I'm going to continue experimenting with this today and hopefully complete it. I'll keep in mind what you said about null-Lines and I'll let you know how everything goes.

 

I may just predefine the lines and have them change visibility like I do for all of the trusses, unfortunately this will just mean more lines of code

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...