• Register

Main character lives in far future. He will encounter signs of “ancient” civilization, that use mysterious language connected with math and logic. We’ll discover the secret of disappearing the “ancients”, coping with various puzzles, especially when we will meet electronic panels hidden in deep caves or tree trunks. The world of our main character is wild, vast, interesting to explore.

Post news Report RSS Apparatus - animation system of climb on shelfs & GLARE filter

Animation system of climb on shelfs that allows the main character to use various climb animation depending on the sytuation.

Posted by on

Animation system of climb on shelfs that allows the main character to use various climb animation depending on the sytuation. For now there is 7 different sytuations of collision with a shelf:

  1. jump on/drop with knees at the height of a shelf (23 sec)
  2. jump on with hips at the height of a shelf (59 sec, it will be improv)
  3. drop with hips at the height of a shelf (29 sec, 36 sec)
  4. jump on with chest at the height of a shelf (53 sec)
  5. drop with chest at the heights of a shelf (38 sec)
  6. jump on with the head under a shelf (9 sec, 43 sec)
  7. jump up with the head under a shelf (0 sec)

The jump up/foward animation is also done. Every of these animations you can see on a video below:

Second issue I want to share is a glare filter for image postprocessing. I cant find anywhere the algorithm of this effect so I tried to make my own and it's work fine as you can see on a video below:

If someone want to use it in your game, you can do it on CC0 licence. Algorithm can be easily improved, becouse I use in it a few constant integers, but they can be repleced by variables dynamicly changing during game.

The glare algorithm as OpenCL-C kernel:

kernel void GlareKernel(global const int* pixels, int width, int height, int numDataElements, global int* newpixels, int maxDataSize, float glare, int r, int smoth) {
     int idx = get_global_id(0);
     if (idx >= maxDataSize) {
         return;
     }
     newpixels[idx] = pixels[idx];
     if ((idx & 3) == 3) {
         int i = idx / numDataElements;
         int yl_ = (i + 1) / width;
         int xl = i + 1 - yl_ * width;
         int yl = xl > 0 ? yl_ + 1 : yl_;
         float glareSum = 0;
         for (int k = xl - r; k <= xl + r; k++) {
             for (int j = yl - r; j <= yl + r; j++) {
                 int X = k - xl;
                 int Y = j - yl;
                 int d = (int)abs((int)abs(X) - (int)abs(Y));
                 int s = (int)(((float)abs(X) + (float)abs(Y))/(float)(r/2));
                 if (d+s < smoth) {
                     int idx = (j * width + k - 1) * numDataElements - 1;
                     if (idx >= 0 && idx < width*height*numDataElements) {
                         int A = pixels[idx];
                         int B = pixels[idx - 1];
                         int G = pixels[idx - 2];
                         int R = pixels[idx - 3];
                         if (A > 250 && R + G + B > 600) {
                             float D = sqrt((float)(X*X+Y*Y));
                             float dk = 3*(float)r;
                             float sg = (dk - D)/dk;
                             float SG = (float)(smoth - d-s)/(float)smoth;
                             glareSum += glare*sg*SG;
                         }
                     }
                 }
             }
         }
         int GS = (int)glareSum;
         newpixels[idx] = max(0, min(255, newpixels[idx] + GS));
         newpixels[idx - 1] = max(0, min(255, newpixels[idx - 1] + GS));
         newpixels[idx - 2] = max(0, min(255, newpixels[idx - 2] + GS));
         newpixels[idx - 3] = max(0, min(255, newpixels[idx - 3] + GS));
     }
}
Post a comment

Your comment will be anonymous unless you join the community. Or sign in with your social account: