Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/yadurajiv/Ray-Casting-Soft-Shadows

ray casting and soft shadow example written in ActionScript
https://github.com/yadurajiv/Ray-Casting-Soft-Shadows

Last synced: about 2 months ago
JSON representation

ray casting and soft shadow example written in ActionScript

Awesome Lists containing this project

README

        

This is a ray casting and soft shadow example written in ActionScript.

As seen here - https://dl.dropbox.com/u/1526334/yrdcExtra/rayCastingSoftShadows/index.html

2D Raycasting and Soft shadows - realtime in flash. I had to make a small framework and a way to create some basic primitives, then moved on to the ray casting bit, and then to shadows.

The (inner/outer)Penumbra is not really rendered as explained in the document, It was drawn initially, but didn't look so great. Instead the shadows were blurred using flash filters. The blend modes (colour blending modes) take more cpu than the actual casting.

Reference: http://www.gamedev.net/page/resources/_/technical/graphics-programming-and-theory/dynamic-2d-soft-shadows-r2032

[Getting it up and running in windows]
Get Flex 4.1
Get Flash Develop
Open rayCastingSoftShadows.as3proj and you are set to go

[Command line using mxmlc]
Get Flex 4.1

Make sure that JAVA_HOME variable is set to where Java/jre is - (note: win7 64bit might have java64bit in it's path, make sure to use Flex 64bit or point the JAVA_HOME to 32bit jre folder in Progarm Files(x86))

to compile, run mxmlc from the command line inside the Folder

For Debug
mxmlc -optimize=true -output bin/rayCastingSoftShadows.swf -static-link-runtime-shared-libraries=true --target-player=10.0.0 -compiler.debug=true src/Main.as

For Release
mxmlc -optimize=true -output bin/rayCastingSoftShadows.swf -static-link-runtime-shared-libraries=true --target-player=10.0.0 -compiler.debug=false src/Main.as

Note: running mxmlc on fcsh(the flash shell which comes with Flex) is much faster if you have to repeatedly compile your code. The same command above will work inside fcsh

[Javascript Port]

You can find a js port of the same by @is__real here - http://www.is-real.net/experiments/canvas/soft-shadows/