20-09-2011, 08:09 PM
(Questo messaggio è stato modificato l'ultima volta il: 20-09-2011, 08:10 PM da Skyline.)
Hello! Over the past few weeks I've been working on a shadow volumes implementation for Unity and would now like to get some feedback on it
Webplayer demo
Use the mouse to move objects around.
Available now in the Unity Asset Store
Please use the poll above to let me know how it ran, thanks!
Features:
Dynamic pixel-perfect shadows using shadow volumes and the alpha channel
Supports all 3 Unity light types
Works with any closed mesh (each edge has exactly 2 triangles)
Works even when the camera is inside the shadow volumes
Works in edit-mode
Requires no scripting
Tested on Unity Free, should work on Unity Pro
Unity iOS/Android may be possible, see below
The toolkit is not...
a complete renderer
a replacement for Unity Pro lighting/shadows
using the patented depth-fail algorithm (The volumes are drawn 4 times instead of 2 to avoid this algorithm; but it is still very fast)
Since Unity does not expose the stencil buffer, I implemented the shadow volumes using the alpha channel of the framebuffer in a similar way to what Aras did quite a while ago. Unlike the algorithm presented in the papers he linked however, my implementation supports up to 255 overlapping shadows, not only 8. Using the alpha channel is not as robust as using the stencil buffer for this purpose, which is why I decided to have a poll. (In the worst case, the underlying drivers/hardware may break the shadows)
The toolkit only requires a framebuffer with an alpha channel so it should work on most Android phones as well as iOS devices, but it seems like Unity does not enable the alpha channel by default. I can't find the option to specify the framebuffer format on Unity Android but according to Jessy's comment this seems to be possible on Unity iOS, which I don't have a license for at the moment. Any information on this is greatly appreciated
I'm currently creating the example scenes and writing the documentation and I plan to release the package on the Unity Asset Store for 20$ in the next couple of days, if it is approved of course.
Autore: http://forum.unity3d.com/threads/102079-...bly-Mobile
Webplayer demo
Use the mouse to move objects around.
Available now in the Unity Asset Store
Please use the poll above to let me know how it ran, thanks!
Features:
Dynamic pixel-perfect shadows using shadow volumes and the alpha channel
Supports all 3 Unity light types
Works with any closed mesh (each edge has exactly 2 triangles)
Works even when the camera is inside the shadow volumes
Works in edit-mode
Requires no scripting
Tested on Unity Free, should work on Unity Pro
Unity iOS/Android may be possible, see below
The toolkit is not...
a complete renderer
a replacement for Unity Pro lighting/shadows
using the patented depth-fail algorithm (The volumes are drawn 4 times instead of 2 to avoid this algorithm; but it is still very fast)
Since Unity does not expose the stencil buffer, I implemented the shadow volumes using the alpha channel of the framebuffer in a similar way to what Aras did quite a while ago. Unlike the algorithm presented in the papers he linked however, my implementation supports up to 255 overlapping shadows, not only 8. Using the alpha channel is not as robust as using the stencil buffer for this purpose, which is why I decided to have a poll. (In the worst case, the underlying drivers/hardware may break the shadows)
The toolkit only requires a framebuffer with an alpha channel so it should work on most Android phones as well as iOS devices, but it seems like Unity does not enable the alpha channel by default. I can't find the option to specify the framebuffer format on Unity Android but according to Jessy's comment this seems to be possible on Unity iOS, which I don't have a license for at the moment. Any information on this is greatly appreciated
I'm currently creating the example scenes and writing the documentation and I plan to release the package on the Unity Asset Store for 20$ in the next couple of days, if it is approved of course.
Autore: http://forum.unity3d.com/threads/102079-...bly-Mobile