Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Turbo Slicer

Discussion in 'Assets and Asset Store' started by ThatJoeOverThere, Aug 27, 2012.

  1. ThatJoeOverThere

    ThatJoeOverThere

    Joined:
    Aug 24, 2012
    Posts:
    120
    Me and a cohort made this slicing game for iPad with real time slicing (link is to web player), and now we put the slicing kit on the asset store. (The linked game is the demo.)

    It was built to get the game to run with lots of real time slicing at sixty FPS without any lurches. The code's organized to avoid cache thrashing.

    Note: This is for simple meshes. For slicing ragdolls, check out Limb Hacker.

    Features:

    • Sub meshes (multi-material meshes)
    • Normal, Tangent, UV1 and UV2 channels
    • Slice by plane (two public methods for this)
    • Slice by line in screen space
    • Slice by object (details below)
    • Special optimizations for repeated slicing
    • Filling in the slice hole with texture
    • Slice by line demo featuring simple game mechanics.
    • Handles hierarchies.
    • A muffin.
    • An orange.
    • A donut-orange hybrid. God bless GMOs.
    • Sources for the muffin.
    • Sources for everything else.
    • The double sided shader configuration used in Synergy Blade.

    You can see the manual for more.

    The slice-by-object feature involves a slicer prefab which you can attach to blades and whatnot, a sliceable component and a "slice handler" facility to deal with custom setup of slice results.

    The goal here is to make the best damn slicing kit ever created.

    Cover art by Nigel Kitts.
     
    Last edited: Mar 19, 2013
  2. virror

    virror

    Joined:
    Feb 3, 2012
    Posts:
    2,963
    Very cool demo, love the concept of that ; )
     
  3. ThatJoeOverThere

    ThatJoeOverThere

    Joined:
    Aug 24, 2012
    Posts:
    120
  4. pneill

    pneill

    Joined:
    Jan 21, 2007
    Posts:
    207
    Is it possible to just shatter an object rather than slice it?
     
  5. mrbdrm

    mrbdrm

    Joined:
    Mar 22, 2009
    Posts:
    510
    very nice, when you done this
    Advanced skinned mesh slicing (yielding skinned rag dolls)
    i will get it .
     
  6. ThatJoeOverThere

    ThatJoeOverThere

    Joined:
    Aug 24, 2012
    Posts:
    120
    @pneill

    Yes!

    I will write a method to do this tonight, update it and post here when it's up.

    @mrbdrm

    If you send me your e-mail address or something I can notify you when it's ready.
     
  7. I am da bawss

    I am da bawss

    Joined:
    Jun 2, 2011
    Posts:
    2,574
    Awesome! I am definitely very interested. What's the performance like? How many ms for the slice? And what's the limitation?
     
  8. ThatJoeOverThere

    ThatJoeOverThere

    Joined:
    Aug 24, 2012
    Posts:
    120
    I've done some tests on an iPad 1 (A4 1ghz) with three models. The profiler gives a minimum, maximum and average time per frame.

    The benchmark works by flinging random cuts at a loaded model.

    These figures are made with the normals channel on and mesh caching off (it is for re-slicing which is not test here). The time includes the actual split, instantiation of child models and building of their meshes:

    muffin (100 vertices, 155 triangles): 5.5 to 11, average 7
    standard-def boss (380 vertices, 414 triangles): 7 to 15, average 8
    subsurf'd muffin (390 vertices, 706 triangles): 10 to 30, average 13

    We can see a strong correlation between triangle count and time. This is a CPU bound operation.

    No built-in maximum; it's a matter of target CPU, target frame rate and how much time everything else needs.

    When I do slice filling, I'll post new numbers for comparison.
     
    Last edited: Aug 29, 2012
  9. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    Hi, This is very cool. I have worked on iPad1 so I know what a pain the performance can be :)

    A question: can this asset generate geometry for the two halves along the slice plane to get a "solid" effect? If not, is it in the pipe?

    Great work!

    /Cal
     
  10. ThatJoeOverThere

    ThatJoeOverThere

    Joined:
    Aug 24, 2012
    Posts:
    120
    Nope, but it is in the pipe. If you give me an e-mail address I can notify you when it's up.
     
  11. badawe

    badawe

    Joined:
    Jan 17, 2011
    Posts:
    297
    Great work @Toby Grierson! I was trying to achieve this result, maybe you can check my old post:


    I can reach this result with Turbo Slicer?
     
  12. ThatJoeOverThere

    ThatJoeOverThere

    Joined:
    Aug 24, 2012
    Posts:
    120
    Can you check that video link? It's borked somehow.
     
  13. badawe

    badawe

    Joined:
    Jan 17, 2011
    Posts:
    297
  14. ThatJoeOverThere

    ThatJoeOverThere

    Joined:
    Aug 24, 2012
    Posts:
    120
    Absolutely.

    If everything's 2D, you can use the sliceByLine method to slice by a line in screen space.

    Or you can attach a "Slicer" to the bullet and give the target a "Sliceable" component.

    There's sample code for both methods, including how to make them pop apart (if you want). Write me if you find the samples or documentation unclear.
     
  15. badawe

    badawe

    Joined:
    Jan 17, 2011
    Posts:
    297
    Perfect! I'm buying right now! I'll keep in touch!
     
  16. I am da bawss

    I am da bawss

    Joined:
    Jun 2, 2011
    Posts:
    2,574
    Hey Toby, I noticed a bug of the sort while playing Synergy Blade.
    I discovered when I draw a long continuous slice (for combos) over multiple objects, it will often miss some of the objects in the same continous slice. This will not happen if you draw a short slice, but if you do a long continous slice (not lifting your finger) it will happen 9/10 times.

    Is this a polling rate issue (if your system or the touch sensor do polling)?
     
    Last edited: Sep 8, 2012
  17. dark_tonic

    dark_tonic

    Joined:
    Mar 23, 2011
    Posts:
    137
    wicked stuff, guys, well done.
     
  18. ThatJoeOverThere

    ThatJoeOverThere

    Joined:
    Aug 24, 2012
    Posts:
    120
    @bawss

    Hi there, I did see your bug report and I'll see if I can address this in the upcoming update. (Aiming for Tuesday.)

    ATM I am working on filling the slice-hole with textured content.
     
  19. I am da bawss

    I am da bawss

    Joined:
    Jun 2, 2011
    Posts:
    2,574

    WOW ! TOO AWESOME !! :D Glad I bought it!
     
  20. Korok

    Korok

    Joined:
    Dec 19, 2011
    Posts:
    179
    •Basic skinned mesh slicing (yielding non-skinned slice results)
    •Advanced skinned mesh slicing (yielding skinned rag dolls)
    •Filling in the slice hole with texture

    Til waiting for those :)
     
  21. ThatJoeOverThere

    ThatJoeOverThere

    Joined:
    Aug 24, 2012
    Posts:
    120
    Version 1.2 with infill was just sent up for review.

    The in-fill looks great running on the iPad, but I haven't done the most rigorous optimization yet. I need a few days away from it before I can do that, cause my brain is now mush.

    Solid objects need to use one material. For example, the orange in the demo (it's an orange now) has a material with the exterior painted on the left half of the texture and the interior on the right. (Multi-materials would make it super complicated and preclude batching.)

    Remember to look at the manual; you need to tell it what region of the material is for the interior texture.

    Next in order:

    • Child objects. (For given object A sliced to yield B and C, A's child objects must be correctly moved to slice results B and C.)

    • Review the in-fill. (I think it could be optimized far more rigorously than I have already.)

    • Basic skinned mesh slicing (yielding non-skinned slice results)

    • Advanced skinned mesh slicing (yielding skinned rag dolls)
     
    Last edited: Sep 14, 2012
  22. ThatJoeOverThere

    ThatJoeOverThere

    Joined:
    Aug 24, 2012
    Posts:
    120
    This update is accepted online.
     
  23. blaze

    blaze

    Joined:
    Dec 21, 2011
    Posts:
    211
    Toby, and if I cut an animated character? I can make it continue animating without that "part"?

    Like cutting zombies that are coming to you, then you cut a arm, and it continues walking to you.

    This can be reached? Could you show some example?
     
  24. ThatJoeOverThere

    ThatJoeOverThere

    Joined:
    Aug 24, 2012
    Posts:
    120
    Not yet. That one's pretty hard. I'm aiming to have it done within a month or two and I'll let everyone know when it's done, but I can't promise it on a particular schedule.

    I also can't guarantee it'll scale up well on mobles – that is, handle a decent amount of geometry – and to have any chance of it I'm definitely going to need to get at the mobile vector processing capabilities.

    So I'm going to make an asset for that first.

    My asset schedule is like this:

    1) [secret project]
    2) Vector processing
    3) Turbo Slicer for Animation

    This is going to be a fork of Turbo Slicer for a few reasons, but folks who already bought TS and asked for it can get a free copy.
     
    Last edited: Sep 19, 2012
  25. BrUnO-XaVIeR

    BrUnO-XaVIeR

    Joined:
    Dec 6, 2010
    Posts:
    1,687
    When this thing get skinned meshes support, I won't think twice.
     
  26. blaze

    blaze

    Joined:
    Dec 21, 2011
    Posts:
    211
    Right Toby, I will wait for "Turbo Slicer for Animation".
    When I can cut some legs and arms of animated characters, I will do something with huge gore. :)
     
  27. ThatJoeOverThere

    ThatJoeOverThere

    Joined:
    Aug 24, 2012
    Posts:
    120
    Little update: I am building Ragdoll Slicer.

    I am aiming for late next week and I am aiming to have near-parity with Turbo Slicer's performance.

    There is one more technical challenge to solve (of three). The bulk of it works now, the algorithm just won't jive with the infill's polygon distinguisher yet. But I'll crack this nut.
     
    Last edited: Sep 28, 2012
  28. cygnusprojects

    cygnusprojects

    Joined:
    Mar 13, 2011
    Posts:
    766
    Toby,

    Thinking on buying your asset for our action game but for our specific game I need you to answer one question please.
    Can we attach scripts ourselves to the scattered object? What we like to achieve is when the user scattered an object its parts are dissolving. Or can this be achieved with another functionality you support?
     
  29. pinchmass

    pinchmass

    Joined:
    Jul 2, 2012
    Posts:
    156
    Sorry if this has been asked (had a look), but will this run (need much work) on Android devices too.

    also will this new Ragdoll slicer be an update or new package.

    keep up the good work (another sale on its way from me)
     
  30. Contract-killer

    Contract-killer

    Joined:
    Sep 21, 2012
    Posts:
    42
    Hi
    I have lot's of query regarding the plugin which are given below.And as I am an student I want to clear my all points because I am investing a huge part of my pocket money savings.

    - To use your plugin in my project is there any special kind of 3d models are required
    - A special kind of mesh required , if yes what I will do I have make my models already then is there any alternate is available to me.
    - Same with shader is there any special shader is required with it.
    - As I told you I had model already and your plugin work with them then how you show the internal cut part of the object and can we change the color of that part or to get the a required color model need to be make in special way.
    - If I will send you my model then can you give me the demo on the same model.
    - I want that my model can be slice only once
    - One help I require from your side is that - my game is lagging badly so please help me in running the game smoothly.
    And my queries for that is -

    What would be the size for a 3D model because I am using 5 model and each of them are of 12MB. Is this is the reason of laggin issue.
    What number of polygon maximum I'll use for the model making and please tell me if this is issue for it.
    And please guide me if have any Idea please tell me this is my college project.
     
  31. ThatJoeOverThere

    ThatJoeOverThere

    Joined:
    Aug 24, 2012
    Posts:
    120
    Hi,

    I'm going to address everything here by tomorrow; I'm a bit busy at this moment with the baby and some immigration related chores, yada yada yada.

    Contract Killer,

    0) Did you already buy it? I can cut the price now or maybe give a half rebate. Educational discount.

    1) Once it's imported into Unity, it's ready to go.

    2) For basic use, it will accept a mesh with one or more sub meshes (Unity uses a "submesh" concept to deal with multiple materials). It will use the raw triangle data, not the optimized triangle data (the triangle strips). But it's OK if the mesh import is configured to optimize; it will still possess the regular triangle data for Turbo Slicer to read.

    3) No shader requirements; it will spit out the materials that are fed in.

    4) For the _infill_ the requirements are a little stricter. The object must feature _one_ material. A square-shaped fraction of that material must be used for the infill texture. You specify in the configuration where in the material this texture is.

    It is a little sensitive to anomalies in the mesh; it needs to be able to find a _closed_ polygon in order to fill the hole.

    There should be some examples in the manual here.

    5) I can do that, but it might take as long as Friday night.

    6) You give the instruction to slice the mesh. There is an example script that slices multiple times, but the Turbo Slicer kit per se only slices what you tell it, when you tell it to, via a public method.

    7) I do know a lot on this topic and I'll see what I can do.

    8) It is going to be sensitive to the total workload fed in.

    Less is better.

    What platform?

    It is theoretically possible to exploit SMP but it's only profitable if there's a lot to process. We might try this.
     
  32. Contract-killer

    Contract-killer

    Joined:
    Sep 21, 2012
    Posts:
    42
    I am going to buy it if it full fill all of my requirements. Thanks for the information . I am just asking for the guidiance because I have very less Idea about these things
    I did n't get you from 8'th point
     
    Last edited: Oct 11, 2012
  33. ThatJoeOverThere

    ThatJoeOverThere

    Joined:
    Aug 24, 2012
    Posts:
    120
    Sorry for the late reply, crazy times over here.

    Contract Killer, may we talk on Skype or something? I'd like to work with you to make your project work.

    Cygnus,

    I just submit an update – version 1.3 –*which makes sure this is all doable. You can have a look at the manual with all the details, but the jist of it is this:

    1) It can (optionally) use Unity's clone facility to create the slice results, transferring the scripts and configurations and (if necessary) refreshing any box or sphere colliders present.

    An object to be sliced has a few requirements (one mesh filter, renderer in its hierarchy, etc.) but other than that, put anything you like on it and if you want your configuration and components transferred to the sliced halves, it'll do that.

    2) If you call the API directly, it returns the set of slice result objects which you can revise and configure as you need.

    3) There's a component - AbstractSliceHandler - which you can extend and add configuration code to that will be called upon after a slice is performed.

    Yes.

    It's pure-C# and it'll go anywhere Unity does.

    Only comment is that it's CPU-bound and devices vary. It was tested on a 1 ghz arm7 iPad.

    But that might be pretty retro by now.

    New, different product.

    By the way everyone, the new update will be 50% off when Unity accepts it. I will post again here when it is accepted.
     
  34. I am da bawss

    I am da bawss

    Joined:
    Jun 2, 2011
    Posts:
    2,574
    What? New product? That's the feature I was hoping to get.
    I knew I shouldn't have bought this so soon :(
     
  35. ThatJoeOverThere

    ThatJoeOverThere

    Joined:
    Aug 24, 2012
    Posts:
    120
    Oh if you already bought TS before it comes out, you can have it free. No worries. I'm making it a different product partly cause the pitch, code and demo are super different but also going to make it something like a higher end product.

    The version 1.3 update is up.

    It is 30 USD this week. I have no idea how to make that discount banner comes up as this seems to be undocumented, there's no configuration for it and when I put a note about it in the submission, they ignored it, which is delightful.
     
    Last edited: Oct 17, 2012
  36. I am da bawss

    I am da bawss

    Joined:
    Jun 2, 2011
    Posts:
    2,574
    Nah its fine. I was just a bit shocked you drop the price to $30 (I bought at $50 just weeks ago) and then the feature I really wanted is now another package. Oh well. Don't worry I fully understand that's just business. So what's the ragdoll slicer going to cost?
     
  37. ThatJoeOverThere

    ThatJoeOverThere

    Joined:
    Aug 24, 2012
    Posts:
    120
    Oh, I wanted to discount it for a week cause that other guy said he was a student. I wanted to do one of those temporary discount banners but I'm stumped on how to make that happen.

    I haven't decided on RDSlicer but I'm debating between 100 and 150, while dropping TS's price.

    The RDSlicer'll be a tad time consuming to maintain and is kind of an esoteric beast, so I'm going to try pricing it higher.

    But I also intended to hand it out to people who already bought TS and had asked for the feature. This was part of the plan when I decided to split it.

    I'm actually having some trouble with it at the moment figuring out how to get the infill algorithm to work, so I can't give a date on when it'll work wholly. I'm half-considering putting it out at a lower than intend price without the feature, then raising it if/when I figure it out.

    Or, something.

    EDIT: Turns out you have to get that in something of a deal with the Unity folks! And that's OK. I guess it's 30 for the moment and I've pulled a Steve Jobs.
     
    Last edited: Oct 17, 2012
  38. Egg

    Egg

    Joined:
    Oct 8, 2012
    Posts:
    9
    I've been messing about with Turbo Slicer for a while now and it's quite amazing, exactly what I've been looking for, especially with the interface upgrade for the infill. It's much easier to use, thank you. I'm greatly looking forward to the Ragdoll Slicer, so keep up the awesome work.

    I have one question for both TS and RDS, though. Would it be possible to add in functionality for custom shapes for cutting? For example, a V shape or anything besides the straight-line, plane slicing? That'd be fun to have.
     
  39. ThatJoeOverThere

    ThatJoeOverThere

    Joined:
    Aug 24, 2012
    Posts:
    120
    Hi! Thanks for the kind words, I'm really happy you like the infill interface.

    Custom shapes would be super fun but I'm not sure.

    I'm having trouble getting infills to work in RDS because of shape anomalies; the algorithm I have makes a lot of assumes (e.g. the surface is flat) in order to save work. I could get odd shapes (like cut a circle hole through) really fast but then there'd be no infill.

    It's something I'm working on and unfortunately I can't guess when I'll figure it out – but I'm actively working on it so we'll see.
     
  40. cygnusprojects

    cygnusprojects

    Joined:
    Mar 13, 2011
    Posts:
    766
    Hi Toby,

    Bought the asset and trying to implement it. Within the doc you mention you can use suppress sliceability with the currentSliceable property. However in my test setup this doesn't work as expected.
    I added a slicer to my object and when I start the game the object is slices as expected, however if it attach the script below to the gameobject and press H the slicing doesn't occur.

    Code (csharp):
    1. public class TopDownDestruction : MonoBehaviour
    2. {
    3.     private Sliceable slice;
    4.    
    5.     // Use this for initialization
    6.     void Start ()
    7.     {
    8.         slice = gameObject.GetComponent<Sliceable>();
    9.         slice.currentlySliceable = false;
    10.     }
    11.    
    12.     // Update is called once per frame
    13.     void Update ()
    14.     {
    15.         if (Input.GetKeyUp(KeyCode.H)  slice != null)
    16.         {            
    17.             slice.currentlySliceable = true;
    18.         }
    19.     }
    20. }
    I already put some debug info after the slice.currentlySliceable = true; and the code is reached.

    Any suggestion?

    Kind regards,

    Wim
     
  41. ThatJoeOverThere

    ThatJoeOverThere

    Joined:
    Aug 24, 2012
    Posts:
    120
    I failed to reproduce this exactly, but I found a problem that might be relevant.

    Using your script in the muffin-drop demo, I found that it will slice once, create two new objects featuring the test script, then call Start on both of those, making them unsliceable again. (I'll put something into the manual about this.)

    Also – and this is speculation – it could be a triggering issue. It triggers when they come into contact with each other, and if at that moment it's unsliceable, it won't slice when you flip the switch; it will slice when the objects separate and recontact.

    Could you give any more details or test steps?
     
  42. cygnusprojects

    cygnusprojects

    Joined:
    Mar 13, 2011
    Posts:
    766
    I created a prefab from a barrel with a slicer already in place where it needs to be cut in half. So it maybe indeed because the trigger events aren't raised. I'll try be move the slicer down on disable and move it up after enable and see how things go.
    I'll keep you posted.
     
  43. ThatJoeOverThere

    ThatJoeOverThere

    Joined:
    Aug 24, 2012
    Posts:
    120
    Thanks a lot, let me know.

    I wonder if I should change the behavior, such that it will test again when the switch is changed. If that turns out to be the problem, would you like me to modify the Slicer script as described there?
     
  44. cygnusprojects

    cygnusprojects

    Joined:
    Mar 13, 2011
    Posts:
    766
    hm, no luck with slicing the gameobject yet.

    This is the adapted code:
    Code (csharp):
    1. public class TopDownDestruction : MonoBehaviour
    2. {
    3.     private Sliceable slice;
    4.     public GameObject slicer;
    5.    
    6.     // Use this for initialization
    7.     void Start ()
    8.     {
    9.         slice = gameObject.GetComponent<Sliceable>();
    10.         slice.currentlySliceable = false;
    11.         slicer.transform.position = new Vector3(slicer.transform.position.x, slicer.transform.position.y - 2, slicer.transform.position.z);      
    12.     }
    13.    
    14.     // Update is called once per frame
    15.     void Update ()
    16.     {
    17.         if (Input.GetKeyUp(KeyCode.H)  slice != null)
    18.         {            
    19.             slice.currentlySliceable = true;
    20.             slicer.transform.position = new Vector3(slicer.transform.position.x, slicer.transform.position.y + 2, slicer.transform.position.z);
    21.         }
    22.     }
    23. }
    When I hit the H key I see the slider move from below the gameobject into the gameobject but no slicing occurs.

    To reproduce try this:
    Take a gameobject you prepare for slicing and setup the scene (adding a TurboSlicer) as layed out in the documentation. Place the Slicer prefab you provide within the gameobject and attach this screen to to gameobject (not the slicer). Adapt the -2 and +2 within the code to make sure the slider is below the gameobject when starting the game and within the gameobject when pressing H.
    In my case pressing H does nothing (except in sceneview I see the slicer go up through the object, as expected but no slicing).
    When you remove my script and run you will see the slicing does occur. Strange.

    It would be indeed reduce the workflow alot when you recheck the triggers on the reactivation of the slider (as then we can skip the implementation of moving sliders out and in the gameobjects).
     
  45. ThatJoeOverThere

    ThatJoeOverThere

    Joined:
    Aug 24, 2012
    Posts:
    120
    Can you send me the whole project?

    I'm stumped but I wonder if there's a RigidBody / Trigger mishap.

    Meanwhile, I'll change the code as described now.
     
  46. cygnusprojects

    cygnusprojects

    Joined:
    Mar 13, 2011
    Posts:
    766
    Hi Toby,

    I can't send you the whole project as it's containing copyrighted material but I'll create a simple test project for you to check things out. In the meantime we implemented a different approach which serves us well: attached the slicer to the weapon and added some slicers within the prefab of the sliceable object (and limited the maximum number of slices/object). The only problem with this is that the fill in doesn't work as TurboSlicer detects multiple meshrenderers (which are the ones of the slicer prefabs). If this could be fixed that would be great! I'll add such a case to the testing project as well so you can see for yourself. I estimate I will be able to provide this test project by tomorrow morning as I've got lot of stuff todo today ;-)
     
  47. ThatJoeOverThere

    ThatJoeOverThere

    Joined:
    Aug 24, 2012
    Posts:
    120
    If I could see a test case, that would really help me develop this for a wider range of use cases. I'll make an update to the software and manual shortly after I have a look.
     
  48. blaze

    blaze

    Joined:
    Dec 21, 2011
    Posts:
    211
    Toby, with the "animated mesh slicer", I can slice a Leg of a zombie, and make it fall in the ground and start to crawl?
    Or I will need to use a ragdoll and after the first slice, I cant animate it anymore?

    When I asked about this feature, the idea was to slice some coming zombies, and they continue coming until you cut/smash it's head.
     
  49. ThatJoeOverThere

    ThatJoeOverThere

    Joined:
    Aug 24, 2012
    Posts:
    120
    Yes. You don't need to use a ragdoll; you can animate the result as the two pieces have complete and compatible skeletons.
     
  50. blaze

    blaze

    Joined:
    Dec 21, 2011
    Posts:
    211
    I think that there is coming a new concept of "slicing games" to mobile.
    Awesome!