Strange shadow effect with spotlight

Everything related to 3D programming
User avatar
AndyLy
Enthusiast
Enthusiast
Posts: 228
Joined: Tue Jan 04, 2011 11:50 am
Location: GRI

Strange shadow effect with spotlight

Post by AndyLy »

Hi, I have one problem with shadows.
If I use a direct light source - shadows displays normal, if spotLight - shadow and light displays in the inversion. The picture below it shows.

Code: Select all

CreateLight(222,RGB(200,200,200),32,75,200,#PB_Light_Directional): LightLookAt(222,52,10,240)
WorldShadows( #PB_Shadow_Modulative, 70, RGB(120,120,120))
Image

Code: Select all

CreateLight(223,RGB(200,200,200),38,94,165,#PB_Light_Spot)
SpotLightRange(223,20,240): LightDirection(223,1,-1,1)
WorldShadows( #PB_Shadow_Modulative, 70, RGB(120,120,120))
Image

I can not put all the source code, but maybe someone has an idea why this happens?
'Happiness for everybody, free, and no one will go away unsatisfied!'
SMsF town: http://www.youtube.com/watch?v=g6RRKYf_Pd0
SMf locations module (Ogre). Game video: http://www.youtube.com/watch?v=ZlhBgPJhAxI
User avatar
Samuel
Enthusiast
Enthusiast
Posts: 756
Joined: Sun Jul 29, 2012 10:33 pm
Location: United States

Re: Strange shadow effect with spotlight

Post by Samuel »

Unfortunately, I can't replicate your problem. I'm guessing this only happens under certain conditions.

I once read a topic saying that inverted shadows can appear when a light is within the bounding box of an object.
Maybe that's somehow related to your problem. You could try moving your light source to different locations and see if you can get different results.
User avatar
AndyLy
Enthusiast
Enthusiast
Posts: 228
Joined: Tue Jan 04, 2011 11:50 am
Location: GRI

Re: Strange shadow effect with spotlight

Post by AndyLy »

Thank you for reply.
This whole room is a mesh. So "light is within the bounding box of an object."
Well, it will be one more reason not to use shadow. )
Anyway with shadows FPS falls too much, impossible to play.
'Happiness for everybody, free, and no one will go away unsatisfied!'
SMsF town: http://www.youtube.com/watch?v=g6RRKYf_Pd0
SMf locations module (Ogre). Game video: http://www.youtube.com/watch?v=ZlhBgPJhAxI
User avatar
AndyLy
Enthusiast
Enthusiast
Posts: 228
Joined: Tue Jan 04, 2011 11:50 am
Location: GRI

Re: Strange shadow effect with spotlight

Post by AndyLy »

Room - a single mesh, I mean cube (walls, floor, ceiling).

I tried static geometry once, maybe I did something wrong, but after free all entities I got scene without physics.
'Happiness for everybody, free, and no one will go away unsatisfied!'
SMsF town: http://www.youtube.com/watch?v=g6RRKYf_Pd0
SMf locations module (Ogre). Game video: http://www.youtube.com/watch?v=ZlhBgPJhAxI
User avatar
Bananenfreak
Enthusiast
Enthusiast
Posts: 519
Joined: Mon Apr 15, 2013 12:22 pm

Re: Strange shadow effect with spotlight

Post by Bananenfreak »

Don´t free the entities, just hide them. So (in my mind) only the StaticGeometry is rendered, but you´ll have the static physicsbody of your entities.
Image
User avatar
AndyLy
Enthusiast
Enthusiast
Posts: 228
Joined: Tue Jan 04, 2011 11:50 am
Location: GRI

Re: Strange shadow effect with spotlight

Post by AndyLy »

I tried static geometry right now: first, it behaves strangely, the meshes are only visible from a certain angle of the camera (in the range of 90 deg.), at other angles they are invisible. Second FPS increase only on 5.
Yes, if hiding objects - physics persists.
'Happiness for everybody, free, and no one will go away unsatisfied!'
SMsF town: http://www.youtube.com/watch?v=g6RRKYf_Pd0
SMf locations module (Ogre). Game video: http://www.youtube.com/watch?v=ZlhBgPJhAxI
User avatar
AndyLy
Enthusiast
Enthusiast
Posts: 228
Joined: Tue Jan 04, 2011 11:50 am
Location: GRI

Re: Strange shadow effect with spotlight

Post by AndyLy »

Today I decided to check out one thing - it is important to disable casting shadows of the room itself, then works fine (with spot light). :D
'Happiness for everybody, free, and no one will go away unsatisfied!'
SMsF town: http://www.youtube.com/watch?v=g6RRKYf_Pd0
SMf locations module (Ogre). Game video: http://www.youtube.com/watch?v=ZlhBgPJhAxI
Post Reply