Page 1 of 1

Soft Shadows

Posted: Sat Jul 13, 2013 3:42 pm
by maslobojik
How to create soft shadows on Purebasic???? Like this http://dlight.ru/images/mrs05.jpg
Is it impossible??

Re: Soft Shadows

Posted: Sun Jul 14, 2013 8:25 am
by Bananenfreak
I think it´s possible, if you´re knowledge about shaders is big enough :)

Re: Soft Shadows

Posted: Sun Jul 14, 2013 2:55 pm
by applePi
as a replacement of softening the shadow edges witch are not supported by Ogre engine itself we can softening the shadow itself by reducing its intensity and to make its color approach the environment color and also by adjusting the ambient color, not what is wanted but it is psychologically have some effect like soft shadow edges.
also look at the LightAttenuation.pb example

Code: Select all

Enumeration
   #cyl
   #TEX
   #TEX_plane
   #MAT
   #plane
   #LIGHT
   #CAMERA_ONE
   #BUTTON
   #mainwin
EndEnumeration
Global Quit.b = #False

If OpenWindow(#mainwin, 0, 0, 500, 480, "press ESC to exit...", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)

InitEngine3D()
InitSprite()
InitKeyboard()
OpenWindowedScreen(WindowID(#mainwin), 0, 0, 500, 400, 0, 0, 0)
;WorldShadows(#PB_Shadow_Additive)
WorldShadows(#PB_Shadow_Modulative, -1, RGB(213, 250, 213))
SetFrameRate(60)

  Add3DArchive(#PB_Compiler_Home + "Examples/3D/Data/Textures", #PB_3DArchive_FileSystem)
  Add3DArchive(#PB_Compiler_Home + "Examples/Sources\Data", #PB_3DArchive_FileSystem)
  Add3DArchive("/", #PB_3DArchive_FileSystem)

CreateMaterial(#TEX_plane, LoadTexture(#TEX_plane, "white.jpg"))
CreatePlane(#plane, 10, 10, 1, 1, 1, 1)
CreateEntity (#plane, MeshID(#plane), MaterialID(#TEX_plane))
  
CreateCylinder(#cyl, 2, 4.5)
LoadTexture(#TEX, "DosCarte.png")
CreateMaterial(#MAT, TextureID(#TEX))

CreateEntity(#cyl, MeshID(#cyl), MaterialID(#MAT))
;ScaleEntity(#cyl,0.5,0.5,0.5)
EntityRenderMode(#cyl, #PB_Entity_CastShadow)
MoveEntity(#cyl,-3,2.5,0)

CreateLight(0,RGB(255,255,255),-100,40,30)
CreateLight(1,RGB(0,255,0),-100,40,30)
AmbientColor(RGB(10,10,10))

CreateCamera(#CAMERA_ONE, 0, 0, 400, 400)
MoveCamera(#CAMERA_ONE, 0, 4, 9)
CameraLookAt(#CAMERA_ONE, 0, 2, 0)

RotateCamera(#CAMERA_ONE, -15, 0, 0)
EndIf

Repeat
  Event = WindowEvent()
  RenderWorld()
  FlipBuffers()

   ExamineKeyboard()
   If KeyboardReleased(#PB_Key_Escape)
      Quit = #True
   EndIf

Until Quit = #True Or Event = #PB_Event_CloseWindow

   
    

Re: Soft Shadows

Posted: Sun Jul 14, 2013 6:38 pm
by Bananenfreak
Hmm, hears plausible, but for me, it doesn´t work. The shadow is not softened...

http://ogre3d.org/forums/viewtopic.php?t=39809

But how to let it work I don´t know :(