iamgreaser / iceball

Open-source rewrite of the VOXLAP version of Ace of Spades.
http://iceball.build
GNU General Public License v3.0
114 stars 32 forks source link

PMF model format #63

Closed melchips closed 11 years ago

melchips commented 11 years ago

The current model format (PMF) doesn't seem appropriate for the OpenGL renderer.

As a matter of fact, I don't see any obvious way of avoiding the z-fighting issues as nothing, in the format, prevents two polygons to share the same space.

Moreover, I can't apply smooth lighting as I did on the map.

Possible solutions

  1. improve PMF format
    • prevent two cubes to share the same space (maybe an octree-like structure could solve this ?)
  2. do boolean operations on cubes to remove shared faces (are you seriously considering it ?)
  3. add another format
    • like kv6 support ?

In my opinion, models should be created just as maps (placing/removing blocks while flying around the model like in the game, just like the current map editor). That way, it would be a standard and easy interface. We would need to handle a few things like the size of a block (to increase the model resolution, divide the size of the blocks by two), and the center of the model (to place it correctly in the game world).

What do yo think about this issue ? Have you got any other idea ? Am I missing something ?

Is models texturing out of the discussion because it can't be supported on both renderers ?

Side note

If I alter the following line in gl/render.c, the rifle hasn't any z-fighting issue on my box anymore as no faces are sharing the same space (but the others models aren't rendered properly because of the newly invalid radius value) :

render_pmf_cube(bone,
    pt->x/256.0f, pt->y/256.0f,
    pt->z/256.0f,
    pt->r,
    pt->g,
    pt->b,
    pt->radius*2.0f/256.0f);

to

render_pmf_cube(bone,
    pt->x/256.0f,
    pt->y/256.0f,
    pt->z/256.0f,
    pt->r,
    pt->g,
    pt->b,
    pt->radius*1.0f/256.0f);
Ericson2314 commented 11 years ago

I support implement KV6

melchips commented 11 years ago

KV6 is nice and already has the pivot coordinates in the structure. However, to my knowledge there is no bone information nor scale information. Should we make a new format based on KV6 ? If such a format is added, is there a need to keep the PMF support in the engine ?

Ericson2314 commented 11 years ago

how does kwalk in Voxlap do animation then?

melchips commented 11 years ago

Thanks for pointing kwalk to me.

Reading the doc, it seems that :

So, we somehow have to make the link between multiple kv6 files (one kv6 per bone maybe ?).

I may understand this wrongly, feel free to enlighten me.

Ericson2314 commented 11 years ago

Yeah, though I've been porting voxlap a while I know little about it's algorithms. It does seem likely that kva would have something to do with it. If Ace of Spades uses kva too then I think kv6+kva is definitely the way to go with iceball.

(I accidentally hit close)

iamgreaser commented 11 years ago

Replacing the PMF format with KV6 is not the way to go.

What we should be doing instead is generating, say, a kd-tree inside the GL renderer, and rendering it like that.

iamgreaser commented 11 years ago

Z-fighting issues fixed by giving the cubes a slight sine-based offset. If you don't like the method I used, consider sorting the cube faces by planes and using the painters' method. There are MANY ways to solve this problem, I just used what I thought was the simplest, and it actually looks OK.

If you think this method sucks, you can reopen this issue.