Solarus-Games English Forum

Solarus => Development => Topic started by: wizard_wizzle (aka ZeldaHistorian) on August 27, 2015, 11:57:20 PM

Title: Shaders?
Post by: wizard_wizzle (aka ZeldaHistorian) on August 27, 2015, 11:57:20 PM
Is there any information about what's currently available in the engine concerning shaders? I believe there was an experimental implementation, but I'm not sure if it was ever completed/tested/documented? If I can help in any way, I'm happy to do so!

I need to implement more advanced lighting in my game, and I'm getting to the point where I can't put it off much longer and need to come up with something. I would require multiple light points in an otherwise dark room, and thought shaders would be the only way to manage this. If anyone knows of another way, I would love to hear ideas! :)
Title: Re: Shaders?
Post by: polyglot762 on August 28, 2015, 02:30:01 PM
I am looking forwards to seeing the feedback. I have some need of this also.
Title: Re: Shaders?
Post by: Christopho on August 28, 2015, 03:23:28 PM
Here is the issue tracking advancement on shaders: https://github.com/christopho/solarus/issues/394
Title: Re: Shaders?
Post by: Diarandor on September 22, 2015, 04:51:43 PM
I have another idea to use multiple light points, only using Lua. But it could slow down a bit the game (and it will be much worse than using a shader). We could script this in one Lua file, doing as follows:

First, we create a main transparent surface, with the size of the screen/window. Then, for each pixel of the screen, we can create a surface of 1x1 pixels size and draw it in the main surface. We can use a list as a matrix to store all the "pixel surfaces". The rest of the code would be some functions to modify the transparence on each pixel surface (to make it more or less transparent, also modify the color, etc). This would allow to have torches iluminating some parts of dark rooms, and also to have several lights which are moving. This is just the overall idea.

Anyway, as I say, maybe this would be a bit of brute force that could slow down the game (too many surfaces?), although I'm not sure of this.
Title: Re: Shaders?
Post by: Christopho on September 22, 2015, 05:38:06 PM
320 * 240 = 76800 surfaces, this would be terribly slow.
There will be a function set_pixel one day to modify a surface, for example to make a pixel transparent.
Title: Re: Shaders?
Post by: Diarandor on September 22, 2015, 06:20:31 PM
I was so curious that I tried the brute force idea. Only creating the surfaces makes the game impossible to play (terribly slow, no game is possible, as we thought), and drawing the pixel-surfaces just makes it even worse...  :'(

No hope until Christopho allows pixel modification in the engine.