www.jpct.net

Bones - Skeletal and Pose Animations for jPCT/jPCT-AE => Bones => Topic started by: jaychang0917 on April 05, 2017, 09:42:51 am

Title: How to set texture to object material
Post by: jaychang0917 on April 05, 2017, 09:42:51 am
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?
Code: [Select]
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
...


Title: Re: How to set texture to object material
Post by: 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
Title: Re: How to set texture to object material
Post by: 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)
Title: Re: How to set texture to object material
Post by: jaychang0917 on April 07, 2017, 03:55:27 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.
Code: [Select]
animatedGroup.get(0).setTexture("head");
animatedGroup.get(1).setTexture("headTop");
animatedGroup.get(2).setTexture("head");
...
Title: Re: How to set texture to object material
Post by: jaychang0917 on April 07, 2017, 03:56:27 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? :)
Title: Re: How to set texture to object material
Post by: raft on April 07, 2017, 04:07:03 pm
Quote
i tried to set the texture by Animated3D index instead of name, seems work.
Code: [Select]
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
Title: Re: How to set texture to object material
Post by: jaychang0917 on April 11, 2017, 07:09:19 am
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?
Title: Re: How to set texture to object material
Post by: raft on April 11, 2017, 10:10:29 am
which pipeline are you using, Collada or Ogre3D?

are you sure it's exported correctly?
Title: Re: How to set texture to object material
Post by: jaychang0917 on April 11, 2017, 10:20:26 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?
Title: Re: How to set texture to object material
Post by: raft on April 11, 2017, 11:05:11 am
interesting, might be jpct-ae
Title: Re: How to set texture to object material
Post by: jaychang0917 on April 11, 2017, 11:24:23 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)
Code: [Select]
frameBuffer = new FrameBuffer(width, height);

For desktop (jpct)
Code: [Select]
frameBuffer = new FrameBuffer(width, height, FrameBuffer.SAMPLINGMODE_NORMAL);

So what approach can i take to solve this problem?
Title: Re: How to set texture to object material
Post by: raft on April 11, 2017, 11:28:48 am
may be ask in jpct-AE forum? :)
Title: Re: How to set texture to object material
Post by: jaychang0917 on April 11, 2017, 12:41:09 pm
may be ask in jpct-AE forum? :)

I post a new thread in jpct-AE forum, see if you have any idea :)
http://www.jpct.net/forum2/index.php/topic,4878.msg33311.html#msg33311 (http://www.jpct.net/forum2/index.php/topic,4878.msg33311.html#msg33311)
Title: Re: How to set texture to object material
Post by: AGP on May 09, 2017, 02:18:58 pm
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 (http://www.scriptspot.com/3ds-max/scripts/texture-atlas-generator)