MaterialX: Implement White Noise node #113495

Merged
Brecht Van Lommel merged 7 commits from DagerD/blender:matx-add-white-noise-node into main 2023-10-23 17:31:51 +02:00

Purpose

Implement conversion for White Noise node

Technical steps

Implemented conversion for White Noise node

Ref: #112864

### Purpose Implement conversion for White Noise node ### Technical steps Implemented conversion for White Noise node Ref: #112864
Georgiy Markelov added 1 commit 2023-10-10 15:11:48 +02:00
Georgiy Markelov requested review from Brian Savery (AMD) 2023-10-10 15:12:37 +02:00
Georgiy Markelov requested review from Bogdan Nagirniak 2023-10-10 15:12:37 +02:00
Georgiy Markelov requested review from Vasyl Pidhirskyi 2023-10-10 15:12:38 +02:00
Bogdan Nagirniak requested changes 2023-10-11 13:28:31 +02:00
@ -188,0 +191,4 @@
NodeItem noise = empty();
NodeItem vector = get_input_link("Vector", NodeItem::Type::Vector3);
NodeItem w = get_input_value("W", NodeItem::Type::Float);
switch (node_->custom1) {
Contributor

Add variable which name this node option: int <option name> = node_->custom1.
See example https://projects.blender.org/blender/blender/src/branch/main/source/blender/nodes/shader/nodes/node_shader_math.cc#L186

Add variable which name this node option: `int <option name> = node_->custom1`. See example https://projects.blender.org/blender/blender/src/branch/main/source/blender/nodes/shader/nodes/node_shader_math.cc#L186
DagerD marked this conversation as resolved
@ -188,0 +192,4 @@
NodeItem vector = get_input_link("Vector", NodeItem::Type::Vector3);
NodeItem w = get_input_value("W", NodeItem::Type::Float);
switch (node_->custom1) {
case 1:
Contributor

Are there existing constants?

Are there existing constants?
DagerD marked this conversation as resolved
Georgiy Markelov added 1 commit 2023-10-11 14:42:16 +02:00
Bogdan Nagirniak requested changes 2023-10-11 15:21:19 +02:00
@ -188,0 +194,4 @@
int dimension = node_->custom1;
switch (dimension) {
case 1:
noise = create_node("cellnoise2d",
Contributor

Optimize getting values, only w is used here

Optimize getting values, only w is used here
DagerD marked this conversation as resolved
@ -188,0 +218,4 @@
return noise;
}
NodeItem combine = create_node(
Contributor

Add comment what we are doing here

Add comment what we are doing here
DagerD marked this conversation as resolved
Georgiy Markelov added 1 commit 2023-10-11 16:00:46 +02:00
b09196dd12 MaterialX: optimize getting values
Also add comment about colored output
Georgiy Markelov added 1 commit 2023-10-11 16:49:34 +02:00

White noise gives a different result for every texture coordinate, it hashes the floating point values. But cell noise I think only changes at different integer coordinates?

The simple trick would be to multiply the texture coordinate by a large number, but that can run into precision issues.

With math nodes something like this could be done, until MaterialX natively supports something like hashnoise in OSL.
https://stackoverflow.com/a/28095165

White noise gives a different result for every texture coordinate, it hashes the floating point values. But cell noise I think only changes at different integer coordinates? The simple trick would be to multiply the texture coordinate by a large number, but that can run into precision issues. With math nodes something like this could be done, until MaterialX natively supports something like `hashnoise` in OSL. https://stackoverflow.com/a/28095165
Bogdan Nagirniak added 1 commit 2023-10-19 18:32:30 +02:00
Bogdan Nagirniak approved these changes 2023-10-19 18:34:04 +02:00
Bogdan Nagirniak left a comment
Contributor

Added LARGE_NUMBER texcoord multiplicator.
Tested - works good.

Added `LARGE_NUMBER` texcoord multiplicator. Tested - works good.
Bogdan Nagirniak added 2 commits 2023-10-19 19:22:57 +02:00
Brecht Van Lommel merged commit 132b90651a into main 2023-10-23 17:31:51 +02:00
Brecht Van Lommel deleted branch matx-add-white-noise-node 2023-10-23 17:31:52 +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
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#113495
No description provided.