Jump to content

Texture paint Shader


Recommended Posts

Hi i want to paint a texture on an other texture.So the texture apears on the other texture in the circel.When i change the position of the circel the texture goes away from the old position.I want that the painting texture keeps on its position and overlay the new position too(like painting).I dont know how to solve this problem(i started with shaders few days ago so i am not a pro) :( Any Tutorials or ideas?

sampler firstSampler; 
texture texture1; // drawmaterial 
float x; 
float y; 
float radius; 
  
sampler Sampler2 = sampler_state  
{  
texture   = <texture1>; 
}; 
  
float4 PSFade(float2 Tex : TEXCOORD0) : COLOR 
{ 
    if ( ((Tex.x-x)*(Tex.x-x)+(Tex.y-y)*(Tex.y-y)) < radius )  // Only in circel 
    { 
  
    float4 color = tex2D(Sampler2, Tex); 
    color.rgb = color.rgb*0.5; 
    return color; 
  
       } 
    else 
    { 
      float4 color = tex2D(firstSampler, Tex); 
       color.rgb = color.rgb*0.5; 
       return color; 
        
       } 
        
} 
  
technique main 
{ 
    pass p1   
    { 
     
        PixelShader = compile ps_2_0 PSFade(); 
    } 
} 

Link to comment

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...