Vorstellung OBGE - Oblivion Graphics Extender

sorry, keine Ahnung. Ich würde OBGE Core und Effects nochmal neu installieren und auch mal die OBGE.ini löschen und neu generieren lassen.

hmrpf ... ich habe noch wie vor das problem, dass meine maus mit aktiviertem OBGE + einigen wenigen shadern sehr träge wird und das bei einer framerate von 30fps ... ja v-sync ist aus und auch in der ini ist usejoystick = 0
 
Zuletzt bearbeitet:
sorry, keine Ahnung. Ich würde OBGE Core und Effects nochmal neu installieren und auch mal die OBGE.ini löschen und neu generieren lassen.

hmrpf ... ich habe noch wie vor das problem, dass meine maus mit aktiviertem OBGE + einigen wenigen shadern sehr träge wird und das bei einer framerate von 30fps ... ja v-sync ist aus und auch in der ini ist usejoystick = 0



ja, das habe ich auch manchmal. vor allem, als ich mal POM an hatte :)
aber ob es wirklich an OBGE liegt? vlt. sind ja noch einige weitere plugins im spiel.... aber dann wäre bestimmt die FPS zahl weniger bei z.b. gesteigerter polygonzahl, wa
 
#define BLURHIGHLIGHT
#define SEPIA
#define COLORINVERT

durch

extern bool DoBlurHighlight = 0;
extern bool DoSepia = 0;
extern bool DoColorInvert = 0;


warum nicht alles von vorne herein einfach xyz = 1 wie bei den anderen Parametern heißt ist mir ein Rätsel.

Weil Du dadurch im Prinzip 1%-2% Leistung verlierst (nicht global, nur für diesen Effekt). Muss ja nicht sein.
__________________________



Ich suche ein paar Freuwillige für die nächste Version. Jemand bereit Reporte zu liefern? (Einfach so installieren und freuen is nich :p )
 
Zuletzt bearbeitet von einem Moderator:
Naja, das klingt für mich irgendwie unplausibel. Warum soll ein Effekt Leistung ziehen, nur weil er richtig aufgelistet ist? Das muss ja nicht heißen, dass man ihn auch aktiviert hat.

In diesem Falle wars ja sogar umgekehrt. Weil die Effekte nicht wie die anderen aufgelistet waren, waren sie gleich zu Beginn aktiviert.
 
Ich schaff es einfach nicht, OBGE zu installieren. Ich habe die OBGE Core und die Standalone Effects Archive runtergeladen und mit Bain installiert. Ingame kommt auch das Menü etc., aber fast alle Shader funktionieren nicht. Bei den meisten sehe ich dann tausende bunte Punkte und es sieht aus, als ob meine GraKa kaputt wäre (was sie aber nicht ist). Und wenn mal ein Effekt funktioniert (ColorMood z.B.), dann macht er das Spiel unglaublich langsam (dann kann ich den Cursor kaum noch bewegen).

Wenn ich versuche, dass ganze nicht über das Ingame-Menü, sondern über die Shaderlist zu managen (ohne das Support Plugin), dann ist alles vorbei. Entweder ich hab auch lauter bunte Punkte, oder einen weißen Bildschirm, oder es passiert einfach garnix.

:cry:


PS: Was ich sonst noch so an Grafik-Mods hab sind UL, Natural Environments, QTP3 Redimized, Better cities. Ja das wars glaube ich. Jedenfalls läuft das Spiel mit den genannten Mods flüssig, d.h. an einer Überlastung meiner Grafikkarte kanns eigentlich nicht liegen.

edit: Achja, und Quarls DoF
 
Zuletzt bearbeitet:
Warum soll ein Effekt Leistung ziehen, nur weil er richtig aufgelistet ist?

Es bezog sich auf "#undef ..." vs. "extern bool ... = 0;" bzw. "#define ..." vs. "extern bool ... = 1;".
Dabby hatte gefragt

warum nicht alles von vorne herein einfach xyz = 1 wie bei den anderen Parametern heißt ist mir ein Rätsel.

Die "extern"-Angaben gibt's schon seit 3.0 nicht mehr, funktionieren tut's also in 3.0+ nicht. Der Grund warum von "extern" auf "#define" gewechselt wurde ist die Leistungs-Einbuße durch "extern"s.
 
Also bei meinem OBGE v3 funktionieren diese "extern" Angaben durchaus, ich kann damit problemlos die besagten Effekte ein- und ausschalten.

aus reinem Interesse, wie würde die Angabe für "#define" heißen? einfach nur "#define=0" ?
 
Was könnt ihr mir für Shaders empfehlen, die Oblivion wie eins der neueren Games aussehen lässt, aber trozdem noch real sind.
 
Entgegen der allgemeinen Verbreitung die besagt das keine OBGE2 Shader mehr laufen. Falsch.
Alle anderen Shader ( Die von OBGE2 laufen auch mit OBGE 3 zusammen). Hätte mich auch gewundert. Denn schliesslich ist es eine Erweiterung.

Ja ihr hört richtig. Auch das Tool zum Testen der Shader inGame läuft miit OBGE 3 zusammen. Das Einzige was Ihr beachten müsst.
Die Ini des OBGE 3 Shaders stimmt nicht. Es fehlen Einträge bzw die sind auf 0 gesetzt.
Diese müssen in der INI die OBGE3 generiert manuell auf 1 gesetzt werden.
OBGE 3 generiert die Ini noch nicht so vollständig wie OBGE2.

Dazu braucht Ihr eine von OBGE2 genrierte Ini ( Ihr findet sie by Mygames. Da wo auch die Oblivion.ini liegt) und überträgt dann deren Werte in die Neue.

Desweiteren benötigt Ihr alle 3 dlls. die 31, die 41 und die 43

31 für die Nutzung des Compilers- ( brauchen viele Obge2 Shader)
41 für die Nutzung der OBGE 2 Shader überhaupt
43 für die Nutzung von OBGE3

Zu OBGE 3 Der absolute Wahnsinn. Damit ist es möglich die Shader der Engine direkt zu beeinflussen. Nun ist es nur noch eine Frage der Zeit bis wir Schatten bekommen. Das neue Wasser schlägt sogar das Skyrimwasser.

Der neue Farbshader und der Bleach sind der Oberhammer. Zusammen mit dem neuen NAA- (der Einzige der bei mir von denen neuen AAs funktioniert) und dem Alten Godrays 5 ist Oblivion kaum wieder zuerkennen.

Ihr könnt pro Shader (bis auf SSAO -4FR und POMM unspielbar ) 2FR Verlust verbuchen.OBGE3 verbucht im Gegensatz zu OBGE2 nur 1FR also halt anstatt 5 jetzt 6 weniger.

EDIT
SSAO Volumetric verbraucht doch nicht so viel (20FR). Das war ein Irtum es sind nur knapp 4 oder etwas weniger. Je mehr Shader man nutzt umso mehr verschmilzt das. Ist nur als Richtwert anzusehen. Hängt von der zuberechnenden Scene ab. SSAO kann auch deutlich mehr verbrauchen.
(Testscene (Ausgang der Abwasserkanäle) Ohne OBGE 3 Shader- Siehe unten) 50-60FR. Mit 40-50FR.
Hatte im Testoblivion die Lods nicht im Ordner. Somit war RAEWD nicht aktiv. Fazit RAEWD kostet 16 FR. Werde mich mal nach einer Alternative umschauen. Aber das geht garnicht. Edit gibt irgendwie keine Alternative.



ohne shader

mit shader ( HDR , Crysis DOF OBGE2, SSAO OBGE2, Godrays OBGE2, NAA OBGE3, Colormod OBGE3, Bleach OBGE3, Water OBGE3 )
 
Zuletzt bearbeitet:
@robinH. würdest du dir die Mühe machen und mal ein paar Ingame-Screenshots posten? Würde mich wirklich interessieren, was du da so rausgeholt hast aus OBGE.
 
  • Like
Reaktionen: Konuad
Sei gegrüßt, werte Hackfresse und willkommen im Forum :D!

Du solltest dein Problem vielleicht etwas genauer schildern, z.B. wann genau dein Bild immer schwarz wird, was du für Mods verwendest usw.

Bei deiner dürftigen Beschreibung kann man leider nur ins blaue hineinraten.

Edit: Hier mal meine momentane Shaderkonfiguration:


Code:
/* Full Screen Colour Effects Shader by WrinklyNinja. Release Version 5.
 * Gamma Alterations code by Donovan Baarda <abo@minkirri.apana.org.au>.
 *
 * Contains the following applicable effects:
 * Luminosity-Dependent Film Grain
 * Sepia
 * Saturation/Contrast/Brightness Alteration
 * Gamma (non-linear) Contrast/Brightness Alteration
 * Colour Inversion
 * Blur Highlighting
 *
 * To Do:
 * A better film grain noise.
 * More effects!
 */
 
// ---------------------------------------
// TWEAKABLE VARIABLES.
 
 
extern bool DoBlurHighlight = 0;
extern bool DoSepia = 0;
extern bool DoColorInvert = 0;
//Toggles for the on/off effects. 1 is enabled, and 0 is disabled.
 
extern float Saturation = 0.9;
//Saturation: Scales the saturation level.
//1 is vanilla, less than 1 decreases it, greater than 1 increases it.
 
extern float Brightness = 1;
//Brightness: Scales the brightness level.
//1 is vanilla, less than 1 decreases it, greater than 1 increases it.
 
extern float Contrast = 1;
//Contrast: Scales the contrast level.
//1 is vanilla, less than 1 decreases it, greater than 1 increases it.
 
extern float GContrast = 1;
//Gamma Contrast: Scales the contrast level.
//Default = 1.
 
extern float GBrightness = 1;
//Gamma Brightness: Scales the brightness level.
//Default = 1.
 
extern float FGIntensity = 0;
//Film Grain: Controls the intensity of the noise. 0 = no effect, 1 = full effect.
//Default = 0.
 
extern float BHMagnitude = 10;
//Blur Highlight: Controls the size of the blur.
//Default = 10.
 
extern float BHBrightness = 4;
//Blur Highlight: Corrects the darkening of the screen the effect causes.
//Default = 4.
 
 
// END OF TWEAKABLE VARIABLES.
// ---------------------------------------
 
float4 f4Time;
float2 rcpres;
 
texture obge_LastRendertarget0_EFFECTPASS;
 
sampler PassSampler = sampler_state {
	texture = <obge_LastRendertarget0_EFFECTPASS>;
	AddressU = CLAMP;
	AddressV = CLAMP;
	MINFILTER = POINT;
	MAGFILTER = POINT;
};
 
static const float3 greyscale = float3(0.299, 0.587, 0.114);
 
static const float BlurWeights[13] =  {
	0.057424882f,
	0.058107773f,
	0.061460144f,
	0.071020611f,
	0.088092873f,
	0.106530916f,
	0.114725602f,
	0.106530916f,
	0.088092873f,
	0.071020611f,
	0.061460144f,
	0.058107773f,
	0.057424882f
};
 
static const float2 BlurOffsets[13] =  {
	float2(-6.0f * rcpres[0], -6.0f * rcpres[1]),
	float2(-5.0f * rcpres[0], -5.0f * rcpres[1]),
	float2(-4.0f * rcpres[0], -4.0f * rcpres[1]),
	float2(-3.0f * rcpres[0], -3.0f * rcpres[1]),
	float2(-2.0f * rcpres[0], -2.0f * rcpres[1]),
	float2(-1.0f * rcpres[0], -1.0f * rcpres[1]),
	float2( 0.0f * rcpres[0],  0.0f * rcpres[1]),
	float2( 1.0f * rcpres[0],  1.0f * rcpres[1]),
	float2( 2.0f * rcpres[0],  2.0f * rcpres[1]),
	float2( 3.0f * rcpres[0],  3.0f * rcpres[1]),
	float2( 4.0f * rcpres[0],  4.0f * rcpres[1]),
	float2( 5.0f * rcpres[0],  5.0f * rcpres[1]),
	float2( 6.0f * rcpres[0],  6.0f * rcpres[1])
};
 
struct VSOUT
{
	float4 vertPos : POSITION;
	float2 UVCoord : TEXCOORD0;
};
 
struct VSIN
{
	float4 vertPos : POSITION0;
	float2 UVCoord : TEXCOORD0;
};
 
VSOUT DummyVS(VSIN IN)
{
	VSOUT OUT = (VSOUT)0.0f;	// initialize to zero, avoid complaints.
	OUT.vertPos = IN.vertPos;
	OUT.UVCoord = IN.UVCoord;
	return (OUT);
}
 
float3 Sepia(float3 frame) {
	return max(0, dot(greyscale, frame) + float3(0.191, -0.054, -0.221));
}
 
float3 ColorInvert(float3 frame) {
	return max(0, 1 - frame);
}
 
float3 AlterSatBrightCont(float3 frame) {
	frame  = lerp(dot(greyscale, frame), frame, Saturation);
	frame *= Brightness;
	frame  = lerp(0.5, frame, Contrast);
 
	return frame;
}
 
float3 FilmGrain(float3 frame, float2 UVCoord) {
	float gradient = f4Time.x % (20000 * 3.141592654);
	float x = UVCoord.x * UVCoord.y * gradient;
	x = fmod(x, 13) * fmod(x, 123);
	float dx = fmod(x, 0.01);
	float lum = saturate(1 - dot(greyscale,frame));
	float3 framenoise = frame + frame * saturate(0.1f + dx.xxx * 100);
	framenoise = lerp(frame, framenoise, FGIntensity * lum);
	framenoise = framenoise / (1 + FGIntensity / 2);
	return framenoise;
}
 
float3 BlurHighlight(float3 frame, float2 UVCoord) {
	float3 blur = 0;
	for (int k = 0; k < 13; k++) {
		blur += tex2D(PassSampler, UVCoord + (BlurOffsets[k] * float2(0, 1) * BHMagnitude) * BlurWeights[k]);
		blur += tex2D(PassSampler, UVCoord + (BlurOffsets[k] * float2(1, 0) * BHMagnitude) * BlurWeights[k]);
	}
	blur = (blur / 24) - frame;
 
	return lerp(frame, blur, 1) * BHBrightness;
}
 
//Originally written by Donovan Baarda.
float3 GammaContrast(float3 color) {
    return pow(color, GContrast) / (pow(saturate(color), GContrast) + pow(1.0 - saturate(color), GContrast));
}
 
//Originally written by Donovan Baarda.
float3 GammaBrightness(float3 color) {
    return pow(color, 1.0 / max(0.0001, GBrightness));
}
 
float4 ApplyEffects(float2 UVCoord : TEXCOORD0) : COLOR0
{
	float3 frame = tex2D(PassSampler, UVCoord).rgb;
 
#ifdef	BLURHIGHLIGHT
	frame = BlurHighlight(frame, UVCoord);
#endif
	frame = AlterSatBrightCont(frame);
	frame = GammaBrightness(frame);
	frame = GammaContrast(frame);
#ifdef	COLORINVERT
	frame = ColorInvert(frame);
#endif
	frame = FilmGrain(frame, UVCoord);
#ifdef	SEPIA
	frame = Sepia(frame);
#endif
 
	return float4(frame, 1);
}
 
technique t0
<
	int group = EFFECTGROUP_POST;
	int fxclass = EFFECTCLASS_COLOR;
>
{
	pass p0 {
		VertexShader = compile vs_3_0 DummyVS();
		PixelShader  = compile ps_3_0 ApplyEffects();
	}
}
Code:
////////////////////////////////////////////////////////////////////////////////////////////////////
/// Depth of field technique ///////////////////////////////////////////////////////////////////////
// Taken straight from Crysis: Warhead and converted for Oblivion's OBGEv2.
// Then messed around with, because Oblivion sure ain't Crysis...
// Release version 1.
 
/* Brief outline of method:
 * Downsample and pre-blur the image. - This isn't being done.
 * Approximate circle of confusion using a variable size filter kernel.
 * blend between original and pre-blurred image for better quality.
 * take measures to prevent leaking sharp foreground into blurry background.
 */
 
//Focal plane: Everything on this is in full focus.
//Near plane: Everything closer than this is fully blurred.
//Far plane: Everything beyond this is fully blurred.
 
//Render depth and blurriness info into destination alpha.
 
/// Constants ////////////////////////////
 
 
// ---------------------------------------
// TWEAKABLE VARIABLES.
 
 
extern bool DISTANTBLUR = 1
// If true, reduces DoF to a distance blurring effect, ie. things far away are blurred more than things close up.
 
#undef	WEAPONBLUR
// Setting this to true will stop your weapon, and anything else really close to you, from blurring.
 
extern float NearBlurDepth = 0.4;
//The difference between the focal plane and the near plane depths.
extern float FarBlurDepth = 0.4;
//The difference between the focal plane and the far plane depths.
extern float MaxBlurCutoff = 1;
//The maximum blurriness that an object behind the focal plane can have, where 1 is full blur and 0 is none.
 
extern float dofMinThreshold = 0.2; //0.5;
//Ensures a smoother transition between near focal plane and focused area.
 
extern float ApertureDiameter = 0.6;
//Size of aperture, larger values give more blur.
//extern float radiusScale = 1;
//Scale of low res radius to high res radius.
//extern float rcpresScale = 10;
//Scale of pixel sizes for the scaled down filtered image.
 
 
// END OF TWEAKABLE VARIABLES.
// ---------------------------------------
 
#define	rcpres	oblv_ReciprocalResolution_MAINPASS.xy
// .x - 1 / width
// .y - 1 / height
// .z - width / height
// .w - width * height
float4 oblv_ReciprocalResolution_MAINPASS;
 
 
float4x4 m44proj;
static const float nearZ = m44proj._43 / m44proj._33;
static const float farZ = (m44proj._33 * nearZ) / (m44proj._33 - 1.0f);
 
float2 poisson[8] =
{
       0.0,    0.0,
     0.527, -0.085,
    -0.040,  0.536,
    -0.670, -0.179,
    -0.419, -0.616,
     0.440, -0.639,
    -0.757,  0.349,
     0.574,  0.685,
};
 
/// Samplers /////////////////////////////
 
texture oblv_CurrDepthStencilZ_MAINPASS;
texture obge_LastRendertarget0_EFFECTPASS;
 
sampler PassSampler = sampler_state {
	texture = <obge_LastRendertarget0_EFFECTPASS>;
 
	AddressU = CLAMP;
	AddressV = CLAMP;
 
	MINFILTER = LINEAR;
	MAGFILTER = LINEAR;
	MIPFILTER = NONE;
};
 
sampler DepthSampler = sampler_state {
	texture = <oblv_CurrDepthStencilZ_MAINPASS>;
 
	AddressU = CLAMP;
	AddressV = CLAMP;
 
	MINFILTER = LINEAR;
	MAGFILTER = LINEAR;
	MIPFILTER = NONE;
};
 
///////////////// vertex shader //////////////////
 
struct VSOUT
{
	float4 vertPos : POSITION0;
	float2 UVCoord : TEXCOORD0;
};
 
struct VSIN
{
	float4 vertPos : POSITION0;
	float2 UVCoord : TEXCOORD0;
};
 
VSOUT BaseVS(VSIN IN)
{
	VSOUT OUT = (VSOUT)0.0f;	// initialize to zero, avoid complaints.
	OUT.vertPos = IN.vertPos;
	OUT.UVCoord = IN.UVCoord;
	return (OUT);
}
 
///////////////// pixel shader //////////////////
 
float GetDepthBluriness(float fDepth, float4 dofParamsFocus) {
	// 0 - in focus, 1 - completely out of focus
	float f = abs(fDepth - dofParamsFocus.z);
 
	// point is closer than focus plane.
	if (fDepth < dofParamsFocus.z) {
		f /= dofParamsFocus.x;
	}
	// point is futher than focus plane.
	else {
		f /= dofParamsFocus.y;
		f = clamp(f, 0, 1 - dofMinThreshold);
	}
 
#ifndef	WEAPONBLUR
	if (fDepth < 0.005)
		f = 0.0f;
#endif
 
	return f;
}
 
float4 GetDepth(float2 UVCoord : TEXCOORD0) : COLOR0 {
	// OBGEv2 Depth (HawkleyFox):
	float depth = pow(abs(tex2D(DepthSampler,UVCoord).x), 0.05);
	float3 color = tex2D(PassSampler, UVCoord).rgb;
	depth = (2.0f * nearZ) / (nearZ + farZ - depth * (farZ - nearZ));
 
	// Focus depth (HawkleyFox):
	float fdepth = 0.0f;
#ifndef	DISTANTBLUR
	fdepth = pow(abs(tex2D(DepthSampler, float2(0.5, 0.5)).x), 0.05);
#endif
 
	fdepth = (2.0f * nearZ) / (nearZ + farZ - fdepth * (farZ - nearZ));
	float4 dofParamsFocus = float4(NearBlurDepth, FarBlurDepth, fdepth, MaxBlurCutoff);
	depth = saturate(GetDepthBluriness(depth, dofParamsFocus)) * dofParamsFocus.w;
 
	return float4(color, depth);
}
 
float4 DofPS(float2 UVCoord : TEXCOORD0) : COLOR0 {
	// fetch center tap from blured low res image
	float centerDepth = tex2D(PassSampler, UVCoord).w; 	//Gets relative depth with blur amount.
	float cdepth = tex2D(DepthSampler, UVCoord).x; 		//Gets absolute depth.
 
	// disc radius is circle of confusion - how much blur an object (or pixel) has.
	// it is given by c=A*abs(S2-S1)/S2
	// where A is aperture size, S2 is the distance to an out of focus object,
	// and S1 is the distance to the focused object.
 
	float discRadius = ApertureDiameter * centerDepth / cdepth;
	// or is it: discRadius = ApertureDiameter * centerDepth; ?
 
//	float discRadiusLow = discRadius * radiusScale;
	float4 cOut = 0;
 
	for (int t = 0; t < 8; t++)
		cOut += tex2D(PassSampler, UVCoord + poisson[t] * rcpres * discRadius);
 
	cOut = cOut / 8;
 
	return float4(cOut.rgb, 1);
}
 
////////////////// technique /////////////////////
 
technique t0
<
	int group = EFFECTGROUP_POST;
	int fxclass = EFFECTCLASS_DOF;
	int conditions = EFFECTCOND_ZBUFFER;
>
{
	pass p0 {
		VertexShader = compile vs_1_1 BaseVS();
		PixelShader  = compile ps_2_b GetDepth();
	}
 
	pass p1 {
		VertexShader = compile vs_1_1 BaseVS();
		PixelShader  = compile ps_2_b DofPS();
	}
}
Code:
// HLSL Color Grading
// By vtastek
// made one-pass via mipmaps by Ethatron
 
// ---------------------------------------
// TWEAKABLE VARIABLES.
 
 
// suggestion
extern float saturatex = 0.65;
extern float opacity = 0.5;
 
 
// END OF TWEAKABLE VARIABLES.
// ---------------------------------------
 
#define	rcpres		oblv_ReciprocalResolution_MAINPASS.xy
#define	aspect		oblv_ReciprocalResolution_MAINPASS.z
#define	raspect		(1.0 / oblv_ReciprocalResolution_MAINPASS.z)
// .x - 1 / width
// .y - 1 / height
// .z - width / height
// .w - width * height
float4 oblv_ReciprocalResolution_MAINPASS;
 
 
texture obge_LastRendertarget0_EFFECTPASS;
 
sampler PassSampler = sampler_state {
	texture = <obge_LastRendertarget0_EFFECTPASS>;
 
	AddressU = CLAMP;
	AddressV = CLAMP;
 
	MINFILTER = LINEAR;
	MAGFILTER = LINEAR;
	MIPFILTER = LINEAR;
};
 
struct VSOUT
{
	float4 vertPos : POSITION;
	float2 UVCoord : TEXCOORD0;
};
 
struct VSIN
{
	float4 vertPos : POSITION0;
	float2 UVCoord : TEXCOORD0;
};
 
VSOUT FrameVS(VSIN IN)
{
	VSOUT OUT = (VSOUT)0.0f;	// initialize to zero, avoid complaints.
	OUT.vertPos = IN.vertPos;
	OUT.UVCoord = IN.UVCoord;
	return OUT;
}
 
float HueToRGB(float f1, float f2, float hue) {
	if (hue < 0.0)
		hue += 1.0;
	else if (hue > 1.0)
		hue -= 1.0;
 
	float res;
	if ((6.0 * hue) < 1.0)
		res = f1 + (f2 - f1) * 6.0 * hue;
	else if ((2.0 * hue) < 1.0)
		res = f2;
	else if ((3.0 * hue) < 2.0)
		res = f1 + (f2 - f1) * ((2.0 / 3.0) - hue) * 6.0;
	else
		res = f1;
 
	return res;
}
 
float3 RGBToHSL(float3 color) {
	float3 hsl; // init to 0 to avoid warnings ? (and reverse if + remove first part)
 
	/* re-range to be in [0,1] without loss of HDR */
	color.r = 1.0 / (1.0 + color.r);
	color.g = 1.0 / (1.0 + color.g);
	color.b = 1.0 / (1.0 + color.b);
 
	float fmin = min(min(color.r, color.g), color.b);	// Min. value of RGB
	float fmax = max(max(color.r, color.g), color.b);	// Max. value of RGB
	float delta = fmax - fmin;				// Delta RGB value
 
	hsl.z = (fmax + fmin) / 2.0; 				// Luminance
 
	// This is a gray, no chroma...
	if (delta == 0.0) {
		hsl.x = 0.0;	// Hue
		hsl.y = 0.0;	// Saturation
	}
	// Chromatic data...
	else {
		if (hsl.z < 0.5)
			hsl.y = delta / (      fmax + fmin); // Saturation
		else
			hsl.y = delta / (2.0 - fmax - fmin); // Saturation
 
		float deltaR = (((fmax - color.r) / 6.0) + (delta / 2.0)) / delta;
		float deltaG = (((fmax - color.g) / 6.0) + (delta / 2.0)) / delta;
		float deltaB = (((fmax - color.b) / 6.0) + (delta / 2.0)) / delta;
 
		if (color.r == fmax )
			hsl.x =               deltaB - deltaG; // Hue
		else if (color.g == fmax)
			hsl.x = (1.0 / 3.0) + deltaR - deltaB; // Hue
		else if (color.b == fmax)
			hsl.x = (2.0 / 3.0) + deltaG - deltaR; // Hue
 
		if (hsl.x < 0.0)
			hsl.x += 1.0; // Hue
		else if (hsl.x > 1.0)
			hsl.x -= 1.0; // Hue
	}
 
	return hsl;
}
 
float3 HSLToRGB(float3 hsl) {
	float3 rgb;
 
	if (hsl.y == 0.0)
		rgb = float3(hsl.z, hsl.z, hsl.z); // Luminance
	else {
		float f2;
 
		if (hsl.z < 0.5)
			f2 = hsl.z * (1.0 + hsl.y);
		else
			f2 = (hsl.z + hsl.y) - (hsl.y * hsl.z);
 
		float f1 = 2.0 * hsl.z - f2;
 
		rgb.r = HueToRGB(f1, f2, hsl.x + (1.0/3.0));
		rgb.g = HueToRGB(f1, f2, hsl.x);
		rgb.b = HueToRGB(f1, f2, hsl.x - (1.0/3.0));
	}
 
	/* recover HDR range HDR */
	rgb.r = (1.0 / rgb.r) - 1.0;
	rgb.g = (1.0 / rgb.g) - 1.0;
	rgb.b = (1.0 / rgb.b) - 1.0;
 
	return rgb;
}
 
float3 BlendColor(float3 base, float3 blend)
{
	float3 blendHSL = RGBToHSL(blend);
	return HSLToRGB(float3(blendHSL.r, blendHSL.g, RGBToHSL(base).b));
}
 
 
// code starts here actually
 
float4 ColorGrade(float2 Tex : TEXCOORD0) : COLOR {
	float4 Color = tex2Dlod(PassSampler, float4(Tex, 0, 8));	// approx. 8x8 block
	float4 orgi  = tex2Dlod(PassSampler, float4(Tex, 0, 0));
	float3 base  = orgi.rgb;
 
	float grey_s = ((Color.r * 0.3) + (Color.g * 0.59)) + (Color.b * 0.11);
	float3 Colorx = lerp(grey_s, Color.rgb, saturatex);
 
	float3 final = orgi * opacity + (1 - opacity) * BlendColor(orgi, Colorx);
 
	return float4(final, 1);
}
 
technique t0
<
	int group = EFFECTGROUP_POST;
	int fxclass = EFFECTCLASS_COLOR;
	int conditions = EFFECTCOND_MIPMAPS;
>
{
	pass {
		VertexShader = compile vs_3_0 FrameVS();
		PixelShader  = compile ps_3_0 ColorGrade();
	}
}
Code:
//Godrays(timely) v6.00 for Scanti's OGE(03.06.2011)
//by vtastek

/*TWEAKABLES START*/

//Number of passes for sunshafts
#define NUM_SAMPLES 35

//decrease to gain performance
//but keep in mind effect will start to break
//revealing the squarish nature of the lightshafts
//so increasing would be a better idea
//but at the exchange of performance

//Exposure(intensity) values for sunshafts
extern float globalmul = 4.5f;
extern float morningshaftex = 3.5f; //morning ray intensity
extern float eveningshaftex = 4.0f; //evening ray intensity
extern float noonshaftex = 1.5f; //afternoon ray intensity
extern float goldendecay = 0.99; //afternoon ray length
extern float moonshaftex = 0.09f; //night ray intensity experimental




//Mornings are more powerful already
//so I decreased it
//noon is for noon and moon is for nights
//you may get shafts for lightnings and moon maybe


//Morning start-end hours
extern float startsunrise = 4.0f;
extern float endsunrise = 10.0f;
//start early for sunrise

//Evening start-end hours
extern float startevening = 17.0f;
extern float endevening = 22.0f;
//end late for sunset

//ray density
extern float Density=1.99;
//actual ray visibility
extern float Weight=0.1;


//edit for light colorness, lower the value for desaturated colors...
extern float goldensaturate = 0.540f; //ray colors for golden hours
extern float noonsaturate = 0.01f; //ray colors for afternoon

//decreasing may fix blue lights


//Bright Pass values
extern float Luminance = 0.44;
extern float fMiddleGray = 0.99f;
extern float fWhiteCutoff = 0.40f; //extern float fWhiteCutoff = 0.40f;
//This shader is image based
//this step(pass) determines how much of the sky will produce godrays
//different skies may need different brightpass values

//for advancing tweaking shows the rays
extern float showraypass = 0;
extern float scalex = 2;

//shader codes begin here
matrix m44view;//matrix m44world;

float3 f3EyeForward;
float4 f4SunDir;
float2 rcpres;
static const float3 eyef = f3EyeForward;
float4 f4Time;

#define	FOVx	oblv_ProjectionFoV_MAINPASS.z
// .x - fovX rad
// .y - fovY rad
// .z - fovX deg
// .w - fovY deg
float4 oblv_ProjectionFoV_MAINPASS;

static const float3 sd = -f4SunDir.xyz;

static const float t =  tan(radians(FOVx * 0.5));
static const float3 sp = float3(0,0,0) + (f4SunDir.xyz * 999999);
static const float2 texproj = 0.5*float2(1,-rcpres.y/rcpres.x)/t;
static const float d=dot(f3EyeForward,sp);
static const float3 sunview_v=mul(sp/d,m44view);
static const float2 sunview=float2(0.5,0.5)+sunview_v.xy*texproj;
static const float sunPos = (dot(normalize(sp).xyz, m44view[2].xyz));
static const float raspect = 1.333* rcpres.x / rcpres.y;
extern float4 sunColor = float4(1, 0.71, 0.33, 1);//

float4x4 m44proj;
static const float nearZ = m44proj._43 / m44proj._33;
static const float farZ = (m44proj._33 * nearZ) / (m44proj._33 - 1.0f);
static const float Zmul = nearZ * farZ;
static const float Zdiff = farZ - nearZ;
static const float depthRange = nearZ-farZ;

//float2 sunview = (0.3,0.3);
static const float2 fsxy = float2(morningshaftex,eveningshaftex);
//static const float2 fsxy = float2(0.12,0.89);

//the golden code
static const float forward = dot(sd,eyef);


//photoshop blend modes softlight
//#define BlendSoftLightf(base, blend) 	((blend < 0.5) ? (2.0 * base * blend + base * base * (1.0 - 2.0 * blend)) : (sqrt(base) * (2.0 * blend - 1.0) + 2.0 * base * (1.0 - blend)))

texture thisframe;
texture lastpass;
texture Depth;


sampler s0 = sampler_state {
	texture=<thisframe>;

	minfilter = linear;
	magfilter = linear;
	mipfilter = linear;

	addressu = clamp;
	addressv = clamp;
};

sampler s1 = sampler_state {
	texture = <Depth>;

	MINFILTER = linear;
	MAGFILTER = linear;

	AddressU = CLAMP;
	AddressV = CLAMP;
};

sampler s2 = sampler_state {
	texture = <lastpass>;

	minfilter = linear;
	magfilter = linear;
	mipfilter = linear;
 
	addressu = clamp;
	addressv = clamp;
};

struct VSOUT
{
	float4 vertPos : POSITION;
	float2 UVCoord : TEXCOORD0;
};

struct VSIN
{
	float4 vertPos : POSITION0;
	float2 UVCoord : TEXCOORD0;
};

VSOUT FrameVS(VSIN IN)
{
	VSOUT OUT = (VSOUT)0.0f;	// initialize to zero, avoid complaints.
	OUT.vertPos = IN.vertPos;
	OUT.UVCoord = IN.UVCoord;
	return OUT;
}

/*float4 SunPosDebug(float2 TexCoord : TEXCOORD0) : COLOR0
{
	float4 black = float4(0.0, 0.0, 0.0, 1.0);
	float4 sample=tex2D(s0,TexCoord);

	float2 diff=TexCoord-sunview;
	diff.x=diff.x*diff.x;
	diff.y=diff.y*diff.y;

	float dist=diff.x+diff.y;

	if (dist>0.1)
		dist=0;
	else
		dist=0.5;

	return(lerp(sample,black,dist));
}*/
float readDepth(in float2 coord : TEXCOORD0)
{
	float posZ = tex2D(s1, coord).x;
	posZ = Zmul / ((posZ * Zdiff) - farZ);
	return posZ;
}

float3 toWorld(float2 tex)
{
    float3 v = float3(m44view[0][2], m44view[1][2], m44view[2][2]);
    v += (1/m44proj[0][0] * (2*tex.x-1)).xxx * float3(m44view[0][0], m44view[1][0], m44view[2][0]);
    v += (-1/m44proj[1][1] * (2*tex.y-1)).xxx * float3(m44view[0][1], m44view[1][1], m44view[2][1]);
    return v;
}







float4 depthskymask(VSOUT IN) : COLOR0
{

	float saat = f4Time[1];
	float dakika = f4Time[2];
	float gece = 0;
	if (saat > endevening - 1 && saat < 24 )
	{
		gece = 1;
	}

	if (saat > 0 && saat < startsunrise + 1)
	{
		gece = 1;
	}

	
		float4 black = float4(1.0, 0.0, 0.0, 0.0);
		float3 sky = 0;
		if(forward<0 && gece<0.6)
		{
			float posZ = tex2D(s1, IN.UVCoord).x;
			float depthMask = (2.0f * nearZ) / (nearZ + farZ - posZ * (farZ - nearZ));
			depthMask = step(0.99, depthMask);

			sky = tex2D(s0, IN.UVCoord).rgb * depthMask;
			sky *= fMiddleGray / ( Luminance + 0.001f );
			sky *= ( 1.0f + ( sky / ( fWhiteCutoff * fWhiteCutoff ) ) );
			sky -= 5.0f;
			sky = max( sky, 0.0f );
			sky /= ( 10.0f + sky );


		}

		return float4(sky,1.0f);
}


//lets pack data


struct GSIN
{
	float4 vertPos : POSITION0;
	float2 TexCoord : TEXCOORD0;
};

struct GSOUT
{
	float4 vertPos : POSITION;
	float2 TexCoord : TEXCOORD0;
	float2 satdecexpo :TEXCOORD1;
};

GSOUT IFLOOKVS(GSIN IN)
{
	GSOUT OUT = (GSOUT)0.0f;	// initialize to zero, avoid complaints.
	OUT.vertPos = IN.vertPos;
	OUT.TexCoord = IN.TexCoord;


	
	float saat = f4Time[1];
	float dakika = f4Time[2];
	float Exposure = 0.001;
	float saturatex = 0.550;
	float gece = 0;

	if (saat > endevening - 1 && saat < 24 )
	{
		gece = 1;
	}

	if (saat > 0 && saat < startsunrise + 1)
	{
		gece = 1;
	}



	if (saat > endevening - 1 && saat < 24 )
	{

		Exposure = moonshaftex;
		
	}

	if (saat > 0 && saat < startsunrise + 1)
	{

		Exposure = moonshaftex;
		
	}

	if (saat > startsunrise - 1 && saat < endsunrise-1 )
	{
		Exposure = morningshaftex;
		
		saturatex = goldensaturate;
	}

	if ( saat > (endsunrise - 2) && saat < endsunrise + 1 )
	{
		//float trans1 = clamp(dakika, 0,1);
		Exposure = lerp (morningshaftex, noonshaftex, float(dakika / 59));
		
		saturatex = lerp (goldensaturate, noonsaturate, float(dakika / 59));
	}

	if ( saat > endsunrise -1 && saat < startevening )
	{
		Exposure = noonshaftex;
		
		saturatex = noonsaturate;
	}

	if (saat > startevening - 1 && saat < (startevening + 1))
	{
		//float trans2 = clamp(dakika, 0,1);
		Exposure = lerp (noonshaftex, eveningshaftex, float(dakika/59));
		
		saturatex = lerp (noonsaturate, goldensaturate, float(dakika/59));
	}

	if (saat > startevening && saat < endevening )
	{
		Exposure = eveningshaftex;
		
		saturatex = goldensaturate;
	}




	OUT.satdecexpo = float2(saturatex, Exposure);
 
	return OUT;
}





float4 lightshaft(float2 TexCoord : TEXCOORD0) : COLOR0
{
 
	TexCoord *= scalex;
 
	//this is a vector!!!
	float2 DeltaTexCoord= (TexCoord - sunview.xy);
 
	//vertically, we need to adjust it according to Aspect Ratio
	float screendist = length(DeltaTexCoord * float2(1,raspect));
	DeltaTexCoord /=screendist;
 
	//sun is not a point
	float sunr = min(0.3,screendist);
 
	//float2 DeltaTexCoord = (IN.TexCoord - ScreenLightPos.xy);
 
 
    DeltaTexCoord = DeltaTexCoord * 0.5 * sunr * (1.0 / NUM_SAMPLES) * Density;
 
	float3 Color = tex2D( s2, TexCoord );
 
	float IlluminationDecay = 1.0;
 
    float2 samplepos = TexCoord;
 
	for( int i = 0; i < NUM_SAMPLES; ++i )
	{
 
		samplepos -= DeltaTexCoord;
 
		float3 Sample = tex2D( s2, samplepos );
 
		Sample *= IlluminationDecay * Weight;
		Color += Sample;
 
		IlluminationDecay *= goldendecay;
	}
 
 
	Color /=float(NUM_SAMPLES);
	//Color = saturate(Color);
 	
	return float4( Color , 1 );
}
 
 
//blurt from phal's sunshaft shader
float4 blurT( float2 Tex : TEXCOORD0 ) : COLOR0
{
 
	//clip(-forward);
 
	float4 col = tex2D(s2, Tex );
 
	float2 tangent = 1.0 * normalize((Tex-sunview)).yx*float2(rcpres.y,-rcpres.x );
 
	col += 0.67*tex2D(s2, Tex + tangent );
	col += 0.67*tex2D(s2, Tex - tangent );
	col += 0.33*tex2D(s2, Tex + 2*tangent );
	col += 0.33*tex2D(s2, Tex - 2*tangent );
	
	if (forward > 0)
		col = 0;
		
	return float4(col.rgb*0.333f,1);
 
}


float3 BlendSoftLight(float3 a, float3 b)
{
 
  float3 c = 2 * a * b * ( 1 + a * (  1 - b ) ); // 4 inst
 
  float3 a_sqrt = sqrt( a );  // 1
  float3 d = ( a  +  b * (a_sqrt - a )) * 2 - a_sqrt; // 3 inst

  return( b < 0.5 )? c : d; // 1
}

float4 SunCombine( GSOUT IN ) : COLOR0
{

  float4 Color=0;
  float shaftmask = 0;
  float4 orgi = tex2D(s0,IN.TexCoord);
  float4 shaft = tex2D(s2,IN.TexCoord/scalex)* IN.satdecexpo.y * globalmul;
  float grey_s = ((shaft.r * 0.3) + (shaft.g * 0.59)) + (shaft.b * 0.11);
  Color = lerp(grey_s, shaft, IN.satdecexpo.x);
 
  
  
  shaftmask *= -forward;
  Color.xyz = orgi + shaft.xyz *(-forward) * sunColor.rgb * ( 1 - orgi );
  Color.xyz = BlendSoftLight(Color, (sunColor.rgb *3.33 * shaftmask * 2 * 0.5 + 0.5));
  Color.w = 1;
  return Color;
}


technique t0
<
	int group = EFFECTGROUP_MAIN;
	int fxclass = EFFECTCLASS_LIGHT;
	int conditions = EFFECTCOND_ZBUFFER /*| EFFECTCOND_HASSUN*/;
>
{
/*
	pass debug {
		//VertexShader = compile vs_1_1 FrameVS();
		PixelShader = compile ps_2_0 SunPosDebug();
	}
*/
 
	pass {
	VertexShader = compile vs_1_1 FrameVS();
	PixelShader = compile ps_2_0 depthskymask(); }
 
	pass {
	VertexShader = compile vs_3_0 FrameVS();
	Pixelshader = compile ps_3_0 lightshaft(); }
 
	pass {
	VertexShader = compile vs_1_1 FrameVS();
	Pixelshader = compile ps_2_0 blurT(); }
 
	pass {
	VertexShader = compile vs_1_1 IFLOOKVS();
	Pixelshader = compile ps_2_0 SunCombine(); }
 
}
 
/*eof*/
Code:
/* HLSL Bleach Bypass from Nvidia Shader Library
 * by vtastek
 * This effect is very common in cinematography
 * mixing a black-white version of an image with original
 * creates a powerful chroma look which looks saturated with high contrast.
 * can be mixed with color mood
 */
 
// ---------------------------------------
// TWEAKABLE VARIABLES.
 
 
// change below variable to adjust power
extern float Opacity = 0.5;
 
 
// END OF TWEAKABLE VARIABLES.
// ---------------------------------------
 
texture obge_LastRendertarget0_EFFECTPASS;
 
sampler PassSampler = sampler_state {
	texture = <obge_LastRendertarget0_EFFECTPASS>;
 
	AddressU = CLAMP;
	AddressV = CLAMP;
 
	MINFILTER = POINT;
	MAGFILTER = POINT;
	MIPFILTER = NONE;
};
 
struct VSOUT
{
	float4 vertPos : POSITION;
	float2 UVCoord : TEXCOORD0;
};
 
struct VSIN
{
	float4 vertPos : POSITION0;
	float2 UVCoord : TEXCOORD0;
};
 
VSOUT DummyVS(VSIN IN) {
	VSOUT OUT = (VSOUT)0.0f;	// initialize to zero, avoid complaints.
	OUT.vertPos = IN.vertPos;
	OUT.UVCoord = IN.UVCoord;
	return (OUT);
}
 
float4 HLSLbleachbypass(float2 Tex : TEXCOORD0) : COLOR0 {
	float4 base = tex2D(PassSampler, Tex.xy);
	float3 lumCoeff = float3(0.25, 0.65,0.1);
	float lum = saturate(dot(lumCoeff, base.rgb));
	float L = saturate(10 * (lum - 0.45));
	float3 result1 = min(2.0f * base.rgb * lum, 65504);
	float3 result2 = 1.0f - 2.0f * (1.0f - lum) * (1.0f - base.rgb);
	float3 newColor = lerp(result1, result2, L);
	float3 mixRGB = lerp(base.rgb, newColor.rgb, Opacity);
 
	return float4(mixRGB,1);
}
 
 
technique t0
<
	int group = EFFECTGROUP_POST;
	int fxclass = EFFECTCLASS_COLOR;
>
{
	pass p0 {
		VertexShader = compile vs_1_1 DummyVS();
		PixelShader = compile ps_2_0 HLSLbleachbypass();
	}
}
 
/*eof*/
Code:
///////////////////////////////////////////////////////////////////////////
////////////////////////// NORMAL Filter AA SHADER ////////////////////////
///////////////////////////////////////////////////////////////////////////
 
// The Normal Filter Anti Aliasing (NFAA) shader attempts to reduce obvious
// alising by searching for contrasting luminosity changes in the final
// render image. It then builds a normal displament map to apply a
// per-pixel blur filter in high contrast alised areas.
 
// Based on Styves implimentation at GemeDev.net
// http://www.gamedev.net/community/forums/topic.asp?topic_id=580517
 
// OBGEv2 port by Dracusis aka Cameron Owen
// Version 1.1 2010/10/29
 
///////////////////////////////////////////////////
// EDIT THE VALUES BELOW TO CUSTOMISE THE FILTER //
///////////////////////////////////////////////////
 
// Filter Strength Adjusts the overall power of the filter.
// Values in the range of 0.5 to 1.5 should provide good results without
// blurring the overal image too much. Anything higher will also likely
// cause ugly blocky or spikey artifacts.
// Default Value = 1.0;
 
extern float filterStrength = 0.2;
 
 
// Filter Spread controls how large an area the filter tries to sample
// and fix aliasing within. This has a direct relationship to the angle
// of lines the filter can smooth well. A 45 degree line will be perfectly
// alised with a spread of 2.0, steeper lines will need higher
// values. The tradeoff for setting a high spread value is the overall
// softness of the image. Values between 2.0 and 5.0 work best.
// Default Value = 3.0;
 
extern float filterSpread = 2.0;
 
// This adjusts whether or not the filter works on pixel color or pixel
// luminance. Using pixel color gives better results with lower
// contrasting aliasing areas but can over soften the whole scene a bit.
// Set to false to use pixel luminance method if you're only concerned
// with high contrast aliasing or if you find the colour version
// makes everything too blurry.
// Default Value = true;
 
#define USE_COLOR
 
// Set Debug to true to see the normal map used to apply the blur filter.
// Use this with the OBSE.ini bRenderHalfScreen=1 setting to get a feel
// for how the filter works. Default Value = false;
 
#undef	TEST_MODE
 
 
////////////////////////////////////////
// DO NOT EDIT VALUES PAST THIS POINT //
////////////////////////////////////////
 
///////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
 
#define	rcpres	oblv_ReciprocalResolution_MAINPASS.xy
// .x - 1 / width
// .y - 1 / height
// .z - width / height
// .w - width * height
float4 oblv_ReciprocalResolution_MAINPASS;
 
 
texture  obge_LastRendertarget0_EFFECTPASS;
 
sampler FrameSampler = sampler_state {
	texture = <obge_LastRendertarget0_EFFECTPASS>;
 
	AddressU = CLAMP;
	AddressV = CLAMP;
 
	MINFILTER = LINEAR;
	MAGFILTER = LINEAR;
	MIPFILTER = NONE;
};
 
///////////////////
// VERTEX SHADER //
///////////////////
 
struct VSOUT
{
	float4 vertPos : POSITION;
	float2 UVCoord : TEXCOORD0;
};
 
struct VSIN
{
	float4 vertPos : POSITION0;
	float2 UVCoord : TEXCOORD0;
};
 
VSOUT FrameVS(VSIN IN)
{
	VSOUT OUT = (VSOUT)0.0f;	// initialize to zero, avoid complaints.
	OUT.vertPos = IN.vertPos;
	OUT.UVCoord = IN.UVCoord;
	return OUT;
}
 
 
//////////////////
// PIXEL SHADER //
//////////////////
 
 
// Luminance Conversion
float GetColorLuminance( float3 i_vColor ) {
	return dot( i_vColor, float3( 0.2126f, 0.7152f, 0.0722f ) );
}
 
float2 findContrastByLuminance(float2 XYCoord, float filterStrength2) {
 
	// Normal offsets, scale by filter spread
	float2 upOffset    = float2(0, rcpres.y) * filterSpread;
	float2 rightOffset = float2(rcpres.x, 0) * filterSpread;
 
	float topHeight         = GetColorLuminance( tex2D( FrameSampler, XYCoord +               upOffset).rgb );
	float bottomHeight      = GetColorLuminance( tex2D( FrameSampler, XYCoord -               upOffset).rgb );
	float rightHeight       = GetColorLuminance( tex2D( FrameSampler, XYCoord + rightOffset           ).rgb );
	float leftHeight        = GetColorLuminance( tex2D( FrameSampler, XYCoord - rightOffset           ).rgb );
	float leftTopHeight     = GetColorLuminance( tex2D( FrameSampler, XYCoord - rightOffset + upOffset).rgb );
	float leftBottomHeight  = GetColorLuminance( tex2D( FrameSampler, XYCoord - rightOffset - upOffset).rgb );
	float rightBottomHeight = GetColorLuminance( tex2D( FrameSampler, XYCoord + rightOffset + upOffset).rgb );
	float rightTopHeight    = GetColorLuminance( tex2D( FrameSampler, XYCoord + rightOffset - upOffset).rgb );
 
	// Normal map creation
	float sum0 = rightTopHeight    + bottomHeight + leftTopHeight;
	float sum1 = leftBottomHeight  + topHeight    + rightBottomHeight;
	float sum2 = leftTopHeight     + rightHeight  + leftBottomHeight;
	float sum3 = rightBottomHeight + leftHeight   + rightTopHeight;
 
	// Subtract the opposite sample set for final vectors
	float vec1 = (sum0 - sum1) * filterStrength2;
	float vec2 = (sum3 - sum2) * filterStrength2;
 
	float2 Vectors = float2(vec1,vec2);
 
	return  Vectors;
 
}
 
float2 findContrastByColor(float2 XYCoord, float filterStrength2) {
 
	// Normal offsets, scale by filter spread
	float2 upOffset    = float2(0, rcpres.y) * filterSpread;
	float2 rightOffset = float2(rcpres.x, 0) * filterSpread;
 
	float3 topHeight         = tex2D( FrameSampler, XYCoord +               upOffset).rgb;
	float3 bottomHeight      = tex2D( FrameSampler, XYCoord -               upOffset).rgb;
	float3 rightHeight       = tex2D( FrameSampler, XYCoord + rightOffset           ).rgb;
	float3 leftHeight        = tex2D( FrameSampler, XYCoord - rightOffset           ).rgb;
	float3 leftTopHeight     = tex2D( FrameSampler, XYCoord - rightOffset + upOffset).rgb;
	float3 leftBottomHeight  = tex2D( FrameSampler, XYCoord - rightOffset - upOffset).rgb;
	float3 rightBottomHeight = tex2D( FrameSampler, XYCoord + rightOffset + upOffset).rgb;
	float3 rightTopHeight    = tex2D( FrameSampler, XYCoord + rightOffset - upOffset).rgb;
 
	// Normal map creation
	float3 sum0 = rightTopHeight    + bottomHeight + leftTopHeight;
	float3 sum1 = leftBottomHeight  + topHeight    + rightBottomHeight;
	float3 sum2 = leftTopHeight     + rightHeight  + leftBottomHeight;
	float3 sum3 = rightBottomHeight + leftHeight   + rightTopHeight;
 
	// Subtract the opposite sample set for final vectors
	float vec1 = length(sum0 - sum1) * filterStrength2;
	float vec2 = length(sum3 - sum2) * filterStrength2;
 
	float2 Vectors = float2(vec1,vec2);
 
	return  Vectors;
 
}
 
float4 NormalAAPS(VSOUT IN) : COLOR0 {
 
	float filterStrength2 = filterStrength + (filterSpread/2);
 
#ifdef USE_COLOR
	// Find Contrast By Colour
	float2 Vectors = findContrastByColor(IN.UVCoord.xy, filterStrength2);
#else
	// Find Contrast By Luminance
	float2 Vectors = findContrastByLuminance(IN.UVCoord.xy, filterStrength2);
#endif
 
	float filterClamp = filterStrength2/filterSpread;
 
	Vectors.xy = clamp(Vectors, -float2(filterClamp,filterClamp), float2(filterClamp,filterClamp));
 
	float2 Normal = float2(Vectors.x,Vectors.y) * rcpres;
//	Normal.xy *= 2;
 
	float4 Scene0 = tex2D( FrameSampler, IN.UVCoord.xy );
	float4 Scene1 = tex2D( FrameSampler, IN.UVCoord.xy + Normal.xy );
	float4 Scene2 = tex2D( FrameSampler, IN.UVCoord.xy - Normal.xy );
	float4 Scene3 = tex2D( FrameSampler, IN.UVCoord.xy + float2(Normal.x, -Normal.y) );
	float4 Scene4 = tex2D( FrameSampler, IN.UVCoord.xy - float2(Normal.x, -Normal.y) );
 
	// Final color
	float4 o_Color = (Scene0 + Scene1 + Scene2 + Scene3 + Scene4) * 0.2;
 
#ifdef	TEST_MODE
	// Debug Output
	o_Color.xyz = normalize(float3(Vectors.x, Vectors.y, 1) * 0.5 + 0.5);
#endif
 
	return o_Color;
 
}
 
 
 
///////////////////
// RENDER PASSES //
///////////////////
 
technique t0
<
	int group = EFFECTGROUP_PRE;
	int fxclass = EFFECTCLASS_NEUTRAL;
>
{
	pass p0 {
		VertexShader = compile vs_3_0 FrameVS();
		PixelShader  = compile ps_3_0 NormalAAPS();
	}
}
Code:
// Volumetric SSAO
// Implemented by Tomerk
// Optimized by Ethatron

// ---------------------------------------
// TWEAKABLE VARIABLES.


#undef	TEST_MODE
// testMode. set to 1, you can see the raw ssao

#define LUMINANCE_CONSIDERATION
extern float luminosity_threshold = 0.3;
// comment this line to not take pixel brightness into account

#define N_SAMPLES	9
// number of samples, currently do not change.

extern float aoRadiusMultiplier = 2;
// Linearly multiplies the radius of the AO Sampling

extern float aoStrengthMultiplier = 1.0;
// Linearly multiplies the strength of the AO

extern float aoClamp = 0.5;
// The maximum strength of the AO, 0 is max strength, 1 is weakest

extern float ThicknessModel = 100;
// units in space the AO assumes objects' thicknesses are

extern float2 fogParams = float2( 8000, 20500 );

// END OF TWEAKABLE VARIABLES.
// ---------------------------------------


#include "includes/Random.hlsl"
#include "includes/Depth.hlsl"
#define	irangeZ	-oblv_ProjectionDepthRange_MAINPASS.z

#define	rcpres		oblv_ReciprocalResolution_MAINPASS
#define	aspect		(oblv_ReciprocalResolution_MAINPASS.z)
#define	raspect		(1.0 / aspect)
// .x - 1 / width
// .y - 1 / height
// .z - width / height
// .w - width * height
float4 oblv_ReciprocalResolution_MAINPASS;

#define	FOV	oblv_ProjectionFoV_MAINPASS.x
// .x - fovX rad
// .y - fovY rad
// .z - fovX deg
// .w - fovY deg
float4 oblv_ProjectionFoV_MAINPASS;


texture obge_LastRendertarget0_EFFECTPASS;

sampler PassSamplerL = sampler_state
{
	texture = <obge_LastRendertarget0_EFFECTPASS>;

	AddressU = CLAMP;
	AddressV = CLAMP;

	MINFILTER = LINEAR;
	MAGFILTER = LINEAR;
};

struct VSOUT
{
	float4 vertPos : POSITION;
	float2 UVCoord : TEXCOORD0;
};

struct VSIN
{
	float4 vertPos : POSITION0;
	float2 UVCoord : TEXCOORD0;
};

VSOUT FrameVS(VSIN IN)
{
	VSOUT OUT = (VSOUT)0.0f;	// initialize to zero, avoid complaints.

	OUT.vertPos = IN.vertPos;
	OUT.UVCoord = IN.UVCoord;

	return OUT;
}

static const float2 g_InvFocalLen = {
	tan(0.5f * FOV) * raspect,
	tan(0.5f * FOV)
};

static float2 sample_offset[N_SAMPLES] =
{
//#if N_SAMPLES >= 9
	float2(-0.1376476f,  0.2842022f ),
	float2(-0.626618f ,  0.4594115f ),
	float2(-0.8903138f, -0.05865424f),
	float2( 0.2871419f,  0.8511679f ),
	float2(-0.1525251f, -0.3870117f ),
	float2( 0.6978705f, -0.2176773f ),
	float2( 0.7343006f,  0.3774331f ),
	float2( 0.1408805f, -0.88915f   ),
	float2(-0.6642616f, -0.543601f  )
//#endif
};

static float sample_radius[N_SAMPLES] =
{
//#if N_SAMPLES >= 9
	0.948832,
	0.629516,
	0.451554,
	0.439389,
	0.909372,
	0.682344,
	0.5642,
	0.4353,
	0.5130
//#endif
};

float3 getPosition(in float2 uv, in float eye_z) {
	uv = (uv * float2(2.0, -2.0) - float2(1.0, -1.0));
	float3 pos = float3(uv * g_InvFocalLen * eye_z, eye_z);
	return pos;
}

float4 Occlusion(VSOUT IN) : COLOR0 {
	float3 sample = tex2D(PassSamplerL, IN.UVCoord).rgb;
	float depth = LinearDepth(IN.UVCoord);

	[branch]
	if (depth >= 0.99)
		return float4(sample, 1.0);

	float3 pos = getPosition(IN.UVCoord, depth);
	float3 dx = ddx(pos);
	float3 dy = ddy(pos);
	float3 norm = normalize(cross(dx, dy));
	norm.y *= -1;

	float sample_depth;

	float ao = 0;
	float s = 0.0;

	float2 rand_vec = rand_2_10(IN.UVCoord);
	float2 sample_vec_divisor = g_InvFocalLen * depth * irangeZ / (aoRadiusMultiplier * 5000 * rcpres);
	float2 sample_center = IN.UVCoord + norm.xy / sample_vec_divisor * float2(1, aspect);
	float sample_center_depth = depth * irangeZ + norm.z * aoRadiusMultiplier * 10;

	[unroll]
	for (int i = 0; i < N_SAMPLES; i++) {
		float2 sample_vec = reflect(sample_offset[i], rand_vec) / sample_vec_divisor;
		float2 sample_coords = sample_center + sample_vec * float2(1, aspect);

		float curr_sample_radius = sample_radius[i] * aoRadiusMultiplier * 10;
		float curr_sample_depth = irangeZ * LinearDepth(sample_coords);

		ao += clamp(0, curr_sample_radius + sample_center_depth - curr_sample_depth                 , 2 * curr_sample_radius);
		ao -= clamp(0, curr_sample_radius + sample_center_depth - curr_sample_depth - ThicknessModel, 2 * curr_sample_radius);

		s += 2 * curr_sample_radius;
	}

	ao /= s;

	float fogNear = min( fogParams.x, 8000 );
	float fogFar = min( fogParams.y, 20500 );
	if (depth * irangeZ >= fogNear )
		ao *= saturate(lerp(1, 0, (depth * irangeZ - fogNear) / (fogFar-fogNear) ));

	ao = 1.0 - ao * aoStrengthMultiplier;

	return float4(sample, ao);
}

float4 Blur(VSOUT IN) : COLOR0 {
	float4 sample = tex2D(PassSamplerL, IN.UVCoord).rgba;
	float ao = sample.a * 4;

	ao += tex2D(PassSamplerL, IN.UVCoord + float2( rcpres.x, 0)).a * 2;
	ao += tex2D(PassSamplerL, IN.UVCoord + float2(-rcpres.x, 0)).a * 2;
	ao += tex2D(PassSamplerL, IN.UVCoord + float2(0,  rcpres.y)).a * 2;
	ao += tex2D(PassSamplerL, IN.UVCoord + float2(0, -rcpres.y)).a * 2;

	ao += tex2D(PassSamplerL, IN.UVCoord + rcpres                ).a;
	ao += tex2D(PassSamplerL, IN.UVCoord - rcpres                ).a;
	ao += tex2D(PassSamplerL, IN.UVCoord + rcpres * float2(1, -1)).a;
	ao += tex2D(PassSamplerL, IN.UVCoord - rcpres * float2(1, -1)).a;

	ao /= 16;
	sample.a = ao;

	return sample;
}

float4 Combine(VSOUT IN) : COLOR0 {
	float4 sample = tex2D(PassSamplerL, IN.UVCoord).rgba;
	float3 color = sample.rgb;
	float ao = sample.a;

#ifdef LUMINANCE_CONSIDERATION
	float luminance = color.r * 0.3 + color.g * 0.59 + color.b * 0.11;
	float white = 1.0;
	float black = 0;

	luminance = clamp(
		max(black, luminance - luminosity_threshold) +
		max(black, luminance - luminosity_threshold) +
		max(black, luminance - luminosity_threshold), 0.0, 1.0);

	ao = lerp(ao, white, luminance);
#endif

	color *= ao;

#ifdef	TEST_MODE
	return ao;
#endif

	return float4(color, 1);
}

technique t0
<
	int group = EFFECTGROUP_PRE;
	int fxclass = EFFECTCLASS_AO;
	int conditions = EFFECTCOND_ZBUFFER;
>
{
	pass {
		VertexShader = compile vs_3_0 FrameVS();
		PixelShader  = compile ps_3_0 Occlusion();
	}

	pass {
		VertexShader = compile vs_3_0 FrameVS();
		PixelShader  = compile ps_3_0 Blur();
	}

	pass {
		VertexShader = compile vs_3_0 FrameVS();
		PixelShader  = compile ps_3_0 Combine();
	}
}
Die Threadverantwortlichen können die ja in den Startpost übertragen, falls gewünscht.
 
Zuletzt bearbeitet:
Ja, keine Komplikationen

Evtl. macht das "Prallax Occlusion Mapping" etwas andere Artefakte als mit Vanilla Normals. Genaues kann ich dazu aber nicht sagen da ich das "POM" nciht mit den Detailled Normals zusammen verwendet habe
 
Zuletzt bearbeitet:
  • Like
Reaktionen: der dunkelfürst
Hi, ich habe seit geraumer Zeit versucht den OBGE zu installieren, doch immer wieder passierten bei mir unerwartete Abstürze oder es lief erst garnicht, auch die readme hat mir nicht sonderlich helfen können...
Hier meine Frage:
- Was muss ich alles installieren?
- Ich möchte die Shader so einstallen, dass alles möglichst karg bleibt, keine übertrieben beleuchtung während des tages

Danke im Voraus
 
Haaai!

Ich benutze obge 3.0.1 (die neuste zumindest) als Standalone Version mit diesem misc Item ingame. Aber...wie kann ich AA und gleichzeitig obge ermöglichen? Kann mir da jemand helfen? :(


UND bei der Gelegenheit:

Habe ich ein großes Problem mit der Mod. Bei einigen Grafikeinstellungen wie zb bei dem SSAO Zeug. Wenn ich sowas anmache, wird der ganze Bildschrim schwarz während sich ein hauchdünner, diagonaler Strich durchs Bild zieht. Wenn ich haarscharf nach oben sehe ist alles wieder normal. Aber wehe ich verschiebe die Kamera wieder einen Pixel nach unten...dann wird alles wieder schwarz. Hääälp Q_Q
 
Zuletzt bearbeitet: