Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Mesh - Extraction

Discussion in 'Scripting' started by josephsaade, Sep 23, 2019.

  1. josephsaade

    josephsaade

    Joined:
    Apr 18, 2016
    Posts:
    46
    Trying to find a way to implement something like "Drawing in sand" or "Peeling". Basically reconstructing geometry from a mesh into a sub mesh based on user clicks.

    My first naive implementation seems very slow, any ideas?
     
    Last edited: Sep 26, 2019
  2. Yoreki

    Yoreki

    Joined:
    Apr 10, 2019
    Posts:
    2,605
    From the images i assume they are not actually modifying the mesh, but simply changing the textures and then creating another object that looks like the peeled outer layer, depending on the peel progress. So to reproduce it i would divide it into two steps to look into.
    1.) Changing the texture / uvs for some area on the mesh, which you can then do for where the player peeled the fruit.
    2.) Depends on how accurately you want to fake the peeled layer object. The easiest way would probably be to create some variety of peeled objects and then make them partly visible using a shader (as well as rotating them accordingly) to look like it was peeled off the fruit.

    There is probably a thousand ways to do this, depending on the performance and accuracy requirements, as well as the complexity you can handle to implement.
     
    Kurt-Dekker likes this.
  3. josephsaade

    josephsaade

    Joined:
    Apr 18, 2016
    Posts:
    46
    Thanks for the reply. I think you need to play it.

    I tried DepthMasking (but I am sure this is not what they are using). I am not sure I can change uv textures to make them transparent (where the user cuts). But I used RayCast to find triangleIndex and I would be able to cut a circle (or just one triangle for now) but this means that each model contains a huge number of tris.
     
  4. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,350
    i'd probably try using high resolution mesh,
    then player would paint into that texture,
    and that texture would used as a vertex offset to push vertices back,
    and maybe also as a color mask to reveal the inner fruit texture..

    some video here from that game
     
  5. josephsaade

    josephsaade

    Joined:
    Apr 18, 2016
    Posts:
    46
  6. josephsaade

    josephsaade

    Joined:
    Apr 18, 2016
    Posts:
    46
    Just watched


    Basically it is done with polygon subs-traction and recalculating colliders. So they are actually removing polygons like I was initially trying.
     
  7. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,514
    Hey you shouldn't as a general rule be removing posts wholesale. It sorta ruins the entire history of the thread. This forum and "Answers" are a growing body of mostly-useful Unity lore, indexed by the most powerful search engines in the world, and also by Bing.

    Edit it, refresh it, but don't destroy it unless you truly posted something dangerous, private, inappropriate, etc. And usually in those last cases, a Mod will zap your post anyway.
     
    gurbrindersingh likes this.
  8. Yoreki

    Yoreki

    Joined:
    Apr 10, 2019
    Posts:
    2,605
    This, sir, was hilarious.

    But jeah, why remove it? Are you one of those "now that i have my answers, i dont want others to have it easy" kind of people? We've had another one recently who just went along and deleted all his posts after he got an answer.

    So if you can, please try to reconstruct your original post for those to come. It's an interresting topic and if you looked for your answers and found a post discussing it, you wouldnt have wanted the OP to delete his question either, would you? As mentioned by Kurt, there are definitely reasons to delete a post, but other than those it's kinda just unfair for everybody who comes in the future with the same question.
     
    gurbrindersingh, Olmi and Kurt-Dekker like this.
  9. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Don't remove posts that have replies (or significantly alter them so the replies don't make sense).

    --Eric
     
    gurbrindersingh and Kurt-Dekker like this.
  10. chinhlv321

    chinhlv321

    Joined:
    Oct 27, 2019
    Posts:
    1
    see this video :
     
    Last edited: Mar 3, 2020
  11. unity_noZ0_6W70KHj0A

    unity_noZ0_6W70KHj0A

    Joined:
    Jul 25, 2019
    Posts:
    5
    Can anybody give any idea, how to achieve peeling as I Peel Good ?
     
    yimo24 likes this.
  12. kartikesh211

    kartikesh211

    Joined:
    Mar 23, 2018
    Posts:
    4
    Please Peel Mechanics! Anyone!
    Thanks in advance
     
    yimo24 likes this.
  13. yimo24

    yimo24

    Joined:
    May 13, 2016
    Posts:
    2
    you found how to implement this?
     
  14. yimo24

    yimo24

    Joined:
    May 13, 2016
    Posts:
    2
    same here, how is it going?