|
|||||||
| Windows XP Radeon Display Drivers The official Omegadrive support forum. Also discuss ATI's Catalyst Control Center and windows drivers here. |
![]() |
|
|
Thread Tools |
|
|
#1 |
|
DriverHeaven Newbie
Join Date: Mar 2004
Posts: 9
Rep Power: 0 ![]() |
Volunteer to port a few shaders?
I'm posting this here because SMARTSHADER Effects is a Catalyst driver feature.
Recently an article was contributed to VERC detailing how to use full-screen pixel shaders in Half-Life by loading up nVidia's Cg library (working on both ATI and nVidia cards). A very nice sample effect was included, however as support for Cg needs to be coded into the mod, the effect can't be used in existing mods. However, ATI's Smartshader also allows custom pixel shaders to be loaded and used in ANY game. Unfortunately the original shaders are written in Cg and Smartshader doesn't use the same language. None of us are graphics programmers, just regular programmers, so we're wondering if we could get a volunteer to either port the Cg versions to SMARTSHADER, or produce a similar effect in a SMARTSHADER program. What follows is the Cg programs used to acheive the effect (Which is somewhat of a nice blur that only effects bright things, adding a lot of atmosphere to games like Natural-Selection): glow_blur_fp.cg Code:
struct VertOut
{
float4 pos : POSITION;
float4 col : COLOR0;
float2 tex0 : TEXCOORD0;
float2 tex1 : TEXCOORD1;
float2 tex2 : TEXCOORD2;
float2 tex3 : TEXCOORD3;
};
struct FragOut
{
float4 col : COLOR;
};
FragOut main(VertOut vin,
uniform samplerRECT tex0 : TEXUNIT0,
uniform samplerRECT tex1 : TEXUNIT1,
uniform samplerRECT tex2 : TEXUNIT2,
uniform samplerRECT tex3 : TEXUNIT3)
{
FragOut fout;
float4 col1 = texRECT(tex0, vin.tex0) / 2.0f;
float4 col2 = texRECT(tex1, vin.tex1) / 2.0f;
float4 col3 = texRECT(tex2, vin.tex2) / 2.0f;
float4 col4 = texRECT(tex3, vin.tex3) / 2.0f;
float4 avg1 = (col1 + col2) / 2.0f;
float4 avg2 = (col3 + col4) / 2.0f;
fout.col = avg1 + avg2;
return fout;
}
Code:
struct VertIn
{
float4 pos : POSITION;
float4 diffuse : COLOR0;
float2 tex0 : TEXCOORD0;
};
struct VertOut
{
float4 pos : POSITION;
float4 col : COLOR0;
float2 tex0 : TEXCOORD0;
float2 tex1 : TEXCOORD1;
float2 tex2 : TEXCOORD2;
float2 tex3 : TEXCOORD3;
};
VertOut main(VertIn vin,
uniform float XOffset,
uniform float YOffset,
uniform float4x4 ModelViewProj)
{
VertOut vout;
vout.pos = mul(ModelViewProj, vin.pos);
vout.col = vin.diffuse;
vout.tex0 = vin.tex0 + float2(XOffset,YOffset);
vout.tex1 = vin.tex0 + float2(XOffset*2,YOffset*2);
vout.tex2 = vin.tex0 - float2(XOffset,YOffset);
vout.tex3 = vin.tex0 - float2(XOffset*2,YOffset*2);
return vout;
}
Code:
struct VertOut
{
float4 pos : POSITION;
float4 col : COLOR0;
float2 tex0 : TEXCOORD0;
float2 tex1 : TEXCOORD1;
};
struct FragOut
{
float4 col : COLOR;
};
FragOut main(VertOut vin,
uniform samplerRECT texNormal : TEXUNIT0,
uniform samplerRECT texGlow : TEXUNIT1)
{
FragOut fout;
float4 colGlow = texRECT(texGlow, vin.tex1);
float4 colNormal = texRECT(texNormal, vin.tex0);
fout.col = colNormal + colGlow*2;
return fout;
}
Code:
struct VertIn
{
float4 pos : POSITION;
float4 diffuse : COLOR0;
float2 tex0 : TEXCOORD0;
};
struct VertOut
{
float4 pos : POSITION;
float4 col : COLOR0;
float2 tex0 : TEXCOORD0;
float2 tex1 : TEXCOORD1;
};
VertOut main(VertIn vin,
uniform float4x4 ModelViewProj)
{
VertOut vout;
vout.pos = mul(ModelViewProj, vin.pos);
vout.col = vin.diffuse;
vout.tex0 = vin.tex0 * 2;
vout.tex1 = vin.tex0;
return vout;
}
Code:
struct VertOut
{
float4 pos : POSITION;
float4 col : COLOR0;
float2 tex0 : TEXCOORD0;
};
struct FragOut
{
float4 col : COLOR;
};
FragOut main(VertOut vin, uniform samplerRECT tex0 : TEXUNIT0)
{
FragOut fout;
float4 newCol = texRECT(tex0, vin.tex0);
fout.col = newCol * newCol * newCol;
return fout;
}
Code:
struct VertIn
{
float4 pos : POSITION;
float4 diffuse : COLOR0;
float2 tex0 : TEXCOORD0;
};
struct VertOut
{
float4 pos : POSITION;
float4 col : COLOR0;
float2 tex0 : TEXCOORD0;
};
VertOut main(VertIn vin, uniform float4x4 ModelViewProj)
{
VertOut vout;
vout.pos = mul(ModelViewProj, vin.pos);
vout.col = vin.diffuse;
vout.tex0 = vin.tex0;
return vout;
}
|
|
|
|
![]() |
| Thread Tools | |
|
|