Sign in to follow this  

Is this a MIPMapping problem?

This topic is 4593 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm using DirectX9 to render my latest game engine. I'm exporting .x files from 3DSmax7 with the latest Quest plugin. I'm not doing anything weird... just rendering the images on screen with a standard Z-Buffer (16FMT AutoDepthStencil). I'm drawing my models for my map from a simple 2D array; they are being drawn to the screen row by row, starting in at the origin, in the bottom left hand corner from where my camera is at. I'm not sure if this is a simple MIPmapping issue (and if it is, how can I go about resolving it?), or something more serious... but as you can tell from the 3 screenshots below, I'm getting some WEIRD texturing issues when the camera is x amount of distance away from certain models. Take the light fixture on the back wall, for example. If you look at the closest zoomed screenshot, you can see what it SHOULD look like. The furthest two, however, completely distort the model-- even to the point where the actual "bulb" part of the lamp isn't drawn at all. Anyone had any experience with this? Any red lights going off? Closest Zoom Medium Zoom Furthest Zoom -dbh Edited by Coder: There are people on dialup, so please don't inline large images [smile] [Edited by - Coder on May 15, 2005 12:10:46 PM]

Share this post


Link to post
Share on other sites
You'll also notice at the farthest zoom some issues where you can see my 64x64 wall tiles (3D, but still tiles) are not meshing perfectly together. At a closer zoom they fit perfectly (and they are aligned perfectly)-- but some light gets through them as you zoom further away, showing the textures on the SIDE of the wall model where you shouldn't be able to see at all.

I think the problems are related...?

-dbh

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
i've fixed tile seams by cheating just a pinch (overlapping a tiny bit).
is mipmapping enabled? if so, i think your texture for the bulb needs to be a power of two to mipmap correctly.

is there a reason you can't render the floor as a single mesh? are u doing that already? (i'm sure u know that calling drawprim 300 times to render that floor isn't gonna be super efficient). a single mesh would cure the seam problem.

Share this post


Link to post
Share on other sites
I'm trying to keep the engine purely tile-based for gameplay reasons-- otherwise I'd be looking into a single mesh.

I've also tried overlapping, but I still have these exact same graphics issues.

At the moment, MIP is disabled entirely. That's why I was wondering if I should turn it on; and if I do turn it on, what settings would be optimal for graphics quality?

Oh, also, I am using strictly power of 2 textures.

Thanks for the suggestions so far!

-dbh

Share this post


Link to post
Share on other sites
Quote:
Original post by dbh
I'm trying to keep the engine purely tile-based for gameplay reasons-- otherwise I'd be looking into a single mesh.
-dbh

The bulb problem and the seem problems are both z-buffer issues. You can fix the tile problem pretty easily. The bulb may need reworked.

Basically, each vertex on the side of a tile needs to be in the exact same position as the one in the tile beside it. If they share the exact same coordinates, they will act as a single object, and you won't notice any problems with distance.

The light bulb obviously can't share the same coordinates as the wall behind it, so you'll have to change it, or treat it as a decal. There are several methods to stop the z-buffer from fighting. Stencils, disabling the z-buffer for the bulb, or even changing the near/far planes on your camera to render the bulb.

But if this will be a rare situation for you, I would simply move the bulb out farther from the wall.

Share this post


Link to post
Share on other sites
Ah.. I just realised how severe the problem really is. You need to turn the near plane distance up on your camera. The more distance your z-buffer needs to cover, the less accurate things are going to be at medium distance. If your near plane distance is set at 0-5, for example, try turning it up to 15 or 20, if not just to see the difference.

Share this post


Link to post
Share on other sites
I'll try that first thing in the morning, Jiia - it makes sense.

At the moment, my near is at 1.0f and my far is at (as I remember) 2000.0f.

Is that an unreasonable distance to cover?

-dbh

Share this post


Link to post
Share on other sites
Well, it's less about the distance and more about the accuracy. Things that are closer use up more of the z-buffer's precision. So turning your near plane up by 1 is probably giving you more precision than turning down your far plane by 100. The only downside to turning up your near plane is that things get clipped when they are extremely close. I have mine set at 20. In my game, that's 20 inches things need to be away from the camera to be visible. But my z buffer is incredibly accurate at long range.

Share this post


Link to post
Share on other sites
Definetly z fighting... depending on your z check (less than, less than or equal?) you could just draw stuff in a different order and fix the problems, or do what was suggested. Since this looks to be more of a top-down type view, stuff should never get to close to the camera, so try changing your near to something like 5 and see how it works (this really depends on your scale as well).

Share this post


Link to post
Share on other sites
...

I'm disgusted. I've had this problem for weeks but figured I'd eventually figure it out. I thought it was z-buffer related, or render order... but I didn't know about the accuracy issues involved with the camera viewplanes. It makes sense though!

Anyway, needless to say, that fixed it. It looks 1000000% better now; I'm just thrilled. Thanks for your help and explanations of the issue, you have all made my weekend!

-dbh

Note: Thanks for linking my images-- I should have done that myself.

Share this post


Link to post
Share on other sites

This topic is 4593 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this