GithubHelp home page GithubHelp logo

orels1 / orels-unity-shaders Goto Github PK

View Code? Open in Web Editor NEW
161.0 5.0 12.0 63.98 MB

A collection of practical Unity shaders for your next project

Home Page: https://shaders.orels.sh

License: Other

C# 25.03% ShaderLab 31.51% CSS 0.32% HTML 1.62% JavaScript 0.79% HLSL 40.72%
unity shaders cg hlsl amplify vrchat

orels-unity-shaders's Introduction

๐Ÿ“œ A collection of Unity Shaders and tools to make them ๐Ÿ“œ

Built with โค๏ธŽ by orels1 and contributors

For any Unity project - Download Here

You should grab the top .unitypackage file from the latest release. It contains all the shaders and tools. It should be named like

sh.orels.shaders-full-X.X.X.unitypackage

For VCC users

Add this repo listing to your VCC

https://orels1.github.io/orels-Unity-Shaders/index.json

Afterwards - add ORL Shaders package to your project

More instructions

There are more in-depth instructions and explanations on the docs!

Having issues? Hop by the discord

Demo World

s

Check out the demo world which uses these shaders! It showcases most of the features and has some presets to play with.

orels-unity-shaders's People

Contributors

absolutestratos avatar orels1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

orels-unity-shaders's Issues

Add custom shader combiner

Currently, if someone needs a special combination of modules - i need to make a custom one.

There should be an option to combine them yourself

One piece of this could include a %CombinePriority(<int>) tag which allows you to enforce an order of module. Or maybe a list of modules it should precede, not sure.
Could also just leave it up to the user, so they can figure out what works

Add missing variable types

Currently, the shader generator will complain about an unknown variable type, which atm includes

  • bool
  • 2x2, 3x3, and 4x4 matrices of any type

These should be natively supported and not generate errors

Add `%SetProp()` drawer function

There is often a need to set some property based on the value of another property. A common example: adjusting blend settings based on the desired blending mode or setting stencil refs in a user-friendly way (like for outlines).

The signature should look like this

%SetProp((<shader condition>), <prop name>, <value if true>, <value if false>);

Example:

// properties

[Toggle(OUTLINE_ENABLED)]_OutlineEnabled("Enable Outline", Int) = 0
UI_SetStencilOp("Stencil Op Settier %SetProp((OUTLINE_ENABLED), _StencilOp, 2, 0)", Int) = 0
[HideInInspector]_StencilOp("Stencil Op", Float) = 0

// below in the pass

Stencil
{
  Ref 69
  Comp Always
  Pass [_StencilOp]
}

// below in the CGPROGRAM

float _StencilOp;

This will set the Stencil Pass op (via the _StencilOp property) to 2 (Replace) if the OUTLINE_ENABLED keyword is set, or to 0 (Keep) if the keyword is not set

Add Support for Bakery Volumes [ORL-53]

Bakery has a feature called "Volumes", which are essentially baked 3d textures that can be sampled instead of lightmaps.

While you can already use Light Probe Proxy Volumes with ORL Shaders for a similar effect, the Bakery Volume technique doesn;t require placing any extra probes and is generally a bit more flexible and higher quality


Automatically created from Linear (#53)

via LinearSync

.

.

Add LOD Cross Fade support to the Cutout shader

Unity enables shaders to smoothen the transition between LOD meshes (and during culling) and a good balanced approach is to do it with a cutout shader and dithering.

You just have to make the CutoutFragment() look something like this

sampler2D unity_DitherMask;

void CutoutFragment() {

	float2 vpos = d.screenPos.xy / d.screenPos.w * _ScreenParams.xy;

	vpos /= 4; // the dither mask texture is 4x4
	float mask = tex2D(unity_DitherMask, vpos).a;
	float sgn = unity_LODFade.x > 0 ? 1.0f : -1.0f;
	clip(unity_LODFade.x - mask * sgn);

	#if !defined(_NATIVE_A2C)
	if (o.Alpha < _Cutoff)  {
		clip(-1);
	}
	#endif
}

Code is taken from https://github.com/keijiro/CrossFadingLod and UnityCG.cginc

Add Fake Interior Shader

Fake Interior shaders are a very common approach for creating detail in repetitive buildings, making cityscapes much more interesting.

An interesting approach could be to also add support for double-relief mapping, like in the Matrix Awakening Demo.

One of the requirements for this would also be to add some sort of Baking utility so people can easily create their own layouts

  • Add a basic Interior Mapping Shader
  • Add Support for custom surface normals for adding water droplets or glass surface patterns to add a refraction effect
  • Add support for double-relief mapping
  • Add a baking tool to easily make new fake interior cubemaps and relief textures

Add Puddles Shader

Add a shader for Puddles emulation

  • Should have multiple modes for puddles display
    • Height Map based (only works with parallax)
    • Texture mask based
    • Vertex Color based
  • Should have a mask
  • Should support any mapping space (including biplanar local/world mapping)
  • Mask should have triplanar support
  • Should have simple raindrop support

Add 2-Pass Transparency Toon shader

2-Pass Transparency is very common in avatar shaders, since you often need to have something like semi-transparent hair together with outlines and other things.

Non-convex meshes are ill-suited for regular transparency as they will encounter sorting issues. Adding a separate pass that renders backfaces only allows you to separate the two and create a stable mesh that can act both as a transparent and an opaque object without issue

Add Texture Mask support for Neon Light

The current neon light shader works pretty well for standard neon lights

But for cases where the base mesh contains more than just neon - it is useful to be able to mask the areas where neon light is applied via a texture

Test Linear 2 [ORL-47]

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Create a material with X shader
  2. Enable Y setting
  3. Observe Z bug

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Environment:

  • OS: [e.g. Windows]
  • Unity Version: [e.g. 2019.4/2021]
  • Shaders Version: [e.g. 6.0/6.1]
  • Rendering Pipeline: [e.g. Built-In/URP]

Additional context
Add any other context about the problem here.

Utility Shaders Collection

I should add a couple of general utility shaders

  • Video Emission Shader w/ USharpVideo support (similar to merlin's but using both VFX and PBR cores)
  • Distance fade shader (both near and far)
  • Hide in mirror/camera
  • Pulse animation mode for scale vertex anim

UI Shaders Collection

I should add some UI-focused utility shaders, including:

  • Overlay Shader (for HUDs)
  • Scrolling UV shader
  • Parallax Shader
  • Dot product sheen shader (similar to VRC menu)
  • AudioLink shader

All shaders should support an HDR glow property and expose ZTest

Add Patterns Shader

Add a VFX patterns shader that can be used for background movement effects

[ORL-63] Toon shader outlines w/o stencil

The current toon shader uses stencils to achieve its stencil effects. This effect has benefits when dealing with transparency. But it's sometimes less effective at rendering concave outlines or outlines that intersect with the mesh.

I'd appreciate being able to choose between stencil-based outlines and "traditional" outlines.

Here's a comparison between orels's toon shader and Poyomi.

orels vs poyomi

Here's an example of outlines not being rendered in certain conditions:

outlines

From SyncLinear.com | ORL-63

AmbientCG Material Library

This is a little obscure, but here's the gist

I want to be able to provide an easy way to browse one of the best free PBR material libraries there is.

In the current vision, this includes

  • A simple "Open AmbientCG Library" button you can add to any of the shader properties to make it visible somewhere
  • A way to define the texture names and channels the source textures should map to
  • A cache implementation
  • A way to select the shader you want to use (maybe auto-map foliage to cutout, etc)

Currently it can browse, download and set up the ORL Standard materials but its not the best User Experience just yet

  • Add a popup window to browse the material library
  • Add Search with pagination
  • Add an ability to download materials
  • Add caching support
  • Map materials directly to ORL Standard
  • Show materials already in local library
  • Add support for selecting the type of shader used (regular, transparent, cutout, etc)
  • Clean up UI

Seperate image slots for roughness and occlusion

I'd really love to use your shaders, its really awesome but there's no separate slots for roughness/smoothness and occlusion. I'm using Autodesk Interactive for all my materials which don't include more than albedo, roughness, normal and occlusion maps.

I recently unpacked a lot of my textures from glTF's orm format to separate maps because it's easier to work with, though it would really suck if I had to manually make maps like that again. I don't know if it's possible to make a compile step to automatically optimize occlusion, roughness and metallic or more together.

Thanks!
Maki

Add material migrator

Currently there is a way to migrate from old ORL Shaders to new ORL Shaders

I should add a way to migrate from Standard to ORL easily.

I could use the same logic, but it is currently a bit too aggressive. Preferably it should allow you to:

  • Migrate the whole project
  • Migrate all materials in the current scene
  • Migrate manually selected materials
  • Detect Standard blending mode (opaque, cutout, transparent) to map to correct shaders

Add some sort of emission masking support to the Layered parallax Shader

Currently, each layer of the Layered Parallax shader can only glow as a single unit

It would be nice to be able to make only specific parts of the texture glow, instead of everything glowing together.

One idea could be - adding a texture slot where each channel can be used as an emission mask. and then adding an Enum to each layer that allows you to pick a channel from that mask and set an extra emission color as an option

Add UVDiscard support to Toon Shader

UV Tile-Based discard is a common way to toggle props and items of clothing in shaders cheaply. It allows you to have a single mesh with many separate pieces, mix and match them, without needing to split them into separate gameobjects, materials or use blend shapes

This implementation supports 10 items per material

Add support for per-texture tiling options in the toon shader

When working with detailed Toon materials - it is often desirable to be able to control the tiling of each texture individually.

This allows you to have a simple base texture, base occlusion and base normal, with detail drive specular, normal, and occlusion applied on top.

An example of such material would be a knitted sweater, where the underlying base color, occlusion, and normal can describe the overall parameters that follow the shape of the model, while the rest are heavily tiled texture with the knitted wool pattern

This should be implemented via a "Synced with Albedo" and "Independent" tiling modes

UV-Space noise support for Laser Shader [ORL-59]

Laser shader currently only supports Local and World space.

While that works for most cases, it doesnt work well for Line Renderers. As those generate meshes in runtime by adjusting their vertex positions. This causes the noise to constantly move on the surface of the laser, which might be undesireable.

A solution to this is to use UV space for Line Renderers. As they are, by definition, 2D - the 3rd dimension doesn't matter and UVs can be used without any downsides.


Automatically created from Linear (#59)

via LinearSync

Add support for Template Features

Sometimes there is a need to include a whole Template section per-shader conditionally.

E.g. a special pass for a shader that needs it.

While it can be done with PrePasses and PostPasses that is very limited as it doesn't utilize the actual template logic (although maybe it should!

A solution to this could be created in a form of Template Features.

E.g. you add a block to the template that looks something like this

%TemplateFeature("MyFeature")
{
  // some feature code
}

%TemplateFeature("MyOtherFeature")
{
  // some feature code
}

And then in the shader code you simply add

TemplateFeatures("MyFeature", "MyOtherFeature")

And that automatically includes those scoped blocks in the main template before it gets processed.

An example of this used in practice is a conditional Depth PrePass for shaders that need it

Duplicate variable declarations should not generate warnings

There is often a reason to declare the same variable in multiple modules to avoid them being undefined when modules aren't used together.

Currently, that generates a "skipped duplicate variable" warning on every recompile - which is distracting and undesirable.

While an argument can be made that special support for GLOBAL variables should be added for cross-module stuff, i think it makes sense to generally allow this to happen without warnings, and have a flag somewhere to enable debug-level compilation logs that would throw those warnings into the console.

Add tooltips to the texture pack channels, for newbies.

Describe what are you aiming to achieve
I think it would be useful for the channel colors to have very short tooltips defining their default intended use for newbies who are new to texture packing.

Describe any workarounds you can use now
Going back to the documentation to make sure I'm remembering correctly.

Any other comments or context/references
I know you might intend for people to learn this stuff fast. But I think this is a good accessibility/learning feature that (seems) simple to implement. And you already take great care in designing the UIs and documentation for your software.

I do notice that you don't appear to have tooltips anywhere in the shader UI. Is this intentional? This feature request is only about channel packing because terms like "Red" are ambiguous without context clues on the surface without domain knowledge. (I mean that in a loose sense.)

I also notice that you take the space to describe GSAA - Almost as to push people into using it. (I agree that it is an important feature all good modern "Standard" shaders should implement as an option.) I think having that without at least some basic tooltips elsewhere is an interesting choice.

Thanks for taking the time to consider this!

Improve behavior on Bakery MonoSH Clears [ORL-51]

When Using Bakery's MonoSH - the SH map gets cleared on assembly reload
This causes the shaders to become fully black, which looks bad and can make someone think that things are broken.

I should check if this can be made more stable


Automatically created from Linear (#51)

via LinearSync

Fix outlines UI mask conflict

Current stencil implementation conflicts with the Unity UI masking stencils, which makes masked objects always visible on top of opaque Toon materials. This is undesirable.

The fix works in the following way:

  • The Outline pass should write Zero for both Pass and ZFail, this means that the outline pass fully overwrites the base pass stencil value, restoring it to how it should be
  • When the outline isn't used at all - the base pass should not write any stencil ref to avoid collisions with Unity UI. This can be done with the new SetProp DrawerFunction

Implementation of the SetProp: #29

Game Shaders (VFX) Collection

I should add some shaders that can aid game world creation:

  • Shield shader
  • Laser shader
  • Dissolve shader
  • Pulse shader (like hit effect pulse)
  • Parallax holo shader
  • Ghost pattern shader (from Ghostwire torii gate)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.