Rendering To floating point render target
#1
Posted 12 December 2008 - 03:01 AM
I'm trying to render a scene to a floating point render target, I have functions to decode and all, but I don't know how to create a render target of say D3DFMT_A16B16G16R16F or setting it to RGBE8. Can someone help me?
EDIT: forgot to mention, I'm using DirectX9
#2
Posted 12 December 2008 - 04:50 AM
LPDIRECT3DTEXTURE9 texture; LPDIRECT3DSURFACE9 surface; d3ddev->CreateTexture(sizeX,sizeY,1,D3DUSAGE_RENDERTARGET,D3DFMT_A16B16G16R16F,D3DPOOL_DEFAULT,&texture,NULL); texture->GetSurfaceLevel(0,&surface);
keep in mind though that not all cards fully support floating point render targets. What kind of card are you using? Any relativley modern card should work.
(='.'=) This is Bunny. Copy and paste bunny into
(")_(") your signature to help him gain world domination.
bunny also wants to fight spam: Click Here Bots!
#3
Posted 12 December 2008 - 05:28 AM
Thanks for the reply and help. Using the D3DUSAGE_RENDERTARGET enum will acutomatically set it as the render target? Because I'm working on an HDR app and I need to render to a floating point texture and then I will tone map etc then convert it back to an integer value texture.
Also, I am aware some cards don't support floating point textures, I use the D3DCAPS9 structure to check before intialising :)
#4
Posted 12 December 2008 - 05:39 AM
Phlex said:
Phlex said:
(='.'=) This is Bunny. Copy and paste bunny into
(")_(") your signature to help him gain world domination.
bunny also wants to fight spam: Click Here Bots!
#5
Posted 12 December 2008 - 05:50 AM
I thought that after tone mapping, you had to convert back to an integer value texture?? Could you please explain the last part?
#6
Posted 12 December 2008 - 06:10 AM
Phlex said:
nope, should display fine on the moniter. Converting it back would just be an extra rendering pass. All the color values must be between 1 and 0 on the screen, but thats done automaticly by the graphics card and manually converting it back would just be a waste of resources.
All you need to do to display it is set up 2 polygons on the screen to make a square in 2D space (so their coordinates would be
(0,0)
(screenwidth, 0)
(0, screenheight)
(screenwidth, screenheight)
If you've programed in 2D I'm sure you've made 2D quads before. Then just set the render target as the texture and draw away.
(='.'=) This is Bunny. Copy and paste bunny into
(")_(") your signature to help him gain world domination.
bunny also wants to fight spam: Click Here Bots!
#7
Posted 12 December 2008 - 06:29 AM
Thanks
#8
Posted 12 December 2008 - 06:44 AM
#9
Posted 12 December 2008 - 10:50 AM
render to floating point texture
downsize to new texture and surface and keep the first render there
calculate measured Luminance
bright pass the downsized texture using the measuered Lumminance
bloom filter the above result
upsize the bloomed texture
compose the bloomed texture and the first render pass
????
#10
Posted 12 December 2008 - 03:02 PM
The only thing I would be careful of is, how are you planning to extract the luminance? If you lock the texture, that's really not a good idea. Personally what I do is about 3 passes, which each one progressivley smaller, of downsampling the rendered scene untill its only 1x1 pixel.
Then I render the 1x1 texture onto a non-opaque background, so the result of the eye adaption is not instant (you get a smooth fade transition effect). The next step is to take that and just stretch it back over the final image, like you do with the bloom image, and use a multiplication style blending.
Above all though, just avoid locking it, it's easy to cause stalls in your engine by doing so.
(='.'=) This is Bunny. Copy and paste bunny into
(")_(") your signature to help him gain world domination.
bunny also wants to fight spam: Click Here Bots!
#11
Posted 12 December 2008 - 05:22 PM
What do you mean when you render the 1x1 texture onto a non-opaque background?
#12
Posted 12 December 2008 - 05:58 PM
#13
Posted 13 December 2008 - 01:59 AM
#14
Posted 13 December 2008 - 03:49 AM
Reedbeta said:
(='.'=) This is Bunny. Copy and paste bunny into
(")_(") your signature to help him gain world domination.
bunny also wants to fight spam: Click Here Bots!
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users












