Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - jaychang0917

Pages: 1 [2] 3 4
16
Bones / Re: How to set texture to object material
« 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");
...

17
Bones / How to set texture to object material
« 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
...



18
I tried with the following code, it works.

Code: [Select]
model.clearRotation();
model.rotateX((float) Math.toRadians(pitch));
model.rotateY((float) Math.toRadians(yaw));
model.rotateZ((float) Math.toRadians(roll));

19
Is there any method that i can rotate a model by euler angles (pitch, yaw, roll)?
Thanks!

20
Support / Re: How to place object at specific location of world?
« on: April 01, 2017, 09:03:15 am »
I fixed by using model.getRoot().clearTranslation(); :)

21
Support / Re: How to place object at specific location of world?
« on: April 01, 2017, 05:08:57 am »
Uhm... I don't quite understand what you mean... Sorry

The application i am developing is to draw points of detected face using front camera and place a face model on top of those points. so if i use 1.5f scalar, the model will be shifted right a little.

22
Support / Re: How to place object at specific location of world?
« on: March 31, 2017, 07:04:24 pm »
Hmmm you could add some scalar to the translation...
model.getRoot().translate(
      -1.5f * targetPosition.x -model.getRoot().getTransformedCenter().x,
      -1.5f * targetPosition.y -model.getRoot().getTransformedCenter().y,
      0);

With 1.5f being your scalar... Which could be any value up to you :)

This did come across my mind, but the issue is that the model will be shifted by 1.5 times at the first rendering. You will see that the model is not at the center at first time.

23
Support / Re: How to place object at specific location of world?
« on: March 31, 2017, 12:45:56 pm »
Although the direction of movement is correct now, but the proportion of movement seems less than before.

24
Support / Re: How to place object at specific location of world?
« on: March 31, 2017, 09:22:39 am »
Oh hmmm, well you could try to swap this:
model.getRoot().translate(
      targetPosition.x -model.getRoot().getTransformedCenter().x,
      targetPosition.y -model.getRoot().getTransformedCenter().y,
      0);

To:
model.getRoot().translate(
      -targetPosition.x +model.getRoot().getTransformedCenter().x,
      -targetPosition.y +model.getRoot().getTransformedCenter().y,
      0);

Which should swap the translation direction into the opposite X and Y direction.

I tried your code, the model will continuously move to left side instead stop at a position, and i log the parameters x and y as follows,
Code: [Select]
x: -7.5 y: 7.4305553
x: -19.51389 y: 9.097222
x: -39.305557 y: 15.000001
x: -83.61111 y: 26.180557
x: -167.63887 y: 50.555557
....

25
Support / Re: How to place object at specific location of world?
« on: March 31, 2017, 08:39:39 am »
Thanks AeroShark333, it works.

Let's say the model is rendered on a 1440*1440 screen, and I have a 2d point like (x, y), i want to place the model base on this point, so i try to translate this point to world space point and do translation with the following code,
Code: [Select]
SimpleVector targetPosition = new SimpleVector();

Interact2D.reproject2D3DWS(world.getCamera(), frameBuffer,
      x, y, world.getCamera().getPosition().z, targetPosition);

model.getRoot().translate(
      targetPosition.x -model.getRoot().getTransformedCenter().x,
      targetPosition.y -model.getRoot().getTransformedCenter().y,
      0);

but i found that the targetPosition.x will be decrease if x increase, I log the result as follow,
Code: [Select]
2d: PointF(518.5, 746.5) => 3d:(14.027778,-1.8055556,-80.0)
2d: PointF(677.16003, 587.04706)  => 3d:(2.9861112,9.236111,-80.0)

So my model will be moved oppositely. Have any idea? Thanks!

26
Bones / Re: No animations found in collada file!
« on: March 31, 2017, 04:16:53 am »
well, the error is descriptive I suppose :) there are multiple skeletons. maybe you are exporting multiple models with separate skeletons?

you can have multiple models and all should be attached to a single skeleton

You mean the designer doesn't put the models under a root model?

27
Support / Re: How to place object at specific location of world?
« on: March 30, 2017, 05:48:41 pm »
Just a quick question: Why don't you just blit the watermark instead of creating an object for it? Or you could use an Overlay instead...if your manual GL calls don't break its functionality...
Hi, i still want to know how can I move an object. I call translate() in the onDraw() loop, the model will keep moving instead of move to that position. Is there any method that can move the object to an absolute position and it stops at there?

28
Bones / Re: No animations found in collada file!
« on: March 30, 2017, 12:06:40 pm »
you compare it with what?

yes, possibly missing library_controllers is the reason

New errors occurred, it shows `There are more than one skeletons in ColladaStorage.` Have any idea?

Code: [Select]
Exception in thread "main" java.lang.IllegalArgumentException: There are more than one skeletons in ColladaStorage.
at raft.jpct.bones.BonesImporter.findUniqueArdorSkeleton(BonesImporter.java:359)
at raft.jpct.bones.BonesImporter.importCollada(BonesImporter.java:66)
at bones.samples.ProceduralAnimationSample.initialize(ProceduralAnimationSample.java:84)
at bones.samples.AbstractSample.loop(AbstractSample.java:91)
at bones.samples.ProceduralAnimationSample.main(ProceduralAnimationSample.java:311)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)

29
Bones / Re: No animations found in collada file!
« on: March 29, 2017, 10:16:53 am »
I got a new model from designer yesterday. But unfortunately it still can't be loaded, same error "ColladaStorage contains no skins." shows. I used text editor to open the working .dae file (Seymour.dae) and my model .dae file, i found there are two differences that my model lacks two nodes (library_controllers and library_physics_scenes).

Is this the root cause of the error? Thanks!

30
Support / Re: How to place object at specific location of world?
« on: March 24, 2017, 03:29:20 pm »
arrr... i can blit it, it is much more efficient and easy way. Thanks your suggestion.

Pages: 1 [2] 3 4