Ability to tweak texture wrapping in gldefs

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

Moderator: GZDoom Developers

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

Ability to tweak texture wrapping in gldefs

Post by Marisa the Magician »

As an option for both material definitions and additional textures within.

This is important for some shaders where, for example, textures are expected to either wrap or clamp. To give one example, equirectangular maps for environment textures, which are expected to wrap horizontally, but clamp vertically. As of now, I'm kind of "working around" this by having those textures be padded vertically and adjusting the math to compensate, but this is less than desirable since it makes the textures larger, and also unusable in other programs such as Blender.

I'm currently trying to do this myself, but if anyone more experienced with the rendering side is willing to tackle it instead, I'd be grateful.
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

Re: Ability to tweak texture wrapping in gldefs

Post by Marisa the Magician »

Update: I managed to hack together something semi-functional but my method is really ugly and doesn't work for external textures in hardware shaders. I think I'd rather leave this in the hands of those who Know Their Shit™.
User avatar
Rachael
Admin
Posts: 13254
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her

Re: Ability to tweak texture wrapping in gldefs

Post by Rachael »

If you hook (read: rename) the sampler functions themselves in your shaders it should be possible to emulate any possible combination of clamping and wrapping in any direction, even doing more complex things like clamping after a single repeat or things like that if you wanted to. I don't think this is ugly and I don't think there is anything wrong with this method - but I'd love to be corrected if this is an undesirable way to do things in 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

Re: Ability to tweak texture wrapping in gldefs

Post by Marisa the Magician »

I'm not sure that would really work. We're talking about the default, native texture*() functions.

Edit: Time to go on a very lengthy time-consuming web search on how to emulate clamping in glsl without seams...

Edit 2: ... So turns out I should have actually paid attention in high school math class because I know jack shit about calculus.

Return to “Feature Suggestions [GZDoom]”