PDA

View Full Version : epsxe shaders


Loggo
19th July 2012, 03:07 PM
Hi there guys.

I was playing around with ePSXe's custom shaders the other day (storybook shaders, cartoon shaders etc.) and I was really impressed by the results:

http://i.imgur.com/gm79Y.jpg

http://i.imgur.com/UIGfa.jpg

http://i.imgur.com/eDtqm.jpg

So, I was just wondering if a Project 64 port of these shaders would be possible.

I'd love to replay something like Ocarina of Time or Majora's Mask using epsxe's storybook shaders.:)

squall_leonhart
19th July 2012, 03:09 PM
no, because jabo's plugin uses d3d8.

TheRealM
24th July 2012, 01:07 AM
u will need someone to write a new plugin.

chumbalumba
29th November 2012, 05:38 PM
Sorry for my bad english.

How to Add shaders in N64 games:

See this video:

www(.)youtube.com/watch?v=sCu3VkYkFBk

www(.)41post.com/1063/retro-games/how-to-add-shaders-to-ocarina-of-time

It's my Ocarina of time (I customize "emboss" shader to make this "Relief" effect, the original shader is from "Mudlord's Code".):

//These variables will get set automatically
texture tex1;

float2 rcpres;

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



float4 NormalColourPass( in float2 Tex : TEXCOORD0 ) : COLOR0
{
float4 color = tex2D( s0, Tex );
color.a = 1;
return color;
}

float4 EmbossPass( in float2 Tex : TEXCOORD0 ) : COLOR0
{
float4 Color = tex2D( s0, Tex );
Color.a = 0.3f;
Color.rgb = 0.0f;
Color -= tex2D( s0, Tex.xy-0.00001)*10.0f;
Color += tex2D( s0, Tex.xy+0.00001)*10.0f;
Color.rgb = (Color.r+Color.g+Color.b)/0.1f;
return Color;
}




Technique T0
{

pass p0 { PixelShader = compile ps_3_0 NormalColourPass(); }
pass p1 { PixelShader = compile ps_3_0 EmbossPass(); }
}

http://img442.imageshack.us/img442/6896/shaderp.png

HatCat
29th November 2012, 08:52 PM
LLE is better. :rolleyes:

Color.rgb = (Color.r+Color.g+Color.b)/0.1f;

lolwut, why would you want to divide by 0.1, when you just finished multiplying by 10 in the lines above that?

0.1 = (10 ^ -1) # not XOR, dammit! to the power of...
10 is the multiplicative inverse of 0.1.

So:
rgb == (r + g + b) / 0.1
0.1*(rgb) == r + g + b
10[0.1(rgb)] == 10(r + g + b)
rgb == 10(r + g + b)

More readable.

Natch
29th November 2012, 10:03 PM
http://img442.imageshack.us/img442/6896/shaderp.png


haha

HatCat
29th November 2012, 10:30 PM
Why is it only Spanish people, who keep obsessing over HLE graphics, hi-res texture packs and the 30-day free trial shareware edition of Project64 1.7.0.55?

chumbalumba
1st December 2012, 03:13 PM
New shaders: //These variables will get set automatically
texture tex1;

float2 rcpres;
float4 ToonConfig;
float threshold = 0.001;

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



float4 NormalColourPass( in float2 Tex : TEXCOORD0 ) : COLOR0
{
float4 color = tex2D( s0, Tex );
color.a = 1;
return color;
}

float4 ToonPass( in float2 Tex : TEXCOORD0 ) : COLOR0
{
ToonConfig.xyz = 4; //RGB colours

float4 Color = tex2D( s0, Tex.xy );
Color.r = round(Color.r*ToonConfig.r)/ToonConfig.r;
Color.g = round(Color.g*ToonConfig.g)/ToonConfig.g;
Color.b = round(Color.b*ToonConfig.b)/ToonConfig.b;
const int NUM = 9;
const float2 c[NUM] =
{
float2(-0.0078125, 0.0078125),
float2( 0.00 , 0.0078125),
float2( 0.0078125, 0.0078125),
float2(-0.0078125, 0.00 ),
float2( 0.0, 0.0),
float2( 0.0078125, 0.007 ),
float2(-0.0078125,-0.0078125),
float2( 0.00 , -0.0078125),
float2( 0.0078125,-0.0078125),
};

int i;
float3 col[NUM];
for (i=0; i < NUM; i++)
{
col[i] = tex2D(s0, Tex.xy + 0.2*c[i]);
}

float3 rgb2lum = float3(0.01, 0.01, 0.01);
float lum[NUM];
for (i = 0; i < NUM; i++)
{
lum[i] = dot(col[i].xyz, rgb2lum);
}
float x = lum[2]+ lum[8]+2*lum[5]-lum[0]-2*lum[3]-lum[6];
float y = lum[6]+2*lum[7]+ lum[8]-lum[0]-2*lum[1]-lum[2];
float edge =(x*x + y*y < threshold)? 1.0:0.0;
Color.rgb *= edge;
return Color;
}




Technique T0
{

pass p0 { PixelShader = compile ps_3_0 NormalColourPass(); }
pass p1 { PixelShader = compile ps_3_0 ToonPass(); }
}

http://img717.imageshack.us/img717/9728/toonshader.png


Bloom & HDR shader:
//These variables will get set automatically
texture tex1;
texture tex2;
float2 rcpres;
float CurrentEye;
float CurrentBrightness;

sampler s0 = sampler_state { texture = <tex1>; };
sampler s1 = sampler_state { texture = <tex2>; };
float ReactionSpeed=9.0;

//Use these to modify the behaviour of the shader
static const float BloomScale = 0.4;
static const float HDRScale = -0.3;
static const float HDRAdjust = -0.01;

//Uncomment these settings and comment out the ones above for super bright bloom
//static const float BloomScale = 0.1;
//static const float HDRScale = -0.6;
//static const float HDRAdjust = 0.04;

float2 PixelKernelH[13] =
{
{ -9, 9 },
{ -7.5, 7.5 },
{ -6, 6 },
{ -4.5, 4.5 },
{ -3, 3 },
{ -1.5, 1.5 },
{ 0, 0 },
{ 1.5, 1.5 },
{ 3, 3 },
{ 4.5, 4.5 },
{ 6, 6 },
{ 7.5, 7.5 },
{ 9, 9 },
};

float2 PixelKernelV[13] =
{
{ -9, -9 },
{ -7.5, -7.5 },
{ -6, -6 },
{ -4.5, -4.5 },
{ -3, -3 },
{ -1.5, -1.5 },
{ 0, 0 },
{ 1.5, -1.5 },
{ 3, -3 },
{ 4.5, -4.5 },
{ 6, -6 },
{ 7.5, -7.5 },
{ 9, -9 },
};

static const float BlurWeights[13] =
{
0.005000,
0.010000,
0.030000,
0.060000,
0.080000,
0.090000,
0.100000,
0.090000,
0.080000,
0.060000,
0.030000,
0.010000,
0.005000,
};

float4 Bloom( in float2 Tex : TEXCOORD0 ) : COLOR0
{
float4 Color = tex2D( s0, Tex );
Color *= 1+((CurrentEye - 0.5)*HDRScale);
//Color *= 1+((CurrentBrightness - CurrentEye)*2); //Uncomment this line for abrubt brightness changes

float4 Color2=0;
for (int i = 0; i < 13; i++)
{
Color2 += tex2D( s1, Tex + (PixelKernelH[i]*rcpres) ) * BlurWeights[i];
Color2 += tex2D( s1, Tex + (PixelKernelV[i]*rcpres) ) * BlurWeights[i];
}
Color2 *= BloomScale;

return saturate((Color*0.6) + (Color2*1.8) - (Color*Color2));
}
float4 HDRBrightPass( in float2 Tex : TEXCOORD0 ) : COLOR0
{
float4 color = tex2D( s0, Tex );
//color += saturate(tex2D( s1, Tex ) - (CurrentEye + 0.1)); //Uncomment this line for retina burn
float4 adjust = (color - CurrentEye*0.5) - HDRAdjust;
color = saturate((adjust)*0.5 + (adjust*adjust)*1.5);
color.a = 1;
return color;
}

technique T0
{
pass p0 { PixelShader = compile ps_3_0 HDRBrightPass(); }
pass p1 { PixelShader = compile ps_3_0 Bloom(); }

}

http://img62.imageshack.us/img62/3839/custombloomhdrshaderpjm.png

Why is it only Spanish people, who keep obsessing over HLE graphics, hi-res texture packs and the 30-day free trial shareware edition of Project64 1.7.0.55?

It's Project 64 1.7.0.50 and i'm not Spanish. :p

HatCat
2nd December 2012, 07:58 PM
Yeah right woman. :D That's why there's Asian language all over the language text in those screenshots

And 1.7.0.55 doesn't even exist; I just made that up to denote cracked 1.7 30-day-free-trial shareware offer! :eek: Seeing as you didn't donate to receive a copy of 1.7 legitimately via that account.

and LOLWUT:


float4 ToonPass( in float2 Tex : TEXCOORD0 ) : COLOR0
{
ToonConfig.xyz = 4; //RGB colours

float4 Color = tex2D( s0, Tex.xy );
Color.r = round(Color.r*ToonConfig.r)/ToonConfig.r;
Color.g = round(Color.g*ToonConfig.g)/ToonConfig.g;
Color.b = round(Color.b*ToonConfig.b)/ToonConfig.b;
const int NUM = 9;
const float2 c[NUM] =
{
float2(-0.0078125, 0.0078125),
float2( 0.00 , 0.0078125),
float2( 0.0078125, 0.0078125),
float2(-0.0078125, 0.00 ),
float2( 0.0, 0.0),
float2( 0.0078125, 0.007 ),
float2(-0.0078125,-0.0078125),
float2( 0.00 , -0.0078125),
float2( 0.0078125,-0.0078125),
};

int i;
float3 col[NUM];
for (i=0; i < NUM; i++)
{
col[i] = tex2D(s0, Tex.xy + 0.2*c[i]);
}

float3 rgb2lum = float3(0.01, 0.01, 0.01);
float lum[NUM];
for (i = 0; i < NUM; i++)
{
lum[i] = dot(col[i].xyz, rgb2lum);
}
float x = lum[2]+ lum[8]+2*lum[5]-lum[0]-2*lum[3]-lum[6];
float y = lum[6]+2*lum[7]+ lum[8]-lum[0]-2*lum[1]-lum[2];
float edge =(x*x + y*y < threshold)? 1.0:0.0;
Color.rgb *= edge;
return Color;


Dat thar be some inefficient code

High-level emulation and C++ are very nice and all that, promotes various things with more direct results sometimes, but what good is any of that if they inspire inefficient coding :D

For example:

float edge =(x*x + y*y < threshold)? 1.0:0.0;
Color.rgb *= edge;
return Color;


Is a bloated, excessive way of saying in pure C:

x *= x;
y *= y;
if (x + y < threshold) return Color;
Color.rgb = 0; /* if edge == 0.0 then DUH, Color.rgb *= 0 zeroes it. */
return Color;

ExtremeDude2
3rd December 2012, 08:16 PM
If anything that is french (I'm just guessing tho)

Natch
3rd December 2012, 10:14 PM
No, I'm pretty sure that that's spanish.

"sistema"

HatCat
3rd December 2012, 11:11 PM
Oh, I thought it was C++.

If anything that is french (I'm just guessing tho)

lol, FINALLY

Someone other than myself who is illiterate with languages other than English.
And another American too XD, knowing like at least one other language is like almost a requirement to go to college here

I thought I was the only one retarded with that shit XD

(edit, but srsly, no way in Hell is that French)

gottebag
4th December 2012, 02:30 AM
I'm guessing chumbalumba is either Portuguese or Brazillian

HatCat
4th December 2012, 08:51 PM
Portuguese, Brazilian, Colombian, Mexican, Saudi Arabian...

Jesus Christ, it's all Japanese to me.

SPANISH.


dammit.

Natch
4th December 2012, 09:54 PM
oplz. I know Japanese well enough to know that that's not Japanese :L

It's all Greek to me.



haha just kidding I know Greek too

HatCat
4th December 2012, 10:15 PM
k

chumbalumba
24th December 2012, 08:07 PM
My country is...

See my new shader:

http://img689.imageshack.us/img689/9728/toonshader.png

My official language! :D

HatCat
26th December 2012, 11:27 PM
Awesome lmao^

Well whatever that post was that haxatax tried to get through on the forum I guess none of the moderators wanted us to see it XD

mudlord_
27th December 2012, 12:49 AM
Indeed, oh well. best stuff is private anyway.