GPU: Split gpu_shader_material into multiple files.
This patch continue the efforts to split the `gpu_shader_material` file
started in D5569.
Dependency resolution is now recursive. Each shading node gets its own
file. Additionally, some utility files are added to be shared between
files, like `math_util`, `color_util`, and `hash`. Some files are always
included because they may be used in the execution function, like
`world_normals`.
Some glsl functions appeared to be unused, so they were removed, like
`output_node`, `bits_to_01`, and `exp_blender`. Other functions have
been renamed to be more general and get used as utils, like `texco_norm`
which became `vector_normalize`.
A lot of the opengl tests fails, but those same tests also fail in
master, so this is probably unrelated to this patch.
Reviewers: brecht
Differential Revision: https://developer.blender.org/D5616
2019-08-30 17:23:04 +02:00
#ifndef VOLUMETRICS
vec3 tint_from_color ( vec3 color )
{
float lum = dot ( color , vec3 ( 0.3 , 0.6 , 0.1 ) ) ; /* luminance approx. */
return ( lum > 0 ) ? color / lum : vec3 ( 1.0 ) ; /* normalize lum. to isolate hue+sat */
}
void convert_metallic_to_specular_tinted ( vec3 basecol ,
vec3 basecol_tint ,
float metallic ,
float specular_fac ,
float specular_tint ,
out vec3 diffuse ,
out vec3 f0 )
{
vec3 tmp_col = mix ( vec3 ( 1.0 ) , basecol_tint , specular_tint ) ;
f0 = mix ( ( 0.08 * specular_fac ) * tmp_col , basecol , metallic ) ;
diffuse = basecol * ( 1.0 - metallic ) ;
}
2020-02-20 14:53:53 +01:00
/* Output sheen is to be multiplied by sheen_color. */
void principled_sheen ( float NV ,
vec3 basecol_tint ,
float sheen ,
float sheen_tint ,
out float out_sheen ,
out vec3 sheen_color )
GPU: Split gpu_shader_material into multiple files.
This patch continue the efforts to split the `gpu_shader_material` file
started in D5569.
Dependency resolution is now recursive. Each shading node gets its own
file. Additionally, some utility files are added to be shared between
files, like `math_util`, `color_util`, and `hash`. Some files are always
included because they may be used in the execution function, like
`world_normals`.
Some glsl functions appeared to be unused, so they were removed, like
`output_node`, `bits_to_01`, and `exp_blender`. Other functions have
been renamed to be more general and get used as utils, like `texco_norm`
which became `vector_normalize`.
A lot of the opengl tests fails, but those same tests also fail in
master, so this is probably unrelated to this patch.
Reviewers: brecht
Differential Revision: https://developer.blender.org/D5616
2019-08-30 17:23:04 +02:00
{
float f = 1.0 - NV ;
/ * Temporary fix for T59784 . Normal map seems to contain NaNs for tangent space normal maps ,
* therefore we need to clamp value . * /
f = clamp ( f , 0.0 , 1.0 ) ;
/* Empirical approximation (manual curve fitting). Can be refined. */
2020-02-20 14:53:53 +01:00
out_sheen = f * f * f * 0.077 + f * 0.01 + 0.00026 ;
sheen_color = sheen * mix ( vec3 ( 1.0 ) , basecol_tint , sheen_tint ) ;
GPU: Split gpu_shader_material into multiple files.
This patch continue the efforts to split the `gpu_shader_material` file
started in D5569.
Dependency resolution is now recursive. Each shading node gets its own
file. Additionally, some utility files are added to be shared between
files, like `math_util`, `color_util`, and `hash`. Some files are always
included because they may be used in the execution function, like
`world_normals`.
Some glsl functions appeared to be unused, so they were removed, like
`output_node`, `bits_to_01`, and `exp_blender`. Other functions have
been renamed to be more general and get used as utils, like `texco_norm`
which became `vector_normalize`.
A lot of the opengl tests fails, but those same tests also fail in
master, so this is probably unrelated to this patch.
Reviewers: brecht
Differential Revision: https://developer.blender.org/D5616
2019-08-30 17:23:04 +02:00
}
void node_bsdf_principled ( vec4 base_color ,
float subsurface ,
vec3 subsurface_radius ,
vec4 subsurface_color ,
float metallic ,
float specular ,
float specular_tint ,
float roughness ,
float anisotropic ,
float anisotropic_rotation ,
float sheen ,
float sheen_tint ,
float clearcoat ,
float clearcoat_roughness ,
float ior ,
float transmission ,
float transmission_roughness ,
vec4 emission ,
2020-09-09 11:36:57 +02:00
float emission_strength ,
GPU: Split gpu_shader_material into multiple files.
This patch continue the efforts to split the `gpu_shader_material` file
started in D5569.
Dependency resolution is now recursive. Each shading node gets its own
file. Additionally, some utility files are added to be shared between
files, like `math_util`, `color_util`, and `hash`. Some files are always
included because they may be used in the execution function, like
`world_normals`.
Some glsl functions appeared to be unused, so they were removed, like
`output_node`, `bits_to_01`, and `exp_blender`. Other functions have
been renamed to be more general and get used as utils, like `texco_norm`
which became `vector_normalize`.
A lot of the opengl tests fails, but those same tests also fail in
master, so this is probably unrelated to this patch.
Reviewers: brecht
Differential Revision: https://developer.blender.org/D5616
2019-08-30 17:23:04 +02:00
float alpha ,
vec3 N ,
vec3 CN ,
vec3 T ,
vec3 I ,
2020-09-19 00:06:45 +02:00
float use_multiscatter ,
GPU: Split gpu_shader_material into multiple files.
This patch continue the efforts to split the `gpu_shader_material` file
started in D5569.
Dependency resolution is now recursive. Each shading node gets its own
file. Additionally, some utility files are added to be shared between
files, like `math_util`, `color_util`, and `hash`. Some files are always
included because they may be used in the execution function, like
`world_normals`.
Some glsl functions appeared to be unused, so they were removed, like
`output_node`, `bits_to_01`, and `exp_blender`. Other functions have
been renamed to be more general and get used as utils, like `texco_norm`
which became `vector_normalize`.
A lot of the opengl tests fails, but those same tests also fail in
master, so this is probably unrelated to this patch.
Reviewers: brecht
Differential Revision: https://developer.blender.org/D5616
2019-08-30 17:23:04 +02:00
float ssr_id ,
float sss_id ,
vec3 sss_scale ,
out Closure result )
{
N = normalize ( N ) ;
ior = max ( ior , 1 e - 5 ) ;
metallic = saturate ( metallic ) ;
transmission = saturate ( transmission ) ;
2020-02-20 14:53:53 +01:00
float m_transmission = 1.0 - transmission ;
GPU: Split gpu_shader_material into multiple files.
This patch continue the efforts to split the `gpu_shader_material` file
started in D5569.
Dependency resolution is now recursive. Each shading node gets its own
file. Additionally, some utility files are added to be shared between
files, like `math_util`, `color_util`, and `hash`. Some files are always
included because they may be used in the execution function, like
`world_normals`.
Some glsl functions appeared to be unused, so they were removed, like
`output_node`, `bits_to_01`, and `exp_blender`. Other functions have
been renamed to be more general and get used as utils, like `texco_norm`
which became `vector_normalize`.
A lot of the opengl tests fails, but those same tests also fail in
master, so this is probably unrelated to this patch.
Reviewers: brecht
Differential Revision: https://developer.blender.org/D5616
2019-08-30 17:23:04 +02:00
float dielectric = 1.0 - metallic ;
transmission * = dielectric ;
sheen * = dielectric ;
subsurface_color * = dielectric ;
2020-02-20 14:53:53 +01:00
vec3 diffuse , f0 , out_diff , out_spec , out_refr , ssr_spec , sheen_color ;
float out_sheen ;
GPU: Split gpu_shader_material into multiple files.
This patch continue the efforts to split the `gpu_shader_material` file
started in D5569.
Dependency resolution is now recursive. Each shading node gets its own
file. Additionally, some utility files are added to be shared between
files, like `math_util`, `color_util`, and `hash`. Some files are always
included because they may be used in the execution function, like
`world_normals`.
Some glsl functions appeared to be unused, so they were removed, like
`output_node`, `bits_to_01`, and `exp_blender`. Other functions have
been renamed to be more general and get used as utils, like `texco_norm`
which became `vector_normalize`.
A lot of the opengl tests fails, but those same tests also fail in
master, so this is probably unrelated to this patch.
Reviewers: brecht
Differential Revision: https://developer.blender.org/D5616
2019-08-30 17:23:04 +02:00
vec3 ctint = tint_from_color ( base_color . rgb ) ;
convert_metallic_to_specular_tinted (
base_color . rgb , ctint , metallic , specular , specular_tint , diffuse , f0 ) ;
float NV = dot ( N , cameraVec ) ;
2020-02-20 14:53:53 +01:00
principled_sheen ( NV , ctint , sheen , sheen_tint , out_sheen , sheen_color ) ;
vec3 f90 = mix ( vec3 ( 1.0 ) , f0 , ( 1.0 - specular ) * metallic ) ;
GPU: Split gpu_shader_material into multiple files.
This patch continue the efforts to split the `gpu_shader_material` file
started in D5569.
Dependency resolution is now recursive. Each shading node gets its own
file. Additionally, some utility files are added to be shared between
files, like `math_util`, `color_util`, and `hash`. Some files are always
included because they may be used in the execution function, like
`world_normals`.
Some glsl functions appeared to be unused, so they were removed, like
`output_node`, `bits_to_01`, and `exp_blender`. Other functions have
been renamed to be more general and get used as utils, like `texco_norm`
which became `vector_normalize`.
A lot of the opengl tests fails, but those same tests also fail in
master, so this is probably unrelated to this patch.
Reviewers: brecht
Differential Revision: https://developer.blender.org/D5616
2019-08-30 17:23:04 +02:00
/ * Far from being accurate , but 2 glossy evaluation is too expensive .
* Most noticeable difference is at grazing angles since the bsdf lut
* f0 color interpolation is done on top of this interpolation . * /
vec3 f0_glass = mix ( vec3 ( 1.0 ) , base_color . rgb , specular_tint ) ;
float fresnel = F_eta ( ior , NV ) ;
vec3 spec_col = F_color_blend ( ior , fresnel , f0_glass ) * fresnel ;
f0 = mix ( f0 , spec_col , transmission ) ;
2020-02-20 14:53:53 +01:00
f90 = mix ( f90 , spec_col , transmission ) ;
GPU: Split gpu_shader_material into multiple files.
This patch continue the efforts to split the `gpu_shader_material` file
started in D5569.
Dependency resolution is now recursive. Each shading node gets its own
file. Additionally, some utility files are added to be shared between
files, like `math_util`, `color_util`, and `hash`. Some files are always
included because they may be used in the execution function, like
`world_normals`.
Some glsl functions appeared to be unused, so they were removed, like
`output_node`, `bits_to_01`, and `exp_blender`. Other functions have
been renamed to be more general and get used as utils, like `texco_norm`
which became `vector_normalize`.
A lot of the opengl tests fails, but those same tests also fail in
master, so this is probably unrelated to this patch.
Reviewers: brecht
Differential Revision: https://developer.blender.org/D5616
2019-08-30 17:23:04 +02:00
2020-02-20 14:53:53 +01:00
/* Really poor approximation but needed to workaround issues with renderpasses. */
spec_col = mix ( vec3 ( 1.0 ) , spec_col , transmission ) ;
/* Match cycles. */
spec_col + = float ( clearcoat > 1 e - 5 ) ;
GPU: Split gpu_shader_material into multiple files.
This patch continue the efforts to split the `gpu_shader_material` file
started in D5569.
Dependency resolution is now recursive. Each shading node gets its own
file. Additionally, some utility files are added to be shared between
files, like `math_util`, `color_util`, and `hash`. Some files are always
included because they may be used in the execution function, like
`world_normals`.
Some glsl functions appeared to be unused, so they were removed, like
`output_node`, `bits_to_01`, and `exp_blender`. Other functions have
been renamed to be more general and get used as utils, like `texco_norm`
which became `vector_normalize`.
A lot of the opengl tests fails, but those same tests also fail in
master, so this is probably unrelated to this patch.
Reviewers: brecht
Differential Revision: https://developer.blender.org/D5616
2019-08-30 17:23:04 +02:00
vec3 mixed_ss_base_color = mix ( diffuse , subsurface_color . rgb , subsurface ) ;
float sss_scalef = avg ( sss_scale ) * subsurface ;
eevee_closure_principled ( N ,
mixed_ss_base_color ,
f0 ,
2020-09-19 00:06:45 +02:00
/ * HACK : Pass the multiscatter flag as the sign to not add closure
* variations or increase register usage . * /
( use_multiscatter != 0.0 ) ? f90 : - f90 ,
GPU: Split gpu_shader_material into multiple files.
This patch continue the efforts to split the `gpu_shader_material` file
started in D5569.
Dependency resolution is now recursive. Each shading node gets its own
file. Additionally, some utility files are added to be shared between
files, like `math_util`, `color_util`, and `hash`. Some files are always
included because they may be used in the execution function, like
`world_normals`.
Some glsl functions appeared to be unused, so they were removed, like
`output_node`, `bits_to_01`, and `exp_blender`. Other functions have
been renamed to be more general and get used as utils, like `texco_norm`
which became `vector_normalize`.
A lot of the opengl tests fails, but those same tests also fail in
master, so this is probably unrelated to this patch.
Reviewers: brecht
Differential Revision: https://developer.blender.org/D5616
2019-08-30 17:23:04 +02:00
int ( ssr_id ) ,
roughness ,
CN ,
clearcoat * 0.25 ,
clearcoat_roughness ,
1.0 ,
sss_scalef ,
ior ,
2019-08-22 16:04:25 +02:00
true ,
GPU: Split gpu_shader_material into multiple files.
This patch continue the efforts to split the `gpu_shader_material` file
started in D5569.
Dependency resolution is now recursive. Each shading node gets its own
file. Additionally, some utility files are added to be shared between
files, like `math_util`, `color_util`, and `hash`. Some files are always
included because they may be used in the execution function, like
`world_normals`.
Some glsl functions appeared to be unused, so they were removed, like
`output_node`, `bits_to_01`, and `exp_blender`. Other functions have
been renamed to be more general and get used as utils, like `texco_norm`
which became `vector_normalize`.
A lot of the opengl tests fails, but those same tests also fail in
master, so this is probably unrelated to this patch.
Reviewers: brecht
Differential Revision: https://developer.blender.org/D5616
2019-08-30 17:23:04 +02:00
out_diff ,
out_spec ,
out_refr ,
ssr_spec ) ;
vec3 refr_color = base_color . rgb ;
refr_color * = ( refractionDepth > 0.0 ) ? refr_color :
vec3 ( 1.0 ) ; /* Simulate 2 transmission event */
2020-02-20 14:53:53 +01:00
refr_color * = saturate ( 1.0 - fresnel ) * transmission ;
sheen_color * = m_transmission ;
mixed_ss_base_color * = m_transmission ;
GPU: Split gpu_shader_material into multiple files.
This patch continue the efforts to split the `gpu_shader_material` file
started in D5569.
Dependency resolution is now recursive. Each shading node gets its own
file. Additionally, some utility files are added to be shared between
files, like `math_util`, `color_util`, and `hash`. Some files are always
included because they may be used in the execution function, like
`world_normals`.
Some glsl functions appeared to be unused, so they were removed, like
`output_node`, `bits_to_01`, and `exp_blender`. Other functions have
been renamed to be more general and get used as utils, like `texco_norm`
which became `vector_normalize`.
A lot of the opengl tests fails, but those same tests also fail in
master, so this is probably unrelated to this patch.
Reviewers: brecht
Differential Revision: https://developer.blender.org/D5616
2019-08-30 17:23:04 +02:00
result = CLOSURE_DEFAULT ;
2020-02-20 14:53:53 +01:00
result . radiance = render_pass_glossy_mask ( refr_color , out_refr * refr_color ) ;
result . radiance + = render_pass_glossy_mask ( spec_col , out_spec ) ;
/* Coarse approx. */
result . radiance + = render_pass_diffuse_mask ( sheen_color , out_diff * out_sheen * sheen_color ) ;
2020-09-09 11:36:57 +02:00
result . radiance + = render_pass_emission_mask ( emission . rgb * emission_strength ) ;
2019-10-08 20:29:27 +02:00
result . radiance * = alpha ;
GPU: Split gpu_shader_material into multiple files.
This patch continue the efforts to split the `gpu_shader_material` file
started in D5569.
Dependency resolution is now recursive. Each shading node gets its own
file. Additionally, some utility files are added to be shared between
files, like `math_util`, `color_util`, and `hash`. Some files are always
included because they may be used in the execution function, like
`world_normals`.
Some glsl functions appeared to be unused, so they were removed, like
`output_node`, `bits_to_01`, and `exp_blender`. Other functions have
been renamed to be more general and get used as utils, like `texco_norm`
which became `vector_normalize`.
A lot of the opengl tests fails, but those same tests also fail in
master, so this is probably unrelated to this patch.
Reviewers: brecht
Differential Revision: https://developer.blender.org/D5616
2019-08-30 17:23:04 +02:00
closure_load_ssr_data ( ssr_spec * alpha , roughness , N , viewCameraVec , int ( ssr_id ) , result ) ;
2020-02-20 14:53:53 +01:00
mixed_ss_base_color * = alpha ;
2019-08-22 16:04:25 +02:00
closure_load_sss_data ( sss_scalef , out_diff , mixed_ss_base_color , int ( sss_id ) , result ) ;
GPU: Split gpu_shader_material into multiple files.
This patch continue the efforts to split the `gpu_shader_material` file
started in D5569.
Dependency resolution is now recursive. Each shading node gets its own
file. Additionally, some utility files are added to be shared between
files, like `math_util`, `color_util`, and `hash`. Some files are always
included because they may be used in the execution function, like
`world_normals`.
Some glsl functions appeared to be unused, so they were removed, like
`output_node`, `bits_to_01`, and `exp_blender`. Other functions have
been renamed to be more general and get used as utils, like `texco_norm`
which became `vector_normalize`.
A lot of the opengl tests fails, but those same tests also fail in
master, so this is probably unrelated to this patch.
Reviewers: brecht
Differential Revision: https://developer.blender.org/D5616
2019-08-30 17:23:04 +02:00
result . transmittance = vec3 ( 1.0 - alpha ) ;
}
void node_bsdf_principled_dielectric ( vec4 base_color ,
float subsurface ,
vec3 subsurface_radius ,
vec4 subsurface_color ,
float metallic ,
float specular ,
float specular_tint ,
float roughness ,
float anisotropic ,
float anisotropic_rotation ,
float sheen ,
float sheen_tint ,
float clearcoat ,
float clearcoat_roughness ,
float ior ,
float transmission ,
float transmission_roughness ,
vec4 emission ,
2020-09-09 11:36:57 +02:00
float emission_strength ,
GPU: Split gpu_shader_material into multiple files.
This patch continue the efforts to split the `gpu_shader_material` file
started in D5569.
Dependency resolution is now recursive. Each shading node gets its own
file. Additionally, some utility files are added to be shared between
files, like `math_util`, `color_util`, and `hash`. Some files are always
included because they may be used in the execution function, like
`world_normals`.
Some glsl functions appeared to be unused, so they were removed, like
`output_node`, `bits_to_01`, and `exp_blender`. Other functions have
been renamed to be more general and get used as utils, like `texco_norm`
which became `vector_normalize`.
A lot of the opengl tests fails, but those same tests also fail in
master, so this is probably unrelated to this patch.
Reviewers: brecht
Differential Revision: https://developer.blender.org/D5616
2019-08-30 17:23:04 +02:00
float alpha ,
vec3 N ,
vec3 CN ,
vec3 T ,
vec3 I ,
2020-09-19 00:06:45 +02:00
float use_multiscatter ,
GPU: Split gpu_shader_material into multiple files.
This patch continue the efforts to split the `gpu_shader_material` file
started in D5569.
Dependency resolution is now recursive. Each shading node gets its own
file. Additionally, some utility files are added to be shared between
files, like `math_util`, `color_util`, and `hash`. Some files are always
included because they may be used in the execution function, like
`world_normals`.
Some glsl functions appeared to be unused, so they were removed, like
`output_node`, `bits_to_01`, and `exp_blender`. Other functions have
been renamed to be more general and get used as utils, like `texco_norm`
which became `vector_normalize`.
A lot of the opengl tests fails, but those same tests also fail in
master, so this is probably unrelated to this patch.
Reviewers: brecht
Differential Revision: https://developer.blender.org/D5616
2019-08-30 17:23:04 +02:00
float ssr_id ,
float sss_id ,
vec3 sss_scale ,
out Closure result )
{
N = normalize ( N ) ;
metallic = saturate ( metallic ) ;
float dielectric = 1.0 - metallic ;
2020-02-20 14:53:53 +01:00
vec3 diffuse , f0 , out_diff , out_spec , ssr_spec , sheen_color ;
float out_sheen ;
GPU: Split gpu_shader_material into multiple files.
This patch continue the efforts to split the `gpu_shader_material` file
started in D5569.
Dependency resolution is now recursive. Each shading node gets its own
file. Additionally, some utility files are added to be shared between
files, like `math_util`, `color_util`, and `hash`. Some files are always
included because they may be used in the execution function, like
`world_normals`.
Some glsl functions appeared to be unused, so they were removed, like
`output_node`, `bits_to_01`, and `exp_blender`. Other functions have
been renamed to be more general and get used as utils, like `texco_norm`
which became `vector_normalize`.
A lot of the opengl tests fails, but those same tests also fail in
master, so this is probably unrelated to this patch.
Reviewers: brecht
Differential Revision: https://developer.blender.org/D5616
2019-08-30 17:23:04 +02:00
vec3 ctint = tint_from_color ( base_color . rgb ) ;
convert_metallic_to_specular_tinted (
base_color . rgb , ctint , metallic , specular , specular_tint , diffuse , f0 ) ;
2020-02-20 14:53:53 +01:00
vec3 f90 = mix ( vec3 ( 1.0 ) , f0 , ( 1.0 - specular ) * metallic ) ;
GPU: Split gpu_shader_material into multiple files.
This patch continue the efforts to split the `gpu_shader_material` file
started in D5569.
Dependency resolution is now recursive. Each shading node gets its own
file. Additionally, some utility files are added to be shared between
files, like `math_util`, `color_util`, and `hash`. Some files are always
included because they may be used in the execution function, like
`world_normals`.
Some glsl functions appeared to be unused, so they were removed, like
`output_node`, `bits_to_01`, and `exp_blender`. Other functions have
been renamed to be more general and get used as utils, like `texco_norm`
which became `vector_normalize`.
A lot of the opengl tests fails, but those same tests also fail in
master, so this is probably unrelated to this patch.
Reviewers: brecht
Differential Revision: https://developer.blender.org/D5616
2019-08-30 17:23:04 +02:00
float NV = dot ( N , cameraVec ) ;
2020-02-20 14:53:53 +01:00
principled_sheen ( NV , ctint , sheen , sheen_tint , out_sheen , sheen_color ) ;
GPU: Split gpu_shader_material into multiple files.
This patch continue the efforts to split the `gpu_shader_material` file
started in D5569.
Dependency resolution is now recursive. Each shading node gets its own
file. Additionally, some utility files are added to be shared between
files, like `math_util`, `color_util`, and `hash`. Some files are always
included because they may be used in the execution function, like
`world_normals`.
Some glsl functions appeared to be unused, so they were removed, like
`output_node`, `bits_to_01`, and `exp_blender`. Other functions have
been renamed to be more general and get used as utils, like `texco_norm`
which became `vector_normalize`.
A lot of the opengl tests fails, but those same tests also fail in
master, so this is probably unrelated to this patch.
Reviewers: brecht
Differential Revision: https://developer.blender.org/D5616
2019-08-30 17:23:04 +02:00
2020-09-19 00:06:45 +02:00
eevee_closure_default ( N ,
diffuse ,
f0 ,
/ * HACK : Pass the multiscatter flag as the sign to not add closure
* variations or increase register usage . * /
( use_multiscatter != 0.0 ) ? f90 : - f90 ,
int ( ssr_id ) ,
roughness ,
1.0 ,
true ,
out_diff ,
out_spec ,
ssr_spec ) ;
GPU: Split gpu_shader_material into multiple files.
This patch continue the efforts to split the `gpu_shader_material` file
started in D5569.
Dependency resolution is now recursive. Each shading node gets its own
file. Additionally, some utility files are added to be shared between
files, like `math_util`, `color_util`, and `hash`. Some files are always
included because they may be used in the execution function, like
`world_normals`.
Some glsl functions appeared to be unused, so they were removed, like
`output_node`, `bits_to_01`, and `exp_blender`. Other functions have
been renamed to be more general and get used as utils, like `texco_norm`
which became `vector_normalize`.
A lot of the opengl tests fails, but those same tests also fail in
master, so this is probably unrelated to this patch.
Reviewers: brecht
Differential Revision: https://developer.blender.org/D5616
2019-08-30 17:23:04 +02:00
result = CLOSURE_DEFAULT ;
2020-02-20 14:53:53 +01:00
result . radiance = render_pass_glossy_mask ( vec3 ( 1.0 ) , out_spec ) ;
result . radiance + = render_pass_diffuse_mask ( sheen_color , out_diff * out_sheen * sheen_color ) ;
result . radiance + = render_pass_diffuse_mask ( diffuse , out_diff * diffuse ) ;
2020-09-09 11:36:57 +02:00
result . radiance + = render_pass_emission_mask ( emission . rgb * emission_strength ) ;
GPU: Split gpu_shader_material into multiple files.
This patch continue the efforts to split the `gpu_shader_material` file
started in D5569.
Dependency resolution is now recursive. Each shading node gets its own
file. Additionally, some utility files are added to be shared between
files, like `math_util`, `color_util`, and `hash`. Some files are always
included because they may be used in the execution function, like
`world_normals`.
Some glsl functions appeared to be unused, so they were removed, like
`output_node`, `bits_to_01`, and `exp_blender`. Other functions have
been renamed to be more general and get used as utils, like `texco_norm`
which became `vector_normalize`.
A lot of the opengl tests fails, but those same tests also fail in
master, so this is probably unrelated to this patch.
Reviewers: brecht
Differential Revision: https://developer.blender.org/D5616
2019-08-30 17:23:04 +02:00
result . radiance * = alpha ;
2019-10-08 20:29:27 +02:00
closure_load_ssr_data ( ssr_spec * alpha , roughness , N , viewCameraVec , int ( ssr_id ) , result ) ;
GPU: Split gpu_shader_material into multiple files.
This patch continue the efforts to split the `gpu_shader_material` file
started in D5569.
Dependency resolution is now recursive. Each shading node gets its own
file. Additionally, some utility files are added to be shared between
files, like `math_util`, `color_util`, and `hash`. Some files are always
included because they may be used in the execution function, like
`world_normals`.
Some glsl functions appeared to be unused, so they were removed, like
`output_node`, `bits_to_01`, and `exp_blender`. Other functions have
been renamed to be more general and get used as utils, like `texco_norm`
which became `vector_normalize`.
A lot of the opengl tests fails, but those same tests also fail in
master, so this is probably unrelated to this patch.
Reviewers: brecht
Differential Revision: https://developer.blender.org/D5616
2019-08-30 17:23:04 +02:00
result . transmittance = vec3 ( 1.0 - alpha ) ;
}
void node_bsdf_principled_metallic ( vec4 base_color ,
float subsurface ,
vec3 subsurface_radius ,
vec4 subsurface_color ,
float metallic ,
float specular ,
float specular_tint ,
float roughness ,
float anisotropic ,
float anisotropic_rotation ,
float sheen ,
float sheen_tint ,
float clearcoat ,
float clearcoat_roughness ,
float ior ,
float transmission ,
float transmission_roughness ,
vec4 emission ,
2020-09-09 11:36:57 +02:00
float emission_strength ,
GPU: Split gpu_shader_material into multiple files.
This patch continue the efforts to split the `gpu_shader_material` file
started in D5569.
Dependency resolution is now recursive. Each shading node gets its own
file. Additionally, some utility files are added to be shared between
files, like `math_util`, `color_util`, and `hash`. Some files are always
included because they may be used in the execution function, like
`world_normals`.
Some glsl functions appeared to be unused, so they were removed, like
`output_node`, `bits_to_01`, and `exp_blender`. Other functions have
been renamed to be more general and get used as utils, like `texco_norm`
which became `vector_normalize`.
A lot of the opengl tests fails, but those same tests also fail in
master, so this is probably unrelated to this patch.
Reviewers: brecht
Differential Revision: https://developer.blender.org/D5616
2019-08-30 17:23:04 +02:00
float alpha ,
vec3 N ,
vec3 CN ,
vec3 T ,
vec3 I ,
2020-09-19 00:06:45 +02:00
float use_multiscatter ,
GPU: Split gpu_shader_material into multiple files.
This patch continue the efforts to split the `gpu_shader_material` file
started in D5569.
Dependency resolution is now recursive. Each shading node gets its own
file. Additionally, some utility files are added to be shared between
files, like `math_util`, `color_util`, and `hash`. Some files are always
included because they may be used in the execution function, like
`world_normals`.
Some glsl functions appeared to be unused, so they were removed, like
`output_node`, `bits_to_01`, and `exp_blender`. Other functions have
been renamed to be more general and get used as utils, like `texco_norm`
which became `vector_normalize`.
A lot of the opengl tests fails, but those same tests also fail in
master, so this is probably unrelated to this patch.
Reviewers: brecht
Differential Revision: https://developer.blender.org/D5616
2019-08-30 17:23:04 +02:00
float ssr_id ,
float sss_id ,
vec3 sss_scale ,
out Closure result )
{
N = normalize ( N ) ;
vec3 out_spec , ssr_spec ;
vec3 f90 = mix ( vec3 ( 1.0 ) , base_color . rgb , ( 1.0 - specular ) * metallic ) ;
2020-09-19 00:06:45 +02:00
eevee_closure_glossy ( N ,
base_color . rgb ,
/ * HACK : Pass the multiscatter flag as the sign to not add closure
* variations or increase register usage . * /
( use_multiscatter != 0.0 ) ? f90 : - f90 ,
int ( ssr_id ) ,
roughness ,
1.0 ,
true ,
out_spec ,
ssr_spec ) ;
GPU: Split gpu_shader_material into multiple files.
This patch continue the efforts to split the `gpu_shader_material` file
started in D5569.
Dependency resolution is now recursive. Each shading node gets its own
file. Additionally, some utility files are added to be shared between
files, like `math_util`, `color_util`, and `hash`. Some files are always
included because they may be used in the execution function, like
`world_normals`.
Some glsl functions appeared to be unused, so they were removed, like
`output_node`, `bits_to_01`, and `exp_blender`. Other functions have
been renamed to be more general and get used as utils, like `texco_norm`
which became `vector_normalize`.
A lot of the opengl tests fails, but those same tests also fail in
master, so this is probably unrelated to this patch.
Reviewers: brecht
Differential Revision: https://developer.blender.org/D5616
2019-08-30 17:23:04 +02:00
result = CLOSURE_DEFAULT ;
2020-02-20 14:53:53 +01:00
result . radiance = render_pass_glossy_mask ( vec3 ( 1.0 ) , out_spec ) ;
2020-09-09 11:36:57 +02:00
result . radiance + = render_pass_emission_mask ( emission . rgb * emission_strength ) ;
GPU: Split gpu_shader_material into multiple files.
This patch continue the efforts to split the `gpu_shader_material` file
started in D5569.
Dependency resolution is now recursive. Each shading node gets its own
file. Additionally, some utility files are added to be shared between
files, like `math_util`, `color_util`, and `hash`. Some files are always
included because they may be used in the execution function, like
`world_normals`.
Some glsl functions appeared to be unused, so they were removed, like
`output_node`, `bits_to_01`, and `exp_blender`. Other functions have
been renamed to be more general and get used as utils, like `texco_norm`
which became `vector_normalize`.
A lot of the opengl tests fails, but those same tests also fail in
master, so this is probably unrelated to this patch.
Reviewers: brecht
Differential Revision: https://developer.blender.org/D5616
2019-08-30 17:23:04 +02:00
result . radiance * = alpha ;
2019-10-08 20:29:27 +02:00
closure_load_ssr_data ( ssr_spec * alpha , roughness , N , viewCameraVec , int ( ssr_id ) , result ) ;
GPU: Split gpu_shader_material into multiple files.
This patch continue the efforts to split the `gpu_shader_material` file
started in D5569.
Dependency resolution is now recursive. Each shading node gets its own
file. Additionally, some utility files are added to be shared between
files, like `math_util`, `color_util`, and `hash`. Some files are always
included because they may be used in the execution function, like
`world_normals`.
Some glsl functions appeared to be unused, so they were removed, like
`output_node`, `bits_to_01`, and `exp_blender`. Other functions have
been renamed to be more general and get used as utils, like `texco_norm`
which became `vector_normalize`.
A lot of the opengl tests fails, but those same tests also fail in
master, so this is probably unrelated to this patch.
Reviewers: brecht
Differential Revision: https://developer.blender.org/D5616
2019-08-30 17:23:04 +02:00
result . transmittance = vec3 ( 1.0 - alpha ) ;
}
void node_bsdf_principled_clearcoat ( vec4 base_color ,
float subsurface ,
vec3 subsurface_radius ,
vec4 subsurface_color ,
float metallic ,
float specular ,
float specular_tint ,
float roughness ,
float anisotropic ,
float anisotropic_rotation ,
float sheen ,
float sheen_tint ,
float clearcoat ,
float clearcoat_roughness ,
float ior ,
float transmission ,
float transmission_roughness ,
vec4 emission ,
2020-09-09 11:36:57 +02:00
float emission_strength ,
GPU: Split gpu_shader_material into multiple files.
This patch continue the efforts to split the `gpu_shader_material` file
started in D5569.
Dependency resolution is now recursive. Each shading node gets its own
file. Additionally, some utility files are added to be shared between
files, like `math_util`, `color_util`, and `hash`. Some files are always
included because they may be used in the execution function, like
`world_normals`.
Some glsl functions appeared to be unused, so they were removed, like
`output_node`, `bits_to_01`, and `exp_blender`. Other functions have
been renamed to be more general and get used as utils, like `texco_norm`
which became `vector_normalize`.
A lot of the opengl tests fails, but those same tests also fail in
master, so this is probably unrelated to this patch.
Reviewers: brecht
Differential Revision: https://developer.blender.org/D5616
2019-08-30 17:23:04 +02:00
float alpha ,
vec3 N ,
vec3 CN ,
vec3 T ,
vec3 I ,
2020-09-19 00:06:45 +02:00
float use_multiscatter ,
GPU: Split gpu_shader_material into multiple files.
This patch continue the efforts to split the `gpu_shader_material` file
started in D5569.
Dependency resolution is now recursive. Each shading node gets its own
file. Additionally, some utility files are added to be shared between
files, like `math_util`, `color_util`, and `hash`. Some files are always
included because they may be used in the execution function, like
`world_normals`.
Some glsl functions appeared to be unused, so they were removed, like
`output_node`, `bits_to_01`, and `exp_blender`. Other functions have
been renamed to be more general and get used as utils, like `texco_norm`
which became `vector_normalize`.
A lot of the opengl tests fails, but those same tests also fail in
master, so this is probably unrelated to this patch.
Reviewers: brecht
Differential Revision: https://developer.blender.org/D5616
2019-08-30 17:23:04 +02:00
float ssr_id ,
float sss_id ,
vec3 sss_scale ,
out Closure result )
{
vec3 out_spec , ssr_spec ;
N = normalize ( N ) ;
vec3 f90 = mix ( vec3 ( 1.0 ) , base_color . rgb , ( 1.0 - specular ) * metallic ) ;
eevee_closure_clearcoat ( N ,
base_color . rgb ,
2020-09-19 00:06:45 +02:00
/ * HACK : Pass the multiscatter flag as the sign to not add closure
* variations or increase register usage . * /
( use_multiscatter != 0.0 ) ? f90 : - f90 ,
GPU: Split gpu_shader_material into multiple files.
This patch continue the efforts to split the `gpu_shader_material` file
started in D5569.
Dependency resolution is now recursive. Each shading node gets its own
file. Additionally, some utility files are added to be shared between
files, like `math_util`, `color_util`, and `hash`. Some files are always
included because they may be used in the execution function, like
`world_normals`.
Some glsl functions appeared to be unused, so they were removed, like
`output_node`, `bits_to_01`, and `exp_blender`. Other functions have
been renamed to be more general and get used as utils, like `texco_norm`
which became `vector_normalize`.
A lot of the opengl tests fails, but those same tests also fail in
master, so this is probably unrelated to this patch.
Reviewers: brecht
Differential Revision: https://developer.blender.org/D5616
2019-08-30 17:23:04 +02:00
int ( ssr_id ) ,
roughness ,
CN ,
clearcoat * 0.25 ,
clearcoat_roughness ,
1.0 ,
2019-08-22 16:04:25 +02:00
true ,
GPU: Split gpu_shader_material into multiple files.
This patch continue the efforts to split the `gpu_shader_material` file
started in D5569.
Dependency resolution is now recursive. Each shading node gets its own
file. Additionally, some utility files are added to be shared between
files, like `math_util`, `color_util`, and `hash`. Some files are always
included because they may be used in the execution function, like
`world_normals`.
Some glsl functions appeared to be unused, so they were removed, like
`output_node`, `bits_to_01`, and `exp_blender`. Other functions have
been renamed to be more general and get used as utils, like `texco_norm`
which became `vector_normalize`.
A lot of the opengl tests fails, but those same tests also fail in
master, so this is probably unrelated to this patch.
Reviewers: brecht
Differential Revision: https://developer.blender.org/D5616
2019-08-30 17:23:04 +02:00
out_spec ,
ssr_spec ) ;
2020-02-20 14:53:53 +01:00
/* Match cycles. */
float spec_col = 1.0 + float ( clearcoat > 1 e - 5 ) ;
GPU: Split gpu_shader_material into multiple files.
This patch continue the efforts to split the `gpu_shader_material` file
started in D5569.
Dependency resolution is now recursive. Each shading node gets its own
file. Additionally, some utility files are added to be shared between
files, like `math_util`, `color_util`, and `hash`. Some files are always
included because they may be used in the execution function, like
`world_normals`.
Some glsl functions appeared to be unused, so they were removed, like
`output_node`, `bits_to_01`, and `exp_blender`. Other functions have
been renamed to be more general and get used as utils, like `texco_norm`
which became `vector_normalize`.
A lot of the opengl tests fails, but those same tests also fail in
master, so this is probably unrelated to this patch.
Reviewers: brecht
Differential Revision: https://developer.blender.org/D5616
2019-08-30 17:23:04 +02:00
result = CLOSURE_DEFAULT ;
2020-02-20 14:53:53 +01:00
result . radiance = render_pass_glossy_mask ( vec3 ( spec_col ) , out_spec ) ;
2020-09-09 11:36:57 +02:00
result . radiance + = render_pass_emission_mask ( emission . rgb * emission_strength ) ;
GPU: Split gpu_shader_material into multiple files.
This patch continue the efforts to split the `gpu_shader_material` file
started in D5569.
Dependency resolution is now recursive. Each shading node gets its own
file. Additionally, some utility files are added to be shared between
files, like `math_util`, `color_util`, and `hash`. Some files are always
included because they may be used in the execution function, like
`world_normals`.
Some glsl functions appeared to be unused, so they were removed, like
`output_node`, `bits_to_01`, and `exp_blender`. Other functions have
been renamed to be more general and get used as utils, like `texco_norm`
which became `vector_normalize`.
A lot of the opengl tests fails, but those same tests also fail in
master, so this is probably unrelated to this patch.
Reviewers: brecht
Differential Revision: https://developer.blender.org/D5616
2019-08-30 17:23:04 +02:00
result . radiance * = alpha ;
2019-10-08 20:29:27 +02:00
closure_load_ssr_data ( ssr_spec * alpha , roughness , N , viewCameraVec , int ( ssr_id ) , result ) ;
GPU: Split gpu_shader_material into multiple files.
This patch continue the efforts to split the `gpu_shader_material` file
started in D5569.
Dependency resolution is now recursive. Each shading node gets its own
file. Additionally, some utility files are added to be shared between
files, like `math_util`, `color_util`, and `hash`. Some files are always
included because they may be used in the execution function, like
`world_normals`.
Some glsl functions appeared to be unused, so they were removed, like
`output_node`, `bits_to_01`, and `exp_blender`. Other functions have
been renamed to be more general and get used as utils, like `texco_norm`
which became `vector_normalize`.
A lot of the opengl tests fails, but those same tests also fail in
master, so this is probably unrelated to this patch.
Reviewers: brecht
Differential Revision: https://developer.blender.org/D5616
2019-08-30 17:23:04 +02:00
result . transmittance = vec3 ( 1.0 - alpha ) ;
}
void node_bsdf_principled_subsurface ( vec4 base_color ,
float subsurface ,
vec3 subsurface_radius ,
vec4 subsurface_color ,
float metallic ,
float specular ,
float specular_tint ,
float roughness ,
float anisotropic ,
float anisotropic_rotation ,
float sheen ,
float sheen_tint ,
float clearcoat ,
float clearcoat_roughness ,
float ior ,
float transmission ,
float transmission_roughness ,
vec4 emission ,
2020-09-09 11:36:57 +02:00
float emission_strength ,
GPU: Split gpu_shader_material into multiple files.
This patch continue the efforts to split the `gpu_shader_material` file
started in D5569.
Dependency resolution is now recursive. Each shading node gets its own
file. Additionally, some utility files are added to be shared between
files, like `math_util`, `color_util`, and `hash`. Some files are always
included because they may be used in the execution function, like
`world_normals`.
Some glsl functions appeared to be unused, so they were removed, like
`output_node`, `bits_to_01`, and `exp_blender`. Other functions have
been renamed to be more general and get used as utils, like `texco_norm`
which became `vector_normalize`.
A lot of the opengl tests fails, but those same tests also fail in
master, so this is probably unrelated to this patch.
Reviewers: brecht
Differential Revision: https://developer.blender.org/D5616
2019-08-30 17:23:04 +02:00
float alpha ,
vec3 N ,
vec3 CN ,
vec3 T ,
vec3 I ,
2020-09-19 00:06:45 +02:00
float use_multiscatter ,
GPU: Split gpu_shader_material into multiple files.
This patch continue the efforts to split the `gpu_shader_material` file
started in D5569.
Dependency resolution is now recursive. Each shading node gets its own
file. Additionally, some utility files are added to be shared between
files, like `math_util`, `color_util`, and `hash`. Some files are always
included because they may be used in the execution function, like
`world_normals`.
Some glsl functions appeared to be unused, so they were removed, like
`output_node`, `bits_to_01`, and `exp_blender`. Other functions have
been renamed to be more general and get used as utils, like `texco_norm`
which became `vector_normalize`.
A lot of the opengl tests fails, but those same tests also fail in
master, so this is probably unrelated to this patch.
Reviewers: brecht
Differential Revision: https://developer.blender.org/D5616
2019-08-30 17:23:04 +02:00
float ssr_id ,
float sss_id ,
vec3 sss_scale ,
out Closure result )
{
metallic = saturate ( metallic ) ;
N = normalize ( N ) ;
2020-02-20 14:53:53 +01:00
vec3 diffuse , f0 , out_diff , out_spec , ssr_spec , sheen_color ;
float out_sheen ;
GPU: Split gpu_shader_material into multiple files.
This patch continue the efforts to split the `gpu_shader_material` file
started in D5569.
Dependency resolution is now recursive. Each shading node gets its own
file. Additionally, some utility files are added to be shared between
files, like `math_util`, `color_util`, and `hash`. Some files are always
included because they may be used in the execution function, like
`world_normals`.
Some glsl functions appeared to be unused, so they were removed, like
`output_node`, `bits_to_01`, and `exp_blender`. Other functions have
been renamed to be more general and get used as utils, like `texco_norm`
which became `vector_normalize`.
A lot of the opengl tests fails, but those same tests also fail in
master, so this is probably unrelated to this patch.
Reviewers: brecht
Differential Revision: https://developer.blender.org/D5616
2019-08-30 17:23:04 +02:00
vec3 ctint = tint_from_color ( base_color . rgb ) ;
convert_metallic_to_specular_tinted (
base_color . rgb , ctint , metallic , specular , specular_tint , diffuse , f0 ) ;
subsurface_color = subsurface_color * ( 1.0 - metallic ) ;
vec3 mixed_ss_base_color = mix ( diffuse , subsurface_color . rgb , subsurface ) ;
float sss_scalef = avg ( sss_scale ) * subsurface ;
float NV = dot ( N , cameraVec ) ;
2020-02-20 14:53:53 +01:00
principled_sheen ( NV , ctint , sheen , sheen_tint , out_sheen , sheen_color ) ;
GPU: Split gpu_shader_material into multiple files.
This patch continue the efforts to split the `gpu_shader_material` file
started in D5569.
Dependency resolution is now recursive. Each shading node gets its own
file. Additionally, some utility files are added to be shared between
files, like `math_util`, `color_util`, and `hash`. Some files are always
included because they may be used in the execution function, like
`world_normals`.
Some glsl functions appeared to be unused, so they were removed, like
`output_node`, `bits_to_01`, and `exp_blender`. Other functions have
been renamed to be more general and get used as utils, like `texco_norm`
which became `vector_normalize`.
A lot of the opengl tests fails, but those same tests also fail in
master, so this is probably unrelated to this patch.
Reviewers: brecht
Differential Revision: https://developer.blender.org/D5616
2019-08-30 17:23:04 +02:00
vec3 f90 = mix ( vec3 ( 1.0 ) , base_color . rgb , ( 1.0 - specular ) * metallic ) ;
eevee_closure_skin ( N ,
mixed_ss_base_color ,
f0 ,
2020-09-19 00:06:45 +02:00
/ * HACK : Pass the multiscatter flag as the sign to not add closure variations
2020-10-14 15:24:42 +11:00
* or increase register usage . * /
2020-09-19 00:06:45 +02:00
( use_multiscatter != 0.0 ) ? f90 : - f90 ,
GPU: Split gpu_shader_material into multiple files.
This patch continue the efforts to split the `gpu_shader_material` file
started in D5569.
Dependency resolution is now recursive. Each shading node gets its own
file. Additionally, some utility files are added to be shared between
files, like `math_util`, `color_util`, and `hash`. Some files are always
included because they may be used in the execution function, like
`world_normals`.
Some glsl functions appeared to be unused, so they were removed, like
`output_node`, `bits_to_01`, and `exp_blender`. Other functions have
been renamed to be more general and get used as utils, like `texco_norm`
which became `vector_normalize`.
A lot of the opengl tests fails, but those same tests also fail in
master, so this is probably unrelated to this patch.
Reviewers: brecht
Differential Revision: https://developer.blender.org/D5616
2019-08-30 17:23:04 +02:00
int ( ssr_id ) ,
roughness ,
1.0 ,
sss_scalef ,
2019-08-22 16:04:25 +02:00
true ,
GPU: Split gpu_shader_material into multiple files.
This patch continue the efforts to split the `gpu_shader_material` file
started in D5569.
Dependency resolution is now recursive. Each shading node gets its own
file. Additionally, some utility files are added to be shared between
files, like `math_util`, `color_util`, and `hash`. Some files are always
included because they may be used in the execution function, like
`world_normals`.
Some glsl functions appeared to be unused, so they were removed, like
`output_node`, `bits_to_01`, and `exp_blender`. Other functions have
been renamed to be more general and get used as utils, like `texco_norm`
which became `vector_normalize`.
A lot of the opengl tests fails, but those same tests also fail in
master, so this is probably unrelated to this patch.
Reviewers: brecht
Differential Revision: https://developer.blender.org/D5616
2019-08-30 17:23:04 +02:00
out_diff ,
out_spec ,
ssr_spec ) ;
result = CLOSURE_DEFAULT ;
2020-02-20 14:53:53 +01:00
result . radiance = render_pass_glossy_mask ( vec3 ( 1.0 ) , out_spec ) ;
result . radiance + = render_pass_diffuse_mask ( sheen_color , out_diff * out_sheen * sheen_color ) ;
2020-09-09 11:36:57 +02:00
result . radiance + = render_pass_emission_mask ( emission . rgb * emission_strength ) ;
2019-10-08 20:29:27 +02:00
result . radiance * = alpha ;
GPU: Split gpu_shader_material into multiple files.
This patch continue the efforts to split the `gpu_shader_material` file
started in D5569.
Dependency resolution is now recursive. Each shading node gets its own
file. Additionally, some utility files are added to be shared between
files, like `math_util`, `color_util`, and `hash`. Some files are always
included because they may be used in the execution function, like
`world_normals`.
Some glsl functions appeared to be unused, so they were removed, like
`output_node`, `bits_to_01`, and `exp_blender`. Other functions have
been renamed to be more general and get used as utils, like `texco_norm`
which became `vector_normalize`.
A lot of the opengl tests fails, but those same tests also fail in
master, so this is probably unrelated to this patch.
Reviewers: brecht
Differential Revision: https://developer.blender.org/D5616
2019-08-30 17:23:04 +02:00
closure_load_ssr_data ( ssr_spec * alpha , roughness , N , viewCameraVec , int ( ssr_id ) , result ) ;
2020-02-20 14:53:53 +01:00
mixed_ss_base_color * = alpha ;
2019-08-22 16:04:25 +02:00
closure_load_sss_data ( sss_scalef , out_diff , mixed_ss_base_color , int ( sss_id ) , result ) ;
GPU: Split gpu_shader_material into multiple files.
This patch continue the efforts to split the `gpu_shader_material` file
started in D5569.
Dependency resolution is now recursive. Each shading node gets its own
file. Additionally, some utility files are added to be shared between
files, like `math_util`, `color_util`, and `hash`. Some files are always
included because they may be used in the execution function, like
`world_normals`.
Some glsl functions appeared to be unused, so they were removed, like
`output_node`, `bits_to_01`, and `exp_blender`. Other functions have
been renamed to be more general and get used as utils, like `texco_norm`
which became `vector_normalize`.
A lot of the opengl tests fails, but those same tests also fail in
master, so this is probably unrelated to this patch.
Reviewers: brecht
Differential Revision: https://developer.blender.org/D5616
2019-08-30 17:23:04 +02:00
result . transmittance = vec3 ( 1.0 - alpha ) ;
}
void node_bsdf_principled_glass ( vec4 base_color ,
float subsurface ,
vec3 subsurface_radius ,
vec4 subsurface_color ,
float metallic ,
float specular ,
float specular_tint ,
float roughness ,
float anisotropic ,
float anisotropic_rotation ,
float sheen ,
float sheen_tint ,
float clearcoat ,
float clearcoat_roughness ,
float ior ,
float transmission ,
float transmission_roughness ,
vec4 emission ,
2020-09-09 11:36:57 +02:00
float emission_strength ,
GPU: Split gpu_shader_material into multiple files.
This patch continue the efforts to split the `gpu_shader_material` file
started in D5569.
Dependency resolution is now recursive. Each shading node gets its own
file. Additionally, some utility files are added to be shared between
files, like `math_util`, `color_util`, and `hash`. Some files are always
included because they may be used in the execution function, like
`world_normals`.
Some glsl functions appeared to be unused, so they were removed, like
`output_node`, `bits_to_01`, and `exp_blender`. Other functions have
been renamed to be more general and get used as utils, like `texco_norm`
which became `vector_normalize`.
A lot of the opengl tests fails, but those same tests also fail in
master, so this is probably unrelated to this patch.
Reviewers: brecht
Differential Revision: https://developer.blender.org/D5616
2019-08-30 17:23:04 +02:00
float alpha ,
vec3 N ,
vec3 CN ,
vec3 T ,
vec3 I ,
2020-09-19 00:06:45 +02:00
float use_multiscatter ,
GPU: Split gpu_shader_material into multiple files.
This patch continue the efforts to split the `gpu_shader_material` file
started in D5569.
Dependency resolution is now recursive. Each shading node gets its own
file. Additionally, some utility files are added to be shared between
files, like `math_util`, `color_util`, and `hash`. Some files are always
included because they may be used in the execution function, like
`world_normals`.
Some glsl functions appeared to be unused, so they were removed, like
`output_node`, `bits_to_01`, and `exp_blender`. Other functions have
been renamed to be more general and get used as utils, like `texco_norm`
which became `vector_normalize`.
A lot of the opengl tests fails, but those same tests also fail in
master, so this is probably unrelated to this patch.
Reviewers: brecht
Differential Revision: https://developer.blender.org/D5616
2019-08-30 17:23:04 +02:00
float ssr_id ,
float sss_id ,
vec3 sss_scale ,
out Closure result )
{
ior = max ( ior , 1 e - 5 ) ;
N = normalize ( N ) ;
vec3 f0 , out_spec , out_refr , ssr_spec ;
f0 = mix ( vec3 ( 1.0 ) , base_color . rgb , specular_tint ) ;
2019-08-22 16:04:25 +02:00
eevee_closure_glass ( N ,
vec3 ( 1.0 ) ,
2020-10-22 00:55:38 +02:00
vec3 ( ( use_multiscatter != 0.0 ) ? 1.0 : - 1.0 ) ,
2019-08-22 16:04:25 +02:00
int ( ssr_id ) ,
roughness ,
1.0 ,
ior ,
true ,
out_spec ,
out_refr ,
ssr_spec ) ;
GPU: Split gpu_shader_material into multiple files.
This patch continue the efforts to split the `gpu_shader_material` file
started in D5569.
Dependency resolution is now recursive. Each shading node gets its own
file. Additionally, some utility files are added to be shared between
files, like `math_util`, `color_util`, and `hash`. Some files are always
included because they may be used in the execution function, like
`world_normals`.
Some glsl functions appeared to be unused, so they were removed, like
`output_node`, `bits_to_01`, and `exp_blender`. Other functions have
been renamed to be more general and get used as utils, like `texco_norm`
which became `vector_normalize`.
A lot of the opengl tests fails, but those same tests also fail in
master, so this is probably unrelated to this patch.
Reviewers: brecht
Differential Revision: https://developer.blender.org/D5616
2019-08-30 17:23:04 +02:00
vec3 refr_color = base_color . rgb ;
refr_color * = ( refractionDepth > 0.0 ) ? refr_color :
vec3 ( 1.0 ) ; /* Simulate 2 transmission events */
float fresnel = F_eta ( ior , dot ( N , cameraVec ) ) ;
vec3 spec_col = F_color_blend ( ior , fresnel , f0 ) ;
2020-02-20 14:53:53 +01:00
spec_col * = fresnel ;
refr_color * = ( 1.0 - fresnel ) ;
ssr_spec * = spec_col ;
GPU: Split gpu_shader_material into multiple files.
This patch continue the efforts to split the `gpu_shader_material` file
started in D5569.
Dependency resolution is now recursive. Each shading node gets its own
file. Additionally, some utility files are added to be shared between
files, like `math_util`, `color_util`, and `hash`. Some files are always
included because they may be used in the execution function, like
`world_normals`.
Some glsl functions appeared to be unused, so they were removed, like
`output_node`, `bits_to_01`, and `exp_blender`. Other functions have
been renamed to be more general and get used as utils, like `texco_norm`
which became `vector_normalize`.
A lot of the opengl tests fails, but those same tests also fail in
master, so this is probably unrelated to this patch.
Reviewers: brecht
Differential Revision: https://developer.blender.org/D5616
2019-08-30 17:23:04 +02:00
result = CLOSURE_DEFAULT ;
2020-02-20 14:53:53 +01:00
result . radiance = render_pass_glossy_mask ( refr_color , out_refr * refr_color ) ;
result . radiance + = render_pass_glossy_mask ( spec_col , out_spec * spec_col ) ;
2020-09-09 11:36:57 +02:00
result . radiance + = render_pass_emission_mask ( emission . rgb * emission_strength ) ;
GPU: Split gpu_shader_material into multiple files.
This patch continue the efforts to split the `gpu_shader_material` file
started in D5569.
Dependency resolution is now recursive. Each shading node gets its own
file. Additionally, some utility files are added to be shared between
files, like `math_util`, `color_util`, and `hash`. Some files are always
included because they may be used in the execution function, like
`world_normals`.
Some glsl functions appeared to be unused, so they were removed, like
`output_node`, `bits_to_01`, and `exp_blender`. Other functions have
been renamed to be more general and get used as utils, like `texco_norm`
which became `vector_normalize`.
A lot of the opengl tests fails, but those same tests also fail in
master, so this is probably unrelated to this patch.
Reviewers: brecht
Differential Revision: https://developer.blender.org/D5616
2019-08-30 17:23:04 +02:00
result . radiance * = alpha ;
2019-10-08 20:29:27 +02:00
closure_load_ssr_data ( ssr_spec * alpha , roughness , N , viewCameraVec , int ( ssr_id ) , result ) ;
GPU: Split gpu_shader_material into multiple files.
This patch continue the efforts to split the `gpu_shader_material` file
started in D5569.
Dependency resolution is now recursive. Each shading node gets its own
file. Additionally, some utility files are added to be shared between
files, like `math_util`, `color_util`, and `hash`. Some files are always
included because they may be used in the execution function, like
`world_normals`.
Some glsl functions appeared to be unused, so they were removed, like
`output_node`, `bits_to_01`, and `exp_blender`. Other functions have
been renamed to be more general and get used as utils, like `texco_norm`
which became `vector_normalize`.
A lot of the opengl tests fails, but those same tests also fail in
master, so this is probably unrelated to this patch.
Reviewers: brecht
Differential Revision: https://developer.blender.org/D5616
2019-08-30 17:23:04 +02:00
result . transmittance = vec3 ( 1.0 - alpha ) ;
}
#else
2020-06-30 01:32:00 +02:00
/* clang-format off */
GPU: Split gpu_shader_material into multiple files.
This patch continue the efforts to split the `gpu_shader_material` file
started in D5569.
Dependency resolution is now recursive. Each shading node gets its own
file. Additionally, some utility files are added to be shared between
files, like `math_util`, `color_util`, and `hash`. Some files are always
included because they may be used in the execution function, like
`world_normals`.
Some glsl functions appeared to be unused, so they were removed, like
`output_node`, `bits_to_01`, and `exp_blender`. Other functions have
been renamed to be more general and get used as utils, like `texco_norm`
which became `vector_normalize`.
A lot of the opengl tests fails, but those same tests also fail in
master, so this is probably unrelated to this patch.
Reviewers: brecht
Differential Revision: https://developer.blender.org/D5616
2019-08-30 17:23:04 +02:00
/* Stub principled because it is not compatible with volumetrics. */
2020-09-19 00:06:45 +02:00
# define node_bsdf_principled(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, aa, bb, result) (result = CLOSURE_DEFAULT)
# define node_bsdf_principled_dielectric(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, aa, bb, result) (result = CLOSURE_DEFAULT)
# define node_bsdf_principled_metallic(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, aa, bb, result) (result = CLOSURE_DEFAULT)
# define node_bsdf_principled_clearcoat(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, aa, bb, result) (result = CLOSURE_DEFAULT)
# define node_bsdf_principled_subsurface(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, aa, bb, result) (result = CLOSURE_DEFAULT)
# define node_bsdf_principled_glass(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, aa, bb, result) (result = CLOSURE_DEFAULT)
2020-06-30 01:32:00 +02:00
/* clang-format on */
GPU: Split gpu_shader_material into multiple files.
This patch continue the efforts to split the `gpu_shader_material` file
started in D5569.
Dependency resolution is now recursive. Each shading node gets its own
file. Additionally, some utility files are added to be shared between
files, like `math_util`, `color_util`, and `hash`. Some files are always
included because they may be used in the execution function, like
`world_normals`.
Some glsl functions appeared to be unused, so they were removed, like
`output_node`, `bits_to_01`, and `exp_blender`. Other functions have
been renamed to be more general and get used as utils, like `texco_norm`
which became `vector_normalize`.
A lot of the opengl tests fails, but those same tests also fail in
master, so this is probably unrelated to this patch.
Reviewers: brecht
Differential Revision: https://developer.blender.org/D5616
2019-08-30 17:23:04 +02:00
#endif