Alpha Channels with Mental Ray Shaders

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
  06 June 2013
Alpha Channels with Mental Ray Shaders

Hi there,

I've been racking my brains over something that should be so simple for two days now. I'm creating leaves with the mia_material_x_passes shader plugging .tga file into the diffuse and cutout_opacity for the texture and alpha respectively.

This would all work fine but the edges look horrible and pixellated (see attached image).

Does anybody know the reason for this? Or even better another way around?

Thanks in advance,
Martin
Attached Images
File Type: jpg Cutoutopacity_Problem.jpg (87.7 KB, 38 views)
__________________
www.martinfalconer.com
 
  06 June 2013
What filtering settings are you using for the texture? (i've found "off" works best in this case, usually).
 
  06 June 2013
I've tried changing it to off and it corrects it ever so slightly but the problem is still glaringly obvious. Interestingly it seems to be a problem only where the leaves overlap the wood texture but not the rusty metal texture.

It's my first time using maya after a year of C4D and I must say I've missed these little nigglesome issues, worth it in the end though right?
__________________
www.martinfalconer.com
 
  06 June 2013
I've narrowed it down to being to do with the bump map on the Lambert wood texture behind it throwing up issues where it is seen through the edges of the leaves. I tried fiddling with the filter and filter offset of the bump map which only fixed it when blurring the bump to the point where it lost realism. I also tried applying to the wood a mia_material_x_passes with a mib_passthrough_bump connected to its overall bump.. this improved the edges but it was still an issue.

So I give up, I wanted to use mental ray shaders for this but I think I'll revert to Maya's.
__________________
www.martinfalconer.com
 
  06 June 2013
First, try using a standard and separate image file for your cutout opacity slot. .jpgs work just fine, since cutout opacity is only black and white, no grays. Second, every material should be a mia_mat_x or _x_passes shader, and that's part of the issues you're experiencing with native Maya shaders. There's really no reason to use them, and they also render slower.

Regarding your file texture node filtering, try Mipmap, with a filter of .2 perhaps? I've been using that for all my plantwork, and it seems great!

Also, what does your diffuse texture look like for those leaves? Have you painted the overlaps too?
__________________
Commodore 64 @ 1MHz
64KB RAM
1541 Floppy Drive


"Like stone we battle the wind... Beat down and strangle the rains..."
 
  06 June 2013
Thanks a lot, those suggestions have really gotten rid of the problem. I just need to get my head around bump maps in mental ray, but that's another issue. Thanks so much for all your help
__________________
www.martinfalconer.com
 
  06 June 2013
Hmm, I find they work pretty much how they do with other materials, just connect your image node to the Standard Bump slot. I generally start with a strength of .1, and rarely go above .2 in for bump strength. For bumps I use the Mipmap filter, with a filter strength of 0, under "Effects" in the file node attributes. For color maps (diffuse) I usually do Mipmap with a filter strength of .2 however.

Using a separate file for each file texture node can be really helpful too, when you need to swap stuff in and out. Sure, there may be benefits to using one file with multiple channels, but if you need to only change one channel (bump, reflectivity, etc.) then it's a bit harder to do on the fly. I usually have a master Photoshop project file for each custom texture, and then "spit out" the various texture node files as .jpgs from there.
__________________
Commodore 64 @ 1MHz
64KB RAM
1541 Floppy Drive


"Like stone we battle the wind... Beat down and strangle the rains..."
 
  06 June 2013
yeah that does the trick. Thanks so much for the insight mate, it'll come in useful many times I'm sure. What is it about the Mipmap filter type that you like?
__________________
www.martinfalconer.com
 
  06 June 2013
As far as I understand, the Mipmap filter helps reduce render times by creating a set of lower-detail textures based on the original. Then depending on the distance from the camera/size of the texture in the final render, it chooses an appropriate level of detail/resolution to render it. The Wikipedia page for Mipmaping should be able to explain in more detail.

edit: I also just wanted to confirm InfernalDarkness' claim that MR shaders render faster than Maya shaders. I had never heard that before, but I just decided to test on a simple scene, and they actually rendered 30% faster. Impressive!

Last edited by pollos : 06 June 2013 at 04:44 PM.
 
  06 June 2013
Quote: edit: I also just wanted to confirm InfernalDarkness' claim that MR shaders render faster than Maya shaders. I had never heard that before, but I just decided to test on a simple scene, and they actually rendered 30% faster. Impressive!


Much of this speed boost is due to the Reflections/Refractions cutoff threshholds, which reduce the math considerably past that point. Superfluous, non-visible reflections and refractions are skipped, speeding up the render time obviously. There are many other ways to optimize your mia_mat_x shaders as well, to gain speed.

And you're dead-on about the mipmapping. That's precisely how it works!
__________________
Commodore 64 @ 1MHz
64KB RAM
1541 Floppy Drive


"Like stone we battle the wind... Beat down and strangle the rains..."
 
  06 June 2013
Originally Posted by InfernalDarkness: Much of this speed boost is due to the Reflections/Refractions cutoff threshholds, which reduce the math considerably past that point. Superfluous, non-visible reflections and refractions are skipped, speeding up the render time obviously. There are many other ways to optimize your mia_mat_x shaders as well, to gain speed.

And you're dead-on about the mipmapping. That's precisely how it works!


Well that's definitely good to know. I suppose there is no reason to ever use Maya's shaders really, as MR shaders are both faster and more accurate.
 
  06 June 2013
Also the mia_mat_x is energy-conserving and more physically accurate, as well as calculating real reflective light instead of the specularity workaound. Phong and Blinn shaders use specularity to mimic surface area of point and spot lights which have no actual surface area. The mia_mat_x is designed to work mostly with Area Lights, which of course have actual surface area. They can still perform specularity, for those times when you need point or spot lights, and this is controlled in the Advanced rollout, "Specular Balance" node. At 1, false Blinn/Phong-style specularity is enabled, and at 0 you will only get specularity from actual area lights.

Sorry to ramble on, hope this info helps someone!
__________________
Commodore 64 @ 1MHz
64KB RAM
1541 Floppy Drive


"Like stone we battle the wind... Beat down and strangle the rains..."
 
  06 June 2013
Originally Posted by InfernalDarkness: Also the mia_mat_x is energy-conserving and more physically accurate, as well as calculating real reflective light instead of the specularity workaound. Phong and Blinn shaders use specularity to mimic surface area of point and spot lights which have no actual surface area. The mia_mat_x is designed to work mostly with Area Lights, which of course have actual surface area. They can still perform specularity, for those times when you need point or spot lights, and this is controlled in the Advanced rollout, "Specular Balance" node. At 1, false Blinn/Phong-style specularity is enabled, and at 0 you will only get specularity from actual area lights.

Sorry to ramble on, hope this info helps someone!


I had never touched that specular balance option and just decided to check it out now that you mentioned it. It seems to me that it just controls spec highlights in general, and the type of light doesn't make any difference. Here's a quick test to show what I mean:



The purple sphere has specular balance set to 0, and the yellow has specular balance of 1. Here is a quick screeshot of the how the scene is setup:



Maybe I misunderstood what you meant in the first place, but I just thought I would share my findings.

edit: This site defines Specular Balance for the mia_material as "The relative intensity of "highlights" to reflections."

Last edited by pollos : 06 June 2013 at 09:36 PM.
 
  06 June 2013
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 11:16 PM.


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