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 / Z-Sort Vs. Z-Buffer Explained

Author
Message
The Wendigo
22
Years of Service
User Offline
Joined: 13th Sep 2002
Location: A hole near the base of a tree in the US
Posted: 5th Oct 2004 10:22
I am writing this because I've noticed there is a lot of confusion out with with the so-called newbies and their understanding of how object occlusion works in hopes to clarify the situation.

Z-Sorting and Z-Buffering are NOT the same thing. Dark Basic Pro currently only supports Z-Buffering, which can cause a few problems. A patch is in the works to implement better occlusion techniques whether it be Z-Sort or something else, however for this explination I am going to be talking about Z-Sorting.

What is Z-Sorting? Z-Sorting (or Painter's Algorithm) is where objects are drawn based on the order of their distance to the camera. Basically, if an object is 5 yards away from the camera compared to an object 3 yards from the camera, then the 5 yard object will be drawn before the 3 yard object. That makes it to where closer objects will paint over the farther objects and give correct occlusion. There are limmitations to this, however. For the case of two objects intersecting each other there is no correct way to sort who gets drawn first. For instance, say you have two plains crossing each other in the shape of an X like in this picture:
http://www.geocities.com/djpeterson83/PainterGlitch.JPG
as you can see, there is just no correct way to draw it. If you draw the red one last, now, you would have the red one on top of the blue one.

What is Z-Buffering? Z-Buffering was the initial cure-all for the Z-Sort or Painter's Algorithm, but as will be shown later, it has its limmitations as well. How Z-Buffering works is by using a buffer the size and dimmension of the screen buffer (your monitor, basically). It then writes to the Z-Buffer all the polygon information just like it would to the screen with one exception: instead of writing the polygon's pixel color value at that location, it writes the polygon's pixel Z position, and only writes it if the new Z position of that pixel is closer to the camera. Otherwise it just ignores it because that pixel should be occluded. Because of the way that Z-Buffering works, it really doesn't care about the order of the objects it is drawing, only if the pixels of each object are closer than the last plotted pixel at that point. This gives pixel perfect occlusion, but has one major limmitation: if an object's pixels are translucent, then it will write the pixel to the Z-Buffer as if it were opaque! Thus objects which should show slightly through at that particular pixel, are completely obscured. Back in the beginning of 3D game programming, translucency was never an issue, so this wasn't a problem, but now a days this is not the case. Many of you may have noticed this phenominon already with blue-edged trees, or water that shows right through the terrain.

The Verdict: In today's graphics, Z-Buffering or Z-Sorting alone are not enough. Both methods must work together to give the best looking visuals with as few artifacts as possible. Thankfully, the DBP folks are adding in this capability (or a similar one).

The Solution: Currently, until the next patch comes out, THERE IS NO REAL SOLUTION. I stress this because there is a lot of missleading talk about how disabling the Z-WRITE of an object is some cure-all, but this is not the case! All this simply does is make it where the Z-Buffer ignores your objects pixels. This can actually cause more problems as now your object is ignored by the Z-Buffer, your object gets completely occluded by objects FARTHER away from it. A tree 50 yards away will now show over a bush 1 foot away, and as you may guess, this looks really wierd.

I hope this clears things up a bit, because the DBP folks have really been getting hit hard by similar bug-reports on the same issue. If there are any comments to this, please feel free to post.

Current Projects: Verious things right now. Lots of utils for game making. Hopefully something solid soon.

http://www.geocities.com/djpeterson83
Dave J
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Feb 2003
Location: Secret Military Pub, Down Under
Posted: 5th Oct 2004 16:46
Ahh, nice work. That's really useful, thanks. I knew they were different but I wasn't exactly sure why.


"Computers are useless they can only give you answers."
The Wendigo
22
Years of Service
User Offline
Joined: 13th Sep 2002
Location: A hole near the base of a tree in the US
Posted: 5th Oct 2004 17:58
No problem. Back when I was just getting into 3D programming, this stuff confused me a bit too, but after some messing around and a lot of reading, I finally got it figured out. Hopefully this will save a lot of new-to-3D folks a lot of work and reading .

Current Projects: Verious things right now. Lots of utils for game making. Hopefully something solid soon.

http://www.geocities.com/djpeterson83
Hamish McHaggis
22
Years of Service
User Offline
Joined: 13th Dec 2002
Location: Modgnik Detinu
Posted: 5th Oct 2004 23:20
So is this why having transparent polygons with overlaying solid polygons are completely screwed up in DBPro? I've had loads of trouble with transparent polygons within the same object and I've just given up now.

Isn't it? Wasn't it? Marvellous!
Get Involved With The DBPro Community FPS
Supremacy
21
Years of Service
User Offline
Joined: 30th Dec 2003
Location:
Posted: 6th Oct 2004 00:26
This and Control over anti-alising should be the main preocupation of TGC, dont forget anti-alising is always a plus when showing your product to a publisher .

The Wendigo
22
Years of Service
User Offline
Joined: 13th Sep 2002
Location: A hole near the base of a tree in the US
Posted: 6th Oct 2004 14:14
Basically, yeah, this is a lot of the reason that transparency looks funny right now, but as I said, they are focusing on getting it implemented (it's actually more of a limmitaion than a bug).

As far as AA goes, I don't really use it all that much as it tends to slow things down. You are probably right, though, as AA does really cover up those hard edges. Are there AA problems in DB currently?

Current Projects: Verious things right now. Lots of utils for game making. Hopefully something solid soon.

http://www.geocities.com/djpeterson83
Dave J
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Feb 2003
Location: Secret Military Pub, Down Under
Posted: 6th Oct 2004 17:02
The only AA problem in DBP is that it can't be turned on by DBP, instead, it must be manually turned on within the Graphics card control panel. What this means is that AA won't work in DBP for any user that has selected the "Let the application decide" option, unfortunately, that's about 95% of users.


"Computers are useless they can only give you answers."
Hamish McHaggis
22
Years of Service
User Offline
Joined: 13th Dec 2002
Location: Modgnik Detinu
Posted: 6th Oct 2004 18:48
Mike said something about adding a command to switch anti-aliasing on and off I think.

Isn't it? Wasn't it? Marvellous!
Get Involved With The DBPro Community FPS
Preston C
22
Years of Service
User Offline
Joined: 16th May 2003
Location: Penn State University Park
Posted: 6th Oct 2004 19:54
You calling me a newbie?

But yeah, that was a good explanation on everything. But don't call us non newbies newbies, k? Been working with Dark Basic Pro for a while now, and DBC for a while before that.

Cheers,
Preston

Intel Celeron 1.3 Ghrz 512 MB Ram nVidia GeForce FX 5200 128MB
Prayne de crabug ahm rinedere be-yogt iglo kes gron
The Wendigo
22
Years of Service
User Offline
Joined: 13th Sep 2002
Location: A hole near the base of a tree in the US
Posted: 6th Oct 2004 20:10
Quote: "You calling me a newbie"


lol, not everyone complaining about the situation (myself included) is a newbie and I wasn't even about to sort out who was and who wasn't. Actually, (don't really mean to back-pedal ) but a lot of the people talking about this issue had some very advance projects going. I will admitt that since you were about the 5th person I talked about this too, that I felt it was time for this explanation, but seeing your work, you don't exhibit any signs of the newbie syndrome .

Freakin amazing work with memblocks, preston. I was amazed to see anyone alpha-vertex-blend two meshes together to make terrains (IMO) that looked better than the new Advanced Terrain system.

Oh yeah! One other thing. I'm not sure exactly why, but I've noticed that objects of different sizes (for instanced two different sized plains) in the exact same position and having transparency on seem to sheer eachother unmercifly, but if you make those two the same size, the sheering goes away and you get a perfect blend. I'd assume this has something to do with Z-Buffer resolution, but I'm not sure why, really, as the two objects are smack-dab on eachother at X Y and Z position, this shouldn't really factor in. I noticed this while working with my water system (3 plains of translucency to work with! ACK!) and that's how I got it to work.

Current Projects: Verious things right now. Lots of utils for game making. Hopefully something solid soon.

http://www.geocities.com/djpeterson83
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 6th Oct 2004 23:56
Very nice explanation Wendigo - this crops up all the time so I'll sticky it for now.


Van-B


Muhahahahaha.
Kevin Picone
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Australia
Posted: 7th Oct 2004 00:00 Edited at: 11th Aug 2010 23:39
That's Z fighting, it's a by product of both how the Z is sampled across the spans (a scan line)of the polygon and z buffer resolution.

Even in perspective correct renders, one of the common tricks (even in hardware) is rather than generate true Z values across the scan line (the polygon span) for each pixel / texel, you only generate true Z at set of sample points (every 8 pixels is more than enough) then linearly interpolate between them.

Rob K
Retired Moderator
22
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 7th Oct 2004 00:42 Edited at: 7th Oct 2004 00:43
This page provides some useful information on the problems and the alternatives:

http://www.sjbaker.org/steve/omniv/alpha_sorting.html

Needless to say, implementing some of these could be quite fiddly.


BlueGUI:Windows UI Plugin - All the power of the windows interface in your DBPro games.
Hamish McHaggis
22
Years of Service
User Offline
Joined: 13th Dec 2002
Location: Modgnik Detinu
Posted: 7th Oct 2004 03:42 Edited at: 7th Oct 2004 03:44
AsylumHunter came up with the idea of alpha blended terrains first (not saying preston isn't worthy of the title "non-n00b" , cos he is), just thought I'd mention it, cos twas an inspiration to all of us...

http://www.dannywartnaby.co.uk/rgt/index.php?board=10;action=display;threadid=2289;start=msg28237#msg28237

Isn't it? Wasn't it? Marvellous!
Get Involved With The DBPro Community FPS
Preston C
22
Years of Service
User Offline
Joined: 16th May 2003
Location: Penn State University Park
Posted: 7th Oct 2004 07:41
Yep, thats where I got the idea for it. Never really tried it seriously until now, and it really peeves me off that all this z-whatever stuff screwed it up (when it would work great in previous patches).

Cheers,
Preston

Intel Celeron 1.3 Ghrz 512 MB Ram nVidia GeForce FX 5200 128MB
Prayne de crabug ahm rinedere be-yogt iglo kes gron
Mr Anderson
21
Years of Service
User Offline
Joined: 14th Oct 2003
Location: NYC
Posted: 7th Oct 2004 12:46
Great explanation!

I do disagree with saying that Z buffering is like crippled by the tranceparency bit; it just cannot cover every single contingency. The same way that z-sorting has its limitations. In the end the z-buffer is more efficient in handling the task because it takes less of the processors time and just more memory (and that we have lots of don't we). It is really space versus time algorithms. All techniques have there strengths and weaknesses.

In almost all graphics engines I have seen, when you write transparent things to the screen you turn off the depth buffer anyway - and you take a small hit by changing the renderer's state.

I'm not sure of this, but perhaps with pixel shaders you will be able to better test and control the depth-buffer (z-buffer) per pixel with much less of a hit on performance from changing the hardware engine's state machine.

G’day

IDIC (Infinite Diversity Infinite Combinations)
The Wendigo
22
Years of Service
User Offline
Joined: 13th Sep 2002
Location: A hole near the base of a tree in the US
Posted: 7th Oct 2004 15:02
Thanks for the feedback, guys, and thanks for stickying it VanB.

AsylumHunter, sounds like a cool guy then . I'd like to see his work.

Current Projects: Verious things right now. Lots of utils for game making. Hopefully something solid soon.

http://www.geocities.com/djpeterson83
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 7th Oct 2004 17:15
Yeah, his screenies certainly got our attention, IIRC he is a pro terrain developer for console games, his method was really complex because he used Max - but luckily we have memblocks which make the job much easier.


Van-B


Muhahahahaha.
Avan Madisen
22
Years of Service
User Offline
Joined: 12th Sep 2002
Location: The Castle Anthrax
Posted: 7th Oct 2004 21:53
I've had a brain storm reading this. You say that the z-buffer keeps the depth of the pixels drawn so anything trying to draw behind it is left out.

Well, what I'd like to see is a way to set a default z-buffer, so you can paste a pre-rendered image onto the screen along with a z-depth image so 3d can be drawn within that image.

Think of Resident Evil, I've seen a few people in the past wanting to try it but now I can see how Capcom did the effect.

Paste a rendered image onto the screen, fill the z-buffer with z-data of that image produced by the renderer, then draw the 3d over that and the pre-determined z-data clips the 3d in the scene.

It's such a simple trick and it would work so easily, I do believe that's how they did it, some kind of functionality to do that in DBPro would be great.

I'd appreciate it if TGC would consider it.

Nice work on the infomation Wendigo.

Avan

I don't suffer from insanity:
I enjoy every minute of it!
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 7th Oct 2004 22:16
In resident evil, I think they used mock 3D scenes, like a rendered scene, but textured onto a much lower res model. You could do this in DB if you have a limb act as a camera, like render your high quality image, then plonk a cube down at the camera location and get it rotated right - so that you can recreate the camera angles in DBPro, then inside DBPro, you could find each vertices screen location and auto-plain UV map the scene onto a lower resolution mesh. Then you'd have the 3D effect, and it'd work with lighting and all your other effects and models, but all inside a rendered screen.

Even point and click adventure games with cartoony or hand-drawn graphics could use that method, you'd render your scene in DBPro, then draw the graphics over the top, like working from a basic render. Often getting correct perspective, scale and shading is the toughest part of manually drawing scenes.


Van-B


Muhahahahaha.
Mr Anderson
21
Years of Service
User Offline
Joined: 14th Oct 2003
Location: NYC
Posted: 8th Oct 2004 08:42
In the original RE, they used pre-rendered sets and the characters were polygons. In the newer versions, there was a mixture of 3d, but most of the sets were video.

The backgrounds are rendered and then the cam would control the distance and angle that you view. If you think about it, it is like a skybox. The background is unaffected by the motion of the camera. The z-buffering would only come in play for the zombies and characters and other 3d objects that might get between the camera and the main character.

G'day

IDIC (Infinite Diversity Infinite Combinations)
Avan Madisen
22
Years of Service
User Offline
Joined: 12th Sep 2002
Location: The Castle Anthrax
Posted: 11th Oct 2004 02:21
I think you've both misunderstood where I was coming, and from what you've said I've misunderstood how RE was done, but my idea still sits in my mind:

The simplest way to do a RE style game would be to paste the backdrop image onto the screen and then have the 3d render over it every frame.

The problem is it the depth, there's no connection between the 3d and pre-rendered image and that would cause the 3d to be drawn over the image where it shouldn't be. However if you had the z-buffer of the rendered image and you could put that data into the z-buffer before the 3d is drawn, the 3d objects would automatically be clipped around everything.

Alternatively you could paste the image over the 3d using the z-buffer to determine where the 3d is infront of the backdrop and therefore only draw the image where no 3d objects are in front of it.

As far as speed goes it wouldn't much different from having no auto backdrop and pasting an image the size of the screen every frame.

I hope that makes more sense.

Avan

I don't suffer from insanity:
I enjoy every minute of it!
Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 11th Oct 2004 09:13
Avan, to do that;
1. set:
BackDrop Off : Draw To Front : Draw Sprites First
2. Make the "background image" a full-screen sprite
3. Simply paste the sprite once before the main loop, and it'll stay there

Jess.


Team EOD :: Programmer/All-Round Nice Guy
Aust. Convention!
The Wendigo
22
Years of Service
User Offline
Joined: 13th Sep 2002
Location: A hole near the base of a tree in the US
Posted: 11th Oct 2004 14:32
Avan, I understand what you mean. That would be cool if there was a function where you could use pointers to manipulate the backdrop (ie Get ZBuffer Ptr). then you could write data directly to the Z-Buffer. I don't even know enough about DirectX to know if it is even possible to do it, but unless I'm mistaken, the Z-Buffer is just another surface.

Current Projects: Verious things right now. Lots of utils for game making. Hopefully something solid soon.

http://www.geocities.com/djpeterson83
Avan Madisen
22
Years of Service
User Offline
Joined: 12th Sep 2002
Location: The Castle Anthrax
Posted: 13th Oct 2004 06:46 Edited at: 13th Oct 2004 06:50
Wendigo, At least someone understands my strange (dyslexic) way of thinking, and the great thing is it'd be fast as well. The only thing you wouldn't be able to do easily is dynamic lights within the rendered scene. That'd take some interesting tricks, but it's possible!

[edit] I just had another idea, disabling z-write would work well for a skybox, since you want everything draw on top of it. But I guess quite a few people have already thought of that one. I hadn't until now, again Wendigo, thanks for the infomation!

I don't suffer from insanity:
I enjoy every minute of it!
The Wendigo
22
Years of Service
User Offline
Joined: 13th Sep 2002
Location: A hole near the base of a tree in the US
Posted: 13th Oct 2004 20:55
yes and no with the skybox thing. It would depend on if it is the first thing drawn or not. if it is, then that would work really really well, but if it's not, then it would probably still occlude objects. I think, though, that if you call a LOAD OBJECT for your skybox and it is the very first object you load, then that will work, because I think loaded objects get least precedence than other objects (except maybe instanced objects which probably work about the same level). I'd give it a try though.

Current Projects: Verious things right now. Lots of utils for game making. Hopefully something solid soon.

http://www.geocities.com/djpeterson83
TheSquid
21
Years of Service
User Offline
Joined: 29th Sep 2003
Location: Ohio
Posted: 18th Oct 2004 23:13
Let me ask this question...

What is so different between DB Pro and DB Classic? The "blue outlined tree" issue never showed it's ugly face in DB Classic. I have a project which I've compiled in both DBC and DB Pro, Classic showed the trees flawlessly, while Pro has issues. I can put some screenshots together later tonight.

What did DB Classic do that DB Pro can not?
The Wendigo
22
Years of Service
User Offline
Joined: 13th Sep 2002
Location: A hole near the base of a tree in the US
Posted: 19th Oct 2004 09:08
Quote: "What did DB Classic do that DB Pro can not? "


you mean DBP that DBC cannot? Shaders, object specularity, diffuse, true alpha translucency (not just ghosting), true reflections, cube mapping, sphere mapping, as well as some other stuff too (oh yeah, advanced mathmatics with matricese and quaternions (so I've heard)).


Home of DOOP, Strata Works, and Height
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 19th Oct 2004 18:33
Bone based animation, .dll support, memblocks...

In regards to the skybox z-depth, I'm using that very technique, it works well with for me - don't know what'll happen when I have to load another skybox - I'm actually considering switching to a skydome if things go pear shaped.


Van-B


Muhahahahaha.
The Wendigo
22
Years of Service
User Offline
Joined: 13th Sep 2002
Location: A hole near the base of a tree in the US
Posted: 19th Oct 2004 20:17
A sky dome? oh really? Are you doing animated skies or something? cuz if not I would personally stick with boxes whenever possible. Pears? Everytime you say something and after seeing Virtual Holiday it always makes me want to know what your devious mind is conjuring next . (note halloween references... yey!).


Home of DOOP, Strata Works, and Height
TheSquid
21
Years of Service
User Offline
Joined: 29th Sep 2003
Location: Ohio
Posted: 19th Oct 2004 22:50 Edited at: 19th Oct 2004 22:52
Quote: "you mean DBP that DBC cannot?"


No, that wasn't my question at all. My question was, why can DB Classic get the transparency right but DB Pro can not?
The Wendigo
22
Years of Service
User Offline
Joined: 13th Sep 2002
Location: A hole near the base of a tree in the US
Posted: 20th Oct 2004 18:17
Quote: "No, that wasn't my question at all. My question was, why can DB Classic get the transparency right but DB Pro can not? "


This looks like a job for Lee or Mike .


Home of DOOP, Strata Works, and Height
BatVink
Moderator
22
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 21st Oct 2004 23:20
So how do you set the skybox so that everything draws over it? I recall seeing it months ago, but then never could find it again when I needed it.

BatVink
http://biglaugh.co.uk/catalog AMD 3000+ Barton, 512Mb Ram, 120 Gig Drive space, GeForce 5200 FX 128 Mb, Asus A7N8X Mobo.
Terms & Conditions apply
AtomR
22
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Portugal
Posted: 22nd Oct 2004 04:00
So, to sum it up, we don't have z-sort in DBPro. The last update gifted us with what looks like a workaround to the transparency bug that only looks good on trees and bushes. So the big question for me is. Will we ever have z-sort implemented in DBPro? How soon(or not)?

Take care
AtomR
Avan Madisen
22
Years of Service
User Offline
Joined: 12th Sep 2002
Location: The Castle Anthrax
Posted: 22nd Oct 2004 07:49
Thinking about the problem when the transparent objects draw to the z-buffer in places they shouldn't, if you deliberately left rendering all transparent objects 'til last, wouldn't that at least reduce the problems? I've seen the problem of objects behind transparent objects disappearing, Manhunt is riddled with this when rendering trees.

I don't suffer from insanity:

I enjoy every minute of it!
The Wendigo
22
Years of Service
User Offline
Joined: 13th Sep 2002
Location: A hole near the base of a tree in the US
Posted: 22nd Oct 2004 12:44
It probably won't solve the problem, but it would help. Biggest problem with that system for me is every object in my project has some transparency some where on it.


Home of DOOP, Strata Works, and Height
Kevin Picone
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Australia
Posted: 25th Oct 2004 08:20 Edited at: 11th Aug 2010 23:40
Normally scenes with transparent faces are done in two passes.

Solid faces are drawn front to back with Z buffer, to ensure the lowest (per pixel) texel expense. It's less expensive to for texels to be rejected than drawn.

Transparent faces are draw back to front, the best way would be via span buffering the segments so you get the right blending order, but by face would do most of the time.

The Wendigo
22
Years of Service
User Offline
Joined: 13th Sep 2002
Location: A hole near the base of a tree in the US
Posted: 26th Oct 2004 16:16
That sounds like a good method, except, since technology has advanced so much, I'll bet ordering the solids would take longer than just drawing them in any old order. That you could most undoubtably get away with, but as you said, the transparent faces should be in order of back to front. I mentioned in the bug reports a system that I think would work:

Create a function called ADD TO ZSORT and one called REMOVE FROM ZSORT which takes an object reference and adds to a list and removes from a list, respectively. Then every time the SYNC command is called, all objects in the ZSORT buffer are sorted and then rendered AFTER the non Z-Sorted objects are rendered. That way, if you don't want or need to use the ZSort (which you probably won't always) then you don't have to use it, but if you need it, it's there. I don't know how difficult that would be to do, but I think it would be the best way.


Home of DOOP, Strata Works, and Height
Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 26th Oct 2004 20:16 Edited at: 26th Oct 2004 20:18
Would that be possible though?
I thought that the program just handed all the information to DirectX, which did all the sorting, occluding, rendering, etc etc, then handed that to the hardware device for displaying?
Or am I way off-track here?

If it is possible, that sounds like a good idea, although, I would have said that a "Put to front of Zsort" and "Put to back of ZSort" or something like that may have been better than "remove from Zsort"...

Just a though

Jess.


Team EOD :: Programmer/All-Round Nice Guy
Aust. Convention!
The Wendigo
22
Years of Service
User Offline
Joined: 13th Sep 2002
Location: A hole near the base of a tree in the US
Posted: 28th Oct 2004 18:35
With my experience with DX programming (which hasn't been much), it seems they give you the pleasure of doing every intricacy (minus stuff like do-it-yourself polygon blitting... ACK!). There are helper functions, but it's best to write your own code. I don't know for sure, but I think you are thinking of OpenGL. I heard it takes care of stuff like that for you (which ofcourse would cause a few problems in itself). I heard OpenGL is probably easier to program in, but when that is the case, that generally means less functionality. DBP itself, is a perfect example of that. Awesome program, but you can't really affect how things work in the background much (ie ZSorting). And just to let everyone know I'm not ranting about DB limmitations, every package has its pros and cons, and the reason I chose DBP was because its limmitations are far less than other packages promising the same power and ease. It's at least the best darn hobbiest package on the market, but I believe it could shoot out more professional grade programs. Just have to have the time and care is all .


Home of DOOP, Strata Works, and Height
Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 30th Oct 2004 13:37
Alrighty

I've never programmed in DirectX, nor OpenGL, so my knowledge is limited, I was just going off of what little i know on the subjects

Jess.


Team EOD :: Programmer/All-Round Nice Guy
Aust. Convention!
Chris K
21
Years of Service
User Offline
Joined: 7th Oct 2003
Location: Lake Hylia
Posted: 31st Oct 2004 01:34
Is there anyway of finding the Z Depth of a pixel in DBpro? Is there a pointer to the Z-Buffer?

The Wendigo
22
Years of Service
User Offline
Joined: 13th Sep 2002
Location: A hole near the base of a tree in the US
Posted: 10th Nov 2004 05:47
Not that I have found, but I've been looking. I don't think there is. That would be a really nice modification, though, wouldn't it .


Home of DOOP, Strata Works, and Height
Chris K
21
Years of Service
User Offline
Joined: 7th Oct 2003
Location: Lake Hylia
Posted: 10th Nov 2004 06:19
Damn that would be useful.

Does the z buffer contain actual distances from the camera or relative distances.

ie. does the closest pixel get given '1' then they count up from there.
Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 10th Nov 2004 07:51
I'm not too good at these things ( as I said before ), but is not the BackBuffer what you are talking about?

Although, without specific information on exactly what it is ( ie, not in the help files... surprise, surprise ), it's hard to say if this is what you need...

But, either way, have a look in the Display command set at the BackBuffer commands.

Jess.


Team EOD :: Programmer/All-Round Nice Guy
Aust. Convention!
Chris K
21
Years of Service
User Offline
Joined: 7th Oct 2003
Location: Lake Hylia
Posted: 10th Nov 2004 16:06
Nah, the backbuffer contains all the info about the colour of the pixel and the x & y positions, not the z position of it.
Kevin Picone
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Australia
Posted: 10th Nov 2004 22:31
The Zbuffer contains the distance from a pixel on the camera surface to this point in space (a texel). This is post transformation, so you can use the screen coords to get the distance from the a point on the camera, to a point after rendering. The bigger the value, the more distant the point is.

Kevin Picone
[url]www.underwaredesign.com[/url]
Play Nice! Play Basic - Next generation 2D Basic (Release V1.00 Out Now)
Chris K
21
Years of Service
User Offline
Joined: 7th Oct 2003
Location: Lake Hylia
Posted: 10th Nov 2004 23:34
Yeah but does it give the actual distance from the camera?
Kevin Picone
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Australia
Posted: 10th Nov 2004 23:53
erm, obviously. Which is what i just said.

Kevin Picone
[url]www.underwaredesign.com[/url]
Play Nice! Play Basic - Next generation 2D Basic (Release V1.00 Out Now)
Chris K
21
Years of Service
User Offline
Joined: 7th Oct 2003
Location: Lake Hylia
Posted: 11th Nov 2004 00:10
I just thought it might give it a number starting from 1 each time, like 1 means this is the 1st pixel from the camera, 2 mens this is the second pixel from the camera etc.

Login to post a reply

Server time is: 2025-05-29 06:02:47
Your offset time is: 2025-05-29 06:02:47