🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Convert texture to different format

Started by
3 comments, last by Alberth 3 years, 1 month ago

Anyone have a clue how to convert the outdated and pretty much no longer supported l6u5v5 textures to something usable? has to be on the fly as they are not accessible to pre-convert… they are old bumpenv normal maps mostly r(u)/g(v) data and l on b all 0-255 range …. was thinking R5G6B5

Advertisement

Just like any conversion. Get or build code that can read (parse) the input and extract the relevant information into some data structure. Then write or get code that can construct the output format from the relevant information.

If the input and output structures match quite closely, you may be able to perform parsing as well as building output simultaneously. However having the intermediate form in-between decouples both conversions better. In addition, you can (pre-)process the intermediate form before converting it to the output for better results.

getting pretty close to what I need, however, ran into an issue of one channel being just wrong… like the histogram is inverted(valley becomes peak, peak becomes valley type deal)

def f(value, smallest, biggest):
    return smallest + biggest - value

convert value from a range from smallest to biggest, inclusive

>>> f(1, 0, 3)
2
>>> f(0, 0, 3)
3
>>> f(3, 0, 3)
0
>>> f(3, 1, 4)
2
>>> f(4, 1, 4)
1
>>> f(1, 1, 4)
4

This topic is closed to new replies.

Advertisement