The unofficial BSNES pixel shader thread

Anything else related to bsnes goes there.
Locked
mudlord
has wat u liek
Posts: 559
Joined: Tue Sep 11, 2007 2:54 pm
Location: Banland.

Post by mudlord »

Wow....never was expecting this when people code shaders. :shock:
And I mean that in a good way.
gllt
NO VOWELS >:[
Posts: 753
Joined: Sun Aug 31, 2008 12:59 pm
Location: ALABAMA
Contact:

Post by gllt »

Code: Select all

// MAGICAL FUNTIME
texture tex1;
texture tex2;
float2 rcpres;
float Timer;
sampler s0 = sampler_state { texture = <tex1>; };
sampler s1 = sampler_state { texture = <tex2>; };

float4 Pass0( in float2 Tex : TEXCOORD0 ) : COLOR0
{
   float4 Color = tex2D( s0, Tex.xy );
   float4 Colrx = tex2D( s1, Tex.xy );
   return Color;
   return Colrx;
}

float4 Pass1( in float2 Tex : TEXCOORD0 ) : COLOR0
{
   float4 Color = tex2D( s0, Tex.xy );
   float4 Colrx = tex2D( s1, Tex.xy );
   // FIRST ITERATION
   Color += tex2D( s0, Tex.xy+float2(0,0.0050) )/4;
   Color += tex2D( s0, Tex.xy-float2(0,0.0050) )/4;   
   Color += tex2D( s0, Tex.xy+float2(0.0050,0) )/4;   
   Color += tex2D( s0, Tex.xy-float2(0.0050,0) )/4;
   Color += tex2D( s0, Tex.xy+float2(0.0025,0.0025) )/6;
   Color += tex2D( s0, Tex.xy-float2(0.0025,0.0025) )/6;   
   Color += tex2D( s0, Tex.xy+float2(-0.0025,0.0025) )/6;   
   Color += tex2D( s0, Tex.xy-float2(-0.0025,0.0025) )/6;
   // SECOND ITERATION
   Color += tex2D( s0, Tex.xy+float2(0,0.0100) )/8;
   Color += tex2D( s0, Tex.xy-float2(0,0.0100) )/8;   
   Color += tex2D( s0, Tex.xy+float2(0.0100,0) )/8;   
   Color += tex2D( s0, Tex.xy-float2(0.0100,0) )/8;
   Color += tex2D( s0, Tex.xy+float2(0.0050,0.0050) )/12;
   Color += tex2D( s0, Tex.xy-float2(0.0050,0.0050) )/12;   
   Color += tex2D( s0, Tex.xy+float2(-0.0050,0.0050) )/12;   
   Color += tex2D( s0, Tex.xy-float2(-0.0050,0.0050) )/12;   
   // COLOR ROTARY (OPTIONAL SHENANIGANS)
   Colrx.rgb += sin(float3(Timer,Timer*2,Timer*4)*10)/4;
   // FINAL PRODUCT   
   return Color/2 + Colrx/4;
}

Technique T0
{
    pass p0 { PixelShader = compile ps_2_0 Pass0(); }
    pass p0 { PixelShader = compile ps_2_0 Pass1(); }
}


Am I banned yet?
gllt
NO VOWELS >:[
Posts: 753
Joined: Sun Aug 31, 2008 12:59 pm
Location: ALABAMA
Contact:

Post by gllt »

Code: Select all

// THIS FILTER IS POINTLESS AND ANNOYING.
texture tex1;
texture tex2;
float2 rcpres;
float Timer;
sampler s0 = sampler_state { texture = <tex1>; };
sampler s1 = sampler_state { texture = <tex2>; };

float4 Pass0( in float2 Tex : TEXCOORD0 ) : COLOR0
{
   float4 Color = tex2D( s0, Tex.xy );
   float4 Colrx = tex2D( s1, Tex.xy );
   return Color;
   return Colrx;
}

float4 Pass1( in float2 Tex : TEXCOORD0 ) : COLOR0
{
   float4 Color = tex2D( s0, Tex.xy );
   float4 Colrx = tex2D( s1, Tex.xy );   
   // UP, DOWN, LEFT, RIGHT
   Color += tex2D( s0, Tex.xy+sin(float2(Timer*20,0))/200 )/4;
   Color += tex2D( s0, Tex.xy-sin(float2(Timer*20,0))/200 )/4;   
   Color += tex2D( s0, Tex.xy+sin(float2(0,Timer*20))/200 )/4;
   Color += tex2D( s0, Tex.xy-sin(float2(0,Timer*20))/200 )/4;     
   // DIAGONALWAYS
   Color += tex2D( s0, Tex.xy+sin(float2(Timer*20,Timer*20))/200 )/4;
   Color += tex2D( s0, Tex.xy-sin(float2(Timer*20,Timer*20))/200 )/4;   
   Color += tex2D( s0, Tex.xy+sin(float2(-Timer*20,Timer*20))/200 )/4;
   Color += tex2D( s0, Tex.xy-sin(float2(-Timer*20,Timer*20))/200 )/4;   
   // IT'S LIKE THAT ELEVATOR FROM WILLY WONKA, EXCEPT NOT.
   if (Color.r < 0.3){
   Color.r = 0;
   }if (Color.r > 0.7){
   Color.r = 1;
   }
   if (Color.g < 0.3){
   Color.g = 0;
   }if (Color.g > 0.7){
   Color.g = 1;
   }
   if (Color.b < 0.3){
   Color.b = 0;
   }if (Color.b > 0.7){
   Color.b = 1;
   }   
   return lerp(Color/2,Colrx,Colrx);
}

Technique T0
{
    pass p0 { PixelShader = compile ps_2_0 Pass0(); }
    pass p0 { PixelShader = compile ps_2_0 Pass1(); }
}


Gonna make some vids sooner or later I guess OR NEVER.
grinvader
ZSNES Shake Shake Prinny
Posts: 5626
Joined: Wed Jul 28, 2004 4:15 pm
Location: PAL50, dood !

Post by grinvader »

gllt wrote:Am I banned yet?

Dude, you've produced more functional code than jargon ever has. That's not the way to get banned.
皆黙って俺について来い!!

Code: Select all

<jmr> bsnes has the most accurate wiki page but it takes forever to load (or something)

Pantheon: Gideon Zhi | CaitSith2 | Nach | kode54
gllt
NO VOWELS >:[
Posts: 753
Joined: Sun Aug 31, 2008 12:59 pm
Location: ALABAMA
Contact:

Post by gllt »

grinvader wrote:
gllt wrote:Am I banned yet?

Dude, you've produced more functional code than jargon ever has. That's not the way to get banned.


Who is she?

EDIT; SURPRISE, ...LETS BAG THESE UP!
http://www.savefile.com/files/1829086
gllt
NO VOWELS >:[
Posts: 753
Joined: Sun Aug 31, 2008 12:59 pm
Location: ALABAMA
Contact:

Post by gllt »

Image

Code: Select all

texture tex1;
texture tex2;
float2 rcpres;
float Timer;
sampler s0 = sampler_state { texture = <tex1>; };
sampler s1 = sampler_state { texture = <tex2>; };

float4 Pass0( in float2 Tex : TEXCOORD0 ) : COLOR0
{
   float4 Color = tex2D( s0, Tex.xy );
   float4 Colrx = tex2D( s1, Tex.xy );
   return Color;
   return Colrx;
}

float4 Pass1( in float2 Tex : TEXCOORD0 ) : COLOR0
{
   float4 Color = tex2D( s0, Tex.xy );
   float4 Colrx = tex2D( s1, Tex.xy );   
   Color += tex2D( s0, Tex.xy+sin(float2(Timer*20,0))/200 )/4;
   Color += tex2D( s0, Tex.xy-sin(float2(Timer*20,0))/200 )/4;   
   Color += tex2D( s0, Tex.xy+sin(float2(0,Timer*20))/200 )/4;
   Color += tex2D( s0, Tex.xy-sin(float2(0,Timer*20))/200 )/4;     
   Color += tex2D( s0, Tex.xy+sin(float2(Timer*20,Timer*20))/200 )/4;
   Color += tex2D( s0, Tex.xy-sin(float2(Timer*20,Timer*20))/200 )/4;   
   Color += tex2D( s0, Tex.xy+sin(float2(-Timer*20,Timer*20))/200 )/4;
   Color += tex2D( s0, Tex.xy-sin(float2(-Timer*20,Timer*20))/200 )/4;   
   if (Color.r < 0.3){
   Color.r = 0;
   }if (Color.r > 0.7){
   Color.r = 1;
   }
   if (Color.g < 0.3){
   Color.g = 0;
   }if (Color.g > 0.7){
   Color.g = 1;
   }
   if (Color.b < 0.3){
   Color.b = 0;
   }if (Color.b > 0.7){
   Color.b = 1;
   }   
   return lerp(Color/2%Colrx*2,Colrx/2+Color*2,Colrx)/2;
}

Technique T0
{
    pass p0 { PixelShader = compile ps_2_0 Pass0(); }
    pass p0 { PixelShader = compile ps_2_0 Pass1(); }
}


I LIKE THIS but it's just not special enough.
Someone give me inspiration! NOW.
gllt
NO VOWELS >:[
Posts: 753
Joined: Sun Aug 31, 2008 12:59 pm
Location: ALABAMA
Contact:

Post by gllt »

Last edited by gllt on Thu Oct 09, 2008 7:29 am, edited 1 time in total.
sweener2001
Inmate
Posts: 1751
Joined: Mon Dec 06, 2004 7:47 am
Location: WA

Post by sweener2001 »

i do like that one
Image
gllt
NO VOWELS >:[
Posts: 753
Joined: Sun Aug 31, 2008 12:59 pm
Location: ALABAMA
Contact:

Post by gllt »

Final version, just modified it and changed the defaults. Too lazy to savefile it.

Code: Select all

texture tex1;
texture tex2;
float2 rcpres;
float Timer;
sampler s0 = sampler_state { texture = <tex1>; };
sampler s1 = sampler_state { texture = <tex2>; };

float4 Pass0( in float2 Tex : TEXCOORD0 ) : COLOR0
{
   float4 Color = tex2D( s0, Tex.xy );
   float4 Colrx = tex2D( s1, Tex.xy );
   return Color;
   return Colrx;
}

float4 Pass1( in float2 Tex : TEXCOORD0 ) : COLOR0
{
   float4 Color = tex2D( s0, Tex.xy );
   float4 Colrx = tex2D( s1, Tex.xy );   
   
   //* FIRST PASS
   Color += tex2D( s0, Tex.xy+float2(0,0.0050) )/4;
   Color += tex2D( s0, Tex.xy-float2(0,0.0050) )/4;   
   Color += tex2D( s0, Tex.xy+float2(0.0050,0) )/4;   
   Color += tex2D( s0, Tex.xy-float2(0.0050,0) )/4;
   Color += tex2D( s0, Tex.xy+float2(0.0025,0.0025) )/6;
   Color += tex2D( s0, Tex.xy-float2(0.0025,0.0025) )/6;   
   Color += tex2D( s0, Tex.xy+float2(-0.0025,0.0025) )/6;   
   Color += tex2D( s0, Tex.xy-float2(-0.0025,0.0025) )/6;
   //*/ UNCOMMENT ME AND REMOVE THE FIRST SLASH ABOVE TO AVOID THIS PASS.
   
   //* SECOND PASS
   Color += tex2D( s0, Tex.xy+float2(0,0.0100) )/8;
   Color += tex2D( s0, Tex.xy-float2(0,0.0100) )/8;   
   Color += tex2D( s0, Tex.xy+float2(0.0100,0) )/8;   
   Color += tex2D( s0, Tex.xy-float2(0.0100,0) )/8;
   Color += tex2D( s0, Tex.xy+float2(0.0050,0.0050) )/12;
   Color += tex2D( s0, Tex.xy-float2(0.0050,0.0050) )/12;   
   Color += tex2D( s0, Tex.xy+float2(-0.0050,0.0050) )/12;   
   Color += tex2D( s0, Tex.xy-float2(-0.0050,0.0050) )/12; 
   //*/ UNCOMMENT ME AND REMOVE THE FIRST SLASH ABOVE TO AVOID THIS PASS.
   
   // TRY OTHER SETTINGS BELOW. SIMPLY COMMENT OUT THE ACTIVE AND UNCOMMENT THE ONE YOU LIKE.
   Color.rgb -= smoothstep(0.3,0.6,dot(Color.g/2+Color.r,Color.b/2+Color.r)%Color.r);
   //Color.rgb += smoothstep(0.3,0.6,dot(Color.g/2+Color.r,Color.b/2+Color.r)%Color.r);
   //Color.rgb /= smoothstep(0.3,0.6,dot(Color.g/2+Color.r,Color.b/2+Color.r)%Color.r);
   //Color.rgb *= smoothstep(0.3,0.6,dot(Color.g/2+Color.r,Color.b/2+Color.r)%Color.r);
   //Color.rgb %= smoothstep(0.3,0.6,dot(Color.g/2+Color.r,Color.b/2+Color.r)%Color.r);
   //Color.rgb = smoothstep(0.3,0.6,dot(Color.g/2+Color.r,Color.b/2+Color.r)%Color.r);
   
   // TRY OTHER SETTINGS BELOW. SIMPLY COMMENT OUT THE ACTIVE AND UNCOMMENT THE ONE YOU LIKE.
   //return Color/4 + Colrx;
   return lerp(Color/4 + Colrx,Color,Color)*Colrx;
}

Technique T0
{
    pass p0 { PixelShader = compile ps_2_0 Pass0(); }
    pass p0 { PixelShader = compile ps_2_0 Pass1(); }
}
gllt
NO VOWELS >:[
Posts: 753
Joined: Sun Aug 31, 2008 12:59 pm
Location: ALABAMA
Contact:

Post by gllt »

I post too much and feel guilty about it.

Anyway, BEHOLD. EIGHT WEIGHT BLUR. Unfortunately, that much math requires PS 3.0 so comment out all but three or so of the blur passes and then edit the division of Color to match. (Three passes is 8*3, or 24. So Color/24.)

EDIT; Updates. Changed weight numbers. Now can induce a bloom-like effect too I guess. I dunno, it might just really be bloom. :V

Code: Select all

// WHAT A WASTE OF TIME.
texture tex1;
float2 rcpres;
//float Timer;
float4 End;
sampler s0 = sampler_state { texture = <tex1>; };

#define NUM 8

float2 Weights[NUM] = {
 0.0020, 0,
 -0.0020, 0,
 0, 0.0020,
 0, -0.0020,
 0.0015, 0.0015,
 -0.0015, -0.0015,
 -0.0015, 0.0015,
 0.0015, -0.0015
};

float4 Pass0( in float2 Tex : TEXCOORD0 ) : COLOR0
{
   float4 Base = tex2D( s0, Tex.xy );
   return Base;
}

float4 Pass1( in float2 Tex : TEXCOORD0 ) : COLOR0
{
   float4 Base = tex2D( s0, Tex.xy );
   float4 Color = 0;   
   for (int i = 0; i < NUM; ++i ){
    Color += tex2D( s0, Tex.xy + (0.0001 * i)+ Weights[i] );
    Color += tex2D( s0, Tex.xy + (0.0001 * i)+ (Weights[i]*2) );
    Color += tex2D( s0, Tex.xy + (0.0001 * i)+ (Weights[i]*3) );
    Color += tex2D( s0, Tex.xy + (0.0001 * i)+ (Weights[i]*4) );
    Color += tex2D( s0, Tex.xy + (0.0001 * i)+ (Weights[i]*5) );
    Color += tex2D( s0, Tex.xy + (0.0001 * i)+ (Weights[i]*6) );
    Color += tex2D( s0, Tex.xy + (0.0001 * i)+ (Weights[i]*7) );
    Color += tex2D( s0, Tex.xy + (0.0001 * i)+ (Weights[i]*8) );
   }
   End = Color/64;
   return End;

   // Bloom-ish!
   // End = Color/16;
   // return Base * End;

   // Bloom-like!
   // End = Color/64;
   // return Base + End;

   // MY NAME IS LINKFAN001 AND I PLAY TP, LIKE, ALL THE TIME.
   // End = Color;
   // return (Base * End/16) + End/64;
}

///*
Technique T0
{
    pass p0 { PixelShader = compile ps_3_0 Pass0(); }
    pass p1 { PixelShader = compile ps_3_0 Pass1(); }
}
//*/

/* 2.0 Pass instead?
Technique T0
{
    pass p0 { PixelShader = compile ps_2_0 Pass0(); }
    pass p1 { PixelShader = compile ps_2_0 Pass1(); }
}
*/



EDIT; PIX. OOT with Hi-Res texture pack and LINKFAN001 bloom.

Image
byuu

Post by byuu »

Hope you don't mind me moving this over to the general discussion thread, as it's not really related to bsnes development.

I don't mind if you continue posting here, of course.
grinvader
ZSNES Shake Shake Prinny
Posts: 5626
Joined: Wed Jul 28, 2004 4:15 pm
Location: PAL50, dood !

Post by grinvader »

did i hear someone say zelda bloom ?
皆黙って俺について来い!!

Code: Select all

<jmr> bsnes has the most accurate wiki page but it takes forever to load (or something)

Pantheon: Gideon Zhi | CaitSith2 | Nach | kode54
gllt
NO VOWELS >:[
Posts: 753
Joined: Sun Aug 31, 2008 12:59 pm
Location: ALABAMA
Contact:

Post by gllt »

byuu wrote:Hope you don't mind me moving this over to the general discussion thread, as it's not really related to bsnes development.

I don't mind if you continue posting here, of course.


I KNOW IM SO SORRY I FELT THE SAME WAY <3

ty

Will work more today :V
gllt
NO VOWELS >:[
Posts: 753
Joined: Sun Aug 31, 2008 12:59 pm
Location: ALABAMA
Contact:

Post by gllt »

Code: Select all

// WHAT A WASTE OF TIME.
texture tex1;
float2 rcpres;
//float Timer;
float4 End;
sampler s0 = sampler_state { texture = <tex1>; };

#define NUM 8
#define MUL 8

float2 Weights[NUM] = {
 0.0020, 0,
 -0.0020, 0,
 0, 0.0020,
 0, -0.0020,
 0.0015, 0.0015,
 -0.0015, -0.0015,
 -0.0015, 0.0015,
 0.0015, -0.0015
};

float4 Pass0( in float2 Tex : TEXCOORD0 ) : COLOR0
{
   float4 Base = tex2D( s0, Tex.xy );
   return Base;
}

float4 Pass1( in float2 Tex : TEXCOORD0 ) : COLOR0
{
   float4 Base = tex2D( s0, Tex.xy );
   float4 Color = 0;   
   for (int i = 0; i < NUM; ++i){
    Color += tex2D( s0, Tex.xy + (0.0001 * i)+ (Weights[i]*1) );   
   Color += tex2D( s0, Tex.xy + (0.0001 * i)+ (Weights[i]*2) );
    Color += tex2D( s0, Tex.xy + (0.0001 * i)+ (Weights[i]*3) );
    Color += tex2D( s0, Tex.xy + (0.0001 * i)+ (Weights[i]*4) );
    Color += tex2D( s0, Tex.xy + (0.0001 * i)+ (Weights[i]*5) );
    Color += tex2D( s0, Tex.xy + (0.0001 * i)+ (Weights[i]*6) );
    Color += tex2D( s0, Tex.xy + (0.0001 * i)+ (Weights[i]*7) );
    Color += tex2D( s0, Tex.xy + (0.0001 * i)+ (Weights[i]*8) );
   }
   End = Color;
   Base.rgb = (Base.r + Base.g + Base.b)/3.0f;
   return End/32 - Base;
}

///*
Technique T0
{
    pass p0 { PixelShader = compile ps_3_0 Pass0(); }
    pass p1 { PixelShader = compile ps_3_0 Pass1(); }
}
//*/

/* 2.0 Pass instead?
Technique T0
{
    pass p0 { PixelShader = compile ps_2_0 Pass0(); }
    pass p1 { PixelShader = compile ps_2_0 Pass1(); }
}
*/


NESS IS RUNNING AERO THEME, BUT HOW COULD EARTHBOUND BE ANY SLOWER.



http://i37.tinypic.com/kd8mmh.png

EDIT;
Alternative weights;

Code: Select all

float2 Weights[NUM] = {
 0.00200, 0,
 -0.00200, 0,
 0, 0.00200,
 0, -0.00200,
 0.00175, 0.00175,
 -0.00175, -0.00175,
 -0.00175, 0.00175,
 0.00175, -0.00175
};
gllt
NO VOWELS >:[
Posts: 753
Joined: Sun Aug 31, 2008 12:59 pm
Location: ALABAMA
Contact:

Post by gllt »

Code: Select all

// WHAT A WASTE OF GPU.
texture tex1;
float2 rcpres;
//float Timer;
float4 End;
sampler s0 = sampler_state { texture = <tex1>; };

#define NUM 16

float2 Weights[NUM] = {
  0.00200, 0,
  -0.00200, 0,
  0, 0.00200,
  0, -0.00200,
  0.001625, 0.001625,
  -0.001625, -0.001625,
  -0.001625, 0.001625,
  0.001625, -0.001625,
  0.00200, 0.001625,
  0.001625, 0.00200,
  -0.00200,-0.001625,
  -0.001625,-0.00200,
  0.00200,-0.001625,
  -0.00200,0.001625,
  0.001625,-0.00200,
  -0.001625,0.00200
};

float4 Pass0( in float2 Tex : TEXCOORD0 ) : COLOR0
{
   float4 Base = tex2D( s0, Tex.xy );
   return Base;
}

float4 Pass1( in float2 Tex : TEXCOORD0 ) : COLOR0
{
   float4 Base = tex2D( s0, Tex.xy );
   float4 Color = 0;   
   for (int i = 0; i < NUM; ++i){
    Color += tex2D( s0, Tex.xy + (0.0001 * i) + (Weights[i]*1*2) );   
    Color += tex2D( s0, Tex.xy + (0.0001 * i) + (Weights[i]*2*2) );
    Color += tex2D( s0, Tex.xy + (0.0001 * i) + (Weights[i]*3*2) );
    Color += tex2D( s0, Tex.xy + (0.0001 * i) + (Weights[i]*4*2) );
    //Color += tex2D( s0, Tex.xy + (0.0001 * i) + (Weights[i]*5*2) );
    //Color += tex2D( s0, Tex.xy + (0.0001 * i) + (Weights[i]*6*2) );
    //Color += tex2D( s0, Tex.xy + (0.0001 * i) + (Weights[i]*7*2) );
    //Color += tex2D( s0, Tex.xy + (0.0001 * i) + (Weights[i]*8*2) );
   }
   End = Color;
   return ((Base * End/32) + End/64);
   //return ((Base * End/64) + End/128);
}

///*
Technique T0
{
    pass p0 { PixelShader = compile ps_3_0 Pass0(); }
    pass p1 { PixelShader = compile ps_3_0 Pass1(); }
}
//*/

/* 2.0 Pass instead?
Technique T0
{
    pass p0 { PixelShader = compile ps_2_0 Pass0(); }
    pass p1 { PixelShader = compile ps_2_0 Pass1(); }
}
*/
gllt
NO VOWELS >:[
Posts: 753
Joined: Sun Aug 31, 2008 12:59 pm
Location: ALABAMA
Contact:

Post by gllt »

http://www.si-gamer.net/gulikoza/src/scale2x.fx
Gonna try and convert this if it's possible.

Code: Select all

//uncomment lines for different version

texture tex1;
float2 rcpres;
sampler s0 = sampler_state { texture = <tex1>; };

#define MID1 0.40
#define MID2 0.60
#define LOW 0
#define HIGH 1

float4 Pass0( in float2 Tex : TEXCOORD0 ) : COLOR0
{
   float4 Base = tex2D( s0, Tex.xy );
   return Base;
}

float4 Pass1( in float2 Tex : TEXCOORD0 ) : COLOR0
{
   float4 Base = tex2D( s0, Tex.xy );
   float4 Lay0 = tex2D( s0, Tex.xy );
   
   //Lay0.rgb = (Lay0.r + Lay0.g + Lay0.b)/3.0f;   

   if (Lay0.r < 0.25){
   Lay0.r = LOW;
   }if (Lay0.r > 0.25 && Lay0.r < 0.50){
   Lay0.r = MID1;
   }if (Lay0.r > 0.50 && Lay0.r < 0.75){
   Lay0.r = MID2;
   }if (Lay0.r > 0.75){
   Lay0.r = HIGH;
   };
   
   if (Lay0.g < 0.25){
   Lay0.g = LOW;
   }if (Lay0.g > 0.25 && Lay0.g < 0.50){
   Lay0.g = MID1;
   }if (Lay0.g > 0.50 && Lay0.g < 0.75){
   Lay0.g = MID2;
   }if (Lay0.g > 0.75){
   Lay0.g = HIGH;
   };
   
   if (Lay0.b < 0.25){
   Lay0.b = LOW;
   }if (Lay0.b > 0.25 && Lay0.b < 0.50){
   Lay0.b = MID1;
   }if (Lay0.b > 0.50 && Lay0.b < 0.75){
   Lay0.b = MID2;
   }if (Lay0.b > 0.75){
   Lay0.b = HIGH;
   };
   
   //Base.rgb -= (Base.r + Base.g + Base.b)/3.0f;
     
   return (Lay0);
   //return (Base/3 + Lay0);
}

Technique T0
{
    pass p0 { PixelShader = compile ps_2_0 Pass0(); }
    pass p1 { PixelShader = compile ps_2_0 Pass1(); }
}


Also this...!
gllt
NO VOWELS >:[
Posts: 753
Joined: Sun Aug 31, 2008 12:59 pm
Location: ALABAMA
Contact:

Post by gllt »

Code: Select all

texture tex1;
float2 rcpres;
sampler s0 = sampler_state { texture = <tex1>; };

#define MID1 0.50
#define MID2 0.60
#define LOW 0
#define HIGH 1

float4 Pass0( in float2 Tex : TEXCOORD0 ) : COLOR0
{
   float4 Base = tex2D( s0, Tex.xy );
   return Base;
}

float4 Pass1( in float2 Tex : TEXCOORD0 ) : COLOR0
{
   float4 Base = tex2D( s0, Tex.xy );
   float4 Lay0 = tex2D( s0, Tex.xy );
   
   //  Lay0.rgb = (Lay0.r + Lay0.g + Lay0.b)/3.0f;   
   
   if (Lay0.r < 0.25){
   Lay0.r = LOW;
   }if (Lay0.r > 0.25 && Lay0.r < 0.50){
   Lay0.r = MID1;
   }if (Lay0.r > 0.50 && Lay0.r < 0.75){
   Lay0.r = MID2;
   }if (Lay0.r > 0.75){
   Lay0.r = HIGH;
   };
   
   if (Lay0.g < 0.25){
   Lay0.g = LOW;
   }if (Lay0.g > 0.25 && Lay0.g < 0.50){
   Lay0.g = lerp(MID1,HIGH,MID1);
   }if (Lay0.g > 0.50 && Lay0.g < 0.75){
   Lay0.g = lerp(MID2,LOW,MID2);
   }if (Lay0.g > 0.75){
   Lay0.g = HIGH;
   };
   
   if (Lay0.b < 0.25){
   Lay0.b = LOW;
   }if (Lay0.b > 0.25 && Lay0.b < 0.50){
   Lay0.b = MID1;
   }if (Lay0.b > 0.50 && Lay0.b < 0.75){
   Lay0.b = MID2;
   }if (Lay0.b > 0.75){
   Lay0.b = HIGH;
   };
   
   // Base.rgb -= (Base.r + Base.g + Base.b)/3.0f;
   Lay0.rgb = (Lay0.r + Lay0.g + Lay0.b)/3.0f;   
   
   return (Lay0);
}

Technique T0
{
    pass p0 { PixelShader = compile ps_2_0 Pass0(); }
    pass p1 { PixelShader = compile ps_2_0 Pass1(); }
}



Image

Code: Select all

texture tex1;
float2 rcpres;
sampler s0 = sampler_state { texture = <tex1>; };

#define MID1 0.50
#define MID2 0.60
#define LOW 0
#define HIGH 1

float4 Pass0( in float2 Tex : TEXCOORD0 ) : COLOR0
{
   float4 Base = tex2D( s0, Tex.xy );
   return Base;
}

float4 Pass1( in float2 Tex : TEXCOORD0 ) : COLOR0
{
   float4 Base = tex2D( s0, Tex.xy );
   float4 Lay0 = tex2D( s0, Tex.xy );
   
   //  Lay0.rgb = (Lay0.r + Lay0.g + Lay0.b)/3.0f;   
   
   if (Lay0.r < 0.25){
   Lay0.r = LOW;
   }if (Lay0.r > 0.25 && Lay0.r < 0.50){
   Lay0.r = lerp(MID1,HIGH,MID1);
   }if (Lay0.r > 0.50 && Lay0.r < 0.75){
   Lay0.r = lerp(MID2,LOW,MID2);
   }if (Lay0.r > 0.75){
   Lay0.r = HIGH;
   };
   
   if (Lay0.g < 0.25){
   Lay0.g = LOW;
   }if (Lay0.g > 0.25 && Lay0.g < 0.50){
   Lay0.g = lerp(MID1,HIGH,MID1);
   }if (Lay0.g > 0.50 && Lay0.g < 0.75){
   Lay0.g = lerp(MID2,LOW,MID2);
   }if (Lay0.g > 0.75){
   Lay0.g = HIGH;
   };
   
   if (Lay0.b < 0.25){
   Lay0.b = LOW;
   }if (Lay0.b > 0.25 && Lay0.b < 0.50){
   Lay0.b = lerp(MID1,HIGH,MID1);
   }if (Lay0.b > 0.50 && Lay0.b < 0.75){
   Lay0.b = lerp(MID2,LOW,MID2);
   }if (Lay0.b > 0.75){
   Lay0.b = HIGH;
   };
   
   Base.rgb -= (Base.r + Base.g + Base.b)/3.0f;
   Lay0.rgb = (Lay0.r + Lay0.g + Lay0.b)/3.0f;   
   
   return (Lay0 + Base/3);
}

Technique T0
{
    pass p0 { PixelShader = compile ps_2_0 Pass0(); }
    pass p1 { PixelShader = compile ps_2_0 Pass1(); }
}


Image
gllt
NO VOWELS >:[
Posts: 753
Joined: Sun Aug 31, 2008 12:59 pm
Location: ALABAMA
Contact:

Post by gllt »

Code: Select all

texture tex1;
float2 rcpres;
sampler s0 = sampler_state { texture = <tex1>; };

#define MID1 0.40
#define MID2 0.60
#define MID3 0.80
#define LOW 0
#define HIGH 1

float4 Pass0( in float2 Tex : TEXCOORD0 ) : COLOR0
{
   float4 Base = tex2D( s0, Tex.xy );
   return Base;
}

float4 Pass1( in float2 Tex : TEXCOORD0 ) : COLOR0
{
   float4 Base = tex2D( s0, Tex.xy );
   float4 Lay0 = tex2D( s0, Tex.xy );
   
   //  Lay0.rgb = (Lay0.r + Lay0.g + Lay0.b)/3.0f;   
   
   if (Lay0.r < 0.20){
   Lay0.r = LOW;
   }if (Lay0.r > 0.20 && Lay0.r < 0.40){
   Lay0.r = MID1;
   }if (Lay0.r > 0.40 && Lay0.r < 0.60){
   Lay0.r = MID2;
   }if (Lay0.r > 0.60 && Lay0.r < 0.80){
   Lay0.r = MID3;
   }if (Lay0.r > 0.80){
   Lay0.r = HIGH;
   };
   
   if (Lay0.g < 0.20){
   Lay0.g = LOW;
   }if (Lay0.g > 0.20 && Lay0.g < 0.40){
   Lay0.g = MID1;
   }if (Lay0.g > 0.40 && Lay0.g < 0.60){
   Lay0.g = MID2;
   }if (Lay0.g > 0.60 && Lay0.g < 0.80){
   Lay0.g = MID3;
   }if (Lay0.g > 0.80){
   Lay0.g = HIGH;
   };
   
   if (Lay0.b < 0.20){
   Lay0.b = LOW;
   }if (Lay0.b > 0.20 && Lay0.b < 0.40){
   Lay0.b = MID1;
   }if (Lay0.b > 0.40 && Lay0.b < 0.60){
   Lay0.b = MID2;
   }if (Lay0.b > 0.60 && Lay0.b < 0.80){
   Lay0.b = MID3;
   }if (Lay0.b > 0.80){
   Lay0.b = HIGH;
   };
   
   Base.rgb += tex2D( s0, Tex.xy + float2(0.0020,0) );
   Base.rgb += tex2D( s0, Tex.xy - float2(0.0020,0) );
   Base.rgb += tex2D( s0, Tex.xy + float2(0,0.0020) );
   Base.rgb += tex2D( s0, Tex.xy - float2(0,0.0020) );
   
   Base.rgb += tex2D( s0, Tex.xy + float2(0.0020,0.0020) );
   Base.rgb += tex2D( s0, Tex.xy - float2(0.0020,0.0020) );
   Base.rgb += tex2D( s0, Tex.xy + float2(-0.0020,0.0020) );
   Base.rgb += tex2D( s0, Tex.xy - float2(-0.0020,0.0020) );
   
   Base = lerp(Base/2,Base*2,Base/8);
   
   Base.rgb -= (Base.r + Base.g + Base.b)/3.0f;
   Lay0.rgb = (Lay0.r + Lay0.g + Lay0.b)/3.0f;   
   
   return (Lay0 + Base/3);
}

Technique T0
{
    pass p0 { PixelShader = compile ps_3_0 Pass0(); }
    pass p1 { PixelShader = compile ps_3_0 Pass1(); }
}


B E A U T I F U L

post ss later.
gllt
NO VOWELS >:[
Posts: 753
Joined: Sun Aug 31, 2008 12:59 pm
Location: ALABAMA
Contact:

Post by gllt »

Code: Select all

texture tex1;
float2 rcpres;
sampler s0 = sampler_state { texture = <tex1>; };

#define DIV0 3
#define DIV1 2

float4 Pass0( in float2 Tex : TEXCOORD0 ) : COLOR0
{
   float4 Base = tex2D( s0, Tex.xy );
   return Base;
}

float4 Pass1( in float2 Tex : TEXCOORD0 ) : COLOR0
{
   float4 Base = tex2D( s0, Tex.xy );
   float4 Lay0 = tex2D( s0, Tex.xy );
   Lay0.rgb = round(Lay0.r + Lay0.g + Lay0.b)/DIV0;
   Base.r *= Lay0.r/DIV1;
   Base.g *= Lay0.g/DIV1;
   Base.b *= Lay0.b/DIV1;
   return Base + Lay0;
}

Technique T0
{
    pass p0 { PixelShader = compile ps_2_0 Pass0(); }
    pass p1 { PixelShader = compile ps_2_0 Pass1(); }
}


Image

Image
gllt
NO VOWELS >:[
Posts: 753
Joined: Sun Aug 31, 2008 12:59 pm
Location: ALABAMA
Contact:

Post by gllt »

Code: Select all

texture tex1;
float2 rcpres;
sampler s0 = sampler_state { texture = <tex1>; };

#define DIV0 3
#define DIV1 2
#define DIV2 6
#define MUL1 3

float4 Pass0( in float2 Tex : TEXCOORD0 ) : COLOR0
{
   float4 Base = tex2D( s0, Tex.xy );
   return Base;
}

float4 Pass1( in float2 Tex : TEXCOORD0 ) : COLOR0
{
   float4 Base = tex2D( s0, Tex.xy );
   float4 Lay0 = tex2D( s0, Tex.xy );
   Lay0.rgb = round(Lay0.r + Lay0.g + Lay0.b)/DIV0;
   Base.r *= Lay0.r/DIV1;
   Base.g *= Lay0.g/DIV1;
   Base.b *= Lay0.b/DIV1;
   float4 Highlight = (Base.r + Base.g + Base.b)/1.5f + 0;
   float4 Color = Base.rgba - (Base.r + Base.g + Base.b)/3.0f + 0;
   return ((Color * Lay0) + Highlight * Color + Lay0/DIV2)*MUL1;
}

Technique T0
{
    pass p0 { PixelShader = compile ps_2_0 Pass0(); }
    pass p1 { PixelShader = compile ps_2_0 Pass1(); }
}


too lazy to post sss fffdsdfsf

#define MUL1 6
return ((Color * Lay0) + Highlight * Color + Lay0/DIV2)*MUL1 + Color;

punchier ^
gllt
NO VOWELS >:[
Posts: 753
Joined: Sun Aug 31, 2008 12:59 pm
Location: ALABAMA
Contact:

Post by gllt »

Code: Select all

texture tex1;
float2 rcpres;
sampler s0 = sampler_state { texture = <tex1>; };

float4 Pass0( in float2 Tex : TEXCOORD0 ) : COLOR0
{
   float4 Base = tex2D( s0, Tex.xy );
   return Base;
}

float4 Pass1( in float2 Tex : TEXCOORD0 ) : COLOR0
{
   float4 Base = tex2D( s0, Tex.xy );
   float4 Lay0 = tex2D( s0, Tex.xy );
   Lay0.rgb = round(Lay0.r + Lay0.g + Lay0.b)/3 - (Lay0.r + Lay0.g + Lay0.b)/3;
   float4 Lax0 = Lay0.rgba - (Lay0.r + Lay0.g + Lay0.b)/3.0f + 0;
   return (Base + Lay0) - (Base * Lay0) + Lax0;
   //return (Base + Lay0);
}

Technique T0
{
    pass p0 { PixelShader = compile ps_2_0 Pass0(); }
    pass p1 { PixelShader = compile ps_2_0 Pass1(); }
}


produces http://img241.imageshack.us/img241/5362/effectootzh3.png

that's old so I'm gonna work on some today

k
gllt
NO VOWELS >:[
Posts: 753
Joined: Sun Aug 31, 2008 12:59 pm
Location: ALABAMA
Contact:

Post by gllt »

Code: Select all

texture tex1;
float2 rcpres;
sampler s0 = sampler_state { texture = <tex1>; };

float4 Pass0( in float2 Tex : TEXCOORD0 ) : COLOR0
{
   float4 Base = tex2D( s0, Tex.xy );
   return Base;
}

float4 Pass1( in float2 Tex : TEXCOORD0 ) : COLOR0
{
   float4 Base = tex2D( s0, Tex.xy );
   float4 Color = tex2D( s0, Tex.xy );
   if (Color.r > Color.g || Color.b > Color.r || Color.g > Color.b){
   Color.rb -= Color.gb;
   Color.gr *= Color.br;
   Color.rg += Color.gr;
   }else{
   Color.rgb -= (Color.r + Color.g + Color.b)/3;
   };
   return ((Base*16 * Color) + Base/8)*3;
}

Technique T0
{
    pass p0 { PixelShader = compile ps_2_0 Pass0(); }
    pass p1 { PixelShader = compile ps_2_0 Pass1(); }
}


Um.

It makes.. things..

gold.

Image
gllt
NO VOWELS >:[
Posts: 753
Joined: Sun Aug 31, 2008 12:59 pm
Location: ALABAMA
Contact:

Post by gllt »

Code: Select all

texture tex1;
float2 rcpres;
sampler s0 = sampler_state { texture = <tex1>; };
float4 Lay0;
float4 Lay1;
float4 End;

float4 Pass0( in float2 Tex : TEXCOORD0 ) : COLOR0
{
   float4 Base = tex2D( s0, Tex.xy );
   return Base;
}

float4 Pass1( in float2 Tex : TEXCOORD0 ) : COLOR0
{
   float4 Base = tex2D( s0, Tex.xy );
   float4 Color = tex2D( s0, Tex.xy );
   if (Color.r < 0.50 || Color.b < 0.25){
   Color.g -= 0.75;
   }else{
   Color.rb += Color.g;
   };
   
   End = Color;
   return End;
}

Technique T0
{
    pass p0 { PixelShader = compile ps_2_0 Pass0(); }
    pass p1 { PixelShader = compile ps_2_0 Pass1(); }
}


NEVER FEAR, PINK IS HERE.

edit

Code: Select all

texture tex1;
float2 rcpres;
sampler s0 = sampler_state { texture = <tex1>; };
float4 Lay0;
float4 Lay1;
float4 End;

float4 Pass0( in float2 Tex : TEXCOORD0 ) : COLOR0
{
   float4 Base = tex2D( s0, Tex.xy );
   return Base;
}

float4 Pass1( in float2 Tex : TEXCOORD0 ) : COLOR0
{
   float4 Base = tex2D( s0, Tex.xy );
   float4 Color = tex2D( s0, Tex.xy );
   if (Color.r < 0.3){
   Color.r = 0.3;
   }if (Color.r < 0.6 && Color.r > 0.3){
   Color.r = 0.6;
   }if (Color.r < 1.0 && Color.r > 0.6){
   Color.r = 1.0;
   }if (Color.g < 0.3){
   Color.g = 0.3;
   }if (Color.g < 0.6 && Color.g > 0.3){
   Color.g = 0.6;
   }if (Color.g < 1.0 && Color.g > 0.6){
   Color.g = 1.0;
   }if (Color.b < 0.3){
   Color.b = 0.3;
   }if (Color.b < 0.6 && Color.b > 0.3){
   Color.b = 0.6;
   }if (Color.b < 1.0 && Color.b > 0.6){
   Color.b = 1.0;
   }; 
   Color.rgb = smoothstep(0.3,1,Color.rgb);
   End = Color;
   return End + Base/3;
}

Technique T0
{
    pass p0 { PixelShader = compile ps_2_0 Pass0(); }
    pass p1 { PixelShader = compile ps_2_0 Pass1(); }
}


same stuff different code, but I like this version the best. (this isn't pink its the color limitations)

// Color.rgb = smoothstep(0.3,1,Color.rgb) * Base; // ALTERNATE LINE
gllt
NO VOWELS >:[
Posts: 753
Joined: Sun Aug 31, 2008 12:59 pm
Location: ALABAMA
Contact:

Post by gllt »

Purple and Green

Image

Code: Select all

texture tex1;
float2 rcpres;
sampler s0 = sampler_state { texture = <tex1>; };
float4 Lay0;
float4 Lay1;
float4 End;

float4 Pass0( in float2 Tex : TEXCOORD0 ) : COLOR0
{
   float4 Base = tex2D( s0, Tex.xy );
   return Base;
}

float4 Pass1( in float2 Tex : TEXCOORD0 ) : COLOR0
{
   float4 Base = tex2D( s0, Tex.xy );
   float4 Color = tex2D( s0, Tex.xy );
   Color.r = lerp(Color.g,Color.b,Color.gb); 
   Color.g = lerp(Color.b,Color.r,Color.br);
   Color.b = lerp(Color.r,Color.g,Color.rg);   
   return Color;
}

Technique T0
{
    pass p0 { PixelShader = compile ps_2_0 Pass0(); }
    pass p1 { PixelShader = compile ps_2_0 Pass1(); }
}


edit;

return Color + Base; makes a beautiful tint :OOO it's almost rustic or something
gllt
NO VOWELS >:[
Posts: 753
Joined: Sun Aug 31, 2008 12:59 pm
Location: ALABAMA
Contact:

Post by gllt »

Code: Select all

texture tex1;
float2 rcpres;
sampler s0 = sampler_state { texture = <tex1>; };

float4 Pass0( in float2 Tex : TEXCOORD0 ) : COLOR0
{
   float4 Base = tex2D( s0, Tex.xy );
   return Base;
}

float4 Pass1( in float2 Tex : TEXCOORD0 ) : COLOR0
{
   float4 Base = tex2D( s0, Tex.xy );
   float4 Color = tex2D( s0, Tex.xy );
   return (round(Base*8*Color) - round(Base)) * Base;
}

Technique T0
{
    pass p0 { PixelShader = compile ps_2_0 Pass0(); }
    pass p1 { PixelShader = compile ps_2_0 Pass1(); }
}


http://img135.imageshack.us/img135/8876/shadootex1tb2.png
http://img135.imageshack.us/img135/9421/shadootex2qm8.png
http://xs432.xs.to/xs432/08430/shadootex3632.png

ACCOMPLISHED GOAL
Locked