Tuesday Feb 02, 2010

jMonkeyEngine Documentation contest (2)

So yeah well... I didn't submit my tutorial to the jME documentation contest after all (I was on an island without wifi -- don't ask), and nobody else submitted anything either, quite sad. The whole event happened at quite short notice and over the winter break, maybe nobody felt inspired to work. ;)

Anyway, here is my Terrains, Heightmaps, and Texturing article. I haven't fully written the section about terrain texturing yet, I'm still looking for the optimal combination of settings (texture units + texture size + procedural textures). But the tutorial already covers heightmaps and terrain generation and loading.

When I worked with terrains the first time, I kept adding translation constants and shifted and scaled them, all to get an intuition for how big they were, and where they would be rendered, compared to smaller models I loaded. Some terrains ended up being rendered smaller than expected, others bigger; some looked clear and smooth, and others blurry and angular; some were floating "in mid air" and others stuck to the "floor" (the x/z plane) or in a faraway corner. No details in the javadoc either. How mysterious. (Note to self: Get developer permissions and add javadoc!)

So I sat down and tried to find out: How does the terrain's heightmap size map onto world units? I have to scale every terrain (you will notice that, by default, they are too steep), is there maybe one obvious factor I can apply that makes them look more natural? What is the default position and size for a freshly loaded terrain anyway? And what is it after scaling? And lastly, how do I calculate the right values for the texture intervals in a procedural texture?

Since it's impossible to judge distances in the empty space of a 3D-scenegraph, lots of trial and error ensued: I created long white boxes (1\*1\*256) around the origin, to mark the x/y/z axes. I also marked points such as (128,128,128), (255,255,255), (0,0,255), etc with AxisRod objects. Finally, when looking at the terrain rendered next to these markers, the pattern behind heightmap values and world units became clear. When I now create a landscape with a water surface, I can predict which part of the terrain will be under water, and adjust the procedural texture accordingly. No blooming meadows on the sea floor anymore! :)

Next stop: Decreasing the blurriness of my terrain textures. Am I supposed to use the same detail texture on the whole terrain, or can I have several? If you have any best practices regarding jME texturing, please leave a comment. :)

Tuesday Jul 28, 2009

Creating Java 3D Games with NetBeans

While taking a few days of vacation (before coming back in time for the release of NetBeans 6.7.1!) I finally got my jMonkeyEngine notes and files in order. If you don't know it yet: The jMonkeyEngine (jME) is a free and open-source 3D engine for creating 3D games and simulations in Java.

(I would have blogged about it earlier, but the project is moving servers in July... So if the links below should change again and break, search the web for "jmonkeyengine" and then search within the page...)

If you have never seen it before, these jME videos and demos show best what you can do with Java3D nowadays.

I had created a simple 3D world with jME 1.0 and started migrating useful elements to jME 2.0 -- which is well doable despite a few API changes, especially since NetBeans marks the broken lines, fixes the import statements, and I can get the new syntax from the code completion popup. Here are my notes that I shared on the jME wiki:

  • General jMonkeyEngine beginners FAQ -- Those are my questions and answers that I found. I just updated it for jME 2.0 and will be filling in more stuff as I go along.
  • jMonkeyEngine + NetBeans Tutorials -- I created this index page because I noticed that several authors had started writing jME+NetBeans tutorials for various versions! Thanks to the community for covering this so well.
  • Setting up NetBeans 6.7 for jME 2.0 -- This is my jME tutorial contribution. Maintaining the native libraries and JARs is easier now with NetBeans 6.5 (or higher). I also mention Maven briefly, and how to wrap up a whole project (JARs and native libraries!) into one distributable JAR file (using OneJar), and how to make this distributable java application startable in a user-friendly way.

There is probably more to be said about distributable JAR files, but OneJar solves my current questions. If you figured out how to get native libraries into a webstartable JNLP file, leave a comment. This blogger here has some more tips regarding JNLP signing and where to place the native libraries, so this is my next lead to investigate. But first I need to get my rusty 3D app going again--taking into account the new stuff I've been reading about programming patterns lately, suddenly my old class structure looks quite... sub-optimal. ;)

PS: updated links to stable jmonkeyengine.com URLs.

Wednesday May 28, 2008

Developing Java ME on Mac

As Karel already mentioned a few weeks ago, the Mobility pack can also be used on MacOS. (The mobility pack is written in Java and does run on Mac OS, but there is no current official WTK and no emulators for Mac OS, so netbeans.org never offered this download option.) Since people asked about it, I tried to install the third-party SDK and emulator and ran a sample app, and ta-daa, it worked. :) Here are a few "Doh!"s I came across, I'll write them down in case somebody else has the same questions.

  1. Installing NeBeans Mobility pack for Mac
    • There is no download explicitly labeled "Mobility pack of NetBeans for Mac OS" or so on the NetBeans Installer page. Instead you download any other Java edition for Mac OS, for instance the Java SE edition. (Or use the one you already have.)
    • Then you go to the Tools>Plugins menu, and install (at least) these two plugins: "Mobility" and "Visual Mobility Designer" (you can also install other items you need).
    • In other words, don't look for a plugin explicitly called "mpowerplayer" or so. The Mac integration is part of the normal "Mobility" plugin now.
  2. Installing mPowerPlayer
    • Next download the SDK for Mac OS -- click the "Get the SDK: Download..." link.
    • Then download the emulator for Mac OS -- click the "free download" button.
    • Remember the directory where you downloaded the stuff to. :-) The SDK is saved as mpp-sdk, the emulator is called mpowerplayer.app. I copied them into the "/Applications/" directory.
  3. Telling NetBeans where to find the JavaME platform
    • Go to the IDE's platform manager (Tools menu) and add the mpp-sdk as a "Java MIDP Platform emulator". (If needed you can get more details how to do that on the FAQ).
    • When you now create a new Mobile project, the MPowerPlayer SDK and QVGA device will show as options.
  4. Limitations?
    • You cannot use the CDC framework yet, this implementation is only meant for CLDC/MIDP.
    • You get a working emulator together with mpowerplayer, but it's only one. This is because emulators are released by phone companies, but they never released any for Mac OS. So you have to go back to a PC (e.g. on a virtual machine) to get one emulator for each type of phone if you want to do any serious crash-testing of your mobile apps.
    • Tip: Instead of using different emulators, you can test the app on actual devices that you have. Use the help menu in the IDE and search for "deploy to mobile device" to learn more, but some devices don't come with software to connect to Mac OS, so you may be out of luck.

Wednesday Mar 26, 2008

Donnerstag: Software Quality Environment für NetBeans


Sven Reimers spricht über SQE - ein Software Quality Environment für NetBeans

Sven leitet die Entwicklung des Open Source Projektes SQE, das Software Quality tools wie FindBugs, PMD, CheckStyle, Lint4j und Dependency Finder in die NetBeans IDE integriert und es geht das Gerücht, dass Sven eine sehr interessante Ankündigung im Gepäck hat :-).

Für die besten Fragen und Diskussionsbeiträge gibt es gibt wieder T-shirts. Sven ist auch ein absoluter Experte was Rich Client Platform-Entwicklung mit der NetBeans Platform angeht, also nutzt die Gelegenheit auch für Fragen zu diesem Thema. Hier gibt es ein Exemplar von Geertjan's Buch zu gewinnen.

Anschliessend Diskussion und NetBeans Stammtisch.


Donnerstag, 27.3.2008, 18:30Uhr


Genomatix Software GmbH
Bayerstr. 85a
80335 München

Friday Dec 14, 2007

JDKs for MacOS?

Yesterday, Apple released a JDK update! :-)
... for JDK4 and JDK5. \*sigh\* :-[

Let's hope the update does something useful. The "more info" link offered by the Software Updater in the German locale was a 404. I searched the Apple support center and only came up with this English info page (which alas doesn't contain more info, but repeats what I already knew, "it's an update").

Also this week, Apple felt compelled to release a little article about Java and Mac OS 10.5 (Leopard). Don't hold your breath. As much as I appreciate Apple improving their Java profiler, and adding support for 64-bit apps, yadda yadda, it's still a pity the whole article says no word about the Apple JDK 6. \*sigh\* It doesn't even contain the number 6. \*SIGH\* (Although it contains the digit 6. I checked.)

I still have the JDK 6 Dev Preview released by the Apple Dev connection (a download which seems now gone from the ADC.) Why does Apple develop their own JDK? They do it so they can add these guys to it. (Why they do it so slowly, I don't know.) If you want to know what Java on the Mac looks like without those typical controls, have a look at this BSD port of JDK6 for Mac OS 10.4 and 10.5: Soy Latte JDK 6.

You can download SoyLatte into any directory you like, then expand it (I used bunzip2 soylatte16-i386-1.0.tar.bz2 and tar -xf soylatte16-i386-1.0.tar in the Terminal), and then symlink to it from /System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home, so NetBeans can find and identify it as a JDK in the Java Platform manager. Afterwards don't forget to go to the properties of the project you want to use it with, and switch it to use the SoyLatte Java platform.

It seems to make sense to place SoyLatte in the /sw/ directory, but if you save it to a directory in your home dir instead, then you can compile and run the demos and samples that come with it as normal user. I do have X11 installed, but I haven't figured out how I can make NetBeans run the demos directly in X11, although it readily recogizes the projects as netbeans projects. (If you figured it out, leave a comment.) If I run the samples from the commandline in the X11 terminal, they don't look pretty ;-) (as expected), but they work well.

In case you like SoyLatte so much that you want to get rid of the developer preview jdk, read Joshy's blog.

PS: Two people asked recently, so if you don't know either how to set up the javadoc popups in netbeans, here's an 'F'AQ answer to you.

Weihnachtsgeschenk fuer NetBeans-Fan gesucht?

Wie Ihr wisst, gibt es ja schon schon ziemlich viele NetBeans-Bücher auf Englisch und anderen Sprachen. Und wie steht es mit deutschsprachiger Literatur? Hier ein kleiner Überblick:

Wow, nette Sammlung! Hoffe ich habe keines vergessen. Also, falls Ihr Euch noch was zu Weihnachten wünschen wollt... :-)


NetBeans IDE, Java SE and ME, 3D Games, Linux, Mac, Cocoa, Prague, Linguistics.


« September 2016

No bookmarks in folder