Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/engines/eevee/shaders/default_world_frag.glsl
| uniform float backgroundAlpha; | uniform float backgroundAlpha; | ||||
| uniform vec3 color; | uniform vec3 color; | ||||
| out vec4 FragColor; | out vec4 FragColor; | ||||
| #ifdef LOOKDEV | #if defined(LOOKDEV_BG) || defined(LOOKDEV) | ||||
| uniform mat3 StudioLightMatrix; | uniform mat3 StudioLightMatrix; | ||||
| uniform sampler2D image; | uniform sampler2D image; | ||||
| uniform float studioLightBackground = 1.0; | |||||
| uniform float studioLightIntensity = 1.0; | uniform float studioLightIntensity = 1.0; | ||||
| uniform float studioLightBlur = 0.0; | |||||
| in vec3 viewPosition; | in vec3 viewPosition; | ||||
| # define M_PI 3.14159265358979323846 | # define M_PI 3.14159265358979323846 | ||||
| vec3 background_transform_to_world(vec3 viewvec) | vec3 background_transform_to_world(vec3 viewvec) | ||||
| { | { | ||||
| vec4 v = (ProjectionMatrix[3][3] == 0.0) ? vec4(viewvec, 1.0) : vec4(0.0, 0.0, 1.0, 1.0); | vec4 v = (ProjectionMatrix[3][3] == 0.0) ? vec4(viewvec, 1.0) : vec4(0.0, 0.0, 1.0, 1.0); | ||||
| vec4 co_homogenous = (ProjectionMatrixInverse * v); | vec4 co_homogenous = (ProjectionMatrixInverse * v); | ||||
| Show All 24 Lines | vec4 node_tex_environment_equirectangular(vec3 co, sampler2D ima) | ||||
| * texels. So we force the highest mipmap and don't do anisotropic filtering. */ | * texels. So we force the highest mipmap and don't do anisotropic filtering. */ | ||||
| return textureLod(ima, vec2(u, v), 0.0); | return textureLod(ima, vec2(u, v), 0.0); | ||||
| } | } | ||||
| #endif | #endif | ||||
| void main() | void main() | ||||
| { | { | ||||
| vec3 background_color; | vec3 background_color; | ||||
| #ifdef LOOKDEV | |||||
| #if defined(LOOKDEV_BG) | |||||
| vec3 worldvec = background_transform_to_world(viewPosition); | |||||
| background_color = probe_evaluate_world_spec(worldvec, studioLightBlur).rgb; | |||||
jbakker: Not really accurate, but `studioLightBlur * studioLightBlur * studioLightBlur` felt to be a… | |||||
Done Inline ActionsI think that this is too little blur for default 50% blur. I used powf(studioLightBlur, 2.5f). fclem: I think that this is too little blur for default 50% blur. I used powf(studioLightBlur, 2.5f). | |||||
| background_color *= studioLightIntensity; | |||||
| #elif defined(LOOKDEV) | |||||
| vec3 worldvec = background_transform_to_world(viewPosition); | vec3 worldvec = background_transform_to_world(viewPosition); | ||||
| background_color = node_tex_environment_equirectangular(StudioLightMatrix * worldvec, image).rgb; | background_color = node_tex_environment_equirectangular(StudioLightMatrix * worldvec, image).rgb; | ||||
| background_color *= studioLightIntensity; | background_color *= studioLightIntensity; | ||||
| background_color = mix(color, background_color, studioLightBackground); | |||||
| #else | #else | ||||
| background_color = color; | background_color = color; | ||||
| #endif | #endif | ||||
| FragColor = vec4(clamp(background_color, vec3(0.0), vec3(1e10)), 1.0) * backgroundAlpha; | FragColor = vec4(clamp(background_color, vec3(0.0), vec3(1e10)), 1.0) * backgroundAlpha; | ||||
| } | } | ||||
Not really accurate, but studioLightBlur * studioLightBlur * studioLightBlur felt to be a more natural curve.