Blend Shader Question

Started by gregtee, February 18, 2013, 04:36:11 PM

Previous topic - Next topic

gregtee

Is there a way to soften the edge of the source input for a blend shader?  I'm using a fake stone as it's own mask into a surface layer and the problem I'm having is that where the stone meets the underlaying surface there's a very sharp cutoff.  I'm thinking this is happening because the the fake stone itself has a very sharp falloff around it's edges so I was thinking that some sort of blur or something between the output of the fake stone and the blend shader input on the surface layer would alleviate this issue. 

Is there such a thing?


Thanks

Greg

Supervisor, Computer Graphics
D I G I T A L  D O M A I N

mhaze

Not that I know of but I'm sure someone can work some magic with the blue nodes. We could do with a blur node a grow and shrink white/black for masks

Dune

No, there is not. I have wished many times there was a blur mechanism... The only option I see is using a different setup for your stones, based on soft edges. There are several ways, but here's one: http://www.planetside.co.uk/forums/index.php/topic,15345.0.html
Or use a perlin fractal for stones distribution and blender for the surface layer, which is simpler, but maybe inadequate.

Tangled-Universe

Hi Greg,

As said before it's not possible to blur/soften the edges of the fake stones' pattern.

However, there may be other approaches possibles, but before we can go into them I'd like to know what you're trying to achieve?
Blending fake stones as its own mask sounds a bit "double" to me and I'm not sure what you're trying and why?
There are other ways of completely restricting displacements and shading to the fake stones shader.

Cheers,
Martin

jo

Hi,

This sort of thing comes up quite often but I should point out that it can be difficult and/or slow to blur procedurally generated masks and patterns. To blur a procedural mask would mean you'd have to sample a number of point surrounding the point being evaluated. Let's say you had 8 samples, which probably wouldn't give very accurate results. That means you'd increase the computation time for the shader by 8 times. That's the reason that there aren't ways to blur this kind of thing. The same sort of issues apply to shrinking and expanding a mask.

I'm not sure any CG apps support blurring procedural textures. A quick search seemed to back that up. It's certainly not common.

It's easy to do this for image/bitmap based masks but procedural masks are another thing altogether.

Regards,

Jo

mhaze

Hi Dune, I'd forgotten efflux's work worth exploring I suspect.  Surely can't be that hard Jo, PS does it with selections easily enough.  It could be localized/selected with position coordinates and an area size and based on expanding /shrinking  a choice of black or white areas.

Tangled-Universe

World-Machine does blur their procedurals, but it's completely different as the procedurals are first rasterized into heightfields and then will be blurred.
So essentially it's not procedural blur.

Perhaps we can rasterize the procedural texture locally and then perform blur?
This definitely has limits to its usefulness of course, but I'm just trying to think out loud along here of course.

cyphyr

You can achieve something towards this by plugging your Power Fractal into a Surface layer's or Distribution layer's child slot and changing the "Fuzzy zone softness". It's set to a default of "1", lower values make the power fractal sharper, higher make it softer. Not a perfect solution I know.
Richard
www.richardfraservfx.com
https://www.facebook.com/RichardFraserVFX/
/|\

Ryzen 9 5950X OC@4Ghz, 64Gb (TG4 benchmark 4:13)

mhaze

#8
Just a thought.  I use the preview windows a lot. You can center an area of interest, see images of fake stones extracted using displacement to vector node. and then enlarge it . IF you could render at a higher resolution and then have some means of outputting the image as a .bmp  you would have a useful mask that could be modified in PS or other image editing program.  This must be possible and should be easy to implement.

As you can see from the images there is not enough resolution to make them useful and you would have use print screen to extract them to PS.  But maybe this could be the way to do it.

Oshyan

Of course one could first rasterize the procedurals at a *finite resolution*, and then blur. This would be more efficient than trying to blur the procedurals somehow, as Jo indicated. But it would mean working at a finite resolution, and depending on the detail level needed and the area covered, this could really be a "big data" problem. It's not out of the question, but as Jo mentioned, there's a reason that "blurred procedurals" are not a commonly available thing.

Probably the best approach in this case if the original request is still desired, would be to work on exporting the rock mask into a raster image format (top-down render with black/white color masking perhaps?), then blur that, and use an Image Map Shader with the blurred image to blend, instead of the fake stones output itself.

- Oshyan

Tangled-Universe

Yes that would be an approach Oshyan and you're right about the limits of resolution for rasterizing.

It would be nice to know where he wants to use it for though.
I have the feeling he's intending to use it to mask displacement and shading to his rocks, for example, and you don't need any kind of mask for that.

Oshyan

Yes, I certainly agree T-U. Often times we get caught up in approaching things a certain way, and it's helpful to step back and get some perspective about the end goal rather than a specific method. Sometimes there are simpler ways to do things. :)

- Oshyan

gregtee

Thanks for all the replies everyone.  What I'm trying to achieve is restriction of the surface layer properties to just the fake stones after I've run them through a few displacements.  I've got a surface shader that I like but it's everywhere on the terrain.  I want to limit it to just the fake stones I've built up and displaced so to do that I've used the fake stone source as a blend shader mask on the surface layer.  It nicely restricts the shader to just the fake stones but it has a nasty side effect of also abruptly cutting off the surface shader and fake stone displacement at the fake stone's boarder.  What I want is more gradual falloff.  Thinking like a compositor in Nuke, I'd make an edge matte and blur it, but I don't see the tools in TG to do that.  Or maybe I'm just approaching this incorrectly. 

I also thought of just applying the shader to the stones before I add them to the terrain but the shader still wanted to put itself everywhere, not just on the stones. 

Thanks again



Greg

Supervisor, Computer Graphics
D I G I T A L  D O M A I N

Tangled-Universe

Yessss there you go!

The trick is to use smoothing in the surface layer where you put your fake stones on.

I'll explain briefly:
Make a couple (if you wish) of fake stones layers and merge them with merge shaders which are set to "highest" blending mode.
This will prevent your stones from being placed on each other.

The output of your single or multiple fake stones goes into the child layer input port of a surface layer.
In that surface layer disable the diffuse colour, because that will now be provided by the fake stones.
In the smoothing tab enable smoothing.

Smoothing "reverts" the surface layers' displacement and shading it receives from the shaders above it in the network up to the first compute terrain it meets.
If you don't do this then the fake stones will inherit the displacements as well as the shading and vice versa.

Now add a lambert shader or surface layer to your fake stones surface shader input and give it a fancy colour and you'll notice it's exclusively applied to your fake stone(s).
The same accounts for displacements.

gregtee

Ok, I think I figured this out using a different technique.  I'll post a pick of what I did later but what id like to know now is how does one layer up displacemts on fake stones?  I put a voronoi displacer into the fake stone shader input which gave a nice look.  Now I want to continue to add more displacemts on top of that. 

What's the best way?

Thanks again

Greg
Supervisor, Computer Graphics
D I G I T A L  D O M A I N