Streaking glow with a DX8 Pixel Shader

Started by
3 comments, last by Battagline 18 years, 11 months ago
I am attempting to create a streaking glow effect using ps1.1 in DirectX 8. I have created a glow effect using a gaussian blur on a second "glow" surface that I blend with my main back surface. Here's my current glow effect: Epoch Star - Sci-Fi Space Adventure If I don't clear my glow surface every frame, I get a streaking effect like this: Epoch Star - Sci-Fi Space Adventure This creates an interesting streaking effect. The only problem with it, is that eventually the glowing takes up the entire screen and you have a completely white screen. What I would like to do is every frame cut the brightness of each pixel in half. That way, there is a streak effect that doesn't eventually fill the entire screen with white. I created a pixel shader and rendered the glow texture to itself in an attempt to do this. Here is the pixel shader code:

ps.1.1
def c0, 0.4, 0.4, 0.4, 0.4
tex t0
mul r0, t0, c0


I then render a screen size quad back to the same glow texture, having set both the render target and the texture to the glow texture. Here's the code:

	g_pDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, FALSE );
	g_pDevice->SetRenderTarget( g_pGlowSurface, NULL ); 
	g_pDevice->SetTexture( 0, g_pGlowSurfaceTexture );
	g_pDevice->SetPixelShader( g_ResourceManager->m_dwReduceShaderPS );
	g_pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN,0,2);


Howevever, I don't get the reduced color that I was looking for. Here's a few screen shots to show you what happens: Epoch Star - Sci-Fi Space RPG Epoch Star - Sci-Fi Space RPG As you can see, the screen still fills with a white color... however, the color is at least somewhat transparent. Does anyone know what I'm doing wrong? Thanks [Edited by - Battagline on May 14, 2005 5:58:21 PM]
Advertisement
I believe what you're trying to achieve is better achieved with the rendering of a alpha blended black quad that is as big as the screen.
Quote:Original post by Anonymous Poster
I believe what you're trying to achieve is better achieved with the rendering of a alpha blended black quad that is as big as the screen.


I am using a screen sized quad to render my texture to the screen if that's what your saying. The problem is, I'm not sure why my pixel shader isn't reducing the brightness of that quad. I guess I could render another black quad with an alpha channel over top of this, but I'd rather just do it in the shader if I can.
Maybe it's cause you're rendering to a surface from the texture that you're using? Maybe it'll work if you have 2 textures? (i don't know much about shaders - so just a sugestion)
Quote:Original post by Axiverse
Maybe it's cause you're rendering to a surface from the texture that you're using? Maybe it'll work if you have 2 textures? (i don't know much about shaders - so just a sugestion)


Someone on a different forum told me that I can't do this (rendering to the surface of the texture I'm using). So, I've shelfed the glow for the moment to pursue another problem I'm having. When I get back to it, I'll try it with 2 textures.

This topic is closed to new replies.

Advertisement