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.

Dark GDK / How to make invisible textures?

Author
Message
MES
16
Years of Service
User Offline
Joined: 9th Feb 2008
Location: AFK
Posted: 6th Nov 2008 22:55
Hi,
When I animated trees for my game, I had the Problem, that they have to much polygons.
I know the trick to reduce the polygons with the squares I put on the tree and on that squares I paint my leafs.
But I don't want the whole square to be painted. In the gaps, where are no leafs I made my texture blue. Now I want that blue parts to be invisible.
How can I realize that?
Can I programm it with DarkGDK or do I have to change something in my 3D-Modelling-Programm (3D Canvas Professional 7)?

Regards
MES

http://www.Computer-Masters.de
Zuka
16
Years of Service
User Offline
Joined: 21st Apr 2008
Location: They locked me in the insane asylum.
Posted: 7th Nov 2008 00:20
dbSetImageColorKey().

Before you load the images. Make sure the images are bitmaps.

Or, the better way, use PNG textures with alpha.
MES
16
Years of Service
User Offline
Joined: 9th Feb 2008
Location: AFK
Posted: 7th Nov 2008 15:44
Hi,
The Texture is loaded right in the .x File, so the source code doesn't have any influence on the texture-files.

Is it possible to set the Color Key to the Object? I didn't find a function for that.
The Object is not just a tree (with one texture), there are also houses and so on.

Thanks for your help so far!
Regards
MES

http://www.Computer-Masters.de
MES
16
Years of Service
User Offline
Joined: 9th Feb 2008
Location: AFK
Posted: 16th Nov 2008 20:48
Do you have no idea?
Do I have to set the texture with a DarkGDK function?

http://www.Computer-Masters.de
sydbod
16
Years of Service
User Offline
Joined: 14th Jun 2008
Location: Just look at the picture
Posted: 16th Nov 2008 23:28
Hi MES,

Sorry for the late reply, but I was going through a similar problem with transparent textures as well as transparent materials like aircraft cockpits. Only sorted it out at 4AM this morning. Also could not find anything relevant with a search.

To make a transparent texture, you will have to make your texture picture in a format that supports transparency. I chose 32bit *.PNG files.
You have to make your picture background for the picture to transparent, or remove it completely.
Then you paint the leaves to the foreground.
Then you paint to the Alpha Channel ( to the picture, but the painting controls the transparency entry for the pixels) the areas you want to be transparent.

Lastly once the object is in the game, you have to set its transparency flag : "dbSetObjectTransparency ( ObjectID, 1); //allow transparency".

Things to be careful of when using transparency.
If a transparent polygon has already been drawn in the foreground, and then one tried to draw any sort of polygon in the background, the background polygon will not get drawn to screen (Z Buffer operation). You end up with what looks like holes in youe scene.
Always make sure things like solid trunks and branches are higher up the list in the model and will get drawn first, before you create the transparent leaves planes. The same applies for multi-layered billboards.

Hope that gets you started.
MES
16
Years of Service
User Offline
Joined: 9th Feb 2008
Location: AFK
Posted: 17th Nov 2008 21:07
Ok, that semms to be very difficult.
Which painting programm do you use for that?


Is there another possibility to make trees looking real with few polygons?
I got the idea with the invisible textures from GTA SA, because there you can see a blue outline on some of the trees, wich must come from cheap textures.

Thanks for your help so far!
Regards
MES

http://www.Computer-Masters.de
sydbod
16
Years of Service
User Offline
Joined: 14th Jun 2008
Location: Just look at the picture
Posted: 18th Nov 2008 02:32
It is not very difficult once you have managed to create one.
It may take you a whole afternoon to create your first one, but after that when you know what you are doing, then you can knock one out every 10 minutes or less.

I used Gimp for my paint program. (Open source ....Free).

I don't know of any other free program that supports what is required and is easier to use

We all suffer the same problem.
To create our code we require the models.
Model creators will not help us until we have the code.
the old saying is so true "Santa Claus helps those that help themselves".
MES
16
Years of Service
User Offline
Joined: 9th Feb 2008
Location: AFK
Posted: 18th Nov 2008 21:32
Thank you so much for your help.
It works now and I'm so happy! That was one of the main problems in my game.

I've never heard of transparency in pictures before, so it opens a new world for me, bcause I can use transparency also for my website.

Just Great!!!

Thank you!
Regards
MES

http://www.Computer-Masters.de

Login to post a reply

Server time is: 2024-11-25 08:03:48
Your offset time is: 2024-11-25 08:03:48