### 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 ... 3 4 [5] 6 7 ... 104
61
##### Bones / Re: Scale Problem?
« on: August 31, 2017, 03:07:27 pm »
Sorry, I hadn't realized that you replied.

No, they were both attempts to fix the incomprehensible problem. scaleBones looks like this (where SCALE is currently set to 1.00f):

Code: [Select]
`    private static void scaleBones(ArrayList<Bone> bones) {        for (int i = 0; i < bones.size(); i++) {            Bone aBone = bones.get(i);            scaleBonePosition(aBone);            scaleBoneMatrix(aBone);        }    }    private static void scaleBonePosition(Bone aBone) {        aBone.position.x *= SCALE;        aBone.position.y *= SCALE;        aBone.position.z *= SCALE;    }        private static void scaleBoneMatrix(Bone aBone) {        aBone.transform.scalarMul(SCALE);    }`
invertBones just multiplies all values by -1. Neither attempts at solutions either help or hurt the problem.

62
##### Bones / Scale Problem?
« on: August 29, 2017, 10:04:27 pm »
I have a class called Bone, as defined in the following code. It's used as a bridge between the JSON-serialized format I created and Bones.

Code: [Select]
`class Bone {    protected String name;    protected SimpleVector position;    protected Matrix transform;    protected int index, parentIndex;    public Bone(String name, SimpleVector position, Matrix transform, int index, int parentIndex) {        this.name = name;        this.position = position;        this.transform = transform;        this.index = index;        this.parentIndex = parentIndex;    }    public boolean hasParent () {        return this.parentIndex >= 0;    }    public String toString () {        return this.name + ": " + this.position;    }}`
When I print its values as follows, I get perfectly reasonable numbers (values ranging from -30 to +120).

Code: [Select]
`System.out.println(newBone.toString() +": "+newBone.index);`
But, after creating my AnimatedGroup, as follows, the values range between -Infinity to +Infinity, with NaNs thrown in there for good measure.

Code: [Select]
`    public static AnimatedGroup loadGroup(JsonLoader jsonLoader) {        MaxBonesClip[] clips = Importer.getMaxBonesClips(jsonLoader);        MaxBonesImporter jImporter = new MaxBonesImporter(jsonLoader, clips);        ArrayList<ArrayList> objects = jImporter.getList();        ArrayList<Bone> bones = jImporter.getBones();        ArrayList<ArrayList> objectsBonesReferences = jImporter.getBonesReferences(); // for all objects, respects the same order of objects        Animated3D anObject = null;        SimpleVector center = null;        scaleBones(bones);        invertBonesCoords(bones);        Skeleton skeleton = Importer.makeSkeleton(bones);        SkeletonPose pose = new SkeletonPose(skeleton);        pose.updateTransforms();                Animated3D[] list = new Animated3D[objects.size()];        for (int i = 0; i < objects.size(); i++) {            ArrayList<ArrayList> theObject = objects.get(i);            if (bones == null || bones.size() <= 0) {                Logger.log("Problem: no bones. Try loadObject(String) instead.");                java.awt.Toolkit.getDefaultToolkit().beep();                return null;            }            anObject = makeAnimated3D(pose, objectsBonesReferences.get(i), theObject, new File(jsonLoader.getMainFileName()).getParent());            anObject.build();            list[i] = anObject;        }        System.out.println("To test: "+bones.get(JSONFrame.BONE_INDEX_TO_TEST));        AnimatedGroup asGroup = new AnimatedGroup(list);        asGroup.setSkinClipSequence(getSkinClipSequence(jImporter, anObject.getSkeleton()));        return asGroup;    }    private static Animated3D makeAnimated3D(SkeletonPose pose, ArrayList<BoneReference> boneRefs, ArrayList<ArrayList> theImportedObject, String absolutePath) {        ArrayList<ArrayList> vertices = theImportedObject.get(0);        ArrayList<String> diffuseAndNormal = theImportedObject.get(3);        int verticesCount = vertices.size();                //skeletonDebugger = new SkeletonDebugger(pose, 0f, 1f);                float[][] weights = new float[verticesCount][Importer.MAX_JOINTS_PER_VERTEX];        short[][] jointIndices = new short[verticesCount][Importer.MAX_JOINTS_PER_VERTEX];        int[] verticesCounters = new int[verticesCount];        for (int i = 0; i < verticesCount; i++) verticesCounters[i] = 0;                for (BoneReference aBoneRef: boneRefs) {            int vertexRef = aBoneRef.vertexIndexReference;                        int verticesCounter = verticesCounters[vertexRef];            if (verticesCounter < Importer.MAX_JOINTS_PER_VERTEX) {                weights[vertexRef][verticesCounter] = aBoneRef.vertexWeight;                jointIndices[vertexRef][verticesCounter] = aBoneRef.boneIndexReference;                verticesCounters[vertexRef]++;            }        }        SkinData skin = new SkinData(weights, jointIndices);        if (!TextureManager.getInstance().containsTexture(diffuseAndNormal.get(0)))        TextureManager.getInstance().addTexture(diffuseAndNormal.get(0), new Texture(absolutePath +File.separator+diffuseAndNormal.get(0)));                MeshData meshData = makeMeshData(theImportedObject);        Animated3D anAnimated = new Animated3D(meshData, skin, pose);        anAnimated.setTexture(diffuseAndNormal.get(0));        return anAnimated;    }`
These prints produce NaNs, and the infinities:
Code: [Select]
`        for (int h = 0; h < asGroup.getSize(); h++) {            Animated3D temp = asGroup.get(h);                        Skeleton s = asGroup.get(h).getSkeletonPose().getSkeleton();            for (int i = 0; i < s.getNumberOfJoints(); i++) {                System.out.println(temp.getSkinClipSequence().getClip(0).getSkeleton().getJoint(i).getBindPose().toString());                //temp.applySkeletonPose();                //temp.animateSkin(frame, sequence);                //temp.applyAnimation();            }        }`

63
« on: August 25, 2017, 05:11:51 am »
I'm sure that I did in the past, but what's a reasonable value? And, since you have the scene, are the scales and distances reasonable?

64
« on: August 22, 2017, 10:28:38 am »
Sorry, I got a lot of emails yesterday. If some filter could be applied to the shadows it would already help a good deal (is there no way, to access the shadow map and, thus, for instance, apply java.awt.Image filters?). Thanks for having a look.

65
« on: August 22, 2017, 12:36:59 am »
Have you had a look at it, Egon?

66
##### Bones / SkeletonDebugger Auto-Scale Feature?
« on: August 18, 2017, 10:19:15 pm »
I've been stuck for weeks on what has to be the last stages of my file format. I load the whole thing into bones without a problem, but animating it is something else altogether. When I try to use the SkeletonDebugger, I get an "ERROR: Invalid scale!" message. When I animate it, the center of the object doesn't change but it disappears entirely. No further errors as the animation runs, but no visible object, even with culling set to false.

I can't figure this error out (especially since I can reimport the object back into 3ds max and succesfully play its animations). Would it be possible to add some logic such that SkeletonHelper would automatically rescale this invalid scale?

67
##### Bones / Re: My Format
« on: August 17, 2017, 06:41:11 pm »
I think that it's still being maintained, but I'm not sure. The user base is almost gone, per a thread I read on their board. But we have no way of using it anymore.

68
##### Bones / Re: My Format
« on: August 17, 2017, 06:35:11 am »
Just dropped by to point out that even EasyOgreExporter is no longer available (no 2018 version). And, no command line tools to convert from binary to .xml, either, so even the older versions (I'm still running Max 2017, for instance) would be no good.

69
« on: August 16, 2017, 05:52:55 am »
I've emailed you one. But my forest is actually even bigger than that (regardless, the artifacts are plainly visible). Thanks in advance.

70
« on: August 14, 2017, 10:31:43 pm »
The movement is terrible, Egon, even with the shadow map at the size of 8192 pixels. There's no compression problem on the video: what you think is a codec issue is the shadow issue.

71
« on: August 14, 2017, 06:04:38 am »
Egon, I'd really like to solve the shadow-map movement issue in jpct. I've put out finishing a nice little RPG game for a couple of years because of it. The following shows the problem I get when I move the sun:

72
##### Support / Re: Wall Collision
« on: August 13, 2017, 10:33:04 pm »
I did, and you can see it in that code, but I was being thick. I can't help it: if I don't ask for help my brain shuts down. As soon as I get a response I can figure it out. LOL

The following solved it:

Code: [Select]
`      final float MOVE_SPEED = joystick.getYAxisValue()*(float)deltaTime*-100f;      SimpleVector direction = wallCollision(MOVE_SPEED);    private void wallCollision(float MOVE_SPEED) { SimpleVector cameraZ = camera.getZAxis(); SimpleVector direction = new SimpleVector(cameraZ.x*MOVE_SPEED, cameraZ.y*MOVE_SPEED, cameraZ.z*MOVE_SPEED);theWorld.checkCameraCollisionEllipsoid(camDirection.getZAxis(), ELLIPSOID_RADIUS, MOVE_SPEED, 5);    }     private SimpleVector collide(SimpleVector directionToHead) { ground.setVisibility(false); SimpleVector direction = theWorld.checkCollisionEllipsoid(camera.getPosition(), directionToHead, ELLIPSOID_RADIUS, 5);//.5f, 2f, .5f), 5 if (directionToHead.x != direction.x || directionToHead.z != direction.z) { System.out.println("Collided and not with ground. Direction: ("+directionToHead.x +", "+directionToHead.z +") Return route: ("+direction.x +", "+direction.z +")."); Toolkit.getDefaultToolkit().beep(); } ground.setVisibility(true); return direction;     }`

73
##### Support / Wall Collision
« on: August 12, 2017, 12:10:26 am »
I'm trying to use the following code. In this case, the walls and the floor are different entities. Collision with the floor is handled separately and works fine. When I do get a collision with the walls, which is not always, I get printouts like "Collided and not with ground. Direction: (-7.939828, -2.0494497) Return route: (5.188492, -2.2546387)." Why would I not at least get the reverse of my direction? How should I do this, instead?

In loop():
Code: [Select]
`      wallCollision(MOVE_SPEED);      camera.moveCamera(Camera.CAMERA_MOVEIN, MOVE_SPEED);`
Code: [Select]
`    private void wallCollision(float MOVE_SPEED) { SimpleVector cameraZ = camera.getZAxis(); SimpleVector direction = new SimpleVector(cameraZ.x*MOVE_SPEED, cameraZ.y*MOVE_SPEED, cameraZ.z*MOVE_SPEED); SimpleVector newDirection = collide(direction);    }     private SimpleVector collide(SimpleVector directionToHead) { ground.setVisibility(false); SimpleVector direction = theWorld.checkCollisionEllipsoid(camera.getPosition(), directionToHead, ELLIPSOID_RADIUS, 5);//.5f, 2f, .5f), 5 if (directionToHead.x != direction.x || directionToHead.z != direction.z) {      float multiplier = 1f;      direction.x*= multiplier;      direction.z*= multiplier; System.out.println("Collided and not with ground. Direction: ("+directionToHead.x +", "+directionToHead.z +") Return route: ("+direction.x +", "+direction.z +")."); Toolkit.getDefaultToolkit().beep();      camera.moveCamera(direction, 1f); } ground.setVisibility(true); return direction;     }`

74
##### Support / Re: Only thing rendered is the SkyBox
« on: June 25, 2017, 07:26:01 am »
Got the SkyBox working for the individual textures. ; )

Still think a FrameBuffer3D is pertinent (clean and safe, and all-too-useful).

75
##### Support / Re: Only thing rendered is the SkyBox
« on: June 23, 2017, 07:41:41 pm »