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.
2 Answers
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.
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.
-
\$\begingroup\$ 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 :( \$\endgroup\$ Commented Aug 9, 2012 at 6:31