Lean Texture allows you quickly modify textures in your project with a range of filters, pack them together into channels, and much more!
To install this package, first open the Package Manager window, and wait for the package list to finish downloading.
Click the dropdown, and select Unity Registry, so you can see all of Unity's official packages.
Once the list loads, scroll down to find the Burst package, and click Install.
You should now be able to enjoy the full Lean Texture experience!
If you haven't already, make sure you install the Burst package made by Unity. Steps on how to install this are described HERE.
Go to the Project tab, right click on a texture asset, and select the Create / Lean / Texture option.
This will create a new LeanTexture asset alongside your texture. This asset will be pre-configured with your texture.
Click the Add Filter button, and select the kind of filter you want to apply to your texture.
After you add a filter, you can adjust its settings in the inspector.
At the bottom of the inspector you can see a preview of the texture with all the filters you have applied.
Once you're happy with your texture modifications, you can click the Save button. This will save the modified texture to your project alongside the LeanTexture asset, with the same filename.
Go to the Project tab, select multiple texture assets, right click on one of them, and select the Create / Lean / Texture option.
This will create a new LeanTexture asset alongside your textures.
The Lean Texture asset that was created will be pre-configured with your textures based on your selection order, so the first selected texture will be packed into the red channel of the output texture based on that texture's RGB grayscale value, etc.
If you don't like these default settings then feel free to adjust them.
Once you're happy with your texture modifications, you can click the Save button. This will save the packed texture to your project alongside the LeanTexture asset, with the same filename.
If you cannot access this code, then you must:
You can read Unity's documentation about this feature HERE.
All Lean Texture code is inside the Lean.Texture namespace.
To reduce the amount of typing, you can add a using statement to the top of your source file.
using Lean.Texture
Begin by creating a new LeanTexture instance, and store it in a variable.
// Create LeanTexture instance
var leanTexture = new LeanTexture();
Next, specify how the texture should begin. All availible classes will start with the LeanCreate___ name.
// Begin with texture
var createTexture = leanTexture.BeginWith<LeanCreateTexture>();
createTexture.Texture = SourceTexture;
Next, add a filter. All availible classes will start with the LeanFilter___ name.
// Then Modify Brightness
var filterBrightness = leanTexture.Then<LeanFilterBrightness>();
filterBrightness.Multiplier = 2.0f;
Finally, you can generate the texture based on these settings.
// Generate texture
var generatedTexture = leanTexture.Generate();
// NOTE: You must manually destroy this texture once you've finished using it
The steps described above allow you to generate a texture from C# immediately. This means the code will pause until the texture generated has completed.
This is fine for mose scenarios, but if you have a high resolution texture with many filters, it can cause lag or stuttering.
To eliminate this, you can spread the texture generation over multiple frames. To do this, instead of calling the leanTexture.Generate() method, you can call the leanTexture.TrySchedule() method.
Instead of returning a texture, this will give you a LeanPendingTexture instance.
You can store this instance somewhere, and then up to 3 frames later you can call its .Complete() method to get the generated texture.
Here's a list of all my other assets, please check them out!
You can also view this list on my Asset Store page.
Rapidly develop your game with consistent input across desktop & mobile using Lean Touch. This lightweight asset comes with many modular components, allowing you to customize them to your exact project needs!
Lean Touch+ is an extension to the popular Lean Touch asset, adding many more example scenes.
Lean Localization is a localization library that's designed to be as simple to use as possible for both designers, and programmers.
Quickly optimize the performance of your games using Lean Pool. Within minutes you can use this lightweight asset to preload, recycle, and limit the spawning of your prefabs.
Quickly polish your games using Lean Transition. This asset allows you to easily tween or animate almost anything in your game, making it transition smoothly.
Lean GUI is a colllection of components that extend Unity's GUI system, allowing you to rapidly enhance the user experience (UX) of your game's UI.
Lean GUI Shapes allows you to quickly add lines, rounded boxes, polygons, and much more to your GUI!
Lean Texture allows you quickly modify textures in your project with a range of filters, pack them together into channels, and much more!
Lean Texture+ is an extension to Lean Texture, adding many new types of texture modification tools!
Unlock a universe of visual possibilities with Modular Backgrounds. Simply drag and drop these graphics into the background of your scenes.
Paint all your objects using Paint in 3D - both in game, and in editor. All features are optimized with GPU accelerated texture painting, so you can enjoy consistent performance, even if you paint your objects one million times!
Paint all your sprites with Paint in 2D. With incredible performance on mobile, WebGL, and much more!
Paint in Editor unlocks the ability to paint objects in your scene - great for making small tweaks, or even creating entirely new texture sets!
FLOW allows you to add large scale interactive fluids to your scene - all highly optimized using GPU acceleration.
Unlock the full potential of your 2D games using Destructible 2D, this asset allows you to quickly convert all your boring solid sprites into fully destructible ones!
Quickly make the space scene of your dreams using Space Graphics Toolkit. This huge collection of space effects can be customized and combined in any way you like, allowing you to quickly make realistic or fantasy worlds. Each feature has been heavily optimized to run on almost any device and platform.
Enhance your space scenes using this large pack of high detail volumetric planets. These planets are finished using the powerful planet features from Space Graphics Toolkit (not required).
Unity sounds only emanate from a single point source. This is great for explosions and footsteps, but quite often you need something more advanced. Volumetric Audio is an easy to use package that allows you to define boxes, spheres, capsules, paths, or meshes that sounds can emanate from.
Changed folder structure to be inside Plugins/CW/LeanTexture.
Updated inspector code to support third party assets that implement nested inspectors.
Fixed in-editor error when loaded texture and source texture have different sizes due to NPOT scaling.
Fixed preview RGB isolation not working for Preset = ColorPlusTransparency.
Fixed preview RGB isolation not working for Preset = LineColorPlusTransparency.
Fixed color shift in linear color space.
Fixed half pixel offset from texture sampling.
Fixed compression settings not being copied to exported texture.
Centered preview texture.
Textures loaded in-editor are now directly loaded from file in an uncompressed form if they're originally .png or .jpg.
This component shows you how to use LeanTexture from code.
The texture that will be modified.
The UI element the modified texture will be displayed using.
This lets you create a texture where all pixels have the same color value.
The size of the created texture.
The color of the created texture.
This lets you create a texture based on a color gradient.
The size of the created texture.
The first color of the gradient.
The second color of the gradient.
The coordinate space of the points, where 0 is the bottom left.
The first point of the gradient.
The second point of the gradient.
This lets you load a texture so you can then modify it with various filters.
The texture that will be used to create the texture.
The size of the created texture.
-1 = Use existing texture size.
This lets you create a texture from up to 4 other textures. A single value is extracted from each of the textures using the channel(s) you specify, and this is stored in each of the final texture's channels.
The texture that will be stored in the Red channel of the created texture.
The channel from the RedTexture that will be stored in the created texture's Red channel.
The texture that will be stored in the Green channel of the created texture.
The channel from the GreenTexture that will be stored in the created texture's Green channel.
The texture that will be stored in the Blue channel of the created texture.
The channel from the BlueTexture that will be stored in the created texture's Blue channel.
The texture that will be stored in the Alpha channel of the created texture.
The channel from the alphaTexture that will be stored in the created texture's alpha channel.
By default the created texture will be given the largest width and largest height of the input textures, but this setting allows you to override this.
-1 = Do not override size.
Enums don't seem to render properly with SerializeReference if they appear after the inspector has opened (at least in 2019.4.12f1), so we use this to work around it.
This allows you to modify the brightness of all pixels in the current texture.
The brightness of all pixels will be multiplied by this value.
This will convert the texture's RGB values into a single grayscale value, and write it to the specified channels.
The strength of the grayscale effect.
0 = No change.
1 = Fully grayscale.
This allows you to specify the channels the grayscale value will be written to.
This allows you to modify the hue of all pixels in the current texture.
The hue of all pixels will be offset by this value.
This allows you to multiply all pixels in the current texture by the specified value, either to all RGBA channels, or individually.
How should the texture channels should be modified?
All channels will be multiplied by this value.
This channel value will be multiplied by this value.
This channel value will be multiplied by this value.
This channel value will be multiplied by this value.
This channel value will be multiplied by this value.
This allows you to modify the saturation of all pixels in the current texture.
The saturation of all pixels will be multiplied by this value.
This allows you to multiply all pixels in the current texture by the specified color.
All pixels in the texture will be multiplied by this color.
This class stores information about a texture that is currently being generated.
This method will convert this pending texture into the final Texture2D, and then clean up & pool itself.
This class can generate a texture based on the specified Create technique, which is then modified by the specified Filters.
The texture can be immediately generated using the Generate method, or it can be generated asynchronously with the TrySchedule method.
This allows you to specify what kind of texture is being generated. This changes the output texture format, preview behavior, and warnings in the filter inspectors.
When generating the texture, some settings like the WrapMode will be copied from the texture you specify here.
If SettingsFrom is set to None/null, then this allows you to specify the wrap mode of the generated texture.
If SettingsFrom is set to None/null, then this allows you to specify the wrap mode of the generated texture.
If SettingsFrom is set to None/null, then this allows you to specify the mip map creation of the generated texture.
The texture will begin with this creation method.
The texture will then be modified by these filters.
Does this texture have horizontal or vertical wrapping?
This method allows you to change how this texture is initially created.
This method allows you to add a filter to the current texture.
This method will immediately perform the specified texture operations and return the modified texture.
This method will try and create a job to modify a texture using the current settings applied to this LeanTexture instance.
How do I make a channel packed texture?
How do I use this from C# code?
How can I stop in-game texture generation from lagging?