ImgToMap - terrain generator

Post anything to do with editing Nexuiz here. Whether its problems you've had, questions, or if you just want to show off your work.

Moderators: Nexuiz Moderators, Moderators

ImgToMap - terrain generator

Postby SavageX » Sun May 18, 2008 11:22 am

This post always links to the most current version.

Hello,


I wrote a simple cross-platform application which generates terrain from pictures. My GTKRadiant doesn't come with a fitting plugin and I wanted a special feature found nowhere else (AFAIK): If pictures have an alpha channel I want transparent regions of that picture to not end up as terrain. This makes it very easy to come up with terrain maps with more organic shapes.

This is what the application looks like:

Image

As one can see it's not very complicated and should be easy to use.

The following picture

Image

(note that the preview picture is screwed up, click onto it to see it unspoiled)

converts to this:

Image

Another novel feature of ImgToMap is that it can autogenerate visblockers hidden within the terrain (which by itself cannot block vis). The following picture shows the visblockers generated (terrain removed):

Image

The source can be found at

http://svn.icculus.org/nexuiz/trunk/mis ... /ImgToMap/

(it's a complete Netbeans project - people toying around with it can directly load it into their IDE) and a binary here:

http://savagex.planetnexuiz.de/ImgToMap.zip

Unzip it and start the program either via a doubleclick on ImgToMap.jar (in properly set up graphical file managers) or in the console with "java -jar ImgToMap.jar".

You need a Java 6 runtime to execute it. People hating Java may feel free to convert it to C++, Mono/.net, Python, VisualBasic, Brainfuck or whatever.
Last edited by SavageX on Sun Feb 08, 2009 10:58 am, edited 5 times in total.
SavageX
Site Admin
 
Posts: 442
Joined: Wed Mar 01, 2006 9:34 am

Postby torus » Sun May 18, 2008 4:11 pm

Very nice :D I haven't used it, but it looks like it could be useful for making tri-soups where a model isn't practical.
Image
torus
Forum addon
 
Posts: 1341
Joined: Sun Dec 24, 2006 6:59 am
Location: USA

Postby C.Brutail » Sun May 18, 2008 5:17 pm

MY HERO! :D

OMG, THIS IS SO COOL!

THX :D
"One should strive to achieve; not sit in bitter regret."
WE ARE NEXUIZ.
Image
Image
C.Brutail
Laidback mapper
 
Posts: 2357
Joined: Tue Feb 28, 2006 7:26 pm
Location: Ironforge

Postby SavageX » Sun May 18, 2008 5:31 pm

Thanks, I hope this is useful.

The current version (which looks a bit different) can also autogenerate a skybox and fill those blocks, which were skipped due to the alpha-channel and are next to "real" geometry, with sky-high visblockers.

One example with the ceiling of the skybox removed:

Image


Moving forward I want to also autogenerate visblockers inside mountains.
SavageX
Site Admin
 
Posts: 442
Joined: Wed Mar 01, 2006 9:34 am

Postby cortez » Sun May 18, 2008 7:26 pm

sounds nice but it needs a explaination how to use and how to install it for people like me who dont know what to do with ths http://savagex.planetnexuiz.de/ImgToMap.jar .
Aneurysm 4 the win !!!!! :D
cortez
Keyboard killer
 
Posts: 805
Joined: Wed Dec 06, 2006 7:22 pm
Location: From the moon

Postby C.Brutail » Mon May 19, 2008 1:33 am

Code: Select all
akion@quadra:~$ java -jar ImgToMap.jar
Exception during event dispatch:
java.lang.NoClassDefFoundError: imgtomap.JFrameMain
   at java.lang.Class.initializeClass(libgcj.so.90)
   at imgtomap.Main$1.run(Main.java:29)
   at java.awt.event.InvocationEvent.dispatch(libgcj.so.90)
   at java.awt.EventQueue.dispatchEvent(libgcj.so.90)
   at java.awt.EventDispatchThread.run(libgcj.so.90)
Caused by: java.lang.ClassNotFoundException: javax.swing.GroupLayout not found in gnu.gcj.runtime.SystemClassLoader{urls=[file:ImgToMap.jar], parent=gnu.gcj.runtime.ExtensionClassLoader{urls=[], parent=null}}
   at java.net.URLClassLoader.findClass(libgcj.so.90)
   at gnu.gcj.runtime.SystemClassLoader.findClass(libgcj.so.90)
   at java.lang.ClassLoader.loadClass(libgcj.so.90)
   at java.lang.ClassLoader.loadClass(libgcj.so.90)
   at java.lang.Class.forName(libgcj.so.90)
   at java.lang.Class.initializeClass(libgcj.so.90)
   ...4 more
akion@quadra:~$


:(
"One should strive to achieve; not sit in bitter regret."
WE ARE NEXUIZ.
Image
Image
C.Brutail
Laidback mapper
 
Posts: 2357
Joined: Tue Feb 28, 2006 7:26 pm
Location: Ironforge

Postby SavageX » Mon May 19, 2008 6:07 am

@C.Brutail: You need a Java 6 runtime (either the one from Sun or IcedTea or OpenJDK). The GCJ stuff apparently is missing some Java 6 classes.

edit: The next release will be Java 5 compatible.

@cortez: With a Java 6 runtime just call "java -jar ImgToMap.jar". In many GUI environments (including Windows) double-clicking on them in the file manager will start the program as if it was an ".exe" if Java is installed.
SavageX
Site Admin
 
Posts: 442
Joined: Wed Mar 01, 2006 9:34 am

Postby C.Brutail » Mon May 19, 2008 9:42 am

Code: Select all
quadra:/home/akion# apt-cache search java6
sun-java6-bin - Sun Java(TM) Runtime Environment (JRE) 6 (architecture dependent files)
sun-java6-demo - Sun Java(TM) Development Kit (JDK) 6 demos and examples
sun-java6-doc - Sun JDK(TM) Documention -- integration installer
sun-java6-fonts - Lucida TrueType fonts (from the Sun JRE)
sun-java6-javadb - Java(TM) DB, Sun Microsystems' distribution of Apache Derby
sun-java6-jdk - Sun Java(TM) Development Kit (JDK) 6
sun-java6-jre - Sun Java(TM) Runtime Environment (JRE) 6 (architecture independent files)
sun-java6-plugin - The Java(TM) Plug-in, Java SE 6
sun-java6-source - Sun Java(TM) Development Kit (JDK) 6 source files


From those, I already have (and I've had when I've posted the error above):

sun-java6-bin sun-java6-fonts sun-java6-jdk sun-java6-jre sun-java6-plugin

So what am I missing? :(
"One should strive to achieve; not sit in bitter regret."
WE ARE NEXUIZ.
Image
Image
C.Brutail
Laidback mapper
 
Posts: 2357
Joined: Tue Feb 28, 2006 7:26 pm
Location: Ironforge

Postby morfar » Mon May 19, 2008 11:15 am

It's crashing for me when I press "Start conversion!". Using windows xp sp2 with java 6 update 5.

Code: Select all
C:\Documents and Settings\Kristian Johansson>java -version
java version "1.6.0_05"
Java(TM) SE Runtime Environment (build 1.6.0_05-b13)
Java HotSpot(TM) Client VM (build 10.0-b19, mixed mode, sharing)

C:\Documents and Settings\Kristian Johansson>java -jar "C:\Documents and Setting
s\Kristian Johansson\Skrivbord\ImgToMap(2).jar"
Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
        at java.util.Arrays.copyOf(Unknown Source)
        at java.lang.AbstractStringBuilder.expandCapacity(Unknown Source)
        at java.lang.AbstractStringBuilder.append(Unknown Source)
        at java.lang.StringBuffer.append(Unknown Source)
        at imgtomap.MapWriter.writeMap(MapWriter.java:80)
        at imgtomap.JFrameMain.jButtonOKActionPerformed(JFrameMain.java:311)
        at imgtomap.JFrameMain.access$200(JFrameMain.java:17)
        at imgtomap.JFrameMain$3.actionPerformed(JFrameMain.java:117)
        at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
        at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
        at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
        at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
        at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
        at java.awt.Component.processMouseEvent(Unknown Source)
        at javax.swing.JComponent.processMouseEvent(Unknown Source)
        at java.awt.Component.processEvent(Unknown Source)
        at java.awt.Container.processEvent(Unknown Source)
        at java.awt.Component.dispatchEventImpl(Unknown Source)
        at java.awt.Container.dispatchEventImpl(Unknown Source)
        at java.awt.Component.dispatchEvent(Unknown Source)
        at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
        at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
        at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
        at java.awt.Container.dispatchEventImpl(Unknown Source)
        at java.awt.Window.dispatchEventImpl(Unknown Source)
        at java.awt.Component.dispatchEvent(Unknown Source)
        at java.awt.EventQueue.dispatchEvent(Unknown Source)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
        at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
morfar
Site Admin
 
Posts: 938
Joined: Tue Feb 28, 2006 6:08 pm
Location: The Island

Postby GreEn`mArine » Mon May 19, 2008 11:42 am

you'll have to increase the memory limit (oh rly :P). Google.com for more information :P
IRC quote:
[kojn] I've been coming a bit more recently
[kojn] she took it the dirty way
GreEn`mArine
Forum addon
 
Posts: 1509
Joined: Tue Feb 28, 2006 9:33 pm
Location: Germany

Next

Return to Nexuiz - Editing

Who is online

Users browsing this forum: No registered users and 0 guests

cron