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.
  2. Dismiss Notice

Question Dynamic outline extrusion

Discussion in 'Scripting' started by Ilikefishandchips, Jul 3, 2023.

  1. Ilikefishandchips

    Ilikefishandchips

    Joined:
    Jul 3, 2023
    Posts:
    3
    I have developed a paining system which allows the user to paint rivers (textures) on a flat 2D plane, and would like river banks to be dynamically generated along the sides of the painted river.

    The banks would consist of extruded edges along the river with a texture.
    The plane is similar to the below:


    I have a couple ideas involving raycasting to find the desired color border and generating a spline along it, or shader extrusion of some kind - but so far have not found a performant solution as this is a priority for me (it's a mobile game).

    any further ideas would be much appreciated, I am curious and stumped!
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,563
  3. Ilikefishandchips

    Ilikefishandchips

    Joined:
    Jul 3, 2023
    Posts:
    3
    This looks interesting and may be useful for the extrusion. What is the performance like?
    Would need to combine this with an edge detection system but looks promising. Thanks
     
  4. zulo3d

    zulo3d

    Joined:
    Feb 18, 2023
    Posts:
    510
    Edge detection would be very difficult and very unreliable. What happens if the user paints their name?. You won't be able to generate a single spline if the painted river is complex. A better approach would be to let the user create a spline and then your program creates the river from the spline. But generating an efficient polygon terrain from a spline would still be very difficult.

    As Kurt has shown, a better approach is to convert your texture into a height map and apply it to a Unity terrain. Easy!.
     
  5. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,563
    Let me know when you find out! It might be quite different on a $50 Android Cobi versus a $4000 gaming rig.
     
  6. Ilikefishandchips

    Ilikefishandchips

    Joined:
    Jul 3, 2023
    Posts:
    3
    Using heightmaps seems interesting, is there a performant way of generating terrain via a heightmap during runtime?
     
  7. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,563
    Nobody made successful games by observing techniques and deeming them interesting or not.

    Get cracking and try some of this stuff out, iterate, learn, understand, measure, refine, implement, succeed.

    You seem to be horribly tunnel-vision fixated on performance.

    Contemplating the most-incredibly-performant vaporware also never made anyone a successful game.

    Get something working first that actually solves your problem FIRST, see how it goes.
     
    Ilikefishandchips likes this.