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 & HelpSyntax Questions › matrix bug since v125
Pages: 1 2 
matrix bug since v125 (Read 1801 times)
Re: matrix bug since v125
Reply #15 - Jul 21st, 2007, 2:13am
 
short answer then:

loadMatrix();


and if you're interested in getting that to work:
http://www.gamedev.net/reference/articles/article1088.asp

have fun =)
Re: matrix bug since v125
Reply #16 - Jul 21st, 2007, 4:17am
 
hehehe
ok...
well loadmatrix doesnt work for me, the g.mXY is zero for all the values. its also zero if i dont use loadmatrix
im using xp and p3d

and im interested in why it doesnt work anymore
it used to work 24hours ago before i download the new version

-nothing changed in the code
-the math behind it didnt change (unless that patch modified the fabrics of space and time or that kind of freaky things)
-so i guess there is a bug somewhere...

but anyway thanks for taking time to answer.
Re: matrix bug since v125
Reply #17 - Jul 21st, 2007, 4:54am
 
oh and both methods work...
what you are doing is say: "if the camera is in the half space facing the polygon then the polygon is visible"
but note that the camera's facing doesnt enter into account in this operation
so if your camera is in the half-space facing the polygon but looking away from it you'll draw the polygon, even though it isnt actually visible.

im going the other way: "if the polygon's normal is oriented along the view vector, then it is invisible"
in my case i dont check whether the polygon is in front or behind the camera, so if they are facing each other ill draw it even if the polygon is behind me.

i think ill use both methods from now on, so thanks for pointing me this. Plus your method will work around the bug.

but sooner or later i'll have to get the view vector, and im worried about how ill do since i cant retrieve the values.
Re: matrix bug since v125
Reply #18 - Jul 21st, 2007, 5:12am
 
i have processing 125 version and i tested loadMatrix() for you and it worked just fine with me.. it gave me the resulting matrix. maybe you're doing sumtin wrong..

about back face culling:

--what you are doing is say: "if the camera is in the half space facing the polygon then the polygon is visible"
this is wrong. camera can be facing any direction, but any faces that are facing away are rejected. thats what backface cull does.. it does not take camera direction into account.

what you need is a vector from your camera position to the plane in question, the plane that represents your face, and test that vector with the plane's normal. if the angle is greater than 90º it is backfacing the camera, so you can ignore it. thats it

the view vector is just camTarget-camPos..
you can get that from your Camera class.

if you want to remove objects not visible in the camera frustum you will have to go thru other techniques..
Re: matrix bug since v125
Reply #19 - Jul 21st, 2007, 10:25am
 
You're wrong.
Take this first example:
...

The same polygon, when translated across the field of view, goes from facing the cam (on the left) to facing away (on the right) with your method the poly would be drawn in both cases.

Example two:
...

Here's a real example of the errors you'll see with your method. The red line represents the parts of the sphere your method will class as "back" but on the left sphere you can see that at the right side, there are some polygons removed that should be drawn.. and on the left some are drawn that shouldn't be.
Re: matrix bug since v125
Reply #20 - Jul 21st, 2007, 1:13pm
 
ok... that makes sense! i surrender ^^
*waves white flag*
BUT ILL BE BACK!!
Pages: 1 2