softbody texture on to mesh
stephanschulz opened this issue · 7 comments
thanks for the great add-on.
is it possible to apply a texture to the bunny in the SoftBodyMeshExample?
it would be great to hear your advice on how to achieve that.
thanks, stephan
The stanford bunny doesn't have any texture coords since the model was created via scanning. You could bring it into Blender and try some of the texturing tools.
ok. thx.
what about the penguin in the OF sample 3DModelLoaderExample.
I used the penguin.ply and the penguin.jpg
loaded both in and use
in setup
texture.load("penguin.jpg");
texture.getTexture().setTextureWrap( GL_REPEAT, GL_REPEAT );
mesh.load("penguin.ply");
in draw
texture.getTexture().bind();
bunnies[i]->draw();
texture.getTexture().unbind();
but a model never appears, and the app starts hanging when pressing key == 'b'
???
A lot of 3D models use 0 -> 1 texture coordinates. So try calling
ofDisableArbTex();
texture.load("penguin.jpg");
ofEnableArbTex();
And after the mesh.load call, print out the number of tex coords on the mesh to make sure it has texture information.
Thanks.
Still no luck. Maybe you can take a look?
I put together my OF 0.10 copy of your example.
https://www.dropbox.com/s/tsfwj4pxa45l6gu/SoftBodyMeshExample.zip?dl=0
ofDisableArbTex();
texture.load("penguin.jpg");
ofEnableArbTex();
mesh.load("penguin.ply");
ofLog()<<"mesh.getNumTexCoords() "<<mesh.getNumTexCoords();
ofLog()<<"mesh.getNumIndice() "<<mesh.getNumIndices();
[notice ] mesh.getNumTexCoords() 11486
[notice ] mesh.getNumIndice() 21348
Thanks again.
I went ahead and made a OF 0.9.8 project.
https://www.dropbox.com/s/mky2g7ykeflfjvc/SoftBodyMeshExample_0-9-8.zip?dl=0
You are right that the penguin has 4 times more vertices.
So I tried the squirrel. It's hard to tell if it texture maps ok, since it is super small in the app.
I guess I will have to find a ok sized model + it's texture.
Does the texture need to have a specific size, or would any image work?
in OF 0.9.8
[notice ] mesh_bunny.getNumTexCoords() 0
[notice ] mesh_bunny.getNumIndice() 5388
[notice ] mesh_penguin.getNumTexCoords() 0
[notice ] mesh_penguin.getNumIndice() 21348
[notice ] mesh_squirrel.getNumTexCoords() 402
[notice ] mesh_squirrel.getNumIndice() 1701
in OF 0.10
[notice ] mesh_bunny.getNumTexCoords() 0
[notice ] mesh_bunny.getNumIndice() 5388
[notice ] mesh_penguin.getNumTexCoords() 11486
[notice ] mesh_penguin.getNumIndice() 21348
[notice ] mesh_squirrel.getNumTexCoords() 402
[notice ] mesh_squirrel.getNumIndice() 1701