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: 3804
Joined: Fri Feb 08, 2008 9:15 am
Discord: Marisa the Magician#1666
Twitch ID: MarisaDOOM
Github ID: OrdinaryMagician
Preferred Pronouns: She/Her
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: 3804
Joined: Fri Feb 08, 2008 9:15 am
Discord: Marisa the Magician#1666
Twitch ID: MarisaDOOM
Github ID: OrdinaryMagician
Preferred Pronouns: She/Her
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: 12911
Joined: Tue Jan 13, 2004 1:31 pm
Discord: Rachael#3767
Twitch ID: madamerachelle
Github ID: madame-rachelle
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: 3804
Joined: Fri Feb 08, 2008 9:15 am
Discord: Marisa the Magician#1666
Twitch ID: MarisaDOOM
Github ID: OrdinaryMagician
Preferred Pronouns: She/Her
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”