Re: Do I have to redraw everything every frame / loading meshes
- From: legalize+jeeves@xxxxxxxxxxxxxxxxx (Richard [Microsoft Direct3D MVP])
- Date: Tue, 30 Oct 2007 16:34:45 -0700
[Please do not mail me a copy of your followup]
"IB" <IB@xxxxxx> spake the secret code
<OSsIg4uGIHA.1548@xxxxxxxxxxxxxxxxxxxx> thusly:
My 3d model hase a very large mesh which is loaded at startup, and some much
smaller objects animated around it. It can also have multiple windows. 2
questions:
1. Currently, each 3d window loads its own meshes, and as the static mesh is
very large, this takes a long time. I would prefer to load the mesh once,
and share it between the windows - is this possible? The problem I'm seeing
is that Mesh.FromFile requires a device, which is specific to the window??
A device can present to any window handle. A device must be
associated with a window when it is created, but any window can
receive the results of Present.
2. The large mesh is static, but I'm rendering it in every frame with the
smaller moving objects. Is there any way to put static meshes into some kind
of buffer, so they don't have to be processed every frame?
You have a variety of choices here, but they break down into two
methods: caching the result of rendering or simplifying the rendering.
You can create a cached result by:
1) creating a secondary depth buffer and a secondary plain surface
2) clear the render target and back buffer
3) render your big static mesh
4) copy the depth buffer and color buffer to the secondary buffers
Then to render using your cached result do:
1) clear render target and depth buffer
2) copy cached color buffer and depth buffer into your render target
and depth buffer
3) render the remaining meshes
There are a large variety of techniques for simplifying the rendering;
they all rely on methods of either discarding irrelevant geometry in a
complex mesh, or substituting low(er)-fidelity geometry for the
complex geometry. The book "Real-Time Rendering" is mostly about
techniques for substituting simpler geometry for complex geometry in
order to keep the rendering running in real-time. The simplest form
of discarding of irrelevant geometry is to cull back faces. There are
more complex algorithms for discarding.
The cached rendering route is simple to implement, but rather hoggy of
video card resources particularly if your rendering is large. But its
simple to implement, so give that a try first.
--
"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/>
.
- Follow-Ups:
- References:
- Prev by Date: Using a different type of projection matrix in Direct3D?
- Next by Date: Re: Simple rendering/transformation problem
- Previous by thread: Do I have to redraw everything every frame / loading meshes
- Next by thread: Re: Do I have to redraw everything every frame / loading meshes
- Index(es):
Relevant Pages
|