 	o.worldPos	= interpolate3D(	i[0].worldPos,	i[1].worldPos,	i[2].worldPos	); 
 	o.modelPos	= interpolate3D(	i[0].modelPos,	i[1].modelPos,	i[2].modelPos	); 
 	o.normal	= interpolate3D(	i[0].normal,	i[1].normal,	i[2].normal		); 
-	o.uv		= interpolate2D(	i[0].uv,		i[1].uv,		i[2].uv			); 
+	//o.uv		= interpolate2D(	i[0].uv,		i[1].uv,		i[2].uv			); 
 	o.tangent	= interpolate3D(	i[0].tangent,	i[1].tangent,	i[2].tangent	); 
 
-
-
-	o.uv = calestialToSpherical(o.modelPos + param_offsetFromPlanetCenter).xy;
-
-	//o.normal = normalize(o.normal);
+	//o.uv = calestialToSpherical(o.modelPos + param_offsetFromPlanetCenter).xy;
 
 	// APPLY TERRAIN MODIFIER
 	vec3 pos = o.modelPos + param_offsetFromPlanetCenter;
 	// make it uniform across different planet sizes
 	pos *= 200000 / float(param_radiusMin);
-	//uv = mod(uv * 10000000, 1);
 
 	o.worldPos += o.normal * AdjustTerrainAt(pos);
+	o.normal = normalize(o.normal);
 
 	gl_Position = engine.projectionMatrix * engine.viewMatrix * vec4(o.worldPos,1);
 


	// BASE COLOR
	//float pixelDepth = gl_FragCoord.z/gl_FragCoord.w; //distance(EyePosition, i.worldPos);
	vec3 color;
	vec3 normalColorFromTexture;
	getColor(color, normalColorFromTexture);

	float distToCamera = length(i.worldPos);
	float defaultNormalWeight = smoothstep(NORMAL_MAPPING_DISTANCE * 0.9, NORMAL_MAPPING_DISTANCE, distToCamera);

	if(a>2) return 2;
	return 1;
}
int tessLevel(float d1, float d2) {		
	float d=(d1+d2)/2;
	//float r=clamp((1/d)*(keyIK*10), 1, 64);
	//float r=clamp((1/d)*(100.0), 1, 64);
	float r=clamp(100/d, 1, 64);
	return closestPowerOf2(r);
}

