• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
execom_rt

Problem when rendering transparent objects into a floating point target on ATI

8 posts in this topic

Using an ATI Radeon 9800, Catalyst 5.9, Windows XP. When using D3DRS_ALPHABLENDENABLE when rendering into a floating point texture, transparency is disabled. Which is a quite a bugger, if you want to render lens flares or particles in HDR. To reproduce the bug (see below). - In the DirectX 9.0c SDK, Open $DXSDK\Samples\C++\Direct3D\HDRLighting project. - In the function 'RenderScene' (around line 1305), add g_pd3dDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, TRUE); g_pd3dDevice->SetRenderState( D3DRS_SRCBLEND, D3DBLEND_ONE); g_pd3dDevice->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_ONE); and restore the blending state a the end of the function g_pd3dDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, FALSE); - Recompile and start, the scene (pillars) should be transparents. On my machine, it is not. - To see, the correct way, changes in line 724 '//Create the HDR scene texture' and changes the parameter of the CreateTexture from D3DFMT_A16B16G16R16F to D3DFMT_A8R8G8B8. - Run again, the scene is transparent as expected. Can people reproduce on nVidia or other platforms ? Is it a limitation of rendering into floating point textures ? Cheers;
0

Share this post


Link to post
Share on other sites
The early FP-capable cards can't do floating-point blending. The newer Geforces (7xxx) can, I can't say for sure about ATI cards.

You can check the texture formats suitable for blending by using CheckDeviceFormat() and querying for D3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING. The SDK warns that you should except this to fail for any floating-point formats (even though it works on the new cards).
0

Share this post


Link to post
Share on other sites
I don't think it's really hardware limited.

Doing a render into a texture with OpenGL, using an internal format of GL_RGB16F_ARB and texture_type GL_FLOAT, with transparent objects works on the same video card ...

[EDIT] :

D3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING is only for alpha blending in a pixel shader. This is not my case. I don't use pixel shader (just plain render to a texture).
0

Share this post


Link to post
Share on other sites
Nevertheless, I've been told it is a hardware limitation and the query I mentioned best describes it on D3D9. Do correct me if you find that I'm actually wrong though [smile]

You could contact ATI dev department about this, if you want to be absolutely sure. I've done that with NVidia.

OpenGL is generally more loose on the capabilities than D3D, because the card manufacturers do not need to adhere to as strict specifications with extensions as with D3D. This is both the greatest strength and the biggest failure of OpenGL, in my opinion.
0

Share this post


Link to post
Share on other sites
I've contacted ATI, and waiting their answer. At least, it easy to reproduce.

The weird thing, as I said before, is that you can do it in OpenGL, but not in DirectX 9 :

I've ported the HDR lighting DirectX 9.0 demo to OpenGL 2.0, but it is running slower compared to DX9, but transparency is working in OpenGL (maybe it's emulated behind the scenes ?)

Finally, running the program with DX9 Debug Runtime, with maximum debug output, shows not warning or error when trying to uses ALPHABLENDENABLE during a render into a fp texture : I was expecting an error like 'unsupported', instead of silently reporting nothing.

Cheers;
0

Share this post


Link to post
Share on other sites
Quote:
Original post by execom_rt
I've contacted ATI, and waiting their answer. At least, it easy to reproduce.

The weird thing, as I said before, is that you can do it in OpenGL, but not in DirectX 9 :

I've ported the HDR lighting DirectX 9.0 demo to OpenGL 2.0, but it is running slower compared to DX9, but transparency is working in OpenGL (maybe it's emulated behind the scenes ?)

Finally, running the program with DX9 Debug Runtime, with maximum debug output, shows not warning or error when trying to uses ALPHABLENDENABLE during a render into a fp texture : I was expecting an error like 'unsupported', instead of silently reporting nothing.

Cheers;


It may very well be emulated in software for OpenGL; the specification doesn't prohibit implementing it like that, unlike D3D specification which requires hardware implementation (so it "becomes" a hardware issue).

The HDR blending is a relatively new feature, so they've probably just missed the warning there. I can escalate this issue to the DirectX team so they may fix it in a future core release, but as it's not exactly critical, you may have to wait for a year for it. Meanwhile, the flag I mentioned does expose the hardware's capabilities regarding fp blending.

Do post the ATI answer here, when you get it!
0

Share this post


Link to post
Share on other sites
Will do.

I'm trying to figure out to 'circumvent' the problem.

I mean games like 'HL2-Lost Cost' is using HDR lighting, so they needs to render their scene into a fp render target, but probably this doesn't work on R300 (Maybe a R520 or Geforce 7 is required to run this game) when the scene have alpha blended textures (like trees) or particles (see http://www.bit-tech.net/gaming/2005/06/14/hl2_hdr_overview/1.html)

Probably what I can do is (for already old R300 hardware) :

- Render the non transparent objects into FP render target.
- Render the tranparents objects into a RGB render target.
- Write a pixel shader to blend the two target (probably for each type of blending) and write a result into a new FP render target
- Process the HDR tone mapping.

Don't know if this was discussed before.

0

Share this post


Link to post
Share on other sites
You could see what makes the SDK sample "HDRFormats" tick - it emulates HDR by using 32-bit integer format to encode the exponent of the color into the alpha component, and runs on older cards also. You can of course use another texture as the actual alpha, if you need it.
0

Share this post


Link to post
Share on other sites
I've done this:

if (SUCCEEDED( g_lpD3D->CheckDeviceFormat( 0, D3DDEVTYPE_HAL,
D3DFMT_A16B16G16R16F, D3DUSAGE_RENDERTARGET | D3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING, D3DRTYPE_SURFACE, D3DFMT_X8R8G8B8 )))
{
// Can render transparency object in floating point buffers
}
else
{
// Not possible
}

and it fails on mine. Don't know if this test is correct or not.
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0