Archived

This topic is now archived and is closed to further replies.

Erzengeldeslichtes

Odd drawing problem...

Recommended Posts

I don''t know how to describe this problem. I have a cruddy space ship that I threw together in 3d studio, converted to a .x, and put it into my engine for testing the engine''s movement of objects. On the object is a half-sphere that uses 8 segments. When if first renders you can barely see the sphere. As it moves further away, it suddenly appears in fully, then as it moves it will sweep to nothing, jump to full, sweep to nothing, jump to full, etc. I''m getting the effect on both my laptop (2.4ghz, radeon mobility {aka radeon 7000}) and my PC (1.0ghz, Geforce FX 5600), so here is the program if you want to see the effect. (Spacebar: Move forward, Left & Right: rotate along y axis) Any ideas what could cause such an odd effect?

Share this post


Link to post
Share on other sites
I tried it. It looks like z-fighting, like you''ve got coplanar polys.

The .x file looks OK in Mesh viewer. So, my guess is something''s up with your mesh rendering code. Do you have depth sorting enabled? Is your depth buffer of reasonable length? Have you tried collapsing all D3D states down to the bare minimum? (Disable alpha blending, etc.)

I''d suggest checking out the mesh loader/viewer code that comes with the SDK and compare it against your own code.

---
http://www.gapingwolf.com

Share this post


Link to post
Share on other sites
I agree it looks like z fighting. What are the near and far plane values in your projection matrix set to?

Neil

WHATCHA GONNA DO WHEN THE LARGEST ARMS IN THE WORLD RUN WILD ON YOU?!?!

Share this post


Link to post
Share on other sites
Coplanar faces: I don't see multiple faces of the same face in my 3d file, and as you said, it looks right in mesh viewer.

Z Depth sorting: I have D3DRS_ZENABLE set to D3DZB_TRUE, but I haven't explicitly set a depth buffer.

Near and Far planes: 1 unit near, 100000 units far

I'll take a look at the source for model view, although I have found the sdk program source difficult to follow...

[edited by - Erzengeldeslichtes on October 7, 2003 8:57:44 PM]

Share this post


Link to post
Share on other sites
I am clearing the z buffer, and I lowered the far clipping plane to 1000.0f (and tried at 500.0f), and it's still doing the 'z fighting.' The only difference I see is that things start to disappear faster (and at 500 I can hardly see the effect because the ship vanishes quickly).

Edit: I'm preparing a version so that you can test it out for yourself if you want...

Edit 2: If you want that version, download from the link above, and when you run engine.exe add the argument "\clip" and enter a number after that. The number may be an int or float, and you can put it right after clip or you can put a space after clip and before the number.

Edit 3: Hrm, I just took a look at the .x in the the Mesh Viewer, and noticed the cockpit, the part that's 'z fighting', is extremely tiny compaired to what I designed in 3d studio. While it doesn't z fight, it is tiny. I wonder why...?

Edit 4: (I'm just full of edits aren't I?) I repaired the small size, however, it still z fights, just (arguably) not as noticably. You can see it at the edges, but at least you can always see the cockpit now. You can get the update by downloading it again.

Edit 5: You know, it doesn't look like z fighting to me. It looks more like the objects get smaller until they are drawn in a certain spot on the projection matrix it jumps to a larger size, which then shrinks and when it hits the next spot jumps to the larger size, etc...

[edited by - Erzengeldeslichtes on October 7, 2003 11:58:54 PM]

[edited by - Erzengeldeslichtes on October 7, 2003 12:33:06 AM]

[edited by - Erzengeldeslichtes on October 7, 2003 12:58:39 AM]

[edited by - Erzengeldeslichtes on October 8, 2003 1:18:39 AM]

[edited by - Erzengeldeslichtes on October 8, 2003 1:52:17 AM]

Share this post


Link to post
Share on other sites
How is your Z Buffer set up? For that sort of issue, I would try using a 32bit zbuffer (or on your card a D24S8).

Neil

WHATCHA GONNA DO WHEN THE LARGEST ARMS IN THE WORLD RUN WILD ON YOU?!?!

Share this post


Link to post
Share on other sites
Running a binary doesn''t tell me that much about your code. If you don''t want to post any "secret tidbits" then simply give us the sections where you initialize DX and setup your render view.

---
http://www.gapingwolf.com

Share this post


Link to post
Share on other sites