WEBGL & WEBGPU Can I get image opacity parameter?

Not favoritedFavorited Favorited 0 favourites
  • 3 posts
From the Asset Store
A template for creating sprite editing functionality, including selection, resizing, rotation, duplication and more
  • Construct can provide those values:

    uniform mediump vec2 srcOriginStart;

    uniform mediump vec2 srcOriginEnd;

    uniform mediump vec2 layoutStart;

    uniform mediump vec2 layoutEnd;

    Can it provide image opacity value that we set on the scene?

  • The sdk docs about effects mention most of the builtin uniforms. But

    Uniform mediump float opacity;

    Used to be a thing in c2. But it might be gone now

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The opacity is not provided because in the effect compositor, it will pre-draw the object with its opacity to an offscreen surface, and then run your effect on the object with the opacity already having taken effect. So the opacity is in the alpha component of the foreground texture.

    It kind of has to work this way otherwise every single effect would also have to reimplement every part of the default rendering system, including things like the color tint, opacity, and some special handling of depth. And then if the effect is run later in the chain, none of those things apply anyway. So Construct just pre-draws it with the default rendering system and then your shader is processed on the result. (Unless none of the default rendering options affect rendering, in which case it can skip that and process your shader directly, but in that case it means the opacity is definitely 1.)

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