External texture support for texture shaders

Moderator: GZDoom Developers

Post Reply
User avatar
Marisa the Magician
Posts: 3886
Joined: Fri Feb 08, 2008 9:15 am
Preferred Pronouns: She/Her
Operating System Version (Optional): (btw I use) Arch
Graphics Processor: nVidia with Vulkan support
Location: Vigo, Galicia
Contact:

External texture support for texture shaders

Post by Marisa the Magician »

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.
dpJudas
 
 
Posts: 3037
Joined: Sat May 28, 2016 1:01 pm

Re: External texture support for texture shaders

Post by dpJudas »

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 all

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.
User avatar
Marisa the Magician
Posts: 3886
Joined: Fri Feb 08, 2008 9:15 am
Preferred Pronouns: She/Her
Operating System Version (Optional): (btw I use) Arch
Graphics Processor: nVidia with Vulkan support
Location: Vigo, Galicia
Contact:

Re: External texture support for texture shaders

Post by Marisa the Magician »

TBH I only wanted these for the diffuse...
dpJudas
 
 
Posts: 3037
Joined: Sat May 28, 2016 1:01 pm

Re: External texture support for texture shaders

Post by dpJudas »

With a reply like that I guess you'll have to file the PR yourself..
User avatar
Marisa the Magician
Posts: 3886
Joined: Fri Feb 08, 2008 9:15 am
Preferred Pronouns: She/Her
Operating System Version (Optional): (btw I use) Arch
Graphics Processor: nVidia with Vulkan support
Location: Vigo, Galicia
Contact:

Re: External texture support for texture shaders

Post by Marisa the Magician »

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
Major Cooke
Posts: 8170
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: External texture support for texture shaders

Post by Major Cooke »

This would also be greatly appreciated for models.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49056
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: External texture support for texture shaders

Post by Graf Zahl »

Not before Vulkan is working.
User avatar
Pixel Eater
 
 
Posts: 667
Joined: Wed Aug 02, 2017 12:31 am
Location: In between the Moon and you, between the buried and me.

Re: External texture support for texture shaders

Post by Pixel Eater »

Dangit! I literally just ran into this problem :tongue:
User avatar
UsernameAK
Posts: 83
Joined: Wed Jul 15, 2015 5:26 am
Location: Ukraine

Re: External texture support for texture shaders

Post by UsernameAK »

User avatar
Pixel Eater
 
 
Posts: 667
Joined: Wed Aug 02, 2017 12:31 am
Location: In between the Moon and you, between the buried and me.

Re: External texture support for texture shaders

Post by Pixel Eater »

Thanks UsenameAK!

I'll be using this for making alpha maps :)
Talon1024
 
 
Posts: 374
Joined: Mon Jun 27, 2016 7:26 pm
Preferred Pronouns: He/Him
Graphics Processor: nVidia with Vulkan support
Contact:

Re: External texture support for texture shaders

Post by Talon1024 »

Is this the kind of thing that would make this effect possible in GZDoom? That would be really awesome.
Diode
Posts: 53
Joined: Mon Feb 29, 2016 2:34 pm

Re: External texture support for texture shaders

Post by Diode »

It looks like there's progress on this on github. Is this slated for the next version?
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49056
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: External texture support for texture shaders

Post by Graf Zahl »

Yes.
Post Reply

Return to “Closed Feature Suggestions [GZDoom]”