squared distance function

This commit is contained in:
Joshua
2016-09-23 14:31:05 +02:00
parent 22f7af4cf7
commit 5129eb207b
2 changed files with 15 additions and 4 deletions

View File

@@ -100,12 +100,23 @@ vec3 Pruefe_Pixel_in_Umgebung (vec2 start){
}else{ }else{
return vec3(0.5f); return vec3(0.5f);
}*/ }*/
float nenner=0.0f;
i=0;
while(i<anzahl_richtungen){
if(SicheresPixel[i].w!=-1){
SicheresPixel[i].w=pow(maximal-SicheresPixel[i].w,2);
nenner+=SicheresPixel[i].w;
}
i++;
}
i=0; i=0;
vec3 kombiniert=vec3(0.0f); vec3 kombiniert=vec3(0.0f);
float nenner=gefundene_pixel*maximal-gesamt_abstand;
while(i<anzahl_richtungen){ while(i<anzahl_richtungen){
if(SicheresPixel[i].w!=-1) if(SicheresPixel[i].w!=-1)
kombiniert+=SicheresPixel[i].xyz*(maximal-SicheresPixel[i].w)/nenner; kombiniert+=SicheresPixel[i].xyz*SicheresPixel[i].w/nenner;
i++; i++;
} }
return kombiniert; return kombiniert;
@@ -130,7 +141,7 @@ void main(){
color = getBackColor(UV).rgb; color = getBackColor(UV).rgb;
} else { } else {
vec3 h=Pruefe_Pixel_in_Umgebung(UV); vec3 h=Pruefe_Pixel_in_Umgebung(UV);
//h=vec3(0.5f); //h=vec3(1.0f, 0.0f,0f);
color = h; color = h;
} }
} }

View File

@@ -23,7 +23,7 @@ int UNSET = -1;
vec3 greenValue = vec3(0.0f, 1.0f, 0.0f); vec3 greenValue = vec3(0.0f, 1.0f, 0.0f);
vec3 difference = vec3(40.0f/255.0f); vec3 difference = vec3(40.0f/255.0f);
int radius = 5; int radius = 3;
vec3 getColor(vec2 uvCoord) { vec3 getColor(vec2 uvCoord) {