lördag 21 september 2013

Hello again!

Ugh, being sick blows! Still, I updated the line of sight to semi transparent occlusion instead of it being black.
Peep this!

Basically what I do is fetch all the wall sides that are facing the player (which is a simple since it's a grid based world). Then, for each edge I create vertices that extrude from the edge away from the player.



These vertices are then combined into one mesh. This mesh is rendered with a shader that only writes to the stencil buffer. I create another mesh that spans the viewport extents with a shader that only renders where the stencil check passes.

Now you might wonder why I don't just render the shadow mesh at once since I already have that geometry. The problem is that since the mesh consists of triangles that might overlap the alpha blending would render certain parts darker than others.

Now I only need to hide the enemies that are out of sight somehow :)

Inga kommentarer:

Skicka en kommentar