Page MenuHome

Shading: Add White Noise node.
ClosedPublic

Authored by Omar Emara (OmarSquircleArt) on Aug 21 2019, 1:48 PM.

Details

Summary

The White Noise node hashes the input and returns a random number in the
range [0, 1]. The input can be a 1D, 2D, 3D, or a 4D vector.

Diff Detail

Repository
rB Blender

Event Timeline

source/blender/makesrna/intern/rna_nodetree.c
174

Might be good to add some description here. Especially for the 2D case.

source/blender/makesrna/intern/rna_nodetree.c
174

What do you suggest?

source/blender/makesrna/intern/rna_nodetree.c
174

"Use only a single value to control the noise.", "Use only the x and y values of a vector to control the noise.", ...

4515

A description here would be good as well.

source/blender/makesrna/intern/rna_nodetree.c
174

I am using this enum for all textures, so I think it should have more generic tool tip. How about:

{1, "1D", 0, "1D", "Use the scalar value W as input"},
{2, "2D", 0, "2D", "Use the 2D vector (x, y) as input. The z component is ignored"},
{3, "3D", 0, "3D", "Use the 3D vector Vector as input"},
{4, "4D", 0, "4D", "Use the 4D vector (x, y, z, w) as input"},
source/blender/makesrna/intern/rna_nodetree.c
174

That's good enough for now.

Omar Emara (OmarSquircleArt) marked 4 inline comments as done.Aug 21 2019, 4:43 PM

Looks good to me now.

This revision is now accepted and ready to land.Aug 21 2019, 5:25 PM
Brecht Van Lommel (brecht) requested changes to this revision.Aug 21 2019, 7:11 PM

Looks generally fine, just one comment.

intern/cycles/util/util_hash.h
73

The change of (2 << 2) to (1 << 2) here causes all render tests to have different noise patterns, and changes the particle random number distribution.

We should avoid that, especially the latter since that's breaking backwards compatibility.

To fix that, you can replace any existing usage of hash_int(x) with hash_uint2(x, 0), and similar for hash_int_01.

This revision now requires changes to proceed.Aug 21 2019, 7:11 PM
  • Use hash_uint2 instead of hash_uint in Cycles code.
Omar Emara (OmarSquircleArt) marked an inline comment as done.Aug 21 2019, 7:23 PM
This revision is now accepted and ready to land.Aug 21 2019, 7:24 PM
This revision was automatically updated to reflect the committed changes.

I don't see any docs, neither in this diff nor at
https://docs.blender.org/manual/en/dev/render/shader_nodes/index.html.

Is the documentation missing or am I just not looking for it in the right place?

The manual is not updated immediately when new features get added to Blender.