Bloom Effect in D3D8
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
I recently wrote about Direct3D hooking. You can get my sample code and a brief discussion here (It's DX 9, but the code can easily be ported to DX 8).
Your task sounds entirely achievable, but you'll need to work a little harder. In particular, you'll probably have to hook IDirect3DDevice9::Clear and make a call to SetRenderTarget so as to draw the clean render to a render-texture. The work would then need to be done in IDirect3DDevice9::Present or IDirect3DSwapChain::Present accordingly. Don't forget to implement the hooks to deal with a lost device, too.
Your task sounds entirely achievable, but you'll need to work a little harder. In particular, you'll probably have to hook IDirect3DDevice9::Clear and make a call to SetRenderTarget so as to draw the clean render to a render-texture. The work would then need to be done in IDirect3DDevice9::Present or IDirect3DSwapChain::Present accordingly. Don't forget to implement the hooks to deal with a lost device, too.
Yeah, thanks, as I said I already hooked the device, but I tried to draw the "hook successful" text, and yeah it worked :)
Guess I now have to learn some more DirectX basics, but my problem is: All of those bloom effect tutorials use some sort of HLSL shader..
Does Direct3D8 support HLSL? If not, would there be some way to convert those shaders.. sorry, Im really a newbie ;)
Guess I now have to learn some more DirectX basics, but my problem is: All of those bloom effect tutorials use some sort of HLSL shader..
Does Direct3D8 support HLSL? If not, would there be some way to convert those shaders.. sorry, Im really a newbie ;)
You can use the DirectX 9 SDK's HLSL compiler (fxc) to produce a shader program that Direct3D 8 can load. I think.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement