Efficiency of the Principled Shader vs Classic Core vs rolling your own simple shaders?

   3387   3   3
User Avatar
Member
146 posts
Joined: Sept. 2011
Offline
Boy, there's a lot going on in that Principled Shader.

Top priority for me is fast renders. I don't do much photorealistic stuff; tends to be abstract or stylised. If I just need a plain ole' diffuse material, or a diff/spec/fresnelly material, what sort of increase in render speed am I likely to get by creating a simple shader from scratch (whatever that is)?

Guess I'm asking how much overhead there is in having all that gubbins in there, even if most of it is effectively switched off/bypassed.

If I just need, say, a pure and simple diff material, how deeply do I have to dive into the world of shaders to make one that's as efficient as possible? There's a Diffuse material in the Utility section of the Gallery - looks like most of the work is done by a Classic Shader Core, but even that seems quite complex internally. Much of the stuff would end up being bypassed (eg if a Color Map isn't provided) but each of those switches is an additional op that (I'm guessing) gets evaluated for every sample.

Most of the quality/speed tuning is handled by Mantra's render settings, but I'd like some idea of relative speeds of shaders so I know whether it's worth me investing precious time digging deeper into the shader world. Gotta balance the hedonistic world of gorging on Houdini tutorials with the practicalities of feeding the family.

(and it's not like the world of Houdini shader tutorials is without its confusion, too; Houdini advances and shape-shifts so fast I often find myself learning stuff just in time for it to be superseded)
User Avatar
Staff
2540 posts
Joined: July 2005
Offline
With what you want I'd say it's not so much which shader you use, but which render engine you choose to use in Mantra has the greatest effect with simplistic shading where only primary samples are required (no raytrace, no reflections, no indirect lighting).

There are three Mantra engines: PBR, Raytrace and Micropolygon.

If you want abstract stylized NPR NonPhotoReal type renders that only use primary samples and no secondary raytrace rays, or just straight diffuse and specular with no indirect lighting and use point lights, keep on using Principled material or any of the others and you can try out either raytrace or Micropolygon rendering engines as a first step.

This also means that you are using point lights with raytrace and micropolygon rendering! Did I say only use point lights? Only use point lights. Do NOT use area lights or geometry lights with raytrace or Micropoly renders! And if you use Environment lights, set them to Ambient Occlusion and use that environment light's samples to control quality. Exact opposite of PBR which is why it can be confusing for many lighting artists when choosing render engines and optimizing scenes.

For plain old diffuse and spec, micropoly or raytrace is good. Adding in fresnel reflections would be raytrace only.


If you need area lights and more complicated lighting, then go PBR as it is very fast compared to raytrace and micropolygon engines in these more complex lighting scenarios. But as you said, you don't use that. Right?

You can go quite far with principle shader and raytrace/micropolygon engines for quick snappy renders. Micro poly doesn't scale very well as it needs to pre-shade all the vertices but wouldn't you know there's a render property to control that per object. Plus you miss out on indirect lighting. Not as easy to set up as PBR these days.

All the materials that you use in the Material network should work with the Micropolygon and Raytrace render engines. If the materials in there suit your needs that is.


Warning!!!
- IPR in Preview mode will use raytracing even if you use micropolygon mode. You need to turn off the preview option (one of the little icons on the top IPR bar) in order to render with micro-polygons in IPR and see the correct result.


As for all the shenanigans going on in inside the principled shader, the compiler will strip all the needless stuff out and you are left with a fast executing shader, regardless of chosen Mantra render engine. In H16.5 even loose VOPs are pre-compiled for even more efficiency.


Regarding Principled shader vs. Classic, there really is no difference in terms of compilation or execution. They both use the same setups internally accessing the same surface models. Both will work with all three Mantra render engines. Principled has a bunch of internal biasing of the top parameters to make shading of complicated surfaces easier for artists. For example Metallicity on Principled takes in to account the specular colouring and refraction changes for you. No need to manage this as with the Classic shader. You don't need to know the differences between dielectric, non-dielectric and metallic materials with Principled…


As for the shape shifting material and shader context changes and outdated tutorials, we should be all good moving forward beyond H16 for the foreseeable future. Moving from /shop to /mat was necessary. We do apologize for that but getting this right was crucial.

—-

With NPR style simplistic rendering, I am always finding myself creating my own shaders out of VOPs or even vex code and using the VCC compiler to create material HDA's. Choosing just what I need to get the job done but you need to know how to construct the older type shaders for microplygon and raytrace render engines. Which is why PBR style rendering has taken over for almost all rendering tasks these days. It is where SideFX is concentrating shader development to meet main stream needs and that is all most excellent.

Myself? I like simplifying the shaders for NPR so that I can go in there and add my own shading types with little complication. But these are specialized shaders not used very often so not included in Houdini. We still have all the older and updated building block VOPs in there such as the Lighting Model VOP and for even more hard core users, illuminance loops to build up these old school style shaders if you want to, but PBR is out of the picture.

If there is a desire to have tutorials on how to set up these older style shaders and rendering setups for NPR style looks and take advantage of Micropolygon and raytrace rendering, just like this post and we'll see…
There's at least one school like the old school!
User Avatar
Member
146 posts
Joined: Sept. 2011
Offline
Thanks, Jeff, for the hugely detailed response. Much appreciated. This sort of thing would make a very useful addition to the docs, especially as Houdini finds its way into the motion graphics world. My corporate clients can't afford–nor do they need–PBR or realism, they just want something they can stick on YouTube that looks and feels slick and sophisticated while getting their message over. So Houdini's modelling and animation tools are a godsend; complex, multi-layered animations are so fast to create and refine…

…just need to know I can get the frames out fast enough at the end.

Cheers
User Avatar
Member
171 posts
Joined: Oct. 2016
Offline
@Jeff
Thanks for the given comparison between PBR and others Usually hear advices - just use PBR… and this I do. Always interesing to look at your workflows, that is not always simple to repeat Nicely that mantra surface just changed the name and live in another context, icon for the material context is more beautiful than for shop, but shop sounds more intriguing - what is it about at all O_o
For the first time hear the word “shenanigans” WIll take it in use if you're not against.
@howiem
Thanks for the asked question, that brought answer
Edited by RyuKu - Nov. 8, 2017 13:10:08
  • Quick Links