WIP SSS MDL ubershader for anyone who wants to experiment

see attached hacked together over the last day or so from online examples of code I could find (and lots of reading the MDL manual!)

its not got any texture slots hooked in yet (working on it) but it does work reasonably well - the SSS parametrisation is a little weird right now until I can work out how to stop the volumetric side of it making things too dark - code is commented so open it up in a text editor for some inline notes

only really works in path trace mode and iray - its kind of busted in real time mode

with SSS on:


ubershaderSSS.mdl (9.4 KB)

1 Like

this is cool, looking forward to playing with it!
only had a look at the code at the moment, but it would be nice to have a dedicated mode for thin walled geometry (leaves etc).

also, this I found an interesting read when it comes to ubershaders
(the github issues also have some interesting comments)

nice work!

yeah I’ve read that white paper

the ideas is sound but its a bit light on implementation - the github code is kinda half finished (or was the last time I looked at it)

this was more just for fun, since I as finding the inbuilt surfaces a little limiting and the arch cad stuff that seems to make up most of the MDL you can actually grab online is of limited interest to me personally beyond waht I can learn from deconstructing it

I’ll probably have an improved version of this that Ill shove up in the next few days, but I have to se if I can sort out a few issues with energy conservation - too many parameters make the shader darker right now - especially thee SSS, though the way I’m doing it here is sort clunky anyway (rendering a volume inside and essentially peering into that via a diffuse transmission bsdf - that seems to be pretty much the only way to do it with the stock function definitions but looking at GTC Nvidia have a much more sophisticated shader coming soon anyhoo :)

1 Like

yep, agreed - there isn’t that much available easily for this sort of stuff. a link I found interesting is this one

at the bottom there is a free download to an mdl to visualize sss in substance via iray

however that might just be another rabbit hole to get lost in (as it seems to include additional substance specific functionality), but yeah - might not be worth the time for all the reasons you mentioned

Hah - that was one of the sources I looked at when hacking my version together :)

I pretty much nicked the SSS idea from that implementation (though I essentially ended up rewriting most of it, the core idea is the same)

just discovered this - seems to be a pretty complete implementation of Autodesk’s standard shader direct from the reference OSL

I noticed it essentially does the SSS the same way I’m doing it, but with fancier math :)
it has many of the same issues therefore on SSS (ie SSS albedo in no way matches the diffuse albedo and is much darker)

still nice job

uhh, good find! another forum to monitor!

(I assume the artifacts are due to my hacked together topology)

the thread also pointed me to the materialx repo, which seems to have a script that converts all the material x nodes (including a std surface) to mdl

I guess something else to play around with. Also tempted to add texture slots to these, in the unlikely case I find enough time…

yeah I’m still planning on developing mine with tex slots - though I’m tempted to use the more advanced template I linked to as its much more complete and ‘correct’ in general

one thing I’ve discovered though is Create RTX does not seem to implement the correction term on various MDL BSDF’s that compensates for energy loss due to lack of multi scattering on microfacets (which affects practically ALL the available BSDFs) - so essentially all high roughness surfaces will have darker edges than they should - this issue tends to compound itself on layered shaders

eg see rendering - Compensation for energy loss in single-scattering microfacet BSDF models - Computer Graphics Stack Exchange

MDL itself incorporates some kind of mechanism to deal with this but doesn’t seem to have any effect in Create