M
mysticjim
Guest
Hello
I've been collecting lots of possible ways to do this, some more practical than others, but i thought I'd throw this out here to get some feedback and maybe other suggestions I haven't discovered yet.
So, I'm working on a top down shooter, literally all the graphics are portrayed in a plan view. I wanted to impliment shadows to all the characters and buildings in the game. The game is set outdoors, mostly, in what I'd consider normal daylight. I've already shaded most of my static graphics like buildings imagining the light is hitting it from the bottom left, so I want to generate simple shadows going off to the top right for all of them, and for the shadows to reflect their imagined height.
This was fine with characters, a simple close drop shadow works fine as it's so close to the character object, but buildings are causing me issues.
Initially I was actually drawing the shadow and building that into the sprite image as I drew it in Photoshop - which was a massive pain and not very efficient as I have buildings and things of different sizes. I really don't want to have to draw in a shadow manually for every building!
Drop shadows are easy to generate in the draw event, but no good buildings if you want to give a sense of height as they simply make the building look like it's hovering.
I found this brilliant tutorial by Friendly Cosmonaut;
It involves using the draw_sprite_pos feature - which I initially thought was a winner, until I realised that this sprite function doesn't naturally let you set the colour of the shadow sprite to c_black. Friendly Cosmonaut gets around this by using gpu_set_fog - however I'm currently using GMS1.4 and this function isn't available (another reason for me to upgrade soon, me thinks!)
So I was back to the drawing board.
I see lots of fancy lighting systems tutorials but they all seem to deal with dynamic shadows, i.e. moving light sources and stuff. I'd have thought what I need is much simpler - just a single light source effecting all the buildings in the same way - a generic 45 degree shadow on everything.
I think I've ruled out all functions native to GMS1.4 using sprite commands - they either can't put the sprite in the right shape or in the right place, or don't have the right means to manipulate the colour of the shadow.
Is there a simple and elegant solution that I've missed? I've seen a few comments about manipulating primitives and surfaces, and a few things about shaders, both of which looked a bit scary in terms of complexity. If they're viable solutions does anyone know a kind of 'baby-steps' approach to figuring those out?
I've been collecting lots of possible ways to do this, some more practical than others, but i thought I'd throw this out here to get some feedback and maybe other suggestions I haven't discovered yet.
So, I'm working on a top down shooter, literally all the graphics are portrayed in a plan view. I wanted to impliment shadows to all the characters and buildings in the game. The game is set outdoors, mostly, in what I'd consider normal daylight. I've already shaded most of my static graphics like buildings imagining the light is hitting it from the bottom left, so I want to generate simple shadows going off to the top right for all of them, and for the shadows to reflect their imagined height.
This was fine with characters, a simple close drop shadow works fine as it's so close to the character object, but buildings are causing me issues.
Initially I was actually drawing the shadow and building that into the sprite image as I drew it in Photoshop - which was a massive pain and not very efficient as I have buildings and things of different sizes. I really don't want to have to draw in a shadow manually for every building!
Drop shadows are easy to generate in the draw event, but no good buildings if you want to give a sense of height as they simply make the building look like it's hovering.
I found this brilliant tutorial by Friendly Cosmonaut;
It involves using the draw_sprite_pos feature - which I initially thought was a winner, until I realised that this sprite function doesn't naturally let you set the colour of the shadow sprite to c_black. Friendly Cosmonaut gets around this by using gpu_set_fog - however I'm currently using GMS1.4 and this function isn't available (another reason for me to upgrade soon, me thinks!)
So I was back to the drawing board.
I see lots of fancy lighting systems tutorials but they all seem to deal with dynamic shadows, i.e. moving light sources and stuff. I'd have thought what I need is much simpler - just a single light source effecting all the buildings in the same way - a generic 45 degree shadow on everything.
I think I've ruled out all functions native to GMS1.4 using sprite commands - they either can't put the sprite in the right shape or in the right place, or don't have the right means to manipulate the colour of the shadow.
Is there a simple and elegant solution that I've missed? I've seen a few comments about manipulating primitives and surfaces, and a few things about shaders, both of which looked a bit scary in terms of complexity. If they're viable solutions does anyone know a kind of 'baby-steps' approach to figuring those out?