Page 1 of 1

Back face culling

Posted: Mon Dec 10, 2007 8:50 pm
by Mentat
Tips? Help? I've got the concepts down. But the code doesn't. I don't want actual code; I want different methods, on a mathematical and conceptual level.

Posted: Mon Dec 10, 2007 8:51 pm
by Sinuvoid
What is that?

Posted: Mon Dec 10, 2007 8:55 pm
by Mentat
Lee wrote:What is that?
Displaying only the front part of a 3d object, instead of the whole thing. I've just been testing on tetrahedrons. It doesn't help that half of it is out of the screen. But once in a while I get a beautiful one, fully culled. Right now I'm just working with wireframes, and not filling the sides in.

Posted: Mon Dec 10, 2007 8:59 pm
by Sinuvoid
Ok thanks :D

Posted: Mon Dec 10, 2007 9:04 pm
by Mentat
It stopped working :cry:'

I've flipped around the the signs and it does the same thing.

Posted: Tue Dec 11, 2007 10:30 am
by BadMrBox
I dont personally know anything about bfc but I found this link. It might be usefull http://www.cs.berkeley.edu/~ug/slide/pi ... cull.shtml

Posted: Tue Dec 11, 2007 2:42 pm
by Anonymous
I took a quick look in petes tutorial section and found this tutorial which may be of help

http://www.petesqbsite.com/sections/tut ... phics.html

back face culling

Posted: Mon Apr 07, 2008 1:10 am
by Kiyotewolf
there is a math routine that calculates the points to see if they come out to a positive or a negative number and it follows somehow on the fact that polygons are drawn using clock-wise drawn points,.. and if the points run in the other direction, counter clockwise, the formula returns the opposite sign..

You have to do vector math, and you add the vectors between the points somehow and compare it .. but that's about all I can remember.

Look up um.. what was it also called..

front facing polygons, back facing polygons?

i know this stuff and even understood the formula and code when i poured over it for hours but now i hath forgotten my info..

grr..

this thucks..

well.. i'll go looking and see if i can find something to be more helpful to you..

Kiyote!

Posted: Mon Apr 07, 2008 6:17 am
by Mentat
Thanks, though I already got it. I just have to use the cross product with two sides. :mrgreen:

cross product?

Posted: Tue Apr 08, 2008 10:05 am
by Kiyotewolf
Telling the difference between cross and dot products did confuse me thoroughly..

I could only tell the code apart from each other if I saw a listing of both side by side...

@.@'

I have been able to use 3D rotation formulas though, and scalar multiplication to make a vector clown do what looked like take two steps and make a back flip..

It rotated in all 3 axis, and was only a 2D wireframe, but as you watched it you kinda got hypnotised.

It was coded in Turbo Pascal v3 for DOS, (.. i should look up a compilier for that again.. <.<').. and was pretty fun as a diversion.

Actually....

I tried to code a texture mapping thingy in that same code which has been since coded in QBasic and submitted for the next issue of QBX.. so.. heh..


^.^

Whatcha making in 3D anyway? Izzit secret? Is it not? Me curious now..

I have a few odd projects to code in 3D eventually.. but the math still escapes me,.. I have to go code googling and find all it and print all it and rewrite all it and all kinds of stuff like that there.....

Kudos..

Clue me in if possible.. if not I'm sure I'll find out when you submit demo screens..!

Kiyote!

Posted: Tue Apr 08, 2008 5:03 pm
by Mentat
I've been working on a functioning and easy to use 3d graphics library. My avatar is a snap shot of one of my older demos. The current work isn't much though.

Posted: Wed Apr 09, 2008 10:06 am
by syn9
do your normal 3d math, and projection, once you have the 2d screen coordinates, use the cross product on them, if (-) then its facing away from the screen, if (+) its facing the viewer. you dont need to do it on the 3d points because you'll be wasting clocks on the z coor when you can just do it on the 2d screen ones.

Posted: Tue Apr 15, 2008 7:10 am
by Mentat
It occurred to me, Wouldn't it be different in a left-handed coordinate system? X right, y up, z into screen is left handed, though x right y down z into (which seems to be somewhat conventional) is right handed.

Posted: Wed Apr 16, 2008 11:23 am
by syn9
it doesnt really matter... as long as z is into or out of the screen and all of your poly points are either CCW or CW, then just do a test to see which one yields a -1 and which yields a +1, then do not draw the one that is facing away