External texture support for texture shaders

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

Moderator: Developers

External texture support for texture shaders

Postby Marisa Kirisame » Thu Feb 22, 2018 7:20 am

We already have this for screen shaders and it's all good, but I've been thinking that this could also get some use on texture shaders. Overlays, distortions, all sorts of stuff.
User avatar
Marisa Kirisame
heh
 
Joined: 08 Feb 2008
Location: Vigo, Galicia
Discord: Marisa Kirisame#4689
Twitch ID: magusmarisa

Re: External texture support for texture shaders

Postby dpJudas » Thu Feb 22, 2018 8:16 am

You will probably not see any improvements in this area until after the materials branch.

User shaders for materials are complicated. The light code needs to cooperate with the output of the shader. For example, if you want to use a brightmap, the shader needs to output both the primary texture color and the emissive color.

The current internal brightmap shader looks like this:

Code: Select allExpand view
vec4 ProcessTexel()
{
   return getTexel(vTexCoord.st);
}

vec4 ProcessLight(vec4 color)
{
   vec4 brightpix = desaturate(texture(texture2, vTexCoord.st));
   return vec4(min (color.rgb + brightpix.rgb, 1.0), color.a);
}

As you can see, there's two outputs. ProcessTexel and ProcessLight. For a material with a normal map and specular there's need for an additional ProcessNormal and ProcessSpecular. For PBR there's ProcessRoughness and ProcessMetallic. All of this needs to be set up in GLDEFS so that GZDoom knows what kind of output is implemented in the shader.

That in turn affects texture binding as each of those needs a place to sample from. Should that always be custom textures for custom shaders? There's a bunch of stuff like this that needs to be thought through. A premature quick fix for the current hardware shaders will only cause cursing down the road.

TL;DR: Don't expect to get this feature for some time. It isn't as simple to add as for the screen shaders.
dpJudas
 
 
 
Joined: 28 May 2016

Re: External texture support for texture shaders

Postby Marisa Kirisame » Thu Feb 22, 2018 5:36 pm

TBH I only wanted these for the diffuse...
User avatar
Marisa Kirisame
heh
 
Joined: 08 Feb 2008
Location: Vigo, Galicia
Discord: Marisa Kirisame#4689
Twitch ID: magusmarisa

Re: External texture support for texture shaders

Postby dpJudas » Thu Feb 22, 2018 5:47 pm

With a reply like that I guess you'll have to file the PR yourself..
dpJudas
 
 
 
Joined: 28 May 2016

Re: External texture support for texture shaders

Postby Marisa Kirisame » Thu Feb 22, 2018 6:09 pm

I'll try to figure out how. I haven't really touched graphics-related gzdoom code yet.

Edit: What have I gotten into...
User avatar
Marisa Kirisame
heh
 
Joined: 08 Feb 2008
Location: Vigo, Galicia
Discord: Marisa Kirisame#4689
Twitch ID: magusmarisa

Re: External texture support for texture shaders

Postby Major Cooke » Thu Jun 14, 2018 9:39 am

This would also be greatly appreciated for models.
User avatar
Major Cooke
Slaughterer of Sewers
 
Joined: 28 Jan 2007
Discord: Major Cooke#0846

Re: External texture support for texture shaders

Postby Graf Zahl » Thu Jun 14, 2018 10:27 am

Not before Vulkan is working.
User avatar
Graf Zahl
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: External texture support for texture shaders

Postby Pixel Eater » Thu Jun 14, 2018 10:31 pm

Dangit! I literally just ran into this problem :tongue:
User avatar
Pixel Eater
In my thoughts I have seen rings of smoke through the trees.
 
 
 
Joined: 02 Aug 2017
Location: In between the Moon and you, between the buried and me.


Return to Feature Suggestions

Who is online

Users browsing this forum: Ahrefs [Bot] and 0 guests