Dynamic lighting

HI … first of all i want to thank the creators of cocos2d-x and the forum members for making such and awesome framework and strong community.

i am looking for a tutorial to dynamic lighting in cocos2d-x. I am new to cocos2d-x and shaders. Is this possible without shaders at all? I found a cocos2d iphone version of the source but i dont understand shaders all that well so got confused as hell :).

The link shows dynamic lighting in action made by someone in cocos2d-x (http://www.youtube.com/watch?v=TMWQSQQQMCk ). I am asking for the source code but there is no reply.

Can someone pls be kind enough to share a link to the tutorial? or atleast the c++ source? thanks.

Why don’t you want to use shaders? I’ve implemented this technique quick’n’dirty in cocos2d-x: https://github.com/mattdesl/lwjgl-basics/wiki/2D-Pixel-Perfect-Shadows

On desktop machines the performance is quite ok, but on mobile devices it isn’t very fast cause the shaders are rather complex and multiple render passes are required. I’m sure it’s possible to optimize it however.

I’ve just created a git repo with the source I came up with: https://github.com/JochenHeizmann/dynLight

oh wow thanks… but how do you run the project?? Sry xcode noon here. :slight_smile:

Also I found this cocos2d port alternate technique, that works fine on ios devices but has been unsuccessful ( He says that it doesnt work for him but someone else in the post says that it worked if you changed the shaders folders. But it doesnt work either way for me ). He provides link to both his project and the cocos2d (http://www.cocos2d-x.org/forums/6/topics/14402).

I haven’t included a working project. When you add the “DynamicLight”-source files to your project and put the shaders into your resources folders you should be able to use the class to create DynamicLight-Nodes.

I just tried the example you provided on my ipad3. It’s looks very nice and I will definitely have a deeper look into the source later on - but it’s also very slow :slight_smile:

BTW: The only thing I had to fix to compile it was to remove a shell script that wasn’t available from the “Build Phases” and select my personal provisioning profile in XCode.

ya the cocos2d version works fine after removing the shell script… it was the X version that is not working… i mean it builds and everything but the shader code doesnt work? … any ideas ???