Ooops
November 28, 2020, 02:21:21 AM

Author Topic: [bb] Easy Shadows (flat surfaces only) by daaan [ 1+ years ago ]  (Read 616 times)

Offline BlitzBot

  • Jr. Member
  • **
  • Posts: 1
Title : Easy Shadows (flat surfaces only)
Author : daaan
Posted : 1+ years ago

Description : This is the easiest way to get decent looking shadows. The only problem is that they only work on a single flat surface.

Code :
Code: BlitzBasic
  1. ; lazy mans shadows ;
  2. ;      by tank      ;
  3. Graphics3D 640,480,32,2
  4. SetBuffer BackBuffer()
  5.  
  6. campiv=CreatePivot()
  7. camera=CreateCamera(campiv)
  8. MoveEntity camera,0,5,-10
  9. TurnEntity camera,25,0,0
  10.  
  11. cone=CreateCone()
  12. MoveEntity cone,0,5,0
  13.  
  14. shadow=CreateCone()
  15. EntityFX shadow,1
  16. EntityColor shadow,10,10,10
  17. ScaleEntity shadow,1,0.001,1
  18. MoveEntity shadow,0,0.11,0
  19. EntityAlpha shadow,0.5
  20.  
  21. platform=CreateCube()
  22. ScaleEntity platform,5,0.1,5
  23. EntityColor platform,100,100,100
  24.  
  25. light=CreateLight()
  26. MoveEntity light,0,20,0
  27. TurnEntity light,90,90,0
  28.  
  29. scale#=1.0
  30.  
  31. ; M A I N  L O O P ;
  32. While Not KeyHit(1)
  33.                
  34.         TurnEntity campiv,0,0.1,0
  35.                
  36.         RotateMesh cone,1,1,0
  37.         RotateMesh shadow,1,1,0
  38.        
  39.         If KeyDown(200) Then scale# = scale# + 0.01
  40.         If KeyDown(208) Then scale# = scale# - 0.01
  41.         ScaleEntity cone, scale#, scale#, scale#
  42.         ScaleEntity shadow, scale#+(scale#*0.4), 0.001, scale#+(scale#*0.4)
  43.                
  44.         UpdateWorld
  45.         RenderWorld
  46.        
  47.         Text 10,10,"Use the UP ARROW and DOWN ARROW keys to change the scale of the cone."
  48.        
  49.         Flip
  50.        
  51. Wend


Comments :


Clarks(Posted 1+ years ago)

 thats pretty neat


puki(Posted 1+ years ago)

 Nice shadow thingy>'The only problem is that they only work on a single flat surface'Still useful.


bytecode77(Posted 1+ years ago)

 waaah, rubish...( sry:( )but if you wanna have a stencil shdaow system, just go into my worklogs(signature or click onto my name)!


Naughty Alien(Posted 1+ years ago)

 you said you will make it faster (I try it and its still not for real use)...so, I hope it will be updated soon (I'm talking about stencil shadows)


bytecode77(Posted 1+ years ago)

 well, i dont know wether i can make it faster... i cannot promise you that it will be faster...


fireshadow4126(Posted 1+ years ago)

 thanksvery simple, but effective for my purposes, considering that the game that I'm making is mostly inside a labyrinth, so it's going to be flat


_PJ_(Posted 1+ years ago)

 Nice and fast, Shame if you try using more complex shapes, or have 'AddMesh' though.


 

SimplePortal 2.3.6 © 2008-2014, SimplePortal