Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have an object(FBX format) in my project, it's a line drawn in 3D max. I want to color the line in XNA so that the color starts from a specific RGB color in both the start and end points of the line and finish in a specific RGB color.(e.x., from (255,255,255) to (128,128,128). Something like gradient coloring of an object. I need to do that programmatically, since later in my code I have to change these two specific colors a lot.

share|improve this question

In 3DS Max, select your line geometry and apply the VertexPaint modifier to it. This way you can paint individual vertices with the color of your choice, although I don't know if FBX format supports exporting this information.

If you need to change the color later, paint one end in pure white and the other in a middle gray; then, inside your code, change the DiffuseColor of your BasicEffect to achieve the desired tinting.

share|improve this answer

This article talks about gradient shaders:

You might be able to adapt that to shade your model (draw it with the shader) instead of the skybox.

share|improve this answer
Thanks for the link. I could use the shader for an object like a magnet with 3 meshes and it works. however I want to use that for only a line (an FBX object) with only one mesh and it seems all the line has a equal color :( – perrakdar Aug 9 '12 at 6:31

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.