Creating spotlight shader in Cocos2d-x 3.0

I’ve been working on a game project with Cocos2d-x 3.0. From time to time as I’m searching for documentation I can’t find any clear examples of how thing x works. So for now I decided to write simple samples/tutorials for such topics. The first one will be creating light shader for a dark scene.

10 thoughts on “Creating spotlight shader in Cocos2d-x 3.0”

Hey! Thanks for the Code, but I think it is much more helpful to have a full tutorial on that. I wanted to create a spotlight in my game, which always is centred on the player. I can’t get it to work. For once the position is off and the shader doesn’t darken the screen – it makes it yellow. I think I don’t fully understand the code. It would be really could if you consider creating a full tutorial.

Hi! thanks for the feedback. At first I thought about writing a full tutorial on this, but then I was lazy and just tried to comment the code enough. I will consider writing more lengthy tutorial in future.

Hard to say what’s wrong with your code from the description. If you could share it somehow I could take a look.