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 / dbSetAlphaMappingOn Transparency & Skyboxes

Author
Message
DBAlex
19
Years of Service
User Offline
Joined: 4th Oct 2004
Location: United Kingdom
Posted: 9th Aug 2010 04:24 Edited at: 9th Aug 2010 04:25
Hi, I have two issues:

Transparency using dbSetAlphaMappingOn

I'm trying to use dbSetAlphaMappingOn to make an object transparent, but as you can see below it doesn't show the background behind the transparent objects:



Why is this? I've tried using dbSetObjectTransparency and dbGhostObjectOn but I can't seem to get the background to show through the transparency.

Could it possibly be a HW issue? I can try it tomorrow on my 9600GT I suppose.

Skyboxes/Skyspheres

Is their a way to texture a sphere and use it as a skybox? I know I can easily load .X skyboxes using DGDK but I have a texture I want to use (as seen in the BG) and I want to use that as my skybox/sphere and then rotate it. I've tried using a huge textured sphere using dbMakeObjectSphere but I can't see inside the sphere so it doesn't work.

Thanks for any help! DGDK is really a fun "language" to program in when you've been hacking OpenGL all year...

Learning DarkGDK for phun.

AMD X2 7750, 2GB, 250GB HD, Nvidia 9600GT, XP SP3 & Ubuntu
JTK
14
Years of Service
User Offline
Joined: 10th Feb 2010
Location:
Posted: 9th Aug 2010 07:13
Quote: "Is their a way to texture a sphere and use it as a skybox? I know I can easily load .X skyboxes using DGDK but I have a texture I want to use (as seen in the BG) and I want to use that as my skybox/sphere and then rotate it. I've tried using a huge textured sphere using dbMakeObjectSphere but I can't see inside the sphere so it doesn't work.
"


I know that this can be done, I've done it myself. Although I don't remember off hand, exactly, I want to say that you have to call dbSetObjectCull(obj_id,0) to derive the effect that you are looking for...

As for the transparent texturing: there are several flags that you can provide for transparency: 0 thru 6 (if memory serves me). Try those various settings to see which (if any) works for you... dbSetObjectTransparency(obj_id,flag). Also, don't forget that you may have to call dbSetImageColorKey() *before* loading the image that you will be using as the texture...

Hope this helps,
JTK
Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 9th Aug 2010 12:16
You can scale the sky sphere using negative values, it will then be textured inside.

For ghosting an object, it works for me. If I import a model though I have to use dbSetObjectLight(id, 1) for it to work.

Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 9th Aug 2010 13:27
@ your first question, is the skybox a normal object? if so, i believe the reason is because GDK is drawing the object(your cube or whatever) before the skybox, because GDK arranges objects according to their distance from the camera, farther objects drawn first (NOTE: this only applies to to objects using alpha)

what's happening is that the skybox's position is closer than the box's position, because the position is in the center, assuming the skybox will always be positioned on top of the camera, it will always be drawn last

as for the solution, i havn't really done it myself, but i believe making 6 separate plains and positioning them manually would help

KISTech
16
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 9th Aug 2010 20:10
Don't do anything else to the object but this.

dbSetObjectTransparency, obj, 3
dbSetAlphaMappingOn obj, 30

What result does this produce?

If this is a skybox, it should be created with,

dbMakeObjectCube obj, -10000
dbPositionObject obj, dbCameraPositionX(), dbCameraPositionY(), dbCameraPositionZ()

DBAlex
19
Years of Service
User Offline
Joined: 4th Oct 2004
Location: United Kingdom
Posted: 9th Aug 2010 21:49 Edited at: 9th Aug 2010 21:49
@JTK: Thanks yes, the colorkey is for transparency in textures I think, I was looking for Alpha transparency, but playing with dbSetObjectTransparency works (Why are these extra modes not in the manual?!?! (My main point of reference atm)

@matty halewood: Thanks! Going to try that now for the skybox. Ghosting is different, was looking for alpha transparency, thanks though, it's fixed now!

@Hassan: Cheers! Useful info to know

@KISTech: Cheers! Using "dbSetObjectTransparency, obj, 3" worked perfectly. What does flag 3 mean then? It's exactly what I wanted, pic below:



I'll try the skybox next.

Learning DarkGDK for phun.

AMD X2 7750, 2GB, 250GB HD, Nvidia 9600GT, XP SP3 & Ubuntu
KISTech
16
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 10th Aug 2010 02:20
There should be some mention of Set Object Transparency in the help files when it talks about Set Alpha Mapping On, but I don't think there is. I think I learned the combination by reading someone else's example code.

For various situations you have to change the last parameter, but I've found that 3 works for about 98% of everything.

Login to post a reply

Server time is: 2024-07-02 09:03:03
Your offset time is: 2024-07-02 09:03:03