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 / Culling with two transparent objects

Author
Message
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 23rd May 2019 05:39 Edited at: 23rd May 2019 05:40
I have a setup like this


The blue object is a mad scientist type machine and it converts boulders to diamonds (Wish i had one ;-D). It is set as a transparent object
The billboard is slightly deformed plane object which will display an electric arc. It is also set as a transparent object

My problem is that the billboard image is being rendered BEHIND the machine (Top left of machine)
I think i've got to use SetDepthWrite() and/or SetObjectCullMode() or something or other but the combinations i have tried don't seem to give me the results i want.



Any help is greatly appreciated.
Thanks

Attachments

Login to view attachments
SFSW
21
Years of Service
User Offline
Joined: 9th Oct 2002
Location:
Posted: 23rd May 2019 06:29
If you're not concerned with other structures closer than the arc, you can use:

SetObjectDepthReadMode(obj,7)

Which should place it in front of the machine.
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 23rd May 2019 06:59 Edited at: 23rd May 2019 08:28
No luck with SetObjectDepthReadMode(obj,7) unfortunately

I've attached a project so you can have a look at it if you want

UPDATE: I figured it out. It uses the pivot point to calculate the depth (which was at the base of the electric arc object)

Thanks for your help matey!

Attachments

Login to view attachments
SFSW
21
Years of Service
User Offline
Joined: 9th Oct 2002
Location:
Posted: 23rd May 2019 16:48
Thanks for the sample code. Indeed, the method of transparency also plays a role as does the other object also being marked for transparency mode 1. Since you specified alpha, the bolt is technically solid. So when initialized that way, it will layer as though solid and clip based on pivot/center when interacting with the other alpha active structure.

If you don't need alpha transparency on the machine, you can rem out that line for the 'factory' object and the bolt will appear as desired and you can use different transparency methods on the bolt. If you use either additive or custom blending, you can give the bolt a nice electric 'glowing' look and disregard the pivot point entirely. See the attached update for an example.

Attachments

Login to view attachments
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 23rd May 2019 21:03
Thanks SFSW! That is a very handy piece of code

Login to post a reply

Server time is: 2024-04-25 09:31:25
Your offset time is: 2024-04-25 09:31:25