← All ideas
  • Published 11 Feb 2020

Allow Different World Settings Per View Layer

Currently the active world shading setting you have is shared throughout every view layer. When it comes to lighting, if you want different lights in each view layer, that is no problem, because of collections and excluding. However, if you are also lighting with HDRI's and want to use a different HDRI per view layer, you cannot. Ideally, it would be great if you could create different world settings for each layer if you wanted to . Light linking might solve this in the future if it allowed HDRI's from the shader to also be affected by it, but I don't want to speak for that feature as I'm not a developer.

DIffernt View Layer.png

100%

Development Status: Open

Upvote 22 Downvote 0
daniellapalme
11 Feb 2020

10 Comments

tempodude

Found a way to do this, Based on this post.

  1. Enable 'Auto Run Python Scripts' (Preferences > Save & Load > Auto Run...)

  2. Add a new text document in the Text Editor , copy the following code into the document:

    def is_view_layer(depsgraph: bpy.types.Depsgraph, *layer_names: str) -> bool:
        print(f"depsgraph={depsgraph.mode} VL={depsgraph.view_layer.name}")
        return depsgraph.view_layer.name in layer_names
    
    bpy.app.driver_namespace['is_view_layer'] = is_view_layer
    
    
  3. Run the script manually (only needed the first time, the next time you open Blender you'll get a popup confirming you want to allow running code at startup).

Now lets say you want a property (HDRi background, film transparency, whatever) to be different for two view layers. You add a driver to the property (Right Click > Add Driver), make sure Type is set to Scripted Expression, and write:

  is_view_layer(depsgraph, 'View Layer Name')

Click Update Dependencies and you're done, the checkbox is now checked for that and only that view layer called 'View Layer Name'.

If the property you want to change is not a boolean, like a number or a string or something, then you can use this driver:

  true_value if is_view_layer(depsgraph, 'View Layer Name') else false_value

You can type multiple layer names to check for any one of them:

is_view_layer(depsgraph, 'Layer 1', 'Layer 2', 'Layer 3')
stann_co

finding need for this still. This should have become a thing ages ago

malefic.max

absolutely must have!

Topeich

Sooo much needed!

Indeed, everything like this should "easily" be solved if someday we have a proper layer with overiding system... maybe someday, hopefully :)

In the meantime, what I do is mapping a giant sphere with the hdri I want in every layer on a different collection.

guisado

Hi, a year late to the party and I´m running into this as well.

If any one, like me has no idea on how to combine scenes, here´s a tutorial just found youtube.com/watch

jason

FWIW, this is already possible using scenes instead of view layers.

daniellapalme Author

* @Jason van Gumster * Right! I forgot about that. Performance wise that may not be the best option though perhaps, but it can be done.

Draise

I agree, and with additional different render settings per layer.

daniellapalme Author

* @Andres Stephens - Trinumedia * Not different render settings. The world shading settings.

Draise

* @daniellapalme * Corrected my comment. I had a "+" sign, but it didn't show.

1