[SOLVED] MAT Context Stylesheets Override

   3491   6   2
User Avatar
Member
267 posts
Joined:
Offline
Is the new MAT context shaders supported by Stylesheets?

I have a simple test scene, where I'm assigning random diffuse colors to packed primitives via Stylesheets material overrides.

In the attached scene, you'll see two approaches testing the shaders from MAT and SHOP contexts.
If I use the “From SHOPs” style, it works. (Green box highlight)
But if I disable it to use the “From MATs” style, it does not work. (Red box highlight)


I wonder if there's an additional setup needed for MATs?

H16.0.600 Indie
Edited by galagast - May 12, 2017 00:54:54

Attachments:
mat_stylesheets.jpg (110.0 KB)
mat_stylesheets.zip (44.8 KB)

User Avatar
Member
8177 posts
Joined: Sept. 2011
Offline
Your mat shader doesn't have any parameters. Stylesheets and material overrides can only change shader parameters. Promote the ‘color’ input of the diffuse layer with a parameter vop, and it works.
User Avatar
Member
267 posts
Joined:
Offline
Awesome, thank you jsmack! That was the missing piece of the puzzle
User Avatar
Member
267 posts
Joined:
Offline
After working on the test scene a bit more, I noticed that using /MAT for stylesheets seems to be slower as opposed to using /SHOPS.

Try these out on the attached file:
  1. Open the File
  2. Go to a Render View pane tab
  3. Disable Preview
  4. Hit Render
  5. Note the render time
The file is set up to use the old SHOP shaders.

Now, we switch to using MAT shaders:
  1. Open a Stylesheets pane tab
  2. Expand the styles for the Teapot Object
  3. Un-Check to Turn ON “From MATs”
  4. Check to Turn OFF “From SHOPs”
  5. Render
  6. Note the render time

Here are my results for 100k instances:
SHOPs: 40s | 2.6gigs
MATs: 1m12s | 5.5gigs

For some reason, MATs seems to be slower and is consuming more memory.
Also, if I push the instances to a million, MATs would eat up more than my 32gigs of ram and start swapping, then it would eventually stop with a Windows error about not too much resources.

Could anyone be able to test and confirm?

H16.0.600 Indie
Edited by galagast - May 11, 2017 14:49:29

Attachments:
fast_instancing.zip (48.1 KB)

User Avatar
Member
8177 posts
Joined: Sept. 2011
Offline
Does it do that if you put the mat shader in a real material, (not adhoc)? Collapse the vops you had assigned into a material builder, and let us know.
User Avatar
Member
267 posts
Joined:
Offline
And again, thank you jsmack! Placing it inside a /MATs Material Shader Builder resulted in the same render duration as the /SHOPs.

I guess I got too complacent in using the new /MATs context that a lot of the old paradigm in using shaders was completely disregarded >_<

Cheers!

(branch post) [sidefx.com]
Edited by galagast - May 12, 2017 00:55:57
User Avatar
Member
8177 posts
Joined: Sept. 2011
Offline
Thanks for doing that test, I was curious myself.
  • Quick Links