EntityOrder > 0 ignores existing ZBuffer

Archives Forums/Blitz3D Bug Reports/EntityOrder > 0 ignores existing ZBuffer

BIG BUG(Posted 2008) [#1]
First of all, I'm aware that EntityOrder can't set any z-values in order to work properly and EntityOrder < 0 has to ignore existing z-values for the very same reason.

BUT,
when you want to draw something behind your scene, z-values should be evaluated.
Due to the order of drawing this matters only when rendering multiple times without clearing your z-buffer (CameraCLSMode 0,0), but then it's very annoying, because of this you just can't use this command in later rendering passes.

For example, a skybox would simply redraw all your scene from the earlier passes.


Ross C(Posted 2008) [#2]
Maybe not getting what your saying, but you can hide entities between renders.


big10p(Posted 2008) [#3]
Same - no idea what you're getting at.

You realize that setting an EntityOrder disables z-buffering for that entity, right?


BIG BUG(Posted 2008) [#4]
Ok, I made an example showing the problem:




big10p(Posted 2008) [#5]
OK, I've had a couple of beers but that code behaves exactly as I would expect. As I said, setting an EntityOrder of anything other that 0 causes that entity to be rendered without consulting the z-buffer. Thus the entire entity (skybox) is rendered, obscuring the sphere.

If it were to consult the z-buffer, that would make setting an EntityOrder pointless, since the entity would be rendered according to the z-buffer and would be no different from not setting an EntityOrder at all.


BIG BUG(Posted 2008) [#6]
This is what EntityOrder lower than 0 is for. In my opinion EntityOrder greater than 0 should consult the z-buffer.


Who was John Galt?(Posted 2008) [#7]
If you're of the opinion that a command should work differently to the way it does work and the same way it is stated to work in the manual, it's not a bug. I guess it's a feature request.


Zethrax(Posted 2008) [#8]
If you want to create a skybox, then I suggest you look at the castle demo ( C:\Program Files\Blitz3D\Samples\Blitz 3D Samples\mak\castle ) to see how it's done.


BIG BUG(Posted 2008) [#9]
Thank you, but I know how to set up a skybox, believe me.

I guess only BlitzResearch themself can tell if it's a bug or a missing feature, because they know how they wanted it to work.


Ross C(Posted 2008) [#10]
The way i see it. Everything normally is set to the same entityorder, thus consulting the z-buffer.

I mean, if you set everything to entityorder 4, then it will consult the z-buffer. Set everything some things to entityorder 3 and some to entity order 0, the 0 entities will be rendered infront of the 3, but in the order of the 0 entities place in the z-buffer.

I'm not sure if entities all are preset to a certain entityorder, i'd imagine they would be. So going on that theory, i'd say that entityorder < 0 would be rendered first, entityorder > 0 would be rendered last.


skidracer(Posted 2008) [#11]
I guess only BlitzResearch themself can tell if it's a bug or a missing feature, because they know how they wanted it to work.


Or you could refer to the docs...


Ross C(Posted 2008) [#12]
Yeah! I got it right :o) Would have been easier to look at the docs i suppose...


BIG BUG(Posted 2008) [#13]
First of all this hint about z-buffering isn't very detailed and would also be correct if EntityOrder > 0 was consulting the z-buffer.
And for second it doesn't really matter if it's a problem with the design or a bug in the programming of this command. It's still an annoying behaviour.


Ross C(Posted 2008) [#14]
I don't really see your issue. If you want the object to be rendered behind everything, you set a minus entity order. If you want it rendered in front of everything, then you would set an entityorder > 0.


skidracer(Posted 2008) [#15]
The issue is only skyboxes and huds can be drawn, without zbuffer support any model with overlapping parts will not render correctly.

The solution although not documented well is to use a more complicated multi-pass rendering system where the zbuffer but not the rgb-backbuffer are cleared between passes, and all objects are parented off either a near medium or far pivot entities that can be shown/hidden to perform the trick.


BIG BUG(Posted 2008) [#16]
I don't really see your issue. If you want the object to be rendered behind everything...

Thats exactly my issue. It's not possible to render an object behind "everything" across more than one render pass.

What I want to do in special:
1. Render Pass: Render specified objects, hide all other.
2. Render Pass: Apply some "special effects" via blend mode add & multiply
3. Render Pass: Render rest of world including skybox the normal way.

In result my effect is only applied to the objects from the first pass, which would work fine if my skybox just wasn't redrawing all that stuff from the earlier passes :-(

So the only thing I can do is to forget about EntityOrder and scale my skybox really huge to ensure it will be drawn behind all other objects anyway.
Hopefully I will not run into any problems with CameraRange then...

It could be so easy without this EntityOrder bug. Grmbl.


Ross C(Posted 2008) [#17]
So, setting the sky box to entityorder -999 doesn't render the skybox behind everything? Are you sure? Make sure you AREN'T clearing the z-buffer between renders. You can set this up in cameraclsmode()


BIG BUG(Posted 2008) [#18]
Actually it's a positive EntityOrder that is used to draw behind other objects(I mixed it up myself in the previous post), but yes, it will redraw stuff from earlier renders as seen in my example above.
CameraCLSMode is set to 0,0, so the z-buffer isn't cleared.


Stevie G(Posted 2008) [#19]
I don't get you either. Surely you should be rendering the skybox in the first pass anyway?

1. set skybox to order > 0. Show skybox and non-specified objects. Hide specifed objects + effects. render normally.

2. Hide skybox & non-specified objects. Show specificed objects. render with cameraclsmode 0,1

3. hide specified objects. Apply special effects. render with cameraclsmode 0,1

I forget the order of the 0,1 for the last two renders so if it doesn't work swap them.

Other than that I guess there's something I'm missing? What effects are you applying exactly? Oh and ask the question in the beginner forumn and you'll get a better response. This is not a bug - it's completely logical imo.


BIG BUG(Posted 2008) [#20]
You're indeed not getting me. I'm not asking for help, I'm just reporting this issue.

It's easy to say that command works right, if one hasn't run into that problem.
In my opinion it's not logical as seen in discussion above.
And I'm definitly not new to BlitzBasic or software engineering in general.


Rob Farley(Posted 2008) [#21]
1. Render Pass: Render specified objects, hide all other.
2. Render Pass: Apply some "special effects" via blend mode add & multiply
3. Render Pass: Render rest of world including skybox the normal way.
Unfortunately it doesn't work this way. The skybox will act as a cls to everything that has occurred before it.

The only solution to you problem would be to render the skybox in your first pass, but this, as you well know will add the effects to the skybox also.

This is the way it works, I would suspect with where blitz is in it's development lifecycle any additional features are unlikely to be added.


BIG BUG(Posted 2008) [#22]
I'm with you, I don't expect this to be changed either.

But maybe this report will prevent other third-party-engine developer from making the same mistake...


Rob Farley(Posted 2008) [#23]
You've not mentioned what your 'special effects' are, but generally this sort of thing is provided with a shader, which, as we know, isn't available in DX7 and therefore not available in Blitz3D natively.

If a shader could be used this would bypass this probably as you'd do the whole shebang in one render.