Author Topic: Stupid goddamn erroneous pseudovertex extermination thread.  (Read 22143 times)

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 1,809
I gotta figure out why these erroneous pseudovertices are being created.

They are created inside a single rotating cube, when a foreground edge intersects with a background edge.
The pseudovertex is created just at the point where this intersection would occur.

Now, the pseudovertex generating code should check it in 2D first and discover it's "inside" a face, so it should then proceed to the next part of the code where it checks to see if the pseudovertex is hidden behind anything (and it is!  it's hidden behind a face...  or it's right on the edge of a face....)



Hmm.  Maybe it exists in a microscopic gap between the faces?  Maybe in that area, the code considers it behind neither one face, or the other, because (by its very nature) it is perfectly balanaced in between them?

So I guess I'd need to add some kind of buffer zone around faces or something..?

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 1,809
Re: Stupid goddamn erroneous pseudovertex extermination thread.
« Reply #1 on: May 28, 2012, 05:53:17 PM »
That won't work.  If I create a microscopic buffer zone around faces that prevents pseudovertices being added, all the REAL pseudovertices will fall inside this area and as a result won't be rendered.

That would be wrong.

I need to figure out how I can programatically distinguish between the erroneous pseudovertices and the real ones.

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 1,809
Re: Stupid goddamn erroneous pseudovertex extermination thread.
« Reply #2 on: May 28, 2012, 06:09:53 PM »


The red dots are the erroneously created pseudovertices..
« Last Edit: May 28, 2012, 06:17:33 PM by annikk.exe »

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 1,809
Re: Stupid goddamn erroneous pseudovertex extermination thread.
« Reply #3 on: May 28, 2012, 06:24:29 PM »
Perhaps if I add one more check at the end, right before the pseudovertex is added..

At this point we know:

1) The pseudovertex is "inside" a face in 2D
2) The pseudovertex is either visible, or stuck in the microscopic gap between two edges like above.
3) We know the 2D and 3D coordinates it occurs at
4) We know which edge we're going to be adding it to


I could cycle a tiny bit forward and a tiny bit backward along the edge for each potential pseudovertex.

If the pseudovertex is not hidden behind anything when cycled forward along the edge by 1%, OR it's not hidden when cycled backward along the edge by 1%, then it should be visible.
If it's hidden in both of these circumstances, we've captured an erroneous pseudovertex that should not be rendered!

This sidesteps the problem of vertices erroneously being rendered in between faces.

« Last Edit: May 28, 2012, 06:35:39 PM by annikk.exe »

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 1,809
Re: Stupid goddamn erroneous pseudovertex extermination thread.
« Reply #4 on: May 28, 2012, 06:34:59 PM »


The rule is:

1: Cycle 1% forwards along the edge: Is this visible?
2: Cycle 1% backwards along the edge: Is this visible?

If the answer to EITHER 1 or 2 is Yes, SHOW THE EDGE.
Otherwise hide it.


That should work, right..?

Lost Seedling

  • Shrub
  • ***
  • Thank You
  • -Given: 9
  • -Receive: 30
  • Posts: 205
Re: Stupid goddamn erroneous pseudovertex extermination thread.
« Reply #5 on: May 29, 2012, 02:23:51 AM »
This only occurs in a "rotating" cube? Would the speed of rotation then need to be considered?

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 1,809
Re: Stupid goddamn erroneous pseudovertex extermination thread.
« Reply #6 on: May 29, 2012, 02:38:23 AM »
This only occurs in a "rotating" cube?

It's particularly obvious in a rotating cube because you can see the erroneous pseudovertex floating along the back edge, where it shouldn't be.... but no, it's not technically a requirement.  A static, non-moving cube that had already been rotated like in my diagram above would display this behaviour too.

Quote
Would the speed of rotation then need to be considered?

Nope. :>  Not a factor whatsoever.  :>

Aino

  • Ent
  • ******
  • Thank You
  • -Given: 4
  • -Receive: 30
  • Posts: 1,527
  • Eufloria: Yes
Re: Stupid goddamn erroneous pseudovertex extermination thread.
« Reply #7 on: May 29, 2012, 04:01:27 AM »
Do you have a way to check if an edge is being rendered? Might wanna start there and see if both of the edges for the pseudovertex is being rendered?

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 1,809
Re: Stupid goddamn erroneous pseudovertex extermination thread.
« Reply #8 on: May 29, 2012, 04:16:08 AM »
Edges, or parts of them, are rendered according to the configuration of vertices, inactive vertices, and pseudovertices.

From your question, it sounds like you mean the vertices.

Yes, my first step was to hide those when they are behind stuff - and that part works!  So it's just the pseudovertices, then I'm ready to draw the edges. :>

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 1,809
Re: Stupid goddamn erroneous pseudovertex extermination thread.
« Reply #9 on: May 29, 2012, 05:25:00 AM »
Here's what I have at the moment.

If you load it up and pan around a bit, you'll see the vertices of 3 cubes being rendered.  You'll also notice red dots - these represent pseudovertices.

You should be able to see them appearing in the correct places.  You might also notice the erroneous ones.  A good way to see the erroneous pseudovertices is to pan the camera up and right, so that you have an unobscured view of the cube at the back.  As it rotates, you should start to see little red dots trace their way between the vertices of the cube.



I think my solution above might fix the problem.  It all depends on whether my assumptions about the nature of the problem are correct, but I've been thinking about it for ages and this is the best idea I have so far.  We shall see...

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 1,809
Re: Stupid goddamn erroneous pseudovertex extermination thread.
« Reply #10 on: May 29, 2012, 06:18:49 PM »
I thought that coincident lines might create a problem but I've realised they probably won't.

One small change though, I think I will use "1" instead of "1%" for the forward/backward cycling.
Otherwise it would vary the behaviour depending on the edge's length, so for very long or very short edges the behaviour might become erroneous.

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 1,809
Re: Stupid goddamn erroneous pseudovertex extermination thread.
« Reply #11 on: July 29, 2012, 06:26:46 PM »
Made a breakthrough, finally.
During edge comparison, edges that share a vertex were erroneously being checked against each other. This causes the flickering pseudovertices on top of the vertices.

Problem is corrected and the flickering is gone.

Also realised my linear interpolation algorithm is wrong. Got an idea to fix it but it will take some time..

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 1,809
Re: Stupid goddamn erroneous pseudovertex extermination thread.
« Reply #12 on: August 01, 2012, 09:35:15 PM »
So close...  it's so close guys..

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 1,809
Re: Stupid goddamn erroneous pseudovertex extermination thread.
« Reply #13 on: August 06, 2012, 08:43:17 PM »
I've got rid of all the erroneous pseudovertices.

I'm left with only correct pseudovertices.  However, there's a problem.  Some of the pseudovertices flicker.

The flickering is caused by the code which checks whether they are "inside" a 2D polygon or not.

The code has recently been modified to NOT check any face that the edge is a part of.
To better explain this, when two edges cross, their distances from the camera are compared, then the furthest away edge is chosen as the host edge for the potential pseudovertex.  The host edge becomes the PROTECTED EDGE.
The pseudovertex is then checked against all faces EXCEPT if the protected edge is part of that face.  So edge 12 might be the protected edge, and it might be part of faces 3 and 4.  Faces 3 and 4 then become protected; ie, they are not checked to see if the pseudovertex is "inside" them in 2D.

This most recent update is what has produced the nearly-correct behaviour.  But I can't work out why some of the pseudovertices flicker.

SweetCandyGrimm

  • Grimm
  • Shoot
  • *
  • Thank You
  • -Given: 1
  • -Receive: 1
  • Posts: 23
Re: Stupid goddamn erroneous pseudovertex extermination thread.
« Reply #14 on: September 04, 2012, 09:24:16 PM »
I've got rid of all the erroneous pseudovertices.

I'm left with only correct pseudovertices.  However, there's a problem.  Some of the pseudovertices flicker.

The flickering is caused by the code which checks whether they are "inside" a 2D polygon or not.

The code has recently been modified to NOT check any face that the edge is a part of.
To better explain this, when two edges cross, their distances from the camera are compared, then the furthest away edge is chosen as the host edge for the potential pseudovertex.  The host edge becomes the PROTECTED EDGE.
The pseudovertex is then checked against all faces EXCEPT if the protected edge is part of that face.  So edge 12 might be the protected edge, and it might be part of faces 3 and 4.  Faces 3 and 4 then become protected; ie, they are not checked to see if the pseudovertex is "inside" them in 2D.

This most recent update is what has produced the nearly-correct behaviour.  But I can't work out why some of the pseudovertices flicker.

Ok not a math wiz but i read thru all this and am amazed with what your figuring out.. i DLed the file to check out what it would look like....question? are the solid red dots the pseudo-vertices that had errors? meaning that wasn't the updated code i DLed or have u not posted what u corrected (minus the blinking) yet? like i had said before im learning scripting (thnx to Eufloria) so this is all quite interesting for me.. i think im understanding some of it.. but.. not as much as i could...

i am.. the young grass-hoppa XD