Added background to refinement shader
This commit is contained in:
@@ -21,6 +21,10 @@ int IS_UNDEFINED = 1;
|
||||
int IS_FOREGROUND = 2;
|
||||
int UNSET = -1;
|
||||
|
||||
vec3 greenValue = vec3(0.0f, 1.0f, 0.0f);
|
||||
vec3 difference = vec3(40.0f/255.0f);
|
||||
int radius = 10;
|
||||
|
||||
|
||||
vec3 getColor(vec2 uvCoord) {
|
||||
return texture(myTextureSampler, uvCoord).rgb;
|
||||
@@ -31,8 +35,8 @@ bool isBackground(vec3 c) {
|
||||
if (all( lessThanEqual(c, vec3(51.0f/255.0f, 208.0f/255.0f, 13.0f/255.0f))) &&
|
||||
all(greaterThanEqual(c, vec3(47.0f/255.0f, 204.0f/255.0f, 9.0f/255.0f)))*/
|
||||
// 0, 255, 0
|
||||
if (all( lessThanEqual(c, vec3(2.0f/255.0f, 255.0f/255.0f, 2.0f/255.0f))) &&
|
||||
all(greaterThanEqual(c, vec3(0.0f/255.0f, 253.0f/255.0f, 0.0f/255.0f)))
|
||||
if (all( lessThanEqual(c, greenValue+difference)) &&
|
||||
all(greaterThanEqual(c, greenValue-difference))
|
||||
) {
|
||||
return true;
|
||||
} else {
|
||||
@@ -43,9 +47,9 @@ bool isBackground(vec3 c) {
|
||||
void main(){
|
||||
int status = UNSET;
|
||||
|
||||
for(int w=-5;w<=5;w++){
|
||||
for(int h=-5;h<=5;h++){
|
||||
if (w+h==-10) { // first pixel
|
||||
for(int w=-radius;w<=radius;w++){
|
||||
for(int h=-radius;h<=radius;h++){
|
||||
if (w+h==-radius*2) { // first pixel
|
||||
if (isBackground(getColor(UV+vec2(pixWidth*w, pixHeight*h)))) {
|
||||
status = IS_BACKGROUND;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user