Auto "Alpha mask"

For all the users of Twilight Render (V1 & V2), to ask questions and get started
Fletch
Posts: 12897
Joined: Fri Mar 20, 2009 2:41 pm
OS: PC 64bit
SketchUp: 2016-2023
Contact:

Re: Auto "Alpha mask"

Post by Fletch » Thu Jan 24, 2019 11:18 am

In GIMP this video tutorial explains how to copy and paste your black and white image into the alpha mask channel for your rendered image layer (I don't use GIMP, I use Photoshop):
  1. open Alpha Mask Rendering (it's a greyscale image, basically almost completely black and white)
    resize the Alpha Mask Render (which you rendered at 2x the scale of the original rendered image) and resize it to be exact same size as original rendering. (Use the "resize image" function to do this - not the "free transform" or "scale" function.)
  2. Ctrl+C to copy the entire newly re-sized Alpha Mask Render
  3. Now you right-click your rendered image layer and choose "Add Alpha Channel". (choose either white or transparent alpha channel, it doesn't matter)
  4. Then select the rendering's new alpha channel icon now showing on your layers pallette next to the thumbnail of the rendering, and paste the Alpha Mask Render into the Alpha Channel for the rendered image using Ctrl+V
  5. GIMP will create a new layer with the pasted info, right-click that new layer and click the anchor icon, which will force that info to be pasted into the alpha mask channel.
  6. In GIMP or in Photoshop if the alpha mask on your layer is being edited it will have a highlight line around the little mask thumbnail icon
  7. add new layer BELOW your rendering containing the new sky you want to use
NOTE: If you are in Photoshop, and you create a mask on your rendered image layer, you can hold ALT key down and click the mask icon on the layer to open up that alpha channel for editing, then paste in your mask there. Click on the image icon thumbnail for the same layer to get out of alpha channel editing mode.
Image

tuna57
Posts: 881
Joined: Wed Jul 09, 2014 11:54 pm
OS: MacOSX 10_11
SketchUp: SU 2015Pro SU2018Pro

Re: Auto "Alpha mask"

Post by tuna57 » Thu Jan 24, 2019 4:07 pm

Thanks very much Fletch for your help. Dumb me didn't learn the right way to do this :oops: :doh: . I'll be sure to check the links you posted and try again. Hopefully I'll get it figured out with the great help you've offered.
TwilightPro V2.11

SpookyChick
Posts: 167
Joined: Wed May 26, 2010 6:51 am
OS: win 7 pro x64
SketchUp: SU 2017
Location: DryPlace, USA
Contact:

Re: Auto "Alpha mask"

Post by SpookyChick » Thu Jan 24, 2019 4:29 pm

Thanks Fletch. For some silly reason, I had completely forgotten GIMP's Layer Mask functionality. :doh: :oops: As a result I've been letting myself in for a world of pain :wall: with having to clean up the anti-aliasing induced halos.

Doing it this way (the right way!) works much better!
Aaaand the proof is in the post pro.<br />Disclaimer: Non Commercial Work meant as demo.  Background by Catalysmicenforcer of DeviantArt, who does awesome work!
Aaaand the proof is in the post pro.
Disclaimer: Non Commercial Work meant as demo. Background by Catalysmicenforcer of DeviantArt, who does awesome work!
Anubis Masked.jpg (951.96 KiB) Viewed 9384 times
It's like "Gee, My headache went away after I stopped banging my head against brick wall!", although I did have a weird problem with GIMP deciding to make the shadowed areas of the rendered model semi-transparent after application of the layer mask. Typical GIMP weirdness, easily fixed by selecting the shadowed areas and thresholding the alpha channel. That's not a problem with Twilight though.

Thank you very much Fletch, for the link to the tutorial, and most of all, letting me know that I was doing it the wrong way. It's embarrassing to make a mistake like that, but unlike some folks I've met and worked with, I'm not too proud to learn from my mistakes.

Fletch
Posts: 12897
Joined: Fri Mar 20, 2009 2:41 pm
OS: PC 64bit
SketchUp: 2016-2023
Contact:

Re: Auto "Alpha mask"

Post by Fletch » Fri Jan 25, 2019 10:52 am

SpookyChick wrote: Thu Jan 24, 2019 4:29 pm Thanks Fletch. For some silly reason, I had completely forgotten GIMP's Layer Mask functionality. :doh: :oops: As a result I've been letting myself in for a world of pain :wall: with having to clean up the anti-aliasing induced halos.
:hat:
SpookyChick wrote: Thu Jan 24, 2019 4:29 pm Doing it this way (the right way!) works much better!
:^:
SpookyChick wrote: Thu Jan 24, 2019 4:29 pm although I did have a weird problem with GIMP deciding to make the shadowed areas of the rendered model semi-transparent after application of the layer mask.
My guess is that you have rendered your model, and made changes in the Post-process panel, then saved the rendering.
Then you went to "Alpha Mask" render setting, but did not change the Post-process back to 1 and 1 default setting. In doing so, the blacks in the mask may not be perfectly black, as the Post-processing may have changed them accordingly.
Go set Post-process to "None" and re-render the mask.

SpookyChick
Posts: 167
Joined: Wed May 26, 2010 6:51 am
OS: win 7 pro x64
SketchUp: SU 2017
Location: DryPlace, USA
Contact:

Re: Auto "Alpha mask"

Post by SpookyChick » Fri Jan 25, 2019 4:05 pm

Surprisingly, that wasn't the case. I had not made any changes at all in the post process panel. The black and the white of the Alpha Mask were both perfect. I double checked that in GIMP first thing as part of my trouble shooting. Perfect Black, and Perfect White. Most of the time, I don't even mess with the Post Pro panel in Twilight anyhow, since there's little need for it in my workflow, if I set my lighting up right to begin with. Other people's mileage may vary as a result of difference in workflow.

In this case, investigation revealed that it's a function of how GIMP does things. I've observed similar behaviour during compositing at times in the past, as a result of applying a "Colour to Alpha Channel" function. Simple enough to solve by the method I used, selecting the affected area and thresholding the Alpha.

I do appreciate the information though. That was something I hadn't considered about side effects from the Post-Process panel in the render window, and more knowledge is good.

In any case, thank you very much for the guidance about (proper) use of Alpha Mask. :rspkt: My compositing already takes a great deal less time (and hair pulling) than before. :D

pbacot
Posts: 364
Joined: Wed Oct 03, 2012 2:27 am
OS: MacOSXMojave
SketchUp: 2019

Re: Auto "Alpha mask"

Post by pbacot » Sat Jan 26, 2019 8:14 pm

Thanks Fletch. Yes I do use layer masks, but I have NOT been using it for this (at least not recently). That should help a lot!

tuna57
Posts: 881
Joined: Wed Jul 09, 2014 11:54 pm
OS: MacOSX 10_11
SketchUp: SU 2015Pro SU2018Pro

Re: Auto "Alpha mask"

Post by tuna57 » Mon Jan 28, 2019 5:49 pm

Fletch, can't thank you enough for your help getting me straightened out with the correct way to use Alpha Masks. :^:

Did a very quick render and alpha mask of the model with the palm trees from my first post. Surprise the results are very much better :whoot: . Funny how well it works when you do things the right way :oops: .

Posting the result from doing it properly. It does bring up a question that goes back to pbacots original post though. You can ignore the artifacts around the fronds of the small palm trees, thats to be expected with this particular tree model. They don't render very well on easy 8 for some reason.

But if you look at the right sides of the palm trees on the left side of the image they still have a fine "ghost" line down the sides of the trunks. I wonder if this is more in keeping with the problem pbacot was experiencing ? :!

All that said I'm a very happy camper :whoot: , thanks again for your help.
Attachments
C-1000_B_new mask.jpg
C-1000_B_new mask.jpg (849.1 KiB) Viewed 9341 times
TwilightPro V2.11

pbacot
Posts: 364
Joined: Wed Oct 03, 2012 2:27 am
OS: MacOSXMojave
SketchUp: 2019

Re: Auto "Alpha mask"

Post by pbacot » Mon Jan 28, 2019 7:34 pm

Those are nice trees. I guess they are all 3d--judging by those up front. Only thought, the leaves could be a lighter color.

Fletch
Posts: 12897
Joined: Fri Mar 20, 2009 2:41 pm
OS: PC 64bit
SketchUp: 2016-2023
Contact:

Re: Auto "Alpha mask"

Post by Fletch » Mon Jan 28, 2019 8:25 pm

tuna57 wrote: Mon Jan 28, 2019 5:49 pm Fletch, can't thank you enough for your help getting me straightened out with the correct way to use Alpha Masks. :^:
:hat: my pleasure - glad to help
Did a very quick render and alpha mask of the model with the palm trees from my first post. Surprise the results are very much better :whoot: . Funny how well it works when you do things the right way :oops: .
:D
... palm trees on the left side of the image they still have a fine "ghost" line down the sides of the trunks. I wonder if this is more in keeping with the problem pbacot was experiencing ? :!
This is what I mentioned earlier, and you can see very clearly in my .gif animation (shown below again for your convenience) That if you render an object and it is appearing darker than its background, then you place that object onto a background that is darker than the object, it will appear to your eye like a "ghosting" because that object is blended by AA/the render engine with the surrounding lighter background pixels (depending on the sampling, could be a 3x3 blending matrix for example) which is normally desirable and makes the rendering look nice. So the background image you place the object upon must be very similar in tone to the original background or you will get this apparent "ghosting effect", but it's not actually ghosting, it's a blending issue.

FIX THE ISSUE FAST: If the new background is now darker than the original and you want to blend that sky in quickly use the "blur" tool in your image editor and change the "mode" of the blurring tool to "darken" mode and set the opacity of your blur brush to something gentle like 50 percent at first, slowly increase (or decrease) in 10% increments until it produces the blending effect you want eliminating the light edge, you run that blur tool with a small size brush along the light colored edge of the object where it's touching the dark sky - the darker color from the sky will blend only into the light edge color of your object and work like an "anti aliasing" effect.

Image

tuna57
Posts: 881
Joined: Wed Jul 09, 2014 11:54 pm
OS: MacOSX 10_11
SketchUp: SU 2015Pro SU2018Pro

Re: Auto "Alpha mask"

Post by tuna57 » Mon Jan 28, 2019 11:06 pm

Many thanks again Fletch. I think my old tired brain is finally wrapping around this. :wall: :wall: Think it's time to slowly fade into the background on this post :whistle: .
TwilightPro V2.11

Post Reply

Who is online

Users browsing this forum: No registered users and 13 guests