Jump to content
  • Advertisement
Sign in to follow this  
serious_learner07

Color change of texture without losing it properties

This topic is 3770 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a texture of a car having a given color,light and material properties. Now my task is to change the color of the car without losing the lighting and shiny(material) properties. I have to implement this program in Pixel shader. I have started My Pixel shader like this

sampler2D tex1;  
float new_color[4]; 

float4 main( float2 coord: TEXCOORD0) : COLOR
{
 float4 color = tex2D(tex1,coord);
 float4 new_color = float4(new_color[0],new_color[1],new_color[3],new_color[4]);
 return new_color;
}
How should I move further. Should need extract lighting,material properties and change color accordingly.

Share this post


Link to post
Share on other sites
Advertisement
So you want to use fixed function per-vertex lighting with a custom pixel shader? I believe you can do this by using COLOR0 as an input to the pixel shader, since that should be the calculated lighting for the vertex. Then just modulate by your pixel shader results.

Share this post


Link to post
Share on other sites
You can implement a simple hue-shift easily enough, I should think. Don't have the math for it on-hand, but it involves converting from RGB to HSB, altering the hue, and then converting back to RGB.

Share this post


Link to post
Share on other sites
Quote:
Original post by agi_shi
So you want to use fixed function per-vertex lighting with a custom pixel shader? I believe you can do this by using COLOR0 as an input to the pixel shader, since that should be the calculated lighting for the vertex. Then just modulate by your pixel shader results.



It is just a texture on quad, no 3d model of car or so. Hence No per-vertex lighting.Lighting already there in the image.

How should I change the hue value? Should I scale it.



Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!