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
« On Unity 5.0's new deferred renderer | Main | Unity Shader Gotcha #9 - Reserved Samplers »
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. 

PrintView Printer Friendly Version

EmailEmail Article to Friend

Reader Comments (1)

FYI, in Unity 5.0 we'll be improving this somewhat:

1) you'll be able to do "on/off" features by using just one shader keyword (instead of two, like commonly done now)
2) the limit will be upped to 128
June 21, 2014 | Unregistered CommenterAras Pranckevicius

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
All HTML will be escaped. Hyperlinks will be created for URLs automatically.