Anim8or Community

Please login or register.

Login with username, password and session length
Advanced search  

News:

Ian Ross has just released a book on Anim8or. It's perect for a beginner and a good reference for experienced users. It contains detailed chapters on every aspect, with many examples. Get your own copy here: "Anim8or Tutorial Book"

Author Topic: Feature Request: Vertex Buffer and Index Buffer optimizer  (Read 7215 times)

texel

  • Jr. Member
  • **
  • Posts: 81
    • View Profile
Feature Request: Vertex Buffer and Index Buffer optimizer
« on: December 04, 2008, 01:23:58 pm »

This is a feature which could be great to use anim8or files in 3D engines:
An option in Anim8or to optimize vertex/index/UV/Normal export in .an8 files.

Here are some explanations:
In the current version of anim8or:
_ Each triangles have indices to 3 vertices. If 2 triangles use the same vertex, this vertex is stored just one time in the vertex bloc of the an8 file.
_ Each triangles have indices to 2 couple of uv coords (if used). If 2 vertices use the same uv, this uv is stored just one time in the uv bloc of the an8 file.
_ Each triangles have indices to 3 normales (if exported). If 2 vertices use the same normal, this normal is stored just one time in the normal bloc of the an8 file.
_ The same vertex can have sevral different normal (for each face)
_ The same vertex can have sevral different uv (for each face)
_ An .an8 file can have n vertex, m normal and k UVCoord

But for real time 3D application, it's better to have (to use vertex buffer AND index buffer):
_ 1 normal and 1 uv per vertex.
_ Create a copy of a vertex with its normal and uv, if and only if this vertex is used by several faces having different normal and/or uv and/or binormals.

With an option like "optimize buffer output" .an8 files would have:
_ n vertices
_ n uv coords
_ n normals
_ n binormals (if used)
_ each triangle would have just one index per vertex (and not 3). This index would be the same for the vertex, uv, normal and binormal bloc.

Without this feature, the use of IndexBuffer in OpenGL/DirectX is not very usefull because every vertices are duplicated in vertex bufffer. Developper can also create there own optimization, but it's hard and slow.

I hope it's enought clear :)

PS: This feature could also convert all faces to triangles.



Logged

Claude

  • Sr. Member
  • ****
  • Posts: 285
    • View Profile
Re: Feature Request: Vertex Buffer and Index Buffer optimizer
« Reply #1 on: December 05, 2008, 12:24:40 am »

Salut

Anim8or gives you the option of doing that thru ASL.
The tridata stucture lets you access data in a way
compatible with vertex array and VBO.

You have to create an export script to your own 3D file format
(compatible with  vertex array and VBO) and obviously a loader
in your 3D engine.

The animation data and support for binary file are still missing,
but they are on the todo list.

I've tried it.It worked.The 3D file format was similar to OBJ,but adapted to Anim8or.

Not exactly what you asked for,but close enough,I think.
Unless,you already knew.
Hope this helps.

Bonne journée.
Claude
Logged

texel

  • Jr. Member
  • **
  • Posts: 81
    • View Profile
Re: Feature Request: Vertex Buffer and Index Buffer optimizer
« Reply #2 on: December 05, 2008, 03:30:49 pm »

I didn't know that.
But i prefer C++ :)
Logged

Claude

  • Sr. Member
  • ****
  • Posts: 285
    • View Profile
Re: Feature Request: Vertex Buffer and Index Buffer optimizer
« Reply #3 on: December 05, 2008, 03:41:36 pm »

The ASL script is just to export your model.
The loader could be written in C++.
That's what I did.
It's a lot faster to write than a loader for the
Anim8or file.
Logged