Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Z-buffer and Culling in DirectX

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
oib111
I post too much
Reputation: 0

Joined: 02 Apr 2007
Posts: 2947
Location: you wanna know why?

PostPosted: Sun Jul 26, 2009 9:14 am    Post subject: Z-buffer and Culling in DirectX Reply with quote

I'm trying to draw two triangles, one behind the other so I'm using the Z-buffer. I'm using this tutorial. I noticed in his source code he turned off culling even though he didn't mention anything about that in the tutorial. So why do you have to turn of culling when you're using the Z-buffer?
_________________


8D wrote:

cigs dont make people high, which weed does, which causes them to do bad stuff. like killing
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
HolyBlah
Master Cheater
Reputation: 2

Joined: 24 Aug 2007
Posts: 446

PostPosted: Sun Jul 26, 2009 10:42 am    Post subject: Reply with quote

He does that so you can see the triangles from both sides. he explains that in lesson 5 table 5.1.
Back to top
View user's profile Send private message
oib111
I post too much
Reputation: 0

Joined: 02 Apr 2007
Posts: 2947
Location: you wanna know why?

PostPosted: Sun Jul 26, 2009 1:44 pm    Post subject: Reply with quote

You aren't trying to look at the triangles from both sides though?
_________________


8D wrote:

cigs dont make people high, which weed does, which causes them to do bad stuff. like killing
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
HolyBlah
Master Cheater
Reputation: 2

Joined: 24 Aug 2007
Posts: 446

PostPosted: Sun Jul 26, 2009 4:32 pm    Post subject: Reply with quote

You must see the triangles from both sides to see the effect of z-buffer.
If you won't turn cullmode off you won't be able to see the effect while the
triangles with their "back" to the camera.
Back to top
View user's profile Send private message
oib111
I post too much
Reputation: 0

Joined: 02 Apr 2007
Posts: 2947
Location: you wanna know why?

PostPosted: Sun Jul 26, 2009 5:18 pm    Post subject: Reply with quote

Oh, thanks. That makes sense Smile
_________________


8D wrote:

cigs dont make people high, which weed does, which causes them to do bad stuff. like killing
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Sun Jul 26, 2009 5:29 pm    Post subject: Reply with quote

The common cullmode in DX is to cull away counter clockwise facing verts. (as such, you should take caution to always create them clockwise)

As such, when you create your triangle, you'll probably be looking directly at it until you move it or the camera. If you have culling enabled, there is no backside to the triangle.

I'm pretty sure culling is disabled by default, though.



edit: also this is a MUCH better site than Directxtutorial.com, which doesn't do any error checking and has some noticeable bad practices (trying to keep track of the framerate with GetTickCount(), really?)

http://thetavern.servebeer.com/?p=articles
Back to top
View user's profile Send private message
oib111
I post too much
Reputation: 0

Joined: 02 Apr 2007
Posts: 2947
Location: you wanna know why?

PostPosted: Sun Jul 26, 2009 7:39 pm    Post subject: Reply with quote

Isn't D3DRS_CULLMODE set to D3DCULL_CCW by default? Also, I'll look at that site after dinner. Thanks Smile
_________________


8D wrote:

cigs dont make people high, which weed does, which causes them to do bad stuff. like killing
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
tombana
Master Cheater
Reputation: 2

Joined: 14 Jun 2007
Posts: 456
Location: The Netherlands

PostPosted: Mon Jul 27, 2009 1:37 pm    Post subject: Reply with quote

slovach wrote:
edit: also this is a MUCH better site than Directxtutorial.com, which doesn't do any error checking and has some noticeable bad practices (trying to keep track of the framerate with GetTickCount(), really?)

http://thetavern.servebeer.com/?p=articles

Thanks so much for that site Very Happy

Is timeGetTime() more accurate than GetTickCount() ?
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Mon Jul 27, 2009 4:00 pm    Post subject: Reply with quote

It is (assuming you set it to 1ms with timeBegin / EndPeriod) but you may still have problems with it.


60 fps is 16.667 ms to render the frame.
100 fps is 10 ms...
250 fps is 4 ms...
1000 fps is 1 ms...


If your FPS ever dares to go over 1000, your timing code is going to end up completely breaking... Quake 3 for example uses timeGetTime if I remember right and it does in fact shit itself when your FPS starts to get very high.

This is where QueryPerformanceCounter() comes in... or I guess you could use rdtsc, but I don't think this always works correctly on multi-core systems? maybe someone else can comment on this
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites