Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBartosz Moniewski <monio>2019-12-06 00:07:43 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2019-12-07 21:06:27 +0300
commit074c00f9d6cc720461e6c8c7c13ed4e408ef372e (patch)
tree0d4efaa01952af47f5ea7a70cb14d764a2f597af /intern/cycles/kernel/svm/svm_noisetex.h
parent9c1134015c34ff19f3ff27c89321c019c67904b8 (diff)
Shaders: noise and wave distortion now work uniformly instead of diagonally
Previously Noise and Wave texture nodes would use noise functions within a [0,1] range for distortion effects. We either add or subtract noise from coordinates, never do both at same time. This led to the texture drastically shifting on the diagonal axis of a plane / cube. This behavior makes the Distortion input hard to control or animate. Capabilities of driving it with other texture are also limited, diagonal shifting is very apparent. This was fixed by offsetting the noise function to a signed range and making it zero-centered. This way noise is uniformly added and subtracted from coordinates. Texture pattern sticks to main coordinates which makes it way easier to control. This change is not strictly backwards compatible, there is versioning to ensure the scale of the distortion remains similar, but the particular pattern can be a little different. Differential Revision: https://developer.blender.org/D6177
Diffstat (limited to 'intern/cycles/kernel/svm/svm_noisetex.h')
-rw-r--r--intern/cycles/kernel/svm/svm_noisetex.h20
1 files changed, 10 insertions, 10 deletions
diff --git a/intern/cycles/kernel/svm/svm_noisetex.h b/intern/cycles/kernel/svm/svm_noisetex.h
index c5a1e43a729..12884c6cb25 100644
--- a/intern/cycles/kernel/svm/svm_noisetex.h
+++ b/intern/cycles/kernel/svm/svm_noisetex.h
@@ -55,7 +55,7 @@ ccl_device void noise_texture_1d(
{
float p = co;
if (distortion != 0.0f) {
- p += noise_1d(p + random_float_offset(0.0f)) * distortion;
+ p += snoise_1d(p + random_float_offset(0.0f)) * distortion;
}
*value = fractal_noise_1d(p, detail);
@@ -71,8 +71,8 @@ ccl_device void noise_texture_2d(
{
float2 p = co;
if (distortion != 0.0f) {
- p += make_float2(noise_2d(p + random_float2_offset(0.0f)) * distortion,
- noise_2d(p + random_float2_offset(1.0f)) * distortion);
+ p += make_float2(snoise_2d(p + random_float2_offset(0.0f)) * distortion,
+ snoise_2d(p + random_float2_offset(1.0f)) * distortion);
}
*value = fractal_noise_2d(p, detail);
@@ -88,9 +88,9 @@ ccl_device void noise_texture_3d(
{
float3 p = co;
if (distortion != 0.0f) {
- p += make_float3(noise_3d(p + random_float3_offset(0.0f)) * distortion,
- noise_3d(p + random_float3_offset(1.0f)) * distortion,
- noise_3d(p + random_float3_offset(2.0f)) * distortion);
+ p += make_float3(snoise_3d(p + random_float3_offset(0.0f)) * distortion,
+ snoise_3d(p + random_float3_offset(1.0f)) * distortion,
+ snoise_3d(p + random_float3_offset(2.0f)) * distortion);
}
*value = fractal_noise_3d(p, detail);
@@ -106,10 +106,10 @@ ccl_device void noise_texture_4d(
{
float4 p = co;
if (distortion != 0.0f) {
- p += make_float4(noise_4d(p + random_float4_offset(0.0f)) * distortion,
- noise_4d(p + random_float4_offset(1.0f)) * distortion,
- noise_4d(p + random_float4_offset(2.0f)) * distortion,
- noise_4d(p + random_float4_offset(3.0f)) * distortion);
+ p += make_float4(snoise_4d(p + random_float4_offset(0.0f)) * distortion,
+ snoise_4d(p + random_float4_offset(1.0f)) * distortion,
+ snoise_4d(p + random_float4_offset(2.0f)) * distortion,
+ snoise_4d(p + random_float4_offset(3.0f)) * distortion);
}
*value = fractal_noise_4d(p, detail);