The Better Lit Shader : Replacement Lit Shader for URP/HDRP/Standard

The Better Lit Shader acts as a replacement for the Built in pipeline’s Standard shader and URP/HDRP Lit shaders with the following features and improvements:

  • Supports URP, HDRP, and the Built In rendering pipelines, tested on 2019.4LTS and 2020.3LTS
  • HDRP style texture packing, or a custom tightly packed texture format for even faster shading
  • Tessellation & Parallax Support
  • Crack Free Tessellation mesh preprocessor
  • Stochastic sampling of textures to remove tiling
  • Tint Masking, allowing you to colorize 4 separate parts of the main texture layer independently.
  • HDRP Style Detail Texturing
  • Three additional independent Texture Layers, which can be used as a detail texturing, height blended, or alpha blended, with independent options for Triplanar and Stochastic on each layer. These can also be masked via vertex painting, noise functions, and procedural functions, allowing you to create many different effects.
  • MicroShadows and Fuzzy Shading available on every layer
  • Use UV, UV1, Triplanar, or world projections on each texture layer
  • Flat Shading
  • Single or Double Sided
  • Wetness, automatically integrates with Enviro and Weather Maker
  • Puddles, automatically integrates with Enviro and Weather Maker
  • Automatic placement of puddles via noise functions and angle filters
  • Snow system, automatically integrates with Enviro and Weather Maker
  • Wind system, for particulate wind over surfaces
  • Dissolve Effect, with optional gradient edge w/ optional emissive
  • Trax integration allows you to leave trails on any material you create
  • Vegetation Studio procedural indirect support
  • Support for all VR rendering modes
  • Generate normals directly in the shader to save sampling/memory on low end systems, or use the Surface Gradient framework for higher quality blending.
  • Branch Sampling, to reduce the cost of stochastic and triplanar sampling
  • Debuging mode to visualize actual sample count used by the shader
  • LOD Dither fading
  • Custom Material Interface
  • Bakery Support

Online Documentation

The Better Lit Shader was built using Better Shaders and is tested on URP7.x, URP10.x, HDRP7.x, HDRP10.x, and the Built in Rendering pipeline. No special install is required, just a single shader that runs on all of these different rendering systems.
Full source code in Better Shaders format is included, and all features are done as stackables, making them easy to add to your own shaders, or customize for your own needs.

All features work together and are available via an custom material GUI. Unused features are conditionally compiled out of the shader, and many features are available to make the shader more efficient than the URP Lit or Built In Standard shader.

Working in URP and want HDRP style features? Or want a more efficient URP shader? Want to port between pipelines and have everything “just work”? Want to apply unique procedural damage across your entire level? Want the most advanced shader available, regardless of which rendering pipeline you use? This is the shader for you.

9 Likes

Such a very awesome asset. I had the pleasure of being in the beta and toy around. The ideas keep on spreading once you start using the asset. Can’t wait to see what everyone else comes up with. By the way, most notably: This was HDRP, works the same in Standard and URP.

Here’s eg the dragon on a road mesh:

This is one of the screenshots I took ingame:


So Trax working on mesh is super exciting.

You can also just simply overlay the texture with another to get e. g. Dirt on the Pavement. Top is original, bottom is with a stacked texture:

Or just add other textures with noise in world space to make every house unique, here’s an example with weathering effect:

1 Like

What’s also exciting is that you can define the strength of the effects. I tried with my own Fader asset to interpolate the strength over time, worked perfectly:

Don’t mind the missing obligatory splatter :smile: I just wanted to show the effect :wink:

The indoor puddles are exciting. Of course I had water first, but usually one thing leads to another and I wanted to toy around with a different category of game I’ve never done before :smile:


2 Likes

I just toyed around with the layer blending. It’s really nice how easily you can change the look with it:

3 Likes

will it support SRP Batching ?
what is the minimum SM needed for it

Been toying around with snow. While doing so I thought why not abuse it to give desert bricks some sandy look at the sides and on the top:


I should add terrain blending as well with microsplat

5 Likes

Yes, though there is a Unity bug in SRP which prevents it with two variants of the shader - repro’d by Unity. Minimum is 3.0.

Been experimenting. I gave Irval a Tattoo :smile:


Works also as War Paint :smile:

If you do that, keep in mind to set the tattoo texture’s own Wrap Mode to Clamp, so that it doesn’t tile.

2 Likes

Does blending work with Better Lit Shader? Would love to see a test for this

What exactly do you mean? The fading video above is sliding through the blend strengths of the layers

We just started testing this out for a major upcoming project (Pigeon Simulator) and seems really awesome so far!

Curious about a couple of things:

  • Any plans to add Texture Array support?
  • We’re using GPU Instancer extensively. Currently we’re using some colors and float value arrays with it to vary the looks of things within a draw. Moreover, we’re using a uint structured buffer (“Variation Values” in GPU Instancer) to reference which texture in a texture array gets used. This is all pretty niche stuff, but any chance we can do this with your product?

Thank you for your time, and for building this shader magic!

You’d need to modify the source and recompile it with Better Shaders. Shouldn’t be harder than changing a surface shader to do the same thing.

1 Like

Hi there!

Unity 2020.3.5f1 - Built-in render pipeline - Latest version of Better Lit Shader (1.07)

I get the following error message whenever I select or create a material using Better Lit Shader:

NullReferenceException: Object reference not set to an instance of an object
UnityEditor.MaterialEditor.TexturePropertyWithHDRColor (UnityEngine.GUIContent label, UnityEditor.MaterialProperty textureProp, UnityEditor.MaterialProperty colorProperty, System.Boolean showAlpha) (at <411aa9fd83b6416fab626ca292954771>:0)
JBooth.BetterLit.LitBaseStub.OnLitGUI (UnityEditor.MaterialEditor materialEditor, UnityEditor.MaterialProperty[ ] props) (at Assets/BetterLitShader/Scripts/Editor/EditorStub.cs:1552)
JBooth.BetterLit.LitBaseMaterialEditor.OnGUI (UnityEditor.MaterialEditor materialEditor, UnityEditor.MaterialProperty[ ] props) (at Assets/BetterLitShader/Scripts/Editor/LitBaseMaterialEditor.cs:47)
UnityEditor.MaterialEditor.PropertiesGUI () (at <411aa9fd83b6416fab626ca292954771>:0)
UnityEditor.MaterialEditor.OnInspectorGUI () (at <411aa9fd83b6416fab626ca292954771>:0)
UnityEditor.UIElements.InspectorElement+<>c__DisplayClass59_0.b__0 () (at <0fdaf67e8e744beea25e77915c19f81b>:0)
UnityEngine.GUIUtility: ProcessEvent(Int32, IntPtr, Boolean&)

Also, the Inspector is blank, so I can’t use the shader at all.

I was able to reproduce this bug in a brand new project.

I pushed a patch to this last night- hopefully it’ll appear on the store today. You can also PM me your invoice number if you need it sooner.

1 Like

Hi!

  1. Do micro shadows depend on the volume override and are used for the directional light only or is this your own implementation?

  2. Do you have any plans to support Virtual Textures?

  3. How often do you plan to update this asset? Will it be compatible with LTS only releases, or can we hope for other stable or even beta versions support?

  4. Do you have any plans to integrate Bakery features into it?

Thanks!

It’s based on naughty dog’s technique, for the directional light only.

Not currently.

I will only officially support LTS releases, because doing anything else means you’re effectively Unity’s indentured servant, chasing after undocumented and unfinished changes on a constant basis with no help from Unity.

Yes.

2 Likes

Thanks for the reply! A couple more questions if you don’t mind.

Because they are experimental or its hard to implement this feature anyway?

Do you think new versions will likely break your asset? From your experience. Have you tested it in the resent non LTS versions?

Any ETA on this?

Thanks!

Haven’t really looked at it yet as it’s quite new in Unity.

I can’t control what Unity breaks. In the past, they’ve broken things in LTS versions and between point releases (7.18 to 7.21 in URP for instance), which isn’t supposed to happen. In general, the SRPs are pretty unstable, though I’d say the trend is that they break things less these days than they used to. While many people run non-LTS versions, I don’t even look at them, since Unity can’t really be bothered to document their pipeline any change requires diffing tens of thousands of lines of code.

I don’t give ETAs…

2 Likes

Too bad, though understandable. Your shader looks perfect, and I would gladly replace a lot of shaders in my project with it, except I can’t, because they heavily depend on the Bakery SH + Specular feature. I’ve also planned to update them to use SVT, but haven’t tried it yet as well.

I couldn’t be bothered to convert 10 materials of a humanoid manually, so I took Unity’s HDRP converter and made a BetterLitShader converter mod of it which at its current state converts selected or all project materials from HDRP/Lit to Better Lit/Lit.

Please note the Unity Companion License in case you want to use it:

3 Likes