USA
Joined: Mar 25, 2015
Post Count: 153
Status:
Offline
Import/Export issue #2
Emmanuel -
I knew I'd forgotten something!
When exporting a Lightwave model, under some circumstances SH3D will change texture files. Seemingly, this most often is in order to reduce image resolution, but I've also found instances where resolution was increased (unfortunately, not always very attractively).
For instance, the model on which I am presently working contains 7 texture image files, 4 of which are used as traditional, tiled textures, with the remaining 3 used as 'one-off' textures, mapped against an object component of the same size as the texture -- for instance, to represent a nameplate or control panel. Here are image resolutions as exported from Sketchup in Collada format (DAE) and as imported into SH3D from DAE and exported in Lightwave format (OBJ):
image file DAE OBJ ================================================================= calibratedDialArt.png 706 x 706 512 x 512 castIron.jpg 256 x 256 256 x 256 emergencyStopDisk1.png 400 x 400 512 x 512 mirrorShiny.jpg 500 x 500 512 x 512 motor-control-fs.png 1328 x 697 1024 x 512 nickel.png 374 x 372 256 x 256 shiny2.jpg 500 x 500 n/a
Clearly, the export routine resizes images to the nearest factor of 256; unfortunately, it does so without regard for aspect ratio or image quality. In the example above, upscaling 'emergencyStopDisk1.png' from 400x400 to 512x512 introduced jaggies; downscaling 'calibratedDialArt.png' did the same. In the case of 'motor-control-fs.png', image resolution was reduced and image distortion introduced as the result of downscaling with aspect ratio change.
(Interestingly, I notice the application realized at some point the texture files for the 'mirrorShiny' and 'shiny2' textures were identical, exported only a single texture, and updated the .MTL file accordingly. In the final model, I edit the .OBJ file to append 'sweethome3d_window_mirror' to the name of all instances that use the 'mirrorShiny' texture.)
In a quick glance through OBJWriter.java, I don't see any explicit resizing of images, so I guess it might actually take place during import of the Collada object. (Actually, that might make more sense, as I've noted instances where replacing an imported texture with an identical texture -- that is, using the same image file -- within SH3D results in a different texture, possibly because the user can bypass resizing when importing textures individually.)
At the moment, I'm not sure how much of an issue this is, as I'm only now experimenting with workarounds. Both possible approaches seem to be moderate pains-in-the-cul: namely, replace exported texture files with appropriately named files at the correct resolution, or, if SH3D insists upon resizing textures during OBJ import, as well, replacing imported textures with ones imported directly into SH3D without resizing.
USA
Joined: Mar 25, 2015
Post Count: 153
Status:
Offline
Re: Import/Export issue #2
BTW, during my scan through OBJWriter.java, I couldn't find any obvious reason for the incorrect illumination model to be exported, as mentioned in my earlier thread.