1
Bones / Re: Bones joint rotate but mesh doesn`t update
« on: March 16, 2016, 12:52:17 am »
I pmed you earlier today.
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.
Edit: Another problem with the bones format/java serialization is that it removes the ability to obfuscate your code/bones lib (assuming you want to).it's interesting that you call that a problem but not a restriction.
anyway, it's not a real restriction, you can exclude Bones' classes from obfuscation so serialized format wont cause a problem.
The MaxScript part I can handle. Isn't the point of serialization performance? What if we bypass the bones format altogether and create a JSON-serialized format of our own (and we could--and, indeed, SHOULD--add support for importing other formats, such as the IQM)? We could export to a custom format we could call, say, bonesx (that way we could make our own exporters for Max and Blender spit out the serialized and final file). Regarding JSON, I quote the following article: "The results show that Java serialization is slow for a small number of objects, but good for a large number of objects. Conversely, XML and JSON can outperform Java serialization for a small number of objects, but Java serialization is faster for a large number of objects."
http://java-persistence-performance.blogspot.com.br/2013/08/optimizing-java-serialization-java-vs.html
Oh, I know. I'm getting as far as a MaxScript that exports skin and bone data. I'm currently creating an intermediate JSON-serialized format. But I do hope to do the Java Serialization from inside 3ds max.
Should we coordinate our efforts?
Done. I've also posted a job on Freelance.com for anyone who wants to attempt a MaxScript that takes any biped or bones model from Max and directly exports a .bones file. We'll see how that goes, but that would go a very long way towards making Bones more useful.
That's not a problem unless you use more than 3 (plus one splatting texture) on each tile. Or you could try to combine the textures into fewer but larger ones.
You could use texture splatting for that, but it requires that you actually build a custom splatting texture based on your terrain data and you have to use shaders for this. Here's a basic example: http://www.jpct.net/wiki/index.php?title=Texture_splatting_on_a_terrain
/**
* The terrain heights are calculated now. Now we have to build an
* Object3D from them.
*/
Object3D ground = new Object3D(width * height * 2);
for (int x = 0; x < width - 1; x++) {
for (int z = 0; z < height - 1; z++) {
int x1 = x * 10;
int x2 = (x + 1) * 10;
int z1 = z * 10;
int z2 = (z + 1) * 10;
float southwestY = heights[x][z];
float southeastY = heights[x + 1][z];
float northwestY = heights[x][z + 1];
float northeastY = heights[x + 1][z + 1];
/*
* Triangles start being drawn at the smallest 'x' Cartesian coordinate in jpct.
* You then go clockwise to fill in the rest of the points.
*
*0,1-1,1
* | /|
* | / |
* |/ |
*0,0-1,0
*
* Above is a cheat sheet for the coordinates.
*
*
* TODO: Implement it such we can select the triangle hypotenuse for the tile based
* on surrounding textures. This should improve blending when that finally gets implemented.
*/
// 0,1
// |\
// | \
// | \
// |___\
// 0,0, 1,0
ground.addTriangle(
new SimpleVector(x1, southwestY, z1), 0,0,
new SimpleVector(x2, southeastY, z1),0,1,
new SimpleVector(x1, northwestY, z2), 1,0,
fetchTexture(surfaces[x][z]));
//
//0,1____1,1
// \ |
// \ |
// \|
// 1,0,
ground.addTriangle(
new SimpleVector(x1, northwestY, z2), 1, 0,
new SimpleVector(x2, southeastY, z1), 0, 1,
new SimpleVector(x2, northeastY, z2),1, 1,
fetchTexture(surfaces[x][z]));
// TODO
// ____
// /|
// / |
// / |
// /__ |
}
}