Monday, January 3, 2022
Create gradient texture
When first starting with shaders I was intrigued by the something I saw where greyscale values were used to create screenwhipes using a lerp. In our game we had some texture swaps which were instant and I thought it would be a nice idea to use this technique to create some nice animated texture transitions.
Creating this kind of patterns by hand is nearly impossible so I created a tool for that. The setup I landed on was to start with a Photoshop file set up with a background layer and a (shape) layer. Where the background contains the black and white gradient to use for the transition and the shape is shape to be duplicated. The script then samples the background color value based on where the next copy will be, duplicate the shape, assign a fill layer style with the sampled color and move it over.
I also made a variation on this since I wanted to try a more painterly effect. For his to work I created a few paint strokes consisting of multiple shapes (the color of each shape is not important, as long as they are in separate layers)
The user selects all the layers that need to be included (folders are also fine, the script will traverse through them) These will be counted and then, from the top, the layers receive a Solid Fill layer style. This fill color value is based on the amount of layers, as in 255 / amount of layers. I still want to look at 16 bit files to allow for more gradient values, but for now this works fine. Here's the final result in Unity:
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment