Check out my earth applet

Hey guys. Kit the newbie here.

I just wanted to invite you all to take a look at the applet I’m working on. I am new to Java 3D (heck, 3D in general), and will be learning it as I work on this.

Right now, my applet displays a small model of the earth, using a public-domain NASA texture, and code modified from one of the Sun tutorials. You can use your right or left arrow keys to rotate the globe.

What do I want to do next? Here’s the main list:

  • Add the ability to zoom in or out
  • Add multiple levels of detail, maybe about 5 or so.
  • Add ability (with keystroke, probably) to “reset” the globe to default size/orientation.
  • Allow quick zoom (to next closest LOD) by clicking on the globe
  • Have the globe report longitude/latitude on screen as mouse passes over the terrain.

Once I have the interface working pretty well, I want to start connecting it to a database on the back end. This will involve:

  • Being able to use some kind of pointer to select a certain point on the globe (ie, longitude/latitude).
  • Ability to navigate to a certain point by typing in coordinates.
  • Ability to then open a new window to enter information about that point.
  • Pass the information into the db (PostgreSQL).
  • Conversely, when navigating the globe, one might be able to query the db to show current data.
  • Possibly add different layers of texturing, with ability to decide what is shown - cities, national boundaries, etc.

This is going to be the interface to a historical db on the backend. It’s not exactly a game, and it’s going to take forever to get it working right, but as I progress, you might find something of interest there. I will probably never have more than a few 3D objects on screen at once (the globe, a pointer, some text), so I’m going to try to focus on optimization and overall smoothness and “polish”. Of course, if you have suggestions or want to see the code as I go along, that’s cool, too.

So, anyway, just an introduction. We’ll see if I get anywhere with it. ;D

You can find the applet at www.the-athenaeum.org/javatest/earthtest.php

A fps counter would be a nice addition.

Hi,

bad news: I checked it, but it has thrown a java.lang.Nullpointerexception right into my face. :frowning:

Yah, long live java3d, right?

No, seriously, I was working on getting some keyboard zooming going, but ran into a few issues, and (stupid me) I didn’t have the old file. So, for now, it doesn’t work. (I think I have a message on the site stating that it doesn’t.)

I have been crazy busy with school, so I haven’t had time to fix it, which I think is going to require ditching the SimpleUniverse and learning how a more generic VirtualUniverse works. The main problem I was having involved getting the right context so that I could modify the position of the viewer’s eye. When I have a little more time to get back to it, I figure it out, post some code, and get it back online.

Sorry for the delay. THere will be more, I promise.

  • Chris

Java3d is great for rendering planets, our solar system,
and other planetary related things like the Nasa’s Mars Robotic
Explorers … and Nasa has VRML models of them you can
render with Java3d using the Sun VRML Loaders
which give you the ability to translate, rotate & zoom around
and VRML can contain animation including multiple
solar bodies rotating around each other.

Web3d.org has a image mapped 3d Earth model
in their “Hello World” introductionary VRML world:

http://www.frontiernet.net/~imaging/vrml_loaders_working.html
|
http://www.web3d.org/TaskGroups/x3d/translation/examples/HelloWorld.wrl
|
http://www.web3d.org/TaskGroups/x3d/translation/examples/HelloWorld.html

Nasa using VRML & Sun’s VRML Loaders

http://www.frontiernet.net/~imaging/terrain_rendering.html
|
http://www.frontiernet.net/~imaging/shout3d/models/planetary_earth_moon.wrl

^-- renders with Java3d, & see it rendered with Java 1.1 engine
in your browser ( with Shout3d.com’s engine )

Nasa’s Fastscript3d Java program uses VRML

Nasa’s “FastScript3d” Java + VRML + Scripting" program
|
| More demonstations ( with source code ) of
| Nasa’s Java3d with Javascript extensions
| Earth, rotating ( top left, above )
| Space craft with movable solar panels ( top right, above )
| JavaScript Companion to Java3D ( Announcement to
| Java3d-interest list by Patti Koenig from Nasa / JPL )
|
http://fastscript3d.jpl.nasa.gov/gallery.html
|
http://www.frontiernet.net/~imaging/terrain_rendering.html

— I got an error running your program —

NullPointerException Stack dump:

Attempt to load texture from url: http://www.the-athenaeum.org/javatest/earth_texture.jpg
Connecting http://www.the-athenaeum.org/javatest/earth_texture.jpg with no proxy
Connecting http://www.the-athenaeum.org/javatest/earth_texture.jpg with cookie “PHPSESSID=d19…”
Loading http://www.the-athenaeum.org/javatest/earth_texture.jpg from cache
java.lang.NullPointerException
at EarthAppWeb.createSceneGraph(EarthAppWeb.java:115)
at EarthAppWeb.(EarthAppWeb.java:142)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
at java.lang.Class.newInstance0(Class.java:306)
at java.lang.Class.newInstance(Class.java:259)
at sun.applet.AppletPanel.createApplet(AppletPanel.java:566)
at sun.plugin.AppletViewer.createApplet(AppletViewer.java:1770)
at sun.applet.AppletPanel.runLoader(AppletPanel.java:495)
at sun.applet.AppletPanel.run(AppletPanel.java:292)
at java.lang.Thread.run(Thread.java:536)
Exception: java.lang.NullPointerException

– Paul

I know it’s broken; I haven’t been able to work with it for several weeks. But now that my exams are over, I’m hoping to get back to it. Thanks for the ideas and code.

I’ll let you guys know if I figure it out…

  • Kit