ofx3DModelLoader - Blender to openFrameworks

Hi There,

Appologies if this is a little Blender related, but I am trying to get going with ofx3DModelLoader and have a problem with my textures.

The squirrel example is fantastic and I can happily open it in Blender, change it and then reload it into openFrameworks (using the standard import and export *.3ds with blender 2.48.

I am now trying to make a new model and apply textures with the uv/ImageEditor and for some reason when I open them in openFramworks they all seem to be at 45 degrees…

The squirrel model seems to be fine so I am not sure what I am doing wrong.

I would be really grateful if anyone has come across this or has a good open source alternative… maybe Art of Illusion or something.

I am sure its just one of those things thats easy when you know how

Many thanks

Simon

Hi yes that sounds more like a Blender problem…and probably is just one of those small things. Perhaps try posting the .blend file. It’s difficult to know what it could be.

Also try downloading an .obj viewer…should be several around on the net as .obj is a pretty common format…and see if you get the same result.

Thanks for your reply grimus… I found GLC viewer for os x…
http://www.dewantoro.net/2008/08/25/glc-…-el-viewer/

It seem great but the weird thing is that my model seem to open fine in both 3ds and obj.

But when I try and open them using ofx3DModelLoader the textures are at an angle.

[attachment=0:2xtv9bwc]oF.png[/attachment:2xtv9bwc]

As they seem to open fine in GLC fine I guess the problem must be in how the ofx3DModelLoader is reading or loading my images.

Any ideas or altenatives would really be appreciated.

Here are the files I am working with
http://www.simonblackmore.net/downloads/mlog-model.zip

Thanks again for your help

Best wishes

Simon

Simon, did you UVmap your texture in Blender? You should, for the texture mapping to be ok.

hi Alexandre,

I think its UV mapped correctly as it looks fine in GLC viewer.

[attachment=0:satu8pb6]Picture 1.png[/attachment:satu8pb6]

The textures just seem to offset by half and rotate by 45 degrees when I load the 3ds file into openFrameworks.

I just tried triangulating the surfaces but it didn’t seem to help.

Thanks for helping

Cheers

simon

![](http://forum.openframeworks.cc/uploads/default/330/Picture 1.png)

Hmm - looking at the squirrel example the only difference I can see is that your images are not power of 2 dimensions.

The squirrel is 512 by 512

Maybe try making your textures 512 by 512 adding extra whitepixels as needed and then save out the model.

Curious if that could be the issue.

Theo

well spotted Theo… That has sorted it.

Actually I tried 1024 by 1024 and it worked. Completely makes sense it must be the algorithm
that counts the image expecting it to be square.

Thanks so much for that. I could have spent days tweaking settings in Blender.

Cheers

Simon

Hey glad to hear!

I think this is a bug with the loader - I am sure we can get it working with non-power of 2 textures in the future.

Cheers!
Theo

Thank you for the tip too !

I tried to fix the bug by using alternatives to gluBuild2DMipmaps (see http://www.g-truc.net/post-0256.html) but nothing worked, except scaling up the texture to 1024*1024.

This bug is very strange since gluBuild2DMipmaps is supposed to handle non-power-of-2 textures…