Announcement

Collapse
No announcement yet.

premultiplied confusion

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • premultiplied confusion

    Hi all,

    I'm very new to phoenix, I think it's great so far.

    I've encountered a problem using it to create game assets (sprites) in png format.
    I think the problem stems from the expectation that pngs are not premultiplied
    https://www.w3.org/TR/PNG-Rationale.html

    For example, I have an image of a Mahjong tile rendered in Vray, with flames courtesy of Phoenix.
    If I load it into software (such as fusion or resolve) where you can specify that the image is premultiplied it seems fine.
    Click image for larger version

Name:	redTileFusionViewer.png
Views:	244
Size:	226.9 KB
ID:	969156

    But if I try to view it anywhere I can't specify that it's premultiplied, photoshop, gimp, windows viewer or Unity game engine, it looks something like this...
    Click image for larger version

Name:	redTilePremult.png
Views:	253
Size:	209.3 KB
ID:	969157

    My understanding of what's going on could be completely wrong (I'm very confused by this point), so feel free to call me an idiot as any time...

    But if anyone knows a solution to this, it'd be very gratefully received.
    Can I get Vray/Phoenix to output none-premultiplied pngs? Or is there any way to unpremultiply a premultiplied png? (I have a similar thread on the Fusion website, but I'm not having much luck there...)

    Thanks in advance

  • #2
    Hi,

    there's an easy workaround for this one - export images as .exr format and import them in PS for example. Set Alpha Channel Data as Transparency. Then export it as .png. I hope that would help you.
    George Barzinski
    QA Phoenix FD

    Comment


    • #3
      Hi George,
      Unless I'm misunderstanding you (which could easily be the case). That just seems to produce exactly the same effect.

      Here's the alpha

      Click image for larger version

Name:	tileAlpha.png
Views:	244
Size:	361.1 KB
ID:	969245
      And here's the RGB
      Click image for larger version

Name:	tileRGB.png
Views:	313
Size:	482.9 KB
ID:	969246

      Here's the image that's produced when I create transparency using those alpha values. Which is what I'd expect really. (Unless I'm missing something)
      Click image for larger version

Name:	redRGBFromAlpha.png
Views:	301
Size:	462.1 KB
ID:	969247

      Comment


      • #4
        Well, then you could try exporting the image and alpha channel separately and compose them later in a software of your preference.
        George Barzinski
        QA Phoenix FD

        Comment


        • #5
          Thanks again George.
          I'm just not sure how that would help. (Again, I could be misunderstanding something. So please spell it out to me like I'm a small child, I won't be offended )
          The png format expects straight alpha as per it's specification document here,
          https://www.w3.org/TR/PNG-Rationale.html

          I can take the premultiplied image from vray into an external compositing package, like fusion for example and flag it as a premultiplied image.
          Now that fusion knows it's premultiplied, it can display the image correctly by dividing the RGB by the Alpha (instead of multiplying).
          But the problem is, we've still got the same alpha values in the source file.
          So when we export from the compositing package for use as a standalone png, most other software expect straight alpha as per the png specs. So it multiplies the RGB and alpha which gives us the very transparent look above.

          I think the only way to fix it would be to change the RGB and the Alpha simultaneously but I've looked everywhere and I can't find a way of doing it and I'm beginning to think it's not possible.

          I would love to be wrong on this. So if I'm being an idiot then I'd be more than happy to hear it!

          Comment


          • #6
            Hey there ! Everything you've said is correct.

            Is it strictly necessary that you use PNGs ? Are TIFFs an option ?

            gosho.genchev@chaosgroup.com

            Comment


            • #7
              No, we can't use tifs I'm afraid.

              Comment


              • #8
                Maybe you can modify the alpha by increasing the smoke opacity. As this will also increase the brightness of the fire, you need to dimm that down to get a likeable result.
                Kind regards, Wolf S./K.
                www.faber-courtial.de

                Comment


                • #9
                  Alternatively, you can modify the alpha in any compositing package and make it more opaque. This will cause a dark fringe at the edges, though.
                  gosho.genchev@chaosgroup.com

                  Comment


                  • #10
                    Well unfortunately I couldnt download your image with alpha, but this how I will do.
                    Just increase the alpha like this in PS.

                    Alpha Example

                    I cant remove the Link below
                    Last edited by XavBo; 05-10-2017, 03:06 PM.
                    DE: ERFINDER des Elektroautos „SION"
                    EN: INVENTOR / FOUNDER of the electric vehicle "SION".


                    Computer #1 (Main) : Windows 10 PRO │ 2xXEON │128 GB │Quadro M4000 │ Quadro K4000 │ MaYa │vRay 5 │Phoenix FD 4 │

                    Even I have a powerful Computer ... I NEED CHAOS CLOUD !

                    Comment


                    • #11
                      Originally posted by XavBo View Post
                      Well unfortunately I couldnt download your image with alpha, but this how I will do.
                      Just increase the alpha like this in PS.

                      Alpha Example

                      I cant remove the Link below
                      Thanks. But the problem with that is the RGB will be too dark (as it's been rendered expecting a premultiplied alpha) so you get dark fringes as Gosho mentioned above.

                      Comment

                      Working...
                      X