• Register
Post news Report RSS ..by popular demand, dynamic hard shadows!

After the feedback from some of the RPC fans here and around the web about how they were disappointed that the new hard shadows were no longer dynamic, I decided to rearrange my coding priorities and put dynamic hard shadows on the top of the list!

Posted by on

After the feedback from some of the RPC fans here and around the web about how they were disappointed that the new hard shadows were no longer dynamic, I decided to rearrange my coding priorities and put dynamic hard shadows on the top of the list!

..so, by popular demand, I bring you; dynamic soft shadows!

Thanks for the input! I'm really happy with the results. :)

Go shadows go!


Shadow angles at various times of day.

Dynamic shadows demo. Dynamic shadows demo.

Dynamic shadows demo.

Post comment Comments
doppl3r
doppl3r - - 196 comments

This looks excellent!

Reply Good karma Bad karma+3 votes
Rayvolution Author
Rayvolution - - 13 comments

They look a lot better in the game too, it's hard to capture the full effect in a short gif. :)

Reply Good karma+3 votes
ManuelCP
ManuelCP - - 1 comments

:D

Reply Good karma Bad karma+3 votes
Alitron
Alitron - - 42 comments

Are the shadows generated during runtime and on point?

Reply Good karma Bad karma+1 vote
Rayvolution Author
Rayvolution - - 13 comments

What I did was made a grayscale heightmap of the object I want to cast a shadow, then internal to the shadow .class/code I have a shadow builder that reads the map and splits up the various parts of the shadow (based on color on the grayscale) into separate images (kinda like slices of the building).

Then, I took those images and rendered them to a FBO, and re-rendered it out by +- a fraction of a number (float), for as many times as that slice required in whatever direction they were being told to go. For example, if slice 10 was rendering, it would render itself 10 times each time moving out in whatever direction it was told to based on the time of day. Where as slice 5 would only "move out" 5 times. Slice 15, 15 times, and so forth. So what happens is the higher number slices (or the slices generated from the brighter colors on the height map) would push out longer distances.

You would think doing it this way would be slow, since there are much faster methods for generating shadows (Like raycasting for example). But, because the resolution of these shadows are very low, I can take the performance hit to obtain extremely accurate shadows and the game still runs at a solid 60FPS on most machines.

Here's a link to the Lumber Mill's heightmap if you're curious:
Sixtygig.com

Reply Good karma+1 vote
Post a comment

Your comment will be anonymous unless you join the community. Or sign in with your social account: