Well, not the whole screen, just the actual "scattering" effect. Here is a screeny: (attached)
and here is the code for the shader:
//====================================================
// Light Scattering
// By EVOLVED
//====================================================
//--------------
// un-tweaks
//--------------
matrix ViewProjection:ViewProjection;
matrix ProjMat={0.5,0,0,0.5,0,-0.5,0,0.5,0,0,0.5,0.5,0,0,0,1};
//--------------
// tweaks
//--------------
float3 LightDir={-0.384,-0.573,-0.723};
int SampleNum=20;
float Density=0.2f;
float Decay=0.98f;
//--------------
// Textures
//--------------
texture BlackTextureTX <string Name=" ";>;
sampler BlackTexture=sampler_state
{
Texture=<BlackTextureTX>;
ADDRESSU = CLAMP;
ADDRESSV = CLAMP;
ADDRESSW = CLAMP;
};
//--------------
// structs
//--------------
struct InPut
{
float4 Pos:POSITION;
float2 UV:TEXCOORD;
};
struct OutPut
{
float4 OPos:POSITION;
float2 Tex:TEXCOORD0;
};
//--------------
// vertex shader
//--------------
OutPut VS(InPut IN)
{
OutPut OUT;
OUT.OPos=IN.Pos;
OUT.Tex=IN.UV;
return OUT;
}
//--------------
// pixel shader
//--------------
float4 PS(OutPut IN) : COLOR
{
float4 ScreenToLight=mul(ProjMat,mul(-LightDir,ViewProjection));
float2 DeltaTex=((ScreenToLight.xy/ScreenToLight.z)-IN.Tex)*sign(ScreenToLight.z);
float length=length(DeltaTex);DeltaTex /=length;
length=min(length,Density);DeltaTex *=length;
float2 NewUv=IN.Tex;
float3 Scatter=0;
float FallOff=1.0;
DeltaTex /=SampleNum;
for (int i=0; i < SampleNum; i++)
{
NewUv +=DeltaTex;
Scatter +=tex2D(BlackTexture,NewUv)*FallOff;
FallOff *=Decay;
}
Scatter /=SampleNum;
return float4(Scatter,1);
}
//--------------
// techniques
//--------------
technique Scatter
{
pass p1
{
VertexShader = compile vs_2_0 VS();
PixelShader = compile ps_3_0 PS();
}
}
Code that updates it:
dbPositionObject(SUNGLARE,dbCameraPositionX(),dbCameraPositionY(),dbCameraPositionZ());
dbRotateObject(SUNGLARE,-35,28,0);
dbMoveObject(SUNGLARE,8000);
dbPositionObject(SUNGLARE+1,dbCameraPositionX(),dbCameraPositionY(),dbCameraPositionZ()); //light scatter object
dbRotateObject(SUNGLARE+1,character->rX,character->rY,0);
dbPositionCamera(1,dbCameraPositionX(),dbCameraPositionY(),dbCameraPositionZ());
dbRotateCamera(1,character->rX,character->rY,0);
dbSyncMask(1<<1);
dbFastSync();
dbSyncMask(1<<0);
dbSync();
And finally, the code that sets the scattering up:
// LIGHT SCATTERING
dbLoadImage("Images\\sun.bmp",304);
dbMakeObjectPlain(SUNGLARE,4000,4000);
dbTextureObject(SUNGLARE,304);
dbSetObjectLight(SUNGLARE,0);
SetObjectMask(SUNGLARE,1<<1);
dbMakeCamera(1);
dbSetCameraToImage(1,305,GAME_X/4,GAME_Y/4);
dbSetCameraFOV(1,60);
dbBackdropOn (1);
dbColorBackdrop(1,dbRGB(0,0,0));
dbSetCameraRange(1,3,100000);
//Setup light scatter plain
dbLoadEffect("FX\\Scatter.fx",3,0);
dbMakeObjectPlain (SUNGLARE+1,2,2);
dbTextureObject(SUNGLARE+1,305); // TEXTURE LIGHT SCATTER WITH CAMERA 1'S IMAGE
dbSetObjectEffect(SUNGLARE+1,3);
SetObjectMask(SUNGLARE+1,1<<0);
dbDisableObjectZDepth(SUNGLARE+1);
dbGhostObjectOn(SUNGLARE+1);
Why would it reverse the image? It also makes the image a bit lower. What!?
Your signature has been erased by a mod