Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/engines/eevee/shaders/lightprobe_lib.glsl
| Show First 20 Lines • Show All 197 Lines • ▼ Show 20 Lines | vec3 probe_evaluate_planar(int id, PlanarData pd, vec3 P, vec3 N, vec3 V, float roughness) | ||||
| * In other words find intersection between reflection vector and the sphere center | * In other words find intersection between reflection vector and the sphere center | ||||
| * around point_on_plane. */ | * around point_on_plane. */ | ||||
| vec3 proj_ref = reflect(reflect(-V, N) * ref_depth, pd.pl_normal); | vec3 proj_ref = reflect(reflect(-V, N) * ref_depth, pd.pl_normal); | ||||
| /* Final point in world space. */ | /* Final point in world space. */ | ||||
| vec3 ref_pos = point_on_plane + proj_ref; | vec3 ref_pos = point_on_plane + proj_ref; | ||||
| /* Reproject to find texture coords. */ | /* Reproject to find texture coords. */ | ||||
| vec4 refco = ViewProjectionMatrix * vec4(ref_pos, 1.0); | vec4 refco = ProjectionMatrix * (ViewMatrix * vec4(ref_pos, 1.0)); | ||||
| refco.xy /= refco.w; | refco.xy /= refco.w; | ||||
| /* TODO: If we support non-ssr planar reflection, we should blur them with gaussian | /* TODO: If we support non-ssr planar reflection, we should blur them with gaussian | ||||
| * and chose the right mip depending on the cone footprint after projection */ | * and chose the right mip depending on the cone footprint after projection */ | ||||
| /* NOTE: X is inverted here to compensate inverted drawing. */ | /* NOTE: X is inverted here to compensate inverted drawing. */ | ||||
| vec3 radiance = textureLod(probePlanars, vec3(refco.xy * vec2(-0.5, 0.5) + 0.5, id), 0.0).rgb; | vec3 radiance = textureLod(probePlanars, vec3(refco.xy * vec2(-0.5, 0.5) + 0.5, id), 0.0).rgb; | ||||
| return radiance; | return radiance; | ||||
| ▲ Show 20 Lines • Show All 97 Lines • Show Last 20 Lines | |||||