So from the normal map gideros example, I changed the picture with a normalmapped version of my project main sprite. And I was very impressed by the change!
I started to imagine the lights produced by lasers and missile exhausts changing in real time the appearance of all the ships on the battlefield, and I was "Woooow!... that would just give my game such a high professional touch!"
So much wow that I started to worry about 2 things:
- performance : would a phone be able to withstand about 50 moving ships and 50 moving lights?
- time to learn : I know nothing about shaders. How difficult it is to learn? I know how to create a normal map file. But that's it. What I need to learn especially is how to place/move the lights. How hard is that?
Also I didn't try it, but do we still need power of 2 sized textures?
Comments
I like the look of your game.
Playing around, I understood how to make new lights, change their color and place them (or so I think).
I'll give the normal map version a try.
I need to check on the power of 2 requirement because it is messing big time with my actual sprites and the ones I wanted to implement next.
Likes: MoKaLux
https://wiki.giderosmobile.com/index.php/Profiling
https://play.google.com/store/apps/developer?id=razorback456
мій блог по гідерос https://simartinfo.blogspot.com
Слава Україні!
However, continuing to play with the above example, it seems that a given mesh cannot get more than 1 shader, which is a problem in my current scenario. It seems to be a shader issue regardless of the type of engine. Am I correct?
Likes: oleg
I in the game 'sokoban' used lamps on boxes, there is 1 lamp but many boxes - everything works perfectly.
https://play.google.com/store/apps/details?id=info.simart.sokoban2018
You don't need to make many lamps, you can make many objects with individual lamps
In another game I tested that there were 6 lamps in the scene that affect all objects - on weak devices such a scene will not work ..
https://play.google.com/store/apps/developer?id=razorback456
мій блог по гідерос https://simartinfo.blogspot.com
Слава Україні!
Likes: MoKaLux
I am sorry, I have other questions!
1) Why the alpha does not show a blank background and shows instead this gray surface? How to make it work as intended?
I played a little bit with the colors and in fact the "alpha" takes the color of the shader (see below with the red shader)
2) I changed the code to move light position with the mouse. It seems to behave like the sprite stayed at 0,0 despite it being at the middle of the stage. How do I make the shader take in account the position of the sprite?
3) The orientation of the light/shadows seems off. But it may be because of the automatic generation of the normal map file. (after more verifications, it seems the X is correct but the Y seems inverted)
Here are the shader codes (almost identical to the original files from the gideros example)
vs.glsl
2 and 3) because in the fragment shader the position of the sprite is in normalized device coordinates (they have been transformed in the vertex shader), while your light position wasn’t.
http://forum.giderosmobile.com/discussion/7988/gl-fragcolor-alpha-issue