Gile[s] Lightmapper Ogre export plugin

Discussion area about developing or extending OGRE, adding plugins for it or building applications on it. No newbie questions please, use the Help forum for that.
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

Post by sinbad »

Emissive / ambient only lighting is cheap in the extreme, I doubt setting a base material colour is measurably faster.
User avatar
walaber
OGRE Expert User
OGRE Expert User
Posts: 829
Joined: Sat Oct 02, 2004 2:20 pm
Location: California, USA

Post by walaber »

alright, I'll make my own simple model viewer to test the models...

I really should implement a preview right into the exporter, but that would probably require a lot of recoding :wink:

currently I'm generating the material scripts by hand (writing to a text file)... would it be smarter to build the materials in code, and use the serializer to save them out to a file?
Go Go Gadget OGRE!!
Image
User avatar
:wumpus:
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 3067
Joined: Tue Feb 10, 2004 12:53 pm
Location: The Netherlands
x 1

Post by :wumpus: »

sinbad wrote:Emissive / ambient only lighting is cheap in the extreme, I doubt setting a base material colour is measurably faster.
Probably true... given that you can assume some intelligence from the underlying rendering API and drivers to ignore the lighting calculations with diffuse, specular and ambient equal to 0.
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

Post by sinbad »

walaber wrote:currently I'm generating the material scripts by hand (writing to a text file)... would it be smarter to build the materials in code, and use the serializer to save them out to a file?
If you're already linking to OgreMain you might as well use MaterialSerializer, yes.
User avatar
walaber
OGRE Expert User
OGRE Expert User
Posts: 829
Joined: Sat Oct 02, 2004 2:20 pm
Location: California, USA

Post by walaber »

hmm... I implemented the MaterialSerializer... but it doesn't seem to be working right... here's my Ogre Log file:

Code: Select all

12:24:14: MeshSerializer writing mesh data to C:\Documents and Settings\Timmy\My Documents\Visual Studio Projects\GilesExport\TEST SCENES\boxes.mesh ...
12:24:14: File header written.
12:24:14: Writing mesh data...
...[mesh expor log removed]
12:24:14: Mesh data exported.
12:24:14: MeshSerializer export successful.
12:24:14: MaterialSerializer : writing material Gile[s]_RED  to queue.
12:24:14: MaterialSerializer : done.
12:24:14: MaterialSerializer : writing material Gile[s]_BLUE  to queue.
12:24:14: MaterialSerializer : done.
12:24:14: MaterialSerializer : writing material Gile[s]_LIMEFLY  to queue.
12:24:14: MaterialSerializer : done.
12:24:14: MaterialSerializer : writing material(s) to material script : Giles.material
12:24:14: MaterialSerializer : done.
but here is the Giles.material file it creates:

Code: Select all


material Gile[s]_RED
...that's the entire file
:oops:

I think I'm creating the materials properly... and the log shows that it's adding 3 materials to the queue...

I'll keep fiddling with it!
Go Go Gadget OGRE!!
Image
User avatar
walaber
OGRE Expert User
OGRE Expert User
Posts: 829
Joined: Sat Oct 02, 2004 2:20 pm
Location: California, USA

Post by walaber »

still can't get the MaterialSerializer to work right... so I'm back to my by-hand method...

the exporter is making excellent progress... there are still a few issues with replicating Gile[s] exactly, but I think the exporter is very usable now.

with a little hand-editing the material scripts, you can usually get anything looking great...


yet another WIP screenshot:
Image
Go Go Gadget OGRE!!
Image
User avatar
walaber
OGRE Expert User
OGRE Expert User
Posts: 829
Joined: Sat Oct 02, 2004 2:20 pm
Location: California, USA

Post by walaber »

yet another question 8)

say I have an image and I would like to set a "mask" to it.
basically, I want all pixels of a certain color to be completely transparent, and all other pixels to be completely opaque.

I assume I'd use "colour_op_ex blend_manual" in the material script, but I can't seem to figure out how to set it up...

any advice/help would be greatly appreciated! :D
Go Go Gadget OGRE!!
Image
User avatar
DWORD
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 1365
Joined: Tue Sep 07, 2004 12:43 pm
Location: Aalborg, Denmark

Post by DWORD »

walaber wrote:say I have an image and I would like to set a "mask" to it.
basically, I want all pixels of a certain color to be completely transparent, and all other pixels to be completely opaque.
You have to create an alpha channel and use alpha rejection. See this thread.
User avatar
walaber
OGRE Expert User
OGRE Expert User
Posts: 829
Joined: Sat Oct 02, 2004 2:20 pm
Location: California, USA

Post by walaber »

fair enough... Gile[s] supports these kinds of masks, so some existing Gile[s] projects cannot be directly exported to Ogre without modifying the textures slightly (adding an alpha channel).

that's fine with me, I'll just have to mention it somewhere in the (eventual) docs 8) 8)
Go Go Gadget OGRE!!
Image
Lioric
Google Summer of Code Mentor
Google Summer of Code Mentor
Posts: 295
Joined: Fri Aug 06, 2004 10:25 pm

Post by Lioric »

when you turn the lighting off, there is no effect of the material color settings on the mesh, as the ambient/diffuse ..... colors are counted when the light is calculated per vertex, so no light calculation, no use of the material colors

when the entity is not using realtime light, it uses precalculated light, and that is the vertex colors, so if you want the entity to be colored, export the diffuse component of the vertex with the colors needed, light/shadow color can be precalculated, thus saving some render times, but its resolution is dependant on the mesh tesselation

when using the vertex colors to render, you can use the alpha component to make the entities transparent with the per vertex apha value

Lioric
User avatar
walaber
OGRE Expert User
OGRE Expert User
Posts: 829
Joined: Sat Oct 02, 2004 2:20 pm
Location: California, USA

Post by walaber »

okay, I'm pretty sure it worked, so this project should now be a part of ogreaddons in CVS, in the path "gilesexporter"

8) 8) 8)

there is also a binary-only download available on my website, in the "tools" section.
Go Go Gadget OGRE!!
Image
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

Post by sinbad »

Excellent, thanks walaber :) I've made an announcement in the news.
User avatar
Devine
Kobold
Posts: 35
Joined: Fri Jan 14, 2005 1:21 am

Post by Devine »

I think that the export is broke now that there is a new version of Giles.

Is Anyone else having a problem, or is it just me?

Thanks
User avatar
walaber
OGRE Expert User
OGRE Expert User
Posts: 829
Joined: Sat Oct 02, 2004 2:20 pm
Location: California, USA

Post by walaber »

I've downloaded the newest version of Gile[s] but to be honest haven't even run it yet... I'll take a look into it this weekend!
Go Go Gadget OGRE!!
Image
User avatar
walaber
OGRE Expert User
OGRE Expert User
Posts: 829
Joined: Sat Oct 02, 2004 2:20 pm
Location: California, USA

Post by walaber »

UPDATE

sorry for the delay everyone, was too busy with Stunt Playground :P

I've updated the Gile[s] exporter! it's now been compiled in release mode, and updated to Ogre 1.0. I also made a slight change to the material script producer.

anyway, it has been tested with the newest version of Gile[s] (1.35a) on 2 machines, and seems to work fine. please follow the install instructions carefully because some files are no longer needed, and others have had name changes.

also I have no internet at home now, so unfortunately I can't update the CVS version properly... so this is a binary release only. sinbad, if you can update it for me, I'd be glad to send you the updated source code!

BINARY DOWNLOAD - .rar archive, approx 1MB
Go Go Gadget OGRE!!
Image
louisc
Gnoblar
Posts: 17
Joined: Wed Mar 16, 2005 4:33 pm

Post by louisc »

HI Walaber

I can't find any install instructions in the download or on your site ?

cheers
User avatar
walaber
OGRE Expert User
OGRE Expert User
Posts: 829
Joined: Sat Oct 02, 2004 2:20 pm
Location: California, USA

Post by walaber »

whoops! forgot to inlude the .txt file in the download! it's in there now, please re-download :P
Go Go Gadget OGRE!!
Image
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

Post by sinbad »

@walaber: can you update CVS with this new version please?
louisc
Gnoblar
Posts: 17
Joined: Wed Mar 16, 2005 4:33 pm

Post by louisc »

Sorry Walber .. but now the link to the download appears broken ..

:wink:
User avatar
Kencho
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 4011
Joined: Fri Sep 19, 2003 6:28 pm
Location: Burgos, Spain
x 2

Post by Kencho »

Nope, I've just downloaded it. Try again ;)
Image
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179

Post by jacmoe »

sinbad wrote:@walaber: can you update CVS with this new version please?
I don't think he is able to:
walaber wrote:also I have no internet at home now, so unfortunately I can't update the CVS version properly... so this is a binary release only. sinbad, if you can update it for me, I'd be glad to send you the updated source code!
:wink:
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
User avatar
hebdemnobad
Goblin
Posts: 274
Joined: Wed Feb 09, 2005 5:09 pm
Location: catskill escarpment, new york, usa
x 3

Post by hebdemnobad »

walaber i have been getting errors when trying to view a gile[s] exported scene using the directx renderer, but not the opengl renderer. opengl works fine (but has other limitations)...is this a limitation of the exporter? if not, i'll try to isolate the problem.thanks!
User avatar
walaber
OGRE Expert User
OGRE Expert User
Posts: 829
Joined: Sat Oct 02, 2004 2:20 pm
Location: California, USA

Post by walaber »

there should be no reason the meshes cause problems with a specific renderer, there no different than any other .mesh files...
Go Go Gadget OGRE!!
Image
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

Post by sinbad »

jacmoe wrote:
sinbad wrote:@walaber: can you update CVS with this new version please?
I don't think he is able to:
walaber wrote:also I have no internet at home now, so unfortunately I can't update the CVS version properly... so this is a binary release only. sinbad, if you can update it for me, I'd be glad to send you the updated source code!
:wink:
Doh, that's skim reading for you - I'm in a rush too much these days.

@walaber: yes please do send me the code updates and I'll commit them for you.
User avatar
walaber
OGRE Expert User
OGRE Expert User
Posts: 829
Joined: Sat Oct 02, 2004 2:20 pm
Location: California, USA

Post by walaber »

sinbad - will do. however I'm in the middle of adding a few features that will truly make the exporter useful... so give me a few days, and I'll provide you the source for the new release!

the new version will have the option to copy over all textures for the model with the export, and also have an option to automatically "fix" textures with the "MASK" mode in Gile[s]. by adding an alpha channel to the texture, making it transparent wherever there is a fully black pixel. this should make most models export directly from Gile[s] into usable OGRE meshes :D

in the process I'm also learning how to use the devIL library directly :D
Go Go Gadget OGRE!!
Image