fabmax / kool

An OpenGL / WebGPU engine for Desktop JVM, Android and Javascript written in Kotlin
https://fabmax.github.io/kool/kool-js
Apache License 2.0
273 stars 16 forks source link

UI Opacity #37

Open andrey-zakharov opened 1 year ago

andrey-zakharov commented 1 year ago

I'm trying to animate appeareance of UI stuff by smooth revealing from transparent state to full opacity. I could not find out any easy way to make UiSurface semitransparent. I'd prefer to have some exposed shader's uniform as alphaMultiplier. How could i make this?

fabmax commented 1 year ago

Yes some kind of global alpha multplier is still missing. All meshes that make up an UI are managed by UiSurface (UiPrimitiveMesh, TextMesh and ImageMesh), so it should be relatively easy to add an alphaMultiplier uniform to the corresponding shaders and add a property to UiSurface which then sets the shader uniforms.