Results 1 to 10 of 13

Thread: Smoothening tile edges

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Smoothening tile edges

    I'm working on a tile-based game at the moment, and could use some hints on making it look better. Rendering is using GLSL pixel shader for these 6-sided hexagon tiles. I let there be 4 texturemaps for the terrain, so i can blend them without too much performance loss. Basically fragment shader does:
    Code:
      if (color.w > 0.5) {
        gl_FragColor = color * (
          ts.x * texture2D(tex0, texCoord) +
          ts.y * texture2D(tex1, texCoord) +
          ts.z * texture2D(tex2, texCoord) +
          ts.w * texture2D(tex3, texCoord) );
      } else {
        gl_FragColor = vec4(0.0);
      }
    So i can "break" 1 edge that is exposed to air, to make it look flatter as seen in the attached screenshot. I render 2 dirt tile and 1 stone tile on right side of them. The top-left corner use alpha 0.2 and bottom mid-left corners are set alpha -0.2, that's variety i can let there be... But it didn't work as well as i hoped. Instead of having 1 sharp edge, there now is 2 smaller ones. Ok that looks better than that 1 big sharp edge, when zoomed further out, but is there anything i can do to make it rounder/flatter? I could propably modify color.w component to start alpha 0 from that edge at 0.5, scale it differently. But then it wouldn't be solid edge anymore.

    edit: Scaling was easy to do so attached comparison what it would look like
    Code:
    vec4 col = vec4(color.xyz, (color.w-0.5)*2.0);
    Attached Images Attached Images
    Last edited by User137; 27-04-2013 at 04:01 AM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •