x


Is it necessary to use multiple materials when I only want to change one part of a model's color?

If a model has two colors and I only want to change the tint of one color while leaving the other color completely unaffected, do I have to use two materials - one for each color? I know that using another material adds another draw call, so I want to know if there is a better way before I implement this. Thanks.

more ▼

asked Apr 25 '10 at 02:12 PM

dhendrix gravatar image

dhendrix
2.2k 25 34 59

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

That is one way or if you have the know how, you could change the vertex colors.

Make a texture that is grayscale in the part of the mesh you want to change. Create a shader that reads vertex colors along with the normal diffuse calculations. Procedurally change the vertex colors of the vertices and you would change the color of that part of the object.

Since finding the vertices to change would probably be semi-challenging strictly through iterating, you might want to change the colors in you modeler before you change the mesh procedurally. Then all the vertices you want to change will already have a predetermined vertex color value and you can just iterate through the vertices to find them instead of doing it based on position or another more complicated method.

more ▼

answered Apr 25 '10 at 02:35 PM

Peter G gravatar image

Peter G
15k 16 44 136

Good info, thanks!

Apr 25 '10 at 02:46 PM dhendrix
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x812
x506

asked: Apr 25 '10 at 02:12 PM

Seen: 1369 times

Last Updated: Apr 25 '10 at 02:12 PM