   // return uv;
 }
 
-bool _isBackFace(vec3 rayDir, vec3 normal) {
+bool _isFrontFace(vec3 rayDir, vec3 normal) {
   return dot(rayDir, normal) <= 0.0;
 }
 
-vec3 _revertNormal(vec3 normal, vec3 rayDir) {
-  return normal * (float(_isBackFace(rayDir, normal))) * 2.0 - 1.0;
-}
-
-vec3 _handleNormalForDoubleSide(vec3 normal, vec3 rayDir, bool isDoubleSide) {
-  if (isDoubleSide) {
-    return _revertNormal(normal, rayDir);
-  }
-
-  return normal;
+vec3 _revertForBackFace(vec3 normalRelatedData, bool isFrontFace) {
+  return normalRelatedData * (float(isFrontFace) * 2.0 - 1.0);
 }
 
 HitShadingData getHitShadingData(uint instanceIndex, uint primitiveIndex) {

                 .rgb) *
                2.0 -
            1.0)
            .xyz;
  } else {
    data.worldNormal = nw;
  }

  vec3 no = _blerp(attribs.xy, n0.xyz, n1.xyz, n2.xyz);
  const vec3 ta = _blerp(attribs.xy, t0.xyz, t1.xyz, t2.xyz);

  mat3 normalMatrix = _getNormalMatrix(instanceData);

  vec3 nw = normalize(normalMatrix * no);
  vec3 tw = normalize(normalMatrix * ta);
  vec3 bw = cross(nw, tw);

  BSDFMaterial mat = _getMaterial(materialIndex);

  if (bool(mat.isDoubleSide)) {
    bool isFrontFace = _isFrontFace(gl_WorldRayDirectionEXT, nw);

    nw = _revertForBackFace(nw, isFrontFace);
    tw = _revertForBackFace(tw, isFrontFace);
    bw = _revertForBackFace(bw, isFrontFace);
  }

  uint diffuseMapLayerIndex = uint(mat.diffuseMapLayerIndex);
  uint normalMapLayerIndex = uint(mat.normalMapLayerIndex);
