Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / [SOLVED] [Feature Request] Alpha transparency without partial transparency ( 1 bit alpha )

Author
Message
Nieb
10
Years of Service
User Offline
Joined: 13th May 2014
Location: Lurking
Posted: 15th Jul 2018 12:14
In a different game engine I've used; It used a threshold value on the alpha channel, and only rendered fully transparent or fully opaque.
Thus avoiding partial transparency along with polygon sorting & overdraw. This performs much better if you don't need the partial blending.

The author of this post has marked a post as an answer.

Go to answer

Bengismo
7
Years of Service
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 15th Jul 2018 12:42 Edited at: 15th Jul 2018 13:22
Firstly...we have a feature request thread:
https://forum.thegamecreators.com/thread/212232


Secondly this feature is easily achieved with a sprite shader that checks the alpha value and discards the pixel if the alpha is lower than the value specified. Combine this with setting the sprite transparency mode to 0 and it already does exactly what you want.

EDIT: heres actual shader i used to do the same thing (it might not be optimal but it works fine


you can assign this shader to a sprite then set the reference alpha level and any pixel with alpha less than the reference is thrown away
Nieb
10
Years of Service
User Offline
Joined: 13th May 2014
Location: Lurking
Posted: 24th Jul 2018 00:30
Any word from the developers?
Any chance of such a feature being implemented natively?

RE: Bengismo
That thread is huge, posting in there would be like throwing a speck of sand into a desert, and the OP hasn't been updated in quite sometime.
I'm working in 3D, not with sprites. Thanks anyhow.
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 24th Jul 2018 00:40
Quote: "I'm working in 3D, not with sprites. "


In 3D its very similar
fubar
Bengismo
7
Years of Service
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 24th Jul 2018 08:43 Edited at: 24th Jul 2018 16:35
This post has been marked by the post author as the answer.
Like fubarpk states....it can be done on 3d too with a very similar shader. Ive done it a few times and it take 2 lines of code to set up.

Do you know about SetObjectAlphaMask( objID, mode ) ?

That is the 3D version but it doesnt have a configurable alpha level (it always compares against 128)

You can just use the command above unless you want something else??
Nieb
10
Years of Service
User Offline
Joined: 13th May 2014
Location: Lurking
Posted: 24th Jul 2018 17:34 Edited at: 24th Jul 2018 17:36
Bengismo wrote: "Do you know about SetObjectAlphaMask( objID, mode ) ?"

That is exactly what I was looking for. Thank you much!
I can live without the configurable threshold.

Login to post a reply

Server time is: 2024-11-23 17:59:35
Your offset time is: 2024-11-23 17:59:35