Archived

This topic is now archived and is closed to further replies.

the_grip

Two questions: optimizations and basic vertex shaders

Recommended Posts

i''m new to DirectX, and i have a couple of questions: 1. Optimization: i''m a client/server app developer professionally, and typically loops are used b/c not much CPU overhead is needed. However, say i have 50 objects in a scene - what is the best way to get these objects rendered? i figure a loop is a straightforward but slow method, and i was considereing lumping like objects into a single index buffer. Would i still then need to iterate through each one to set all the appropriate position matricies? Is there a better method? 2. i''ve just glanced at vertex shaders - looks like cool stuff. They do require a knowledge of asm, yes? Like i said, i''m busy ironing out the basics, so i''ve just had a glance and that was my impression. Thanks for helping a noob "You call him Dr. Grip, doll!"

Share this post


Link to post
Share on other sites
2. I have started using Cg by nevidia available at developer.nvidia.com. This uses a C style language that can compile the shader files at runtime. DX9 will have a shader language.

Share this post


Link to post
Share on other sites
1. You'll have to set up each of your objects individually. That's life. You could do some fancywork, with vertex shaders, though. (Like loading several matrices to constant registers, and batching several objects in a call. This assumes that the objects use the same render/texture state setup, and you would need a per-vertex value to select the appropriate matrix)

2. They are written in an assembly-ish language, yes. But the aren't many different commands, the whole thing is pretty easy and elegant once you get used to it. Cg/HLSL is very exciting, but unfortunately almost useless for DX8 class HW (IMHO). (Because you have so few asm lines available in vs1.x/ps1.x)

-meZ

[edited by - meZmo on November 9, 2002 7:42:04 PM]

Share this post


Link to post
Share on other sites