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 / Flickering Planes....Again

Author
Message
GrumpyOne
18
Years of Service
User Offline
Joined: 27th Nov 2007
Location: London, UK
Posted: 10th Jun 2010 02:42
There have been a few posts on this...but never a convincing answer that seems to work.

I'm trying to get a plane to render properly over advanced terrain and I have the dreaded plane zdepth flicker. The render engine can't decide whether to plot the terrain or the plane on top, and so does the worst possible thing, draws parallel strips of both and changes its mind everytime the camera is moved.

I've tried adjusting the camera range near value, no difference. I've tried creating a plane through "make object plain" and as an x object (with several different numbers of polygons). It makes no difference. It doesn't matter whether the plane is transparent or not. I've tried enable zbias with numerous combinations of slope and depth, I've tried disable zdepth....no dice. The plane is not rescaled.

Anyway any suggestions are welcome. I'm rather worried this might be a show stopper...and I really, really don't want to have to start again in XNA...too many matrices and that awful content pipeline.

GrumpyOne - the natural state of the programmer
Kira Vakaan
17
Years of Service
User Offline
Joined: 1st Dec 2008
Location: MI, United States
Posted: 10th Jun 2010 03:00
What have you tried adjusting the camera's near value to? I mean, the default far value is 3000, and if you don't need that much room, you could bring it much closer and push the near value out to sandwich whatever's in the scene. This should give you a much higher Z resolution and might fix your problem.

Sixty Squares
20
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 10th Jun 2010 03:23
I have no idea if this would work, but have you tried using DISABLE OBJECT ZWRITE on the plain?
GrumpyOne
18
Years of Service
User Offline
Joined: 27th Nov 2007
Location: London, UK
Posted: 10th Jun 2010 03:25
Yep, that worked. Good suggestion. Many thanks.

GrumpyOne - the natural state of the programmer
GrumpyOne
18
Years of Service
User Offline
Joined: 27th Nov 2007
Location: London, UK
Posted: 10th Jun 2010 03:26
It was changing the far value that worked...for anyone else reading this.

GrumpyOne - the natural state of the programmer
Kira Vakaan
17
Years of Service
User Offline
Joined: 1st Dec 2008
Location: MI, United States
Posted: 10th Jun 2010 03:27 Edited at: 10th Jun 2010 03:29
Nah, I can't imagine that would work. The only two outcomes that could have would either be that the terrain is drawn completely over the plane, or that the plane is drawn exactly as it is now, depending on which gets drawn first.

Edit: Oops, missed your posts. I was talking about disable object zwrite just now. I'm glad the near/far values worked out though

Mobiius
Valued Member
23
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 10th Jun 2010 09:24
You could have increased the number of polygons in the plain without increasing the near/far values.

My signature is NOT a moderator plaything! Stop changing it!
Kira Vakaan
17
Years of Service
User Offline
Joined: 1st Dec 2008
Location: MI, United States
Posted: 10th Jun 2010 09:29
I'm not sure how that would've helped, as the problem was that the view frustum was too deep. The difference in Z depths of the terrain and the plane was small enough compared to the depth of the frustum that it caused Z fighting issues.

Diggsey
20
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 10th Jun 2010 13:04
Increasing the near value has a much greater affect than decreasing the far value btw

Kira Vakaan
17
Years of Service
User Offline
Joined: 1st Dec 2008
Location: MI, United States
Posted: 10th Jun 2010 20:34
Why is that? Wouldn't it be as effective to decrease the far value in situations where the scene is close to the camera?

Madscientist
16
Years of Service
User Offline
Joined: 23rd Aug 2009
Location: Between a rock and a hard place
Posted: 12th Jun 2010 06:06
Im having this problem for a ghosted level object for a lightmap overtop of my regular level. Any ideas?

If it hasn't exploded yet, I haven't touched it.
Kira Vakaan
17
Years of Service
User Offline
Joined: 1st Dec 2008
Location: MI, United States
Posted: 12th Jun 2010 17:53
Are they positioned in the same place? How do you mean "overtop"?

Madscientist
16
Years of Service
User Offline
Joined: 23rd Aug 2009
Location: Between a rock and a hard place
Posted: 12th Jun 2010 19:44
Yes they are the same size and position, one is just textured with a lightmap texture. I ghosted the lightmap one with the negative alpha flag to 1. I've done this before and it has worked but for some reason it's not working.

If it hasn't exploded yet, I haven't touched it.
Kira Vakaan
17
Years of Service
User Offline
Joined: 1st Dec 2008
Location: MI, United States
Posted: 12th Jun 2010 20:07
Well if they're the same size and position, it makes sense that you're getting z-fighting issues, as the renderer is trying to draw them both in the same place. Try positioning the lightmapped object a fraction of a unit above the other.

Madscientist
16
Years of Service
User Offline
Joined: 23rd Aug 2009
Location: Between a rock and a hard place
Posted: 12th Jun 2010 20:23 Edited at: 12th Jun 2010 20:24
But howcome i have done this before and had it work?
(see screenshot)

If it hasn't exploded yet, I haven't touched it.
Diggsey
20
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 12th Jun 2010 20:42
@Kira Vakaan
The depths are not divided up linearly, positions near the camera have very small gaps between possible depth values, and positions further away have very large gaps.

In the nearest half unit there might be 1,000 depth values that you don't need. At the furthest 10 units there might be 10.

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

Login to post a reply

Server time is: 2026-07-25 16:22:06
Your offset time is: 2026-07-25 16:22:06