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 / SetObjectTransparency strange behaviour

Author
Message
JohnStabler
AGK Bronze Backer
11
Years of Service
User Offline
Joined: 16th Aug 2013
Location: Cardiff, Wales, UK
Posted: 17th Jan 2021 20:12
Hi,

I spent a lot of time on this problem, so I thought I'd post a solution here. I saw people previously had a similar kind of issue, but those threads are closed so I can't tack it on to the end of one of them.

If you have a 3D object and use SetObjectTransparency(ob, 1) but keep the object at full alpha, you'll get a weird effect where the geometry looks like it's back to front, or that the back of the object gets drawn over the front.

This is because SetObjectTransparency() turns off the depth writing for the object. You can fix this by using SetObjectDepthWrite(ob, 1). You must call it after you have set the transparency on. This is the case in both AppGameKit Classic & AppGameKit Studio.

John
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 17th Jan 2021 21:35
Try SetObjectAlphaMask() instead of SetObjectTransparency().
JohnStabler
AGK Bronze Backer
11
Years of Service
User Offline
Joined: 16th Aug 2013
Location: Cardiff, Wales, UK
Posted: 18th Jan 2021 11:31
I'm changing the alpha value for the objects dynamically, depending on different circumstances, so I need the alpha blending.
Santman
13
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 18th Jan 2021 19:55
I gave up with AppGameKit and transparency. You can kind of get around ot for objects, but it destroys particles that have transparency completely.....and let's be fair, almost all do!
Santiago3D
4
Years of Service
User Offline
Joined: 11th May 2020
Location: Argentina
Posted: 20th Jan 2021 17:38
same problem with particles.

My particles are also rendered upside down, it is a disaster, whose only answer is "that things are like that", which has no solution.

I exposed it as a problem, and I got tired of hearing mediocre answers, like alpha problems happen in all engines.

if you use alpha, you will have that awful problem.



Santiago3D30/10/2020
Video de Santi
please!, someone tell me that i no crazy! and someone see the same i see
:slight_smile:
Tipo de archivo adjunto: unknown
main.agc
2.96 KB

AGC EXAMPLE CODE
https://cdn.discordapp.com/attachments/436108259741663233/771580891981414412/main.agc


https://cdn.discordapp.com/attachments/436108259741663233/771580477072867348/VID-20201030-WA0003.mp4
Santman
13
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 23rd Jan 2021 23:17
I already reported particle depth issues. Apparently you have to use other, slower methods for sorting transparent objects as a traditional depth buffer doesnt work, but its not a "bug".
Santman
13
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 23rd Jan 2021 23:19
Heres a solution: write your own particle system. That's what I did for rain, then you can control it with shaders. It would be epic if TGC let us assign a shader to particles.

Login to post a reply

Server time is: 2024-11-24 06:05:21
Your offset time is: 2024-11-24 06:05:21