Search Unity

Procedural Book building and animation system

Discussion in 'Works In Progress - Archive' started by SpookyCat, Apr 25, 2014.

  1. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,762
    This video shows the first test of our new MegaBook system for Unity. This asset allows you to quickly and easily build full books or comics with complete control over the number of pages, and the page turning effects etc. You can ask the system to generate the page meshes for you or you can select to use your own page mesh so you are not limited to rectangular pages.

    You have complete control over how the pages animate as they turn, how far they turn, where they turn and the radius of the turn, so it is easy to turn up just the edge of the pages to get a flip book effect etc.

    Another video showing the various options available will be out soon and the system will be in the Asset Store and on our website very soon. More information can be found at our website www.megafiers.com


    Added a new video showing some of the features of MegaBook which has been submitted to the Asset Store and is also available now on our website.

    Video showing how to add complex mesh data as content.
     
    Last edited: Jul 24, 2014
  2. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,349
    Amazing, will this be a standalone or included in the main Megafiers pack ?

    Also how easy is it to change the book shape ? With my own model or procedurally etc
     
  3. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,762
    This will be a standalone system. You will be able to ask the system per page to either generate a mesh or you can select a mesh that will used, so you could every page as a different shaped mesh if you wanted. The mesh will need to have enough vertices to allow the various bends to work nicely though.
     
  4. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,349
    Nice, the mesh detail was expected for good results

    Is the pricing and release date decided btw ?
     
  5. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,762
    Hope to submit to the store next week, though already had a fair few feature requests so would like to get some of those in but should still be submitted next week with the usual 3 or 4 days for Unity to review and approve. If you have any ideas though please do share and I will see what I can do. Price is yet to be decided but it certainly wont be our most expensive asset :)
     
  6. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,349
    Nice info :), cant wait

    I was wondering about the memory management, for example my RPG will have a book of about 150 full artwork pages, something like Ni no Kuni manual, all will appear in game in the home level of the hero

    I still have not implemented it in game, i only have a placeholder book i made in blender with a simple page animation and just a few pages in a rigid manner (no new page appear)

    Do you offer a memory/asset management handle for the book ? For example will it free memory as new pages are loaded in a dynamic way, since 150 HD pages would be too much for any system if not managed well. Of course i could implement a manager or extend your pack, but if it was included would be a very nice addition
     
  7. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,762
    So would you be streaming in textures then? If so it is a trivial matter to have the book created with no textures set for some pages and then just set or change the textures for a page or change its material as the texture becomes available. Or if you are building the page texture via render to texture or other means again it is a simple call to change the texture on the page.
     
  8. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,349
    I was thinking about a more total solution, like just add the page textures in the editor and have the asset manage the streaming/loading and memory management.

    I can easilly change the textures in the material through scripting, but managing the streaming and memory for these textures is the problem that would take time to solve
     
  9. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,762
    That is certainly something we can look at, it is very simple to do using WWW.LoadImageIntoTexture or direct texture file loading and a data path, naming convention etc
     
  10. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,349
    That would be great, plus would make your book a total solution with all required to get a full book going in an optimized way, which would greatly add to its value imo
     
  11. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,762

    Attached Files:

  12. ecurtz

    ecurtz

    Joined:
    May 13, 2009
    Posts:
    640
    Tetsuo!...

    Looks pretty cool. A nice feature would be the ability to import one of the eBook formats and automatically build the pages from that dynamically. I'm thinking of things like RPGs where you might actually have a bunch of "real" books that you wouldn't want to have to store images for.
     
  13. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,349
    Very cool looking
     
  14. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,762
    You can, if you have Pro do render to texture and use that for a page content. We are also going to be adding support for some of the mesh based text systems so you can build content that way. Support for ebook file formats would be a nice feature, I will add it to the wish list.

    Yes it is Tetsuo in the comic example, well spotted.
     
  15. SteveB

    SteveB

    Joined:
    Jan 17, 2009
    Posts:
    1,451
    I'm assuming if I purchased this from your store, that this asset would be entirely disconnected from AS, correct? There's no way to transfer the purchase license based on the way Unity handles fees and such?
     
  16. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,762
    That is correct, and as you suggest there is no way to add people to the asset store customer database. The system should be on the Asset Store quite soon as it was submitted 4 days ago.
     
  17. SteveB

    SteveB

    Joined:
    Jan 17, 2009
    Posts:
    1,451
    Rock on...I find this terribly fun (or at least appears terribly fun from the video!) :D

    Thanks man...looking forward to it very much

    -Steven
     
  18. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,762
  19. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,762
    Submitted a small update to the MegaBook system which removes the warnings generated when importing the asset into a 4.5 project.
     
  20. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,762
    Submitted a new version to the Asset Store which brings a new feature of being able to add hard front and back covers to your books, there is a new section at the bottom of the Book Builder inspector that opens up the cover options and you can select the objects to use for the front and back covers, as well as alter the angle the covers turn through and define the pivot location. When Tony (the Artist brother) is back I will do a video showing the system in use but until then the demo scene book has hard covers on so you can try it out. You can off course point the system at a bone transforms if you happen to have a skinned book cover, which would allow you to have nice look at the cover hinges for example.

    hardcovers.jpg

    Changes in v1.11
    • Removed Debug script from object in test scene.
    • Added beta of hard front and back cover system for your books.
     
  21. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,762
    Another update to MegaBooks has been submitted to the Asset Store, this brings the beta of the Dynamic Mesh system which is designed to allow you to add mesh data to each page as it is built, the main use for this would be to add text to the pages but could be used to add any kind of mesh data to the front and backs of pages. The mesh data is combined into the page mesh so that it will deform along with the page as it turns. You have control over scaling, position and rotation of the data as it is combined.

    As there are quite a few different text systems out there we added a component called MegaBookDynamicMesh to the system so you would add that component to an object in the scene, the component contains a few methods that the book builder will call as it builds each page mesh, you just need to return the vertex, uv and tri data you want to be added to the page and the materials to use. The demo book in the scene as a simple example where a cube mesh is added to each page.

    Changes in v1.13
    • Removed a debug line.
    • Added beta of system to allow any mesh data to be added to each page as it is built, for example adding text to the page.
    • MegaBookDynamicMesh component added, use this class to provide the mesh data the book builder asks for.
    • Added simple example of dynam mesh to the demo scene book. Docs and video coming.
     
  22. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,762
    Another update, this brings some improvements and fixes to the dynamic mesh system that allows you to add text or any other custom mesh to each page. I have also included an example script on how to make use of the free Typogenic text system. Typogenic makes use of signed distance fields so the text is smooth no matter how close you get. If you use another text rendering system then you can adapt the example script as you need.

    Below is a grab showing the text on the page that is being turned and below that another image zoomed in a little on the text to show its still sharp. The script that passes the data to and from the book builder is also below, and you can see it is a few simple methods that return vertex and tri data and material info, and a method that is called to build the mesh data per page, so with Typogenic there is a RebuildMesh method to call and you just pass in the string of text.

    Code (csharp):
    1.  
    2. using UnityEngine;
    3. using System.Collections.Generic;
    4.  
    5. public class TypogenicMesh : MegaBookDynamicMesh
    6. {
    7.    TypogenicText     typo;
    8.    public List<string>   text = new List<string>();
    9.  
    10.    public override int GetNumMaterials(int page, bool front)
    11.    {
    12.      return renderer.sharedMaterials.Length;
    13.    }
    14.  
    15.    public override Material GetMaterial(int page, bool front, int i)
    16.    {
    17.      return renderer.sharedMaterials[i];
    18.    }
    19.  
    20.    public override void BuildMesh(int page, bool front)
    21.    {
    22.      if ( !typo )
    23.      {
    24.        typo = gameObject.GetComponent<TypogenicText>();
    25.        mesh = typo.m_Mesh;
    26.      }
    27.  
    28.      int index = page * 2;
    29.      if ( !front )
    30.        index++;
    31.  
    32.      if ( index < text.Count )
    33.      {
    34.        typo.Text = text[index];
    35.        typo.RebuildMesh();
    36.        mesh = typo.m_Mesh;
    37.      }
    38.    }
    39.  
    40.    public override Vector3[] GetVertices(int page, bool front)
    41.    {
    42.      if ( mesh )
    43.        return mesh.vertices;
    44.  
    45.      return new Vector3[0];
    46.    }
    47.  
    48.    public override Vector2[] GetUVs(int page, bool front)
    49.    {
    50.      if ( mesh )
    51.        return mesh.uv;
    52.  
    53.      return new Vector2[0];
    54.    }
    55.  
    56.    public override int[] GetTris(int page, bool front, int m)
    57.    {
    58.      if ( mesh )
    59.        return mesh.GetTriangles(m);
    60.  
    61.      return new int[0];
    62.    }
    63. }
    64.  
    megabooktext2.jpg megabooktext3.jpg

    Changes in v1.14
    • Improvements to the Dynamic mesh system.
    • Example dynamic mesh script for using Typogenic to add text to book pages
     
  23. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,762
    Quick update, added an example script to be able to use Text Mesh Pro for adding text to your pages, also added in vertex color support to the book builder so that text or any mesh you add per page can have vertex color info as well so you can have multi colored text etc. Will being the docs and tutorial video for the dynamic mesh system in the coming days.

    Changes in v1.15
    • Added support for vertex color to book builder which will allow multi colored text to be used etc
    • Added support for getting vertex colors in the dynamic mesh system.
    • Added example script for using Text Mesh Pro for adding text to pages.
     
  24. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,762
    Quick grab showing the new vertex color support in MegaBook which allows you to add color to your text (if the text system you are using supports it). In this example Text Mesh Pro is being used which allows for text to easily be colored and various other options such as sizing and italic.
    megabooktext6.jpg
     
  25. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,349
    The text generation is great, i may have to implement even the RPG menus with the book, would be really cool now that is so easy to have dynamic text stick on the page properly.
     
  26. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,762
    Did a slightly more complex example for the dynamic mesh system in the book builder, this example allows you to use multiple objects per page to define the content, so in this example there are multiple text objects per page and a textured object. So you now have complete control over the layout and content of each page. Again in this example the text mesh is generated from the Text Mesh Pro system.
    megabooktext7a.jpg
     
  27. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,762
    Just a quick note, seems I messed something up in the shader for the text in the grab above, and grab and scaling of image hasn't helped, grab below shows the text is very crisp when zoomed in.
    megabooktext8.jpg
     
  28. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,762
    New version in the AssetStore, this fixes a bug if you used the page hole mesh option where the uvs were wrong on the back of the page. Also removes the error if you are compiling for WP8 or other platforms that do not support threading. And finally adds the helper script to be able to add any meshes to a page, be it multiple meshes, multiple material meshes etc so you can do complex text layouts with images as well.

    Changes in v1.16
    • Fixed bug with page hole meshes having wrong back uvs
    • Fixed error about threading method missing when building for platforms that do not support threading.
    • Added example script for adding any mesh items as content for pages, MBComplexPage.cs
     
  29. orbobservation

    orbobservation

    Joined:
    Feb 28, 2013
    Posts:
    87
    Worth the purchase, was messing around with a few alternatives- but this completely cuts out the need for any extra work. Got it working seamlessly in a first person RPG environment within 20 minutes, all the development time can be pushed into the art pipeline for the books now :)
     
  30. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,762
    Finally got around to creating a video to show how to use the Dynamic Mesh system to add complex mesh data as content for your books. The system allows you to add any number of meshes for each page of your book, the system will combine all the meshes and add them to the page so that it will turn correctly etc. The system also support multiple materials and vertex colors.