Sign in to follow this  

Color change of texture without losing it properties

This topic is 3459 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
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

This topic is 3459 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.

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