• 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
Anand Baumunk

DX11
(Order Independent) Transparency

5 posts in this topic

Hello guys,

I started implementing transparency in my engine, and I got stuck on the usualy problem, I think, even thought I can't find very much helpful stuff on this.

I use a classic blendmode for transparent objects, and order them by the distance from the cam before drawing. This works fine if they are just a bunch of objects on behind another, but as soon as I rotate them or a model contains multiple polygons which have to been blended over oneanother, it becomes problematic.

For the rotationpart, I suppose I need a way to check the point of the object closest to the cam, and order them by this point rather than by just their position.

But I can't see someone preordering the triangles inside a mesh to get which transparent one needs to get drawn first.

As a solution, I have read about Order Independent Transparency, which is only for dx11, but that would be fine with me. I can't seem to pick up a good tutorial on this, so I may aswell ask you for one.

Or do you have another way of fixing those two problems?

 

Thanks so much!

-gnomgrol

0

Share this post


Link to post
Share on other sites

I had some help earlier on a similar issue, if you search for the topic "Rendering Intersecting Premultiplied Transparent Planes" and look at the Billboard example in the Microsoft XNA samples site they show how two passes can be used to prevent intersecting planes from creating weird depth effects.

0

Share this post


Link to post
Share on other sites

There's the 'OIT11' sample in the DirectX SDK. It's an expensive technique, though. You can often get away by using simple additive blending.

0

Share this post


Link to post
Share on other sites

Additive blending is the only blending that can be drawn without drawing back to front, yes, for everything else I always implemented a simple binary tree that receives all the triangles being sent to the renderer, inserting them into the tree based on their distance, and then when its time to draw them to the screen I just walk the tree drawing from back to front, deconstructing the tree as the triangles are rendered. This entails building a new tree each frame, but it could be set up to only build a new tree once things have moved around enough to require a new tree being built. Also, for large triangles that could be intersecting eachother this won't work properly, but it works well enough for most cases. If you have a lot of triangles in your scene, its better to precompute something like a BSP tree for the static geometry, as it wouldn't be very efficient to rebuild a distance binary tree every frame (or even every couple of frames) for tens-of-thousands of triangles.

0

Share this post


Link to post
Share on other sites

Hi!

 

What you ended up using is called „alpha test“ and is not truly a solution to the blending of many transparent objects, though it is a common hack to avoid the problem.

Whenever you really need to approach true order-independent transparency, there are a number of methods:

  • Depth peeling [Everitt 01, Bavoil & Myers 08] (Requires to know the number of layers, but was used quite often in research papers. Also works on Dx9.)
  • Concurrent linked list construction [Yang et al. 10, Yakiimo 10]-> do not look into the DxSDK sample (OIT11). Last time I looked, it was poorly implemented (didn’t use shared memory at all).  Check the version of Yakiimo. He implemented it faster, even with multi-sampling. This technique grew more useful by the recent advances of the graphics hardware. Requires Dx11.
  • Stochastic transparency [Enderton et al. 10] (also rather a research thingy. It can handle an arbitrary number of layers, but consumes much performance to get it frame-to-frame coherent). Needs Dx 10.1 if I recall correctly, as it works on the coverage mask.
  • The list goes on... stencil routing etc... (Look into the related work of the papers I linked, if you want to learn more.)

AFAIK, true order-independent transparency was yet too expensive for games. (If someone knows a game that used OIT, please let me know!) It is easier to work around it or just sort the transparent objects by depth. (Of course, this doesn’t work in all cases, but you can tell your artist to circumvent the ugly cases.)
I’m creating technical demos and prototypes, so I can afford to use the concurrent linked list construction.

 

Best regards!
 

PS: Links don't seem to work at the moment, so I post the URLs.

Everitt 01: http://gamedevs.org/uploads/interactive-order-independent-transparency.pdf

Baviol & Myers 08: http://developer.download.nvidia.com/SDK/10/opengl/src/dual_depth_peeling/doc/DualDepthPeeling.pdf

Yang et al. 10: http://onlinelibrary.wiley.com/doi/10.1111/j.1467-8659.2010.01725.x/abstract

Yakiimo 10: http://www.yakiimo3d.com/2010/07/19/dx11-order-independent-transparency/

Enderton et al. 10: http://www.enderton.org/eric/pub/StochasticTransparency_I3D2010.pdf

2

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

  • Similar Content

    • By lonewolff
      Hi Guys,
      I am revisiting an old DX11 framework I was creating a while back and am scratching my head with a small issue.
      I am trying to set the pixel shader resources and am getting the following error on every loop.
      As you can see in the below code, I am clearing out the shader resources as per the documentation. (Even going overboard and doing it both sides of the main PSSet call). But I just can't get rid of the error. Which results in the render target not being drawn.
      ID3D11ShaderResourceView* srv = { 0 }; d3dContext->PSSetShaderResources(0, 1, &srv); for (std::vector<RenderTarget>::iterator it = rtVector.begin(); it != rtVector.end(); ++it) { if (it->szName == name) { //std::cout << it->srv <<"\r\n"; d3dContext->PSSetShaderResources(0, 1, &it->srv); break; } } d3dContext->PSSetShaderResources(0, 1, &srv);  
      I am storing the RT's in a vector and setting them by name. I have tested the it->srv and am retrieving a valid pointer.
      At this stage I am out of ideas.
      Any help would be greatly appreciated
       
    • By bowerbirdcn
      hi, guys, how to understand the math used in CDXUTDirectionWidget ::UpdateLightDir 
      the  following code snippet is taken from MS DXTU source code
       
        D3DXMATRIX mInvView;
          D3DXMatrixInverse( &mInvView, NULL, &m_mView );
          mInvView._41 = mInvView._42 = mInvView._43 = 0;
          D3DXMATRIX mLastRotInv;
          D3DXMatrixInverse( &mLastRotInv, NULL, &m_mRotSnapshot );
          D3DXMATRIX mRot = *m_ArcBall.GetRotationMatrix();
          m_mRotSnapshot = mRot;
          // Accumulate the delta of the arcball's rotation in view space.
          // Note that per-frame delta rotations could be problematic over long periods of time.
          m_mRot *= m_mView * mLastRotInv * mRot * mInvView;
          // Since we're accumulating delta rotations, we need to orthonormalize 
          // the matrix to prevent eventual matrix skew
          D3DXVECTOR3* pXBasis = ( D3DXVECTOR3* )&m_mRot._11;
          D3DXVECTOR3* pYBasis = ( D3DXVECTOR3* )&m_mRot._21;
          D3DXVECTOR3* pZBasis = ( D3DXVECTOR3* )&m_mRot._31;
          D3DXVec3Normalize( pXBasis, pXBasis );
          D3DXVec3Cross( pYBasis, pZBasis, pXBasis );
          D3DXVec3Normalize( pYBasis, pYBasis );
          D3DXVec3Cross( pZBasis, pXBasis, pYBasis );
       
       
      https://github.com/Microsoft/DXUT/blob/master/Optional/DXUTcamera.cpp
    • By YixunLiu
      Hi,
      I have a surface mesh and I want to use a cone to cut a hole on the surface mesh.
      Anybody know a fast method to calculate the intersected boundary of these two geometries?
       
      Thanks.
       
      YL
       
    • By hiya83
      Hi, I tried searching for this but either I failed or couldn't find anything. I know there's D11/D12 interop and there are extensions for GL/D11 (though not very efficient). I was wondering if there's any Vulkan/D11 or Vulkan/D12 interop?
      Thanks!
    • By lonewolff
      Hi Guys,
      I am just wondering if it is possible to acquire the address of the backbuffer if an API (based on DX11) only exposes the 'device' and 'context' pointers?
      Any advice would be greatly appreciated
  • Popular Now