Page 1 of 1

OBJ plugin

PostPosted: Sat Oct 27, 2007 11:53 am
by Aaron
Hi All,

Users of the OBJ plugin may be interested to know that an updated version has been included in the latest release candidate for L3DT Pro. It will also be included with L3DT Standard at the next convenient moment.

This new version of the plugin allows you to split your terrain mesh into a set of OBJ tile files using the mosaic option in the export wizard. It will also stitch the tiles together by adding to each tile a row and column of vertices/faces to join with the next tile. This, a 512x512 tile actually contains 513x513 worth of vertices/faces.

Also, by default, the OBJ files now use an XZ terrain plane, with Y being the up axis. This is to be consistent with Blender and 3DS. If you don't like it, you can change back to the previous 'XY plane with Z up' axis system by changing the appropriate setting in the format preferences dialog box.

Best regards,
Aaron.

PostPosted: Sat Oct 27, 2007 7:32 pm
by Jovin
Awesome! I gotta play with this once I have time, inundated right now.

PostPosted: Mon Oct 29, 2007 4:23 pm
by Tormented
I'm getting gaps between some of the tiles when importing into blender.

This is a 4x4 mosaic:
Image

PostPosted: Mon Oct 29, 2007 8:00 pm
by Aaron
Hi Tormented,

I'm working on this right now. I'll let you know when it's ready.

Best regards,
Aaron.

PostPosted: Tue Oct 30, 2007 7:51 am
by Aaron
Hi Tormented,

I've included a fix for this problem in the latest release candidate, and I've tested it thoroughly in Blender. Please let me know if you find a problem.

For the curious, this problem was due to me breaking one of the hitherto unwritten cardinal rules of using the Zeolite plugin API:

Aaron's bible of L3DT plugin development wrote:"Thou shalt not, when loading or saving mosaic tiles, attempt to access pixels in other tiles."


To stitch the OBJ tile meshes together, each tile file had to contain a row/column of vertices/faces from the neighbouring tiles. To do this in the most painless way for the user, the tile-saving code in the plugin had to access the pixel values from neighbouring tiles. However, during export, the mosaic map implementation does not guarantee that neighbouring tiles will be allocated. This is particularly so when changing file formats, converting from non-mosaic to mosaic, or changing tile sizes. In these cases, L3DT has to create a temporary mosaic on-the-fly to save the tile data, and it often does this one tile at a time to save memory (hence, neighbouring tiles don't necessarily exist).

The solution: I've added to the plugin (actually, the OBJ format instance) a flag called 'MosaicExportNeedsFullMap'. When L3DT attempts to export a mosaic, and it finds that the desired file format contains this particular flag, it will first export the complete temporary mosaic in a standard native format (e.g. HFF) to a temporary directory to get all the tile size/etc settings right, and then export tile-by-tile to the desired location using the desired format. This extra stage ensures that the temporary mosaic actually contains all the map data when it comes time to export the mosaic tiles in the final format, so calls to neighbouring tiles will still work. This option will take a longer time (for OBJ only), but at least it works now. Also, in the process of making this change, I've managed to optimise some other parts of the mosaic export code to make regular (non-OBJ) exports slightly faster. Hurrah.

Anyway, if any plugin developers intends to write an export format plugin that needs to stitch tiles together (and can't use the regular 'stitch tile borders' option), please refer to the source code of the L3DTio_OBJ plugin for an example of how to do it.

Cheerio,
Aaron.

PostPosted: Tue Nov 27, 2007 9:52 am
by notareal
Nice. I hope .obj exporter will get textures soon.

PostPosted: Tue Nov 27, 2007 11:46 am
by Aaron
Hi Notareal,

I have no immediate plans for further improvements to the OBJ plugin. However, I have released the source code, so other developers are free to make any such modifications.

Cheerio,
Aaron.

PostPosted: Sun Dec 02, 2007 9:51 pm
by notareal
aaron wrote:Hi Notareal,

I have no immediate plans for further improvements to the OBJ plugin. However, I have released the source code, so other developers are free to make any such modifications.

Cheerio,
Aaron.


Np. Wonder if anyone is trying do add textures?

PostPosted: Fri Jun 12, 2009 1:48 pm
by Aaron
Hi Notareal,

It took time, but it's done. The OBJ plugin now supports exporting OBJ files with texture coordinates, along with corresponding MTL and texture image files. This update is included in the latest developmental build of L3DT Professional (v2.7.0.16), which is on the downloads page now.


To use the OBJ + MTL exporter, select the 'File->Export->Export OBJ and MTL' menu option.


Please note that the regular export method (using the 'File->Export->Export map' menu option) functions exactly as before; it still only exports the heightfield OBJ file, and does not export the texture map or material file along with the OBJ file.

Please let me know if you find any problems.

Best regards,
Aaron.