Jump to content

Is it possible to blend 2 materials at the material level?


Recommended Posts

Hi,

 

I am trying to blend between 2 materials but so far the only way I have seen is by creating a new material combining their whole network and manually mixing each component one by one. Is this the best way?

 

It's just that it becomes really hard especially if it's a massive material I didn't make, so I am not sure all the things I need to mix.

 

Would it be possible to programmatically do this by examining each material's compiled code and then insert blending code to it that's tied to a single blend parameter? I assume not, because there are very smart people here who must have thought about this way before me :)

 

 

Thanks :)

Link to comment
Share on other sites

lol why would it be strange? A lot of people seem to be asking for this for years :) For example if you have 2 different ground materials you want to blend from one to the other based on some attributes, whether it's a texture map or you paint it manually, etc (Not my image):

 

iray_composite.jpg

 

It's very easy to do in other 3d apps like Max where they have a built-in Blend Material:

http://docs.autodesk.com/3DSMAX/16/ENU/3ds-Max-Help/index.html?url=files/GUID-D2B59023-7D53-4E86-804F-7A037E787055.htm,topicNumber=d30e488557

 

Maya:

http://download.autodesk.com/global/docs/maya2014/en_us/index.html?url=files/Asts_Layered_shaders.htm,topicNumber=d30e620926

  • Like 1
Link to comment
Share on other sites

Yep, mixing two arbitrary BSDFs might yield weird results, and might result in a violation of energy conservation. The mixing should work if you have the same parametric BSDF for both materials, and you mix the input parameters.

 

There is a very nice example of a material pipeline like this from the realtime side of the industry: Crafting a Next-Gen Material Pipeline for The Order:1886 by David Neubelt and Matt Pettineo

  • Like 1
Link to comment
Share on other sites

I don't think those are very current shaders, the blend shader in 3ds max is under the section :

This section describes the Standard material and other materials that are not photometric. These materials can be suitable for games and animation, but not for physically accurate lighting models.

 

 

And i'm pretty sure the layer shader in maya doesn't work with mental ray well if at all.

 

So don't use those as they won't do what you expect in many cases.

 

You just have to be careful on how you choose to do this kind of thing depending on the rendering method and what you are trying to achieve.

For example in micropolygon rendering the individual vop functions will send out secondary rays, so if you start blending multiple materials together you can easily end up sending large amounts of redundant rays per sample.

 

In PBR this is safer but only really makes sense if you are doing a Boolean choice between two shaders or if like eetu mentioned if they are the same parametric,  a 50/50 mix between a ward and a phong doesn't really make any sense anyway from any point of view. (mixng can be done with a mix in vops which is the answer to you question I think) .

 

Blending two shaders on a higher level isn't possible ( in shops networks directly rather than with a shader vex builder)  and again there are more issues even if you could do this, if you have shader outputs for AOVs how would those be combined in a decent way, this would create chaos for anyone trying to managing shading for a production and would make debugging and output control a nightmare. 

  • Like 1
Link to comment
Share on other sites

mmm just reading this issue and it seems there is a reluctance on layered shading because it breaks physically accuracy. 

While the addition of realism certainly is a very very welcome addition on making it easier to achieve higher quality work, layered shaders have the same goal for a 3d artist. I have yet to learn Houdini shading workflows (Houdini noob here) but http://www.orbolt.com/asset/_danylyon::PBR_layered_material is exactly something that Houdini should have already provided artists. It looks great!

Anyway i does sound like we can build layering easily enough in vops :D

Link to comment
Share on other sites

In some ways I think this approach has become a little ingrained as a natural thing to want to do, from an artistic point of view... it seems ordinary enough, have a smooth transition between one material type any another... but take the grass and dirt example above.  When in reality is anything ever 50% mud, and 50% grass?  It's either a strand of grass or it's mud.  The only thing that gives an impression of a smooth transition is the viewpoint being a long way from the object in question, at which point they appear to mix together.

 

I know from an artistic point of view people like to follow the "it doesn't have to be right, it just has to look right" philosophy... but when you're ditching rough approximations in favour of a phyically accurate lighting and shading model, you have to give more thought to what's going on in reality and how best to model it, otherwise you'll just end up battling against your tools, rather than learning to use them effectively.  Alpha blending isn't a thing in the real world, so you can't expect it in a phyically based renderer that is attempting to model the real world.

 

It's not ideal when you're trying to produce work quickly, and design something aesthetically rather than getting wrapped up in the technicalities, but it sort of embodies the eternal struggle with CGI... clients want things to look super-realistic, so it's not 100% art, there's serious science involved... but clients also want complete artistic control, and generally speaking doesn't want to hear a word about all this "science" nonsense.  So the two things tend to be almost mutually exclusive unless your client happens to have a decent appreciation of the science behind it and is willing to give you the time/money to do it "right".

Alas, it's our job to try and find a compromise :-)

Link to comment
Share on other sites

 

.. but when you're ditching rough approximations in favour of a phyically accurate lighting and shading model

 

I

 

"Accurate" is thrown around these days but PBR is very much an approximation ;) 

 

The Veach-Guibas Monte Carlo paper states it succinctly "Technically, rendering is all about clever ways to approximate integrals"

Link to comment
Share on other sites

"Accurate" is thrown around these days but PBR is very much an approximation ;)

 

The Veach-Guibas Monte Carlo paper states it succinctly "Technically, rendering is all about clever ways to approximate integrals"

 

True enough, all CG is a very very rough approximation of reality at best - reality isn't made out of paper-thin polygon shells filled with air after all :-)

My point was just that the closer you try to move towards approximating reality, the more you have to actually consider how those things work in reality to make best use of the tools that are approximating them.  A purely artistic approach works fantastically when you're using a paintbrush to approximate a landscape, but the more believably realistic an image you attempt to create, the more you have to get your scientific hands dirty.

Edited by danw
Link to comment
Share on other sites

I'm still a big believer that the evil non-pbr alpha blend has a place in materials look-dev.

 

As an example anti-aliasing is a blend or average of the sub-pixels, and even though it's only an approximation, it produces the nice edges we are after. It's an artistic effect, the maths is weighted averaging.

 

 

post-8321-0-42334100-1396084603_thumb.pn

Link to comment
Share on other sites

I'm still a big believer that the evil non-pbr alpha blend has a place in materials look-dev.

 

As an example anti-aliasing is a blend or average of the sub-pixels, and even though it's only an approximation, it produces the nice edges we are after. It's an artistic effect, the maths is weighted averaging.

 

Then again, all the original samples are either red or green there, and when the values are binned to the pixels we get the intermediate colors. Likewise, when shading, we should have some samples hitting the grass and be shaded 100% like grass and some samples hitting the dirt and be shaded like dirt - and then the combined results should yield the antialiased blended pixel values. The samples should not be shaded a bit like grass and a bit like dirt.

Link to comment
Share on other sites

Exactly, it totally describes a physically accurate dithered alpha blend.

 

Each pixel is calculated with correct energy, then averaged together for the final output.  

 

edit: screengrab/ dithering is achieved via grouping on a grid. Specular yellow is increased on one material

post-8321-0-92747100-1396116472_thumb.pn

Edited by tar
Link to comment
Share on other sites

  • 4 weeks later...

As far as I can tell, substance Painter, dDO and similar are the texturing programs for the foresable future. Houdini could have their functionalities and more if Houdini's material-workflow were to be updated.

Or am I missing something?

Edited by DASD
Link to comment
Share on other sites

As far as I have seen, Substance designer is working with PBR (physically based rendering) where the main textures are albedo, roughness/glossyness, and normal (and possibly some others). During the interactive process the materials are blended through nodes and at the end everything is baked into those textures. - I may have misunderstood something.

 

- Houdini does not render with this "PBR" rendering model, does it? As far as I understood, this will be the standard for the current technology generation.

 

- The advantages of being able to blend materials (controlled by seperate textures) is numerous. You can have a far cleaner and faster workflow. You generate standard materials and then combine and re-combine them endlessly.

Edited by DASD
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...