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

An edge detection variation.

Discussion in 'Shaders' started by mckertis, Feb 17, 2011.

  1. mckertis

    mckertis

    Joined:
    Dec 20, 2009
    Posts:
    16
    I want to do a kind of a procedural map. This is a concept picture, the map is a 2D projection. So, the white parts are a randomly spawned spheres, around each sphere a purple circle is spawned, and where the purple parts intersect - they merge, but otherwise there is a clear border designating the amount of territory the white spheres control together. The default edge detection filter is too limited, but i guess its about what i need, if only it had more options. So how can i do this ?
     

    Attached Files:

  2. aubergine

    aubergine

    Joined:
    Sep 12, 2009
    Posts:
    2,878
    i didnt understand, be more specific what you require.
     
  3. mckertis

    mckertis

    Joined:
    Dec 20, 2009
    Posts:
    16
    I set up an ortho camera, right ? Then i spawn two spheres at random coordinates within the camera view, right ? Around each sphere i spawn a circle plane mesh with texture of solid color, right ? And at the edges of those circular planes i want to have a thick border of a different color, but if two circles intersect - the border disappears at the point of intersection.
    In the picture, the two purple circular shapes are actually separate shapes, but the border is common to the both of them.

    Look at any world map, the nation is made of cities and towns, but all those towns have a common national border.
    Or an even more obvious example, scrambled eggs. The yolks are separate, but the egg white around them has become one.
     
  4. Krobill

    Krobill

    Joined:
    Nov 10, 2008
    Posts:
    282
    if you stick to your ortho camera and spheres only example, you don't need any shader to get this result. The blue gray outline can be faked with spheres or discs linked to your spheres on the x and y axis but positioned behind your spheres and there 'primary' outline.
     
  5. aubergine

    aubergine

    Joined:
    Sep 12, 2009
    Posts:
    2,878
    Yeah just use suitable texture and no need for a shader here.