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 - AGP

Pages: 1 2 [3] 4 5 ... 108
31
Support / Re: Merging OBJ Frames
« on: June 02, 2018, 06:59:14 pm »
Down to explorer's granularity they look identical at 5170 kb each. Anyway, I added the following block and am still getting that error message:

Code: [Select]
     if (mesh.getVertexCount() == vertexCount) {
animation.addKeyFrame(mesh);
usedFrames++;
     }

And the number of usedFrames is equal to the total number of frames.

32
Support / Re: Merging OBJ Frames
« on: June 02, 2018, 06:28:34 am »
All of the OBJs have the exact same file size. The following is the output for the first few frames:

Quote
Loading file Catwoman000.mtl
Text file Catwoman000.mtl loaded...386 bytes
Processing new material CatSuit!
Texture named CatAtlas.png added to TextureManager!
Loading file Catwoman000.obj
Text file Catwoman000.obj loaded...5293896 bytes
Processing object from OBJ-file: CC_Base_Body
Processing object from OBJ-file: CC_Base_Body
Object 'CC_Base_Body_jPCT-2' created using 15500 polygons and 8068 vertices.
Processing object from OBJ-file: CC_Base_Tongue
Processing object from OBJ-file: CC_Base_Tongue
Object 'CC_Base_Tongue_jPCT-1' created using 592 polygons and 309 vertices.
Processing object from OBJ-file: CC_Base_Eye
Processing object from OBJ-file: CC_Base_Eye
Object 'CC_Base_Eye_jPCT0' created using 1088 polygons and 580 vertices.
Processing object from OBJ-file: CC_Base_Teeth
Processing object from OBJ-file: CC_Base_Teeth
Object 'CC_Base_Teeth_jPCT1' created using 4822 polygons and 2632 vertices.
Processing object from OBJ-file: Cat_Suit
Processing object from OBJ-file: Cat_Suit
Object 'Cat_Suit_jPCT2' created using 8647 polygons and 4407 vertices.
Processing object from OBJ-file: Bunny_Female
Processing object from OBJ-file: Bunny_Female
Object 'Bunny_Female_jPCT3' created using 1540 polygons and 819 vertices.
Processing object from OBJ-file: Fingerless_gloves
Processing object from OBJ-file: Fingerless_gloves
Object 'Fingerless_gloves_jPCT4' created using 2908 polygons and 1510 vertices.
Processing object from OBJ-file: Female_knee_boots
Processing object from OBJ-file: Female_knee_boots
Object 'Female_knee_boots_jPCT5' created using 2416 polygons and 1228 vertices.
Processing object from OBJ-file: RL_G6_Hair
Processing object from OBJ-file: RL_G6_Hair
Object 'RL_G6_Hair_jPCT6' created using 1266 polygons and 947 vertices.
Processing object from OBJ-file: RL_Face002
Processing object from OBJ-file: RL_Face002
Object 'RL_Face002_jPCT7' created using 12470 polygons and 6429 vertices.



Frames length: 345
I: 1
Loading file Catwoman001.mtl
Text file Catwoman001.mtl loaded...386 bytes
Processing new material CatSuit!
Loading file Catwoman001.obj
Text file Catwoman001.obj loaded...5294012 bytes
Processing object from OBJ-file: CC_Base_Body
Processing object from OBJ-file: CC_Base_Body
Object 'CC_Base_Body_jPCT9' created using 15500 polygons and 8068 vertices.
Processing object from OBJ-file: CC_Base_Tongue
Processing object from OBJ-file: CC_Base_Tongue
Object 'CC_Base_Tongue_jPCT10' created using 592 polygons and 309 vertices.
Processing object from OBJ-file: CC_Base_Eye
Processing object from OBJ-file: CC_Base_Eye
Object 'CC_Base_Eye_jPCT11' created using 1088 polygons and 580 vertices.
Processing object from OBJ-file: CC_Base_Teeth
Processing object from OBJ-file: CC_Base_Teeth
Object 'CC_Base_Teeth_jPCT12' created using 4822 polygons and 2632 vertices.
Processing object from OBJ-file: Cat_Suit
Processing object from OBJ-file: Cat_Suit
Object 'Cat_Suit_jPCT13' created using 8647 polygons and 4407 vertices.
Processing object from OBJ-file: Bunny_Female
Processing object from OBJ-file: Bunny_Female
Object 'Bunny_Female_jPCT14' created using 1540 polygons and 819 vertices.
Processing object from OBJ-file: Fingerless_gloves
Processing object from OBJ-file: Fingerless_gloves
Object 'Fingerless_gloves_jPCT15' created using 2908 polygons and 1510 vertices.
Processing object from OBJ-file: Female_knee_boots
Processing object from OBJ-file: Female_knee_boots
Object 'Female_knee_boots_jPCT16' created using 2416 polygons and 1228 vertices.
Processing object from OBJ-file: RL_G6_Hair
Processing object from OBJ-file: RL_G6_Hair
Object 'RL_G6_Hair_jPCT17' created using 1266 polygons and 947 vertices.
Processing object from OBJ-file: RL_Face002
Processing object from OBJ-file: RL_Face002
Object 'RL_Face002_jPCT18' created using 12471 polygons and 6430 vertices.
I: 2
Loading file Catwoman002.mtl
Text file Catwoman002.mtl loaded...386 bytes
Processing new material CatSuit!
Loading file Catwoman002.obj
Text file Catwoman002.obj loaded...5294007 bytes
Processing object from OBJ-file: CC_Base_Body
Processing object from OBJ-file: CC_Base_Body
Object 'CC_Base_Body_jPCT20' created using 15500 polygons and 8068 vertices.
Processing object from OBJ-file: CC_Base_Tongue
Processing object from OBJ-file: CC_Base_Tongue
Object 'CC_Base_Tongue_jPCT21' created using 592 polygons and 309 vertices.
Processing object from OBJ-file: CC_Base_Eye
Processing object from OBJ-file: CC_Base_Eye
Object 'CC_Base_Eye_jPCT22' created using 1088 polygons and 580 vertices.
Processing object from OBJ-file: CC_Base_Teeth
Processing object from OBJ-file: CC_Base_Teeth
Object 'CC_Base_Teeth_jPCT23' created using 4822 polygons and 2632 vertices.
Processing object from OBJ-file: Cat_Suit
Processing object from OBJ-file: Cat_Suit
Object 'Cat_Suit_jPCT24' created using 8647 polygons and 4407 vertices.
Processing object from OBJ-file: Bunny_Female
Processing object from OBJ-file: Bunny_Female
Object 'Bunny_Female_jPCT25' created using 1540 polygons and 819 vertices.
Processing object from OBJ-file: Fingerless_gloves
Processing object from OBJ-file: Fingerless_gloves
Object 'Fingerless_gloves_jPCT26' created using 2908 polygons and 1510 vertices.
Processing object from OBJ-file: Female_knee_boots
Processing object from OBJ-file: Female_knee_boots
Object 'Female_knee_boots_jPCT27' created using 2416 polygons and 1228 vertices.
Processing object from OBJ-file: RL_G6_Hair
Processing object from OBJ-file: RL_G6_Hair
Object 'RL_G6_Hair_jPCT28' created using 1266 polygons and 947 vertices.
Processing object from OBJ-file: RL_Face002
Processing object from OBJ-file: RL_Face002
Object 'RL_Face002_jPCT29' created using 12469 polygons and 6428 vertices.

33
Support / Re: Merging OBJ Frames
« on: May 30, 2018, 04:49:12 pm »
I did. Same thing.

34
Support / Merging OBJ Frames
« on: May 30, 2018, 11:49:33 am »
I'm about to post a little project for anyone unable to export either Ogre or MD2-animated versions of their models but are able to export OBJ or 3ds. I found a little maxscript that automates the exporting of the frames, and I'm writing the jpct end of it. Problem is I keep getting a size difference of 1 between frame 1 and all the rest ("ERROR: The sizes of the Animation's Meshes (26938) and the object's Mesh (26937) don't match!").

Code: [Select]
/**
Written by AGP (BR) on May, 2018
*/
import java.io.*;
import com.threed.jpct.*;

public class MergeAndSerialize {
     public static void main(String[] args) {
Logger.setLogLevel(Logger.LL_ERRORS_AND_WARNINGS);
float SCALE = 3.6f;
String animationName = "Idle";
if (args == null || args.length < 1) {
     System.err.println("USAGE: java MergeAndSerialize [baseFileName] where the file name needs no extension.\nFOR OBJs ONLY.");
     return;
}
String fileName = args[0].trim();
FilenameFilter filter = new FilenameFilter() {
     public boolean accept(File dir, String name) {
return (name.startsWith(fileName) && name.toLowerCase().endsWith(".obj"));
     }
};
String[] frames = new File("./").list(filter);
Object3D model = Object3D.mergeAll(Loader.loadOBJ(frames[0], frames[0].substring(0, frames[0].lastIndexOf("."))+".mtl", SCALE));
Animation animation = new Animation(frames.length);
animation.createSubSequence(animationName);
System.out.println("\n\n\nFrames length: "+frames.length);
model.build();
for (int i = 1; i < frames.length; i++) {
System.out.println("I: "+i);
     Object3D frame = Object3D.mergeAll(Loader.loadOBJ(frames[i], frames[i].substring(0, frames[i].lastIndexOf("."))+".mtl", SCALE));
     frame.build();
     Mesh mesh = frame.getMesh();
     animation.addKeyFrame(mesh);
}
model.setAnimationSequence(animation);
try {
     new DeSerializer().serialize(model, new java.io.FileOutputStream(fileName.substring(0, fileName.lastIndexOf("."))+".serialized"), false);
}
catch (java.io.IOException ex) {System.err.println("Trouble saving file: "+ex.getMessage());}
java.awt.Toolkit.getDefaultToolkit().beep();
     }
}

35
Support / Re: Now this looks like a Java 10 Thing
« on: May 10, 2018, 06:49:54 pm »
I've tried both -Dsun.java2d.d3d=false and -Dsun.java2d.opengl=false. Neither has solved this annoying issue. One of the reasons I so like the software renderer right there. Still, I'd like for this to go away.

36
Bones / Re: Parsing SkinClipSequence
« on: May 08, 2018, 10:18:15 pm »
I feel like this could be a sticky. It's working, and it will prove very helpful. The ArrayList is there because I was originally testing for nulls before adding to it, but it may as well be removed for performance (although this is the kind of performance that doesn't really matter because you only run this code once before creating your .bones file.

Code: [Select]
     private void firstFrameToLast() {
SkinClipSequence sequence = animatedGroup.getSkinClipSequence();
for (int i = 0; i < sequence.getSize(); i++) {
     SkinClip clip = sequence.getClip(i);
     java.util.Iterator<JointChannel> jCs = clip.iterator();
     ArrayList<JointChannel> jointChannels = new ArrayList<JointChannel>();
     while (jCs.hasNext()) {
JointChannel jC = jCs.next();
     jointChannels.add(jC);
JointChannel channel = jC;
int index = channel.getJointIndex();
float[] times = channel.getTimes();
SimpleVector[] translations = channel.getTranslations();
Quaternion[] rotations = channel.getRotations();
SimpleVector[] scales = channel.getScales();
translations[translations.length-1] = translations[0];
rotations[rotations.length-1] = rotations[0];
scales[scales.length-1] = scales[0];
channel = new JointChannel(index, times, translations, rotations, scales);
clip.removeChannel(jC);
clip.addChannel(channel);
     }
}
saveToBones(objectFileName.substring(0, objectFileName.lastIndexOf("."))+".bones");
System.out.println("Last Frame Replaced With First");
Toolkit.getDefaultToolkit().beep();
     }

37
Bones / Re: Parsing SkinClipSequence
« on: May 08, 2018, 08:38:19 pm »
Thanks a lot.

38
Bones / Re: Parsing SkinClipSequence
« on: May 08, 2018, 06:26:02 pm »
They just implemented multiple animations and I just learned a trick to split them. But I still have a problem with the last (occasionally first) frame, which breaks an otherwise perfect loop. Control over the SkinClips would serve all kinds of purpose, and the ability to fix this would be one of them.

39
Bones / Re: Parsing SkinClipSequence
« on: May 08, 2018, 07:32:15 am »
From what I gather, it's the JointChannels themselves, rather than their number, that I need to split here. But Bones doesn't give me access to that. Would you be willing to change that?

40
Bones / Re: Parsing SkinClipSequence
« on: May 08, 2018, 01:36:21 am »
Isn't SkinClipSequence supposed to be analog to Animation? Because Animation gives us access to KeyFrames, so why can't I find something similar in SkinClipSequence?

41
Bones / Re: Parsing SkinClipSequence
« on: May 07, 2018, 08:35:07 pm »
It worked, but it did not parse the animations: it parsed the movements instead. Now I have an animation that only moves my character's fingers.

42
Bones / Re: Parsing SkinClipSequence
« on: May 07, 2018, 08:22:13 pm »
Thanks.

43
Bones / Re: Parsing SkinClipSequence
« on: May 07, 2018, 08:18:23 pm »
OK, so filling two sets of JointChannels with non-null entries will definitely produce two sets of animations?

44
Bones / Re: Parsing SkinClipSequence
« on: May 07, 2018, 08:11:00 pm »
Raft, do you mind being a little more helpful? Is this even the way to go? Because currently I'm only getting NullPointerExceptions.

45
Bones / Re: Parsing SkinClipSequence
« on: May 05, 2018, 10:36:06 pm »
I tried this:
Code: [Select]
     private void addSequence() {
java.util.Iterator<JointChannel> jCs = sequence.getClip(0).iterator();
ArrayList<JointChannel> jointChannels = new ArrayList<JointChannel>();
while (jCs.hasNext())
     jointChannels.add(jCs.next());
System.out.println("jointChannels Length: "+jointChannels.size() +" Is jointChannels[0] null? "+(jointChannels.get(0)==null));
ArrayList<JointChannel> half1 = new ArrayList<JointChannel>(jointChannels.size()/2);
for (int i = 0; i < jointChannels.size()/2; i++)
     half1.add(jointChannels.get(i));
ArrayList<JointChannel> half2 = new ArrayList<JointChannel>(jointChannels.size()/2);
for (int i = jointChannels.size()/2; i < jointChannels.size(); i++)
     half2.add(jointChannels.get(i));
SkinClip clip = new SkinClip(sequence.getSkeleton(), half1);
clip.setName("1");
java.util.ArrayList<SkinClip> clipList = new java.util.ArrayList<SkinClip>();
clipList.add(clip);
clip = new SkinClip(sequence.getSkeleton(), half2);
clip.setName("2");
clipList.add(clip);
newSequence = new SkinClipSequence(clipList);
newSequence.addClip(clip);
     }

But the printout tells me that jointChannnels.get(0) is null. So what am I doing wrong?

Pages: 1 2 [3] 4 5 ... 108