"Principled v2" feedback/discussion thread

After reading the concerns about consistence with other nodes , dissaperance of sockets etc. So this just an alternative solution if design of collapsable menus will be an issue.

For instance, in the collapsable header example in old mockup, adding extra header title will cause longer node if someone uses all the features without collapsing any header, so headers will occupy even more space when they are not collapsed.

I think long node wont be too bad (or not much) by this olternative approach:

Princpled BSDF can be long by default when new material is created,
But on N properties panel , there can be extra options as we always had (EX: displacement type bump or true displacement etc) , these extra options can exist to disable or enable some parts of principled bsdf regarding anisotrophy, , transmission, emission, clearcoat, sheen , subsurface scattering , so, those dropdown headers for different sections can instead be checkbox on properties panel, then users can reduce principled bsdf as they want, so it wont cause any inconsistency compared to other nodes in UI there will be less confusion and it will also not make unnecessary space if we use other alternatives like PRORENDER’s box enabling approach to add new options or collapsable extra grouping headers making it longer in Octane,

Also, those settings can be preserved while copying pasting principled bsdf that can make things easy.

Plus, the area regarding the checkboxes for extending or shortening principled bsdf can have presets functionality (like in properties render setting panels for light paths,) so for example preset is dialectric, u choose it there only checkboxes related to principled bsdf are checked and this way blender can come with presets for making users be more aware of which sections in principled bsdf they need for a specific material type

Or this option might also be placed on NODE tab on N panel rather than OPTIONS tab on N panel if it fits better

(Note: In the edited screenshot images I provided, I know its not new principled BSDF, I just tried to explain the idea, I didnt use the new branch to show this)

If you are on windows system, you can use this one I built temporarily.

2 Likes

It will most likely become available on Blender Builds - blender.org in the near future.


The Principled v2 Branch of Blender has been updated to be based on the latest master and now has Path Guiding built in.

1 Like

Good point, I’ve added a wavelength unit type (also applies to the Wavelength node).

Fixed.

Looks good, thanks! Seems like the thickness is not consistent, though, I’ll look closer into that.

Thanks, should be fixed now.

Also fixed.

I’ve started a build on the buildbot containing the fixes above.

17 Likes

For some reason when inputting a value with a keyboard, it uses pm not nm, so to get visible results you need to type something like 500 000.

Also there is no longer a separate transmission roughness control. Do you still plan to add it? It would be quite useful when making certain frosted glass materials.

When rendering with the Metal GPU backend, there are some errors that result in the kernel not compiling, and some warnings (which may be useful to investigate). You can find them below. Sorry for not having file names and line numbers.

Just for reference, this is a commit from an Apple Engineer fixing the pointer type must have explicit address space qualifier error in Cycles when initially adding Metal to Cycles: rBa0f269f682da

Error messages
program_source:120817:53: error: pointer type must have explicit address space qualifier
    float cosTheta1, float eta1, float eta2, float2 *R, float2 *phi)
                                                    ^
program_source:120817:64: error: pointer type must have explicit address space qualifier
    float cosTheta1, float eta1, float eta2, float2 *R, float2 *phi)
                                                               ^
program_source:130633:48: error: pointer type must have explicit address space qualifier
                                         float *reflect_pdf)
                                               ^
program_source:132563:70: error: pointer type must have explicit address space qualifier
sheen_v2_eval(float3 N, float3 V, float3 L, float3 H, float r, float *pdf)
                                                                     ^
program_source:145512:52: error: pointer type must have explicit address space qualifier
                                               int *offset)
                                                   ^
program_source:145564:49: error: pointer type must have explicit address space qualifier
                                            int *offset)
                                                ^
program_source:120517:7: error: value of type 'bool __attribute__((ext_vector_type(3)))' (vector of 3 'bool' values) is not contextually convertible to 'bool'
  if (F82 == one_spectrum()) {
      ^~~~~~~~~~~~~~~~~~~~~
program_source:120836:10: error: no matching function for call to 'sqr'
    *R = sqr(make_float2(rx, ry));
         ^~~
program_source:3564: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:4441: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:6520: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:120871:15: error: no matching function for call to 'sqr'
  float2 Rs = sqr(T121) * R23 / (one_float2() - R123);
              ^~~
program_source:3564: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:4441: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:6520: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:120878:14: error: no matching function for call to 'average'
  float3 I = average(R12 + Rs) * thin_film_sensitivity(0.0f, 0.0f);
             ^~~~~~~
program_source:3589: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:4451: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)
                        ^
program_source:120950:23: error: pointer type must have explicit address space qualifier
    MicrofacetExtrav2 *extra = (MicrofacetExtrav2 *)bsdf->extra;
                      ^
program_source:120950:51: error: pointer type must have explicit address space qualifier
    MicrofacetExtrav2 *extra = (MicrofacetExtrav2 *)bsdf->extra;
                                                  ^
program_source:121063:21: error: pointer type must have explicit address space qualifier
  MicrofacetExtrav2 *extra = (MicrofacetExtrav2 *)bsdf->extra;
                    ^
program_source:121063:49: error: pointer type must have explicit address space qualifier
  MicrofacetExtrav2 *extra = (MicrofacetExtrav2 *)bsdf->extra;
                                                ^
program_source:130720:7: error: value of type 'bool __attribute__((ext_vector_type(3)))' (vector of 3 'bool' values) is not contextually convertible to 'bool'
  if (F == one_spectrum()) {
      ^~~~~~~~~~~~~~~~~~~
program_source:145307:7: error: value of type 'bool __attribute__((ext_vector_type(3)))' (vector of 3 'bool' values) is not contextually convertible to 'bool'
  if (tint != one_spectrum()) {
      ^~~~~~~~~~~~~~~~~~~~~~
program_source:145457:34: error: pointer type must have explicit address space qualifier
  bsdf->extra = (MicrofacetExtra *)extra;

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