Ubershader v4.0 - New Release 5/24/2013, Come and Get It!

http://www.pasteall.org/pic/show.php?id=50511

Ubershader v4.0

This is the completely overhauled version of my Ubershader. I have attempted to mimic the Standard shader from Arnold to the best of my abilities, plus some neat extras in the Glass shader, as well as some added utility in the form of a Matte option. Using the parameters in this single node you’ll be able to create any mix of matte, diffuse, subsurface, glossy, anisotropic, transparent, glass, and emission materials. The material includes fast, tweakable, realistic fake caustics and non-opaque shadows for glass materials. The Ubershader is meant to be used almost entirely from the properties panel. The only reason the node editor would be necessary would be the addition of normal/bump/tangent maps.

https://www.dropbox.com/s/74b8k067gykgzx8/UberShaderMaterial.blend

UPDATE: Full tutorial avaiable now at Blender Cookie.

http://cgcookie.com/blender/cgc-series/creating-an-uber-shader-in-cycles/

File will need to be unpacked to use the background image.

Explanation of the Settings:

  • Overall Opacity - Controls the overall opacity of the object. 0 is transparent, 1 is opaque.
  • Diffuse Color - Sets the color of the diffuse material.
  • Diffuse Bump - Control the surface bumps of the diffuse material with an image texture. Requires Geometry -> Normal node to be plugged in if not in use.
  • Diffuse Weight - Control the contribution of the diffuse component to the overall material. Must be 0 for fully glossy material. Without Glossy contribution, going from 1 to 0 will transition from a diffuse material to a pure black material.
  • Diffuse Roughness - Controls the roughness of the diffuse component of the material. Setting above 0 switches from a Lambertian BSDF to a Oren-Nayar BSDF.
  • SSS Weight - Allows subsurface scattering for the material added to the diffuse component. SSS is CPU only at the moment, and only in newer builds.
  • SSS Color - Controls the scattering color of the SSS component of the material.
  • SSS Scale - Controls the overall scale of the SSS material. A setting of 1 assumes that objects are modeled such that 1BU equals 1m. It is always recommended to model in real-world values.
  • SSS Radius - Individually control the scattering radii of the red, green, and blue values entering the object. These are multiplied by the SSS Scale.
  • Glossy Color - Control the reflection color of the glossy component of the material. Default color is white.
  • Glossy Bump - Control the surface bumps of the glossy material with an image texture. Requires Geometry -> Normal node to be plugged in if not in use.
  • Glossy Weight - Control the contribution of the glossy component to the overall material. Must be 0 for fully diffuse material. Without Diffuse contribution, going from 1 to 0 will transition from a glossy material to a pure black material.
  • Glossy Roughness - Controls the roughness of the glossy component of the material.
  • Is Anisotropic - Objects can have anisotropic reflections. A setting of 0 will use a standard glossy BDSF, a setting of 1 will use an anisotropic BSDF.
  • Anisotropy - Controls the anisotropy of the reflections on the material when above 0. Must have a Glossy Roughness above 0 in order to see the effects of anisotropy.
  • Aniso Rotation - Controls the rotation of anisotropic reflections from 0 to 1.
  • Fresnel Coefficient - Controls the Fresnel value of the material reflections. A setting of 1 will use a full glossy material. As the value gets closer to 0 reflections will be pushed to faces of the object perpendicular to the camera.
  • Tangent - Control the anisotropic tangents of the object with an image map. REQUIRES GEOMETRY -> TANGENT NODE PLUGGED IN WHEN NOT IN USE. BLENDER WILL CURRENTLY CRASH WITHOUT THIS IF YOU TRY TO RENDER/PREVIEW.
  • Refraction Transparency - Controls the transparency of the refraction component of the material. This allows for materials where refraction is decoupled from reflection.
  • Refraction Color - Controls the base color of the refractive material.
  • Refraction Bump - Control the surface bumps of the refractive material with an image map. Requires Geometry -> Normal node to be plugged in if not in use.
  • IOR - Controls the index of refraction of the refractions. Default is 1.55 for glass.
  • Transmittance - The refraction in the Ubershader allows for absorption based on Beer’s Law. This setting controls the color of thin areas of the object. To disable set this to match the Refraction Color.
  • Transmit Depth - Controls the depth at which the transmission color takes over.
  • Use Glass Shader - When set to 1 this overrides material to use the true glass shader rather than the decoupled refraction shader. Uses color, bump, roughness, IOR, transmittance, and depth values from the refraction settings.
  • Use Fake Shadow - The Ubershader allows for fake shadows to give the effect of light passing through a glass material without having to wait for full caustics to clean up. At 0 the object will be treated as opaque if ‘No Caustics’ is checked in the render settings. At 1 the shadow rays will be calculated as if the object were a transparent BSDF with the color set in Fake Shadow Color.
  • Fake Shadow Color - Controls the color of the shadow cast by the object when Use Fake Shadow is set to 1.
  • Use Fake Caustics - The Ubershader allows for fake caustics to give the effect of light being refracted by a material without having to wait for full caustics to clean up. At 0, and when Use Fake Shadow is above 1, the material will cast simple transparent shadows. At 1 fake caustics will be calculated based on the normals of the base object, giving a convincing caustic effect in most cases. Use values in between to tweak the strength of the effect.
  • Use Emission - Objects can be emitters. At 0 the object will have no emission. At 1 the object will be fully emissive.
  • Emission Color - Controls the color emitted by the object.
  • Emission Strength - Controls the strength of the emitted light.
  • Is Matte - Objects can be matted out for the render using this option. A setting of 0 will turn matte material off, a setting of 1 will turn matte material on.
  • Matte Color - Sets the color of the matte.
  • Matte Alpha - Slider from 0 to 1 to set the alpha of the matte object.

Known Issues:

  • Unplugging the Vector node while preview rendering will cause a hard lockup of your computer. Be wary when playing with this socket.
  • Color values of 1 in Refraction Color cause issues with glass absorption. This is an issue with the Beer’s Law calculation that I will work to fix. For now just keep your R, G, and B values slightly below 1.
Notes:
  • If you open up the shader group in the node editor (with Tab) you’ll notice that to the left of everything else are the layer weight, Fresnel, and multiply nodes. This is to allow for easy switching for whatever your needs are. Currently there is no way to automatically calculate Fresnel based on IOR when creating glass where refraction is decoupled from reflections. In this case there are 3 options: You can either play with the Fresnel Coefficient to try and get them to match up correctly, you can go into the node and attach the Fresnel IOR node in place of the Layer Weight node and simply put the IOR from the refraction shader (or whatever other value you wish) in to the Fresnel node, or you can simply turn on “Use Glass Shader” which will just default to the inbuilt Cycles glass shader. I figured I’d make it easy to do whichever you please to keep as much artist freedom as possible. Most people will probably never need to go into the shader for any reason, this option only exists for someone who may be using a measured Fresnel IOR value.
  • As always, do not attempt to add/remove normal/bump/tangent maps while preview rendering. This can crash Blender/your computer.

Feel free to leave any comments or questions you might have in this thread and I’ll get to them as soon as possible.

Enjoy!

This shader is released under the CC-BY license. If you use this shader in a project, all that I ask is that you give attribution to myself and Stuart Broadfoot for his contribution to the glass shader. Aside from that, go wild, experiment, and have fun!

Thanks!
Will try it out. :wink:

Just out of interest, would something like this just for a simple glossy or diffuse material be significantly slower to render than just using the glossy / diffuse node on it’s own? Or does it not affect render times much having lots of nodes that aren’t affecting the material?

Thank you sir m9105826!
It is very personable!

My friendships
Bye
Spirou4D

In my tests the difference in render times was negligible, about .4 seconds for both the included file and for a more complicated scene I was testing.

M9, let’s put this ubershader to the TEST.

heheheeh

Ok, here’s my result with the Ubershader. I had some issues with the glossiness in the Ubershader, but the glass just works epic.

And I personally think it’s about time this guy got some recognition :wink:.


Had fun on this one. Loads.

Thanks, m91!

-swaschan

Glad to hear you liked it, and very cool model/render!

Please let me know the issues you’re having with the glossy component, I’m definitely interested in improving it in any way that I can.

Speaking of which:

http://pasteall.org/blend/19783

New and improved version. Added some very cool options and figured out kind of a hacky fix to the normal/bump issue (thanks Ace Dragon!). It’s very close to the Arnold Standard shader now. I’d like to add a fake, fast SSS shader to the mix, but I’m still figuring out the best way to integrate it all with the limited customization options of the node system (I’d kill for on/off tickboxes!). I’ll outline the additions in the original post. Enjoy!

they should add the switch_node to the material nodes

I agree, it would be very useful.

Also, v2.1.1 is ready. Anisotropy tangents can now be added to the outside of the node.

http://pasteall.org/blend/19784

+1 and including a input for Switch

This is very useful, thank you for sharing this great node setup :slight_smile:

Glad to contribute! I’ll have some settings for different materials coming shortly, and more images for the original post.

Also, 1500 posts, whoo!


All materials created with the Ubershader. I’ll be posting the material settings in the morning.

This is looking awesome! Great work!

Unfortunately it’s getting obvious Cycles doesn’t like Big Shader Setups… (similar Materials renders way slower) So i would not use it as a general Material Setup. But it’s great for having a discussion/ an idea how an Übershader could look like, so thanks.

The speed hits I’m experiencing are very small, more than offset by not having to create shader setups by hand. I have more tests to do, but it’s been promising so far.

After some more tests it would appear that on my CPU for simple materials my results are about 15% slower using the ubershader. For complex materials there is almost no difference. This problem would go away if there were a way to code an ‘if’ statement with the nodes, or use on/off toggles, but I haven’t figured out a way to do that as of now, if there is any way at all.

2:37 Diffuse Only
3:30 Übershader set to Diffuse (All Setting for the other Mix nodes Set to 0) (30% slower)
2:38 Übershader set to Diffuse but Connect first Mix Node directly to Nodegroup Output. So it does not calc the other 4 Mix Nodes.

Ok, not very Fair comparison, 1 Node against 28 Nodes, but then again, both just Diffuse Materials, Render exactly the same.

The Übershader is perfectly fine, it’s Cycles that either has a Bug or needs to be optimized. imho. Ever had 40, 50, 60 Nodes in one Material? I started to make my Materials as simple as possible, and pretty much gave up on using Textures for much more than very simple Materials or editing Image Textures… Ok, this is only partly cause it slows downs, other half is Cycles Texture editing through current Nodes is, well, ok for simple Tasks, but cumbersome for placing and editing Textures and more i can’t remember right now… But anyway, this does not belong in this Thread. So i will shut up until i have something about the Übershader. Thanks. :wink:

Edit: The “IF” or some sort of On/Off would be great. Together with Input, and not just Checkbox. Plus a State [Render Final(F12)] OR [Render Preview (Viewport)]

what a great contribution, thanks for sharing!