How to set texture to object material

Started by jaychang0917, April 05, 2017, 09:42:51 AM

Previous topic - Next topic

jaychang0917

Suppose my model is a composite of objects, and each object contains few materials, I need to map different texture for each material.

I tried to print the name, i can't get the material name but object name. How can I get the material name of each object?

for (Animated3D o : skinnedGroup) {
    System.out.println("name:" + o.getName());
    o.build();
    o.discardMeshData();
}
// output
name:headMesh_triangles
name:headMesh_triangles
name:headMesh_triangles
name:headMesh_triangles
name:headMesh_triangles
name:headMesh_triangles
name:headMesh_triangles
name:headMesh_triangles
name:headMesh_triangles
name:headMesh_triangles
name:Cover_LMesh_triangles
name:Cover_LMesh_triangles
name:Cover_RMesh_triangles
...




raft

you cannot I believe. materials and texture information is not passed to Bones during export-import process. texture coordinates are passed though.

in this case, you can for example bake the materials into a texture and assign that texture to your Animated3D's

raft

video not appearing part may also related to a thread synchronization issue. in particular if you dont consume a video frame new update never arrives (as far as I remember)

jaychang0917

Quote from: raft on April 05, 2017, 11:13:12 PM
you cannot I believe. materials and texture information is not passed to Bones during export-import process. texture coordinates are passed though.

in this case, you can for example bake the materials into a texture and assign that texture to your Animated3D's

i tried to set the texture by Animated3D index instead of name, seems work.

animatedGroup.get(0).setTexture("head");
animatedGroup.get(1).setTexture("headTop");
animatedGroup.get(2).setTexture("head");
...

jaychang0917

Quote from: raft on April 06, 2017, 02:59:45 PM
video not appearing part may also related to a thread synchronization issue. in particular if you dont consume a video frame new update never arrives (as far as I remember)

?? you are answering my qestion? :)

raft

Quote
i tried to set the texture by Animated3D index instead of name, seems work.

animatedGroup.get(0).setTexture("head");
animatedGroup.get(1).setTexture("headTop");
animatedGroup.get(2).setTexture("head");
...

nice :)

Quote
Quote
video not appearing part may also related to a thread synchronization issue. in particular if you dont consume a video frame new update never arrives (as far as I remember)

?? you are answering my qestion? :)
nope, sorry, wrong thread, have no idea how this happened :D

jaychang0917

raft, I found that the imported model is not rendered correctly. If the geometry contains multiple elements, it seems only render the first element. Do you have any idea?

raft

which pipeline are you using, Collada or Ogre3D?

are you sure it's exported correctly?

jaychang0917

Quote from: raft on April 11, 2017, 10:10:29 AM
which pipeline are you using, Collada or Ogre3D?

are you sure it's exported correctly?

I am using Collada.

I found that the model is rendered correctly using the ProceduralAnimationBonesSample, is it the jpct-ae problem?

raft


jaychang0917

#10
Quote from: raft on April 11, 2017, 11:05:11 AM
interesting, might be jpct-ae

Almost all code are the same for desktop and android version except the FrameBuffer object creation.

For android (jpct-ae)

frameBuffer = new FrameBuffer(width, height);


For desktop (jpct)

frameBuffer = new FrameBuffer(width, height, FrameBuffer.SAMPLINGMODE_NORMAL);


So what approach can i take to solve this problem?

raft



AGP

It doesn't seem appropriate now that I've read the rest of the thread, but it's useful to point out the following max script that I use to create texture atlases (it fails 30% of the time but it's still very useful when it works): http://www.scriptspot.com/3ds-max/scripts/texture-atlas-generator