I know this doesnt do realtime shadows, but how does it work for the game engine, does it make the shadow and you can save iit on a plane for use as a static shadow? If so how does it work, i opened it up and saw the mesh he had and clicked on it but i didnt get a window that had the “go” button on it like he mentioned on his forum post. Please help.
It casts a “static” shadow and you can just use that in the game engine as a Stencil Shadow.
I am this can be done in the game engine, but a mesh would need to be converted to pure triangles. Just use the code Doc use to calculate the position of each point on a flat floor.
Reason it needs to be a triangle is becuase its easy to use .getVertex(0,i) since each face in the object will just be 3 vertices…
for i in range(0,Number of faces*3):
#Get the vertex position
#Get the light postion
#Get distance and theta I am guessing
Umm, stencil shadows are something entirely different, and currently not possible in blender (except maybe 2.23 or earlier if you are a masochist)
z3r0 d it is posttible to get stencil shadows in blender but far slow… Also its Doc’s code is just calculating how stencil shadows work.
I wrote this Script to to get a approximately Imagination how the Shadow of an Object will be look like. I don’t use the Result-Mesh in a Game! (But it should work. Even with Quads.) I only use the Shape of it to integrate it to the Floor-Object and insert new Faces. After that i can texture and color it with Vertex-Paint. So i get a nice transparency FX of the final Shadow. There is some handwork necessary after projection!
(If You really need Tri’s, You can try CTRL+T in Edit-Mode)
Hey Doc I gather you can’t map the shadow to anything other than a flat plane right? Any plans to allow mapping of the shadow to the shape of another object in a future release? This would be really useful as I don’t use flat ground planes.
Yes, i know. That would be great. But this is much more complicated. I’m not so good with this math Stuff and i’m glad because it works now. But maybe i know sometime how, i try it, sure.
there are a few c++ codes for what your looking for but would need to cache all of the vertices of the landscape and that takes a bit of calculating right there… If you really want you could drop each face to the ground and have it as a parted mesh so each face is an object then just have each object have the shadow face property
At the Moment, i have some other Projects in progress and You have to see what You can do with the current Version. Sorry.
But i made a little Demo-File. It contains some Scenes which shows two Possibilities for modifying and using such Shadow-Meshes in Games. (VertexPaint & AlphaTexture) If someone have Interest, it can be found here:
Wow with a bit of work there could be a lot of possiblilties with this little script, alteast more then I thought