You can make the level in Gmax, export it as OBJ twice (once with a texture applied to it, a scond one with the lightmap tga asigned to the difusse slot. As Gmax does not generate lightmaps, you may generate that tga somewhere else....)
The proba has allways been that the available -rarely known- obj exporter, u can grab on the depot, down in my signature, does not do anything with OBJ vertex normals.
The fact is I was curious this mourning, and found a new one that does support them.Sadly, when I set the smooth groups, seems vertex normals are not generated from them, instead, it produces and unwelded obj (it's trivial to do a "weld model" in Lithunwrap(also in the Tool depot) but normals, while are written (you can look there it says "vn" among the coords: vertex normals are exported. Just some error in that tiny code. Some coder feel free to produce and updated revision...The author is unknown, it seems...) )
I'm posting here the code of the script. I have saved as ms and run the maxscript (tip, is important to do how it says in the script comments...clear all listener. )
VERY,VERY,VERY important, with any maxscript exporter...read the mouse genial trick... (or u'll get your whirst ill of so much copy and paste....) It'd be ideal if u had a 3 mouse buttons mouse. As explained in the trick :
http://irrlicht.sourceforge.net/phpBB2/ ... 7147#27147
I don't know what's happening with smooth groups there, but if u can use an external tool to apply that(wings3d comes to mind, if no isolated faces are there, or iverted faces...or some other weirdness ), or just do a weld model, weld equal points, however it's called in ur tool.
BTW, someone brave enough (or not, maybe the error is just trivial) may fix the code bellow to actually export smooth groups out of gmax instead of an unwelded thing...
Yet though, the script seem to export UVs, (and tries to export Vertex normals) , but does not make an mtl file. Again, you may use Wings3d for this. If ur export can be imported nto wings, there's pretty easy to add some materials, add some hard egdes (easier than gmax smooth groups) , export as OBJ. It generates vertex normals correct output, and good MTL files with the OBJ. Murphy and I have checked it.
So u could use Gmax to build ur levels if you prefer, and do this final fix in Wings3d. Till someone fixes this code, and/or add an mtl generation routine to it, I dunno.
The maxscript.(actually starts where it says "global...")
-- Load your scene
-- Open the MaxScript Listener (MaxScript: Maxscript Listener)
-- In the Maxscript Listener's menu Choose menu item Edit:Clear All
-- Run this script (MaxScript:Run Script)
-- Copy and paste the output from the Maxscript Listener window into a text file.
-- (For large scenes you will have to copy-and-paste in chunks)
--
global baseVertex = 0
global baseTVertex = 0
global baseNVertex = 0
function toDec f = (
local i = f as integer
return i
)
function outputHeader =(
format "\n"
format "Copy and paste the following lines into a\n"
format "a new MXScript file, and save them as a .obj file.\n"
format "\n"
format "# -----------------\n"
format "# Start of obj file\n"
flushStringStream
)
function outputFooter =(
format "# end of obj file\n"
format "# ---------------\n"
format "\n"
flushStringStream
)
function outputNode node = (
format "o %\n" node.name
local m = snapshotAsMesh node
for v = 1 to m.numVerts do (
local vert = m.verts[v]
format "v % % %\n" vert.pos.x vert.pos.y vert.pos.z
flushStringStream
)
format "\n"
if m.numtverts > 0 do (
-- Texture coordinates
for vt = 1 to m.numtverts do (
local tvert = getTVert m vt
format "vt % % %\n" tvert.x tvert.y tvert.z
)
format "\n"
-- Also print out the normals, because some importers
-- can't handle faces with textures but not normals
for f =1 to m.numFaces do (
local vn = getFaceNormal m f
format "vn % % %\n" vn.x vn.y vn.z
flushStringStream
)
format "\n"
)
local mv = m.verts
for f =1 to m.numFaces do (
local vface =getface m f
local x = baseVertex + toDec(vface.x)
local y = baseVertex + toDec(vface.y)
local z = baseVertex + toDec(vface.z)
if m.numtverts > 0 then
(
local tvface = gettvface m f
local tx = baseTVertex + toDec(tvface.x)
local ty = baseTVertex + toDec(tvface.y)
local tz = baseTVertex + toDec(tvface.z)
local n = baseNVertex + f
format "f %/%/% %/%/% %/%/%\n" x tx n y ty n z tz n
flushStringStream
)
else (
format "f % % %\n" x y z
)
)
format "\n"
baseVertex = baseVertex + m.numVerts
baseTVertex = baseTVertex + m.numtverts
baseNVertex = baseNVertex + m.numFaces
)
function PrintObj = (
outputHeader()
for c in rootNode.children do outputNode c
outputFooter()
)
PrintObj()