locked
WPF BUG? Viewport3D doesn't render PNGs properly RRS feed

  • Question

  • Hi

    I'm visualizing floorImages of a building in 3D, in this case the "nose" of a boat.
    However, I get a very strange unpredictable result with the transparency of my floors.

    I made a video that shows the problem: http://www.megaupload.com/nl/?d=X3MXKV11 (only 6.8 Mb large)

    Do you notice the inconsistent appearance and disappearance of floors behind the "activated" floor?
    What I want is that all the floors remain transparant at ALL time.

    The funny part is that all images are PNG and are all transparant (or semi-transparant).  When I add floors, some floors become transparant and other floors that were not transparant at all before, become transparant..

    Weird...




    Thursday, May 29, 2008 2:27 PM

Answers

All replies

  • This is probably to do with the order in which you're adding your models to the viewport. Regardless of transparency in the images you're painting your triangles with, you can only see a model behind another model if it was added before the other model. Or after it. I forget which, but either way it makes a difference.

     

    If you're dynamically changing the position of these things so that any one of them could be in front of any other, you'll have to remove and re-add them to the viewport accordingly.

     

    Thursday, May 29, 2008 4:53 PM
  • This is a general problem with z-buffered 3D rendering pipeline, one possible approach to workaround this problem is z-sorting as follows:

    http://blogs.msdn.com/pantal/archive/2007/07/23/sorting-for-wpf-3d-transparency.aspx

    Hope this helps
    • Edited by Marco Zhou Wednesday, June 4, 2008 9:46 AM grammatical correction
    • Marked as answer by Marco Zhou Wednesday, June 4, 2008 9:47 AM
    Monday, June 2, 2008 5:14 AM