New method of 3D data storage

54e97bcc4e4a2fc8f5f05594afd1683a
0
Gnarlyman 101 Mar 29, 2012 at 19:20

Hi there,

I’ve recently been working on developing a vertice system (i.e., the ol’ X-Y-Z axis dealio) which deals in percentages versus hard-‘n fast (hard-coded) vertice points. Basically, it would allow one to describe all objects in the game world by the numerical equivalency of the view box (0,0,0 to 1,1,1, or whatnot), where powers of ten would be the arbiter of scale for all objects. What I’m looking at doing is…

Using either Unity and OpenGL (Unity would be preferred), I’d like to somehow “graft on” my own methodology of 3D data storage via simple scripting (if in Unity that is) and use built in classes and functions to interface with the engine, which (either in Unity or OpenGL) obviously works with absolute polygon vertex points. For instance, have a simple Javascript class or three which takes in data from the game loop, feeds it into the Javascript classes which use the percentage system, and then spits back out the “vertex” “points” to the normal vertex and shader pipelines within Unity/OpenGL (again, trying to use Unity, as it has so many game architecture features already coded in simple Class.Function.Whatnot form, yay).

I know this perhaps sounds like an odd Q, but I know what I’m doing in theory, just not in actual, well, how-to-go-about-actual-implementation stuff. If the above doesn’t make sense yet, feel free to ask Q’s, and I’ll continue to clarify.

Thanks…!

7 Replies

Please log in or register to post a reply.

820ce9018b365a6aeba6e23847f17eda
0
geon 101 Mar 29, 2012 at 19:33

What is the problem you are solving with this? I don’t quite get it.

It seems to me, you won’t need to do any programming at all. Just edit your models to stay within the 0-1 box and scale them apropriatwly in Unity. Or did I miss something?

54e97bcc4e4a2fc8f5f05594afd1683a
0
Gnarlyman 101 Mar 29, 2012 at 20:08

The thing I’m seeking to do is to create a more unified system of 3D data representation so I can immediately tie all objects in the game world in a highly related manner and skip some of the matrix conversions. I’m designing the system so I can create vertices and polygons on-the-fly based on certain logic. I basically want this logic to run as a “mini-engine” that interfaces with the brute-force polygon/vertex pipeline within Unity. Obviously, since new vertices and polygons will will be constantly created/”uncreated”, I need a way to feed in-feed out, to the “mini-engine”, the percentage vertex points which Unity can then treat as hard-coded vertices. I’d like to bypass one of the matrix conversions as I previously mentioned. Since I’m still figuring out Unity scripting and all, perhaps such a thing is much easier to do than I’m currently seeing.

A8433b04cb41dd57113740b779f61acb
0
Reedbeta 167 Mar 29, 2012 at 20:58

Streaming fully dynamic geometry that can be extensively updated at the vertex level in every frame is a task best accomplished within the engine itself rather than a scripting language, for performance reasons. Unless your meshes are quite small (no more than a few hundred vertices I’d guess), using Javascript to process each vertex every frame will be too slow for real-time use. I don’t know if Unity lets you get source-code access to the point where you could add your own code to the engine itself, but if that’s the kind of task you need to do, that’s the only way I would go about it.

Your task might be simpler than that. Do you really need to process individual vertices, or can you get away with manipulating things at the object / mesh level and applying a scale factor or other transformation to map your “percentage-based” system to world space? Keep in mind that engines and GPUs are already designed to apply a transformation matrix to each mesh, so that is very efficient. You can probably update the matrices for a couple hundred objects in Javascript every frame and get good performance.

820ce9018b365a6aeba6e23847f17eda
0
geon 101 Mar 30, 2012 at 08:07

@Reedbeta

Unless your meshes are quite small (no more than a few hundred vertices I’d guess), using Javascript to process each vertex every frame will be too slow for real-time use.

The “Javascript” in Unity is not really javascript at all, but a fully compiled language running on Mono. It’s pretty fast.
@Reedbeta

I don’t know if Unity lets you get source-code access to the point where you could add your own code to the engine itself, but if that’s the kind of task you need to do, that’s the only way I would go about it.

You can, but it’s expensive.

820ce9018b365a6aeba6e23847f17eda
0
geon 101 Mar 30, 2012 at 08:14

@Gnarlyman

skip some of the matrix conversions

Is this the optimization you want to do?

Matrices are always combined, so even if your objects needs to go through hundreds of transformations, they are combined into one, which is multiplied by each vertex.

You won’t save anything.

B5262118b588a5a420230bfbef4a2cdf
0
Stainless 151 Mar 30, 2012 at 08:31

All you are doing by storing vertices as fractions of a unit volume is adding another transformation into the pipeline.

After all, unless ALL your objects fit within a unit sphere, you are going to have to scale them at some point.

If you were writing an engine from scratch, this could be very cheap indeed, but within an existing pipeline you are just adding another matrix multiply.

54e97bcc4e4a2fc8f5f05594afd1683a
0
Gnarlyman 101 Apr 03, 2012 at 21:54

Thanks peoples, very helpful. Pretty much answers my Q.