Jump to content

  • Log In with Google      Sign In   
  • Create Account

w0dk4

Member Since 28 Nov 2007
Offline Last Active Feb 23 2012 03:15 PM

Topics I've Started

Detect/Prevent forced AA through driver

09 February 2012 - 09:38 PM

Hey there,

my problem is that I am coding a deferred renderer on Direct3D9 and when you force Anti Aliasing through the driver, nothing gets rendered for obvious reason,

Is there a best practice to prevent this behaviour? Or if it is not possible to prevent, how could I detect if AA is forced?
Direct3D does not seem to throw any errors...

Mysterious gaussian blur for bloom shader going wrong...

24 April 2010 - 10:49 AM

Hello there,

I have a very weird problem where I really doubt wether Im seeing things clearly, so please have a look if Im doing something obviously wrong here.

So, I got a scene rendered to the backbuffer, I stretchrect it to a 4 times smaller texture.
Now I apply a brightpass, rendering to a new texture of the same size:



So, now I'll apply the following gaussian blur, as found on many sources on the internet, to blur the texture, in order for the highlighted parts to shine over the X-Wings front. Only that it does the exact opposite, it actually blurs inwards:

float g_blurRadiusX;
float g_blurRadiusY;

static const int kernelSize = 9;

//Blur Weights
static const float BlurWeights[kernelSize] = 
{
	0.05f,
	0.09f,
	0.12f,
	0.15f,
	0.16f,
	0.15f,
	0.12f,
	0.09f,
	0.05f
}; 

float4 BlurH_PS( VS_OUTPUT In ) : COLOR0
{ 
	
	float4 color = 0;
    float2 texCoord = In.TextureUV;

    for (int i = 0; i < kernelSize; i++)
    {    
		texCoord.x = In.TextureUV.x + ((i-4)*g_blurRadiusX);
		color += tex2D(Tex0Sampler, texCoord) * BlurWeights[i];
    }

    return color;
}

float4 BlurV_PS( VS_OUTPUT In ) : COLOR0
{ 
	
	float4 color = 0;
    float2 texCoord = In.TextureUV;

	for (int i = 0; i < kernelSize; i++)
    {    
		texCoord.y = In.TextureUV.y + ((i-4)*g_blurRadiusY);
		color += tex2D(Tex0Sampler, texCoord) * BlurWeights[i];
    }

    return color;
}



(blurRadiusX is 1/TexWidth and so on)



Anybody might have any idea on whats going on here?

A note: After I rendered the brightpass, I use the downsample texture as a rendertarget, and so on. So I dont always create a new texture, but reuse the old ones, after Clearing them with 0 0 0 0.

Bloom Effect in D3D8

28 November 2007 - 03:22 AM

Hi there, I'm currently looking for a way to add a bloom effect to an older Direct3D8 game (Freelancer if your interested). I hooked the d3d8.dll interface and my idea is to apply the effect on the Device->Present(..) hook (I know, that way also the menus and fonts and whatsoever will get bloom, but well, bloom everywhere better then no bloom at all^^). First question: Is such an effect actually doable with the Direct3D8 interface? I read some tutorials that render the scene to a texture, then apply a shader that darkens and then blurs the picture, and then re-applies it to the backbuffer... or something like that ;) Since Im a complete DirectX noob I would be glad for any code examples on how to do that with Direct3D8. thanks in advance w0dk4

PARTNERS