View Full Version : Layered shader viewport display?

07 July 2011, 04:30 PM
Hello all,

I have a chracter made of painted body parts (with transparency maps) mapped onto planes. I have all my lighting and shading painted in the textures and hence need to render the textures as is without any change done by the renderer. Hence, I am using surface shaders for my materials plugged into a layered shader (for correct transparency).

The problem is layered shaders display the texture at an extremely lores in the viewport makng it rather difficult to animate. Below you can see two images...the first is with lambert materials.It displays correctly, but dosen't render the textures exactly as they are. The second is using layered shaders. It renders correctly, but as you can see, is a mess in the viewport.

Of course, the first instinct is to increse display resolution of textures in the surface shader. But the moment you plug it into a layered shader, that option is greyed out.

Is there anyway I can get teh surface shader to display properly? Or is there any better approach to render stuff without being affected by lighting and shading?

Thanks for your time.

07 July 2011, 06:48 PM
what you might consider doing is using a shader to work with for placement and UVs and then using a pre-Render MEL script to assign the layered shader or others that don't look right in hardware at the render time.

Prerender MEL example:
select -r pCube1; hyperShade -assign layeredShader1 pCubeShape1;

Postrender MEL example:

select -r pCube1; hyperShade -assign lambert2 pCubeShape1;

You can see this in action here:

07 July 2011, 07:09 PM
Hi Dave,

Thanks for going thru that long post and a huge thanks for the solution. This just might be it!
I have a few questioons though. I was in fact decided on doing what teh script does manually if nothing else worked; i.e, finish all my shots with lamberts and replace each lambert with a layered shader (in each shot) manually during render.

From what I could undertsand, to use the script you mentioned, I need to write the pre render mel in the render globals during rendering. Now my chracters have like 20 planes each. So do I have to enter enter a code for each plane? If so, how is this better than assigning the shaders manually to each plane?

Thanks a lot.

07 July 2011, 08:18 PM
Yes, I think you'll have to enter the code for each plane. It's better in the long run because then you'll never have to keep swapping out the textures manually after you do this once.

07 July 2011, 01:14 AM
ya, it will be a long, ugly string of commands in the pre/post MEL slot but once it's done, it will be time saved

07 July 2011, 04:55 AM
Thanks Dave(very nice blog there!) and Andrew.

Yes itd save time if you need to render, then feel like reworking on a shot, then rerender, etc.
But in my case when im done with the shot im done for good. Post thet, I need to save a version of the file with shaders replaced manually and render that version whenver i need to. So this ends up being the same amount of wrk, the only overhead being an extra file saved.

Or am I (Would be glad to) missing something?


07 July 2011, 03:46 PM
It's simply because nobody ever takes their first render; something's always going to need fixing. If you're even going to render twice, the mel script saves time.

When I use this, I usually use it to hide geometry until render time. It seems like unnecesary hassle, but once you use it once, you realize how easy it makes your life.

07 July 2011, 04:49 PM
Great. Does make sense. Thanks a lot :)

CGTalk Moderation
07 July 2011, 04:49 PM
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.