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 / zdepth and zwrite

Author
Message
Chiblue
16
Years of Service
User Offline
Joined: 6th Nov 2009
Location: NE PA, USA
Posted: 23rd Aug 2010 20:19
I am struggling with using zdepth and zwrite, and problable zread (although I am not using this)...

Anyway, my problem is this, I have an FPS gun model that is animated, I also have a plain that is textured to be the weapons muzzle flash, I am using disable zdepth and zwrite on both to avoind them disappearing into scene objects... so this is my problem...

I cannot get the muzzle flash plain to position behind the gun... ie the muzzleflash is always on top of the gun...

I wrote a test program to display 2 colored plains and it seems that which ever plain is created first is at the back irrespective of position in the z... which makes sense... but I cannot get my gun and flash to work the same, no matter when I create the muzzle flash plain or the gun model the muzzle flash is always on the top...

Does anyone have any ideas why this would be the case, or can someone clearly describe how the rendering sequence is done when disabling the zdepth and zwrite?
DVader
22
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 23rd Aug 2010 20:24 Edited at: 23rd Aug 2010 20:26
Disabling the Z depth means exactly what it says. Whatever object you placed last will draw over the top of any other on the z axis. Would you not be better forgetting disabling zdepth and just positioning the object at the correct distance for it to work? IE. Place the muzzle flash on the end of your gun.

http://s6.bitefight.org/c.php?uid=103081
Chiblue
16
Years of Service
User Offline
Joined: 6th Nov 2009
Location: NE PA, USA
Posted: 23rd Aug 2010 20:35
Ok, I can do that, just makes the collision mechanics a little more involved... also when you say

Quote: "
Whatever object you placed last will draw over the top of any other on the z axis
"


What do you mean placed, becuase the muzzle flash is created first, but is positioned last?? and actually is is at the end of the gun it is using libms to position the flash object...
Mobiius
Valued Member
23
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 23rd Aug 2010 20:55 Edited at: 23rd Aug 2010 20:55
Add the muzzle flash plain as a limb of your weapon, then it will display the same.

My signature is NOT a moderator plaything! Stop changing it!
DVader
22
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 23rd Aug 2010 21:59 Edited at: 23rd Aug 2010 22:01
That is pretty much what I mean Mobiius. By placement I mean object draw order, disabling Z depth makes this very important. Any object you draw last will be priority on the z axis. You have to make sure closest objects are drawn last. So really best to avoid if poss.

http://s6.bitefight.org/c.php?uid=103081
Chiblue
16
Years of Service
User Offline
Joined: 6th Nov 2009
Location: NE PA, USA
Posted: 23rd Aug 2010 23:24
Ok, I added the plain as a limb and connected it to the muzzle flash limb...

Still have a problem but I think my positioning routine needs some addressing...

Thanks
Mobiius
Valued Member
23
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 24th Aug 2010 00:37
Quote: "I think my positioning routine needs some addressing.."

If it's a limb, then you don't need any positioning code???

Just position the flash limb at the end of the barrel, add it as a limb, then as the gun moves, the flash will automatically be in the right place.

My signature is NOT a moderator plaything! Stop changing it!
Chiblue
16
Years of Service
User Offline
Joined: 6th Nov 2009
Location: NE PA, USA
Posted: 24th Aug 2010 01:40
Ok I tried that and I get the plain inine with the barrel, I tried to rotate it and scale it but it will not work... What am I doing wrong?

Sorry it's in DarkGDK, but the functions are the same as DBPro and you guys answer quicker than the C++ forums..

lastlimb = the next available limb in the model...

Also I tried to texture the limd, but the model mesh got the texture, testuring before the makemesh does not work either... any help would be appreciated.. I have not tried to build my own limbs before so am new to it..

Login to post a reply

Server time is: 2026-07-23 14:56:08
Your offset time is: 2026-07-23 14:56:08