Thank you guys! As I've said, esp. right now it has many limitations. 1) Exactly, the (2D) layout matters and thus it's only suitable for corridors and hallways with some pillars here and there. Props and characters should use stencil shadows, though. 2) Yes, it "casts" on everything, it's an object shader (see below) that you can apply on every model. 3) Here you go: http://www.youtube.com/watch?v=4b3BvHuDetk 4) Currently, I take an invisible model, place it at the corner and let it calculate a (2D) normal vector that is perpendicular to the direction vector light->corner. (I make sure that the normal vector does not point inside the level geometry.) Then in my regular point light object shader, I add the following lines:
edgelightdir = vecLightPos[i].xz-dyn_corner_flt.xy;
fj = length(edgelightdir);
edgeposdir = InWorldPos.xz-dyn_corner_flt.xy;
projrange = dot(edgelightdir,edgeposdir)/(fj*fj); //yes, the case fj == 0 is ignored right now
if(projrange < 0)
off = distance(dyn_corner_flt.xy,InWorldPos.xz)/5;
fj = dot(dyn_normal_flt.xy,dyn_corner_flt.xy)-dot(dyn_normal_flt.xy,InWorldPos.xz)+2;
Shadow += vecLightColor[i]*fac * (1-pow(saturate(fj/(5+off)),1.5));
else Shadow += vecLightColor[i]*fac;
All I do is that I check on which side of the line light->corner the current pixel (InWorldPos.xz) is (in respect to the normal vector calculated by our corner model) and depending on the result of that calculation I blend the shadow/ light.
Last edited by Superku; 10/29/1114:47.
"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual