"Principled v2" feedback/discussion thread

When the value of subsurface scaling is not 0, the graphics card will report an error ‘Launch failed in CUDA queue copy_from_device (integrator_shade_surface integrator_sorted_paths_array prefix_sum)’.

@lukasstockner97 Here are some new tests that I hope will be helpful to you. I noticed that with transmission values close to 1, there is a lot more noise than the old Principled bsdf.


uncompressed image:

The image is sampled 4096 times, if you want to see what the noise looks like, here is the picture without noise reduction:
Image in EXR format without noise reduction:
https://files.catbox.moe/4d4qie.exr

4 Likes

Interesting, does it properly read OCIO config for XYZ chromaticity? Just want to make sure it’s not hardcoded.

And I saw in the task page that you wrote:

illuminant-neutral XYZ conversion

I wonder whether you have achieved that? How? Blender currently hardcodes XYZ I-D65 (in blackbody node, sky texture nodes, etc.) while the proper standard XYZ is I-E, if you have achieved " illuminant-neutral XYZ conversion", does it mean that when we change the XYZ OCIO role to I-E, your iridescence will not be broken like the blackbody node etc.? If that’s the case this is impressive and forward-looking.

No Linux builds on Buildbot so far?

1 Like

Nice work, Lukas! My first test results are looking promising.

Do you expect Principled V2 to be present in the Blender 3.4 release?

1 Like

I don’t believe it’ll be in 3.4 as it’s way past the timeline for new features to be added.

Ah, too bad. Then I hope Principled V2 will soon be added to the main 3.5 alpha builds, for a broader test audience.

3 Likes

@lukasstockner97 the color passes are still broken any intent to fix it sooner ?? Cheers!

Does it support gpu now?

You can find a Linux build in the branch builds.

https://builder.blender.org/download/experimental/blender-3.4.0-alpha+principled-v2.45cd4c9c829c-linux.x86_64-release.tar.xz

1 Like

Ah, that build just popped up there. A few hours ago there were only Win and Mac builds.

Principled V2 SSS doesn’t work yet using the GPU, but other functions do work as far as I know.

@lukasstockner97 I saw you commited an attempted fix for Metal.

There are still some issues after the commit that’s resulting in the kernel not compiling. You can find them below (Once again, sorry for not having proper file names and line numbers)

Errors and warnings
program_source:2846:43: error: reference type must have explicit address space qualifier
ccl_device_inline float2 sqr(const float2 &a);
                                          ^
program_source:2847:46: error: reference type must have explicit address space qualifier
ccl_device_inline float average(const float2 &a);
                                             ^
program_source:3055:46: error: reference type must have explicit address space qualifier
ccl_device_inline float average(const float2 &a)
                                             ^
program_source:3060:43: error: reference type must have explicit address space qualifier
ccl_device_inline float2 sqr(const float2 &a)
                                          ^
program_source:120946:10: error: no matching function for call to 'sqr'
    *R = sqr(make_float2(rx, ry));
         ^~~
program_source:120981:15: error: no matching function for call to 'sqr'
  float2 Rs = sqr(T121) * R23 / (one_float2() - R123);
              ^~~
program_source:120988:14: error: no matching function for call to 'average'
  float3 I = average(R12 + Rs) * thin_film_sensitivity(0.0f, 0.0f);
             ^~~~~~~
program_source:121064:9: error: value of type 'bool __attribute__((ext_vector_type(3)))' (vector of 3 'bool' values) is not contextually convertible to 'bool'
    if (extra->dielectric != zero_spectrum()) {
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
program_source:121076:9: error: value of type 'bool __attribute__((ext_vector_type(3)))' (vector of 3 'bool' values) is not contextually convertible to 'bool'
    if (extra->metallic != zero_spectrum()) {
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
program_source:3565:26: note: candidate function not viable: no known conversion from 'float2' (vector of 2 'float' values) to 'float3' (vector of 3 'float' values) for 1st argument
ccl_device_inline float3 sqr(float3 a)
                         ^
program_source:4451:28: note: candidate function not viable: no known conversion from 'float2' (vector of 2 'float' values) to 'const float8_t' for 1st argument
ccl_device_inline float8_t sqr(const float8_t a)
                           ^
program_source:6530:25: note: candidate function not viable: no known conversion from 'float2' (vector of 2 'float' values) to 'float' for 1st argument
ccl_device_inline float sqr(float a)
                        ^
program_source:3565:26: note: candidate function not viable: no known conversion from 'float2' (vector of 2 'float' values) to 'float3' (vector of 3 'float' values) for 1st argument
ccl_device_inline float3 sqr(float3 a)
                         ^
program_source:4451:28: note: candidate function not viable: no known conversion from 'float2' (vector of 2 'float' values) to 'const float8_t' for 1st argument
ccl_device_inline float8_t sqr(const float8_t a)
                           ^
program_source:6530:25: note: candidate function not viable: no known conversion from 'float2' (vector of 2 'float' values) to 'float' for 1st argument
ccl_device_inline float sqr(float a)
                        ^
program_source:3599:25: note: candidate function not viable: no known conversion from 'float2' (vector of 2 'float' values) to 'const float3' (vector of 3 'float' values) for 1st argument
ccl_device_inline float average(const float3 a)
                        ^
program_source:4461:25: note: candidate function not viable: no known conversion from 'float2' (vector of 2 'float' values) to 'const float8_t' for 1st argument
ccl_device_inline float average(const float8_t a)
                        ^

Here’s a quick fix for the issue:

Diff to fix metal compilation issues
diff --git a/intern/cycles/kernel/closure/bsdf_microfacet.h b/intern/cycles/kernel/closure/bsdf_microfacet.h
index 8e4e4345a14..d0b8a23e7a7 100644
--- a/intern/cycles/kernel/closure/bsdf_microfacet.h
+++ b/intern/cycles/kernel/closure/bsdf_microfacet.h
@@ -64,7 +64,7 @@ ccl_device_forceinline Spectrum reflection_color(ccl_private const MicrofacetBsd
     Spectrum F = zero_spectrum();
     float cosHL = dot(H, L);
 
-    if (extra->dielectric != zero_spectrum()) {
+    if (!is_zero(extra->dielectric)) {
       if (extra->thin_film_thickness == 0.0f) {
         /* Dielectric Fresnel, just basic IOR control. */
         F += extra->dielectric * fresnel_dielectric_cos(cosHL, bsdf->ior);
@@ -76,7 +76,7 @@ ccl_device_forceinline Spectrum reflection_color(ccl_private const MicrofacetBsd
       }
     }
 
-    if (extra->metallic != zero_spectrum()) {
+    if (!is_zero(extra->metallic)) {
       /* Fresnel term with edge color control, see fresnel_metallic for details. */
       F += extra->metallic * fresnel_metallic(extra->metal_base, extra->metal_edge_factor, cosHL);
     }
diff --git a/intern/cycles/util/math_float2.h b/intern/cycles/util/math_float2.h
index 60686561f9b..9c851b99bd5 100644
--- a/intern/cycles/util/math_float2.h
+++ b/intern/cycles/util/math_float2.h
@@ -55,8 +55,8 @@ ccl_device_inline float2 sqrt(const float2 &a);
 #endif /* !__KERNEL_METAL__ */
 
 ccl_device_inline float2 safe_divide_float2_float(const float2 a, const float b);
-ccl_device_inline float2 sqr(const float2 &a);
-ccl_device_inline float average(const float2 &a);
+ccl_device_inline float2 sqr(const float2 a);
+ccl_device_inline float average(const float2 a);
 
 /*******************************************************************************
  * Definition.
@@ -264,12 +264,12 @@ ccl_device_inline float2 safe_divide_float2_float(const float2 a, const float b)
   return (b != 0.0f) ? a / b : zero_float2();
 }
 
-ccl_device_inline float average(const float2 &a)
+ccl_device_inline float average(const float2 a)
 {
   return (a.x + a.y) * (1.0f / 2.0f);
 }
 
-ccl_device_inline float2 sqr(const float2 &a)
+ccl_device_inline float2 sqr(const float2 a)
 {
   return a * a;
 }
4 Likes

Thanks, I just came to the topic because I was afraid to lose this artistic control in v2
I’d have never guessed the computation behind SSS coloring is a basic color mix.

1 Like

@lukasstockner97 Thank you for your presentation at BCon.
I’m not sure if I’m thinking about same thing regarding translucency, but I think it would be nice to be able to create semi-transparent or fully transparent and colored objects, like plastic foil sheets (colored), tracing papers, some kind of plastic lampshades or “milky” curtains.
Maxwell render is able to do this using some kind “fake” sss, so there was parameter Asymmetry to control outgoing lobe shape. Setting it to -1 allowed to get pure thin glass (with coloring), 0.5 was tracing paper, 0 was just diffuse transmitter and with 1 it was possible to get retro-reflector effect.
Also old Luxrender was able to do this, but I’m not sure it’s now possible as I’m not using one.
I hope this helps.

3 Likes

@lukasstockner97 thanks for your BCon presentation!

I used vray in the past and swapped over to Blender + I’m a professional since quite a few years in 3D-automotive now.

Setup:
I just created a plane + a sphere made by turning the metallic value to 1, roughness to 0 and the basecolor to complete white (just for testing purpose)
After this I added a light and increased the brightness all the way up so its a way to bright.

The Metallic Sphere is reflecting the light in a lower brightness level (correctly exposed), i know this is the case in real physics but it looks weird i guess… is this a correct behavior?

Problem: Automotive industry you try to light a car by using lights target on planes to get nice gradient, thats not possible at the moment. There are no values between blown out parts and correct exposure inside of the reflection/specular.

1 Like

i forgot:

Tested in 3.4.0. Alpha and normal “Principled” not your “Principled v2”

i found out, its a clamp issue

Sorry!

1 Like

Just watched @lukasstockner97’s BCON 22 presentation. Loved it. Informative, and entertaining too. :slightly_smiling_face:

3 Likes

Hi all,

Testing the development build with the principle v2 and for someone that had used arnold and pxrsurface this is really annoying. We dont have specular, I know, I read the replies, but it not make sense. The thin film feature only works with non metallic materials. I made some anodized metals on arnold and it works like real. Didn’t get it.

Just for example, a titanium metal with an oxide film of ~300 nm made the metal color appear green.

1 Like