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...!

geon
—
2012-03-29T19:33:12Z —
#2

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?

Gnarlyman
—
2012-03-29T20:08:46Z —
#3

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.

Reedbeta
—
2012-03-29T20:58:22Z —
#4

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.

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.