LookDev for external renderengines

Is it possible for external renderengines to create materials that work in look dev shading mode in the viewport?

I think the “PyNodeGLSL” project was a bit related to this topic, was it implemented?

Not currently. The best you can do is use the existing nodes to generate some approximation, whenever the user edits your material.

We may allow this in the future, but it would probably be quite limited. Anything besides simple operations and texture patterns requires more than an isolated piece of GLSL code. BSDFs, SSS, volumes, lighting all tie in closely to Eevee with preprocessing, multipass rendering and caching going on behind the scenes. It’s really hard to decouple those things.

I would like to avoid messing with the user’s existing node setups.
Maybe I can create a separate output + nodes for my approximation and delete them when the user switches to another engine.
It would be cool if each engine could create a hidden Eevee-nodetree attached to the material for this purpose.

The ability to show correct texture mapping, mix of textures and procedural textures would already be very welcome. Maybe support for simple alpha transparency would be nice as well.

Thank you for the quick reply.

1 Like

I just noticed that when the viewport is in look dev shading mode, the RenderEngine’s view_update and view_draw methods are called when the scene is edited. The objects appear uniform grey.
Is this intended?
Can I check if the engine is in look dev mode, like we can check for material preview (is_preview) or animation (is_animation) - something like is_lookdev?

1 Like

It seems to me like the lookdev and rendered shading modes do exactly the same thing when using a custom render engine. Is this a bug?

This means that I can’t follow this recommendation, because the existing nodes (I assume you meant Eevee nodes?) are not used in a custom render engine’s lookdev mode.
Or did I misunderstand you?

It indeed did not work. Committed a fix here:
https://developer.blender.org/rB095df1a

3 Likes

Awesome, thanks for the quick fix!

Thank you @brecht !!

@brecht What is the expected behaviour with respect to editing shaders using existing Cycles/Eevee nodes when a custom render engine is active? I’d like to be able to use the regular shader nodes for setting up materials, which then get translated to materials specific to the custom render engine during interactive/final render. The above threads suggests using the builtin nodes should be possible, at least for lookdev mode. But I’m having trouble getting any kind of editing of Cycles/Eevee shader networks when using the custom engine. I’ve opened https://developer.blender.org/T68473 for more details.

The description is wrong, it’s not possible to register or reuse custom shader nodes, only to create a custom separate node tree type with own nodes.

Maybe I’m misunderstanding. I’m currently registering custom nodes with nodeitems_utils.NodeItem(). This is as part of a RenderEngine that has bl_use_shading_nodes_custom = False (with the intention to keep the Cycles nodes available, but that doesn’t fully work as noted in the linked issue). When my render engine is active the custom nodes show up in the regular Shader Editor. I’m not using a custom node tree type at any point.

1 Like