Re: Do I have to redraw everything every frame / loading meshes



[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/>
.



Relevant Pages

  • Re: Do I have to redraw everything every frame / loading meshes
    ... Currently, each 3d window loads its own meshes, and as the static mesh is ... caching the result of rendering or simplifying the rendering. ... creating a secondary depth buffer and a secondary plain surface ...
    (microsoft.public.win32.programmer.directx.graphics)
  • Cello Speed Week Results
    ... Cello Speed Week!!!!!!! ... by bifurcating the rendering of the shape such that the varying rotation ... Note that this is a phat 900x900 window, ... OpenGL clipping. ...
    (comp.lang.lisp)
  • Re: R14sp3 and Mac OS X 10.4.2
    ... anything into the command window, ... >>> c) Graphics is really really slow. ... >> Graphics rendering times seem okay to me. ... >> Colorbars seem to export fine to PDF or EPS files, ...
    (comp.soft-sys.matlab)
  • Re: center/shrink to fit redux.
    ... for pathologically odd text or window size. ... the rendering is not as pretty, but is easy to use and accessible, and ... CSS has flaws, that's the bottom line... ... immediate problem. ...
    (alt.html)
  • Re: Not rendering the buffer...
    ... I know that if the window is ... kindly suggested to use pbuffers and not using glReadPixels. ... It rendering faster, because it renders nothing at all. ...
    (comp.graphics.api.opengl)