Soft Shadows

Everything related to 3D programming
maslobojik
User
User
Posts: 36
Joined: Thu Jul 11, 2013 11:17 pm

Soft Shadows

Post by maslobojik »

How to create soft shadows on Purebasic???? Like this http://dlight.ru/images/mrs05.jpg
Is it impossible??
User avatar
Bananenfreak
Enthusiast
Enthusiast
Posts: 519
Joined: Mon Apr 15, 2013 12:22 pm

Re: Soft Shadows

Post by Bananenfreak »

I think it´s possible, if you´re knowledge about shaders is big enough :)
Image
applePi
Addict
Addict
Posts: 1404
Joined: Sun Jun 25, 2006 7:28 pm

Re: Soft Shadows

Post 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

   
    
Last edited by applePi on Sun Jul 14, 2013 7:25 pm, edited 1 time in total.
User avatar
Bananenfreak
Enthusiast
Enthusiast
Posts: 519
Joined: Mon Apr 15, 2013 12:22 pm

Re: Soft Shadows

Post 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 :(
Image
Post Reply