Raydium 3D Game Engine

Official forum for everything about Raydium, ManiaDrive, MeMak, ...
It is currently Tue Dec 03, 2024 1:57 pm

All times are UTC




Post new topic Reply to topic  [ 15 posts ] 
Author Message
PostPosted: Tue Dec 08, 2009 5:16 pm 
Offline

Joined: Sun Oct 09, 2005 10:46 pm
Posts: 759
Hello,

You probably know Sketchup 3d models

And now you can have this:
Image
thanks to tsa

And this:
Image
from best-lemming

Or this:
Image
from zt2fan

And even this:
Image
from moom

All is done with a php script.
You need only a kmz file. Google sketchup can generate (export) such kmz files.

Run php script from embended application. (1) kmz is uncompressed. (2) Texture are "automaticaly" converted to tga (need to add gd2 extension to php (see php.ini)) (3) .tri file is generated.

BUT due to a probably misuse of php script become quite slow for bigs objects. If a php specialist have an idea ?

Feedback welcomes.

BE REALLY CARREFULL: google sketchup file are very heavy, lot's of vertex sometime simple objects. Needed to be used with attention, Sofa resulting .tri file is for example 27Mbyte file (cocorobrix is less than 3Mbyte!!!!!).


Attachments:
File comment: php script and test program.
Switch mode with right mouse button.

collada_2_tri_v4.zip [6.04 KiB]
Downloaded 6284 times
Top
 Profile  
 
PostPosted: Tue Dec 08, 2009 10:27 pm 
Offline
User avatar

Joined: Sun Mar 16, 2003 2:53 am
Posts: 2593
Location: gnniiiii (Scrat)
A fennec ! \o/ Sweeeeet ! :)

Having a look at the code, it seems that kmz is some sort of archive with collada mesh inside ? Am I right ? Strange it's not a very known fact ...

Quick note : There's a few annoying windows only paths in the file ("\\") making that script failing here, should use good old sanitized standard polished stable recognized POSIX paths :)

About speed, the only thing I can say is that PHP isn't as good about memory management as a compiled language ... While working on DirectX-to-tri PHP script, I've seen incredible things ... For instance, on the first version of the script, I was using global variables and references (&), to simplify work for PHP (no need to copy parameter for functions). Even with this, the script was damn slow. Almost by error, I've moved to regular (copy) parameters for functions, and the script suddenly increased its speed by 10x ! The only thing I've learned then is not that you should use parameter by copy, but that PHP is simply out of any logic when it comes to (big) memory management.


Top
 Profile  
 
PostPosted: Fri Dec 11, 2009 10:50 pm 
Offline

Joined: Sun Oct 09, 2005 10:46 pm
Posts: 759
Here is it !!!

Attachment:
test_kmz.zip [5.95 KiB]
Downloaded 6112 times


This new version of the script is now quite as faster as light.

Using Xpath can speed up things a lot.

Enjoy sketchup.

Waiting for validation before commiting.

Have a nice day.
Ouille


Top
 Profile  
 
PostPosted: Sat Dec 12, 2009 4:37 pm 
Offline
User avatar

Joined: Sun Mar 16, 2003 2:53 am
Posts: 2593
Location: gnniiiii (Scrat)
What's the precise relation between Collada and Kmz ? I think this demo can be added in the "contrib/" directory, as an example about how importing .kmz files, more than some sort of "official support" for this format that may confuse users. Am I wrong ? (or even clear :)


Top
 Profile  
 
PostPosted: Sat Dec 12, 2009 7:19 pm 
Offline

Joined: Sun Oct 09, 2005 10:46 pm
Posts: 759
Hello,

Kmz is a zip file with model as collada file and texture as image(jpg/png ...) in at least two different folders.

I think that adding test_kmz.c to "normal" raydium dir is a way to handle sketchup files. Leaving his name (test_kmz) is explicit no ?

contrib dir will break all relative path for building app quite easily, except for me ;) I'll have to maintain a new project file and others things like this.

As you want.

About official support, i think that the biggest part about collada / kmz support is done now.

There are probably lot's of things to add, but overall is here i hope so.

Have a nice day.
Ouille.


Top
 Profile  
 
PostPosted: Sun Dec 13, 2009 1:42 pm 
Offline
User avatar

Joined: Sun Mar 16, 2003 2:53 am
Posts: 2593
Location: gnniiiii (Scrat)
Here's the point: IMHO, the "root" directory of the trunk is supposed to show demos, example, sample applications and official tools (JPGS generation, atm_gen.c, cam.c, ...)

If you think this code can fit in one of these categories, then let's add it to the trunk :)

To do so, here's what should be done IMHO:
- comment at the top of test_kmz.c should be changed
- comment at the top of collada_2_tri.php is missing (even a very simple one)
- the application should be a little more explicit about its role, using a short text at the top, or a title somewhere, ...
- needs error checking (giving a non-existing file shows no particular error, for instance. Same seems to apply when the file type is unknown.)
- C and PHP files should share the same name, so the user understand the link between the two files
- (remove GCC warning: ambiguous ‘else’ at line 43)
- http://sketchup.google.com seems to provide mostly "skp" files. How should I do ?

I think you see my point: currently, this code is not easily usable to the user to be provided as a tool or a demo, so the two choices I see are :
- we see this as a "proof-of-concept", and plance it in the contrib dir.
- we upgrade this as a tool, polishing it and thinking about how the user will see it and use it.


Top
 Profile  
 
PostPosted: Tue Dec 15, 2009 8:51 pm 
Offline

Joined: Sun Oct 09, 2005 10:46 pm
Posts: 759
Hello,

And now ....
Attachment:
File comment: New version of kmz to tri
kmz_2_tri.zip [6.72 KiB]
Downloaded 6078 times


What about this new version ???

try to respect all guideline. Is ti ok ?

Have a nice day.
Ouille.


Top
 Profile  
 
PostPosted: Thu Dec 17, 2009 8:22 pm 
Offline
User avatar

Joined: Sun Mar 16, 2003 2:53 am
Posts: 2593
Location: gnniiiii (Scrat)
Still a few points:

- itoa() is not a standardized function, therefore not available on every platform. Linux does not provides it, for instance :)
- gcc warning: kmz_2_tri.c:59: warning : suggest explicit braces to avoid ambiguous ‘else’
- still a lot of missing error checking (about files at least) in the PHP file. Since I'm not able to get a proper kmz file (I think ... see the next point), I've still the console flooded by messages like:
Code:
Raydium:
Warning: fgets(): supplied argument is not a valid stream resource in /home/xfennec/opengl/kmz_2_tri.php on line 588                                                   
Raydium:
Warning: feof(): supplied argument is not a valid stream resource in /home/xfennec/opengl/kmz_2_tri.php on line 586


Same story when I try to open a non existing file, it leads to a crash.

While talking about this, I'm not sure to understand convert_xml_iso()'s goal. It does not sounds very XML, am I wrong :)

Last point, as said in my last post:
Quote:
http://sketchup.google.com seems to provide mostly "skp" files. How should I do ?


What is the link between these two formats ?


Top
 Profile  
 
PostPosted: Sat Oct 30, 2010 9:40 pm 
Offline

Joined: Sun Oct 09, 2005 10:46 pm
Posts: 759
Hello,

here is a newer version, most of corrections where dones, but i don't know why i forget to post results :(

- no more itoa
- added braces
- filename tests, one small correction in php. And error handling in raydium application. I hope it's enough.

- no more crash if file doesn't exist

-convert_iso_xml: it's really ennoying. If the xml header of the file, is type of utf8 it is not parsed correctly by xpath. I don't know why. I've searched why, and i still don't know. I propose this small "hack" it allow script to work. I hope next version of php handle this correctly, or some one help me to understand why.
My sketchup generated kmz file are ok, but getting some file from internet raise the problem.

- skp file are sketchup files. kmz file can be generated by skectchup, in file->export.

Last but not least, this script is a collada parser. And collada file format is quite well supported now. So even if it is not used for sketchup it can be usefull for collada translation.

Here is the last version. Can you make some tests ... and if it's ok i'll like to add thoses files to raydium "official" directory.

Have a nice day.
Ouille


Attachments:
File comment: october version of raydium application and php script to convert sketchup/collada file to raydium .tri file format.
kmz_2_tri.zip [6.83 KiB]
Downloaded 6081 times
Top
 Profile  
 
PostPosted: Tue Nov 02, 2010 12:17 am 
Offline
User avatar

Joined: Sun Mar 16, 2003 2:53 am
Posts: 2593
Location: gnniiiii (Scrat)
(very) Quick test under windows:

- I'm unable to open kmz files :( (see below for verbose log)
- Test for gd is wrong (generates an syntax error when extension is not present) . And we should perhaps include gd in our PHP distribution ?
- You should rework a bit your (interesting) help message, in the application:
"in Sketchup export file in .kmz format" -> ?
"Are now in your writable directory" -> "are now created in your writable directory" ?
remove obvious states: "Enter name and click Load" and "You can specify an output mesh scale", the application is self explaining on this.
add the fact that it supports other file format ? (dae, for instance, no ?)

This is a tiny change, probably, but all this should be simple and clear for the newbie :)

kmz error: (sorry, I had no time to investigate more)
Code:
kmz_2_tri: Converting: test.kmz
kmz_2_tri: Working temp dir:C:\Users\Xfennec\AppData\Local\Temp

Warning: fopen(C:\Users\Xfennec\AppData\Local\Temp/kmz/models/test.dae): failed to open stream: No such file or directory in C:\data\raydium_bordel\raydium_win32_ide_sdk_1025\bin\kmz_2_tri.php on line 586


I'll also try all this with Linux ASAP.

Apart from these points, it looks close to a final state !


Top
 Profile  
 
PostPosted: Tue Nov 02, 2010 10:25 pm 
Offline

Joined: Sun Oct 09, 2005 10:46 pm
Posts: 759
Hello,

Let's try again ...

Now just select your kmz file in the combo menu. Hope your kmz file and this program are in same directory.

To create kmz file in sketchup goto file-> export -> 3d model -> google earth file format.

Click on load ... and i hope ... this time .... perhaps ...

About my message i think that your note is a bit ironic no ?

Just say what you think it must contain, i'll follow the guideline.

This is still a working version.

Have a nice day.
Ouille


Attachments:
File comment: kmz_2_tri with direct file selection.
kmz_2_tri.zip [8.21 KiB]
Downloaded 5907 times
Top
 Profile  
 
PostPosted: Thu Nov 18, 2010 1:38 am 
Offline
User avatar

Joined: Sun Mar 16, 2003 2:53 am
Posts: 2593
Location: gnniiiii (Scrat)
Just a quick note on this subject (or I will forget it :) ) after talking with ouille on this point: we need to work a little bit on error checking: my kmz file is not correct, that why I had all these error lines I talk about in my last post, and the script should report this issue.


Top
 Profile  
 
PostPosted: Sat Oct 12, 2013 8:18 pm 
Offline

Joined: Fri Oct 11, 2013 4:41 pm
Posts: 2
Hi , I tried your script but when I try to run it I get a 'don't send error'

Is there any other way to export .kmz files to .tri or any model files to .tri (without blender because my computer has some problems with that program )


Top
 Profile  
 
PostPosted: Sat Oct 12, 2013 10:56 pm 
Offline
User avatar

Joined: Sun Mar 16, 2003 2:53 am
Posts: 2593
Location: gnniiiii (Scrat)
Long story short: Blender is THE tool for Raydium. You'll have hard times to get anything modeled/imported into Raydium without it.

You should really try to fix your Blender issues on your computer !


Top
 Profile  
 
PostPosted: Sat Oct 26, 2013 10:59 am 
Offline

Joined: Sun Oct 09, 2005 10:46 pm
Posts: 759
Hello,

Please post your file. I'll have a look.

Have a nice day.
Ouille.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 15 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group