Search Unity

Good alternative to bitwise operations

Discussion in 'Shaders' started by aflesher, Sep 9, 2017.

  1. aflesher

    aflesher

    Joined:
    Dec 12, 2013
    Posts:
    28
    I'm trying to draw a simple 2D map using a shader like so



    This was going really well until I tried to run an actual build. This is when I learned I can't use bitwise operators in my shader code ...

    I'm currently using two bitmask parameters to determine where the walls should be drawn in. In this 3 x 5 grid map that I have there are 38 possible wall locations. I'd really prefer not to have wall1, wall2 ... wall38 different parameters passed in.

    What is a good alternative to this?
     
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,339
    Chrisad and aflesher like this.