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

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.
    User avatar
    SavageX
    Site Admin
     
    Posts: 442
    Joined: Wed Mar 01, 2006 9:34 am

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
    User avatar
    torus
    Forum addon
     
    Posts: 1341
    Joined: Sun Dec 24, 2006 6:59 am
    Location: USA

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
    User avatar
    C.Brutail
    Laidback mapper
     
    Posts: 2357
    Joined: Tue Feb 28, 2006 7:26 pm
    Location: Ironforge

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.
    User avatar
    SavageX
    Site Admin
     
    Posts: 442
    Joined: Wed Mar 01, 2006 9:34 am

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
    User avatar
    cortez
    Keyboard killer
     
    Posts: 805
    Joined: Wed Dec 06, 2006 7:22 pm
    Location: From the moon

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
    User avatar
    C.Brutail
    Laidback mapper
     
    Posts: 2357
    Joined: Tue Feb 28, 2006 7:26 pm
    Location: Ironforge

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.
    User avatar
    SavageX
    Site Admin
     
    Posts: 442
    Joined: Wed Mar 01, 2006 9:34 am

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
    User avatar
    C.Brutail
    Laidback mapper
     
    Posts: 2357
    Joined: Tue Feb 28, 2006 7:26 pm
    Location: Ironforge

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)
    User avatar
    morfar
    Site Admin
     
    Posts: 938
    Joined: Tue Feb 28, 2006 6:08 pm
    Location: The Island

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

Mon May 19, 2008 12:46 pm

  • C.Brutail wrote: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? :(


    If you're on Ubuntu or Debian you can configure what JVM is to be used with

    update-java-alternatives -l

    With

    sudo update-java-alternatives -s java-6-sun

    You can select Sun's java.
    User avatar
    SavageX
    Site Admin
     
    Posts: 442
    Joined: Wed Mar 01, 2006 9:34 am

Mon May 19, 2008 12:49 pm

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


    How big was the picture you stuffed into? I should check to make sure nobody feeds in anything bigger than 128x128 or 160x160 - that'd be too many brushes.

    (Plus I should perhaps directly stream into the output file and not keep everything in a StringBuffer, which then gets flushed to disk)

    edit: No, you don't need to allocate more memory to Java. I should just stop wasting loads of it :)
    User avatar
    SavageX
    Site Admin
     
    Posts: 442
    Joined: Wed Mar 01, 2006 9:34 am

Mon May 19, 2008 1:09 pm

Mon May 19, 2008 1:18 pm

  • morfar wrote:The image is 512x512 :P

    edit: rezized it to 128x128 still low on memory.

    Here it is:
    Image


    I'll check this out. Currently I keep the complete map file in memory, then write it to disk, which is pretty stupid.
    User avatar
    SavageX
    Site Admin
     
    Posts: 442
    Joined: Wed Mar 01, 2006 9:34 am

Mon May 19, 2008 1:29 pm

Mon May 19, 2008 5:15 pm

  • Bump. New version available which should also work on Java 5 platforms and fixes the memory problems.
    User avatar
    SavageX
    Site Admin
     
    Posts: 442
    Joined: Wed Mar 01, 2006 9:34 am

Wed May 21, 2008 7:28 pm

  • Bump. New version with the ability to automatically generate visblockers.
    User avatar
    SavageX
    Site Admin
     
    Posts: 442
    Joined: Wed Mar 01, 2006 9:34 am

Thu May 22, 2008 3:38 am

  • Due the usage of alpha channel to determine the existence of a brush at a pixel, it seems as if this plugin was idealized with the creation of Facing Worlds/Broken World-style space floater in mind.

    Unfortunately, for it to be viable to do so, a tri-soup thickness option is needed.

    torus wrote: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.


    .ASE models should never be used for terrain, reiteration is tiresome.
    TVR [Public Terminal]
    Member
     
    Posts: 27
    Joined: Sat Dec 22, 2007 12:48 am

Thu May 22, 2008 11:32 am

  • TVR [Public Terminal] wrote:Due the usage of alpha channel to determine the existence of a brush at a pixel, it seems as if this plugin was idealized with the creation of Facing Worlds/Broken World-style space floater in mind.

    Unfortunately, for it to be viable to do so, a tri-soup thickness option is needed.

    torus wrote: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.


    .ASE models should never be used for terrain, reiteration is tiresome.


    Facing maybe, broken no, it has a rather visible underside and afaik this tool will not uvmap so you will most likely have to use projected texturing, witch is nice and easy and totaly sux for steep / caved in surfaces. ase models are the only real option for complicated terrain / terrain elements if you want to have no / few visible seams and compleate the map in less then a decade. its also to same deal as far as the engine is consernd since forcemata models are broken down just the same way detail brushes are. if you dont want to use models, dont. But stop puting unsubstantiated propaganda in ppls head. theres no practical reason not to use em.

    SavageX wrote:Bump. New version with the ability to automatically generate visblockers.

    Thats like total leetness :D gunna have to try this thing out, good work =)
    HOF:
    <Diablo> the nex is a "game modification"
    <Diablo> quake1 never had a weapon like that.
    <Vordreller> there was no need for anything over 4GB untill Vista came along
    <Samua>]Idea: Fix it? :D
    <Samua>Lies, that only applies to other people.
    User avatar
    tZork
    tZite Admin
     
    Posts: 1337
    Joined: Tue Feb 28, 2006 6:16 pm
    Location: Halfway to somwhere else

Thu May 22, 2008 1:26 pm

  • I wonder if .ase models can create structural brushes when their shader contains "surfaceparm structural". If that works, that would erase the only problem with embedding .ase models...
    1. Open Notepad
    2. Paste: ÿþMSMSMS
    3. Save
    4. Open the file in Notepad again

    You can vary the number of "MS", so you can clearly see it's MS which is causing it.
    User avatar
    divVerent
    Site admin and keyboard killer
     
    Posts: 3809
    Joined: Thu Mar 02, 2006 4:46 pm
    Location: BRLOGENSHFEGLE

Thu May 22, 2008 5:14 pm

  • New version up. This greatly reduces the amount of created brushes for visblockers and skyfillers by "merging" adjacent brushes (well, in fact it doesn't merge but directly creates fitting brushes).

    This should give much nicer map files.
    User avatar
    SavageX
    Site Admin
     
    Posts: 442
    Joined: Wed Mar 01, 2006 9:34 am

Thu May 22, 2008 6:04 pm

  • divVerent wrote:I wonder if .ase models can create structural brushes when their shader contains "surfaceparm structural". If that works, that would erase the only problem with embedding .ase models...

    Import .ASE into blender, export .map from blender.
    Each triangle or quad creates a caulked brush of whatever depth you choose.
    User avatar
    ihsan
    Alien trapper
     
    Posts: 305
    Joined: Fri Mar 03, 2006 3:33 pm
    Location: Trinidad (Where Obama met Chavez)

Thu May 22, 2008 7:24 pm

  • That is the bad way :(

    It means embedding the model twice, making it harder to edit. It'd be neater to have both the model and the "simplified" vis hull in one model, embedding it as parts structural, parts detail.
    1. Open Notepad
    2. Paste: ÿþMSMSMS
    3. Save
    4. Open the file in Notepad again

    You can vary the number of "MS", so you can clearly see it's MS which is causing it.
    User avatar
    divVerent
    Site admin and keyboard killer
     
    Posts: 3809
    Joined: Thu Mar 02, 2006 4:46 pm
    Location: BRLOGENSHFEGLE

Sat May 24, 2008 8:08 pm

  • Bump. Updated version, should fix gaps between faces which occasionally used to happen. Update strongly recommended.
    User avatar
    SavageX
    Site Admin
     
    Posts: 442
    Joined: Wed Mar 01, 2006 9:34 am

Sun May 25, 2008 6:08 pm

  • tZork wrote:
    TVR [Public Terminal] wrote:Due the usage of alpha channel to determine the existence of a brush at a pixel, it seems as if this plugin was idealized with the creation of Facing Worlds/Broken World-style space floater in mind.

    Unfortunately, for it to be viable to do so, a tri-soup thickness option is needed.

    torus wrote: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.


    .ASE models should never be used for terrain, reiteration is tiresome.


    Facing maybe, broken no, it has a rather visible underside and afaik this tool will not uvmap so you will most likely have to use projected texturing, witch is nice and easy and totaly sux for steep / caved in surfaces.


    There do exist shader keys, and compiling switches for minimizing the effect of great variations in height or depth for projected texturing.

    tZork wrote: ase models are the only real option for complicated terrain / terrain elements if you want to have no / few visible seams and compleate the map in less then a decade.


    Visibility seams are caused by the usage of detail brushes over structural, models equally affected when using the -forcemeta switch.


    tZork wrote: its also to same deal as far as the engine is consernd since forcemata models are broken down just the same way detail brushes are.


    If you allow q3map2 to create a convex set out of a terrain model, the end product will be split in a manner bloating up the .BSP size.

    tZork wrote: if you dont want to use models, dont. But stop puting unsubstantiated propaganda in ppls head. theres no practical reason not to use em.


    There exist two primary reasons for not using models for terrain, the first is the inherent incompatibility of a .ASE model + actual brushes, as if the splitting were to be done during the compile, there would be no method to prevent z-fighting from occurring, and secondly is that face culling cannot be accomplished with a model, or detail brushes.

    What I am encouraging the is the usage of structural terrain, as hint brushes can be utilized to create accurate visibility sectors, and it saves space on having the segregate between the detail terrain with poor lighting and shadows, and the underlying visibility blocking layer.
    TVR [Public Terminal]
    Member
     
    Posts: 27
    Joined: Sat Dec 22, 2007 12:48 am

Sat Jan 31, 2009 6:37 pm

  • This is a very cool tool :D i am using it for my new level ... but there are many "brushes"(?) but its cool with this i can make holes in the surface and delete what i not need :)

    my new level with an island and a underground section and so the island looks as a picture xD

    Image
    User avatar
    Sven
    Alien trapper
     
    Posts: 315
    Joined: Sun Jun 01, 2008 8:38 am
    Location: Berlin; Germany

Sun Feb 01, 2009 2:50 pm

  • Image
    :wink:
    User avatar
    Sven
    Alien trapper
     
    Posts: 315
    Joined: Sun Jun 01, 2008 8:38 am
    Location: Berlin; Germany

Sun Feb 01, 2009 3:05 pm

Sun Feb 01, 2009 6:26 pm

  • Image

    help me im making a house on the top of the mountain and have no idea what rooms?
    only 3 ideas: depod(in progress) , room with "halfsecret" door to the unterground
    and lobby with a bar(i mean a table behind a people stand like in a hotel)

    Image

    if you have a idea make a sketch and scan it please or write down your idea (announcement to everyone :wink: )
    User avatar
    Sven
    Alien trapper
     
    Posts: 315
    Joined: Sun Jun 01, 2008 8:38 am
    Location: Berlin; Germany

Wed Feb 18, 2009 6:33 pm

  • Sorry for the bump, but I would like to know if you could use this tool, open it in GtkRadiant, then "convert" it for doom3 ?

    Thanks for any help, I'm somewhat new to mapping.
    Image
    User avatar
    gjsdeath
    Newbie
     
    Posts: 7
    Joined: Wed Feb 27, 2008 3:51 am
    Location: FL

Next


Return to Nexuiz - Editing




Information
  • Who is online
  • Users browsing this forum: No registered users and 1 guest