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 / Enable Object zBias - Might not be supported by all hardware out there

Author
Message
CuCuMBeR
22
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 5th Feb 2008 12:59 Edited at: 5th Feb 2008 13:04
Related to this post:
http://forum.thegamecreators.com/?m=forum_view&t=123291&b=6&p=0

Some people complain that enabling zBias doesnt work as it should by their hardware.

And as this is a more commonly used board i thought ill have some more people to test this thing and see if it works for most of you or not.

Could you please download the project from the link below(small file) and tell me if it works as it should?

http://forumfiles.thegamecreators.com/?i=1420073

And this is a photo, about how it should look like:


chapel should be always visible.
you should see the lightnings behind the chappel all the time
and finally you should see skysphere behind chapel and lightnings

There is always one more imbecile than you counted on.
Kendor
22
Years of Service
User Offline
Joined: 31st Jan 2003
Location: Malta
Posted: 5th Feb 2008 16:00 Edited at: 5th Feb 2008 16:01
I can see neither the sky nor the lightning
ZBUFFER AVAILABLE() returns 1
Graphics card: Geforce 6200

Screenshot:


Theory is when you know something, but it doesn't work. Practice is when something works, but you don't know why.
Programmers combine theory and practice: Nothing works and they don't know why.
CuCuMBeR
22
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 5th Feb 2008 16:22 Edited at: 5th Feb 2008 16:26
Kendor:
Could you please try this code too?
And also try moving around with the mouse, just go backwards and see if anythin changes

EDIT: do you atleast see the lightning effecting the chapel object?



There is always one more imbecile than you counted on.
wh1sp3r
21
Years of Service
User Offline
Joined: 28th Sep 2003
Location: Czech republic
Posted: 5th Feb 2008 16:25
CuCuMBeR : Same problem


PS: Real programmers aren't afraid of math!.
CuCuMBeR
22
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 5th Feb 2008 16:31
This is really bad news then, enabling zbias works like setting sprite priority, i mean you can give different depths to co-planar objects(which are at the same position), doesnt even matter if they are at the same position or not anyways.

Well, i had my own shadowing technique depending on this zBias, but real bad news comin from you guys.

Hope it will work for someone and we can maybe find what the reason is that its not working for you

There is always one more imbecile than you counted on.
wh1sp3r
21
Years of Service
User Offline
Joined: 28th Sep 2003
Location: Czech republic
Posted: 5th Feb 2008 16:35
CuCuMBeR :I know, when something doesnt work ... Look at me and my "effect problem" Its really frustrating ...


PS: Real programmers aren't afraid of math!.
spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 5th Feb 2008 16:38
Brand new Geforce 8800GT

No sky or lightning. Same as Kendor.

Is command being used correctly? Maybe it's working on your machine is a bit of luck. Seems to be all other users with run of the mill cards does not work as you expected.

Good luck on getting it sorted.

Boo!
Kendor
22
Years of Service
User Offline
Joined: 31st Jan 2003
Location: Malta
Posted: 5th Feb 2008 17:02
Unfortunately, same result as the old code and moving around does not change anything. Regarding the lightning effect on the chapel, it worked correctly on both.

Should check whether it is an Nvidia/ATI thing, since those reporting not seeing the sky have an Nvidia, while yours is working on an ATI card.

Theory is when you know something, but it doesn't work. Practice is when something works, but you don't know why.
Programmers combine theory and practice: Nothing works and they don't know why.
CuCuMBeR
22
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 5th Feb 2008 17:04 Edited at: 5th Feb 2008 17:05
Spooky:

For the correct usage, i follow what the help file says:
Quote: "ENABLE OBJECT ZBIAS Object Number, Slope Scale, Depth"


object number is obvious,
Depth is a number between 0-16 (16 is the greatest distance, 0 is the closest)
Slope Scale is described in DxSDK as follows:
Quote: "Offset = m * D3DRS_SLOPESCALEDEPTHBIAS + D3DRS_DEPTHBIAS
where m is the maximum depth slope of the triangle being rendered.
m = max(abs(delta z / delta x), abs(delta z / delta y)) "


where i suppose m is the slope scale (angle)

With the above information, it all works great on my machine.

maybe im wrong with the slope scale thing but then i wonder why it works for me..

any suggestions?

There is always one more imbecile than you counted on.
wh1sp3r
21
Years of Service
User Offline
Joined: 28th Sep 2003
Location: Czech republic
Posted: 5th Feb 2008 17:07
CuCuMBeR : btw: I have nvidia card .. perhaps, on ATI card your code works I dont know Iam going to test it on notebook, there is the ATI card.


PS: Real programmers aren't afraid of math!.
chunks chunks
18
Years of Service
User Offline
Joined: 2nd Jan 2007
Location: ackworth uk
Posted: 5th Feb 2008 17:16
ive tried it seems to be an nvidia problem..

i disabled the object zbias and the lightning appers but the chapel objects distorted and disapears when you move away


nvidia go 7300 256 mb
wh1sp3r
21
Years of Service
User Offline
Joined: 28th Sep 2003
Location: Czech republic
Posted: 5th Feb 2008 17:17
CuCuMBeR : Results: On my laptop with ATI card you demo work correctly !


PS: Real programmers aren't afraid of math!.
Toz
17
Years of Service
User Offline
Joined: 14th Oct 2007
Location: The Netherlands
Posted: 5th Feb 2008 18:14
@Cucumber

I tried changing the depth values of the zbias command a bit but nothing seems to change. The chapel still doesn't appear. Like wh1sp3r I also have a laptop with an ATI card in it (Mobility x1600). Judging from other peoples results I don't think it has anything to do with a card being from ATI of nVIDIA.

Don't read this, read the above.
Roxas
19
Years of Service
User Offline
Joined: 11th Nov 2005
Location: http://forum.thegamecreators.com
Posted: 5th Feb 2008 18:26
I have ATi and it works


Click For Details!
CuCuMBeR
22
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 5th Feb 2008 18:36 Edited at: 5th Feb 2008 18:39
Okay after googling about this issue, i came across the OGRE forum with the same problem, guys over there think it is somethin to do with the poor documentation of dxSDK

according to their solution, the below should work for any card which supports zbuffering, please try this one:



EDIT: and another solution is;



could you try both above and see if any one works?

There is always one more imbecile than you counted on.
fik
20
Years of Service
User Offline
Joined: 28th Sep 2004
Location:
Posted: 5th Feb 2008 18:56 Edited at: 5th Feb 2008 19:24
Never mind just noticed my card the same as Kendor's
Toz
17
Years of Service
User Offline
Joined: 14th Oct 2007
Location: The Netherlands
Posted: 5th Feb 2008 19:10 Edited at: 5th Feb 2008 19:11
Neither of the solutions worked at first but when I changed the zbias for the chapel from:

Enable Object zBias 11, 0.0001, 3

to

Enable Object zBias 11, 0.0001, 1

.....and it works!!!

Anyway I think this works for everybody:



Don't read this, read the above.
CuCuMBeR
22
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 5th Feb 2008 19:28 Edited at: 5th Feb 2008 19:31
EDIT:
@Toz i just noticed your post
Quote: "Enable Object zBias 11, 0.0001, 1
.....and it works!!! "


It may work on yours but now i see the lightnings infront of the Chapel object which it should always be seen behind it, so it doesnt work for me.


Okay i give up.

So we should better put a warning on our programs/games which use zBias will not properly work on Nvidia cards and surely no guarantee that they will work on ATI either.

Nice

There is always one more imbecile than you counted on.
spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 5th Feb 2008 19:33
Both of CucuMBeR's new versions didn't work and also Toz's solution didn't work for me.

Boo!
Kendor
22
Years of Service
User Offline
Joined: 31st Jan 2003
Location: Malta
Posted: 5th Feb 2008 19:39
Found this somewhat old article (2002) on the subject:

Quote: "
Why ZBIAS is not a good thing

ZBIAS looks great at first sight. It's a little tweak to your Z values and stops Z-fighting when things are coplanar but don't actually share vertices (e.g. posters stuck on walls). However, it's a problem. The problem is that the actual behaviour of ZBIAS is not well defined. The number you feed in has no absolute meaning - each card is free to interpret it any way it likes. So a ZBIAS of 3 may work in a particular scene on card A. Card B only need a ZBIAS of 1 to work. However, card C still Z-fights, so you need to increase the number to 7. OK, so you set it to be 7 on everything. Except now that's far too high for card B, and now when a person walks past the poster on the wall, the poster is drawn in front of the person! Argh. This is not a mythical example, this actually happens on two very common cards - the value that works for one is far too high for the other, and vice versa.

For this reason, many cards simply do not support ZBIAS. This is actually a Good Thing

The safest option is not to use ZBIAS. The easy alternative is to push your near and far clip planes away from the camera a bit when rendering things that need biasing towards the camera. This will not change where on the screen the points are rendered, it will simply move those objects slightly nearer the camera in the Z buffer. The advantage of this method is that it works the same way on all cards, and the same bias works consistently (within a small factor because of slightly variable Z-precision). It is not very expensive to change the projection matrix (no more than any other matrix change), and if you store two projection matrices (one biased, one normal) every time the viewpoint changes (which isn't very often), then there's no recalculation needed, you just send the correct matrix to the card.

ZBIAS is not implemented at all the same on each card, and is not support by some. Moving clip planes does, and is."


It seems that different cards implement zbias differently, if at all. Probably better use another method.

Theory is when you know something, but it doesn't work. Practice is when something works, but you don't know why.
Programmers combine theory and practice: Nothing works and they don't know why.
CuCuMBeR
22
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 5th Feb 2008 19:48
Okay one last try, this seem to be working on both nvidia and ati i tried on both, please tell if it does work for you too:



There is always one more imbecile than you counted on.
Kendor
22
Years of Service
User Offline
Joined: 31st Jan 2003
Location: Malta
Posted: 5th Feb 2008 20:05 Edited at: 5th Feb 2008 20:06
Still doesn't work correctly, but at certain angles a part of the sky can be seen:



Theory is when you know something, but it doesn't work. Practice is when something works, but you don't know why.
Programmers combine theory and practice: Nothing works and they don't know why.
Toz
17
Years of Service
User Offline
Joined: 14th Oct 2007
Location: The Netherlands
Posted: 5th Feb 2008 20:15
The last one works perfectly for me, to bad it doesn't work for Kendor...

Don't read this, read the above.
CuCuMBeR
22
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 5th Feb 2008 20:18
duh, okay i give up now.
Thanks for your time guys.

There is always one more imbecile than you counted on.
NeX the Fairly Fast Ferret
20
Years of Service
User Offline
Joined: 10th Apr 2005
Location: The Fifth Plane of Oblivion
Posted: 5th Feb 2008 20:23
I'm using Zbias for sprite ordering in my game... it works fine on my nVidia 6200, the 6300 downstairs, the 7200 in my Dad's laptop, the rubbish ATi in my stepmother's PC...

I can't get the slope scale to work though.

spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 5th Feb 2008 20:30
I get same as Kendor where certain angles reveals one of the spheres polygons.

Boo!
Kendor
22
Years of Service
User Offline
Joined: 31st Jan 2003
Location: Malta
Posted: 5th Feb 2008 20:43 Edited at: 5th Feb 2008 20:43
Managed to obtain the sky and the lightning (although in front of the chapel). I had to multiply the maxRange# by 0.01 for it to appear, which makes it unusable, as the sky sphere will overlap the chapel.





Theory is when you know something, but it doesn't work. Practice is when something works, but you don't know why.
Programmers combine theory and practice: Nothing works and they don't know why.
CuCuMBeR
22
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 5th Feb 2008 20:49

this one??

There is always one more imbecile than you counted on.
Kendor
22
Years of Service
User Offline
Joined: 31st Jan 2003
Location: Malta
Posted: 5th Feb 2008 21:33 Edited at: 5th Feb 2008 21:33
Nope.

Try this code, and see whether it works. I've removed the zbias from the sphere and lightning, while disabling the zdepth of the chapel. The effect should be similar although its not good for actual in-game use.



Theory is when you know something, but it doesn't work. Practice is when something works, but you don't know why.
Programmers combine theory and practice: Nothing works and they don't know why.
CuCuMBeR
22
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 5th Feb 2008 21:45
okay just never mind, this is useless.

There is always one more imbecile than you counted on.
JulesD
20
Years of Service
User Offline
Joined: 7th Feb 2005
Location:
Posted: 15th Apr 2008 10:53 Edited at: 15th Apr 2008 11:05
I think I just figured it out took 10 minutes though.For nvidia

enable zbias object,1,number from -0.9999 to 0

ex -0.9999
0 is the farthest back.
You'll probably want to set your zbias for skyobject to 0

Login to post a reply

Server time is: 2025-08-09 01:37:26
Your offset time is: 2025-08-09 01:37:26