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.

Topics - raft

Pages: 1 ... 4 5 [6] 7 8
Bones / Bones - Skeletal and Pose animations for jPCT
« on: January 06, 2010, 11:45:01 pm »
Bones is a animation API for jPCT. It supports skeletal and pose animations. It's aimed to be small library with no additional dependencies where possible.

Bones can be found at its home page. The download pack contains the source code, necessary libraries, Eclipse project files and a few demo applications. It's definitely free software with a "Do whatever with it" license.

Note: As the API evolved, following information is not exactly correct anymore. Please refer to Bone's home page for up to date information.

Bones initially loads skinning information via Ardor3D's Collada loader. Out of this information, a series of SkinnedObject3D's are constructed. They have mesh data, textures coordinates and skinning information. It's enough to set their textures and call build() to prepare them to be added into a jPCT world.

After this initial loading, they can be saved in a compact form. Saved objects can be later reloaded with loader, with no dependencies to Ardor3D

At the moment, the project is at "Proof of Concept" state. Skinning and mesh deformation works, but skeleton poses can only be created programmatically. Hence it's not really useful for games at the moment. This is so since, Ardor3D's loader only support this much at the moment. As they progress, Bones will progress..

Cheers ;D
r a f t

Edit: Updated the link with some code cleanup and documentation.
Edit2: Updated title and description to reflect changes in the API

Support / steps to take after Object3D.setMesh(mesh)
« on: January 06, 2010, 08:35:30 pm »

i created an Object3D with zero triangles and set a mesh to it. after this either calling build() or recreateTextureCoords() throws a null pointer exception at recreateTextureCoords().

what other steps should i take to prepare the object ?

Support / safely interpolate rotations
« on: January 04, 2010, 11:45:39 pm »

Ardor uses quaternions for rotations. in demo, it calculates a rotation from a vector to a vector and interpolates rotation with identity rotation. AFAIK with quaternions this is perfectly legal and make sense.

i tried to emulate this in jPCT by interpolating two matrices. sometimes results become very strange. i guess this happens when two rotations (matrices) are too different. afterall interpolating matrices for rotations does not makes sense mathematically.

so is there a safe way in jPCT to interpolate a rotation ?

r a f t

Support / translation
« on: January 03, 2010, 03:00:59 pm »

i've figured that, translation info in Object3D's rotation matrix effects where the object is rendered.

for example, this box is rendered at 1,0,0 point
Code: [Select]
Object3D box = Primitives.getBox(1, 1);
box.getRotationMatrix().set(3, 0, 1f);

is this intentional ?

Support / a rotation matrix from one direction to another
« on: January 02, 2010, 04:31:47 pm »

how can i create a rotation matrix such that, when applied, it rotates a direction vector to another ?

Code: [Select]
SimpleVector from;
Simplevector to;

from.equals(to); // -> should be true ignoring rounding errors

Support / why 2 matrices ?
« on: January 01, 2010, 09:16:32 pm »

what's the purpose of having 2 matrices (rotation and translation) per Object3D ? AFAIK rotation matrix uses the upper left 3x3 part and translation matrix only uses the 3 entries in last row. seems as these can be merged into one, or not ?

why is it so ? for historical reasons or to maintain backwards compatibility or ?

r a f t

Support / vertex sharing and vertex indices
« on: December 28, 2009, 07:13:16 pm »

indeed i would keep this as a surprise ::) what i'm after is to make a skeletal animation implementation based on Ardor3d's Collada loader. i'm aiming it will be very lightweight and the runtime will not require Ardor3d.

i've constructed the mesh out of Ardor3d's mesh, assigned texture and coordinates but stuck at vertex indices. Ardor3d stores weights and joint indices in buffers where data is ordered according to mesh vertices. i need a way to match ardor3d vertices and jPCT vertices but there seems no way. futhermore Ardor3d also makes its own vertex sharing among polygons (not sure if engine optimizes it or Collada file is already optimized but that doesnt matter). so Object3D.disableVertexSharing doesnt help either.

only solution i can think of is, use same exact vertices and vertex sharing in jPCT to create an Object3D.

so is it possible to add a method or constructor to Object3D which takes vertice and texture coordinates as float arrays and an int array as index buffer ?

r a f t

Support / creating an object from FloatBuffer
« on: December 27, 2009, 06:58:28 pm »

i'm trying to reconstruct an Ardor3d object in jPCT. it internally stores mesh data (vertices and texture coords) as FloatBuffers. it then directly feeds GL with that float buffers:
Code: [Select]
GL11.glVertexPointer(3, 0, vertexBuffer);
and this is what i do in an Object3D constructor. read the data from vertex and textures buffers and create polygons out of them:

Code: [Select]
        FloatBufferData vertexCoords = mesh.getMeshData().getVertexCoords();
FloatBuffer vertexBuffer = mesh.getMeshData().getVertexBuffer();

        FloatBufferData textureCoords = mesh.getMeshData().getTextureCoords().get(0);
FloatBuffer textureBuffer = textureCoords.getBuffer();

        final float[] vertexData = new float[3];
        final float[] textureData = new float[6];
for (int i = 0; i < vertexCoords.getTupleCount()/3; i++) {

SimpleVector vert1 = new SimpleVector(vertexData);

SimpleVector vert2 = new SimpleVector(vertexData);

SimpleVector vert3 = new SimpleVector(vertexData);

addTriangle(vert1, textureData[0], textureData[1],
vert2, textureData[2], textureData[3],
vert3, textureData[4], textureData[5]);

something is definetly wrong as the constructed object is totally shapeless. any ideas ?

r a f t

Support / applying a 3rd party transform
« on: December 26, 2009, 08:15:46 pm »

i want to apply ardor3d's transform to a jPCT object. it has a 3x3 rotation matrix, a translation and a scale vector. ardor3d's coordinate system differ from jPCT (Y up i guess)

i'm trying to create two jPCT matrices, fill them in and set as rotation and translation matrices on Object3D.

* translation: straightforward: new Matrix().translate(x, y, z)
* rotation: AFAIK in jPCT rotation matrix, only upper left 3x3 part is used. i guess filling them in will be enough. but how to handle coordinate system difference ?
* scale vector: jPCT does not directly support scaling at different axis. but is it possible to achive the effect by playing with matrices ?

ardor3d transform also has a method which returns a 4x4 matrix in the following form. maybe using it with some modification on the result makes more sense ?

Code: [Select]

 R R R Tx
 R R R Ty
 R R R Tz
 0 0 0 1
r a f t

Support / create a pyramide pointing some location
« on: December 26, 2009, 06:51:21 pm »

i have two points: from and to. i want to create a pyramide so that, it's bottom center is placed at from and top corner is at to.

i'm using the following code but it doesnt correctly set direction. what's wrong here ?

Code: [Select]
public static Object3D createPyramide(SimpleVector from, SimpleVector to) {
SimpleVector direction = to.calcSub(from);
float length = direction.length();
Object3D p = Primitives.getPyramide(length);
// Pyramide is centered at origin, so move bottom to origin
p.translate(0, -length/2, 0);

return p;

r a f t

Support / demos are broken under 64 bit linux
« on: December 07, 2009, 03:55:50 am »
adding 64 bit so's to jnlp desc may help

Support / feature request: continuous LoD
« on: November 13, 2009, 07:54:24 am »
hi all,

so jPCT has compiled objects, built in software mipmapping, multi-threading support and so on.. all so good :)

if i know Egon a bit, he is possibly already thinking of next big target, i suggest continuous LoD (level of detail) ;)

at the moment, as far as i know, there is practically no way to implement such a thing on top of jPCT. one can only add triangles to an object, move their vertices with an IVertexController but cannot remove.

using separate meshes for diffent LoD levels (as i did in karga) is an option, but it's not continous, does not look good because of the flop effect, is a real pain to configure and does not fit well for large scene objects.

just a suggestion..
vote for continous LoD ;)

r a f t

Support / textures are gone after some time
« on: October 20, 2009, 04:53:08 pm »

i've adapted new version of jPCT to karga. (not online yet) and been playing with mipmapping and multi threading. multi threading definetely increases fps one multi core machines :) mipmapping works almost identical to previous external MipMapper and i guess performs slightly better. and of course much easier to use. great job :)

however after some time, some of my textures are gone. it's like we have added an object with a missing texture. below are two shots:

i cannot regularly reproduce it, but i can say it happens with multi cores, mipmapping enabled and MOSTLY while resizing the window (creating a new FrameBuffer). i guess it's a multi-threading issue

any ideas ?

r a f t

Projects / SwingGL - Swing on top of OpenGL
« on: March 31, 2009, 11:26:08 pm »

for a few days i've been working on a crazy idea: making Swing work on top of OpenGL. which i think will be very useful if we make it run smoothly. so i've downloaded the jdk source and started digging into it

i first tried rendering, extended awt.Graphics2D and implemented some methods of it. luckily swing seems to use only a small portion of that methods and most can be easily implemented with OpenGL commands. there are some differences though. anyway, below screenshot will give an idea.. the main trick is making top level component believe that it's placed in a container and is visible. than it happily painted itself and its children on given GL based Graphics implementation

second i tried forwarding mouse events from LWJGL display to Swing. this one was hard. all major classes and methods in this process are package private. i still couldnt find a 'normal way' but made a nasty hack: set a private field of some class with reflection. this will almost certainly wont work on a non-Sun JVM and will possibly break in the future. but still proofs, with a proper interleave point making swing event system work offline is possible. i believe, with implementing a custom awt.Tookit and a dummy peer of some component, making event system work without reflection hack is possible. i just couldnt figure out how. maybe some Swing/AWT guru may help ?

later turn will come to keyboard events and keyboard focus. similarly i believe this would be possible with customizing toolkit..

i'm not sure i will have time and continue this project. the code is a mess now, i will publish it when i clean it up. maybe somene will continue it ? if anyone is interested, i will happily go into details..

here is a a web startable link. i tried it on Ubuntu Hardy and Win XP, it worked ok altough there are some small rendering differences. i especially wonder if it will work ok on MacOSX

below is a screenshot, SwingGL running on HelloWorld example (GL one)

cheers  ;D
r a f t

edit: SwingGL can be found at

Support / calling LWJGL methods directly
« on: March 30, 2009, 08:29:40 am »

what should i do to call opengl methods directly after jPCT has done ? for example the code below doesnt draw a line

Code: [Select]

while (loop) {
    // do jPCT things

    // do lwjgl things
    GL11.glVertex2f(10, 10);
    GL11.glVertex2f(50, 50);


Pages: 1 ... 4 5 [6] 7 8