External texture support for texture shaders
Moderator: GZDoom Developers
- 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
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.
Re: External texture support for texture shaders
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:
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 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);
}
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.
- 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
TBH I only wanted these for the diffuse...
Re: External texture support for texture shaders
With a reply like that I guess you'll have to file the PR yourself..
- 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
I'll try to figure out how. I haven't really touched graphics-related gzdoom code yet.
Edit: What have I gotten into...
Edit: What have I gotten into...
- 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
This would also be greatly appreciated for models.
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49056
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: External texture support for texture shaders
Not before Vulkan is working.
- 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
Dangit! I literally just ran into this problem
- UsernameAK
- Posts: 83
- Joined: Wed Jul 15, 2015 5:26 am
- Location: Ukraine
- 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
Thanks UsenameAK!
I'll be using this for making alpha maps
I'll be using this for making alpha maps
-
-
- 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
Is this the kind of thing that would make this effect possible in GZDoom? That would be really awesome.
Re: External texture support for texture shaders
It looks like there's progress on this on github. Is this slated for the next version?