How to Use RGB Mattes for Layered Textures in MentalRay

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
Old 02 February 2013   #1
Question How to Use RGB Mattes for Layered Textures in MentalRay

Here is the core concept.

I am creating a mia_material_x shader and need a little help with how masks are used to make layered textures for one channel. I have a RGB texture matte/mask where R, G and B color is used for a different pattern of scratches or scuffs. This will then be used as the mask to combine 3+ diffuse textures.

What node do I need to use to accomplish this?

Thanks in advance!
 
Old 02 February 2013   #2
Are you familiar with compositing? If so, you could create a render layer for each mask and assign the mask as a surface shader - white for scratches, the rest black. Then in your compositing software you would assign these as masks for the colors that you want to apply - choosing a blending mode that looks coolest. You can get quite artsy with this flexible technique.
__________________
If animation couldn't change the world, it wouldn't be such a Micky-Mouse place.
 
Old 02 February 2013   #3
Thanks for the reply EightBit!

I am familiar with compositing and have used RGB mattes in Nuke/AE before. This is basically the same concept, just happening at a shader level to control how textures are mixed. Here is a rough visual representation of what I am going for:



I have come fairly close with the mib_colormix node, but it is looking for alpha input. I need something that works just like RGB mattes do in compositing where you can say take the Red channel and that's the mask for texture 1, take the Blue channel and that's the mask for texture 2 . . . so on.
 
Old 02 February 2013   #4
I'm not a MR expert by any means, but if the look of these scratches is worth the effort of creating separate mattes like that, compositing has got to be infinitely more tweakable.
__________________
If animation couldn't change the world, it wouldn't be such a Micky-Mouse place.
 
Old 02 February 2013   #5
I am working with assets that were provided to me and I am building the shaders from the textures they provided, the picture above is just a rough example that I threw to together to illustrate my point. The real textures are indeed very detailed. I think it was textured in Mari and the use of RGB mattes to create layered textures is to leave some flexibility for changes. If you decide to change the amount/style of scratches you output one new matte opposed to having to out put new diffuse/spec/etc... Just a guess though.

Now I just have to figure out how to get it to work!
 
Old 02 February 2013   #6
check out the mib_color_mix.
Take care about layering shaders this way cause, depending on what you do, render time could go really high.
Seems that a new library is under development to avoid this (http://elementalray.wordpress.com/2...i-beta-shaders/)
 
Old 02 February 2013   #7
I did this for the first time the other day.

I made a layered shader node, then put different surface shaders in as different layers and used the custom color buffer pass and the writeToColorBuffer node to get each layer into a pass. It's great for an exr for nuke, saves work in nuke not having to shuffle and copy passes to the main data stream.

You may want to write a little script to automate the process though.

Is that what you meant?
 
Old 02 February 2013   #8
Thanks nookie, mib_color_mix did the trick. I had one of those "duh" moments when I realized I just needed to point either the R, G or B of the outColor from the RGBmask to the mix weight.

I ended up creating multiple mia_material_x shaders, such as base metal, paint, dirt and used the mib_color_mix to combine them as desired.

I'm about to explore doing this same setup with VRay.

Thanks for the help!
 
Old 02 February 2013   #9
Not sure this is what I was trying to do, my previous post mentions my solve, but pretty cool concept! So this would give you RGBmattes as passes on your exr?

Originally Posted by gauranga108: I did this for the first time the other day.

I made a layered shader node, then put different surface shaders in as different layers and used the custom color buffer pass and the writeToColorBuffer node to get each layer into a pass. It's great for an exr for nuke, saves work in nuke not having to shuffle and copy passes to the main data stream.

You may want to write a little script to automate the process though.

Is that what you meant?
 
Old 02 February 2013   #10
Originally Posted by ibm051000: Not sure this is what I was trying to do, my previous post mentions my solve, but pretty cool concept! So this would give you RGBmattes as passes on your exr?


yup and then some.
 
Old 02 February 2013   #11
mib_color_mix is probably a better node to use than maya's default layered texture, but you can use the layered texture node and plug in the various outColor channels from the mask image into the alpha of each layer. As stated though, this can be dangerous at render time, so I'd be wary of that (though it'll work if for some unknown reason you decide to use the software renderer). IMO, the most efficient method may actually be to extract the channels in Photoshop or something, it will generate a few more files, but I would think it would be a lot more advantageous at render time.
 
Old 02 February 2013   #12
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 07:47 PM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.