How would I go about storing 3D object data into a database?

How would I go about storing 3D object data into a database?

I`m having issues with converting our 2D database model to translate for our upcoming 3D model in UNity3D

His biggest question is this: What does a Unity 3D object look like and can I store that object in the db for retrieval to be rendered on-the-fly?

  1. My biggest question is this: What does a Unity 3D object look like and can I store that object in the db for retrieval to be rendered on-the-fly? If our data is to be represented (at least on occasion) as 3D objects then we must be able to store those objects in the db, not in the 3D code. This makes it seem like we cant: REF. Note that to me it appears that Unity only connects to a game db server, as they call it, for stats and things, not 3D objects. Retrieving text and binaries (images, videos, documents, etc.) is one thing, but retrieving dynamic 3D objects is, as far as I understand, what this is all about.

Here is the email from my database guy: (Can you please help to find a solution that works with Unity3D)


Hi, Jesse.

If I understand your question, no matter how we code the 2D UI at this time, with or without JavaScript (JS,) the 3D UI is somewhat a do-over. The data captured should be reuseable in both the old and new environments, but the 3D UI can only use limited parts of the 2D code no matter what. For one thing, there will likely be data specific to the 3D environment (TBD) that will be truncated in the 2D environment. Even if we wrote the 2D version entirely in JS, wed have to write completely different JS for 3D, is what Im saying, so no effort would be saved. Please note that it may not be necessary to use JS for the browser, at least not as a primary code structure (REF); Im still trying to determine this. Anyway, the 2D would not be migrated to 3D, rather the 3D would basically be a new version that runs in tandem. Its the same as the 2D being a book and the 3D being a movie: we can use the book as a script for the movie, but we still have to have actors say their lines and record it in order for it to become a movie.

Parsing out the data into XML should be an easy matter, depending on how we enter raw data and how the 3D environment wants to handle it. At present, youll note that I have an XML field (not formatted as such, just a NVARCHAR container.) My assumption is that the XML data will attach to Articles. I have not defined yet what to do with this XML since that is TBD. Articles themselves may become XML data too; this is also TBD. There are a few ways we can handle this.

My biggest question is this: What does a Unity 3D object look like and can I store that object in the db for retrieval to be rendered on-the-fly? If our data is to be represented (at least on occasion) as 3D objects then we must be able to store those objects in the db, not in the 3D code. This makes it seem like we cant: REF. Note that to me it appears that Unity only connects to a game db server, as they call it, for stats and things, not 3D objects. Retrieving text and binaries (images, videos, documents, etc.) is one thing, but retrieving dynamic 3D objects is, as far as I understand, what this is all about.


Thanks and looking forward to ANY help you can give me.

Thanks,

Jesse BigWest11

As Mike said, there are lots of ways to do this.

What you probably want are AssetBundles.

These allow you to store 3d objects, meshes, textures, materials and more externally, and load them at runtime.

The database would obviously just point to an AssetBundle URL.

Piece of cake.

Mostly agree with Brian Kehrer in that you need to use Assetbundles to load model data on the fly. However, a database could store an AssetBundle as a base64 encoded pile of bits instead of linking to it in a filesystem.

Another approach, depending on what your incoming data is, is to write an XML exporter for the model and an XML importer to read it out of the database. The importer would then need to build the mesh on the fly. This approach really only makes sense if your Unity app is creating new geometry that it needs to store somewhere. It is several levels more complex than using Assetbundles alone.

I'm not entirely sure I understand your question. I believe that a good bit of it would benefit from a more clear description of what you are specifically trying to accomplish.

There isn't really anything magical about "3D Objects". You can model the data that represents the GameObject and store that data in a number of ways; but at the end of the day this is all very dependent on what you are trying to do. Say, for example, I have a collection of spheres. I may store a position vector and a radius for each sphere in a database; Unity can call Instantiate a bunch of times and create them for me in my visual space.

Unity can connect to a database and fetch whatever you want from it. You just have to define your data model appropriately so that you can supply Unity with the information it needs to represent the data you fetched.

Hey! It’s completely possible to store meshes in a database and then transport them into Unity, either through using native C# sockets or the WWW class (by getting a php page or something like that to echo the binary BLOB data). You would however need to produce your own way of storing mesh information in a binary file (or produce your own decoder for a standard mesh file format like OBJ). As a minimum, meshes need:

  • Vertex information. These are 3D coordinates of the points making the mesh, made up of 3 4-byte floats each.

  • Triangles. This is a list of 4-byte ints which are the indices of the vertices in the above array.

You’d probably want texture information too and an actual texture, but all that depends on what you actually mean by a ‘3D object’ :).

I’m currently making an MMORPG in Unity3D and as you might have guessed that’s alot of content; all of which is streamed into the client (which is only 300kb) (including code, images, meshes, animations, audio,text etc). Anything can be streamed in; you’ve just got to produce a suitable binary format to do it in :slight_smile:

hi;

my project is to get my 3D objectsobjet3D(.md2 - .obj - .3ds …) stored in a database( in the server).it is possible to store my objet3D in a database? if yes :slight_smile: how i can do that? help me please