About Me

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

Contact:
crunchy.bytes.blog[at]gmail[dot]com

View Joshua Ols's profile on LinkedIn

Meta

Entries in Unity3D (29)

Saturday
Oct112014

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. 

Tuesday
Aug262014

Unity Shader Gotcha #10 - Exclude PrePass

So with surface shaders, sometimes you need to make a forward-only shader for odd lighting models (skin, hair, eyes, etc) and blending modes (premultiplied alpha, additive, etc). In these cases you need to remember to use the attribute "exclude_path:prepass". If you forget, though it might look fine on the PC, it will have broken visuals on MacOSX when used in deferred mode. We've also found that it will get weird results when used with third-party frameworks like Candela SSRR in deferred mode.

Bottom line, for all custom forward-only shaders ALWAYS include the attribute "exclude_path:prepass" in your surface definition pragma!

Wednesday
Aug062014

Alloy 2.1 Released

Asset Store link

Version 2.1

=====================
Shaders
- 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.

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

Friday
Jul042014

On Unity 5.0's new deferred renderer

Among the many things coming in Unity 5.0, I am most excited about the new fat g-buffer deferred renderer. However, some things will need to fall into place for me to take full advantage of its power:

  1. It must allow me to override the lighting shaders, like I can now.
  2. It must let me, at a minimum, store a single low precision custom channel in the g-buffer so I can pass specular occlusion to the lighting shaders.

If I can't pass specular occlusion, then I won't be able to support proper per-light fresnel. Granted, even if I don't have that it will still be an improvement over our current situation because I can finally have properly colored specular highlights. Still, I hope that Unity, or more specifically Aras, is listening to this plea and can work something out. ;)

Friday
Jun202014

On Unity and Shader combinations

UPDATE

My discussion on the topic on the Unity forums. Found a few useful tidbits out from Aras, and thought I should share:

64 Keyword Limit questions

 

ORIGINAL

So yeah, I discovered today that Unity has a 64 unique keyword limit for all shaders in a given project. What this means is that Unity's ever so useful "#pragma multi_compile" directive is no longer a viable option for managing thousands of shader combinations because I will always hit this limit more often than I'd like. So I am forced to manually generate shader combinations that get selected from the shader menu rather than using dropdowns and checkboxes from the material UI. >_<

As a result of this, I am investigating a way to generate all these shader combinations via script. Ideally, I can make a bunch of reusable fragments, then generate all the combinations I need with the push of a button. Updating them will be a synch, as I will only need to update the fragment and the wizard will overwrite all the shaders (no more clumsy Replace in Files). Though it has a high initial cost, as I need to figure out what all this script will need to do.