L3DT users' community
Large 3D terrain generator

OBJ plugin

Correspondence concerning plugins and scripts; development, use, bugs and ideas.

OBJ plugin

Postby Aaron » Sat Oct 27, 2007 11:53 am

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.
User avatar
Aaron
Site Admin
 
Posts: 3696
Joined: Sun Nov 20, 2005 2:41 pm
Location: Melbourne, Australia

Postby Jovin » Sat Oct 27, 2007 7:32 pm

Awesome! I gotta play with this once I have time, inundated right now.
Jovin
Member
 
Posts: 16
Joined: Sun Aug 13, 2006 1:48 am

Postby Tormented » Mon Oct 29, 2007 4:23 pm

I'm getting gaps between some of the tiles when importing into blender.

This is a 4x4 mosaic:
Image
User avatar
Tormented
New member
 
Posts: 6
Joined: Mon Dec 19, 2005 5:17 pm

Postby Aaron » Mon Oct 29, 2007 8:00 pm

Hi Tormented,

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

Best regards,
Aaron.
Last edited by Aaron on Tue Oct 30, 2007 12:06 pm, edited 1 time in total.
User avatar
Aaron
Site Admin
 
Posts: 3696
Joined: Sun Nov 20, 2005 2:41 pm
Location: Melbourne, Australia

Postby Aaron » Tue Oct 30, 2007 7:51 am

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.
User avatar
Aaron
Site Admin
 
Posts: 3696
Joined: Sun Nov 20, 2005 2:41 pm
Location: Melbourne, Australia

Postby notareal » Tue Nov 27, 2007 9:52 am

Nice. I hope .obj exporter will get textures soon.
notareal
Contributing member
 
Posts: 25
Joined: Thu Nov 16, 2006 12:25 pm

Postby Aaron » Tue Nov 27, 2007 11:46 am

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.
User avatar
Aaron
Site Admin
 
Posts: 3696
Joined: Sun Nov 20, 2005 2:41 pm
Location: Melbourne, Australia

Postby notareal » Sun Dec 02, 2007 9:51 pm

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?
notareal
Contributing member
 
Posts: 25
Joined: Thu Nov 16, 2006 12:25 pm

Postby Aaron » Fri Jun 12, 2009 1:48 pm

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.
User avatar
Aaron
Site Admin
 
Posts: 3696
Joined: Sun Nov 20, 2005 2:41 pm
Location: Melbourne, Australia


Return to Plugins and scripts

Who is online

Users browsing this forum: No registered users and 3 guests

cron