Page 11 of 18
Re: Latest Blender Export Script [Sun Nov 8, 2009 - v1.3]
Posted: Mon Feb 22, 2010 11:39 pm
by koirat
I'm afraid he is not quite right.
He was talking about unwrapping with.
"Project from view"
"Project from view (bounds)"
As I assume.
And this is not exactly what I want. But almost this.
First one can do it but you can't get good precision easy with such a way.

Also two models are not exactly seamless. (And you have to do a lot of work manually when unwrapping)
Second method is resizing uv to bounds so you do not get this feature - that texture size will have the same size in world space.
Anyway after longer thinking it can't be made even by exporter.
My problem is that I have got level that is made of smaller bricks those bricks are all linked to each other so change in one of them makes changes in others. So it's not going to work anyway without a shader.
It's probably a reason they did not make it as a unwrapping feature. But process it when doing rendering.
Re: Latest Blender Export Script [Sun Nov 8, 2009 - v1.3]
Posted: Tue Feb 23, 2010 12:24 pm
by Shockeye
koirat:
This is very helpful when modeling a level, you are just preparing textures that will represent 1x1 unit exactly.
In my case it will be 1x1 meter and texture 512x512 so you do not have to play with unwrapping since uv cords are taken from coordinates.
This is perfect for making levels with seamless textures/walls.
Try "Cube Projection". That always works for me with level geometry with seamless textures.
Re: Latest Blender Export Script [Sun Nov 8, 2009 - v1.3]
Posted: Tue Feb 23, 2010 7:55 pm
by koirat
Cube projection is useful.
But somehow it's always making uv different in size than textured face.
Only when face is of length 2 units, its is doing what i want. One to one mapping with a texture.
Make a cube of size 1x1x1 with blender and try to texture it with some square image. And you will see what i'm talking about.
Re: Latest Blender Export Script [Sun Nov 8, 2009 - v1.3]
Posted: Wed Feb 24, 2010 9:28 am
by Shockeye
Yeah, you're right. I've only used it with rooms 1unit = 1metre, so because no-one builds houses with 1m high walls, I didn't notice. And changing texture size doesn't help either.
"Project from View(Bounds)" seems to work, but but you have to be in the right view direction, if you're rotated or viewing from camera it doesn't work.
And that's with a cube, not a complex shape, so there's no telling what it would do with anything interesting. You'd have to unwrap one face at a time, I think.
One thing I've just discovered is the "UV Calculation" panel, which I've never noticed before. In Blender 2.49b it is in the edit panel, hiding behind the "Multires" panel. I haven't had a chance to fiddle with it yet, but it seems to allow you to adjust the properties of Cube projection etc.
Re: Latest Blender Export Script [Sun Nov 8, 2009 - v1.3]
Posted: Wed Feb 24, 2010 11:33 am
by koirat
lf3thn4d wrote:sparkprime wrote:lf3thn4d wrote:@koirat: That's an interesting feature. We could probably add that as a special export feature. However, basing on material option is not a good idea since this is a mesh UV export. What could be done is to have a reserved special naming for the given UV channel that wants this. So when exporter detects the given name, it will export the global position in the UV. Though in practice, if you're already using shaders, you should be just grabbing the vertex coord and feed them as tex coord to the pixel shader.
Can't blender's unwrap already do this? Just aim top down on the meshes in orthographic and map from there?
Yes you are quite right. Though I thought he was meaning 3D UV coordinate with UVW; something blender's UV map doesn't support.
Did you mean, to save this texture UV in multiple texture coordinates on one mesh ? So if i have for example 10 objects on the scene with the same mesh. This imported mesh will have 10 additional texture coordinates. And you will have to chose which one to use in your application ?
@shockey:
Great find.
If you set your cube size to 2.0 than it's working just like I want it to. What's logical given how cube projection is working.
Re: Latest Blender Export Script [Sun Nov 8, 2009 - v1.3]
Posted: Sun Feb 28, 2010 12:28 am
by koirat
Today I decided to give it a try with Custom Material templates *.tpl in Blender Exporter.
It is great thing, and I regret not doing it sooner.
As there are always some buts:
The first thing that shocked me was a lack of getting texture file out of index of this texture in a material.
What we got instead is [textureName].texture that is almost useless, if i have to set it manually for all my materials, I can do well without this template.
Adding support for texture index was very easy:
(also I'm not a python beast

so no comments about coding please

)
here is modified part of an exporter code
Code: Select all
textureIndex=0; <---------------------------------------------------- current texture index
for mtex in self.material.getTextures():
if mtex:
if (mtex.tex.type == Blender.Texture.Types['IMAGE']):
textureName = mtex.tex.getName()
name, ext = Blender.sys.splitext(textureName)
if ext.lstrip('.').isdigit() : textureName = name
if mtex.tex.getImage():
textureFilename = self.manager.registerTextureFile(mtex.tex.getImage().getFilename())
templateDict[textureName + '._texture'] = textureFilename
if mtex.tex.extend & Blender.Texture.ExtendModes['REPEAT']:
templateDict[textureName + '._tex_address_mode'] = 'wrap'
else:
templateDict[textureName + '._tex_address_mode'] = 'clamp'
if (mtex.tex.imageFlags & Blender.Texture.ImageFlags['INTERPOL']):
if (mtex.tex.imageFlags & Blender.Texture.ImageFlags['MIPMAP']):
templateDict[textureName + '._filtering'] = 'trilinear'
else:
templateDict[textureName + '._filtering'] = 'linear linear none'
else:
if (mtex.tex.imageFlags & Blender.Texture.ImageFlags['MIPMAP']):
templateDict[textureName + '._filtering'] = 'bilinear'
else:
templateDict[textureName + '._filtering'] = 'none'
if ((mtex.tex.imageFlags & Blender.Texture.ImageFlags['USEALPHA'])
and not(mtex.mapto & Blender.Texture.MapTo['ALPHA'])):
templateDict[textureName + '._colour_op'] = 'alpha_blend'
else:
templateDict[textureName + '._colour_op'] = 'modulate'
templateDict[textureName + '._sizeX'] = "%.6g" % mtex.size[0]
templateDict[textureName + '._sizeY'] = "%.6g" % mtex.size[1]
templateDict[textureName + '._sizeZ'] = "%.6g" % mtex.size[2]
templateDict[textureName + '._offsetX'] = "%.6g" % mtex.ofs[0]
templateDict[textureName + '._offsetY'] = "%.6g" % mtex.ofs[1]
templateDict[textureName + '._offsetZ'] = "%.6g" % mtex.ofs[2]
templateDict['_textureIndex'+str(textureIndex) + '._texture'] = textureFilename <---------------- dictionary stuff
textureIndex=textureIndex+1 <---------------------- increment textureindex
notice that it only supports _texture
and here is example material template (not exactly valid one):
Code: Select all
#import phong from "phong.material"
material %_materialName : phong
{
texture %_textureIndex0._texture
texture %_textureIndex1._texture
}
this can be especially useful when you do stuff with additional textures like normal or specular maps.
What can be done also is adding textures based on regular expression.
for example
Code: Select all
texture %textureNameRegex('here regular expression')._texture
as i know python got built in regular expressions so it should not be a problem.
But this is less important than something like textureindex - from my perspective this is a must have.
Also reconsider something like default material for material templates. If template not specified.
Re: Latest Blender Export Script [Sun Nov 8, 2009 - v1.3]
Posted: Tue Mar 02, 2010 1:06 pm
by lf3thn4d
Ah.. finally I have someone else who give me feedback on that system.

I will look into what you are suggesting. I need to go out for a meeting first. Will get back to this later.
[edit]
Ok, I see your point. Good suggestion on the texture index reference. I'll add support for that. As for regular expression, it's possible but I don't really see the point of it.
Anyways, this seems easy enough fix. So I'll try to get this done soon. I'll also make it auto fallback to the default material generator when template is not specified. Thanks for the suggestions!

[/edit]
Re: Latest Blender Export Script [Sun Nov 8, 2009 - v1.3]
Posted: Thu Mar 04, 2010 7:44 pm
by gau_veldt
2.6.2 is no longer available on Python site. Only 2.6.4
Re: Latest Blender Export Script [Sun Nov 8, 2009 - v1.3]
Posted: Thu Mar 04, 2010 7:55 pm
by lf3thn4d
Aiks, that's unfortunate. Can someone try out if python 2.6.4 would work with Blender 2.49b?
Re: Latest Blender Export Script [Sun Nov 8, 2009 - v1.3]
Posted: Thu Mar 04, 2010 8:29 pm
by hAhni
lf3thn4d wrote:Aiks, that's unfortunate. Can someone try out if python 2.6.4 would work with Blender 2.49b?
I'm using blender 2.49b with python 2.6.4, seems to work.
Re: Latest Blender Export Script [Sun Nov 8, 2009 - v1.3]
Posted: Thu Mar 04, 2010 8:32 pm
by lf3thn4d
Thanks.

That's good to know. I'll update the info.
Re: Latest Blender Export Script [Sun Nov 8, 2009 - v1.3]
Posted: Thu Mar 04, 2010 11:22 pm
by koirat
lf3thn4d wrote:
As for regular expression, it's possible but I don't really see the point of it.
We can do fine without it. As I have said before it's not one of the hottest feature.
But it's not useless as you might think it is. It's just a generic way of getting texture by name.
It's very often that graphical files/materials are named with some additional info about it's uses.
for example:
postfix "_nm" or "_nor" for normal mapping.
or "_spc" for specular mapping.
Also some materials in blender might be more complex than this one exported.
Let just say that in blender I have materials A and B
A - diffuse/normal/specular textures
B - diffuse/specular textures
What I need is template for diffuse/specular combination. I'm exporting for lower graphics profile.
I can't use the same template for them if I'm getting textures by index.
About fallback to material generator. It would be nice if we got a possibility to specify default material template.
[edit]
Ok it just came to my mind.
This one is a killer 
:
In blender material Textures section we got "Map To"
Where we can specify behavior of a texture "Col" "Nor" "Spec" (and more) thanks to this we know the purpouse of a texture.
In material template we can do
%NorTexture.Texture
%ColTexture.Texture
%SpecTexture.Texture
Let just say that the first texture with specified trait will be chosen.
Or an extensions with indexes example for normal mapping texture:
%NorTexture0.Texture == %NorTexture.Texture
%NorTexture1.Texture
.
.
.
%NorTextureN.Texture
[/edit]
Re: Latest Blender Export Script [Sun Nov 8, 2009 - v1.3]
Posted: Fri Mar 05, 2010 9:58 am
by lf3thn4d
Hmm.. I see how regex can be use. Though it seems to me it becomes a little over generic in a way. It might actually complicate matters. So I'll not look into this first.
Your "Map To" thing is interesting. We could probably do it this way:
Code: Select all
_texMapTo[Col|Nor|Csp|Cmir|Ref|Spec|Amb|Hard|RayMir|Alpha|Emit|TransLu|Disp][#]
where # is the index of textures matching the combination modes.
So one could write:
Code: Select all
_texMapTo[Col][0]._texture
_texMapTo[Col][1]._texture
for a case where we have multi texturing.
Or, in some weird cases:
if they are addressing normal map with specular power in the alpha channel.
With this method, one can pick any of the Map To mode options and even combination.
Obviously this complicates things a little where I have to make sure it doesn't matter which order the MapTo flags are given.
We could probably make the index part optional so without it simply accesses the first matching texMapTo in the list.
as for your texture index idea, I would suggest the naming convention to fix to:
This way we can be more certain that it will not conflict with custom user params. We basically reserve _ prefix for internal use.

Re: Latest Blender Export Script [Sun Nov 8, 2009 - v1.3]
Posted: Fri Mar 05, 2010 3:08 pm
by koirat
Some of this options also support positive and negative. But i do not know if you want to implement it for now.
Code: Select all
_texMapTo[ {+Nor|-Nor|Nor}][0]._texture
for example part of the blender documentation
Ref (+/-/off)
Influences the amount of diffuse reflection.
Spec (+/-/off)
Influences the amount of specular reflection.
Amb (+/-/off)
Influences the amount of Ambient light the material receives
Hard (+/-/off)
Influences the specular hardness amount. A DVar of 1 is equivalent to a Hardness of 130, a DVar of 0.5 is equivalent to a Hardness of 65.
RayMir (+/-/off)
Influences the strength of raytraced mirror reflection
Alpha (+/-/off)
Influences the Opacity of the material. See Use Alpha for Object Transparency. Also use ZTransp for light and if combining multiple channels.
Emit (+/-/off)
Influences the amount of light Emitted by the material
Translu (+/-/off)
Influences the Translucency amount
Disp (+/-/off)
Influences the Displacement of vertices, for using Displacement Maps.
Re: Latest Blender Export Script [Sun Nov 8, 2009 - v1.3]
Posted: Sat Mar 06, 2010 5:20 pm
by teofil20
Hi im having problems exporting a mesh into ogre it was impoerted frrom makehuman using MHX. The symptoms are the teeth texture gets put to the back of the neck and partially on to the lips and the thumbs get streched to the meshes center.(No errors in the exporter except lots of warnings saying "vetex with more than 4 bone assignments")
here is a picture
thanks
Re: Latest Blender Export Script [Sun Nov 8, 2009 - v1.3]
Posted: Mon Mar 08, 2010 8:19 pm
by f00bar
maybe those vertices are not assigned to a bone or to a wrong bone. use "weight painting". does it look ok in blender if you move all bones in pose mode?
Re: Latest Blender Export Script [Sun Nov 8, 2009 - v1.3]
Posted: Sun Mar 14, 2010 6:59 pm
by teofil20
Thanks f00bar now it works
Re: Latest Blender Export Script [Sun Nov 8, 2009 - v1.3]
Posted: Mon Mar 22, 2010 9:37 am
by lustigerclown
Hi guys, I have already posted in a different Thread, but maybe someone of you can help
I can't export a animation with the Exporter...
http://www.ogre3d.org/forums/viewtopic.php?f=8&t=56367
Re: Latest Blender Export Script [Sun Nov 8, 2009 - v1.3]
Posted: Sat Apr 03, 2010 3:08 pm
by Retrofasciata
I am wondering if the Blender 2.5 (alpha 2) release has any influence?
Is it the same exporter? Any other action(s) required to get it to work?
Re: Latest Blender Export Script [Sun Nov 8, 2009 - v1.3]
Posted: Sat Apr 03, 2010 4:49 pm
by jacmoe
Nothing happens here until Blender 2.5 goes *stable* - there's no point in a major effort before then.
The API is still in flux.
Re: Latest Blender Export Script [Sun Nov 8, 2009 - v1.3]
Posted: Sun Apr 04, 2010 8:52 am
by BTolputt
I'm a big fan of Blender 2.5 as well, but jacmoe has a very good point. Blender 2.5 is undergoing some major changes... it is not even known at the moment what the final internal representation of the mesh is going to be (the current EditMesh structure or the new BMesh structure), let alone how they are going to expose these details to the outside world.
I'm going to be making a start in an exporter in the next fortnight because I kind of need it for my own purposes, but there is no point relying on me or anyone else releasing something that may be invalidated with the next SVN commit by the Blender core developers.
Re: Latest Blender Export Script [Sun Nov 8, 2009 - v1.3]
Posted: Mon Apr 12, 2010 3:50 pm
by Tuftux
Hey everyone !
I've got a problem with one of my animated mesh which only appears with two animations : when I try to export the mesh it start calculating the animation (you know, when you see the mesh moving in the 3D window) and then the script crashes even without starting converting the mesh with OgreXMLConverter. It says "Check in the console", and the console returns :
Code: Select all
self.inverseLastKeyFrameTotalTransformation.invert()
ValueError: matrix does not have an inverse
I absolutely don't know where it comes from, and when I try to export other animations there's no problem. Could anoyne help me ?

Thanks !
Re: Latest Blender Export Script [Sun Nov 8, 2009 - v1.3]
Posted: Sun Apr 18, 2010 9:58 pm
by pedro_fp_simoes
Hi I'm a newbie on Ogre3D and I need to implement an 3D simulation of a island with people and animals.
For that I'm thinking on using Blender for the design and Ogre3D for the engine

, but I'm stuck with the animations
I have an simple animated cube in a .blend file (attach)
I can't get animated exported to mesh
Please hellllllllllllllllllllllllppppppppppppppppppp

Re: Latest Blender Export Script [Sun Nov 8, 2009 - v1.3]
Posted: Thu Apr 22, 2010 11:49 am
by Thorworks
Hey
I got a problem regarding the blender exporter.
When exported, my mesh (Shows up good in Blender and other 3d tools) looses faces and screws up the model.
It looks good in different tools, but as .mesh file it screws up.
I also tried converting the frankie model (from the open source Yo Frankie, or Big Buck Bunny) that exports rather well, but with some weird vertexes, animation and skeleton problems.
My other models exported just right so i have no idea what changed.
Also i would like to request a blender 2.5 exporter.
There actually is a request from the blender developers to start write exporters for 2.5. since the exporter framework is just done!
I use 2.5 alpha 2 on a daily base and really works a lot better imho then 2.49.
Thanks
Re: Latest Blender Export Script [Sun Nov 8, 2009 - v1.3]
Posted: Sun May 02, 2010 12:40 pm
by Ultime Alex
Hi !
Is there a way to export partial animations (not all bones affected) with the exporter to use ANIMBLEND_CUMULATIVE without mask ?
In my skeleton.xml, i see that animations with few bones associated are writed in the file with all bones.
Thx.