Skip to content

how to remove/change/transparent in fragment shader? #395

Answered by greggman
lv2lrn4lf asked this question in Q&A
Discussion options

You must be logged in to vote

That link has resource that cannot be used

I don't know what you mean? Are you saying the code doesn't run?

Screen.Recording.2022-05-02.at.10.19.29.AM.mov

Or are you saying something else?

The code you posted seems to have a typo

this

  if (color.g < 10.0/255.0 && color.r < 10.0/255.0 && color.b < 10.0/255.0) color = vec4(0) 
    //transparent color
    color = vec4(0);
   return color;

Is really this

  if (color.g < 10.0/255.0 && color.r < 10.0/255.0 && color.b < 10.0/255.0) {
     color = vec4(0) 
  }

  //transparent color
  color = vec4(0);
  return color;

So it always returns black

If it was me I'd try to do something more generic. Examples

(1) Use a uniform

  uniform ve…

Replies: 4 comments 4 replies

Comment options

You must be logged in to vote
1 reply
@lv2lrn4lf
Comment options

Comment options

You must be logged in to vote
1 reply
@lv2lrn4lf
Comment options

Comment options

You must be logged in to vote
1 reply
@lv2lrn4lf
Comment options

Answer selected by lv2lrn4lf
Comment options

You must be logged in to vote
1 reply
@lv2lrn4lf
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants