Skip to main content
GameDev.net gamedev.net
🔒 Locked

Static vs Dynamic Geometry

Started by TheOrestes Nov 27, 2009 at 3:36 AM 2 replies 5.9k views
Original Post
TheOrestes
TheOrestes
Hi, Is there any difference the way in which Static Geometry ( Walls etc ) & Dynamic Geometry ( Cube, chair etc that moves after collision ) are stored in the computer memory? ( CPU-GPU ) This question is with regards to the fact that, I dont need to update the transformations for the static geometry every frame but i do need to update the same for dynamic memory. Though i have to render both every tick. Thanks in advance!
mmakrzem
mmakrzem
Are you using OpenGL or DirectX. In DirectX when you create a memory buffer you specify how you would like to use it. Dynamic, static, etc.... I believe there are 4 settings. Which ever you pick your program will try to place it in the most appropriate place in memory so that it is fast to access. If you allocate your objects into the static memory space but use it as if it is dynamic, your program will still run it will just be slower then it can really be.
kauna
kauna
Geometry should be defined as static when you don't use CPU to manipulate it's vertex data. So, in that sense even (GPU-)skinned meshes are static even if you see them deforming in real time. So, in your example of moving vs non-moving meshes there is no difference how to store them in the (GPU-)memory.

The transformation matrix doesn't really affect the way geometry is stored.
You are right, that you don't need to change the world matrix of an object every frame if it is non-moving.

However, to clarify, as the camera is moving in the scene, you are changing your view matrix. So in that sense the final transformation matrix is changing when your camera is moving/rotating.

Cheer!
tenpoundbear
tenpoundbear
I am new to games programming myself... So I hope I am answering you question in the right context.

This is an extract that I've taken from "Introduction to 3D Games Programming with DirectX 9" By Frank Luna

A buffer created without the D3DUSAGE_DYNAMIC flag is calleda static buffer. Static buffers are generally placed in video memorywhere its contents can be processed most efficiently. However, thetrade-off of making a buffer static is that writing to and reading fromthe memory of a static buffer is inherently slow because accessingvideo memory is slow. For this reason we use static buffers to holdstatic data (data that will not need to be changed (accessed) very frequently).Terrains and city buildings are examples of good candidatesfor static buffers because the terrain and building geometry will usuallynot change during the course of the application. Static buffers shouldbe filled with geometry at application initialization time and never atrun time.A buffer created with the D3DUSAGE_DYNAMIC flag is called adynamic buffer. Dynamic buffers are generally placed in AGP memorywhere its memory can be updated quickly. Dynamic buffers are notprocessed as quickly as static buffers because the data must be transferredto video memory before rendering, but the benefit of dynamicbuffers is that they can be updated reasonably fast (fast CPU writes).Therefore, if you need to update the contents of a buffer frequently, itshould be made dynamic. Particle systems are good candidates fordynamic buffers because they are animated, and thus their geometryis usually updated every frame.


I am not a professional, although I am striving to become one so I think that text says it better than I can. :-D

Topic Locked

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

Sign in to reply to this topic.