The Source for Java Technology Collaboration

Home » java.net Forums » Project Looking Glass 3D » Wonderland & MPK20 Interest

Thread: Create a sample world

Welcome, Guest Help
Login Login
Guest Settings Guest Settings
Reply to this Thread Reply to this Thread Search Forum Search Forum Back to Thread List Back to Thread List

Permlink Replies: 24 - Last Post: Aug 14, 2007 9:23 AM by: ldhung
ldhung

Posts: 24
Create a sample world
Posted: May 31, 2007 2:40 PM
  Click to reply to this thread Reply

After setting the apps for wonderland, I would like to try the next step in setting up the world but I have no clue on how to do this. Please help. I missed the presentation that Paul presented at our company this week but I heard about the sample world and I was asked to try this step.
Thank you

Kirk Turner
Re: Create a sample world
Posted: May 31, 2007 10:40 PM   in response to: ldhung
  Click to reply to this thread Reply

I'm sure Paul et al will be able to give more information about this,
but in the mean time, I've spent some time over the last couple of
days modifying the world to use my own models.

The first point of call is to have a look at the Wiki
(http://wiki.java.net/bin/view/Javadesktop/ProjectWonderland) at the
section about the Extending the world and Content Creation. The
useLocalArt flag wasn't working for me, so I had to serve the content
from my local apache (I added a few more instructions to the wiki for
this).

You then need to create your content and get it into a j3s format
(compile java3d stream). For this you'll need j3dfly
(https://j3dfly.dev.java.net). I think you'll need the latest from cvs
(this is what I used) - because Paul has written a Wonderland plugin
for this. Note Java3D is bundled with wonderland, but you'll need this
to run j3dfly so you will have to change your classpath and
ld_library_path (on linux/solaris) to point to it, or install it in
your jvm, if you haven't already done so.

Create the content with your favourite tool - I was using Blender, but
basically you can use anything that will output into a format
supported by j3dfly (alias, lightwave, x3d, 3ds formats). I was using
Blender -> 3DS (because my x3d export from blender was failing). From
j3dfly import the model (File->Import), then you can export it using
the Wonderland plugin (Plugins->Export to Wonderland). Give it a name,
provide the path to your lg3d-wonderland-art project, and the URL of
your content server. I believe this is used when setting up the
texture information, to provide the reference for downloading the
textures.

Finally you will need to edit some code. Read more on the Wiki about
it, but I just played around with WorldRootCellGLO (this is a server
file, so if you make changes you'll need to restart your server). The
main point of entry is the buildFullWorld() function, if you have a
look and make changes you should be able to get the idea of how things
work. I haven't gone very far here (I was trying to replace the
mpk20-web model - the main building), so I can't give too much advice
here. One thing I did do was change from using the full version to the
default version ( changed WorldType.FULL to WorldType.DEFAULT on line
58 - note this changes the point of entry to buildDefaultWorld()).

Does that give you a point to start from?

Kirk

On 6/1/07, wonderland@javadesktop.org <wonderland@javadesktop.org> wrote:
> After setting the apps for wonderland, I would like to try the next step in setting up the world but I have no clue on how to do this. Please help. I missed the presentation that Paul presented at our company this week but I heard about the sample world and I was asked to try this step.
> Thank you
> [Message sent by forum member 'ldhung' (ldhung)]
>
> http://forums.java.net/jive/thread.jspa?messageID=219818
>


ldhung

Posts: 24
Re: Create a sample world
Posted: Jun 4, 2007 11:43 AM   in response to: Kirk Turner
  Click to reply to this thread Reply

Hi Kirk,

Before creating our own model, I attempted to use the compiled_models and its *.j3s from lg3d-wonderland-art. My question now is how do I interact with the local compiled_models after I cheked out lg3d-wonderland-art, changed to WorldType.DEFAULT and edited my.build.properties?

Thank you

paulby

Posts: 2,068
Re: Create a sample world
Posted: Jun 4, 2007 3:17 PM   in response to: ldhung
  Click to reply to this thread Reply

What do you mean by interact in this context ?

ldhung

Posts: 24
Re: Create a sample world
Posted: Jun 5, 2007 10:59 AM   in response to: paulby
  Click to reply to this thread Reply

I get the problems fixed and am able to change the model. Now I can move forward to the next steps.
Somehow I didn't get the apps running right the first time and couldn't get to the mpk20 models at all.
Thanks to Paul and Kirk very much for your responses.

Kirk Turner
Re: Create a sample world
Posted: Jun 4, 2007 8:43 PM   in response to: ldhung
  Click to reply to this thread Reply

> Before creating our own model, I attempted to use the compiled_models and its *.j3s from lg3d-wonderland-art. My question now is how do I interact with the local compiled_models after I cheked out lg3d-wonderland-art, changed to WorldType.DEFAULT and edited my.build.properties?

This is the part I didn't have so much to do with - basically all I
did was replaced the line
filename="models/mpk20-web.j3s.gz"; of WorldRootCellGLO.java

with my model name (I was creating a new building). There are a number
of examples in the that file showing you how to place terrain objects
and animated objects - the buildFulllWorld method. There is a bit of
a description of each of the cell types on the Wiki as well.

Kirk


ldhung

Posts: 24
Re: Create a sample world
Posted: Jul 24, 2007 8:51 AM   in response to: Kirk Turner
  Click to reply to this thread Reply

I have a model in x3d format. I follow the intructions and try to replace it with the mpk model.
Wonderland can't load it. I try both the compressed and uncompressed.

RedCylinder.x3d: gzip compressed data, from NTFS filesystem (NT)

Below is the log,

[java] INFO: Load Cell 19 org.jdesktop.lg3d.wonderland.darkstar.client.cell.AvatarCell
[java] Bounding box: Lower=45.0 -5.599999904632568 45.0 Upper=55.0 4.400000095367432 55.0
[java] Jul 23, 2007 3:36:49 PM org.jdesktop.lg3d.wonderland.scenemanager.AssetManager$ModelLoader loadAsset
[java] WARNING: Problem loading model models/RedCylinder.x3d

Any suggestions would be appreciated.

ldhung

Posts: 24
Re: Create a sample world
Posted: Aug 9, 2007 9:56 AM   in response to: Kirk Turner
  Click to reply to this thread Reply

I've created several simple models by using blender then imported them into j3s using j3dfly.

- Somehow none of mine works as wondeland's world but I can get every single of the j3s models provided in lgd-wondeland-art (DukeJetPlainSimple.j3s.gz,Location1_LightMap.j3s,SkyBox1.j3s,...) show.
- One thing I notice was that if I rename the good provided model, it would fail.
Please advise.

Kirk Turner
Re: Create a sample world
Posted: Aug 9, 2007 6:32 PM   in response to: ldhung
  Click to reply to this thread Reply

One thing I noticed when doing some tests from blender was that either
blender or j3dfly was doing face culling, and the size of the object was too
large, so that no matter where I loaded it, my avatar would be inside of it.


Try just exporting the basic cube that blender was when you create a new
project and see what happens when you use that - from memory it was about
the size of the avatar, so you had to run forward and look back to be able
to see it (I was replacing the mpk20 world files - so it was in the same
starting position as the avatar).

Also - are you getting any exceptions being thrown when you run it?

Kirk
[att1.html]


ldhung

Posts: 24
Re: Create a sample world
Posted: Aug 13, 2007 10:15 AM   in response to: Kirk Turner
  Click to reply to this thread Reply

I tried basic cube and cone with various sizes. I also changed the tileSize in hope to catch the hidden models.
From what I understand, my models should be in the center of the 4x4 green grid but they never show up. No exceptions seen. The logs are below:
....
[java] AvatarCellMoved (50.0, 1.7, 50.0)
[java] Revalidating CellCache for user2 true
[java] Cell Count 20 Bounds calc time 102 us. Sgs get object time 65458 us.
[java] Entering cell org.jdesktop.lg3d.wonderland.darkstar.server.cell.SimpleTerrainCellGLO@10efd7c cellcache for user user2
[java] Entering cell org.jdesktop.lg3d.wonderland.darkstar.server.cell.SimpleTerrainCellGLO@1d0d124 cellcache for user user2
[java] Entering cell org.jdesktop.lg3d.wonderland.darkstar.server.cell.SimpleTerrainCellGLO@5f2db0 cellcache for user user2
[java] Entering cell org.jdesktop.lg3d.wonderland.darkstar.server.cell.SimpleTerrainCellGLO@195dd5b cellcache for user user2
[java] Entering cell org.jdesktop.lg3d.wonderland.darkstar.server.cell.SimpleTerrainCellGLO@4204 cellcache for user user2
[java] Entering cell org.jdesktop.lg3d.wonderland.darkstar.server.cell.SimpleTerrainCellGLO@e41bc3 cellcache for user user2
[java] Entering cell org.jdesktop.lg3d.wonderland.darkstar.server.cell.AvatarCellGLO@dec8b3 cellcache for user user2
[java] Entering cell org.jdesktop.lg3d.wonderland.darkstar.server.cell.SimpleTerrainCellGLO@e1dac2 cellcache for user user2
[java] Entering cell org.jdesktop.lg3d.wonderland.darkstar.server.cell.SimpleTerrainCellGLO@18f7386 cellcache for user user2
[java] Entering cell org.jdesktop.lg3d.wonderland.darkstar.server.cell.SimpleTerrainCellGLO@1d32e45 cellcache for user user2
[java] Entering cell org.jdesktop.lg3d.wonderland.darkstar.server.cell.SimpleTerrainCellGLO@15d4de6 cellcache for user user2
[java] Entering cell org.jdesktop.lg3d.wonderland.darkstar.server.cell.SimpleTerrainCellGLO@20fa83 cellcache for user user2
[java] Entering cell org.jdesktop.lg3d.wonderland.darkstar.server.cell.SimpleTerrainCellGLO@1a0d866 cellcache for user user2
[java] Entering cell org.jdesktop.lg3d.wonderland.darkstar.server.cell.SimpleTerrainCellGLO@54f9f1 cellcache for user user2
[java] Entering cell org.jdesktop.lg3d.wonderland.darkstar.server.cell.SimpleTerrainCellGLO@1f08ed8 cellcache for user user2
[java] Entering cell org.jdesktop.lg3d.wonderland.darkstar.server.cell.SimpleTerrainCellGLO@57ea52 cellcache for user user2
[java] Entering cell org.jdesktop.lg3d.wonderland.darkstar.server.cell.SimpleTerrainCellGLO@6c1a82 cellcache for user user2
[java] Entering cell org.jdesktop.lg3d.wonderland.darkstar.server.cell.SimpleTerrainCellGLO@718242 cellcache for user user2
[java] Cache revalidate took 101 ms
[java] Aug 13, 2007 10:01:05 AM org.jdesktop.lg3d.wonderland.darkstar.server.ChecksumManagerGLO getChecksumImpl
[java] WARNING: No Checksum for models/cube2.j3s.gz
[java] Aug 13, 2007 10:01:05 AM org.jdesktop.lg3d.wonderland.darkstar.server.cell.AvatarCellGLO addUserToCellChannel
[java] INFO: addUserToCellChannel user ManagedReferenceImpl[oid:29, state:MAYBE_MODIFIED] id 44057c0104554c29
[java] AvatarGLO received JOIN_P2P
[java] AvatarGLO received CELL_MOVE
[java] Revalidating CellCache for user2 true
[java] Cell Count 20 Bounds calc time 126 us. Sgs get object time 38801 us.

paulby

Posts: 2,068
Re: Create a sample world
Posted: Aug 13, 2007 11:48 AM   in response to: ldhung
  Click to reply to this thread Reply

What scale is the model using, in Wonderland 1 unit is 1 meter.

Also what is the origin on the model ? If it's not 0,0,0 then it will not appear in the correct place.

If you email me the j3s file I can take a look.

Rgds

Paul

PS We should be starting work soon on some tools that make it a little easier to import models. Nothing too fancy, but a big improvement from the current state.

paulby

Posts: 2,068
Re: Create a sample world
Posted: Aug 13, 2007 2:35 PM   in response to: paulby
  Click to reply to this thread Reply

Another quick thing that you might want to try is to print out the Java 3D bounds of the model you have loaded. That will tell you the scale and origin.

ldhung

Posts: 24
Re: Create a sample world
Posted: Aug 13, 2007 2:50 PM   in response to: paulby
  Click to reply to this thread Reply

I'm not sure how to print out the Java 3D bounds as you mentioned.
I check for the scale and origin within blender. Mines show the scale of 1 and origin of 0,0,0.
I sent two attachments but am not sure if the mail goes through though.

Thanks

paulby

Posts: 2,068
Re: Create a sample world
Posted: Aug 13, 2007 3:19 PM   in response to: ldhung
  Click to reply to this thread Reply

Hi Lieu,

I got the cube in world using the following steps

Copy cube.j3s.gz to lg3d-wonderland-art/compiled-models/models
cd lg3d-wonderland
edit my.build.properties and add the following line wonderland.useLocalArt=true
edit WorldRootCellGLO and change the model load line in the method addJavaOneModel to
appGLO = new ModelViewerCellGLO(bounds, orig, "models/cube.j3s.gz");

The cube will then appear to the right of the initial avatar position, near the large glass windows.

Cheers

Paul

ldhung

Posts: 24
Re: Create a sample world
Posted: Aug 14, 2007 9:23 AM   in response to: paulby
  Click to reply to this thread Reply

My problem was that the source was not up-to-date (1 month old). With the latest release and your help, it works.

Thank you much for your help

ldhung

Posts: 24
Re: Create a sample world
Posted: Jun 1, 2007 11:21 AM   in response to: ldhung
  Click to reply to this thread Reply

Hi Kirk,

Yes, this is a very good starting point for me. I'll start working on this next week.
I appreciate your help and your time.

Thank you
ldhung

paulby

Posts: 2,068
Re: Create a sample world
Posted: Jun 1, 2007 1:02 PM   in response to: ldhung
  Click to reply to this thread Reply

Thanks Kirk, that is a great write up of the current process.

This is a horrible set of steps which we will be improving as we move forward. Here are the things I'm planning in the short term

1) Describe the world as a series of xml files, replacing the bulk of RootWorldCellGLO
2) Allow models to be loaded and positioned in the wonderland client and then exported into the
lg3d-wonderland-art project. Along with the xml description of the new content.
3) Dynamic loading of new content by the server

It will be a little while before I get to this, my highest priority is making installation/startup easier and setting up the first public server for some (small scale) testing.

ldhung

Posts: 24
Re: Create a sample world
Posted: Jul 25, 2007 9:38 AM   in response to: paulby
  Click to reply to this thread Reply

Do models have to be in j3s format in current modules? I try a model in x3d and it fails to load.
Thanks

Kirk Turner
Re: Create a sample world
Posted: Jul 25, 2007 9:38 AM   in response to: ldhung
  Click to reply to this thread Reply

I believe so. If you run j3dfly you can import form x3d and export in j3s
format (I gave a bit more detail in this thread). This was the way I got my
changes working.

Kirk
[att1.html]


paulby

Posts: 2,068
Re: Create a sample world
Posted: Jul 25, 2007 2:04 PM   in response to: Kirk Turner
  Click to reply to this thread Reply

Models have to be in the j3s format. As Kirk says J3dFly will help you convert from x3d (or 3ds) into j3s. There are a number of reasons we do this

1) Performance, j3s is an 'image' of the Java 3D graph therefore we don't need to process the geometry at load time
2) Size, j3s is a binary format and takes less network bandwidth than a text based format

The one exception to this is the avatars, these currently load from rtg model files, we will fix this in the future to avoid the geometry stripification etc that happens as the avatars are loaded.

ldhung

Posts: 24
Re: Create a sample world
Posted: Jul 25, 2007 10:37 PM   in response to: paulby
  Click to reply to this thread Reply

Thank you much for your responses.
I have another question regarding j3dfly.
The version of j3dfly I downloaded is 2.0_beta. This doesn't
have x3d loader. From what I read in loaders.xml, I need to get a loader for X3d which is file lg3d-wonderland-client.jar. I searched but can't find one.
Please let me know:
1. Is lg3d-wonderland-client.jar an X3d loader?
2. If so, where can I get it?

Thank you much.

Kirk Turner
Re: Create a sample world
Posted: Jul 25, 2007 11:07 PM   in response to: ldhung
  Click to reply to this thread Reply

I'm not sure of the current versioning, so I don't know where 2.0_beta sits
relative to the latest - Paul can probably give a better indication here,
but I built J3DFly from the latest CVS sources and that contains the
wonderland plugin required for exporting to the correct format.

If you go to the 'Plugins' menu is there an 'Export to Wonderland' option?

Or is the problem that you can't import your X3D that you've created? (What
are you using to create the models?)

Kirk
[att1.html]


paulby

Posts: 2,068
Re: Create a sample world
Posted: Jul 26, 2007 1:27 PM   in response to: Kirk Turner
  Click to reply to this thread Reply

The latest is only in CVS, sorry.

ldhung

Posts: 24
Re: Create a sample world
Posted: Jul 27, 2007 12:09 PM   in response to: Kirk Turner
  Click to reply to this thread Reply

>I'm not sure of the current versioning, so I don't know where 2.0_beta sits
>relative to the latest - Paul can probably give a better indication here,
>but I built J3DFly from the latest CVS sources and that contains the
>wonderland plugin required for exporting to the correct format.

I checked out the CVS version so I assume that is the latest version. (I thought 2.0 is latest though).

>If you go to the 'Plugins' menu is there an 'Export to Wonderland' option?

Yes, I see this option but I can't import the file before I can use the export option.

>Or is the problem that you can't import your X3D that you've created? (What
>are you using to create the models?)

Correct. There isn't a file extension for x3d in the Loader Configuration and when I try to seelct either Load or Import, I get an error "No Loader for File format" which hints me to look for the x3d loader.
Another team member working on this project uses Flux Sudio to make the model. Should we use Blender as you mentioned ealier or any recommended modeler(s)?

Thank you

ldhung

Posts: 24
Re: Create a sample world
Posted: Jul 27, 2007 4:55 PM   in response to: ldhung
  Click to reply to this thread Reply

I got the j3dfly works in importing/exporting my x3d models with the pluggins. Don't know why it didn't work before, it just simply works on my last try.
Thank you so much




 XML java.net RSS