Results 1 to 10 of 112

Thread: [WIP] .render_model exporter (First custom model ingame!)

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #11

    Re: [wip] .render_model exporter (First custom model ingame!)

    Quote Originally Posted by TheGhost View Post
    Are you serious? That has nothing to do with anything.

    The reason that you get degenerate triangles is because of the way the JMS was imported in Halo 1. The post-processing done in Tool created degens, which the game ignores. In Halo 2, the processing done by the exporter breaks down verts along smoothing groups so the compiler doesn't have to distinguish. Undoing the process in the gbxmodel tag isn't that hard. How else do you think I made a gbxmodel importer?
    I know the degenerate triangles get ignored, its how and why the tool creates them in post processing I need to figure out. The reason I assumed they were created for triangle stripping is because if you read up on this you will find out that in triangle stripping, the degen triangles that the game ignores are created to be used to jump around the model to start and end strips of triangles. Undoing the process is not something I have to do, its the process that I have to do, not undo.
    Quote Originally Posted by TheGhost View Post
    Code:
    triangle_vertices = (geometry_part_triangle_blocks[g][p] * 3)
    for t = 1 to triangle_vertices do
    (
        append vertex_order ((readShortB "#signed") + 1)
    )
    
    vo_count = vertex_order.count
    if vertex_order[vo_count] == 0 do deleteItem vertex_order (vo_count)
    if vertex_order[vo_count-1] == 0 do deleteItem vertex_order (vo_count-1)
    
    for w = 1 to (vertex_order.count - 2) do
    (
        triangles[w] = [vertex_order[w],vertex_order[w+1],vertex_order[w+2]]
    )
                    
    for r = 1 to triangles.count by 2 do
    (
        a = triangles[r][1]
        triangles[r][1] = triangles[r][3]
        triangles[r][3] = a
    )
                
    for d = triangles.count to 1 by -1 do
    (
        if (triangles[d][1] == triangles[d][2]) or (triangles[d][2] == triangles[d][3]) or (triangles[d][1] == triangles[d][3]) then
        (
            deleteItem triangles d
        )
    )
    I'll translate that to English for you...

    There are 4 for-loops, each has a purpose:
    1. Read the vertex order from the tag
    2. Create triangles from every 3 vertices
    3. Reverse the vertex indices
    4. Remove degenerate triangles
    Voila, your model no longer looks like crap.
    That code is very similar to what I had to do to extract the lightmap BSP model data from halo 2. Thanks.
    Last edited by jahrain; June 26th, 2007 at 06:31 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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
  •