Author Topic: Mask from object with transparency  (Read 9179 times)

2017-08-09, 22:36:00

Frood

  • Active Users
  • **
  • Posts: 2002
    • View Profile
    • Rakete GmbH
Is there any option to achieve this? Given a simple plane with PNG texmap with tranparency I would like to have something like its alpha but as render element. Every RE (Mask, WireColor) seems to just mask where transparency is not exactly zero, ignoring values in between. Using such a map in CTexmap renders just black.


Good Luck


Never underestimate the power of a well placed level one spell.

2017-08-10, 00:00:32
Reply #1

mferster

  • Active Users
  • **
  • Posts: 525
    • View Profile
It's because you are using an image with an alpha channel. You need to use a straight up  greyscale image. Here is what i got.

2017-08-10, 00:22:01
Reply #2

mferster

  • Active Users
  • **
  • Posts: 525
    • View Profile
I'm a derp. I forgot there is a way to do this if you want to use a .png alpha image.

Change the rgb channel output to 'Alpha as gray' in your bitmap parameters.

as seen below

2017-08-10, 01:50:24
Reply #3

Frood

  • Active Users
  • **
  • Posts: 2002
    • View Profile
    • Rakete GmbH
Thanks for looking into this and for your tests! Here are the to expected "buts"  :)

- using CTexmap isn't really an option anyway because I may have up to 200 different textures like this so I would have to setup as many texmap REs

- even then you will drop RGB which is needed for other passes when setting RGB output to alpha (I should have better attached an example PNG with clearly coloured RGB)

- In the test scene from your last post try to put something behind the plane or compare it to the cVFB alpha: you get the same effect as when using CMasking_Mask. Or set the background override of CTexmap to non black (see attachment)

The only (bad) workaround I found so far is assigning a ShadowCatcher material to everything else in the scene and (mis-)use it as alpha stencil with alpha set to "always transparent" and then use the resulting image alpha from beauty as mask :-/


Thank you again!

Good Night


Never underestimate the power of a well placed level one spell.

2017-09-01, 10:02:30
Reply #4

maru

  • Corona Team
  • Active Users
  • ****
  • Posts: 13715
  • Marcin
    • View Profile
I can confirm that the masking elements always come out solid. Alpha element however works as expected.
Marcin Miodek | chaos-corona.com
3D Support Team Lead - Corona | contact us

2017-11-08, 16:28:29
Reply #5

alexyork

  • Active Users
  • **
  • Posts: 743
  • Partner at Recent Spaces
    • View Profile
    • RECENT SPACES
I can confirm that the masking elements always come out solid. Alpha element however works as expected.

Is this something that can be "fixed" or improved somehow? We are always struggling with glass objects coming out blocking other objects rendered using corona mask element. The "workaround" is to make the glass material's alpha not visible in masks, but then the result isn't correct and we lose a lot of control.
Alex York
Partner
RECENT SPACES
recentspaces.com

2017-11-08, 16:45:38
Reply #6

Frood

  • Active Users
  • **
  • Posts: 2002
    • View Profile
    • Rakete GmbH
https://forum.corona-renderer.com/index.php?topic=96.0

-> "Refraction/Reflection working with masking render elements (CMasking_Mask,CTexmap, etc...)"

In my case it was about opacity only where I expected this would be an easy one. But the above poll item is what we are after I guess and would apply also to opacity.


Good Luck


Never underestimate the power of a well placed level one spell.

2017-11-08, 16:56:01
Reply #7

alexyork

  • Active Users
  • **
  • Posts: 743
  • Partner at Recent Spaces
    • View Profile
    • RECENT SPACES
https://forum.corona-renderer.com/index.php?topic=96.0

-> "Refraction/Reflection working with masking render elements (CMasking_Mask,CTexmap, etc...)"

In my case it was about opacity only where I expected this would be an easy one. But the above poll item is what we are after I guess and would apply also to opacity.


Good Luck

Cheers. Voted!
Alex York
Partner
RECENT SPACES
recentspaces.com

2017-12-12, 23:39:12
Reply #8

dj_buckley

  • Active Users
  • **
  • Posts: 1059
    • View Profile
I can confirm that the masking elements always come out solid. Alpha element however works as expected.

Is this something that can be "fixed" or improved somehow? We are always struggling with glass objects coming out blocking other objects rendered using corona mask element. The "workaround" is to make the glass material's alpha not visible in masks, but then the result isn't correct and we lose a lot of control.

Alex can you confirm what is incorrect about the result, when using the workaround?

2017-12-13, 10:30:49
Reply #9

alexyork

  • Active Users
  • **
  • Posts: 743
  • Partner at Recent Spaces
    • View Profile
    • RECENT SPACES
I can confirm that the masking elements always come out solid. Alpha element however works as expected.

Is this something that can be "fixed" or improved somehow? We are always struggling with glass objects coming out blocking other objects rendered using corona mask element. The "workaround" is to make the glass material's alpha not visible in masks, but then the result isn't correct and we lose a lot of control.

Alex can you confirm what is incorrect about the result, when using the workaround?

Well glass is never totally transparent, so it should always come out a shade of grey in alpha channel. If you do any kind of fudging to the way a material's alpha is calculated it comes out either completely black or white which is wrong.
Alex York
Partner
RECENT SPACES
recentspaces.com