Sign in to follow this  
rem24

Newbie question: Vertex colour information?

Recommended Posts

I know this is a VERY basic question, but just to get my head around it, what is the point of storing anything more than just the x,y,z coordinates, transformation data, and 'who I connect to' data in a vertex. Particularly, why store colour information? What is it good for? Cheers, Rob. [Edited by - rem24 on November 11, 2004 11:43:53 AM]

Share this post


Link to post
Share on other sites
Vertex data is any data that changes on a per vertex level... Normals usually change per vertex, texture coordinates change per vertex, bone influences change per vertex, and sometimes you want color to change per vertex. You don't have to include data that you don't want. Once you become familiar with rendering basic objects and start trying to achieve more complex effects you'll start to see where these other values can come in useful. For example, part of the color is alpha... this allows you to control how transparent your object is, per vertex. Not always useful, but not always useless either. In a project I'm working on we use vertex diffuse alpha to mean "amount of wind", and vertex specular red to mean "direction2 blend factor for wind". In a vertex shader we use this information to determine if a vertex should be moved, by how much, and in what direction. Sure we could calculate this on the CPU, locking the buffer every frame, but we'd rather it perform quickly... practically free.

In other words, some data (normals, texture coords, and color) can be used by the fixed pipeline to render things more interesting than unshaded, uncolored shapes... while with shaders you can store whatever data you'd like and interpret it to mean whatever you desire.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this