lol username Posted January 10, 2020 Share Posted January 10, 2020 https://github.com/Terrev/LWO-to-OBJ/releases A quick and dirty tool for converting Rock Raiders models (.LWO + .UV) to OBJ, just cause I got annoyed there was nothing that handled the texture mapping properly/at all (generating UV coords from the planar texture info, or loading them from the occasional .UV files) Animations/full creatures and buildings etc are another deal entirely (.LWS files; scenes comprised of LWOs), I make no promises as to if/when I might tackle that but it'd be in a separate, more extensive project Select/multiselect as many LWOs as you want and it'll plop the OBJs/MTLs right along side 'em, just remember LRR puts some things in special "Shared" folders so if some textures aren't present, look there ~~ EDIT: AND NOW SOME NEW STUFF ~~ You can also dump LWOs as XMLs and back again, to make simple tweaks easier (changing texture paths, colors, etc without a hex editor) or to more easily debug why one model may be crashing the game or whatever (comparing it with a working file, removing/changing chunks until it works, etc). It handles the bulk of the chunks used by the game's models (certainly all the chunks the game actually reads), others it doesn't recognize just have their raw hex dumped (so if for some reason you need to tweak them you still can). Note that due to the nature of floating point numbers, unless you tick the boxes for it, it won't turn those into text by default (it'll dump the raw contents as you'd see in a hex editor instead), to avoid minuscule differences creeping in (you probably won't need to be editing these by hand 99% of the time anyway) . Practically speaking it won't matter in-game even if that does happen, you'd never see a visual difference. It just makes direct file comparison easier when things match truly 100%. If you wanna know what the hell you're even looking at in the XMLs, here's some format documentation that explains it: http://www.martinreddy.net/gfx/3d/LWOB.txt https://sandbox.de/osg/lightwave.htm The only inaccuracy I found was that angles (i.e. surface smoothing angles) seem to be stored in radians, not degrees. But that doesn't even matter because LRR doesn't read/use any chunks like that. In fact, going by Cyrem's reverse engineering efforts (aka poking the exe with a stick), it seems the only chunks (and SURF sub-chunks) the game pays attention to are: PNTS SRFS CRVS POLS SURF TIMG COLR CTEX TTEX TFLG FLAG TSIZ TCTR TRAN DIFF LUMI REFL SPEC GLOS And not even all of those are actually used in practice - same goes for the surface and texture flags. Oh yeah, and the 4th (supposedly unused) byte in color chunks is typically 00 but the exporter in Lightwave 8 writes FF instead. It's probably of no importance. SOME OTHER NOTES Rock Raiders often leaves certain textures unfiltered to create an appearance of crisp seams between bricks on low resolution textures, but sometimes their choices on what textures to do it on were a bit weird - the Power Station is a great example: https://www.rockraidersunited.com/topic/8156-rock-raiders-models-uv-files-x-files-texture-filtering-and-the-shared-folder/ Basically, if something looks too blurry when you think it should look sharp, try messing with the settings for the texture in whatever program you're using (i.e. in Unity, enable point filtering for the texture under Filter Mode) Chief's models are flipped on X, inside out. His animation then scales him to -1 on X, making the faces appear the right way around, but with flipped vertex normals. Why? So the lighting from the cursor - behind him - makes him appear lit from the front. I've included an option to flip models on X, so you can get Chief's models as they appear once animated in-game. Vertex normals are generated by the game at runtime, and the game ignores any smoothing angles that may be set in the LWO; hard edges are purely handled by which verts are welded/unwelded Rock Raiders often adjusts the scale of misc things in the animations (like the minifigure head), keep an eye out for that if you're assembling these together manually Some screenshots of converted models in another program: Jimbob, Ben24x7, Cyrem and 3 others 5 1 Link to comment Share on other sites More sharing options...
lol username Posted January 13, 2020 Author Share Posted January 13, 2020 Updated so it describes more surface properties in the MTL comments, i.e. # Surface name: Newbit top yellow grill SidesX # Surface flags: None # Color (RGB): 197 254 1 # Luminosity: 0 (0%) # Diffuse: 256 (100%) # Specularity: 166 (64.84375%) # Glossiness 256 (100%) # Reflection: 0 (0%) # Transparency: 0 (0%) # Texture flags: X, PixelBlending, Antialiasing # Texture path: \\Mother\LEGO\Meshes\Lowpoly\Buildings\Refinery\NEW-side.bmp newmtl Newbit_top_yellow_grill_SidesX map_Kd NEW-side.bmp still need to figure out just how much of that can be properly translated to the OBJ/MTL format... Cirevam 1 Link to comment Share on other sites More sharing options...
lol username Posted January 19, 2020 Author Share Posted January 19, 2020 hi it dumps them to XML now too I think it's actually done now goodbye sleep bed zzz Cirevam 1 Link to comment Share on other sites More sharing options...
lol username Posted February 3, 2020 Author Share Posted February 3, 2020 On 1/19/2020 at 2:32 AM, jamesster said: I think it's actually done now I lied, I misunderstood how glossiness worked, it's fixed now https://github.com/Terrev/LWO-to-OBJ/releases/tag/v1.3.0 Cirevam 1 Link to comment Share on other sites More sharing options...
lol username Posted February 11, 2020 Author Share Posted February 11, 2020 https://github.com/Terrev/LWO-to-OBJ/releases now writes planar texture sizes/centers to MTL comments. this may be useful for things that's all Link to comment Share on other sites More sharing options...
lol username Posted March 20, 2020 Author Share Posted March 20, 2020 HEY SO IF YOU EXPORT MODELS OF STUFF WITH .UV FILES (PARTICULARLY THE LAVA MONSTER) and notice "well gee, there's hard edges visible in-game, why aren't there in the exported models?" that's because there seems to be a bug (probably?) in the game where it introduces hard edges along seams in the UV map: I'm not implementing it into this exporter cause a) it's probably a bug they never noticed or bothered to fix cause UV files were used on so few things in the vanilla game, and b) it'd be kind of a pain in the ass so if you reeeaally wanna mimic how the lava monster actually looks in-game, just add hard edges wherever there's UV seams I guess. lol. f****ing 90s 3D games man Cirevam 1 Link to comment Share on other sites More sharing options...
Recommended Posts