Simple effect always transparent

0 favourites
  • 7 posts
From the Asset Store
This Girls Game allows young fashionistas to develop their taste and skills as a fashion designer.
  • So I have a shader that I always use in my own engines that I can use a sample texture to apply transitions and I made a super simple version of it for construct to get used to constructs plugin system and for some reason I just can't get it to work.

    The concept is super simple, pass a cutoff float to the shader and compare the r value of the pixel in a ramp/gradient image and if the cutoff value is lower than the r value of that coordinate, make the color black, if not, make it transparent. But for some reason it is always transparent. I don't know if I'm missing something or what. Any help or information would be greatly appreciated. Here is the code:

    ///////////////////////////////////////////////////////// // Transition effect varying mediump vec2 vTex; uniform lowp sampler2D samplerFront; uniform lowp float cutOff; void main(void) { lowp float pixel = texture2D(samplerFront, vTex).r; lowp vec4 outColor = vec4(0, 0, 0, 0); if(pixel < cutOff) outColor = vec4(1, 1, 1, 1); gl_FragColor = outColor; }


  • Nvm, Its working like it should. Dummy me noticed I put white values in instead of black after I submitted the post, it’s always the little things lol thanks anyways

  • Talking to the rubber duck (or posting to a forum) debugging always works wonders!

    Also, nice idea for a transition effect with use gradient and a tween for controlling the cutoff, I hope you post it up to the C3 addons site. I have done things that are similar (but different), for example, see my Alpha Range mask effect here,

  • Ya I actually just came to construct a couple does ago bc my brother is a huge fan, even does podcasts about construct 3. I usually open glsl in notepad++ But since it has a different extension, I opened it in notepad bc I didn’t know it was a fragment shader until I opened it, I think that was mistake number 1 lmao

    Funny bit of info though, I actually know that shader already. I downloaded a random effect to see how everything was setup and what did what it just so happened to be yours.

    When I’m finished I’m gonna post it. Need sprite transitions as well (so you can transition images to alpha) so there’s a few things more to be added. Still kinda learning the ropes of how construct does things. Mainly I came to construct to make addons for my brother and release them to the community as well

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Welcome to the C3 community, looking forward to future plugins/effects, that's funny you already saw that plugin, don't shame me too much about the inefficient/branching shader code in there :) How about a link to your brother's podcast, I would be interested in checking that out.

  • Thanks. Still have alot of learning to do here. Here's his podcast channel:

  • Thanks, good podcast, I hope he keeps it going.

    Nice effect, that is fun to play with, finding different gradients and trying them out.


Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)