Jump to content


New method of 3D data storage


7 replies to this topic

#1 Gnarlyman

    Valued Member

  • Members
  • PipPipPip
  • 109 posts
  • LocationMilwaukee

Posted 29 March 2012 - 07:20 PM

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

#2 geon

    Senior Member

  • Members
  • PipPipPipPip
  • 939 posts

Posted 29 March 2012 - 07:33 PM

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?

#3 Gnarlyman

    Valued Member

  • Members
  • PipPipPip
  • 109 posts
  • LocationMilwaukee

Posted 29 March 2012 - 08:08 PM

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.

#4 Reedbeta

    DevMaster Staff

  • Administrators
  • 5311 posts
  • LocationSanta Clara, CA

Posted 29 March 2012 - 08:58 PM

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.
reedbeta.com - developer blog, OpenGL demos, and other projects

#5 geon

    Senior Member

  • Members
  • PipPipPipPip
  • 939 posts

Posted 30 March 2012 - 08:07 AM

View PostReedbeta, on 29 March 2012 - 08:58 PM, said:

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.

View PostReedbeta, on 29 March 2012 - 08:58 PM, said:

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.

#6 geon

    Senior Member

  • Members
  • PipPipPipPip
  • 939 posts

Posted 30 March 2012 - 08:14 AM

View PostGnarlyman, on 29 March 2012 - 08:08 PM, said:

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.

#7 Stainless

    Member

  • Members
  • PipPipPipPip
  • 582 posts
  • LocationSouthampton

Posted 30 March 2012 - 08:31 AM

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.

#8 Gnarlyman

    Valued Member

  • Members
  • PipPipPip
  • 109 posts
  • LocationMilwaukee

Posted 03 April 2012 - 09:54 PM

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





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users