Jump to content


2D Distorted Sprite Shadows

gm:studio shader requested question

  • Please log in to reply
5 replies to this topic

#1 chiguy14


    GMC Member

  • New Member
  • 1 posts
  • Version:GM:Studio

Posted 28 March 2016 - 03:05 PM

So, I saw a video by Heartbeast (Random Dungeon Generation Ep.1) in which he created a shadow on the ground for the player.  The shadow was clearly transformed in some way.  No matter how hard I try, I just can't seem to replicate his results... Anyone have an idea?


The video that I am referencing:



  • 0

#2 Annoyed Grunt

Annoyed Grunt

    Right behind you.

  • GMC Member
  • 884 posts
  • Version:GM:Studio

Posted 28 March 2016 - 03:49 PM

Could you pinpoint the exact point where this shadow appears?

  • 0

Every time somebody uses the term "Roguelike" improperly I cry.


#3 johnboy


    GMC Member

  • GMC Member
  • 496 posts
  • Version:GM:Studio

Posted 28 March 2016 - 03:55 PM

I can't be done with watching the whole video, so I don't know exactly how Heartbeast has implemented it.


If it is an exact shadow of the player, but skewed, then using draw_sprite_pos would probably be how it's achieved. It allows you to set four draw points, and by using lengthdir_x/y to define these points you could rotate them around an object. This works on length / angle, so to skew the drawing you would use a length shorter than the sprite height, and set an angle that's appropriate for your "light" source. By setting the sprite to c_black it would be drawn as totally dark, and then changing the alpha setting would make it more, or less, transparent.


Something along those lines...(I think - that's off the top of my head!)

Edited by johnboy, 28 March 2016 - 03:56 PM.

  • 0

#4 Dufner


    GMC Member

  • GMC Member
  • 41 posts
  • Version:GM:Studio

Posted 28 March 2016 - 05:58 PM

I'm pretty sure he didn't uses shaders for that. The wallshadow and the playershadow are not on the same "surface" and that causes the "doubleshadow" if both shadows are on the same spot. (2:30)
So you have exactly the same effect with this code:
draw_sprite_ext(sprite_index, image_index, x, y, -1, 1, -45, c_black, 0.2);

Edited by Dufner, 28 March 2016 - 06:00 PM.

  • 0

#5 BattleRifle BR55

BattleRifle BR55

    Let Live

  • GMC Member
  • 10316 posts
  • Version:GM:Studio

Posted 28 March 2016 - 11:54 PM

A quick glance at the video should easily indicate that not only does this not use a shader, but his entire project doesn't use any at all.
  • 0

#6 TsukaYuriko


    Remember... and never forget

  • Global Moderators
  • 9535 posts
  • Version:GM:Studio

Posted 29 March 2016 - 12:03 AM

This topic has been moved to the Q&A forum as it did not follow the guidelines of the original forum that it was posted in (or was not relevant to that forum).

NOTE: This is an automated reply!

  • 0


Also tagged with one or more of these keywords: gm:studio, shader, requested, question