Define uniforms in non-postprocess shaders

Remember, just because you request it, that doesn't mean you'll get it.

Moderator: GZDoom Developers

Define uniforms in non-postprocess shaders

Postby emprosthotonos » Wed Jul 03, 2019 1: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! :D

(Sorry if my english is bad) :?
emprosthotonos
 
Joined: 03 Jul 2019
Github ID: glhrmfrts

Re: Define uniforms in non-postprocess shaders

Postby dpJudas » Wed Jul 03, 2019 4:55 am

There is currently no support for this, although it has been requested by several people. There is also no official way to request the active projection or view matrices (there may be several if portals are involved, or if VR is active).

Nobody is actively working on adding uniforms to the texture shaders. It isn't so easy because they may be used for walls, planes, actors and 2D. How to design where the inputs for the uniforms comes from is a bigger part of the problem than how to upload it.
dpJudas
 
 
 
Joined: 28 May 2016


Return to Feature Suggestions

Who is online

Users browsing this forum: No registered users and 2 guests