SketchUp to Ogre Export partially rewritten

The place for artists, modellers, level designers et al to discuss their approaches for creating content for OGRE.

Did you use/like this exporter?

I use it and it works
6
25%
I use it but is buggy
1
4%
I don't use it but I consider it a nice contribution
14
58%
SketchUp sucks: this is crap
3
13%
 
Total votes: 24

fnunnari
Gnoblar
Posts: 18
Joined: Thu Jul 28, 2005 10:36 am

SketchUp to Ogre Export partially rewritten

Post by fnunnari » Tue Mar 25, 2008 4:44 pm

Hello Ogre users and SketchUp modellers (if any).

I wanted to announce that in the last week I worked on improving the SketchUp plugin that exports into the Ogre format.

A preliminary page is here:
http://www.di.unito.it/~nunnarif/sketchup_ogre_export/

Thanks to Kojack for the previous work.
I completely rewrote the materials/textures exporting technique.
The mesh exporting procedure is untouched.

There are still open issues that I should fix in the future.

Please give me some feedback ;-)
0 x

User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19261
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
Contact:

Post by sinbad » Tue Mar 25, 2008 6:58 pm

I like Sketchup so any enhancements will be welcome. If Kojack's happy with what you're doing I can give you access to CVS so you can commit your changes upstream.
0 x

User avatar
Jerky
Orc Shaman
Posts: 791
Joined: Wed Mar 02, 2005 4:13 am
Location: Springville, Utah
Contact:

Post by Jerky » Wed Mar 26, 2008 8:03 am

Sketchup, even with the material limitations, can be a very powerful tool for teams. In studying how other games do buildings, I found out that the way texture limitation in Sketchup actually works to create architecture to match that of games like Oblivion. The artists who made oblivion's building models used tiling textures per building piece, and therefore all building were made up of multiple parts. Sketchup can do exactly that, and therefore becomes a powerful tool, in my opinion.

I would welcome any enhancements to the exporter.

My only other question is regarding the license on the assets produced by the free version. I haven't looked lately and don't remember what the restrictions were, if any.
0 x
Erik Briggs (Jerky)
My Blog
Project Wish
Image

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

Post by Kojack » Wed Mar 26, 2008 10:39 am

I've just gotten around (as of a few minutes ago) to updating the current version of the exporter in cvs (been meaning to do that for ages). So your code might need some changing to match the new version.

It's a fairly substantial change. I didn't want to release anything until it worked up to the standard I wanted, which caused it to be dragged on and on.

The main exporter part is pretty much rewritten. It doesn't yet include my scene exporting, but it does do stuff like handle distorted textures about 99.999% correctly (2 giant test models are still slightly wrong on a couple of faces), which took many months of experimenting, several "I'm never touching this program again!" moments (sketchup's api causes MANY of those) and guesswork.

The config file format has changed (now a module instead of global variables). There's no longer a need for hand editing, there's now a config dialog with loading/saving of options:
Image
(Which also caused numerous "I'm never touching this program again!" moments)

You can now select to export front and or back faces, (doing both will generate a lot of triangles).

Hopefully it works. :)



For an idea of the fun this api gives you, I spent a couple of hours last night trying to work out why normals weren't being smoothed. In sketchup the car I was testing looked smooth, in ogre it was flat shaded. Turns out that the sketchup api only exports smoothed normals if the face is inside of at least one group, but will always render them smooth. So what's on screen isn't always what it gives you through the api! If I selected the entire scene, grouped it, then it gave me the right data. GRRR
Also, it doesn't help that Sketchup doesn't like my geforce 8800gts512:
Image
Painful to test models when they look like that. :)

I apologise to anybody who has been waiting for updates. I've been pretty slack with it.
0 x

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

Post by Kojack » Wed Mar 26, 2008 5:56 pm

The eiffel tower problem on your page was something I was looking at in one of my tests before updating the cvs. The easiest fix is to just add alpha blending to all materials which have an alpha capable texture format (png, dds, etc). But I don't like that. I think a better way would be to have a user interface which lets extra data be added to materials, like more ogre options (blend modes, etc). It could also handle the annoying looking colourising support for textures. Attribute dictionaries could probably handle it, I haven't tried them yet.

My version exports your box test correctly.

A good test model is St. Peter's Basilica: http://sketchup.google.com/3dwarehouse/ ... revstart=0
Very painful model. Lots of groups, inherited materials and stuff to confuse the matrices needed for uv coordinate extraction, plus alpha channel pngs for some bits.
0 x

fnunnari
Gnoblar
Posts: 18
Joined: Thu Jul 28, 2005 10:36 am

UVmapping fixed in beta4

Post by fnunnari » Wed Mar 26, 2008 6:38 pm

Kojack,

Thanks for your update on CVS. I was able to fix the UVmap export too :-)

For the alpha problem, today I tried a way to acces the pixels of the texture and manually check if alpha is used. However, there seems to be no way to read the pixels.
I don't think I'm going to add options for users. Instead, we will investigate on why on some textures alpha is recognized and on some others not.

I already found the St.Peter Model few days ago. It seems to export well, with the difference that I still don't export back faces. :-)

I updated my page. Now I noticed an issue related to Axes alignement. Are you coping with it?

I suggest you to also check if some textures cannot be saved. I found a lot of .tif that SketchUp doesn't like. I'll post a case ASAP.

FN
0 x

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

Post by Kojack » Thu Mar 27, 2008 3:15 pm

I just fixed (and uploaded) the texture bug which has annoyed me for a while, the top dome of St. Peter's Basilica was coming out wrong. Turns out the material applied to the dome's group was overridding the back face material on the dome itself, so it was picking the wrong texture.

Now the only texture bug I know of (besides colouring and the alpha channel thing) is on a london bridge model, 2 root faces (not in a group or component) are misaligned. Adding them to a group fixes it, so I'm probably storing the wrong transform matrix for the root faces.


About the only way to know if a material needs alpha is to guess based on the file name (png and tga support it, jpg doesn't, etc). The use_alpha? method only returns true when the opacity slider is less than 100%.
0 x

fnunnari
Gnoblar
Posts: 18
Joined: Thu Jul 28, 2005 10:36 am

Some alpha yes, some aplha not

Post by fnunnari » Thu Mar 27, 2008 6:07 pm

Kojack,

I found that some png are exporting with transparency, even if the opacity slider are at 100%, while others not. There is a test case on the page.

Can you post a link to the london bridge model?

FN
0 x

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

Post by Kojack » Fri Mar 28, 2008 11:21 am

Hmm, the transparency thing doesn't seem to be texture related, there's something still in the material which isn't shown in the material editor.
I took your 2 tests (the tree which has alpha and the eiffel tower which doesn't) and swapped the textures between them (same material, texture changed). With the eiffel tower texture applied to the tree's face, it came with alpha. With the tree texture applied to the tower mesh, it's not alpha.
0 x

fnunnari
Gnoblar
Posts: 18
Joined: Thu Jul 28, 2005 10:36 am

UVMaps really fixed

Post by fnunnari » Fri Mar 28, 2008 2:14 pm

Three things:

First, I've updated also my exporter. UVMaps were still wrong for inherited materials. Thanks to Kojack again

Second. Kojack I've a test case for you. On my web page there is a http://www.di.unito.it/~nunnarif/sketch ... owDoor.skp that, works fine on the UVmaps but don't write the texture.

Third, about transparency. Indeed, it's something in the material.
I saved the material from sketchup. It creates an eiffel.skm file. It is a disguised ZIP archive. I've opened it with 7-Zip. There is a file document.xml containing a line:

Code: Select all

<mat:material colorBlue="222" colorGreen="222" colorRed="221" colorizeType="0" hasTexture="1" name="eiffel" trans="0" type="1" useTrans="0">
The useTrans attribute is the responsible for the Material.has_alpha? method. It is at 1 in the models recognizing transparency.
However, I also don't know how to change it through the editor.

FN
0 x

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

Post by Kojack » Fri Mar 28, 2008 9:10 pm

I've played around a bit and found a tif file solution (kind of).
If you tell the texturewriter to save with a different extension to what the texture originally used, it converts the texture to that format (doesn't just change the name). So for a quick test I told my exporter to change the extension of any tif to png, and they all saved fine (alpha channel as well).

I'm thinking the best option would be to try saving like normal, then if an error happened try saving again as a png (since maybe some tifs do save fine).
0 x

fnunnari
Gnoblar
Posts: 18
Joined: Thu Jul 28, 2005 10:36 am

1_2_0beta6 release exports backfaces

Post by fnunnari » Mon Mar 31, 2008 5:11 pm

I just uploaded the 1.2.0beta6 version of the sketchup to ogre plugin which also exports backfaces.

Kojack, I think we are feature-aligned now :-)
The idea of forcing TIFs to PNG is nice.

I'll consider my release non-beta when I'll fix the Axis positioning problem.

FN
0 x

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

Post by Kojack » Mon Mar 31, 2008 6:27 pm

Cool. :)

I've had a bit of a look at attribute dictionaries.
An attribute dictionary lets you bind data to string keys and attach them to any entity in sketchup (including materials, and the entire scene as a whole). Any kind of data can be bound to a key, but loading/saving of the file destroys all data except for numbers and strings.

This means it's possible to add custom data to any face, material or other thing, and preserve it when saving.
0 x

fnunnari
Gnoblar
Posts: 18
Joined: Thu Jul 28, 2005 10:36 am

Normalizing normals

Post by fnunnari » Mon Apr 14, 2008 11:40 am

I just updated my exporter with a fix.
I noticed that colors visualization is improved if normals are normalized before being exported to Ogre.

technically I changed:

Code: Select all

			norm = (matrix*mesh[0].normal_at(p)).to_a
to

Code: Select all

			norm = (matrix*mesh[0].normal_at(p)).normalize.to_a
As far as I know it shouldn't happen. Normals are normals. If anyone thinks it is an ogre bug, please let me know.
I'm using OgreCommand line tools 1.4.4 and LexiView 1.0.7.

The 1.2.0b7 release is available on the web site, together with a test case: http://www.di.unito.it/~nunnarif/sketchup_ogre_export/

F
0 x

noctrine
Gnoblar
Posts: 1
Joined: Fri Oct 31, 2008 6:21 am

Issues with the partially rewritten version.

Post by noctrine » Fri Oct 31, 2008 6:27 am

Using Sketchup 6.4.112.0, Ogre Command Line Tools 1.4.7 Neoaxis Map Viewer (Ogre 1.4.6)

Whenever I export a model using the most recently added version by Kojack, or the version by fnunnari the models are imported at a weird rotation.

I try to rotate the models when I import them into my engine (using neoaxis game engine) but not knowing the exact rotation I end up getting this issue where my character model slides to one end.

Was wondering if anyone else got this, and also if there was a fix.


EDIT: Alright, I am fairly certain that the sliding is just an issue of how my model is made. But still if anyone has any similar issues your insight would help :)
0 x

User avatar
amigoface
Greenskin
Posts: 132
Joined: Mon Oct 13, 2008 3:01 pm

Post by amigoface » Sat Nov 22, 2008 12:36 pm

after 2 days on this without success i have one simple question :

how it works ???????????????????!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

i downloaded the sript :
http://www.di.unito.it/~nunnarif/sketch ... 0beta7.zip
put it in the sketchup plugins folder (v 6.4.112)

load some models and try to export them
but i have only this simple dialog box
ImageImage[/img][/url]

if i put some thing in the file name and i click ok nothing happen
and i have no output file

the ideal is to export to blender and then to ogre
i have also tried some blender script (kmz,kml, collada) without success too

so give me working solution please

thanks
0 x

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

Post by Kojack » Sun Nov 23, 2008 9:43 am

The current svn of Ogre Addons has my version which gives a better configuration panel, as my screenshot several posts above this one shows.
Both fnunnari's exporter (the one you are using) and mine (the ogre addons version) can export the same data, but mine has the easier to use interface.

For my one, make sure all the paths in the config dialog (for the features you enable) exist, otherwise it will probably fail.

For the one you are using (I'm not familiar with what's different from my original version) check the ogre_export_config.rb file, all the settings for file paths, location of the ogrexxmlconverter.exe file, etc, need to be set by hand before use.
0 x

fnunnari
Gnoblar
Posts: 18
Joined: Thu Jul 28, 2005 10:36 am

Post by fnunnari » Mon Nov 24, 2008 3:58 pm

Indeed, edit the file named "ogre_export_config.rb" and set the right paths and options. There is also a README that should explain everything.

I focused on making the whole code more clean, readable, mainteanable and (hopefully) fast and correct. I didn't put any effort on the GUI.

The only feature I offer in addition to the code of Kojack, is the posibility to export materials and textures with a unique IDs in their name; in order to avoid name conflicts by the OgreResourceManager (I really HATE this name handling policy).

Of course, it would be nice to see the best aspects of both projects merged in a single one. Unfortunately, I don't have enough free time to work on this.

FN
0 x

User avatar
amigoface
Greenskin
Posts: 132
Joined: Mon Oct 13, 2008 3:01 pm

Post by amigoface » Wed Nov 26, 2008 8:04 am

sorry for the late replay

i want just to say that it worked just perfectly :)


thanks a lot
0 x

skektox
Gnoblar
Posts: 2
Joined: Thu Mar 05, 2009 10:25 am
Location: Spain

Re: SketchUp to Ogre Export partially rewritten

Post by skektox » Thu Mar 05, 2009 10:52 am

Hi everyone

Fisrt of all, sorry for my english...

I have a problem using the exporter.

The exporter runs fine (good job!) when i load a mesh in the OgreMeshViewer in Windows XP.

When I use the same mesh and material in my linux application ((Ubuntu 8.04), the mesh don't apply the material and the shadows are very poor. The interpolation between the shadow zone and light zone is a line.

I have the same problem using the blender exporter.

What's the matter? The oGre version, my code ?


Thanks in advance

I can paste my code and the screenshots if you can't understand me.
0 x

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

Re: SketchUp to Ogre Export partially rewritten

Post by Kojack » Fri Mar 06, 2009 1:59 pm

There shouldn't be anything strange about the mesh coming from sketchup, it uses the standard ogre xml converter.
If the blender exporter (which is pretty popular and widely used) is causing problems too, my first assumption would be a bad resource directory setup (for the materials to not show up) or drivers (for the shadows to look wrong).
I don't use linux anymore, so I might be missing some other explanation.
0 x

skektox
Gnoblar
Posts: 2
Joined: Thu Mar 05, 2009 10:25 am
Location: Spain

Re: SketchUp to Ogre Export partially rewritten

Post by skektox » Sat Mar 07, 2009 2:28 pm

Hi

Finally, the problem was the Ogre version. In the last version the meshes look OK.

Thanks for the reply

Skektox
0 x

mehdithe
Halfling
Posts: 42
Joined: Wed Jan 21, 2009 11:57 am

Re: SketchUp to Ogre Export partially rewritten

Post by mehdithe » Tue Nov 03, 2009 10:13 am

Hello,

Very amazing work, thank you!

I have a question :

What about animations support with the last release of SketchUp exporter?

Thanks in advance for any informations
0 x

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

Re: SketchUp to Ogre Export partially rewritten

Post by Kojack » Wed Nov 04, 2009 3:02 am

Model animation is only supported (as far as I know) in Sketchup Pro, which costs money. I only have the free version. So unless google give me a free copy, or they move the feature to the free version, animation won't be supported.
0 x

mehdithe
Halfling
Posts: 42
Joined: Wed Jan 21, 2009 11:57 am

Re: SketchUp to Ogre Export partially rewritten

Post by mehdithe » Sun Nov 08, 2009 11:48 am

Hi,

Thanks for the response,

It seems it is possible to make animation whitout the pro version of SketchUp. We could find a tutorial at :

http://www.top-freewares.com/video-tuto ... -animation

I'm working on the OpenSpace3d platform based on Ogre3D and Newton for physics.

http://www.ogre3d.org/forums/viewtopic.php?f=11&t=51157
www.openspace3d.com

Our users are really interested about your work because we would like to give to non-graphist people the possibility
to make intercative 3D environnement based on 3D models by SketchUp.

What do you think about this project?

Thank you in advance.
0 x

Post Reply