Search Unity

Is there a method of continuously interpolating the interior of an object as it gets destroyed?

Discussion in 'Scripting' started by SoundStormLabs, Jun 24, 2018.

  1. SoundStormLabs

    SoundStormLabs

    Joined:
    May 6, 2017
    Posts:
    187
    Suppose for instance, an apple. It's simple for the most part, except for a slightly unusual seed pod in the middle, it's solid white/yellow all the way through. How could it be programmed so that no matter what angle someone slices it or takes a bite out of it, that the interior is solid white and then the middle has the seeds?
     
    Last edited: Jun 24, 2018
  2. dadude123

    dadude123

    Joined:
    Feb 26, 2014
    Posts:
    789
    In this instance its easy since the apple is basically a sphere and the seeds are at the center.
    So you can just project a texture into the interior of the slice. Like a small circle (the seeds) within a larger circle (the rest of the apple).

    And depending on how deep the slice is, you make the inner circle bigger/smaller, so this is best done using a shader specifically made for this.

    I'd just generate a circle or circular gradient as a mask, and then use 2 textures for center/rest.
    Optionally do some parallax mapping to make it more realistic...


    For other shapes it is probably more complicated, but for most simple cases maybe it could be done with some basic tri-planar projection.

    For the really complex shapes (lets say a whole car or something) you'll have to come up with a unique/specialized approach for each object.

    In the worst case you'd simply have to model the entire interior of a model as well.