SamuKata
vrengames
vrengames

patreon


Dynamic Clothing Colour in LR2

During my last prototyping week I looked at a very interesting library for Ren'py that let me run shaders on images. A "Shader" is basically a simple program designed to be run on a GPU. There were a number of different effects I showed off to patrons, and tonight I've implemented the first and most immediately useful of them: dynamically coloured clothing.

Prior to today, all of the clothing items in Lab Rats 2 were rendered as you seem them in Daz Studio. That meant that if I wanted the same tshirt in red, blue, and green I needed to spend three times as much time rendering it and three times as much space storing it. The alternative to this, which I've finished implementing tonight, is storing a single grey scale render of the clothing item and having a shader modify the colour of each pixel of the image so that it is the correct colour when drawn to the screen. Creating a different coloured version of a clothing item is now as simple as defining a red, green, blue, and transparency value for it.

Here's a quick example of the results, recolouring the white tanktop currently in the game:

This approach will work with any solid colour clothing item. Items with patterns or multi-coloured sections will require a separate mask image to let the shader know which sections it should colour and which it should leave alone (or colour a different colour!).

Changing over to this new shader based display code will have other benefits, but I'll save talking about those for another night!

Comments

@james steele Not really the issue.

Bingbong

now you won't need different colored girls! GJ

james steele

White and yellow is quite popular these days.

Fat Turbo


More Creators