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.
This is my current WIP exporter for the Gile[s] Lightmapper. Gile[s] is a very powerful lightmapper, which I have been using for quite a while now, with fantastic results.
I recently started learning/developing in Ogre (namely using the Newton Game Dynamics physics SDK), and realized I need a way to use Gile[s] lightmapped meshes in Ogre. so I set out to write an Ogre export plugin for the program... and it's almost done.
here's a WIP screenshot:
THINGS TO FIX:
1) error in generating IndexBuffers (easy fix)
2) flip handed-ness when exporting (Gile[s] is left-handed) (easy fix)
3) errors in generating the material scripts.
I have number 1 and 2 solved, I just have to implement them. as for #3, I will probably be asking sime questions from users here, as you can see from the screenshot, the transparency/alpha isn't working right (the shot is from the Ogre mesh viewer app)
I think you need 'depth_write off' in material pass to make the transparent objects render correctly. Also using 'emissive 1 1 1 1' has no effect when turning off dynamic lighting, and consider turning off alpha blending for the floor (and trunk?). I know this is work in progress, so I don't mean to bite off your head.
Edit: Btw I don't know Gile[s], but this looks nice
Actually if the alpha is 'hard' ie not partial, then you need 'alpha_rejection greater 128' in your texture_unit, and depth_write should still be 'on'.
they are .png images, so they should have a proper alpha channel...
I realize there is a lot of excess data in the material script, it's obviously generated automatically from the Gile[s] data, and coule use a few more "brains"
[edit]
with a little hand-editing of the material script, I got it working. with a little modification to my material script generator code, I should be in business!
walaber wrote:what about the source? should I submit that as well? if so I should probably clean it up a little...
Well, you could also decide to sell an executable and get rich But to be included in ogreaddons we need the source code with a GPL/LGPL compatible license (AFAIK)
yet another question... is there anyway to make completely solid, non-white objects in Ogre?
for example, I want to have an object that is rendered with no lighting, but is completely red aka rgb(1 0 0)... if I set "lighting off" in the material script, the object goes white... so do I accomplish this?
it's necessary to make the exporter compatible with all materials Gile[s] can create...
walaber wrote:for example, I want to have an object that is rendered with no lighting, but is completely red aka rgb(1 0 0)... if I set "lighting off" in the material script, the object goes white... so do I accomplish this?
walaber wrote:
for example, I want to have an object that is rendered with no lighting, but is completely red aka rgb(1 0 0)... if I set "lighting off" in the material script, the object goes white... so do I accomplish this?
I'm not sure if this is possible currently, when Lighting is set to off, the base color of the object is always set to white (with glColor3f in GL and ?? in D3D). It can only be changed by the vertex colours of the mesh. We could change things to use the Diffuse color for this as this is unused anyway with lighting and vertex colors set to off.
Thinking about it, there are even two base colors for GL and D3D (and two vertex colour channels).. so using the diffuse and specular for those would make some sense. (most of the time you won't use the second color, but still)
But it could give problems with the default values (materials should be able to assume the base color is white if it isn't set). Diffuse and specular default to 0.0 .. I'm still not too sure about the syntax.
That should give you a solid red colour with no variations in colour. If there are variations, something is wrong. There is no need for any other feature to be created to support this since it should already work. I wouldn't rely on the MeshViewer, use a real Ogre application since cTh no longer maintains MeshViewer.
I don't know if it's an option, but a simple vertex program would work I think (it would just return a constant color).
A vertex program may be overkill for this, though, if you target cards without this support (but I think vertex programs may be emulated if not supported by the card - at leat by directx).