1
$\begingroup$

I am working on a complex scene with many different starships in it. This is a recreation of an old PC game poster, and since each starship was lit in a bit different way, my idea was to have each ship in its own collection, with its own lights, and to then put it all together in compositor. Nothing complicated.

However, I am using custom view layer properties to control various properties of each ship - I make new drivers from them and paste them inside some shader value like roughness, metalness, etc. This allows me to achieve the look I need very flexibly since each starship has a large number of shaders on it, and I can use the custom property to adjust the value in them centrally. It works nicely.

The problem: I want to create several different view layers, each of them showing only one collection with a starship. The plan is to then put all of them together inside compositor. When I create a new view layer, I select the option to copy the settings of the main one. This also copies the custom properties I mentioned in the paragraph above. However, for some reason, even though the custom properties are there, the shader values using them as drivers now read as 0.

My wild guess is that blender is still trying to load these properties from the main view layer but cannot access them, so they're zeroed out. Do I have any options how to solve this aside from having to re-assign them in each view layer?

enter image description here

$\endgroup$
5
  • $\begingroup$ Are there any errors shown in the system console after values are zeroed? The system console can be called from Top Menu > Windows > Toggle System Console on Windows, or if you use Mac or Linux Blender should be launched from Terminal and the Terminal will act as Blender System Console. It is not quite clear for me what you mean by custom view layer properties: which panel exactly do you use to add custom properties to a View Layer? $\endgroup$ Commented Jul 29, 2023 at 10:45
  • 1
    $\begingroup$ Thanks for the comment. I see no errors in the console. I am creating custom properties in the view layer properties tab. Screenshot: 1drv.ms/i/s!AohDmDW98tXLiqsxIlbXxSK3nuFIuQ?e=5NH3uP $\endgroup$
    – Ondrej
    Commented Jul 29, 2023 at 17:21
  • $\begingroup$ I've checked in 3.5, and definitely error occurs in driver and for some reason it is not shown in the Console. If you right-click > Edit Driver on the property with driver, you will see that the Path tab is red and the View Layer it tries to use is the View Layer it was added at. I'm afraid the only way for this system to work is to fix View Layer name in the Path tab of each driver in each material and not to use objects with wrong View Layer in material drivers. Pythonically there is no mistake, it should work from other View Layers, but it doesn't, so I think it can be considered a bug. $\endgroup$ Commented Jul 29, 2023 at 23:27
  • 1
    $\begingroup$ OK, thank you. Not the answer I was hoping for, but you don't always get what you hope for :) Please post this as an answer so that I can award the bounty to you. $\endgroup$
    – Ondrej
    Commented Jul 30, 2023 at 17:49
  • 1
    $\begingroup$ Thank you! Sorry, I am currently a bit out of time, have no possibility to compile a valuable answer. And the answer suggested by @Luis Quintana seems to be a great solution ) $\endgroup$ Commented Aug 1, 2023 at 14:16

1 Answer 1

3
+150
$\begingroup$

If you want to access View Layer Custom Properties from the material editor, use Attribute input node (type: View Layer) instead of drivers. View layer custom properties as attribute The View layer properties will be copied into a new view layer and the material will always read the current layer values.

$\endgroup$
2
  • $\begingroup$ Thank you, Luis! $\endgroup$
    – Ondrej
    Commented Aug 2, 2023 at 17:53
  • $\begingroup$ You`re welcome! $\endgroup$ Commented Aug 2, 2023 at 19:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .