ryzom / ryzomcore

Ryzom Core is the open-source project related to the Ryzom game. This community repository is synchronized with the Ryzom Forge repository, based on the Core branch.
https://wiki.ryzom.dev
GNU Affero General Public License v3.0
342 stars 90 forks source link

Add a runtime panoply pixel program #608

Open kaetemi opened 4 years ago

kaetemi commented 4 years ago

To reduce client size, a panoply pixel program can be implemented for colorizing armor at runtime, rather than pre-building textures for all color combinations. Currently we are not constrained by GPU resources, so this does not add any notable overhead. Potato systems may regress and use an option to disable custom colors entirely.

This may allow more colors, multiple colors per piece, and more variants of textures for enhanced customization.

https://developer.nvidia.com/cg-toolkit-download can be used to generate ARB fragment programs and DX9 pixel shaders.

Armors seem to be using only two material setups. Either it's using a regular material with a single texture and optional alpha test and 2-sided flag, or it's using the cubemap reflection shader material.

Panoply generation works by first detecting the hue of the existing image, then setting the hue relative to that. It also applies a contrast and saturation filter. The base hue, etc, may need to be set as custom metadata of the DDS files.

kaetemi commented 4 years ago

Up to 4 color channels, using one color mask texture with a mask in each channel.

kaetemi commented 4 years ago

KTX allows metadata to go with the texture for this https://github.com/ryzom/ryzomcore/issues/610

kaetemi commented 4 years ago

Possible to include the predefined palettes per texture as well in the metadata, to simplify configuration.

kervala commented 3 years ago

I remember testing that in 2018 :) It worked fine but only with a little sample program, I have no idea what resources it needs for Ryzom :(

For armors, I used 3 textures : base color texture + skin mask + user mask (armor)

MultiTexture.zip MultiTextureGLES2.zip