About Me

Hi. I'm Josh Ols. Lead Graphics Developer for RUST LTD.


View Joshua Ols's profile on LinkedIn


Entries in Alloy (9)


Alloy 3.1 - Asset Store Madness

It's that time again! The Unity Asset Store is having another madness sale. For this week only, you can pick up Alloy 3.1 half off at just $62.50! If you've been hesitating due to price, now's the time to jump in and grab it! XD

Alloy - Unity Asset Store


TeamColor refinements 


Not long ago, I realized that Alloy's Team Color formulation was grossly inflexible and not super intuitive. The primary reason being that if you had more than one color mask overlapping a given pixel, the top one would dominate. This presented a problem if you wanted to mix multiple colors and precisely control their contributions to the final combined color.

It looked a little something like this:

half3 tint = lerp(half3(1,1,1), aTint, masks.a);
tint = lerp(tint, rTint, masks.r);
tint = lerp(tint, gTint, masks.g);
baseColor *= lerp(tint, bTint, masks.b);


As you can see, it was layer order-dependent and made it basically impossible to have all the colors influence one fragment in a clean way. The only problem it really solved was avoiding black zones between masked colors by ensuring that the starting color was white.


New Approach

I needed something that would still prevent the black zone problem, but also allow easy blending between all the masked colors covering a given pixel. Plus, when the total weight of the masks is above 1, it needs to renormalize all the mask weights so that they total 1. Finally, when the total weight is below 1, it needs to add the color white by the remaining weight. 

So I switched to something more like this:

half weight = dot(masks, half4(1,1,1,1));
masks /= max(1, weight);
baseColor *= rTint * masks.r 
            + gTint * masks.g 
            + bTint * masks.b 
            + aTint * masks.a 
            + (1 - min(1, weight)).rrr;


This new approach does everything I need without being overly complex and/or costly.


Alloy 3 is up on the asset store!

After months and months of work it is finally here! See the Unity forum thread for details:

Alloy - Unity Asset Store


Unity Shader Gotcha #11 - World Normals

So it turns out that Unity's WorldNormalVector() and WorldReflectionVector() macros only return world-space vectors for the shader's generated forward base pass, and not its forward add pass. So say you wanted to try to do some sort of direct lighting trick that relies on world space normals, it would work for the directional light in the forward base pass, but then fail for lights in the forward add pass. 

As a result of this limitation, and the fact that Unity seems to have abandoned surface shaders for their new Standard shader, we at RUST LTD are officially abandoning surface shaders for Alloy development. Going forward, we will be using our own framework built on top of raw vertex, fragment, geometry, etc shaders. This is more complex to maintain and develop, but gives us maximum control to add and optimize new features. 


Alloy 2.1 Released

Asset Store link

Version 2.1

- Added support for Parallax & Parallax Occlusion Mapping modes in "\Core" and "\Transparent\Cutout" shaders.
- Added a TeamColor detail mode to the standard shaders.
- Added archviz-friendly UV1AO2 shader variants.
- Dissolve 
* Added variants to all the standard shaders so it is easier to apply the effect to common materials.
* Changed the Cutoff parameter to use [0,1], rather than [0,1.01].
- Skin 
* Moved to "Skin" folder.
* Generalized to support other shader features (Decal, Detail, Rim, etc)
* Added custom material editor support.
- Modified “Self-Illumin/Glow” and “Self-Illumin/Glow Cutout” to use the custom editor.
- Added support for Skyshop 1.07 and up.
* Box projection is now accessed through skyshop's sky manager UI.
* Added support for sky blending.
* PLEASE NOTE: Alloy will no longer work with older versions of Skyshop due to changes in how they do their calculations.
- Changed the custom editor parameter names and order to improve readability.
- Fixed an issue where the misnamed Decal material map parameter prevented it from showing up in our custom editor.
- Fixed an issue where we weren’t gamma-correcting the transition glow intensity in the Transition shaders.
- Restored support for low-quality vertex lighting mode.

PackedTextures (ie. "_AlloyPM" and "_AlloyDM")
- Added support for setting the Wrap Mode on packed textures.
* Still defaults to "Repeat".
- Added support for setting packed textures to "Automatic TrueColor" format.
* Best to keep it on "Automatic Compressed" unless compression artifacts are harming visuals.
- Added support for setting max size on packed textures.
* Capped to not exceed texture's dimensions.
- Fixed issue where user could accidentally set the packed textures to an invalid format.

NOTE: It is also possible to set the Aniso level, in case you didn't know.

Substance Designer
- SD4.1 shader fix so it no longer manually gamma-corrects the environment map. 

Bug Fixes
- Fixed an issue where our custom material inspector's tab and texture name text was hard to read in Light Skin mode.
- Minor cleanup in our RSRM Generator and Material Map Packer to make them more readable using Light Skin.

The following shaders and paths are to be removed after this release:
"Assets/Alloy/Core/Skin Bumped"