Skip to main content
gamedev.net
🔒 Locked

D3D Rendering ...

Started by pegasus123 6 replies 500+ views
Original Post
pegasus123
pegasus123
Hi , I have a novice question ... In 2D , one would clear a dirty rect and paint the sprites that exist in that rect. What abt 3D ? Objects now have a z-coord ... eg. if object A is moving and it moves over only part of object B , does that mean that ObjectA and ObjectB have to be redrawn ? Or is there a way of drawing only part of ObjectB ??? I would appreciate any help with regards to this. I suspect that painting of the entire scene is NOT the right way to go. Regards,
Pipo DeClown
Pipo DeClown
You''re wrong. I''m not completely right. Let me try to explain.

In 2D you don''t have HW acceleration. So the processing is kinda done in the SW. That''s why drawing the entire screen isn''t smart. But with 3D, you can use HW acceleration to speed up drawing. IOW, drawing the whole screen isn''t as expensive as you think, unless of course the user doesn''t have any HW acceleration.

Just let the scene fill the screen.

--
You''re Welcome,
Rick Wong

- sitting in his chair doing the most time-consuming thing..
DarthJappie
DarthJappie
As a matter of fact, you will redraw all objects in view every frame. If object B is obscured by object A, you will have to draw (with depth buffering on) object B first, and then object A. You''ll have to sort these objects based on how close they are to the camera (Z-sorting).

-JJ

-----------------------------
Jan-Jaap Severs
Programming / Design
Grendel Games

[ Grendel Games ]
----------------------------- Jan-Jaap Severs Grendel Games[ Grendel Games ]
Metus
Metus
you don''t have something like dirty rects in 3d, instead you use culling methods like frustum and occlusion culling...
Ethereal
superpig
superpig
quote:
Original post by DarthJappie
As a matter of fact, you will redraw all objects in view every frame. If object B is obscured by object A, you will have to draw (with depth buffering on) object B first, and then object A. You''ll have to sort these objects based on how close they are to the camera (Z-sorting).


You definitely *don''t* want to do that. If depth-buffering is on, you should draw your closest objects first - that way, pixels from objects further away can be z-culled early in the pipeline, rather than constantly redrawing all the same pixels oin the backbuffer.

The exception is with things that aren''t completely opaque (i.e. alpha < 1.0). Those you *should* draw back-to-front.
Richard "Superpig" Fine - saving pigs from untimely fates - Microsoft DirectX MVP 2006/2007/2008/2009
"Shaders are not meant to do everything. Of course you can try to use it for everything, but it's like playing football using cabbage." - MickeyMouse
DarthJappie
DarthJappie
superpig:
You''re right, obviously. Spent too much time tinkering with alpha-stuff, I guess. Thanks for the correction.

-JJ

-----------------------------
Jan-Jaap Severs
Programming / Design
Grendel Games

[ Grendel Games ]
----------------------------- Jan-Jaap Severs Grendel Games[ Grendel Games ]
pegasus123
pegasus123
Oh rite ! Thanks dudes ... so the reason it would run slower on another machine is that there''s no HW acceleration ???

I am effectively drawing closest to furthest and it runs pretty well on my GF4 5200 ... however on a GF4MX its really slow ...

Thanks once again ...
Pipo DeClown
Pipo DeClown
Your other card should be running slow.. since that one got HW acceleration too. I mean, it IS the HW acceleration.

--
You''re Welcome,
Rick Wong

- sitting in his chair doing the most time-consuming thing..

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.