[code] 2D soft shadows using pixel shaders

Forums Programming cocos2d support (graphics engine) [code] 2D soft shadows using pixel shaders

This topic contains 3 replies, has 4 voices, and was last updated by  joshuawilde 7 months, 2 weeks ago.

Viewing 4 posts - 1 through 4 (of 4 total)
Author Posts
Author Posts
December 24, 2011 at 6:44 pm #237970

eVillain
Participant
@evillain

Since Cocos2D 2.0 supports shaders I decided I’d try and port Catalin Zima’s method for 2d shadows from here:

http://www.catalinzima.com/2010/07/my-technique-for-the-shader-based-dynamic-2d-shadows/

I’ve gotten a working version but the current implementation is certainly not very effective (I’m getting ~27FPS on iPad2 with one 512x512px light).

If anyone is interested, the source is available here:

http://lanceofdeath.com/Temp/GameLighting_src.zip

So in effect I’m going back and forth between two CCRenderTextures for each light to apply each shader pass which isn’t fast but it works.

Is there a better way? If anyone can think of optimizations I’d appreciate any suggestions.

Merry holidays to everyone,

-eVillain

January 20, 2012 at 10:17 am #360201

accatyyc
Participant
@accatyyc

Hello! I find this very interesting because I’ve been looking for a solution to the shadow problem. Was hoping that someone had tried implementing that guide with cocos2d. Shame that noone else has commented on this :)

Anyway, I don’t know alot about shaders, but I will try your version and see if I can make any optimizations. In the meantime I hope you keep working on this and see what you can come up with yourself!

April 7, 2012 at 9:49 am #360202

Baca6u
Participant
@baca6u

Well this is great! I’ll try it on iPad 2! And try to optimize it for my game needs too. Thanks!

September 5, 2013 at 4:52 pm #410164

joshuawilde
Participant
@joshuawilde

anyone still have the source code for this?

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.