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.

DarkBASIC Professional Discussion / Object transparency

Author
Message
GrumpyOne
18
Years of Service
User Offline
Joined: 27th Nov 2007
Location: London, UK
Posted: 14th Oct 2010 10:49
Dear All,

I am sure this comes up again and again, but I can't find the answer on the forum. If someone can point me in the right direction I'd be grateful.

I have a problem with models of trees. When I load a tree model, generated with Tree Magik, and set object transparency, the transparent portions of leaves do not display correctly. The tree models construct leaves as a series of planes contained in the same model. Where one plane overlaps another the transparent region of the texture doesn't display the leaves of the plane behind, but the texture of the object behind. I've attached a screen shot to show what I mean, it is difficult to put into words.

I've tried experimenting. Setting the "set object transparency" to different modes 1-6 doesn't seem to have any effect. It doesn't matter is alpha mapping is set on. I am loathe to play around with zdepth, which is a nasty can of words. I expect I could write a shader to solve the problem....but I'd hope there was a simpler solution.

Anyone have any suggestions?

Best,
Mr Grumpy

GrumpyOne - the natural state of the programmer
Rich Dersheimer
AGK Developer
17
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 14th Oct 2010 19:03 Edited at: 14th Oct 2010 19:58
Your screen shot is way too small to show what you are talking about, but you're right, this has come up before in these forums.

I think I have Tree Magik, I'll do some testing.

EDIT: It looks like transparency mode 4 or 6 work best, I'll post a screen shot in a bit.

Top is with transparency mode 1, bottom is with mode 6. You can see the problem along the edges of the transparency in the top image.

MORE EDIT: Mode 6 works better, mode 4 still leaves a bit of backdrop around the edges.



baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 14th Oct 2010 19:39
Try using "disable object zwrite" too...

GrumpyOne
18
Years of Service
User Offline
Joined: 27th Nov 2007
Location: London, UK
Posted: 17th Oct 2010 12:26
Thanks guys.

I did test with mode 1-6, and still have a visible problem with my trees even on mode 6. It's for an RTS. Perhaps I will try to write a shader, if I can figure out how to access the projected textures behind my object.

Disabling object zwrite isn't really an option since I'm not keen on my trees floating over other objects.

Best,
Mr Grumpy

GrumpyOne - the natural state of the programmer
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 17th Oct 2010 19:39
Chafari had a similar problem recently and solved it. Look for his recent posts.
baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 18th Oct 2010 10:20
Quote: "Disabling object zwrite isn't really an option since I'm not keen on my trees floating over other objects."

I think you are thinking of "disable object zdepth"...

All I know is it helped me with the same/similar problem on my game "Backlash" and I use a lot for transparent objects now.

Login to post a reply

Server time is: 2026-07-22 03:51:31
Your offset time is: 2026-07-22 03:51:31