Shadows
BlitzMax Forums/BlitzMax Beginners Area/Shadows| 
 | ||
| I'm trying to create simple shadows for an Isometric 'wall'. At first I thought about drawing a skewed rect. However, I then checked the ZombieBlast game and thought I might do it by rotating the image itself. However, I can't get the rotation right. This is what I have so far... 
Strict
Global scr_wide = 640, scr_high=480
Graphics scr_wide,scr_high
Incbin "grass.png"  'green 640,480 image
Incbin "house.png"  'iso 64*64 rectangle
Global grass:TImage = LoadImage("incbin::grass.png")
Global house:TImage = LoadImage("incbin::house.png")
While Not KeyHit(KEY_ESCAPE)
  Cls
  DrawImage grass,0,0
  SetBlend alphaBlend
  SetColor 0,0,0
  SetAlpha 0.3
  SetRotation 30
  DrawImage house,120,100
  SetColor 255,255,255
  SetBlend maskblend
  SetAlpha 1.0
  SetScale 1.0,1.0
  SetRotation 0
  DrawImage house,100,100
  DrawText MouseX()+" " + MouseY(),0,0
  Flip
Wend
End
The problem is I need to rotate it along an edge line rather than a point (I think). Any ideas? | 
| 
 | ||
| You might want to look into raytracing / raycasting, and see if that has anything on setting up shadows and lighting. | 
| 
 | ||
| I've looked at lots and lots of methods. Before I get too involved with them I wondered how easy this would be. It works ok with 'normal' 2D geometry (see ZombieBlast) as the rotation is on a point (e.g. the feet). If this DOES work then it might be quicker than light/shadow maps and just need to see how many inaccuracies there would be. | 
| 
 | ||
| Do the math and draw a polygon for the shadow. Using set alpha you can make it blend into the floor. Do something like... drawfloor() drawshadows() drawplayersenemiestreasurewallsetcetcetc() | 
| 
 | ||
| I did shadows by simply drawing the original image with x and y offset 2 pixels with color set to some shade of black. Draw shadow first - draw full color image second. | 
| 
 | ||
| sorry Emmett, I should have been more specific. I'm trying to do shadows caused and affected by area lights. |