2009年1月26日月曜日

Java3D model loader for Google SketchUp

I'm trying to implement a Java3D model loader for Collada 1.4.1 format.
There's an implementation on j3d-incubator project however it doesn't seem that is supporting many functions so that I checked out from their repository and tried implementing additional functions.
When I get some result, I'd like to submit my codes.

For the first step, I tried loading models that were made with Google SketchUp (it's using Collada format) 
As you know, there is a lot of great models on 3D Warehouse and it must be very helpful if you can load them into your java 3d application.

I made a very simple applet to try loading them.
(I sincerely ask you guys to accept my personal signature that is needed to access local files by the applet)


It hasn't been supporting a lot of functions however it is able to load geometry, basic materials (such as diffuse or ambient colours) and simple textures.
Please be careful loading a large file, it might require a huge amount of memory space.

You can also download jar binary archive.
Here's a code fragment to try it. Please refer Java3D object loader usage that you can find on several web sites. 
loader.KmzLoader l = new loader.KmzLoader();
Scene s = l.load(new URL(path));
BranchGroup bg = s.getSceneGraph();
You may also need to adjust camera location or things.
I found out if the model is too large Java3D is not able to handle z buffer orders so then you need to use Transform group to scale it smaller. 
If someone has information on this problem and solution please let me know.

Hope you can enjoy it. :)
When you find bugs or have any requirements, I'd be grateful if you leave messages here.

14 件のコメント:

匿名 さんのコメント...

Looks great!
Are you thinking about sharing the code?

Thx.

Shinobu IZUMI さんのコメント...

Hi, thanx for your comment. :)

I updated a bit to support transparency and some additional functions.
Sharing the code might be nice. Please tell me If you have any idea where to publish my codes.

匿名 さんのコメント...

Well, Java3D would be a good place! :)
https://java3d.dev.java.net/

I know there's an incubator project, but I'm sure they would be glad to see an improved version. How about merging your code to the existing one?

Otherwise, you can zip your code and put it here in your blog; I'm sure you'll get comments and ideas to it soon enough.

Mariano.

匿名 さんのコメント...

Hej, Shiva!
I'm trying to use your code in order to load kmz files to google's open source counterpart World Wind (http://worldwind.arc.nasa.gov/java/index.html), but I have several problems.
It would be really good for the open-source community to have an option to Google Earth, but things like KML support are lagging way behind. Would you like to help me merge your code into World Wind?

Thank you very much,
Mariano.

Shinobu IZUMI さんのコメント...

> Mariano
Thanks for your information. Java3D incubator project would be the good place.
I will be a bit busy untill the end of this week so Im not sure I can publish my code soon.

Also, using in the World Wind sounds great. I'd love to help as posslibe as I can. Please wait 2, 3 days more, I'll up my codes here first.

Regards,
Shinobu

匿名 さんのコメント...

Looking forward to it!

NASA's World Wind uses JoGL direcly, so I don't know how hard will it be to merge it in, considering you make use of Java3D, but I think a lot of people will be happy to help merging things at the WWJ forums:
http://forum.worldwindcentral.com

Thanks again,
Mariano.

Shinobu IZUMI さんのコメント...

hey Mariano,

I uploaded my souce code on the blog and now you can download it.
however, if you are using JOGL why don't you use "jcollada".
http://www.xquaker.com/projects_jc.html
I haven't tried it but it seems pretty good.

Thanks for your messages,
Shinobu

匿名 さんのコメント...

Hi, Shinobu!
I hadn't heard about this JCollada project; it sounds very interesting too.

I'll download both codes, and hope I will be able add KMZ support to World Wind soon enough.

Thank you again for the code!

Take care,
Mariano.

Shinobu IZUMI さんのコメント...

Hi, Mario :)

I'm looking forward to see KMZ files loaded in World Wind.

Good luck,
Shinobu.

yo さんのコメント...

初歩的な質問で申し訳ないのですが、ビルド済みのjarファイルはありませんか?
最近javaをはじめたもので、あまり詳しくなく、大変身勝手な質問ではあるのですが。
よろしければ教えていただけませんか?

匿名 さんのコメント...

Great article and very interesting blog :)

------------------------------------------
Free Poker Money - Free $50 褒奨金

Phil さんのコメント...

Thank you for the source code. I am trying to do something interesting with Java3d.

ありがとうございました!

mygamebest さんのコメント...

At this FFXI GIL point, a white Knight Online Gold flowing Perfect World gold purple Ling, Yu Mian Lip, handsome extraordinary, a Dragonica Gold
black silk-fat Metin2 Yang dish Ragnarok Zeny into a Knight Online Gold bun, the hands of a delicate paper fan, 2Moons Dil full scholar dressed, but refined it Cabal Alz without Flyff Penya losing the charming woman, so that Brothel woman to see her every air of obsession, winks thrown straight, she was mistakenly treated as a handsome son of FFXIV GIL extraordinary Columbia.
"Originally, rumors of Red Allods Gold House Lane, is this look like, and do not have any particular Well!" Purple Spirit freely cast a glance of the much Allods Gold slower to catch, and Jade Dynasty Gold some Jade Dynasty Gold disappointment Road.

Parastoo Delgoshaei さんのコメント...

Thanks for your useful post. Can I have access to your source code please?