Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/06/23 11:29
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
7 registered members (fairtrader, Quad, miwok, Martin_HH, AndrewAMD, alibaba, dpn), 581 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
Re: Can i see the world in black and white? XD [Re: ello] #58092
10/26/05 14:02
10/26/05 14:02
Joined: Apr 2002
Posts: 4,801
Richmond B.C., Canada
Captain_Kiyaku Offline OP

Dichotomic
Captain_Kiyaku  Offline OP

Dichotomic

Joined: Apr 2002
Posts: 4,801
Richmond B.C., Canada
hmm weird. well the alphablendenable is false.
let me show you the bloom.fx
its not even important that i wrote it inside this, i think. i just wanted to include it somewhere.

here the bloom from sphere:





float4x4 matWorldViewProj;

//////////////////////////////////////////////////////////////////////
// Variables
//////////////////////////////////////////////////////////////////////


// Pixel offsets ( 1 / 1024, 1 / 768 )
float2 PixelOffset = float2( 0.00097656250, 0.0013020833 );

// Exposure Level
float fExposureLevel;

// Tone mapping variables
float g_fMiddleGray; // The middle gray key value
float g_fWhiteCutoff; // Lowest luminance which is mapped to white
float MiddleGray=0.3;
float g_fElapsedTime; // Time in seconds since the last calculation

bool g_bEnableBlueShift; // Flag indicates if blue shift is performed
bool g_bEnableToneMap; // Flag indicates if tone mapping is performed

texture tFull;
texture tBlur;
texture currenttex;
texture average;
texture last;
texture tone;

//////////////////////////////////////////////////////////////////////
// Samplers
//////////////////////////////////////////////////////////////////////

sampler FullSampler = sampler_state
{
Texture = (tFull);
MinFilter = Linear;
MagFilter = Linear;
MipFilter = none;
AddressU = clamp;
AddressV = clamp;

};

sampler Average = sampler_state
{
Texture = (average);
MinFilter = Linear;
MagFilter = Linear;
MipFilter = none;
AddressU = clamp;
AddressV = clamp;

};

sampler BlurSampler = sampler_state
{
Texture = (tBlur);
MinFilter = Linear;
MagFilter = Linear;
MipFilter = none;
AddressU = clamp;
AddressV = clamp;
};

sampler CurrentLum = sampler_state
{
Texture = (currenttex);
MinFilter = Point;
MagFilter = Point;
MipFilter = none;
AddressU = clamp;
AddressV = clamp;
};

sampler Tone = sampler_state
{
Texture = (tone);
MinFilter = Linear;
MagFilter = Linear;
MipFilter = none;
AddressU = clamp;
AddressV = clamp;
};

sampler Last = sampler_state
{
Texture = (last);
MinFilter = Point;
MagFilter = Point;
MipFilter = none;
AddressU = clamp;
AddressV = clamp;
};

texture entSkin1; //color map

sampler basemap = sampler_state
{
Texture = (entSkin1);
MinFilter = Linear;
MagFilter = Linear;
MipFilter = none;
AddressU = clamp;
AddressV = clamp;
};


static const float BRIGHT_PASS_THRESHOLD = 0.2f; // Threshold for BrightPass filter
static const float BRIGHT_PASS_OFFSET = 0.5f; // Offset for BrightPass filter


///////////////////////////////////////////////////////////////////////////////////////////////////////////////
////bloom shader.. does simple multitap blur..
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
// -------------------------------------------------------------
// Output channels
// -------------------------------------------------------------
struct VS_OUTPUT
{
float4 Pos : POSITION;
float2 Tex : TEXCOORD0;
};


// -------------------------------------------------------------
// vertex shader function (input channels)
// -------------------------------------------------------------
VS_OUTPUT VS_PASS1(float4 Pos : POSITION, float2 texcoord0 : TEXCOORD0 )
{
VS_OUTPUT Out = (VS_OUTPUT)0;
// Out.Pos = mul(Pos, matWorldViewProj); // transform Position
Out.Pos = Pos; // transform Position

Out.Tex = texcoord0.xy;

return Out;
}

// -------------------------------------------------------------
// Pixel Shader (input channels):output channel
// -------------------------------------------------------------

float4 PS_PASS1( float2 Tex: TEXCOORD0 ):COLOR
{


float nsamples=8;

float4 c = 0;
// this loop will be unrolled by compiler and the constants precalculated:
for(int i=0; i<nsamples; i++)
{
float2 tap = Tex;
tap.x*=1+i*0.003f;

c += tex2D(BlurSampler, (tap));
}
c /= nsamples;

c*=4;
c+=tex2D(BlurSampler, Tex);


return c;


}

//brightpass
// -------------------------------------------------------------
// Pixel Shader (input channels):output channel
// -------------------------------------------------------------

float4 PS_PASS2( float2 Tex: TEXCOORD0 ):COLOR
{
float4 vSample = tex2D( BlurSampler, Tex );
float fAdaptedLum = tex2D(CurrentLum, float2(0.5f, 0.5f) );

// Determine what the pixel's value will be after tone-mapping occurs
vSample.rgb *= MiddleGray/(fAdaptedLum + 0.001f);

// Subtract out dark pixels
vSample.rgb -= BRIGHT_PASS_THRESHOLD;

// Clamp to 0
vSample = max(vSample, 0.0f);

// Map the resulting value into the 0 to 1 range. Higher values for
// BRIGHT_PASS_OFFSET will isolate lights from illuminated scene
// objects.
vSample.rgb /= (BRIGHT_PASS_OFFSET+vSample);
return vSample;

}

//final pass
float4 PS_PASS3( float2 Tex: TEXCOORD0 ):COLOR
{

float4 original = tex2D( FullSampler, Tex );
float4 bright = tex2D( BlurSampler, Tex );
float4 fAdaptedLum = tex2D( CurrentLum, float2(0.5f, 0.5f) );

float4 c=original;
c.rgb *= MiddleGray /(fAdaptedLum + 0.001f);
c.rgb /= (1.0f+c);
c+=bright;

// return c;
return original+c;

}

//////////////////////////////////////////////////////////////////////
//Tone Mapping
//////////////////////////////////////////////////////////////////////


//////////////////////////////////////////////////////////////////////
// Vertex shader
//////////////////////////////////////////////////////////////////////

struct VS_OUT
{
float4 Pos: POSITION;
float2 Tex: TEXCOORD0;
};

VS_OUT vs_main( float4 inPos: POSITION, float2 inTex: TEXCOORD0 )
{
VS_OUT OUT;

// Output the transformed vertex
OUT.Pos = mul( inPos, matWorldViewProj);

// Output the texture coordinates
OUT.Tex.xy= inTex.xy ;

return OUT;
}


//tone map
//////////////////////////////////////////////////////////////////////
// Pixel shader
//////////////////////////////////////////////////////////////////////

float4 ps_main( float2 Tex: TEXCOORD0 ) : COLOR0
{
float4 color = tex2D( FullSampler, Tex );

Tex -= 0.5;
float vignette = 1 - dot( Tex, Tex );
color *= pow( vignette, 4.0 );

color *= (fExposureLevel*2);

return (pow( color, 0.1f));
}


here is the black/white thingy
float4 ps_bw( float2 Tex: TEXCOORD0 ) : COLOR0
{
float4 color = tex2D( FullSampler, Tex );
color = (color.r+color.g+color.b)/3;
color.a = 1.0f;
return color;
}


//-----------------------------------------------------------------------------
// Name: CalculateAdaptedLum
// Type: Pixel shader
// Desc: Calculate the luminance that the camera is current adapted to, using
// the most recented adaptation level, the current scene luminance, and
// the time elapsed since last calculated
//-----------------------------------------------------------------------------
float4 CalculateAdaptedLum
(
in float2 Tex : TEXCOORD0
) : COLOR
{
float fAdaptedLum = tex2D(Last, float2(0.5f, 0.5f));
float fCurrentLum = tex2D(Tone, float2(0.5f, 0.5f));


if (fAdaptedLum<0.1f)
{
fAdaptedLum=0.1f;
}

if (fAdaptedLum>12.0f)
{
fAdaptedLum=12.0f;
}


// The user's adapted luminance level is simulated by closing the gap between
// adapted luminance and current luminance by 2% every frame, based on a
// 30 fps rate. This is not an accurate model of human adaptation, which can
// take longer than half an hour.
float fNewAdaptation = fAdaptedLum + (fCurrentLum - fAdaptedLum) * ( 1 - pow( 0.98f, 1 * g_fElapsedTime ) );
return float4(fNewAdaptation, fNewAdaptation, fNewAdaptation, 1.0f);


}

//////////////////////////////////////////////////////////////////////
// Techniques
//////////////////////////////////////////////////////////////////////

technique Tonemap
{
pass Pass0
{
alphablendenable=false;
zenable=false;
zwriteenable=true;


// VertexShader = compile vs_2_0 vs_main();
PixelShader = compile ps_2_0 ps_main();
}
}

////////////////////////////////////////////////////////////////////////////////////////////////////

technique Bloom
{

pass blur1
{
alphablendenable=false;
zenable=false;
zwriteenable=true;

// compile shaders
// VertexShader = compile vs_2_0 VS_PASS1();
PixelShader = compile ps_2_0 PS_PASS1();
}

}

////////////////////////////////////////////////////////////////////////////////////////////////////

technique Brightpass
{

pass blur1
{
alphablendenable=false;
zenable=false;
zwriteenable=true;

// compile shaders
// VertexShader = compile vs_2_0 VS_PASS1();
PixelShader = compile ps_2_0 PS_PASS2();
}

}

////////////////////////////////////////////////////////////////////////////////////////////////////

technique AdaptedLum
{

pass blur1
{
alphablendenable=false;
zenable=false;
zwriteenable=true;

// compile shaders
// VertexShader = compile vs_2_0 VS_PASS1();
PixelShader = compile ps_2_0 CalculateAdaptedLum();
}

}

////////////////////////////////////////////////////////////////////////////////////////////////////

technique Finalpass
{

pass blur1
{
alphablendenable=false;
zenable=false;
zwriteenable=true;

// compile shaders
// VertexShader = compile vs_2_0 VS_PASS1();
PixelShader = compile ps_2_0 PS_PASS3();
}

}


technique Blackwhite
{
pass blur1
{
alphablendenable=false;
zenable=false;
zwriteenable=true;

// compile shaders
// VertexShader = compile vs_2_0 VS_PASS1();
PixelShader = compile ps_2_0 ps_bw();
}

}

maybe i should try to add it in a new level without sphere..

Last edited by DS_Kihaku; 10/26/05 14:04.

My Blog

"Tag und Nacht schrei ich mich heiser,
Wind weht alle Worte fort,
Tag und Nacht schrei ich mein Krähenwort!"

Subway To Sally - Krähenkönig
Re: Can i see the world in black and white? XD [Re: Captain_Kiyaku] #58093
10/26/05 14:41
10/26/05 14:41
Joined: Oct 2002
Posts: 8,939
planet.earth
ello Offline
Senior Expert
ello  Offline
Senior Expert

Joined: Oct 2002
Posts: 8,939
planet.earth
oh, you need to disable (comment or remove) the other techniques;)


www.earthcontrol.de
quoted: We want to maintain a clean, decent, American family suited forum look... which means you may post zombies or chainsaw massacres, but no erotic.
Re: Can i see the world in black and white? XD [Re: ello] #58094
10/26/05 14:56
10/26/05 14:56
Joined: Apr 2002
Posts: 4,801
Richmond B.C., Canada
Captain_Kiyaku Offline OP

Dichotomic
Captain_Kiyaku  Offline OP

Dichotomic

Joined: Apr 2002
Posts: 4,801
Richmond B.C., Canada
lol no it seams to work, at least i have a black/white effect with huge dots XD

but isnt it possible to switch between the black/white and the bloom? or to use the bloom AND the black/white thing? :<


My Blog

"Tag und Nacht schrei ich mich heiser,
Wind weht alle Worte fort,
Tag und Nacht schrei ich mein Krähenwort!"

Subway To Sally - Krähenkönig
Re: Can i see the world in black and white? XD [Re: Captain_Kiyaku] #58095
10/26/05 15:01
10/26/05 15:01
Joined: Oct 2002
Posts: 8,939
planet.earth
ello Offline
Senior Expert
ello  Offline
Senior Expert

Joined: Oct 2002
Posts: 8,939
planet.earth
well about how to apply your own fx in sphere you have to ask matt:)


www.earthcontrol.de
quoted: We want to maintain a clean, decent, American family suited forum look... which means you may post zombies or chainsaw massacres, but no erotic.
Re: Can i see the world in black and white? XD [Re: ello] #58096
10/26/05 15:08
10/26/05 15:08
Joined: Apr 2002
Posts: 4,801
Richmond B.C., Canada
Captain_Kiyaku Offline OP

Dichotomic
Captain_Kiyaku  Offline OP

Dichotomic

Joined: Apr 2002
Posts: 4,801
Richmond B.C., Canada
ok ^^'
but thank you a lot ello, you helped me a lot :>


My Blog

"Tag und Nacht schrei ich mich heiser,
Wind weht alle Worte fort,
Tag und Nacht schrei ich mein Krähenwort!"

Subway To Sally - Krähenkönig
Page 2 of 2 1 2

Moderated by  Blink, Hummel, Superku 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1