by emprosthotonos » Wed Jul 03, 2019 12:31 am
Hello all, this is my first post here.
I'm trying to procedurally render an actor's sprite (color would depend on the player's actions), and I tried to define a Sprite shader and define a uniform so I can set the value in my actor's code every tick, but I noticed it wasn't working and the API was a little weird for that. I thought I had to define one shader per frame of my sprite so I could use the shader's name depending on the current actor's frame, but obviously that didn't work so I took a look at the source code and noticed that uniforms only get parsed when it's a PostProcess shader.
I know a little bit about graphics programming and know that there's probably some batching involved when rendering the actors, so adding the possibility of defining uniforms per-actor could be very difficult or drastically reduce rendering performance. But I just need to confirm if it isn't possible at all atm, and is there some plans to do this in the foreseeable future? For my specific use-case I could work with setting the uniforms 1 time per frame but NOT per actor, I think that would be simpler to add, right?
Also, now that I'm thinking... I think I could work with a post-process shader but I would need to calculate the screen position of the actor, and I didn't see any projection/view matrix listed on the uniforms in the GLDEFS wiki page.
Anyways, if any of you had to do this at some point and came up with a work-around please tell me, thanks!
(Sorry if my english is bad)

Hello all, this is my first post here.
I'm trying to procedurally render an actor's sprite (color would depend on the player's actions), and I tried to define a Sprite shader and define a uniform so I can set the value in my actor's code every tick, but I noticed it wasn't working and the API was a little weird for that. I thought I had to define one shader per frame of my sprite so I could use the shader's name depending on the current actor's frame, but obviously that didn't work so I took a look at the source code and noticed that uniforms only get parsed when it's a PostProcess shader.
I know a little bit about graphics programming and know that there's probably some batching involved when rendering the actors, so adding the possibility of defining uniforms per-actor could be very difficult or drastically reduce rendering performance. But I just need to confirm if it isn't possible at all atm, and is there some plans to do this in the foreseeable future? For my specific use-case I could work with setting the uniforms 1 time per frame but NOT per actor, I think that would be simpler to add, right?
Also, now that I'm thinking... I think I could work with a post-process shader but I would need to calculate the screen position of the actor, and I didn't see any projection/view matrix listed on the uniforms in the GLDEFS wiki page.
Anyways, if any of you had to do this at some point and came up with a work-around please tell me, thanks! :D
(Sorry if my english is bad) :?