23 float fresnel =
exp2(-8.35f * NV) * (1.0f - roughness);
24 return mix(spec_color,
float3(1.0f), fresnel);
32 float4 normalization_factor = shininess * 0.125f + 1.0f;
33 float4 spec_light =
pow(spec_angle, shininess) *
NL * normalization_factor;
43 return clamp((
NL +
w) * denom, 0.0f, 1.0f);
53 const WorldData &world_data = world.world_data;
55 float3 specular_color, diffuse_color;
58 diffuse_color =
mix(base_color,
float3(0.0f), metallic);
59 specular_color =
mix(
float3(0.05f), base_color, metallic);
62 diffuse_color = base_color;
63 specular_color =
float3(0.0f);
77 float4 spec_angle, spec_NL, wrapped_NL;
78 for (
int i = 0; i < 4; i++) [[
unroll]] {
81 wrapped_NL[i] =
dot(
L,
R);
97 spec_light =
mix(spec_light, spec_env,
wrap *
wrap);
100 for (
int i = 0; i < 4; i++) [[
unroll]] {
105 specular_color =
brdf_approx(specular_color, roughness, NV);
107 specular_light *= specular_color;
111 for (
int i = 0; i < 4; i++) [[
unroll]] {
118 for (
int i = 0; i < 4; i++) [[
unroll]] {
124 float spec_energy =
dot(specular_color,
float3(0.33333f));
126 diffuse_light *= diffuse_color * (1.0f - spec_energy);
128 return diffuse_light + specular_light;
133 const WorldData &world_data = world.world_data;
137 shadow_mix *= force_shadow ? 0.0f : world_data.
shadow_mul;
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
T smoothstep(T, T, T) RET
VecBase< int, D > floatBitsToInt(VecOp< float, D >) RET
VecBase< float, D > intBitsToFloat(VecOp< int, D >) RET
VecBase< T, D > reflect(VecOp< T, D >, VecOp< T, D >) RET
VecBase< float, D > normalize(VecOp< float, D >) RET
float dot(VecOp< float, D >, VecOp< float, D >) RET
constexpr T clamp(T, U, U) RET
float wrap(float a, float b, float c)
float4 blinn_specular(float4 shininess, float4 spec_angle, float4 NL)
float get_shadow(const workbench::World &world, float3 N, bool force_shadow)
float4 wrapped_lighting(float4 NL, float4 w)
float4 fast_rcp(float4 v)
float3 brdf_approx(float3 spec_color, float roughness, float NV)
float3 get_world_lighting(const workbench::World &world, float3 base_color, float roughness, float metallic, float3 N, float3 I)
float4 diffuse_color_wrap
struct SolidLightData lights[4]
float4 shadow_direction_vs