CODECUBE VENTURES

Monkeys that Render

Rendermonkey (http://www.ati.com/developer/rendermonkey/) is pretty cool. I was able to take the pixel shader examples from the fairly awesome Facewound shader tutorial (http://www.facewound.com/tutorials/shader1/) and apply them to a DirectX Textured Effect in Rendermonkey.

You can just comment in/out the different pieces of code below to see the effects on the texture. Just make sure you add a variable of type float named "f1MyFloat", and link it semantically to Time0_X.

sampler2D baseMap; float f1MyFloat;

struct PS_INPUT { float2 Texcoord : TEXCOORD0;

};

float4 ps_main( PS_INPUT Input ) : COLOR0 { //pulsate Input.Texcoord.y = Input.Texcoord.y + (sin(f1MyFloat)*0.01); Input.Texcoord.x = Input.Texcoord.x - (cos(f1MyFloat)*0.01);

//wavy //Input.Texcoord.y = Input.Texcoord.y + (sin(Input.Texcoord.x * 200)*.01);

float4 color = tex2D( baseMap, Input.Texcoord );

//blur

color += tex2D( baseMap, Input.Texcoord+ .001 ); color += tex2D( baseMap, Input.Texcoord+ .002 ); color += tex2D( baseMap, Input.Texcoord+ .003 ); color = color /4;

//sharpen /* color -= tex2D( baseMap, Input.Texcoord+ .0001 ) * 10.0f; color += tex2D( baseMap, Input.Texcoord- .0001 ) * 10.0f; */

//emboss /color.a = 1; color.rgb = .5; color -= tex2D( baseMap, Input.Texcoord- .001 ) * 2.0f; color += tex2D( baseMap, Input.Texcoord+ .001 ) * 2.0f; color.rgb = (color.r + color.g + color.b) / 3.0f;/

//inverted /color = 1-tex2D( baseMap, Input.Texcoord); color.a = 1;/

//wacky //color -= tex2D( baseMap, Input.Texcoord+ sin(f1MyFloat) ) * 10.0f; //color += tex2D( baseMap, Input.Texcoord- cos(f1MyFloat)) * 9.0f;

return color;

}

Latest post: Digging Up the First Version of CodeCube

See more in the archives