User Tag List

Results 1 to 4 of 4

Thread: Tilemap Pixel Shader (aka "texture atlas" shader)

  1. #1
    Clicker Fusion 2.5 Developer

    Join Date
    Jul 2008
    Posts
    1,305
    Mentioned
    14 Post(s)
    Tagged
    0 Thread(s)

    Tilemap Pixel Shader (aka "texture atlas" shader)

    For anyone unfamiliar with the concept, here's a little background info:
    http://blog.tojicode.com/2012/07/spr...ps-on-gpu.html

    So basically, you have an object the same size as your frame (I really ought to add scrolling support, so it only needs to be the size of the window), with two textures:
    * a map image representing your game level, with 1 pixel per tile.
    * a tileset image with the individual tiles, in a 16x16 tile grid.

    The color of each pixel in the map image determines which tile from the tileset to draw at that position.

    Anyway, here's my version: http://sdrv.ms/13aDqGN

    The tileset image must be 16x16 tiles in size. Tiles are indexed from 0-255 (ordered left-to-right and top-to-bottom), using the red component from the map image only (unlike the example above which uses red and green).

    btw: I realize there are many other ways to do the same thing, besides a pixel shader, but it just seemed like an interesting experiment.


    EDIT: Ooops - it's still broken (thought I'd fixed it). If anyone can figure out how to fix it, it would be much appreciated...

  2. #2
    Clicker Fusion 2.5 DeveloperSWF Export ModuleUnicode Add-on
    Looki's Avatar
    Join Date
    Aug 2006
    Location
    Karlsruhe, Germany
    Posts
    3,739
    Mentioned
    5 Post(s)
    Tagged
    1 Thread(s)
    Nice work, but I don't see why you're limitting yourself to 16x16 tiles. From what I can tell you only mod/div by that size, so there's no problem implementing it as parameter.

  3. #3
    Clicker Fusion 2.5 Developer

    Join Date
    Jul 2008
    Posts
    1,305
    Mentioned
    14 Post(s)
    Tagged
    0 Thread(s)
    Yeah, that would be very easy - but it's just a simple little demo at the moment. I might add stuff like that and scrolling later.

    In the meantime, it's still not working properly on my netbook for some reason (uses the wrong tiles in some places) - even though it works perfectly on my desktop pc, and the netbook has never had any trouble with any other pixel shaders.


    EDIT: Never mind - I think I've fixed it now. I'll add those other features tomorrow.

  4. #4
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleUnicode Add-on
    Fanotherpg's Avatar
    Join Date
    Jul 2006
    Location
    High Wycombe, Buckinghamshire, UK
    Posts
    3,665
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Looking forward this experiment.

Similar Threads

  1. Request pixel shader "Convex polygon"
    By SEELE in forum Hardware Accelerated Runtime
    Replies: 33
    Last Post: 4th August 2013, 11:17 PM
  2. Shader: "Under Water" dosen't works ...
    By flechenoir in forum Multimedia Fusion 2 - Technical Support
    Replies: 11
    Last Post: 27th May 2013, 01:36 AM
  3. "Rendertarget ping/pong" and "Pixel shaders" Can TGF2 do this?
    By CloudExSolider in forum The Games Factory 2 - Technical Support
    Replies: 13
    Last Post: 7th April 2013, 09:21 PM
  4. "Support DXT texture formats" enabled caused bug
    By Blizna in forum Hardware Accelerated Runtime
    Replies: 1
    Last Post: 26th June 2009, 09:10 AM

Posting Permissions

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