Bundle shader node group assets for compatibility #113145

Open
opened 2023-10-02 14:56:48 +02:00 by Brecht Van Lommel · 3 comments

When exporting shaders to other software, exporters usually do a best effort conversion from the Principled BSDF. However for users it is not obvious which inputs will work or not.

There is some standardization happening with glTF and OpenPBR, but it's still unlikely this will be solved entirely soon. Additionally for game engines it may be helpful to have inputs for image textures like normal maps, occlusion, thickness, etc.

To address this an idea is to add a number of shader group assets that under the hood will use the Principled BSDF or (only if necessary) other BSDF nodes. These can then hide parameters or expose additional ones.

  • Game Engines
    • Specular workflow
    • Metallic workflow
    • Only support image datablock with image sockets?
    • Differences between Unity, Godot, Unreal, .. ?
  • Disney BRDF
  • OpenPBR and Standard Surface
  • glTF

Exporters may need some changes to expand node groups to recognize the Principled BSDF. Or alternative not expand certain node groups that they recognize natively.

When exporting shaders to other software, exporters usually do a best effort conversion from the Principled BSDF. However for users it is not obvious which inputs will work or not. There is some standardization happening with glTF and OpenPBR, but it's still unlikely this will be solved entirely soon. Additionally for game engines it may be helpful to have inputs for image textures like normal maps, occlusion, thickness, etc. To address this an idea is to add a number of shader group assets that under the hood will use the Principled BSDF or (only if necessary) other BSDF nodes. These can then hide parameters or expose additional ones. * Game Engines * Specular workflow * Metallic workflow * Only support image datablock with image sockets? * Differences between Unity, Godot, Unreal, .. ? * Disney BRDF * OpenPBR and Standard Surface * glTF Exporters may need some changes to expand node groups to recognize the Principled BSDF. Or alternative not expand certain node groups that they recognize natively.
Brecht Van Lommel added the
Module
Render & Cycles
Type
To Do
labels 2023-10-02 14:56:48 +02:00
Author
Owner

This is just an idea so far, but I've been thinking about this for a while so might as well make an issue. It came up in the context of removing the Specular BSDF that only works in EEVEE currently.

CC @fclem @JulienDuroure @LukasStockner

This is just an idea so far, but I've been thinking about this for a while so might as well make an issue. It came up in the context of removing the Specular BSDF that only works in EEVEE currently. CC @fclem @JulienDuroure @LukasStockner
Member

Hello,

Some background regarding glTF:

Now, with 4.0 and new Principled, most of glTF can be handled by Principled itself. Only

  • Volume still needs a separate node + a socket in custom node group.
  • Occlusion is handled by a custom node group socket.
    ==> See 0 for custom group node created if needed

Here 1 is a file that can handle most of glTF data. (There is still Anisotropy that needs to be handle)

For most of parameter, glTF can handle factor and/or texture.
That means that for each Principled socket (for example BaseColor), we handle:

  • BaseColor.default_value if not linked
  • Texture if linked
  • Texture + multiply node if texture + factor
    ==> See 2

Current exporter version does not enter/exit node groups, but I have a PR ready, that should land in 4.1 (See 3)
Follow links entering and existing (possible recursively) is quite fastidious. Is there any chance to have an bpy API that automatically skip node group / reroute / etc... to keep link following as simple as possible in addons?

Regarding Godot, the current official workflow is to use .blend file as asset. Godot open Blender and export glTF in background, using my addon.

Hello, Some background regarding glTF: Now, with 4.0 and new Principled, most of glTF can be handled by Principled itself. Only - Volume still needs a separate node + a socket in custom node group. - Occlusion is handled by a custom node group socket. ==> See [0] for custom group node created if needed Here [1] is a file that can handle most of glTF data. (There is still Anisotropy that needs to be handle) For most of parameter, glTF can handle factor and/or texture. That means that for each Principled socket (for example BaseColor), we handle: - BaseColor.default_value if not linked - Texture if linked - Texture + multiply node if texture + factor ==> See [2] Current exporter version does not enter/exit node groups, but I have a PR ready, that should land in 4.1 (See [3]) Follow links entering and existing (possible recursively) is quite fastidious. Is there any chance to have an bpy API that automatically skip node group / reroute / etc... to keep link following as simple as possible in addons? Regarding Godot, the current official workflow is to use .blend file as asset. Godot open Blender and export glTF in background, using my addon. [0]: gltf_material_output.png [1]: 01_factors.blend [2]: factor_and_texture.png [3]: https://github.com/KhronosGroup/glTF-Blender-IO/pull/1735
Contributor

Hello,

Some background regarding glTF:

Now, with 4.0 and new Principled, most of glTF can be handled by Principled itself. Only

  • Volume still needs a separate node + a socket in custom node group.
  • Occlusion is handled by a custom node group socket.
    ==> See 0 for custom group node created if needed

Here 1 is a file that can handle most of glTF data. (There is still Anisotropy that needs to be handle)

For most of parameter, glTF can handle factor and/or texture.
That means that for each Principled socket (for example BaseColor), we handle:

  • BaseColor.default_value if not linked
  • Texture if linked
  • Texture + multiply node if texture + factor
    ==> See 2

Current exporter version does not enter/exit node groups, but I have a PR ready, that should land in 4.1 (See 3)
Follow links entering and existing (possible recursively) is quite fastidious. Is there any chance to have an bpy API that automatically skip node group / reroute / etc... to keep link following as simple as possible in addons?

Regarding Godot, the current official workflow is to use .blend file as asset. Godot open Blender and export glTF in background, using my addon.

I never understood why GLTF did it in such an ugly and clunky way which creates node group datablock to clutter the blender file and tends to get constantly duplicated on imports/exports. Why wouldn't you just use named AOV Node which would be a perfect fit for this?

I know this is a bit of offtopic, but I would rather the GLTF exporter to get its stuff together in terms of how it handles material interop rather than if this poor idea which causes workflow issues spread further.

> Hello, > > Some background regarding glTF: > > Now, with 4.0 and new Principled, most of glTF can be handled by Principled itself. Only > - Volume still needs a separate node + a socket in custom node group. > - Occlusion is handled by a custom node group socket. > ==> See [0] for custom group node created if needed > > Here [1] is a file that can handle most of glTF data. (There is still Anisotropy that needs to be handle) > > For most of parameter, glTF can handle factor and/or texture. > That means that for each Principled socket (for example BaseColor), we handle: > - BaseColor.default_value if not linked > - Texture if linked > - Texture + multiply node if texture + factor > ==> See [2] > > Current exporter version does not enter/exit node groups, but I have a PR ready, that should land in 4.1 (See [3]) > Follow links entering and existing (possible recursively) is quite fastidious. Is there any chance to have an bpy API that automatically skip node group / reroute / etc... to keep link following as simple as possible in addons? > > Regarding Godot, the current official workflow is to use .blend file as asset. Godot open Blender and export glTF in background, using my addon. > > [0]: gltf_material_output.png > [1]: 01_factors.blend > [2]: factor_and_texture.png > [3]: https://github.com/KhronosGroup/glTF-Blender-IO/pull/1735 I never understood why GLTF did it in such an ugly and clunky way which creates node group datablock to clutter the blender file and tends to get constantly duplicated on imports/exports. Why wouldn't you just use named AOV Node which would be a perfect fit for this? I know this is a bit of offtopic, but I would rather the GLTF exporter to get its stuff together in terms of how it handles material interop rather than if this poor idea which causes workflow issues spread further.
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#113145
No description provided.