[QUOTE=kees;1908]It is a pretty big mess though :P[/QUOTE]
OHH YES it is :D: !!!
If you plug their wizzard pre-setup post glow effect on top of your material : everything is working fine.
But I’ve never managed yet to create my own RTT from scratch : all I get is scrambled texels or pixels coming from somewhere from a buffer. In my case, I’d have to use their DECLARE_SIZED_TEX for fixed size render target.
I’ve scaled down and moved slightly to top right the screen quad vertices to keep an eye on it : the texture seems to appear fine, but I’d like it applied back on the object forwarded through “pass2” with “RTsampler” picked up by in pixel shader… weird… :?:
Here is the simple test.fx :
float4x4 WorldViewProj : WorldViewProjection <string UIWidget="None";> ;
float Script : STANDARDSGLOBAL <
string UIWidget = "none";
string ScriptClass = "object";
string ScriptOrder = "standard";
string ScriptOutput = "color";
string Script = "Technique=Textured";
> = 0.8;
// "NVIDIA's header way of doing it"...
// you can comment/uncomment to swap with some of these to try...
// none of them worked for me :(
#include <HLSL\\include\\Quad.fxh>
//DECLARE_QUAD_TEX(RT_Tex,RTsampler,"A8R8G8B8")
//DECLARE_SQUARE_QUAD_TEX(RT_Tex,RTsampler,"A8R8G8B8",256)
//DECLARE_SIZED_TEX(RT_Tex,RTsampler,"A8R8G8B8",256,256)
//DECLARE_QUAD_TEX(RT_Tex,RTsampler,"A8R8G8B8")
//DECLARE_SIZED_QUAD_TEX(RT_Tex,RTsampler,"A8R8G8B8",1)
// My way : classic texture/sampler declaration : "the way Rendermonkey is outputing it"
texture2D RT_Tex : RENDERCOLORTARGET
<
//which SAS semantic is right and required or optional here ?
//float2 ViewportRatio={1.0,1.0};
//float2 RenderTargetDimensions = {256,256};
//float2 Dimensions = {256,256};
float Width = 256;
float Height = 256;
string Format="A8R8G8B8";
string UIWidget = "none";
float ClearDepth=1.000000f;
int ClearColor=-16777216;
int Miplevels = 9;
>;
sampler RTsampler = sampler_state
{
Texture = <RT_Tex>;
ADDRESSU = WRAP;
ADDRESSV = WRAP;
MIPFILTER = LINEAR;
MAGFILTER = LINEAR;
};
texture2D base_Tex ;
sampler Tex1 = sampler_state
{
Texture = <base_Tex>;
ADDRESSU = WRAP;
ADDRESSV = WRAP;
MINFILTER = LINEAR;
MIPFILTER = LINEAR;
MAGFILTER = LINEAR;
};
////////////
// PASS 1 //
////////////
void pass1VS (
in float3 ipos : POSITION,
in float2 iuv : TEXCOORD,
out float4 opos : POSITION,
out float2 ouv : TEXCOORD1 )
{
opos = float4(ipos.xz,0,1.5)+3;
ouv = iuv*float2(1,-1);
}
float4 pass1PS( float2 uv : TEXCOORD1 ) : COLOR
{
return tex2D( Tex1, uv );
}
////////////
// PASS 2 //
////////////
void pass2VS(
in float4 ipos : POSITION,
in float2 iuv : TEXCOORD,
out float4 opos : POSITION,
out float2 ouv : TEXCOORD2 )
{
opos = mul( ipos, WorldViewProj );
ouv = iuv;
}
float4 pass2PS( in float2 uv : TEXCOORD2 ) : COLOR
{ return tex2D( RTsampler, uv ); }
///////////////
// TECHNIQUE //
///////////////
technique Textured
// what are we doing here ? what are thoses "scripts" ??
< string Script =
"RenderColorTarget0=RT_Tex;"
"ClearColor = (0, 0, 0, 255);"
"Pass = pass1;"
"Pass = pass2;";
>
{
pass pass1 < string Script =
"RenderColorTarget0=RT_Tex;"
"ClearColor = (0, 0, 0, 255);"
"ClearDepth = 1.000000;";
>
{
VertexShader = compile vs_2_0 pass1VS();
cullmode = none;
PixelShader = compile ps_2_0 pass1PS();
}
pass pass2
{
VertexShader = compile vs_2_0 pass2VS();
PixelShader = compile ps_2_0 pass2PS();
}
}