 }
 
 
-vec3 getIBLVolumeRefraction(vec3 normal, vec3 viewDirectionW, float perceptualRoughness, vec3 baseColor, vec3 f0, vec3 f90,
-    vec3 worldPos, mat4 modelMatrix, mat4 viewMatrix, mat4 projMatrix, float ior, float thickness, vec3 attenuationColor, float attenuationDistance)
+vec3 getIBLVolumeRefraction(vec3 n, vec3 v, float perceptualRoughness, vec3 baseColor, vec3 f0, vec3 f90,
+    vec3 position, mat4 modelMatrix, mat4 viewMatrix, mat4 projMatrix, float ior, float thickness, vec3 attenuationColor, float attenuationDistance)
 {
     // Direction of refracted light.
-    vec3 refractionVector = refract(-viewDirectionW, normalize(normal), 1.0 / ior);
+    vec3 refractionVector = refract(-v, normalize(n), 1.0 / ior);
 
     // Compute rotation-independant scaling of the model matrix.
     vec3 modelScale;


    // Point where the refracted light is assumed to exit the geometry again.
    // The thickness is specified in local space.
    vec3 refractedRayExit = worldPos + normalize(refractionVector) * thickness * modelScale;
    float transmissionDistance = thickness * length(modelScale);

    vec4 viewPos = viewMatrix * vec4(refractedRayExit, 1.0);

    }

    // Sample GGX LUT to get the specular component.
    float NdotV = clampedDot(n, v);
    vec2 brdfSamplePoint = clamp(vec2(NdotV, perceptualRoughness), vec2(0.0, 0.0), vec2(1.0, 1.0));
    vec2 brdf = texture(u_GGXLUT, brdfSamplePoint).rg;   
    vec3 specularColor = f0 * brdf.x + f90 * brdf.y;
