diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-04-17 07:17:24 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-04-17 07:21:24 +0300 |
commit | e12c08e8d170b7ca40f204a5b0423c23a9fbc2c1 (patch) | |
tree | 8cf3453d12edb177a218ef8009357518ec6cab6a /source/blender/draw/engines/eevee/shaders/volumetric_integration_frag.glsl | |
parent | b3dabc200a4b0399ec6b81f2ff2730d07b44fcaa (diff) |
ClangFormat: apply to source, most of intern
Apply clang format as proposed in T53211.
For details on usage and instructions for migrating branches
without conflicts, see:
https://wiki.blender.org/wiki/Tools/ClangFormat
Diffstat (limited to 'source/blender/draw/engines/eevee/shaders/volumetric_integration_frag.glsl')
-rw-r--r-- | source/blender/draw/engines/eevee/shaders/volumetric_integration_frag.glsl | 90 |
1 files changed, 45 insertions, 45 deletions
diff --git a/source/blender/draw/engines/eevee/shaders/volumetric_integration_frag.glsl b/source/blender/draw/engines/eevee/shaders/volumetric_integration_frag.glsl index 827d774b290..83ed9067087 100644 --- a/source/blender/draw/engines/eevee/shaders/volumetric_integration_frag.glsl +++ b/source/blender/draw/engines/eevee/shaders/volumetric_integration_frag.glsl @@ -15,49 +15,49 @@ layout(location = 1) out vec4 finalTransmittance; void main() { - /* Start with full transmittance and no scattered light. */ - finalScattering = vec4(0.0); - finalTransmittance = vec4(1.0); - - vec3 tex_size = vec3(textureSize(volumeScattering, 0).xyz); - - /* Compute view ray. */ - vec2 uvs = gl_FragCoord.xy / tex_size.xy; - vec3 ndc_cell = volume_to_ndc(vec3(uvs, 1e-5)); - vec3 view_cell = get_view_space_from_depth(ndc_cell.xy, ndc_cell.z); - - /* Ortho */ - float prev_ray_len = view_cell.z; - float orig_ray_len = 1.0; - - /* Persp */ - if (ProjectionMatrix[3][3] == 0.0) { - prev_ray_len = length(view_cell); - orig_ray_len = prev_ray_len / view_cell.z; - } - - /* Without compute shader and arbitrary write we need to - * accumulate from the beginning of the ray for each cell. */ - float integration_end = float(slice); - for (int i = 0; i < slice; ++i) { - ivec3 volume_cell = ivec3(gl_FragCoord.xy, i); - - vec4 Lscat = texelFetch(volumeScattering, volume_cell, 0); - vec4 s_extinction = texelFetch(volumeExtinction, volume_cell, 0); - - float cell_depth = volume_z_to_view_z((float(i) + 1.0) / tex_size.z); - float ray_len = orig_ray_len * cell_depth; - - /* Evaluate Scattering */ - float s_len = abs(ray_len - prev_ray_len); - prev_ray_len = ray_len; - vec4 Tr = exp(-s_extinction * s_len); - - /* integrate along the current step segment */ - Lscat = (Lscat - Lscat * Tr) / s_extinction; - /* accumulate and also take into account the transmittance from previous steps */ - finalScattering += finalTransmittance * Lscat; - - finalTransmittance *= Tr; - } + /* Start with full transmittance and no scattered light. */ + finalScattering = vec4(0.0); + finalTransmittance = vec4(1.0); + + vec3 tex_size = vec3(textureSize(volumeScattering, 0).xyz); + + /* Compute view ray. */ + vec2 uvs = gl_FragCoord.xy / tex_size.xy; + vec3 ndc_cell = volume_to_ndc(vec3(uvs, 1e-5)); + vec3 view_cell = get_view_space_from_depth(ndc_cell.xy, ndc_cell.z); + + /* Ortho */ + float prev_ray_len = view_cell.z; + float orig_ray_len = 1.0; + + /* Persp */ + if (ProjectionMatrix[3][3] == 0.0) { + prev_ray_len = length(view_cell); + orig_ray_len = prev_ray_len / view_cell.z; + } + + /* Without compute shader and arbitrary write we need to + * accumulate from the beginning of the ray for each cell. */ + float integration_end = float(slice); + for (int i = 0; i < slice; ++i) { + ivec3 volume_cell = ivec3(gl_FragCoord.xy, i); + + vec4 Lscat = texelFetch(volumeScattering, volume_cell, 0); + vec4 s_extinction = texelFetch(volumeExtinction, volume_cell, 0); + + float cell_depth = volume_z_to_view_z((float(i) + 1.0) / tex_size.z); + float ray_len = orig_ray_len * cell_depth; + + /* Evaluate Scattering */ + float s_len = abs(ray_len - prev_ray_len); + prev_ray_len = ray_len; + vec4 Tr = exp(-s_extinction * s_len); + + /* integrate along the current step segment */ + Lscat = (Lscat - Lscat * Tr) / s_extinction; + /* accumulate and also take into account the transmittance from previous steps */ + finalScattering += finalTransmittance * Lscat; + + finalTransmittance *= Tr; + } } |