Shadow Mapping or Stencil for FPS

puso1990

08-12-2013 14:50:58

Hi.

I have decided to make a First Person Horror Survival game. If it's a horror survival game, then it has to be dark. And with darkness, here comes shadows. I use Mogre 1.7.1 simply because it's the last version that works on .NET 2.0 and so works on Windows XP. I have tried and sucessfuly added some shaders to my engine, like simple Bloom or Glow shader, found on Ogre snippets. But I'm really confused about the shadows. I have no idea, should I use Texture or Stencil shadows. Both of them give me serious problem so far. As for stencil shadows:

I created a simple test arena in Blender:
[attachment=2]CaptureItPlus635221131365156250.jpg[/attachment]

I loaded it to my engine, with ShadowTechnique.SHADOWTYPE_STENCIL_ADDITIVE, and got some really wierd results:[attachment=1]engine.jpg[/attachment]

All lights are point lights. So everything should work flawlessly, but it's not. It seems like the shadows are there where the lights should be, and lights where the shadows should be. It's really wierd and no explanation really. All lights are put inside the mesh, and all normals are checked and flipped on the inside.

And like there is not enough problems, even Static Geometry doesn't cast shadows at all. So I have to use Movable object for the scene, which is going to give me preformance problems, when the scenes will become large.

I also tried texture shadows. I tried custom shadow mapping found at wiki pages:
http://www.ogre3d.org/tikiwiki/tiki-index.php?page=Custom+Shadow+Mapping&structure=Cookbook

I ran the engine, and found in log file, that:
vertex_program ShadowCasterVP cg
{
source v-shadow-caster.cg
entry_point main
profiles arbvp1

default_params
{
param_named_auto p_ModelViewProjection worldviewproj_matrix
param_named_auto p_AmbientLight ambient_light_colour
}
}

...this Vertex Program is not supported. No surprise, since it uses profile arbvp1 which I believe is a Open GL shader model, and I ran the engine with Direct 3D9 system. And when I tried to switch to OpenGL system, I got even wierder results:
[attachment=0]gl.JPG[/attachment]

...and all new errors in log file:
  1. 15:43:55: Compiler error: number expected in Lighting.program(12): extra parameters required by constant definition light_position_object_space
    15:43:55: OGRE EXCEPTION(7:InternalErrorException): Unable to compile Cg program LightingFP: CG ERROR : "The compile returned an error."
    (34) : error C0000: syntax error, unexpected ')' at token ")"
    (34) : error C0501: type name expected at token ")"
    (39) : error C0000: syntax error, unexpected ';', expecting ',' or ')' at token ";"
    (39) : error C0501: type name expected at token ";"
    (42) : error C0000: syntax error, unexpected ';', expecting ',' or ')' at token ";"
    (42) : error C0501: type name expected at token ";"
    (45) : error C0000: syntax error, unexpected ';', expecting ',' or ')' at token ";"
    (45) : error C0501: type name expected at token ";"
    (51) : error C0000: syntax error, unexpected ';', expecting ',' or ')' at token ";"
    (51) : error C0501: type name expected at token ";"
    (57) : warning C7022: unrecognized profile specifier "l_Out"
    (70) : error C0000: syntax error, unexpected '.' at token "."
    (70) : error C0501: type name expected at token "."
    (70) : warning C7022: unrecognized profile specifier "l_Out"
    (70) : error C1038: declaration of "color" conflicts with previous declaration at (57)
    (70) : error C1038: declaration of "rgb" conflicts with previous declaration at (57)
    (70) : error C1038: declaration of "l_Specular" conflicts with previous declaration at (67)
    (70) : error C1038: declaration of "rgb" conflicts with previous declaration at (57)
    (73) : error C0000: syntax error, unexpected '.' at token "."
    (73) : error C0501: type name expected at token "."[/list:u]

    I have no idea what shoul I try next. I really need some decent shadow technique and I ran out of ideas. I have tried to find Ogre soft shadows demo:
    http://ogre3d.org/forums/viewtopic.php?t=39809
    ...but all links that I found are broken. Please help!!

    I have no idea how to move on, and shadows are a MUST for that kind of game. Please help!

    cheers