 // add Rim Lighting to highlight the edges
 #if defined(r_RimLighting)
 	float rim = pow(1.0 - clamp(dot(N, V), 0, 1), r_RimExponent);
-	specular *= rim;
-	vec3 emission = u_AmbientColor * rim;
+	specBase = mix(specBase, vec3(1.0), rim);
+	vec3 emission = u_AmbientColor * rim * rim;
 
 	// gl_FragColor = vec4(emission, 1.0);
 	// return;


	// simple Blinn-Phong
	float NH = clamp(dot(N, H), 0, 1);
	vec3 specular = texture2D(u_SpecularMap, texSpecular).rgb * u_LightColor * pow(NH, r_SpecularExponent) * r_SpecularScale;

#endif // USE_REFLECTIVE_SPECULAR


		N = normalize(var_Normal);
	}

	vec3 specBase = vec3(0.0);
	vec3 specMult = vec3(0.0);

#endif // USE_NORMAL_MAPPING

