Creating spotlight shader in Cocos2d-x 3.0

Hi!

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.

Instead of going through the code line by line here, I will publish all the examples to Github with comments. Example of light shader can be found here:
https://github.com/joni-mikkola/cocos2d-x-tutorials

light

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

  1. 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.

    phrk

    Reply
    • 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.

      Reply

Leave a Comment