SUBSIM Radio Room Forums



SUBSIM: The Web's #1 resource for all submarine & naval simulations since 1997

Go Back   SUBSIM Radio Room Forums > Silent Hunter 3 - 4 - 5 > SHIII Mods Workshop
Forget password? Reset here

Reply
 
Thread Tools Display Modes
Old 03-23-08, 04:52 AM   #1
USS Sea Tiger
XO
 
Join Date: Oct 2006
Posts: 425
Downloads: 52
Uploads: 0
Default wavefron .obj files what program, payware or free can this be modeled in

Hi

I am currently working my files in gmax and triple translating them into the obj files. this seems to be causing issues in the game due to flipped faces causing crashes

is there a program, payware or free, that will allow easier manipulation of these files??

where can I find it in the USA?
USS Sea Tiger is offline   Reply With Quote
Old 03-23-08, 05:02 AM   #2
iambecomelife
Silent Hunter
 
Join Date: Apr 2005
Posts: 4,706
Downloads: 300
Uploads: 0


Default

Use wings3d. It's simple but easy to learn. It handles SH3 obj files very well for the most part.

http://www.wings3d.com/
iambecomelife is offline   Reply With Quote
Old 03-23-08, 09:07 AM   #3
DeepIron
Sea Lord
 
Join Date: Aug 2007
Location: Too far from the Pacific right now...
Posts: 1,634
Downloads: 0
Uploads: 0
Default

Quote:
I am currently working my files in gmax and triple translating them into the obj files.
Here's an import/export script (xzzy_obj_tool.ms)

Code:
save_file = ""

global verts
global faces
global tverts
global nVerts
global nFaces
global nTVerts
global objname
global normals

fn rtoken str = (
        ret_string = filterString str " :,\""
        return ret_string[1]
)

fn createobj =(
    if (tverts.count > 0) then (
        m = mesh vertices:verts faces:faces tverts:tverts
        update m
        setnumtverts m tverts.count true
        buildTVfaces m
        for j = 1 to tverts.count do settvert m j tverts[j]
        for i = 1 to faces.count do settvface m i faces[i]
        update m
    ) else (
        m = mesh vertices:verts faces:faces
    )

    if normals[1] != undefined then (
        for i = 1 to faces.count do (
                setfacesmoothgroup m i (normals[i])
        )
    ) else (
        addmodifier m (smooth autosmooth:true threshhold:45)
        collapsestack m
    )
        
    update (m)
    m.name = uniquename(objname)
    
    format "verts: %\ntverts: %\nfaces: %\n" (verts.count) (tverts.count) (faces.count)
)

fn fn_import=(
    filename = getOpenFileName "Import OBJ" types:"Wavefront OBJ (*.obj)|*.obj|All Files (*.*)|*.*"
    
    if filename != undefined then    (
        fp = openFile filename
        
        verts = #()
        faces = #()
        tverts = #()
        normals = #()
        nVerts = 0
        nFaces = 0
        nTVerts = 0
        objname = "Object"

        first_obj = true            
        while ((eof fp) == false) do (
            curline = readLine fp
            string = filterString curline " :,\""
            linetype = rtoken curline

            case linetype of (
                "v": (
                    nVerts += 1
                    x = (string[2] as float)
                    y = (string[3] as float)
                    z = (string[4] as float)
                    verts[nVerts] = [x,y,z]
                )
                "vt": (
                    nTverts += 1
                    u = (string[2] as float)
                    v = (string[3] as float)
                    tverts[nTVerts] = [u,v,0]
                )
                "f": (
                    nFaces += 1
                    buf = filterString string[2] "/"
                    a = (buf[1] as integer)
                    buf = filterString string[3] "/"
                    b = (buf[1] as integer)
                    buf = filterString string[4] "/"
                    c = (buf[1] as integer)
                    faces[nFaces] = [a,b,c]
                    if string.count > 4 then (
                        nFaces += 1
                        buf = filterString string[5] "/"
                        d = (buf[1] as integer)
                        faces[nFaces] = [a,c,d]
                    )
                )

                "g": (
                    if( first_obj == true ) then (
                        -- we don't run creatobj() until we hit our second object
                        first_obj = false
                        objname = string[2]
                    ) else (
                        createobj()
                        -- redefine the arrays
                        verts = #()
                        faces = #()
                        tverts = #()
                        normals = #()
                        nVerts = 0
                        nFaces = 0
                        nTVerts = 0
                        objname = string[2]
                    )
                )
            )
        )
        close fp
        -- create the last object in the file
        createobj()
    )
)

fn fn_export=(
    for obj in geometry do (
        if ( (obj.primaryVisibility==on) AND (obj.ishidden==false) ) then (

            snapobj = snapshot obj;
            theMesh = getNodeByName (snapobj.name);

            -- print out name of this object
            format  "g %\n" theMesh.name

/*
            -- Cycle through all vertices in this mesh and print out their coordinates
            for i = 1 to (getNumVerts theMesh) do (
                v = getVert theMesh i;
                format "v % % %\n" v.x v.y v.z
                -- do the normals too
                v = getNormal theMesh i
                format "vn % % %\n" v.x v.y v.z
            )
*/
            channel = 1
            cur_tvert = 1
            cur_vert = 1
            for face = 1 to theMesh.numFaces do (
                theFace = getFace theMesh face;
                x = (theFace.x as integer);
                y = (theFace.y as integer);
                z = (theFace.z as integer);
                
                v = getVert theMesh x
                format "v % % %\n" v.x v.y v.z
                v = getVert theMesh y
                format "v % % %\n" v.x v.y v.z
                v = getVert theMesh z
                format "v % % %\n" v.x v.y v.z
                
                v = getNormal theMesh x
                format "vn % % %\n" v.x v.y v.z
                v = getNormal theMesh y
                format "vn % % %\n" v.x v.y v.z
                v = getNormal theMesh z
                format "vn % % %\n" v.x v.y v.z

                -- get the map face for this mesh face
                theTFace = meshop.getMapFace theMesh channel face
                -- get the UVW coordinates of each texture vertex
                tvx = meshop.getMapVert theMesh channel (theTFace.x as integer)
                tvy = meshop.getMapVert theMesh channel (theTFace.y as integer)
                tvz = meshop.getMapVert theMesh channel (theTFace.z as integer)

                format "vt % %\n" tvx[1] tvx[2]
                format "vt % %\n" tvy[1] tvy[2]
                format "vt % %\n" tvz[1] tvz[2]

                format "f "
                format "%/%/% " cur_vert cur_tvert cur_vert
                format "%/%/% " (cur_vert + 1) (cur_tvert + 1) (cur_vert + 1)
                format "%/%/%\n"(cur_vert + 2) (cur_tvert + 2) (cur_vert + 2)
                cur_tvert += 3
                cur_vert += 3
            )

            delete snapobj;
        )
    )
)

utility spread "OBJ Import/Export" (

    button bt_export "Export" width:140 height:35
    button bt_import "Import" width:140 height:35

    on bt_export pressed do (
        clearListener()
          fn_export()
    )

    on bt_import pressed do (
        fn_import()
    )
)
Quote:
Use wings3d. It's simple but easy to learn. It handles SH3 obj files very well for the most part.
My modeler of choice as well. Just watch your poly count..
__________________
RFB / RSRDC Beta Tester
RFB / RSRDC Modding Forum: http://forum.kickinbak.com/index.php
RFB Top Post link: http://www.subsim.com/radioroom/showthread.php?t=125529
RFB Loadout: RFB_V1.52_102408: RFB_V1.52_Patch_111608: RSRDC_RFBv15_V396
DeepIron is offline   Reply With Quote
Old 03-23-08, 12:02 PM   #4
Graf Paper
Ace of the Deep
 
Join Date: Jan 2008
Location: Pacific Northwest United States
Posts: 1,146
Downloads: 41
Uploads: 2
Default

Anim8or is a good freeware 3D subdivision modeler program with a large community to support it and many resources. It has a simpler interface and is intended for those just starting out in 3D modeling and animation but it can create some fantastic artwork.

Blender is an open source 3D modeling suite that is comparable to 3D Studio Max and Maya. The community that supports it and the resources available are huge. The learning curve is steep due to it being as complex as commercial applications but it can create art and effects every bit as good as the expensive software.

Blender has been used to make professional animated movies, such as "Elephant's Dream" and the full-length theatrical production of "Plumiferos".

Wings 3D is the most popular choice here for those looking for free alternatives and it is a very powerful tool for an open source project that is still in its beginnings.

DAZ Studio is a professional 3D modeler that is free and made by the same company that also has Bryce 3D and Carrara. The company makes its money by selling models and effects libraries that work with DAZ, Lightwave, Maya, and so forth.

There are numerous other free and open source 3D modeling and animation tools out there, if you search enough.
__________________
Still sailing the high seas, hunting convoys with those who join me.
Graf Paper is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 12:10 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright © 1995- 2025 Subsim®
"Subsim" is a registered trademark, all rights reserved.