XImage2Mesh
From GPWiki
The wiki is now hosted by GameDev.NET at wiki.gamedev.net. All gpwiki.org content has been moved to the new server. However, the GPWiki forums are still active! Come say hello.
[edit] DownloadXImage2Mesh.zip 29Kb (Release 1 - Feb 16, 2006) Code written in VB.NET 2005. Requires .NET Framework 2.0 to run. [edit] InformationxImage2Mesh is a application that takes a 2D image and generates MAXScript code. This MAXScript code is then used in tools such as discreets 3DS MAX or gMAX to generate a Multi\Sub object material and a 2D plane mesh. The material is also applied to the mesh. The result is a 3D mesh object that can be used in games or video generated by 3ds max, as well as the ability to then export that mesh into a DirectX *.X file or 3D Studio *.3ds file to be used in other applications. [edit] How it worksxImage2Mesh works by calculating the number of uniqe colors that are used in the image to generate the proper maxscript code that will create the Multi\Sub object material when the maxscript code is run in 3ds MAX or gMAX. The next thing xImage2Mesh does is to construct a vertex along the x/y axis at the location of each pixel in the selected image. The number of vertexes that are created is computed as VertexCount = ImageWidth * ImageHeight The next this it does is to construct two polygons, 3 vertexes per poly, and associates a material id that was generated in the previous step. It continues to create 2 polygon faces for each pixel in the image. The result is MAXScript code that can be run in 3ds MAX or gMAX to recreate the image as a 3D Mesh. [edit] How to use
[edit] Known issuesSpecifying a image that is too large will result in a unknown exception being trown by 3DS MAX (tested on version 7). The reason for this I suspect is that because the maxscript code that generates the mesh is stored on one line. And when 3DS MAX/gMAX reads that line and passes it to the "execute" method, it is unable to handle a line of that size resulting in the entire line to be dumped out to the listener window twice, and reporting the unknown exception. The work around to this is to use smaller image sizes. Or break up your image into smaller parts then generate and run each script in 3ds MAX or gMAX and attach the meshes together. |


