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 / Translucent / transparent Objects

Author
Message
zydeoN
15
Years of Service
User Offline
Joined: 25th Sep 2009
Location:
Posted: 22nd Nov 2009 19:12
Hi, i am using Sketchup to edit the map for my fps game, but for windows, i used a translucent texture, so i can see the inside of the buildings. I have google sketchup pro and i export the map to 3DS format, but when loading it to the game, the windows are not transparent... Do i have to do something besides dbLoadObject() ?
Help would be much appreciated...
zydeoN
15
Years of Service
User Offline
Joined: 25th Sep 2009
Location:
Posted: 24th Nov 2009 20:48
Does anybody use transparent objects in dark gdk ?
_Pauli_
AGK Developer
15
Years of Service
User Offline
Joined: 13th Aug 2009
Location: Germany
Posted: 24th Nov 2009 21:59
You can make a whole object see-through by using dbGhostObjectOn.
If you want to make just a part of your model transparent, you may export the parts individually and set their ghost-state.
I believe there must be somekind of shader around for it, but I never searched for it...

Now the plot thickens, the fps decreases, and the awesomeness goes through the roof.
Morcilla
21
Years of Service
User Offline
Joined: 1st Dec 2002
Location: Spain
Posted: 25th Nov 2009 10:24
The materials described inside a .3ds or .x file can be kept if the object is 'just loaded' (dbLoadObject).

They are destroyed if the object is textured using dbTextureObject.

The texture names (if any) must be included in the different materials themselves, usually with a relative path, so they are applied at dbLoadObject execution.
That is, object file and texture files must be available in the disk when dbLoadObject is performed.

Also, if you have problem with .3ds try to convert it to .x, but you should be able to see through those windows.
Anyway, you'll probably soon discover that you want to texture the object, give it a shader or whatever, so I'm afraid that it is not a long run approach.
zydeoN
15
Years of Service
User Offline
Joined: 25th Sep 2009
Location:
Posted: 25th Nov 2009 14:46
And do i use the shader functions that came with dark gdk ?
entomophobiac
22
Years of Service
User Offline
Joined: 1st Nov 2002
Location: United States
Posted: 25th Nov 2009 17:56
Ï don't remember the command off the top of my head, but you need to set the object to use alpha blending in some way. It's not a shader per-se, but simply a way to interpret alpha blending inside the GDK. It's switched off by default, for some strange reason.

It will then interpret alpha channels from textures, so if the textures you use are proper, it'll alpha-blend.
Morcilla
21
Years of Service
User Offline
Joined: 1st Dec 2002
Location: Spain
Posted: 26th Nov 2009 10:53
Quote: "And do i use the shader functions that came with dark gdk ? "
No, that needs the 'dbLoadEffect' function.

What entomophobiac says is that you can use dbTextureObject, if the texture has an alpha (transparency) channel, that fits into the windows. I recommend to use .png textures for this approach.
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 26th Nov 2009 10:56
an alpha channeled texture would control the object's alpha?

Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 26th Nov 2009 11:16 Edited at: 26th Nov 2009 11:31
sorry for double posting, the site is TOO slow that i can't edit my post.

i found out 2 ways to do it:

1-


2-


so i think if you use the second way, you can make all the object's texture images alpha channeled and then load the object and use dbSetObjectTransparency()

edit: tested and it works:


media: http://filebeam.com/2eb2e3d55264e8340769c927b1d3daec
extract it in the project's directory.

press A in the application and see what happens

zydeoN
15
Years of Service
User Offline
Joined: 25th Sep 2009
Location:
Posted: 26th Nov 2009 21:53
It works, but why did you use dbSetObjectTransparency ( 1, 2 ) ? I mean, dbSetObjectTransparency ( 1,1) works the same way... What do we have to put in the second parameter ?
void dbSetObjectTransparency ( int iID, int iFlag );

And how do i know a texture is alpha channeled ?
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 27th Nov 2009 04:58 Edited at: 27th Nov 2009 04:59
i dunno about the second parameter lol, set it to one no problem xD

how to know? you must make it alpha channeled, what are you using to make textures? Photoshop?

Morcilla
21
Years of Service
User Offline
Joined: 1st Dec 2002
Location: Spain
Posted: 27th Nov 2009 10:19
Quote: "And how do i know a texture is alpha channeled ? "

You are not likely to know until you open it in an image editor and look to its alpha channel, if it is black or it doesn't exist, then the image has no transparent zones.

Login to post a reply

Server time is: 2024-11-24 17:36:01
Your offset time is: 2024-11-24 17:36:01