We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpPrograms › mesh render problem / bug with traerphysics.
Page Index Toggle Pages: 1
mesh render problem / bug with traerphysics. (Read 685 times)
mesh render problem / bug with traerphysics.
Dec 20th, 2009, 6:41pm
 
Hey,
i am having problems rendering a surface generated using a traerphysic particle mesh. I found this problem when playing arround with introspectors great dook mesh sketch.
I first thought there is maybe a problem with his code and tried to figure out what it could be. But after struggling with it for a while now and reducing it to a minimum of code i can tell the problem must be something else.

Sometimes especially when in motion some of the shapes are not rendered. I realized that the problem stops when they rest after a while. Anyway as I want to save some of the shapes especially when in motion thats a problem.
So I thought I can maybe make them fix ( you can do that by pressing f) but that doesnt help either.

So my guess is that it is maybe a problem of traerphysics coordinate calculation that returns some bad coordinates but i couldnt see anything strange when printing out some values. Or is it a known processing render problem? I have to add that it does not only appears on screen. Also when saving an STL file the problem stays.

Thats how it looks like : http://dl.dropbox.com/u/1152794/Screen_3769.jpg

there is a test sketch : http://www.dec32.de/public/p5/meshproblem/

Any ideas ?

Thx
Cedric
Re: mesh render problem / bug with traerphysics.
Reply #1 - Dec 21st, 2009, 4:10am
 
i am still trying to solve the problem, I guess i correct myself by saying it could be a traerphysics problem.

it seems to be a processing problem. When switching from beginShape to beginShape(QUADS) everything is fine. No problems anymore.

this is fine if i just want to draw the mesh, but like in introspectors dook Mesh i want to draw little holes to the surface. So i need to use some custom shape not just a quad. And these custom shapes, even when they are just a quad seems to cause problems.
I will try to work arround it using quadStrips or triangleStrips ( they work also) but i would still like to know why that is.
Re: mesh render problem / bug with traerphysics.
Reply #2 - Dec 21st, 2009, 7:45am
 
I believe the crux of the problem is with the P3D / OpenGL rendering.
The beginShape() is equivalent to beginShape(POLYGON) and this can be followed by 3 or more vertices (in your program 4 vertices) and then rendered with endShape(CLOSE) giving a closed polygon.

In the official guide to OpenGL it states that when using polygon mode
Quote:
Draws a polygon using the points v0, ... , vn-1 as vertices. n must be at least 3, or nothing is drawn. In addition, the
polygon specified must not intersect itself and must be convex. If the vertices don't satisfy these conditions, the
results are unpredictable.

I know you are not using OpenGL but I suspect that P3D which is based on Java3D is the same.

This limitation does not when using QUADS mode.

I could be wrong not being and expert on the inner workings of rendering but it seems to fit the problem you have encountered.

Re: mesh render problem / bug with traerphysics.
Reply #3 - Dec 21st, 2009, 8:00am
 
Yes, i realized using quads works fine.
I used a quadstrip to create the holes i needed. its actually better then the solution i had before i guess.
Thanks anyway!
Page Index Toggle Pages: 1