Sketchup exporter for Ogre

The place for artists, modellers, level designers et al to discuss their approaches for creating content for OGRE.
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 66
Contact:

Post by sinbad »

It's in CVS as ogreaddons/sketchupexporter . Please email me your Sourceforge account name and I'll give you commit access to it there.
ggunhouse
Kobold
Posts: 28
Joined: Tue May 17, 2005 2:10 pm
Location: Atlanta, Georgia
Contact:

Post by ggunhouse »

Version 1.01 works well for me. The church model exports with all the textures showing correctly. Thanks a lot.
Glenn
ggunhouse
Kobold
Posts: 28
Joined: Tue May 17, 2005 2:10 pm
Location: Atlanta, Georgia
Contact:

Post by ggunhouse »

I just discovered that Sketchup can import chunks of terrain from Google Earth.
Instructions on how to do that are at:
http://sketchup.google.com/support/bin/ ... swer=36241
Here's a screenshot of a chunk of the Grand Canyon imported into Sketchup from Google Earth (together with the black-and-white satellite image of the same location), then exported as an OGRE mesh and viewed with Blink 3D:

Image
Glenn
User avatar
Kojack
OGRE Moderator
OGRE Moderator
Posts: 7157
Joined: Sun Jan 25, 2004 7:35 am
Location: Brisbane, Australia
x 534

Post by Kojack »

Hehe, cool. Now if there was just a way to get coloured textures from google earth...

(maybe there is, I haven't tried. It's always grey scale for me)
ggunhouse
Kobold
Posts: 28
Joined: Tue May 17, 2005 2:10 pm
Location: Atlanta, Georgia
Contact:

Post by ggunhouse »

You can capture the color satellite image separately, and substitute the color version for the black-and-white image imported by Sketchup. I'm not sure that Google wants us doing this. The images are copyrighted, after all. Here is an example, for the sake of discussion (image and terrain imported to Sketchup, exported as an OGRE mesh, and viewed in Blink 3D).

Image
Glenn
Hildegaard
Gnoblar
Posts: 11
Joined: Wed Aug 02, 2006 6:24 pm

Post by Hildegaard »

[edit]

found the problem, sorry for posting
nicolasc
Gnoblar
Posts: 1
Joined: Tue Sep 12, 2006 9:35 am

Sketchup Exporter

Post by nicolasc »

Hi, I'm currently trying to make an exporter from Sketchup to Subdo (I have jsut finished a skp importer for subdo using their skpreader.dll

But I really have problems making my exporter dll with (typelibs, etc..) and i request some help since you managed to write your own ogre exporter...


thanks for any help.


nicolasc..lost french guy :)

ps: where can I find any infos to write ogre import/export with subdo by example? it could be fun...
Trentin
Gnoblar
Posts: 13
Joined: Mon Jul 31, 2006 7:08 pm

Post by Trentin »

Are there any plans to add DotScene support?

I would love to see the exporter exporting sketchup conponents as Ogre meshes and then creating the DotScene file for positioning.
User avatar
Kojack
OGRE Moderator
OGRE Moderator
Posts: 7157
Joined: Sun Jan 25, 2004 7:35 am
Location: Brisbane, Australia
x 534

Post by Kojack »

I spent a while recently trying to get dot scene and ofusion support in.
The problem is that sketchup stores entity transformations as 4x4 matrices, and it allows negative scaling (to mirror meshes). Dot scene and ofusion require position / orientation / scale as seperate components, and I can't find a way to extract negative scales (they instead just stuff up the orientations) reliably.

There's 4 options:
- Pretend nobody will drag the mouse in the wrong direction while using the scale tool, and just hope for the best. (But even the built in samples in sketchup use negative scales to mirror halves of objects)
- Calculate correct positions of objects, but bake the orientation / scale into the mesh. But then we lose instancing.
- Calculate correct positions, but orientation and scale is just identity. So entities will be facing and wrong way and scaled wrong, but in the right position and instancing is preserved. You'd have to orient them yourself.
- Drop plans for dotscene / ofusion and just stick to the whole scene as a single mesh.

Even sketchup's kml files store transforms of mesh instances as 4x4 matrices, I don't think it's just a limit of the ruby interface but actually the way sketchup is implemented.
User avatar
Kojack
OGRE Moderator
OGRE Moderator
Posts: 7157
Joined: Sun Jan 25, 2004 7:35 am
Location: Brisbane, Australia
x 534

Post by Kojack »

Just for the hell of it, I installed the trial of Sketchup 5 (commercial version, 480 minute demo). It has the exporter plugins for max, maya, etc.

Their own exporters (tested the max one, and read the output of the maya one) can't handle instancing either, it bakes the entire scene into a single mesh centered on 0,0,0 and with no rotation.

I don't feel so bad now that I know they can't do it either. :)
Trentin
Gnoblar
Posts: 13
Joined: Mon Jul 31, 2006 7:08 pm

Post by Trentin »

If I had to choose between baked and identity transformations, I'd choose baked.

A scene with many meshes and no instancing would at least get mesh culling, but a scene with one big mesh wouldn't get any culling or instancing.

Afterwards if you really wanted instancing you could edit the dotscene xml by hand, which you'd have to do anyways with the identity transformation method.
User avatar
detox
Greenskin
Posts: 103
Joined: Thu Sep 07, 2006 1:13 am
Location: Ohio, USA
Contact:

Post by detox »

Great tool, thank you.
User avatar
mullencm
Gnoblar
Posts: 23
Joined: Sun Oct 30, 2005 8:38 pm

Post by mullencm »

I am a rather avide SketchUp user and now starting to dive into OGRE (after using Blitz3D) anyway... I work in Boulder, CO where sketchup is located and have a bit of a relationship with some of the folks there.

Case studies for them:
http://www.sketchup.com/?id=21&csid=189
http://www.sketchup.com/?id=21&csid=188

Anyway, a guy there "Chris Dizon" <chrisd@sketchup.com> just asked me today about game engines and what I was using, you should make him aware of your OGRE exporter (and grenirally how sweet OGRE is) , it might go somewhere, I was not sure why he asked me. Tell him that Chase sent you his way.
stuartf
Gnoblar
Posts: 13
Joined: Thu Aug 04, 2005 8:12 pm

Post by stuartf »

Hi Kojack

Im having a problem with plain textures/materials when using your exporter then importing the ogre mash material into Blink3D.

The model looks fine in Ogre mesh viewer, but if there's a plain colour (rather than a jpg texture) it just show up in white in Blink3d.

I think it's something to do with adding a diffuse colour to the material which I can do by hand but would there be any way of doing this with the exporter please (If you want me to post/email examples let me know).

Thanks for a bril exporter anyway!
User avatar
Falagard
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 2060
Joined: Thu Feb 26, 2004 12:11 am
Location: Toronto, Canada
x 3
Contact:

Post by Falagard »

If it shows up fine in the Mesh Viewer (whatever one you're using) and doesn't show up in Blink3d, that would make it a problem with Blink3D wouldn't it?
Clive Jackson
Greenskin
Posts: 123
Joined: Mon Jan 03, 2005 3:16 am
Contact:

Post by Clive Jackson »

If it shows up fine in the Mesh Viewer (whatever one you're using) and doesn't show up in Blink3d, that would make it a problem with Blink3D wouldn't it?
I think you are jumping to conclusions a bit.

It is quite possible that Stuart is using a Mesh Viewer that is based on Azathoth. The current version of Blink 3D uses Dagon which is stricter when it comes to parsing material files. It is possible that the Sketchup exporter created a material that works with Azathoth but not with Dagon.

Comparing log files from the Mesh Viewer and from Blink 3D would probably be the way to go here.
Thanks
Clive
User avatar
Kojack
OGRE Moderator
OGRE Moderator
Posts: 7157
Joined: Sun Jan 25, 2004 7:35 am
Location: Brisbane, Australia
x 534

Post by Kojack »

Hmm, might be an ambient light problem.

Try changing one of the materials that doesn't work to have an ambient component. For example, if your material has:

Code: Select all

material test01
{
   technique
   {
      pass
      {
         diffuse 1.0 0.529411764705882 0.176470588235294 1.0
      }
   }
}
then change it to be:

Code: Select all

material test01
{
   technique
   {
      pass
      {
         ambient 1.0 0.529411764705882 0.176470588235294 1.0
         diffuse 1.0 0.529411764705882 0.176470588235294 1.0
      }
   }
}
I usually have very low ambient light, but I just tested with the latest ogre cvs (not eihort) in a sample app with more ambient light, and the colours were pale / washed out or grey instead of orange. The change above fixed it.
stuartf
Gnoblar
Posts: 13
Joined: Thu Aug 04, 2005 8:12 pm

Post by stuartf »

Thanks Kojack/Clive

For every diffuse I've added a complimentary ambient the same beforehand and comes out properly in Blink now (original file and tweaked file looked same in my viewer - must be out of date as Clive says).

I can write a simle php or vb to tweak but it would be SO much more elegant if the exporter could do it for us :)

What's the chances Kojack :roll:

BTW small point (but not if you're tweaking by hand) SketchUp bloats out the material files with all its basic colours even if you dont use them - delete all the ones you aren't actually using before exporting (may seem obvious but there we go!)
User avatar
Kojack
OGRE Moderator
OGRE Moderator
Posts: 7157
Joined: Sun Jan 25, 2004 7:35 am
Location: Brisbane, Australia
x 534

Post by Kojack »

I'll add the ambient fix once I learn how to use source forge... :)

The unused materials exported is a problem with the newer sketchup. The method I used to get only the materials on the model worked fine with the first google sketchup release, but the next version gives out all materials even if not used.
stuartf
Gnoblar
Posts: 13
Joined: Thu Aug 04, 2005 8:12 pm

Post by stuartf »

Hi Kojack/Clive

Created a simple php on line utility here in the interim:
http://www.hsworlds.com/convert.php

Tried it with a few basic outputs from Sketchup via Kojack's Exporter and seems to be working OK - quicker than doing it by hand anyway :)

Just paste your code in top box, click the button and the amended script comes out the bottom for pasting back.

Hope it works and helps - onwards and upwards for Blink3D and Ogre!!
ibrown
Gremlin
Posts: 164
Joined: Wed Aug 18, 2004 6:41 pm
Location: London
Contact:

Post by ibrown »

Kojack wrote: The problem is that sketchup stores entity transformations as 4x4 matrices, and it allows negative scaling (to mirror meshes). Dot scene and ofusion require position / orientation / scale as seperate components, and I can't find a way to extract negative scales (they instead just stuff up the orientations) reliably.

There's 4 options:
- Pretend nobody will drag the mouse in the wrong direction while using the scale tool, and just hope for the best. (But even the built in samples in sketchup use negative scales to mirror halves of objects)
Hi Kojack, I've just started taking a look at sketchup as an idea for level design. Obviously that makes the dotscene interesting. Getting back to your original comment is the problem that it cannot be done reliably in theory or is it just that you cannot get your code to do it reliably. If it's the latter then I'm sure we've got enough math expertise in this forum to figure it out. If it's theoretically impossible though then that's a different story (would be strange though).
As an interim, how about assuming no negative scaling and if any is detected fall back to baking the instance (or is the difficulty detecting the use of negative scaling?).

In any case, is there any chance you can post your code you have so far so that someone else (possibly me :) ) can have a crack at fixing some of the problems.

Thanks,

Ian
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Post by jacmoe »

I believe it's all in ogreaddons! :)
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
ibrown
Gremlin
Posts: 164
Joined: Wed Aug 18, 2004 6:41 pm
Location: London
Contact:

Post by ibrown »

jacmoe wrote:I believe it's all in ogreaddons! :)
The version I looked at and printed out yesterday from ogreaddons was version 1.0.1 - it didn't have any .scene stuff in it, it was just the single mesh version. Of course, kojack may have checked in a new version last night...

Ian
User avatar
Kojack
OGRE Moderator
OGRE Moderator
Posts: 7157
Joined: Sun Jan 25, 2004 7:35 am
Location: Brisbane, Australia
x 534

Post by Kojack »

The version with dot scene stuff is an experimental total rewrite, and doesn't support stuff yet like materials. So it isn't in the addons yet (until it's at least slightly useable). :)
User avatar
Kojack
OGRE Moderator
OGRE Moderator
Posts: 7157
Joined: Sun Jan 25, 2004 7:35 am
Location: Brisbane, Australia
x 534

Post by Kojack »

Ok, I've got most of the default sketchup blue minivan model exporting to ofusion's OSM format correctly.
The minivan is a good test, because half the car body, 2 tires 2 door handles and 1 side mirror are all negatively scaled. It's all coming out ok now, except one of the side mirrors which is yawed wrong.

So there's progress.
Post Reply