Results 1 to 4 of 4

Thread: Weird rendering of a mesh

  1. #1

    Weird rendering of a mesh

    Hi:

    I create a Mesh from scratch (thanks Clootie for the link), namely a fractal world. It's very basic mesh : a grid (x,y coordinates), with a different height (z) for each point, and then 2 triangles to render each quad. I kept it as simple as possible.

    When I render it, some faces that should be hidden by others are still visible. It's as if DirectX did not manage to properly order the faces to render.

    Here is an image link as an illustration (B&W stripes to better see the volume):
    http://arnaud.debruyn.info/images/di...sh_problem.gif

    A few things I noted:

    1. It only happens in certains views (see above link: left image is fine, right one is not), probably due to the initial ordering of the vertex.

    2. Let's say I have 3 faces: A > B > C, where > means 'in front of'. It seems that in that case, C is always correctly hidden, but B might sometimes be rendered in front of A.

    Any idea what happens? Where should I look? Can it be because the mesh is too complex (4225 vertex, 8192 faces)?

    Thanks,
    Arnaud.[/url]

  2. #2

    Weird rendering of a mesh

    What is your projection matrix? I have bad feelings about your Znear and Zfar values. Have you enabled Z buffer at all?
    There are only 10 types of people in this world; those who understand binary and those who don't.

  3. #3

    Weird rendering of a mesh

    ZBuffer:

    Code:
    g_pd3dDevice.SetRenderState(D3DRS_ZENABLE, iTrue);
    Projection matrix:

    Code:
    D3DXMatrixPerspectiveFovLH(matProj, D3DX_PI/4, 1.0, 1.0, 200.0);
    g_pd3dDevice.SetTransform(D3DTS_PROJECTION, matProj);
    The map is 64*64. 200 is more than enough.

    Any clue? :?

  4. #4

    My apologies...

    I was not clearing the zbuffer properly... Hence, the scene was rendered using the zbuffer of the first frame over and over, which is why the scene appeared perfect from some angles, and somewhat ok from others, but never completely chaotic as we could have expected if zbuffer was not working at all.

    Rookie's mistake. ops:

    Thanks for your time.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •