Back face culling

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!

Moderators: Pete, Mods

Post Reply
User avatar
Mentat
Veteran
Posts: 409
Joined: Tue Aug 07, 2007 3:39 pm
Location: NC, US

Back face culling

Post 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.
For any grievances posted above, I blame whoever is in charge . . .
Sinuvoid
Veteran
Posts: 155
Joined: Wed Jul 25, 2007 8:20 am

Post by Sinuvoid »

What is that?
User avatar
Mentat
Veteran
Posts: 409
Joined: Tue Aug 07, 2007 3:39 pm
Location: NC, US

Post 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.
For any grievances posted above, I blame whoever is in charge . . .
Sinuvoid
Veteran
Posts: 155
Joined: Wed Jul 25, 2007 8:20 am

Post by Sinuvoid »

Ok thanks :D
User avatar
Mentat
Veteran
Posts: 409
Joined: Tue Aug 07, 2007 3:39 pm
Location: NC, US

Post by Mentat »

It stopped working :cry:'

I've flipped around the the signs and it does the same thing.
For any grievances posted above, I blame whoever is in charge . . .
User avatar
BadMrBox
Veteran
Posts: 86
Joined: Tue Feb 28, 2006 12:19 pm

Post 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
Anonymous

Post 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
User avatar
Kiyotewolf
Veteran
Posts: 96
Joined: Tue Apr 01, 2008 11:38 pm

back face culling

Post 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!
Banana phone! We need more lemon pledge. * exploding fist of iced tea! * I see your psycho cat and counter with a duck that has a broken leg, in a cast.
User avatar
Mentat
Veteran
Posts: 409
Joined: Tue Aug 07, 2007 3:39 pm
Location: NC, US

Post by Mentat »

Thanks, though I already got it. I just have to use the cross product with two sides. :mrgreen:
For any grievances posted above, I blame whoever is in charge . . .
User avatar
Kiyotewolf
Veteran
Posts: 96
Joined: Tue Apr 01, 2008 11:38 pm

cross product?

Post 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!
Banana phone! We need more lemon pledge. * exploding fist of iced tea! * I see your psycho cat and counter with a duck that has a broken leg, in a cast.
User avatar
Mentat
Veteran
Posts: 409
Joined: Tue Aug 07, 2007 3:39 pm
Location: NC, US

Post 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.
For any grievances posted above, I blame whoever is in charge . . .
syn9
Coder
Posts: 24
Joined: Wed Feb 22, 2006 6:16 pm

Post 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.
User avatar
Mentat
Veteran
Posts: 409
Joined: Tue Aug 07, 2007 3:39 pm
Location: NC, US

Post 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.
For any grievances posted above, I blame whoever is in charge . . .
syn9
Coder
Posts: 24
Joined: Wed Feb 22, 2006 6:16 pm

Post 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
Post Reply