Cycles Refactor: Replace fixed Tangent input with custom input #119042

Merged
Brecht Van Lommel merged 8 commits from Alaska/blender:tangent-to-param5 into main 2024-04-26 15:25:25 +02:00
Member

This replaces the fixed Tangent input in BsdfNode::compile
with a custom input.

This is done because very few nodes actually use the tangent input
and it would be better to have this slot avaliable for other inputs
on different nodes in the future.

There should be no user facing changes.

This replaces the fixed Tangent input in `BsdfNode::compile` with a custom input. This is done because very few nodes actually use the tangent input and it would be better to have this slot avaliable for other inputs on different nodes in the future. There should be no user facing changes.
Alaska added the
Module
Render & Cycles
label 2024-03-04 04:55:28 +01:00
Alaska added 1 commit 2024-03-04 04:55:36 +01:00
Alaska changed title from Cycles: Replace the fixed Tangent input with custom input to WIP: Cycles: Replace the fixed Tangent input with custom input 2024-03-04 04:55:48 +01:00
Author
Member

@LukasStockner suggested this might be desirable during the review of #114499, but I noted I'd prefer this as a seperate pull request.

@LukasStockner suggested this might be desirable during the review of #114499, but I noted I'd prefer this as a seperate pull request.
Alaska force-pushed tangent-to-param5 from 2a7939ddbd to 2d715d0a0a 2024-04-22 04:47:32 +02:00 Compare
Alaska changed title from WIP: Cycles: Replace the fixed Tangent input with custom input to Cycles: Replace the fixed Tangent input with custom input 2024-04-22 04:52:02 +02:00
Alaska requested review from Brecht Van Lommel 2024-04-22 04:52:10 +02:00
Alaska requested review from Lukas Stockner 2024-04-22 04:52:18 +02:00
Alaska requested review from Sergey Sharybin 2024-04-22 04:52:26 +02:00
Alaska force-pushed tangent-to-param5 from 2d715d0a0a to 7f215a0323 2024-04-22 05:00:46 +02:00 Compare

@blender-bot build

@blender-bot build
Alaska added 1 commit 2024-04-22 13:58:24 +02:00
buildbot/vexp-code-patch-lint Build done. Details
buildbot/vexp-code-patch-darwin-x86_64 Build done. Details
buildbot/vexp-code-patch-darwin-arm64 Build done. Details
buildbot/vexp-code-patch-linux-x86_64 Build done. Details
buildbot/vexp-code-patch-windows-amd64 Build done. Details
buildbot/vexp-code-patch-coordinator Build done. Details
50110d22fc
Reduce state usage with isotropic glossy bsdf

@blender-bot build

@blender-bot build

Is there some actual practical example of nodes which plan to use the this slot?

I can't say undocumented and hard-to-see re-shuffling of numbered generic parameters like param5_offset, param3_offset, param4_offset is straightforward to follow and understand. There're plenty of cryptic aspects of Cycles already, to me it feels we should not make it even more cryptic. If there are plans to actually utilize the freed slot, maybe we can schedule a bit of time to work on a cleaner solution?

Is there some actual practical example of nodes which plan to use the this slot? I can't say undocumented and hard-to-see re-shuffling of numbered generic parameters like `param5_offset, param3_offset, param4_offset` is straightforward to follow and understand. There're plenty of cryptic aspects of Cycles already, to me it feels we should not make it even more cryptic. If there are plans to actually utilize the freed slot, maybe we can schedule a bit of time to work on a cleaner solution?
Brecht Van Lommel approved these changes 2024-04-22 16:43:16 +02:00
Dismissed
Lukas Stockner approved these changes 2024-04-23 01:10:18 +02:00
Dismissed
Lukas Stockner left a comment
Member

I think this change is small enough to go through for now, but in general I agree with @Sergey that the parameter handling in its current form is a mess:

  • Some parameters are passed as int, some as uchar.
  • Some are always assigned, some only when not equal to a default, and some only when non-constant (with an extra 32-bit field to pass the constant value).
  • The ordering is often inconsistent and weird.

I don't think we can make this super-fancy because of the inherent limitations of the host-kernel interface, but it has to be possible to do it better than the current state. Even something small like a table of all SVM opcodes and their arguments might help.

I think this change is small enough to go through for now, but in general I agree with @Sergey that the parameter handling in its current form is a mess: - Some parameters are passed as `int`, some as `uchar`. - Some are always assigned, some only when not equal to a default, and some only when non-constant (with an extra 32-bit field to pass the constant value). - The ordering is often inconsistent and weird. I don't think we can make this super-fancy because of the inherent limitations of the host-kernel interface, but it has to be possible to do it better than the current state. Even something small like a table of all SVM opcodes and their arguments might help.
@ -2393,2 +2392,4 @@
closure = distribution;
ShaderInput *tangent = input("Tangent");
tangent = tangent->link || tangent->constant_folded_in ? tangent : NULL;
Member

I'd prefer to add a SVMCompiler::is_linked to check these conditions, seems a bit cleaner than repeating them here.

If not, I'd suggest at least wrapping the condition in parentheses.

Also, nitpick, but I think this should be nullptr in new code.

I'd prefer to add a `SVMCompiler::is_linked` to check these conditions, seems a bit cleaner than repeating them here. If not, I'd suggest at least wrapping the condition in parentheses. Also, nitpick, but I think this should be `nullptr` in new code.
Lukas Stockner requested changes 2024-04-23 01:10:31 +02:00
Lukas Stockner left a comment
Member

Wrong button, sorry.

Wrong button, sorry.
Alaska added 1 commit 2024-04-23 02:48:11 +02:00
Alaska requested review from Lukas Stockner 2024-04-23 02:53:23 +02:00
Author
Member

Is there some actual practical example of nodes which plan to use the this slot?

Lukas said we may want to make this change to make the addition of roughness to the Subsurface scattering node simpler: #114499

maybe we can schedule a bit of time to work on a cleaner solution?

What did you have in mind for a cleaner solution? Just making sure it's in numerical order (param3, param4, param5) and make all the fixes related to changing the order (Like this: 48ade96387)? Or something more complex?

> Is there some actual practical example of nodes which plan to use the this slot? Lukas said we may want to make this change to make the addition of roughness to the Subsurface scattering node simpler: #114499 > maybe we can schedule a bit of time to work on a cleaner solution? What did you have in mind for a cleaner solution? Just making sure it's in numerical order (param3, param4, param5) and make all the fixes related to changing the order (Like this: https://projects.blender.org/blender/blender/commit/48ade96387648fccbab8a71fdc511bd0bd50c0d1)? Or something more complex?

What did you have in mind for a cleaner solution? Just making sure it's in numerical order (param3, param4, param5) and make all the fixes related to changing the order (Like this: 48ade96387)? Or something more complex?

Definitely nothing more complex, not for this step anyway. Something more complex would be better to be be handled separately.

Maybe for now it could be something simple as renaming param{1,2,3,4,5} to bsdf_{y,z}/data_{y,z,w}. Then it becomes more clear where things will be stored, even if they are currently expected to be provided out-of-canonical-order. Thoughts?

> What did you have in mind for a cleaner solution? Just making sure it's in numerical order (param3, param4, param5) and make all the fixes related to changing the order (Like this: 48ade96387)? Or something more complex? Definitely nothing more complex, not for this step anyway. Something more complex would be better to be be handled separately. Maybe for now it could be something simple as renaming `param{1,2,3,4,5}` to `bsdf_{y,z}`/`data_{y,z,w}`. Then it becomes more clear where things will be stored, even if they are currently expected to be provided out-of-canonical-order. Thoughts?
Alaska added 3 commits 2024-04-23 10:52:28 +02:00
buildbot/vexp-code-patch-lint Build done. Details
buildbot/vexp-code-patch-linux-x86_64 Build done. Details
buildbot/vexp-code-patch-darwin-x86_64 Build done. Details
buildbot/vexp-code-patch-darwin-arm64 Build done. Details
buildbot/vexp-code-patch-windows-amd64 Build done. Details
buildbot/vexp-code-patch-coordinator Build done. Details
55c22bdc96
Merge branch 'main' into tangent-to-param5
Alaska changed title from Cycles: Replace the fixed Tangent input with custom input to Cycles Refactor: Replace fixed Tangent input with custom input 2024-04-23 10:53:11 +02:00

@blender-bot build

@blender-bot build
Brecht Van Lommel requested changes 2024-04-24 21:05:45 +02:00
Dismissed
Brecht Van Lommel left a comment
Owner

I like the code changes, but some tests appear to be failing.

I like the code changes, but some tests appear to be failing.
Alaska added 1 commit 2024-04-25 02:57:39 +02:00
buildbot/vexp-code-patch-lint Build done. Details
buildbot/vexp-code-patch-linux-x86_64 Build done. Details
buildbot/vexp-code-patch-darwin-x86_64 Build done. Details
buildbot/vexp-code-patch-darwin-arm64 Build done. Details
buildbot/vexp-code-patch-windows-amd64 Build done. Details
buildbot/vexp-code-patch-coordinator Build done. Details
9bfe2a3873
Merge branch 'main' into tangent-to-param5
Author
Member

I can not reproduce the test failures locally. So I've merged with main and pushed the changes to my branch in hope that fixes it.

I can not reproduce the test failures locally. So I've merged with main and pushed the changes to my branch in hope that fixes it.

@blender-bot build

@blender-bot build

You're probably using a build without asserts? Either a debug build, or enabling WITH_ASSERT_RELEASE should work.

You're probably using a build without asserts? Either a debug build, or enabling `WITH_ASSERT_RELEASE` should work.
Alaska added 1 commit 2024-04-25 19:40:34 +02:00
buildbot/vexp-code-patch-lint Build done. Details
buildbot/vexp-code-patch-linux-x86_64 Build done. Details
buildbot/vexp-code-patch-darwin-x86_64 Build done. Details
buildbot/vexp-code-patch-windows-amd64 Build done. Details
buildbot/vexp-code-patch-darwin-arm64 Build done. Details
buildbot/vexp-code-patch-coordinator Build done. Details
698da133d4
Fix failing tests
Was caused by a missed code change

@blender-bot build

@blender-bot build
Brecht Van Lommel approved these changes 2024-04-26 15:24:26 +02:00
Brecht Van Lommel merged commit 03cb588529 into main 2024-04-26 15:25:25 +02:00
Brecht Van Lommel deleted branch tangent-to-param5 2024-04-26 15:25:28 +02:00
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
4 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#119042
No description provided.