Search Unity

Sequenced .obj mesh streaming?

Discussion in 'Scripting' started by 8Infinite8, Aug 1, 2013.

  1. 8Infinite8

    8Infinite8

    Joined:
    Jul 27, 2013
    Posts:
    112
    Hi all, I'm new here.

    I'm trying to find out if it's possible at all to stream unique meshes in Unity for playback at a reasonable frame rate. Say 24fps. By stream I mean load in on a per frame basis, or switch on or off in sequence.

    Say if you have "body-scan-0001.obj" "body-scan-0002.obj" "body-scan-0003.obj" "body-scan-0004.obj" etc with controls for frame rate, looping etc

    Is there a tool or Unity store asset currently available for this? could it be scripted? Ideally some kind of native built in solution could be quite powerful i.e. alembic support streaming in from a folder.

    Perhaps there is somewhere I could post to get help with this?

    Here's a good example using Thiago Costa's obj importer for Softimage:



    I've just learnt the basics of Unity over the weekend. Incredible application, very powerful.

    Thanks,
    Lee
     
  2. wccrawford

    wccrawford

    Joined:
    Sep 30, 2011
    Posts:
    2,039
    It would totally depend on the network connection that the streaming's being done on.

    Unity doesn't provide anything that would do it directly, but I wrote an open source OBJ importer (that hasn't had much testing) and Eric5h5 sells one on the Asset Store as well. I know mine could import an OBJ from a stream (because I designed it to) and I imagine that Eric's could, too.
     
  3. MikeUpchat

    MikeUpchat

    Joined:
    Sep 24, 2010
    Posts:
    1,056
    There is a system on the asset store that has support for industry point cache files ie pc2 mdd and mc formats, but that is for animating a mesh and maybe not what you need. What is it exactly you are looking to do?
     
  4. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    OBJ files require quite a bit of pre-processing and interpreting, which can't really be done in real-time unless the models are fairly simple. A custom format that used binary data which mirrors Unity's mesh format would probably be some orders of magnitude faster.

    --Eric
     
  5. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,766
    We are in the process of adding a system like this to MegaFiers, we have been looking at the Alembic format which is quite complex but would be good to support and doing offline processing of OBJ files to a custom format as well as a plugin for Max to record complete scenes but it is a little way off. As Mike said above there are systems that can do full point cache playback, but it does really depend on what it is that you are needing to do.
     
  6. 8Infinite8

    8Infinite8

    Joined:
    Jul 27, 2013
    Posts:
    112
    Many thanks for the replies. What I'm looking to do initially is just play back animation, swapping out .objs quickly. Maybe an interim solution would be some kind of script to flip through the naming _001.obj, _002.obj by turning them on or off. Perhaps 15-35k polygon meshes. 24 to start with then scale up. I wouldn't imagine Unity would have a hard time loading these into the scene, hidden then flip through them in a loop? but it's finding a tool / script to do that. Creating a script is out of my remit (something I would be happy to pay to be developed) but I can supply the data to test with.

    The ideal goal would be to stream in from disk, or from a cache.

    The goal is to play back motion scans in real-time and view them in VR. It's just a proof of concept. I have a cool hand animation captured here that could be a good test subject, 25k meshes, 15 frames, hand opening and closing.
     
    Last edited: Aug 2, 2013
  7. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    I'm going to write a script to run realflow .obj sequences in unity if u still need this.
     
  8. greginlifesize

    greginlifesize

    Joined:
    Oct 15, 2014
    Posts:
    1
    Hi radiantboy did you ever get this working? Would love it!
     
  9. jordibeard

    jordibeard

    Joined:
    Nov 6, 2014
    Posts:
    1
    Hi radiantboy, did you ever write this script? I'd love to use it if you did. Thanks.
     
  10. mr_pablo

    mr_pablo

    Joined:
    Jun 26, 2014
    Posts:
    12
    Bump, was there any progress on this?
     
  11. MikeUpchat

    MikeUpchat

    Joined:
    Sep 24, 2010
    Posts:
    1,056
    The author of MegaFiers is adding support for import sequences of OBJ files, also with the option for creation a cache file for streaming at runtime.
     
  12. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,766
    Did another example showing the OBJ cache system. The cache file it creates is about 1/10th the memory use of all the OBJ files used to create it.
     
  13. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,766
    MegaCache has been submitted to the AssetStore so hopefully will be approved this week otherwise it is available now on our website www.megafiers.com

     
  14. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,766

    Attached Files: