Re: How does directx work - World or View transforms and rotations
- From: legalize+jeeves@xxxxxxxxxxxxxxxxx (Richard [Microsoft Direct3D MVP])
- Date: Tue, 03 Apr 2007 09:43:37 -0700
[Please do not mail me a copy of your followup]
g18c@xxxxxxxxxxx spake the secret code
<1175582014.003636.161830@xxxxxxxxxxxxxxxxxxxxxxxxxxxx> thusly:
useless without the background explanation behind the reasoning
With the background explanation you *might* be able to say
that advice is still relevant. Without it, its about as useful as
trying to decide which toilet paper to buy based on TV advertising
(and maybe not even that).
Hehe!
I'm sure you are aware as you are an expert the documentation states:
Direct3D uses the world and view matrices to configure several
internal data structures. Each time you set a new world or view
matrix, the system recalculates the associated internal structures.
Setting these matrices frequently is computationally time-consuming.
Yeah, there are other things hanging off change events for these
matrices. But hey, I've yet to hear of an application that seriously
found that setting the matrices was the bottleneck in their
application.
My point is to stop second-guessing the implementation of the runtime,
the driver and the hardware. Code what is simplest to code --
programmer time is the most expensive, not CPU/GPU time. Once your
application is working with real data, profile it and measure its real
performance. If its real performance is unacceptable, then determine
what's slow from the profile measurements. Then optimize away that
bottleneck to reveal the next most important bottleneck. Measure the
performance again, if its still not acceptable, then you have to go
back to the bottleneck and work on it some more.
Virtually all of the time in graphics, "optimizing away the
bottleneck" means reducing the data load sent to the processor with
things like view frustum culling, imposters, distance based level of
detail, and so-on. Only very, very, very, very rarely is it something
like manually compositing your world and view matrices into a single
matrix.
Either way, my point is still the same: code simply and
understandably, then profile, then optimize if necessary based on the
profile measurements.
Unless you've done something really stupid in the way your app is running
(like repeatedly setting the world and view matrices when you don't need
to), its very unlikely that setting one of these matrices is going to
show up in your profile in any significant way.
Obsessing about the matrices when you're writing the first pass of
your code only leads to code that is harder to understand and you
don't even know if it was worth it because you're attempting premature
optimization, which is bad.
--
"The Direct3D Graphics Pipeline" -- DirectX 9 draft available for download
<http://www.xmission.com/~legalize/book/download/index.html>
Legalize Adulthood! <http://blogs.xmission.com/legalize/>
.
- References:
- Re: How does directx work - World or View transforms and rotations
- From: g18c
- Re: How does directx work - World or View transforms and rotations
- From: Richard [Microsoft Direct3D MVP]
- Re: How does directx work - World or View transforms and rotations
- From: g18c
- Re: How does directx work - World or View transforms and rotations
- Prev by Date: Re: Animation: Can' t derive from sealed Frame class
- Next by Date: Blending from one texture to another - how is this done?
- Previous by thread: Re: How does directx work - World or View transforms and rotations
- Next by thread: Animation: Can' t derive from sealed Frame class
- Index(es):
Relevant Pages
|