Who can explain the "Blend as coverage" option for me?

Started by reck, August 16, 2012, 03:52:25 AM

Previous topic - Next topic

reck

I've tried to experiment with this option but I can't quite figure out what's happening when I turn this option on. Take the following simple example.

I've got a power fractal node that i'm using as a blending shader for a surface layer. With the blend as coverage option turned off I get exactly what I would expect to see. Where there's white in the power fractal the pink surface layer comes through and where's there's black there's no surface layer showing.

Blend as coverage option off
http://img827.imageshack.us/img827/8468/blendascoverageoff.jpg

Now if I tick the blend as coverage option, which I think is the default option, the surface layer no longer matches the power fractal, I just seem to get random areas of coverage.

Blend as coverage option on
http://img215.imageshack.us/img215/5142/blendascoverageon.jpg

Can someone give me a simple explanation please of what this option does and when it should be on\off?

Thanks

P.S. Sorry about the external image links, i'm having a problem uploading these images to the forum in the normal way.



freelancah

Straight from wiki: Blend as coverage: If this is checked the blending shader is used to modify coverage rather than blending the surface shader as a whole. Blending as coverage allows for more sophisticated interaction with aspects of the shader such as fractal breakup. This can be a subtle effect though and is an advanced feature you would not typically need to use

Tangled-Universe

Quote from: reck on August 16, 2012, 03:52:25 AM
Now if I tick the blend as coverage option, which I think is the default option...

Quote from: freelancah on August 16, 2012, 04:14:58 AM
...and is an advanced feature you would not typically need to use...

...and is therefore default?

Strange.

jo

Hi,

First off I should say Martin is right that the fact the docs say that but it's the default setting is strange. I will have to revisit that.

However, reck, you are wrong about getting random areas of coverage. If you overlayed your two rendered results, or screenshots of the previews, you would see that there is a definite correspondence between the two patterns with blend as coverage (BAC) on and off. It's quite easy to see that from your screenshots in fact, especially if you open each image in a different tab in your browser and then flick between the two tabs.

Look at the areas remaining with it turned on. You should see that they correspond to the "purplest" areas when it's off. For example, look at the preview with it on. Just to the left of centre there is a bit that looks like a "N" or perhaps "H" on a bit of a slope. If you look at the same place in the preview with it off you can see that same shape. It's a bit less distinct because there is more lighter purple around it, but it's definitely there. You do the same for every other feature visible with BAC turned on.

You are seeing the exact same pattern in both images, but with BAC turned on the more sophisticated blending mentioned in the docs is taking place and changing the appearance more than with just straight blending. I suspect that BAC is probably on by default because, as you have noticed yourself :-), it helps to make the fractal pattern look a bit more random. A problem with fractal or noise patterns is they sometimes look a lot like fractal patterns, which is definitely the case to me with your example showing BAC turned off.

Having BAC turned off means the blending is much more straightforward, it's happening in a way you can easily predict based on the blend shader input.  I think you would want it turned off if you really wanted fine control over the patterns being used for blending. On the other hand, if I wanted to blend together layers with a more natural look with less work I would probably have BAC on because it helps to hide some of the "fractalness". There would be other situations where you might want it on or vice versa but to me those would probably be the two main ones.

Regards,

Jo

Tangled-Universe

It almost looks like there's a kind of curve/multiply performed on the fractal input. As Jo explained the output is the same, only coverage is a bit lower, because the fractal input has been multiplied by <1 (for example) or a kind of curve adjustment which removes a bit of the lower grayscale colours. Something like that.

reck

@freelancah Thanks for the info from the wiki but I had actually read that before I posted, probably should have mentioned that. I wanted some more clarification though as that bit in the wiki didn't fully answer it for me.

@ Martin, Jo re the default setting. I've just had another look and BAC is turned on by default for me. This was one of the things that I found curious because with BAC off it does exactly what you'd expect, or at least what I was expecting, which is to mask the coverage exactly to the blend shader. I would have thought that this is what you would have wanted most of the time but after reading your post Jo maybe hiding the fractal patterns is more useful.

@Jo I shouldn't have used the word random, of course there would be some logic regarding it's output and now that i've switched between the two images it is quite obvious. As Martin explains it does look like a curve adjustment so that it doesn't cover as much area.

So that explains what it does now as to when you would have it on/off. From your description Jo it sounds like you would want it on most of the time to give a bit of randomness to the fractal unless of course you wanted a one-to-one mapping. It makes a lot more sense now, thanks.

reck

On a related note what does the "Fit blendshader to this" checkbox do? I couldn't see a description on the wiki when I clicked the ? button.

rcallicotte

Does it reverse the influence?  That's how I've treated it, but sometimes settings like this are too subtle for me to see much or any changes.


Quote from: reck on August 16, 2012, 11:21:29 AM
On a related note what does the "Fit blendshader to this" checkbox do? I couldn't see a description on the wiki when I clicked the ? button.
So this is Disney World.  Can we live here?

reck

Calico I clicked it on and off and I couldn't see any difference so i'm not sure what it does!

Oshyan

Calico, you may be thinking of  "Invert blend shader". I'm not certain on "Fit blend shader to this", but my understanding is it's actually intended to scale the blend shader input to the same scale or area as the blended shader. I don't think it's a very often needed setting, but for example it might be useful when using an image map (covering a finite area) as  blend shader, whereas a procedural input to another procedural as blend shader shouldn't need it. Again that's the best of my understanding.

These are all examples of settings that Matt would know best. I'll see if he can pop in here and add any additional info (or make corrections) that might be useful (and will add that to the wiki if so).

- Oshyan

reck


Matt

Quote from: Oshyan on August 16, 2012, 02:59:39 PM
I'm not certain on "Fit blend shader to this", but my understanding is it's actually intended to scale the blend shader input to the same scale or area as the blended shader. I don't think it's a very often needed setting, but for example it might be useful when using an image map (covering a finite area) as  blend shader, whereas a procedural input to another procedural as blend shader shouldn't need it. Again that's the best of my understanding.

That's about right. The exact function depends on the shader that calls the blend shader, but the idea is similar in each case. It changes the texture space given to the blend shader so that an area of 1x1 in the blend shader scales up (or down) to the scale of the shader being applied to. In some cases this makes it easier to change the scale of a shader because you don't have to change the blend shader as well. For example, with the Fake Stones Shader the "scale" it resizes to is the stone scale parameter. On the Heightfield Shader it maps the region [0,0 .. 1,1] in the blend shader to the size and position of the heightfield.

Matt
Just because milk is white doesn't mean that clouds are made of milk.

Mahnmut

Hi,
once again about the "blend as coverage":
The subtle influences that come into acount if you blend as coverage are for example (and I don´t find others) the fractal breakup settings, is that right? So with a high value for the fractal breakup you would see more difference between the two blending modes?
Best Regards,
J

Matt

Quote from: Mahnmut on August 31, 2012, 06:28:12 PM
Hi,
once again about the "blend as coverage":
The subtle influences that come into acount if you blend as coverage are for example (and I don´t find others) the fractal breakup settings, is that right? So with a high value for the fractal breakup you would see more difference between the two blending modes?

Yes.

Matt
Just because milk is white doesn't mean that clouds are made of milk.