Saturday, April 19, 2003

Direct3D - Materials Basics

Here's the latest in my Managed Direct3D series. A little exerpt:

I know I said last time in our discussion about textures, that I?d go on to talk about meshes. But I lied.

 

Actually, I made a mistake. What happened was, I started writing about meshes and realized that using meshes and textures together at the same time is a bit much for an introduction. So I decided that we should talk about materials, which will give us a nice gentle way to get started with meshes. After we talk about zbuffers, too, of course.

 

We?ve now talked about two ways to get objects in our scenes to have some color: we can either use a vertex format that has color information, or we can use a texture to warp a bitmap onto a triangle or set of triangles. But it turns out there is at least one more way: we can set up a material.

 

A material is a bunch of global settings that tells the Device, ?Hey, the next time you draw a triangle, I?d like it to look like this.? The settings are captured in a structure of type Material, and are associated with the Device by assigning to its property of the same name. It goes something like this:

No comments:

Post a Comment