diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ec4efdb --- /dev/null +++ b/.gitignore @@ -0,0 +1,110 @@ +# This .gitignore file should be placed at the root of your Unity project directory +# +# Get latest from https://github.com/github/gitignore/blob/master/Unity.gitignore +# +/[Ll]ibrary/ +/[Tt]emp/ +/[Oo]bj/ +/[Bb]uild/ +/[Bb]uilds/ +/[Ll]ogs/ +/[Uu]ser[Ss]ettings/ + +# MemoryCaptures can get excessive in size. +# They also could contain extremely sensitive data +/[Mm]emoryCaptures/ + +# Asset meta data should only be ignored when the corresponding asset is also ignored +!/[Aa]ssets/**/*.meta + +# Uncomment this line if you wish to ignore the asset store tools plugin +# /[Aa]ssets/AssetStoreTools* + +# Autogenerated Jetbrains Rider plugin +/[Aa]ssets/Plugins/Editor/JetBrains* + +# Visual Studio cache directory +.vs/ + +# Gradle cache directory +.gradle/ + +# Autogenerated VS/MD/Consulo solution and project files +ExportedObj/ +.consulo/ +*.csproj +*.unityproj +*.sln +*.suo +*.tmp +*.user +*.userprefs +*.pidb +*.booproj +*.svd +*.pdb +*.mdb +*.opendb +*.VC.db + +# Unity3D generated meta files +*.pidb.meta +*.pdb.meta +*.mdb.meta + +# Unity3D generated file on crash reports +sysinfo.txt + +# Builds +*.apk +*.aab + +# Crashlytics generated file +crashlytics-build.properties + +# Packed Addressables +/[Aa]ssets/[Aa]ddressable[Aa]ssets[Dd]ata/*/*.bin* + +# Temporary auto-generated Android Assets +/[Aa]ssets/[Ss]treamingAssets/aa.meta +/[Aa]ssets/[Ss]treamingAssets/aa/* + +# I like Rider +/.idea/ + +# Built asset bundles +AssetBundles/ + +# Imported Bundles +ImportedBundles/ + +# MeatKit stuffs +/[Aa]ssets/MeatKit/Managed/DinoFracture.* +/[Aa]ssets/MeatKit/Managed/ES2.* +/[Aa]ssets/MeatKit/Managed/H3VRCode* +/[Aa]ssets/MeatKit/Managed/Atlas.* +/[Aa]ssets/MeatKit/Managed/OtherLoader.* +/[Aa]ssets/MeatKit/Managed/ReadOnlyCollectionsInterfaces.* +/[Aa]ssets/MeatKit/Managed/Stratum.* + +# No Bakery 4 U +/[Aa]ssets/Bakery/ +/[Aa]ssets/Bakery.meta +/[Aa]ssets/Editor/x64/ +/[Aa]ssets/Editor/x64.meta +/[Aa]ssets/BakeryLightmaps/ +/[Aa]ssets/BakeryLightmaps.meta + +# Ignore Samples +Assets/Samples/ + +# Ignore any imported build items +/[Aa]ssets/MeatKit/Editor/BuildPipeline/BuildItems/*.cs +/[Aa]ssets/MeatKit/Editor/BuildPipeline/BuildItems/*.meta +!/[Aa]ssets/MeatKit/Editor/BuildPipeline/BuildItems/PreloadAssetsBuildItem.* +!/[Aa]ssets/MeatKit/Editor/BuildPipeline/BuildItems/StoreFilesBuildItem.* +/[Aa]ssets/MeatKit/Editor/BuildPipeline/OtherLoaderBuildRootEditor.* +/[Aa]ssets/MeatKit/Editor/BuildPipeline/SpawnerEntryEditor.* + +# Cache +/meatkit.json diff --git a/Assets/Alloy.meta b/Assets/Alloy.meta new file mode 100644 index 0000000..b3da03a --- /dev/null +++ b/Assets/Alloy.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 075bd207fd4deb94fa10d7d24d7df7b0 +folderAsset: yes +timeCreated: 1628644346 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/.gitignore b/Assets/Alloy/.gitignore new file mode 100644 index 0000000..e5d2f30 --- /dev/null +++ b/Assets/Alloy/.gitignore @@ -0,0 +1,48 @@ +# ===================================== # +# Visual Studio / Monodevelop generated # +# ===================================== # +/[Ll]ibrary/ +/[Tt]emp/ +/[Oo]bj/ +/[Bb]uild/ +/[Bb]uilds/ +/Assets/AssetStoreTools* + +# Visual Studio 2015 cache directory +/.vs/ + +# Autogenerated VS/MD/Consulo solution and project files +ExportedObj/ +.consulo/ +*.csproj +*.unityproj +*.sln +*.suo +*.tmp +*.user +*.userprefs +*.pidb +*.booproj +*.svd +*.pdb + +# Unity3D generated meta files +*.pidb.meta + +# Unity3D Generated File On Crash Reports +sysinfo.txt + +# Builds +*.apk +*.unitypackage + +# ============ # +# OS generated # +# ============ # +.DS_Store +.DS_Store? +._* +.Spotlight-V100 +.Trashes +ehthumbs.db +Thumbs.db diff --git a/Assets/Alloy/CHANGELOG.md b/Assets/Alloy/CHANGELOG.md new file mode 100644 index 0000000..9ef0799 --- /dev/null +++ b/Assets/Alloy/CHANGELOG.md @@ -0,0 +1,960 @@ +# Changelog + +## 3.6.4 +### Scripts +* Fixed issue where Unity static Area Lights' scene GUIs were not appearing after installing Alloy. +* Fixed intermittent object reference error for Material Inspector. + +### Integration +* Added HX Volumetric Lighting integration for most particle shaders. + + Excludes "Multiply (Double)" and "Alpha Blended Premultiply". + +## 3.6.3 +### Scripts +* Fixed issue where AreaLights needed to update after all other light updates and animation clips had run. + +## 3.6.2 +### Shaders +* Added new config option A_USE_BLACK_SPECULAR_COLOR_TOGGLE to allow killing specular lighting per-pixel. + + Useful for RTP integration. +* Changed "Decal/Multiplicative" and "Decal/Ambient" to add missing alpha visualize option on Main Textures Base Color map. +* Completed internal API overhaul. +* Fixed metallic channel not correctly affecting translucent shadows. +* Fixed baked occlusion shadows in injection header shaders. +* Fixed lightmap shadow mixing support. + +### Scripts +* Changed Camera inspector to now provide an easy button for adding Alloy Effects Manager components. +* Fixed AreaLight issue where using script to set intensity to zero could cause light to blow out in intensity. +* Removed the "Material Migrator" menu item. + +### Integration +* Improved HX Volumetric Lighting integration with "Decal/Additive" shader. + +## 3.6.1 +### Shaders + + Fixed the compiler errors that happened when using new shadow masks mode. + + Fixed issue where baked light occlusion was not being applied to first directional light in forward mode. + + Fixed the issue where the first directional light wasn't rendering in forward mode with lightmaps enabled. + +### Scripts + + Fixed issue with packer on first import where it could not detect "_PackerDefinition.asset". + +## 3.6.0 +### Shaders +* Added Unity 5.6 support. +* Added "Particles/Anim Alpha Blended" shader. +* Changed "Details*" shaders to have proper Alloy inspectors. +* Changed most shaders to have new controls: + + "Render Queue" for sort order. + + "Enable Instancing" toggle. + + "Specular Highlights" toggle. + + "Glossy Reflections" toggle. +* Changed RenderingModes to work correctly with shader replacement. + + "Cutout" tagged as "TransparentCutout". + + "Fade" tagged as "Transparent". + + "Transparent" tagged as "Transparent". +* Changed SpeedTree GeometryTypes to work correctly with shader replacement. + + "Frond" tagged as "TransparentCutout". + + "Leaf" tagged as "TransparentCutout". +* Fixed CarPaint shaders to have "SpecularTint" property. + +### Scripts +* Changed Area Light component menu path to "Alloy/Alloy Area Light". +* Changed Area Lights to work with Unity's light inspectors, including the new "Light Explorer". + + Now uses Unity Light component's color and intensity directly. + + You'll need to manually update your scripts and animation clips to point to the Unity light fields. +* Removed "Animated By Clip" option from AreaLight components. + + Now works with animation clips and third party script tools out of the box. + + You'll need to manually delete references to it from your animation clips. +* Renamed "Alloy Deferred Renderer Plus" component to "Alloy Effects Manager" to clarify its usage. + + Now listed under "Alloy/Alloy Effects Manager" in the component menu. + + Please write down your old settings before doing the update as you may need to re-enter them. + + You may only need to toggle the component to restore its command buffers. + +### Integration +* Added support for "VertExmotion". +* Updated Substance Designer shader to 6.0. + + UV scale support. +* Updated Substance Painter shader to 2.5. + + Specular Level channel support. + + Parallax Mapping support. + +## 3.5.2 +### Shaders +* Changed deferred Skin and Transmission to work with single-pass stereo VR rendering. +* Fixed issues with deferred Transmission code that would fail to compile on some platforms. + +### Integration +* Added support for "Vapor" transparency integration. + +## 3.5.1 +### Shaders +* Fixed "Tessellation *" shaders target 4.6 warning messages. +* Fixed "Glass *" shaders to support Unity 5.5. + + Includes single-pass stereographic fix. + +## 3.5.0 +### Shaders +* Added Unity 5.5 suppport. +* Fixed shadow wind animations on SpeedTree and foliage shaders. +* Fixed "Transmission/TwoSided" shaders' compiler error when they are set to Fade or Transparent mode. +* Optimized the deferred Skin and Transmission effects. + + Added new config flag A_USE_DEFERRED_MATERIAL_TYPE_BRANCHING to toggle optimizations. + +### Known Issues +* Glass shader distortion is much weaker than expected. + +## 3.4.5 +### Shaders +* Added Unity terrain foliage shaders. + + Automatically applied when using Alloy "Terrain *" shaders. +* Changed "Skin" shaders so that the base color now affects transmission correctly. +* Changed most shaders so that LOD crossfade is disabled by default. + + Fixes the batching issue. +* Fixed area light specular highlight distortion in "Forward" Rendering Path. +* Fixed "Glass *" shaders' issue where a zero opacity would cause black voids in reflection probes. +* Fixed SpeedTree Two-Sided lighting. +* Fixed SpeedTree Geometry Type "Fronds" to show "Opacity Cutoff" control. + +### Features +* Changed "Main Properties", "Secondary Properties", & "Oriented Properties" to add a "Specular Tint" parameter. +* Changed "Specular Tint" to be available in Roughness Source "Packed Map Alpha" mode as well. +* Fixed "Detail" and "Wetness" Mask Strength parameters to only affect the mask. +* Fixed "Rim Emission" faceting for Normals Source "Vertex Normals". + +### Injection Headers +* Changed to be more consistent with the Unity version. +* Fixed issue where opacity was darkening materials in deferred mode. + +### Mods +* Added "Core CrossFade" shader with LOD CrossFade support. +* Added "Skin VertexDetail" shaders with vertex color masking for 3-4 detail normal maps. +* Fixed "Curvature Test" shader. + +### Integration +* Updated "Alloy Deferred Shading UBER" shader to support UBER 1.2. + +## 3.4.4 +### Scripts +* Added "Animated by Clip" toggle to the AreaLight component to support Animation Clips. +* Fixed issue where "AlloyRequiredActions.cs" was causing build errors. + +## 3.4.3 +### Scripts +* Changed "Material Migrator" to run on the entire project, rather than per-scene. +* Changed "Material Migrator" to fix Normals Source on existing materials. +* Changed "Keyword Report" to "Material Report". +* Changed "Material Report" to add a section for shaders to list their associated materials. +* Changed "Light Migrator" to "Light Converter". +* Fixed "Light Converter" to properly convert the intensity from Unity lights. + +### Shaders +* Added config options to set which data is read from which channels in the packed maps. +* Added a "Normals Source" setting to enable/disable normal maps. + + Setting it to "Vertex Normals" enables extensive optimizations to greatly reduce a material's cost. +* Added "Vertex Blend" shader with an optional Alpha splat, and toggleable TriPlanar mapping. + + Add Alpha splat, and set Roughness Source to Base Color Alpha to match the old "Vertex Blend 4Splat" shader. +* Added "SpeedTree (Forward)" shader that is forward-only and supports the full set of Transmission parameters. +* Changed "Skin*" shaders to add Parallax feature. +* Changed "Skin*" shaders and camera components to restore Bias and Scale inputs. +* Changed "Terrain" shaders to support enabling optimizations when no normal maps are used. +* Changed "Vertex Blend" to add AO2, Decal support. +* Changed "Terrain" shaders to support TriPlanar mapping as a toggleable feature. +* Changed "Roughness Source" to be global for the whole shader, and eliminated it in Secondary and Oriented Textures sections. +* Fixed "TriPlanar" and "Oriented" shaders to correctly map textures for shadows and lightmap baking. +* Fixed "Terrain/4Splat" fog in forward mode. +* Renamed "TriPlanar/Full" to "TriPlanar" and modified it to encompass the "TriPlanar/Lite" inputs. + +### Features +* Added "Wetness" feature to most of the shaders. +* Changed "Detail" to add a "Mask Strength" parameter. + +### Legacy +* Moved "Terrain * TriPlanar" shaders into this set. +* Moved "TriPlanar/Lite" shaders into this set. +* Moved "Vertex Blend/4Splat *" shaders into this set. + +### Mods +* Removed "Wetmask/Core" & "Wetmask/Weighted Blend". + +### Integration +* Added support for "Hx Volumetric Lighting" transparency integration. +* Fixed Substance Painter custom shader to not cause rough specular in shadowed areas. +* Updated Substance Painter custom shader to support version 2.2. + +## 3.4.1 +_NOTE:_ +* You must run the new Material Migrator tool in each of your scenes to clean up and replace old keywords. + + Open Window->Alloy->Material Migrator. + + After it finishes, hit Ctrl+S. + +### Shaders +* Added "Eye" shader that is deferred-compatible and provides fine control of each eye component. +* Added Dithered LOD Cross-fade support to the majority of the shaders. +* Changed "Glass" shaders to support Roughness Source "Base Color Alpha" in their Main Textures. +* Changed "SpeedTree" shaders to support Transmission for Fronds and Leaves. + + Reads alpha transmission from SpeedTree specular maps. +* Changed "SpeedTree" & "Terrain" shaders to disable UV-picking. +* Changed "Weighted Blend" shaders to add "Decal" feature. +* Changed "Decal/Ambient" to affect specular occlusion for more consistent visuals between forward/deferred reflections. +* Changed "Skin" shaders to drop "Detail" Falloff parameter due to lack of use. +* Fixed "TriPlanar" and "Vertex Blend" shaders to have properly implemented Rendering Modes and opacity. +* Fixed "Transmission" shaders to no longer double-apply metallic inputs. +* Moved "Alloy Mods/Decal Ambient" into this set. +* Optimized lighting code to be much faster when the shader doesn't expose any AO or metallic inputs. +* Updated "Alloy Deferred UBER" override shader to support UBER 1.1b (U5.4.0b10 release). +* Updated "Skin" shader to use corrected LUTs with a slightly wider scattering area. + +### Features +* Changed "Main Textures", "Secondary Textures", and "Oriented Textures" so that their tint alpha still affects opacity when their Roughness Source is set to "Base Color Alpha". +* Changed "Detail" to add the option to use vertex color alpha as a mask. +* Changed "Detail" to drop "AO(G) Variance(A)" & "Occlusion Strength" due to their high cost and lack of widespread use. +* Changed "Directional Blend" to have a vertex color alpha tint property like "Weighted Blend". +* Changed "Directional Blend" and "Weighted Blend" to use a MUCH cheaper blending equation. + + Cutoff is the same, Blend will need to be re-tweaked. +* Changed "TeamColor" Tint toggle into a dropdown. +* Changed "Tessellation" to remove "Combined" mode option due to lack of use. + + Planning equivalent functionality for fewer keywords in the next release. Stay tuned. +* Fixed Parallax Mode dropdown where "POM" was displaying as "P O M". + +### Injection Headers +* Fixed issue with StandardSpecular where opacity was not being adjusted for metals. + +### Scripts +* Added Window->Alloy->Samples menubar item. +* Added Window->Alloy->Keyword Report menubar item. +* Added Window->Alloy->Material Migrator menubar item. +* Changed Window->Alloy->Light Migration Tool to Window->Alloy->Light Migrator menubar item. +* Changed "Material Map Channel Packer" to drop "Detail" packed map since we are no longer supporting it. + + We recommend deleting these maps from your project since they're now useless. + +### Legacy +* Changed "Skin" shaders to drop "Detail" Falloff parameter due to lack of use. +* Moved "Alloy/Eye/Eyeball" shaders into this set. +* Moved "Alloy/Eye/Eyeball (Legacy)" shaders into this set. + + Renamed to "Eye/Eyeball (Forward)". +* Moved "Alloy/Eye/Eye Occlusion" shaders into this set. + + Use the "Alloy/Decal/Ambient" shader instead to achieve the desired eye occlusion effect. + +### Mods +* Added "Car Paint Fast ClearCoat" shader which uses an experimental new ClearCoat approximation. +* Changed "SP Car Paint" to use an experimental new ClearCoat approximation. +* Changed "Weathered Blend" to add "Occlusion Strength" and "Normal Strength" parameters. +* Changed "Weathered Blend" to base its "Detail" feature UVs on the detail color map. +* Fixed "Weathered Blend" base material map AO to be converted to linear-space before being applied. + +## 3.4.0 b4 +### Shaders +* Changed "Mode" to "Roughness Source", "Full" to "Packed Map Alpha", and "Lite" to "Base Color Alpha". +* Fixed issue where deferred override shaders failed to compile while creating a build. + +### Scripts +* Fixed issue where Deferred Skin was getting blocky artifacts when the editor viewports were resized. +* Optimized Deferred Skin to use less bandwidth and VRAM at runtime. + +## 3.4.0 b3 +### Shaders +* Added most of the Alloy shader features to the "SpeedTree" shader. +* Added scroll to the "Vertex Blend TriPlanar" shaders' texture inputs. +* Fixed instancing z-fighting issue with lighting in forward mode. +* Optimized the "Vertex Blend", "Terrain", and "TriPlanar" shaders. +* Optimized forward lights by removing redundant calculations and moving some of the work to the vertex shader. +* Disabled instancing for now since it keeps interfering with several systems: + + SpeedTree wasn't being affected by wind. + + Transmission brightness was off for directional lights. + + Skinned meshes were crashing the editor. + +## 3.4.0 b2 +### Shaders +* Added single-pass stereo rendering support. +* Added "Skin (Forward)" shaders whose parameters and lighting behavior match our "Deferred Skin" pipeline. +* Added instancing support to most of the shaders, including "SpeedTree". +* Changed "Skin" shaders to remove scattering mask so that the metallic mask and controls could be restored. +* Changed "* SingleSided" & "* DoubleSided" shaders to "* OneSided" and "* TwoSided" for easier navigation. +* Fixed "SpeedTree" and "Hair" shaders' incorrect lighting on backfaces. +* Moved "Skin (Legacy)" shaders into the "Legacy" sub-folder/menu. +* Optimized "Transmission TwoSided" shaders to use fewer passes. + +### Scripts +* Added Mask Cutoff parameter to "Deferred Skin" to support thresholding transmission as a scattering mask. +* Changed "Deferred Skin" to never have shadowed transmission. +* Changed "Deferred Transmission" to only be shadowed for "TwoSided", or when "OneSided" shadow culling is set to Front. +* Fixed "Deferred Skin" blocky normal artifact. +* Removed "Deferred Skin" Bias and Scale parameters due to their lack of clarity and often being left on their defaults. + +### Legacy +* Moved "Skin (Legacy)" shaders into the "Legacy" sub-folder/menu. + +## 3.4.0 b1 +### Shaders +* Added Unity 5.4 support. +* Added Light Probe Proxy Volume support to all lit shaders, including particles. +* Added a "Lite" mode to Main, Secondary, and Oriented Textures to get roughness from the base color map alpha. +* Fixed "Partices/VertexLit Blended" shader to support 1 Directional Light, 4 Point Lights, and Light Probes (including LPPV). +* Fixed the vertex lighting code to support the Unity attenuation config flag. +* Fixed SpeedTree shader to apply AO correctly. +* Fixed Skin Transmission to not be so much darker than regular transmission. + +### Scripts +* Optimized Deferred Skin rendering. + + Also removed some development controls that weren't really artist-friendly. + +### Mods +* Added "SP Car Paint" shader that is similar to the Substance Painter CarPaint shader. + +## 3.3.5 +### Shaders +* Added detail normal map support to the SpeedTree shader's "Branch Detail" mode. +* Added "nSplat" terrain shader variants. +* Added "AO2" feature to the "Transition" shaders. +* Added "Detail" feature to the "Terrain" and "Vertex Blend" TriPlanar shaders. +* Changed "Weighted Blend" and "Directional Blend" to use their secondary textures alpha to influence blending. +* Changed "Parallax" effect to reduce cost when using it in conjunction with Amplify Texture. +* Changed the internal API coding style. + + If you use the config header, you will need to use the new flag names. + + Contact us if you are using customized shaders and require updates. +* Fixed "Eyeball" shaders to apply pupil dilation effect with Amplify Texture. +* Fixed "Eyeball" shaders to sample normal maps when using Amplify Texture. +* Fixed the Unity attenuation option to match between Forward and Deferred mode. +* Fixed "Hair HighQuality" issue with depth of field. +* Fixed incomplete mode feature definitions for the "TriPlanar" and "Directional Blend" shaders. +* Fixed "Transition" shader's weird edge glow and blending behavior when using "Parallax" effect. +* Fixed "Oriented Blend" shader to apply "AO2" effect on top of the oriented blend layer as well as the base layer. +* Fixed missing "AO2" effect on "Directional Blend" shaders. + +### Scripts +* Added a workaround for 3rd party plugins that use conflicting definitions for Unity's BlendMode enum. +* Added two new packed map modes to simplify converting Unity metallic and terrain packed maps to Alloy's formats. +* Fixed the Material Map Channel Packer to no longer transfer blurry samples from the input maps. + + We strongly recommend that you reimport all your packed maps to apply this fix. +* Optimized the Material Map Channel Packer for much better packing speed. + +### Mods +* Added "Transition Lite" shader that uses terrain packed maps for Main and Secondary Textures, as well as removing the glow effects from dissolve and transition. +* Added "Decal/Ambient" shader which is a mesh-based decal shader that multiplicatively blends only the ambient contribution. + +### Known Issues +* redLights 2.0 integration is currently broken. + +## 3.3.4 +### Shaders +* Added support for directional disc area lights. +* Added support for enabling Unity attenuation. + + Enable via config flag. +* Added support for Amplify Texture heightmaps in Parallax feature. +* Fixed where the material inspector visualize shader wasn't compiling on the Mac OSX Metal build target. +* Fixed a PS4 compilation issues in the Deferred Skin post-process shaders. + +### Scripts +* Updated the area light control to support radius on directional lights for disc lights. + +### Integration +* Fixed the SD5 shader "Packed *" techniques to use a "packedMap" input like the original shader. + +### Mods +* Added the "Mesh Particle Core" shader that uses vertex colors to look up base and emission color from gradient textures. +* Fixed "Deferred Decal Advanced" shader's compilation error. + +## 3.3.3 +### Shaders +* Fixed the Skin shaders to not blur the specular illumination. + +## 3.3.2 +### Shaders +* Added support for Tube area lights. + + Disable via config flag to slightly improve sphere light performance. +* Added a "Cull Mode" option to the Unlit shaders. +* Changed the mesh-based Decal shaders to be forward-compatible so that they have material inspector previews. +* Fixed Sphere Lights to remove distortion in their diffuse terms. +* Fixed Transmission to remove darkening and distortion due to large area lights. +* Removed the legacy CarPaint mask flag from the config header. + +### Scripts +* Updated the area light control to support length on point lights for tube lights. + +## 3.3.1 +### Shaders +* Added the "Decal/Additive" mesh-based deferred decal shader. +* Fixed the Deferred Transmission and Skin effects to work with Deferred Reflection Probes disabled. +* Fixed the Decal shaders to disable z-writes. +* Fixed the the bug where vertex colors were being double converted from gamma to linear resulting in oversaturated colors. + +### Integration +* Updated Substance Designer custom shader to support version 5.3.1. + + Condensed all the shaders into one FX file with multiple techniques for ease of import. +* Updated Substance Painter custom shader to support version 1.6. + + Removed the opaque shader, since the alpha test shader will work just as well in this context. + +## 3.3.0 +### Shaders +* Added SpeedTree shaders. +* Added the "Decal/Alpha", "Decal/Cutout", and "Decal/Multiplicative" mesh-based deferred decal shaders. +* Added deferred Eyeball shaders. + + Renamed the existing forward-only Eyeball shaders to "Eyeball (Legacy)". +* Added deferred Skin shaders. + + Uses new "Alloy Deferred Skin" deferred override shader & "Deferred Renderer Plus" camera component. + + Renamed the existing forward-only Skin shaders to "Skin (Legacy)". +* Added deferred Transmission shaders. + + Uses new "Alloy Deferred Transmission" deferred override shader & "Deferred Renderer Plus" camera component. + + Renamed the existing forward-only Transmission shaders to "Transmission (Legacy)". +* Added support for colored light cookies to both our shaders and the Unity surface shader injection headers. + + AreaLight script now automatically sets cookie on Spot lights that don't have one. + + Set config flag to restore legacy behavior. +* Added a "Falloff" parameter to the Skin shader Details effect to simulate micro-occlusion at grazing angles. +* Added AO2 to the Weighted Blend shader. +* Changed all the tessellation shaders to add MacOSX support. +* Changed the TeamColor feature to offer the option to use the Masks texture directly as a color tint. +* Changed the TeamColor feature to use the new masks vector control for selecting which channels to use from the Masks map. + + You will need to update any materials that were using RGBA masks. +* Changed the shaders to store specular occlusion directly in the Gbuffer to reduce cost and improve SSRR integration. +* Changed section names to be shorter and more readable in the material inspector. +* Changed Flakes properties so that the tint color alpha affects the flake mask. +* Changed ForwardEye shader to disable Iris highlight to simplify lighting API. +* Fixed the ForwardSkin and Skin shaders to correctly mask blurred normals. +* Fixed a bug in the override headers where they weren't correctly calculating Point/Spot lights in forward mode. +* Fixed the "Unlit" shaders so that it now renders properly when set to Fade/Transparent. +* Fixed the "Oriented Core" shader to gamma-correct vertex colors before using them as tints. +* Fixed our tessellation shaders to not apply tessellation in their Meta passes. +* Fixed the Terrain and Vertex Blend TriPlanar modes to use per-pixel normals for specular occlusion and environment specular. +* Moved all the character shaders into the new sub-menu "Human". +* Moved the Terrain shaders into the "Nature" sub-menu to be with the SpeedTree shaders. + +### Scripts +* Added more validation and warnings to the Material Map Channel Packer. +* Added a new "Deferred Renderer Plus" camera component to support deferred Skin and Transmission. +* Added per-light specular highlight toggle. + + AreaLight component is now required on ALL lights, so use our Light Migration tool to update them. +* Changed the Light Migration tool to support the AreaLight component on all lights, and DefaultSpotCookie on Spot Lights. +* Changed all our packer definitions to be serialized to text by default to prevent issues in "Force Text", and "Mixed" modes. +* Fixed a bug in the Particle inspector where the UI wouldn't appear. + +### Mods +* Added a two-pass, forward-only Full ClearCoat CarPaint shader. +* Added a prototype Deferred Decal shader. +* Added the "Intersection Glow" shader which is used for drawing clear domes with rim & emission effects that glows when it intersects other geometry. +* Added the "Masked Core" shader prototype which uses a shared packed masks texture and the ability to pick multiple masks to apply to the Detail, Emission, and Rim effects. +* Moved deferred-compatible Eyeball shader to official set. + +### Documentation +* Added new sections for "Advanced Setup" of the deferred transmission and skin effects. +* Updated and reorganized most of the existing sections. + +## 3.2.7 +### Shaders +* Added a deferred reflections override shader. +* Added a shadow cull mode setting on the "Transmission SingleSided" shaders. + +### Integration +* Changed the Subtance Painter preview shader to account for SP 1.5 changes. +* Fixed the Subtance Painter preview shader alpha blending/test shader variants. + +## 3.2.6 +### Shaders +* Fixed and simplified the UBER integration by adding a dedicated deferred shader. + +### Scripts +* Fixed the Map Packer pack definition corruption problem. + +## 3.2.5 +### Shaders +* Added "Alloy/Particles/VertexLit Blended" shader with support for vertex lighting and light probes. +* Added UBER integration to our deferred override shader. +* Added Occlusion Strength and Normal Strength parameters to all relevant shaders. +* Added Beta Alloy brdf and area light override headers for Unity's surface shader system. + + Currently works for surface shaders using Standard, StandardSpecular, Phong, and Lambert lighting models. +* Changed default HDR Clamp from 32 to 100. + + To restore legacy, modify setting in config header. +* Changed the "CarPaint" shaders to have the flake map RGB act as a tint, and the alpha act as the mask. + + Set config flag to restore legacy behavior. +* Changed the Unlit shaders' Main Textures properties' Tint parameter to use an HDR Color picker. +* Changed the Unlit shaders to affect the Gbuffer in deferred mode so that image effects will detect them. +* Changed light probe sampling to be fully per-pixel by default. + + Restore legacy behavior with config flag. +* Changed our internal Luminance code to a more modern formula, which may affect look of specular tints. +* Fixed an issue with the Skin shader where it wasn't correctly accounting for shadows and attenuation in it's LUT lookup. +* Fixed an issue in the Static Directional Specular mode where we weren't applying the direct contribution. +* Fixed the Directional Specular lightmap mode to apply AO to its diffuse contribution to look more consistent with the other lightmap modes. +* Fixed the POM distortion that occurred on large triangles at grazing angles. +* Fixed the random popping issues in the POM effect that occurred when the camera moved away from the object. +* Fixed the default value for the Transmission shaders' Bump Distortion to make the effect more apparent. +* Fixed the divide by zero compiler warnings for some of the shaders. +* Fixed a GLSL compilation issue. + +### Scripts +* Changed the channel packer tool to make it data-driven and support user-defined packer modes. +* Fixed the issue where freshly imported packed maps would be broken and need to be manually reimported. + +### Mods +* Changed the Weathered Blend shader to apply parallax to the base masks and normals. + +## 3.2.1 +### Scripts +* Fixed incorrect gamma correction in Map packer to account for changes in Unity 5.1. + +## 3.2.0 +### Shaders +* Added the "TriPlanar/Full" and "TriPlanar/Lite" shaders. +* Added TriPlanar variants of "Terrain/4Splat" and "Vertex Blend/4Splat". +* Adjusted the normal projection for "Oriented/Blend" and "Oriented/Core". +* Merged "Directional/Blend World" and "Directional/Blend Object" into "Directional Blend". +* Migrated all the emission effects to using the new Unity HDR color picker. +* Modified the "Transmission DoubleSided" shader to add the parameters Shadow Weight & Invert Back Normals. +* Fixed the backface lighting for the "Transmission DoubleSided" shaders. +* Removed the legacy features flags. +* Renamed "Hair/Translucent" -> "Hair/HighQuality" and "Hair/Base" -> "Hair/LowQuality" for clarity. +* Renamed "Vertex Blend 4Splat" -> "Vertex Blend/4Splat" for grouping flexibility. + +### Scripts +* Removed the legacy Intensity Gain color control from our inspector definition system. +* Removed the AlloyUtils.IntensityGain() utility function. + +### Mods +* Added the deferred-compatible Eyeball shader prototype. + +## 3.1.2 +### Shaders +* Changed all instances of "_AlphaTestRef" property to "_Cutoff" to ensure compatibility with Unity 3.1's depth-normal pass replacement shader. +* Fixed Oriented Blend and Core shaders to swap X & Z normal mapping and to properly convert Y on the underside of the object. +* Fixed distant terrain shader to use Unity's renamed metallic texture property and roughness. + +## 3.1.1 +### Shaders +* Added a new "Combined" tessellation mode that combines Phong and Displacement. +* Fixed the GI code that caused weird noisy glitching artifacts on some MacOSX platforms. +* Fixed the Parallax code that was causing it to fail to compile on the PS4. +* Fixed the Detail feature code that caused it to fail to compile on some MacOSX platforms. +* Fixed the Substance Designer preview shaders' code that caused them to fail to compile on AMD GPUs. + +## 3.1.0 +### Shaders +* Added "Directional Blend" shaders with support for blending around an arbitrary direction on the surface. +* Added "Vertex Blend 4Splat" shaders with support for blending 4 splats using vertex colors. +* Added a secondary vertex color tint slider to the "Oriented*", "Transition", & "Weighted Blend" shaders. +* Added a Pupil Dilation control to the "Eye/Eyeball". +* Added directional control to the "Oriented Blend" shaders. +* Changed all shaders to now have the Global Illumination control at the top so all types of emission can affect GI. + + You will need to manually set all your static objects to "None", as this control always defaults to "Realtime". +* Changed the "CarPaint" shader. + + Added a primary tint color that is applied in the masked areas. + + "Main Textures" tint color now affects both primary and secondary paint colors. + + Toggle legacy behavior in the config header. +* Changed the "Eye/Eyeball" shader. + + Split up the "Eye Properties" into two smaller sections. + + Added a Schlera tint color. + + "Main Textures" tint color now affects both Schlera and Iris colors. + + Toggle legacy behavior in the config header. +* Changed our Parallax code to reduce the overall cost per active feature and simplify the API. +* Changed "Weighted Blend" & "Oriented Blend" to allow emission to be blended over. +* Changed "Weighted Blend" to remove Secondary Rim, as there should only be one rim term for the combined material. +* Changed "Transition" so that the Dissolve feature now accounts for each layer's parallax texture offsets. +* Changed API + + Rebuilt our lighting code to give each lighting type its own shareable module, removing the code from the shaders. + + Simplified our texture coordinate macro system so that each texture doesn't need to know about parallax. + + Added a masking system to allow features to be externally masked for different blending behavior. +* Fixed the "Particle*" shaders so that input vertex colors now receive gamma-correction. +* Fixed the "Tessellation/Oriented*" shaders which erroniously were set to target SM3.0, and had parallax properties. +* Fixed it so that Fade rendering mode no longer increase opacity when the surface metalness increases. +* Fixed the code we use to transform normals for our Oriented shaders. +* Fixed a compiler bug on the "Eye/Eyeball" shader when using the Dissolve feature in SM3 mode. +* Fixed a Null Ref error when using substances and switching shaders. +* Fixed the rendering modes dropdown to now work with undo. +* Fixed a potential compilation bug in the Glass shader when used on consoles. + +### Scripts +* Fixed the Material Map Channel Packer so that its controls now support undo. + +### Mods +* Weathered Blend (an experiment in attenuating a type of 2mat blend with further mesh data). +* WetMask Set (used in the Remnants demo for combining Weighted blend with scrollable wet sections). + +### Known Issues +* The visualize feature currently doesn't work properly for textures that use world-space UVs. + +## 3.0.2 +### Shaders +* Changed to an optimized BRDF visibility function. + + Toggle legacy behavior in the config header. +* Changed our higher quality Environment BRDF to use a formulation that maps correctly to linear roughness. +* Changed the Environment BRDF to use our new formulation by default. + + Required some small changes to the lighting API. + + Toggle legacy behavior in the config header. +* Fixed a bug in the Weighted Blend shaders where the vertex tint control was not doing anything. + +### Features +* Changed the TeamColor module to use our new formulation by default. + + Toggle legacy behavior in the config header. + +### Scripts +* Fixed a possible bug in the Material Map Channel Packer where it would error if any of the input textures didn't have mipmaps enabled. + +### Integration +* Substance Designer + + Changed visibility function to match Unity shaders. + + Removed the Specular AA feature as it was never really working properly due to the lack of mipmap generation. + +## 3.0.1 +### Shaders +* Added support for tinting the base color with vertex colors. +* Added a Mode dropdown to the Team Color feature to support explicitly turning off the alpha mask. +* Modified the Weighted Blend shader to control the influence of the vertex alpha on the weight. +* Modified the vertex lighting fallback to use Alloy's attenuation function. +* Modified the config header options. +* Fixed a compilation issue with the terrain shaders. +* Fixed a bug in the AlloyVertex() callback where it wouldn't properly handle vertex position modification. + +### Scripts +* Fixed a potential bug on the AreaLight component where it wouldn't let you change the light intensity or color if the light was disabled. + +### Features +* Modified the Decal feature: + + Added a Weight property to allow smoothly turning decals on and off from scripts without modifying the tint color. + + Added a property for controlling how much the vertex color alpha weights the Decals. + +### Integration +* Substance Painter + + Updated the preview shader to support SP1.3. + + Added Alpha translucency and cutout variants of the preview shader. + +## 3.0.0 beta8 +### Shaders +* Added a cutoff control the Hair Translucent shaders to allow control over the opaque regions for better sorting. +* Modified all the Tessellation shaders to use their regular variants as fallbacks. +* Fixed a problem with the Detail feature where it wouldn't compile on MacOSX. + +### Scripts +* Added a new tool for migrating existing punctual lights to Alloy area lights. +* Fixed our Area Light code to now convert existing light data to our representation when the Area Light component is added. +* Fixed our Terrain Packed Maps to correctly grab color info, rather than just a single channel. + +## 3.0.0 beta7 +### Shaders +* Added a new config option for higher quality IBL fresnel. + + Currently disabled by default as we decide if we want to make it the new default. +* Changed the Tessellation shaders so that the Displacement property goes up to a max of 30. +* Moved the Max intensity constant to the Config header to allow easier customization. +* Fixed a bug in our Amplify Texture support code where we were using the wrong function when sampling normals. + +## 3.0.0 beta6 +### Shaders +* Changed the Particle shaders: + + Added a rim fade feature to support light shaft effects. + + Added a near fade feature to support fading particles that get close to the camera. + + Centralized their code in a shared header for easier maintenance. +* Switched to using Unity RC3's new [Gamma] attribute for some input properties to save calculations inside the shaders. + +## 3.0.0 beta5 +### Shaders +* Changed the config header to add an option for enabling a minimum tessellation edge length property. + This can be globally set by a script to control the tessellation quality of all models. +* Changed surface shader API. + + Changed most of the shader pass code to centralize their shared code. +* Changed the Oriented Blend shader: + + If the Oriented material has an alpha channel, it alpha blends on top of the base material. + + If the base material has an alpha, it will alpha through or cutout the oriented material. + +## 3.0.0 beta4 +### Shaders +* Changed surface shader API. + + Added support for modifying vertices. + + Added support for final color modification. + + Added an explicit folder with default headers for various surface shader callbacks. +* Fixed the Distort pass to now support Fog. + +### Scripts +* Material Inspector + + Fixed an issue with the visualize function where the underlying mesh would poke through on edges. + +## 3.0.0 beta3 +### Shaders +* Changed the Terrain shaders. + + Restored the additional per-splat parameters and base layer. + + Restored deferred support. + + Removed 5-n splat support. +* Fixed several Unity config problems + + Shaders were Orthonormalizing when they shouldn't have been. + + Shaders were using Box projection and probe blending when they shouldn't have been. + +### Scripts +* Material Inspector + + Added a new control for Unity's LightmapEmissionProperty. + +## 3.0.0 beta2 +### Shaders +* Added "Oriented/Core" shaders + + World-textured material. +* Changed the Oriented Blend Shader + + Changed the name to "Oriented/Blend". + + Now uses its own property names, so allow easy copying between it and "Oriented/Core". + + Now blends based on the per-pixel world normal, rather than the geometry world normals. +* Changed Skin shaders + + Added an explicit skin mask and removed implicit control through the translucency map. + + Changed Transmission to now convert the Translucency map input to linear space. + + Removed Metallic control and mask. +* Changed Weighted Blend/Transition shaders. + + Secondary maps now support Scroll and UV Set selection. +* Changed all shaders. + + Base and Detail maps now support Scroll and UV Set selection. +* Fixed the Eyeball shader to default Iris Depth to 0.08 rather than 1. +* Fixed the Terrain + + Had to remove a bunch of features since Unity took away the ability to use them. + + It now can use the per-splat and distant metallic feature. + +### Scripts +* Material Inspector + + Added support for rendering a Vector2-4 control for Vector properties. + + Fixed a bug where it would render a color control for Vector properties. + +## 3.0.0 beta1 +Lighting: +* Added support for both Point and Spot Spherical Area lights! +* Modified Point and Spot lights to use Inverse Square physical attenuation. +* Modified our lighting model. + + Diffuse now exhibits interreflection for rough materials. + + Specular lighting now uses the GGX BRDF. +* IBL + + Added support for Unity 5's new reflection probes, dynamic GI, directional lightmaps, etc. + + Removed RSRM support. + +### Shaders +* Added Car Paint shader. +* Added Prototyping shader. +* Added Hair shader. +* Added Eye shader. +* Added Eye Occlusion shader. +* Added Glass shader. + + Replaces Transparent Distort +* Added Unlit shader. + + Replaces the old Glow shaders. +* Added Weighted Blend shaders. +* Added Oriented Blend shaders. +* Added Terrain shaders. +* Added Transmission shaders. +* Added Particle shaders. +* Added Tessellation variants of all shaders. +* Changed Skin shaders + + Added attenuation to the transmission effect. + + Transmission is now in Base alpha. + + Specularity is now in the Material Map blue channel. + + Transmission "weight" parameter is now converted to linear internally. + +### Features +* Added Ubershaders! + + Users can now add/remove features within a shader rather than by switching shaders. + + Uses the new shader_feature system to compile on demand and cut down on excess keyword usage. +* Added Vertex-weighted Decal feature. + + Can control where alpha decals appear on the mesh per-vertex. + + Dropped detail material and normal and now rely on this variant being combined with the Detail feature. +* Added Masked Detail feature. + + Can use a per-pixel mask to control area of influence. +* Added UV mode to AO2, Detail, Dissolve, and Effect texture controls. +* Added AO2 support to the Car Paint, Glass, and Transmission shaders. +* Merged Masked Incandescence system with Unity's new Emission feature. + + Allows it to feed into the lightmap and dynamic GI systems. +* Changed Dissolve, Emission, and Rim effects to use Gain, rather than intensity. + + [0,1] range with a perceptually linear gain in intensity. + + Added a weight parameter to dissolve glow to compensate for added intensity. +* Changed primary textures to now use native Unity transforms. + + You can now tile the other texture groups independently of the "Main Textures" group. + + Rim and Emission color textures now have an Offset parameter. +* Changed the TeamColor feature so that the RGB masks are applied on top of the alpha mask. + + Can now use RGB textures to save memory. + + Testing is simpler, since you no longer need to make a texture with a zero alpha. +* Fixed the issue where tiled secondary textures (Detail, Decal, etc) would "swim" when using parallax. + +### Scripts +* Light Inspector + + All lights can now support intensities higher than 8. + +* Area Light Inspector + + Extends existing Point and Spot light gameobjects to add Size information. + +* Material Inspector + + Added a new in-shader DSL UI definition system. + + Added a new ubershader UI. + - User enables features by adding/removing properties sections. + - Uses Unity 5's render mode selector rather than separate Opaque, Transparent, etc shaders. + + Changed the Visualize feature + - Added support for visualizing on Skinned Meshes. + - Added support for submesh visualization. + - Added UV mode support, including on parent textures. + - Changed button to now appears outside collapsed transforms section on textures. + - Fixed a bug where visualizing individual channels displayed with the wrong intensities. + - Fixed the bug where visualize button appeared on materials selected inside the project window. + + Changed the Texture controls + - Renamed "Velocity" to "Scroll". + - Added a "Spin" value for spinning textures on particles. + - Added UV mode to control whether a texture uses UV0 or UV1. + + Fixed the bug where materials would throw exceptions if they had more than one property with the same name but different types. + + Fixed the issue with Texture controls where you couldn't pick a different texture in the same open window after picking one. + +* Material Map Packer + + Added a new "Terrain" packed mode for supporting maps with color and roughness. + + Modified the save path to reduce its width for extremely deep folder paths. + + Fixed an issue where the float value controls were previewing a color that was too dark. + +* RSRM Generator + + Removed since we discontinued support for them. + +### Integration +* Skyshop + + Removed support. + +* Substance Designer + + Added support for Alloy's new BRDF. + + Added support for SD4.6. + - Support for the new "specularlevel" input, with legacy support for our own "specularity" input. + - Emission support. + - Opacity support, but it blends incorrectly since it is in gamma-space. + - Tessellation support. + + Fixed some issues that caused the Specular highlights to be too dark. + + Fixed an issue where the the ambient occlusion's ambient intensity was being changed. + + Removed support for D3D-style normal toggle, since Unity doesn't support that. + +* Substance Painter + + Added a new Alloy preview shader. + +Demo Assets: +* Updated all the materials to use Alloy 3.0 shaders. + +Known issues: +* Visualize feature does not work correctly when used with parallax or tessellation. + +## 2.1.2 +### Tools +* Material Inspector + + Changed the Visualize feature + - Added support for visualizing on Skinned Meshes. + - Added support for submesh visualization. + - Fixed a bug where visualizing individual channels displayed with the wrong intensities. + - Fixed the bug where visualize button appeared on materials selected inside the project window. + +* Material Map Packer + + Fixed an issue where the float value controls were previewing a color that was too dark. + +### Integration +* Skyshop + + Updated Alloy to use Skyshop 1.11. + +## 2.1.1 +### Shaders +* Fixed the translucent & skin shaders to render correctly in deferred mode on MacOSX. +* Fixes issues when using skin shaders with Candela in deferred mode. + +### Integration +* Substance Designer + + Updated Alloy preview shader to use the new SH diffuse lighting feature. + + Added a new shader to render using packed material map rather than individual channels. + +## 2.1.0 +### 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" + +## 2.0.4 +* EMERGENCY hotfix because I'm an idiot. + +## 2.0.3 +* Added beta Skin shader in Core set (Skin Bumped). + +## 2.0.2 +* Fixed inspector bug preventing custom cubes to be input. + +## 2.0.0 +### Shading Improvements +* Increased Specular Power Range +* Better Visibility Function * Treyarch Shlick Approximation +* Specular Occlusion (Tri-ace style) +* Specular Anti-Aliasing via Roughness Correction + +### Updated Shader Features +* Smoothness changed to Roughness (to line up with SD4, and other industry conventions) +* Added Specularity Parameter for varying specular intensity on dielectrics +* New RGBA Packed Data Map (R = Metallic, G = AO, B = Spec, A = Roughness) +* Dropdown for Ambient Lighting options, rather than multiple shader variants. +* Added Exposure Boost for traditional cube reflections +* RSRMs now affect ambient diffuse +* More controls and texture features for Masked Incandescence and Rim Lighting + +### New Workflow Tools +* Custom Material Inspectors +* Alloy Packed Map Generator +* Alloy RSRM Generator Editor +* Substance Designer 4 Preview Shader with sample graphs + +### New Shader Variants +* Decal Texture Versions in Each Variant Set +* Distortive Translucent Variant Set +* Alpha Cutout Variant Set +* VFX Dissolve and Transition Shaders + +### Full Skyshop Compatibility +* Global Sky Settings, Diffuse SH, FIltered Spec Cube +* Custom Overridden FIltered Spec Cube +* HDR Filtered Cube-capture using Alloy Materials +* Box Projection Support + +### Known Issues +* Some faceting can occur on super smooth surfaces in deferred mode due to normal buffer precision (only Unity can fix) +* Translucent shaders only receive 1 dynamic light in deferred mode due to a Unity 4.3 glitch (we have an open bug report) +* Deferred mode is totally busted on OSX. We have no idea wtf is happening, but we're trying to figure out what it is. +* We don't have a terrain shader currently. Don't worry, we're working hard on it, but didn't want to delay this update further. + + +## 1.0.1 +* Standardized the API naming conventions to avoid name collisions when mixing shader libraries. This will break current user-created shaders, which will need to be updated to use the new API. + + RimLight() -> aRimLight() + + EPSILON -> A_EPSILON + + DeGamma() -> AlloyDeGamma() + + LinearLuminance() -> AlloyLinearLuminance() + + etc. +* Added a new material API to move implementation details of our material system out of the individual shaders. + + Direct access to the SurfaceOutput will no longer work correctly. + + For custom shaders, we strongly recommend using the new API. +* The headers are no longer obfuscated, and come fully commented. +* Renamed “Alloy/Transparent/MaskedIncandescence Rim” to “Alloy/Effects/MaskedIncandescence Rim” since it doesn’t integrate with Unity’s translucency system for baking. +* Fixed an issue in “Alloy/Effects/MaskedIncandescence Rim” where it wasn’t getting texture coordinates from the mask texture +* Reoredered the parameters for all the “*MaskedIncandescence*” shaders so that the Mask is higher up to show that it uses the first UV set while the Incandescence texture uses the second UV set. +* Removed an unnecessary energy conserving step from the distort pass of the alpha distort shaders. +* Fixed an issue where alpha was darkening albedo in cutout shaders. +* Fixed an issue in the terrain shaders where the blend weights were being applied twice to the smoothness, causing them to be biased toward rough values where multiple splats overlapped. diff --git a/Assets/Alloy/CHANGELOG.md.meta b/Assets/Alloy/CHANGELOG.md.meta new file mode 100644 index 0000000..795c6f4 --- /dev/null +++ b/Assets/Alloy/CHANGELOG.md.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 7f4aec931b007494297fe69578d4383a +timeCreated: 1509893722 +licenseType: Pro +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/EXTENSIONS.txt b/Assets/Alloy/EXTENSIONS.txt new file mode 100644 index 0000000..e833794 --- /dev/null +++ b/Assets/Alloy/EXTENSIONS.txt @@ -0,0 +1,11 @@ +Greetings! + +Extensions are separate packages of shaders and scripts that reference Alloy and build on top of it. Here are a few official examples: + +Legacy +===================== +Deprecated Alloy scripts and shaders. They won't receive new features, and may be dropped if they interfere with newer shaders. These exist to facilitate migration or to support projects that are nearly ready to ship. Please refrain from making new content with them. + +Mods +===================== +Betas, experiments, and one-off shaders that we've done for personal/commercial work. They're NOT officially supported or documented, but may be added to the official set if there is sufficient demand. diff --git a/Assets/Alloy/EXTENSIONS.txt.meta b/Assets/Alloy/EXTENSIONS.txt.meta new file mode 100644 index 0000000..2a98fad --- /dev/null +++ b/Assets/Alloy/EXTENSIONS.txt.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c953c17bc6f1c784fb3ec9e3964c936c +timeCreated: 1467836751 +licenseType: Pro +TextScriptImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/LICENSE.txt b/Assets/Alloy/LICENSE.txt new file mode 100644 index 0000000..2da224a --- /dev/null +++ b/Assets/Alloy/LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2013 RUST LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/Assets/Alloy/LICENSE.txt.meta b/Assets/Alloy/LICENSE.txt.meta new file mode 100644 index 0000000..6e127bd --- /dev/null +++ b/Assets/Alloy/LICENSE.txt.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: c1eb8e30cf54a404bb5d0ea06379ef15 +timeCreated: 1509893765 +licenseType: Pro +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Legacy.meta b/Assets/Alloy/Legacy.meta new file mode 100644 index 0000000..d3ca3cb --- /dev/null +++ b/Assets/Alloy/Legacy.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 490b3db96355c4c4d8b1c54cd802bb61 +folderAsset: yes +timeCreated: 1467836664 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Legacy/Shaders.meta b/Assets/Alloy/Legacy/Shaders.meta new file mode 100644 index 0000000..f2cde9c --- /dev/null +++ b/Assets/Alloy/Legacy/Shaders.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 3d47b2bb113220c4db1b7441733ca1d6 +folderAsset: yes +timeCreated: 1467836679 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Legacy/Shaders/3.0.meta b/Assets/Alloy/Legacy/Shaders/3.0.meta new file mode 100644 index 0000000..95f7213 --- /dev/null +++ b/Assets/Alloy/Legacy/Shaders/3.0.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: c4c634823dda5844bb73e007881bdbd2 +folderAsset: yes +timeCreated: 1467836685 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Legacy/Shaders/3.0/Eye Eyeball Forward.shader b/Assets/Alloy/Legacy/Shaders/3.0/Eye Eyeball Forward.shader new file mode 100644 index 0000000..666f1e0 --- /dev/null +++ b/Assets/Alloy/Legacy/Shaders/3.0/Eye Eyeball Forward.shader @@ -0,0 +1,244 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Legacy/Human/Eye/Eyeball (Forward)" { +Properties { + // Main Textures + _MainTextures ("'Eyeball Textures' {Section:{Color:0}}", Float) = 0 + [LM_Albedo] [LM_Transparency] + _Color ("'Tint' {}", Color) = (1,1,1,1) + [LM_MasterTilingOffset] [LM_Albedo] + _MainTex ("'Base Color(RGB) Iris Depth(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _MainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _MainTexUV ("UV Set", Float) = 0 + [LM_Metallic] + _SpecTex ("'Iris(R) AO(G) Spec(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_MainTex}", 2D) = "white" {} + [LM_NormalMap] + _BumpMap ("'Normals' {Visualize:{NRM}, Parent:_MainTex}", 2D) = "bump" {} + _BaseColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Main Properties + _MainPhysicalProperties ("'Main Properties' {Section:{Color:1}}", Float) = 0 + _Specularity ("'Specularity' {Min:0, Max:1}", Float) = 1 + _Roughness ("'Roughness' {Min:0, Max:1}", Float) = 1 + _Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _BumpScale ("'Normal Strength' {}", Float) = 1 + + // Eye Properties + _EyeProperties ("'Eye' {Section:{Color:2}}", Float) = 0 + _EyeScleraColor ("'Sclera Tint' {}", Color) = (1,1,1) + _EyeScleraScattering ("'Sclera Scattering' {Min:0, Max:1}", Float) = 0 + _EyeSpecularity ("'Cornea Specularity' {Min:0, Max:1}", Float) = 0.36 + _EyeRoughness ("'Cornea Roughness' {Min:0, Max:1}", Float) = 0 + + // Iris Properties + _IrisProperties ("'Iris' {Section:{Color:3}}", Float) = 0 + _EyeColor ("'Tint' {}", Color) = (1,1,1) + _EyeIrisScattering ("'Scattering' {Min:0, Max:1}", Float) = 0 + _EyeSpecularTint ("'Specular Tint' {Min:0, Max:1}", Float) = 1 + _EyeParallax ("'Depth' {Min:0, Max:0.08}", Float) = 0.08 + _EyePupilSize ("'Pupil Dilation' {Min:0, Max:1}", Float) = 0 + + // Detail + [Toggle(_DETAIL_MULX2)] + _DetailT ("'Detail' {Feature:{Color:7}}", Float) = 0 + [Enum(Mul, 0, MulX2, 1)] + _DetailMode ("'Color Mode' {Dropdown:{Mul:{}, MulX2:{}}}", Float) = 0 + _DetailAlbedoMap ("'Color(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _DetailAlbedoMapVelocity ("Scroll", Vector) = (0,0,0,0) + _DetailAlbedoMapUV ("UV Set", Float) = 0 + _DetailNormalMap ("'Normals' {Visualize:{NRM}, Parent:_DetailAlbedoMap}", 2D) = "bump" {} + _DetailWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DetailNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Decal + [Toggle(_DECAL_ON)] + _Decal ("'Decal' {Feature:{Color:9}}", Float) = 0 + _DecalColor ("'Tint' {}", Color) = (1,1,1,1) + _DecalTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "black" {} + _DecalTexUV ("UV Set", Float) = 0 + _DecalWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DecalSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _DecalAlphaVertexTint ("'Vertex Alpha Tint' {Min:0, Max:1}", Float) = 0 + + // Emission + [Toggle(_EMISSION)] + _Emission ("'Emission' {Feature:{Color:10}}", Float) = 0 + [LM_Emission] + [HDR] + _EmissionColor ("'Tint' {}", Color) = (1,1,1) + [LM_Emission] + _EmissionMap ("'Mask(RGB)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "white" {} + _IncandescenceMap ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _IncandescenceMapVelocity ("Scroll", Vector) = (0,0,0,0) + _IncandescenceMapUV ("UV Set", Float) = 0 + [Gamma] + _EmissionWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + + // Rim Emission + [Toggle(_RIM_ON)] + _Rim ("'Rim Emission' {Feature:{Color:11}}", Float) = 0 + [HDR] + _RimColor ("'Tint' {}", Color) = (1,1,1) + _RimTex ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _RimTexVelocity ("Scroll", Vector) = (0,0,0,0) + _RimTexUV ("UV Set", Float) = 0 + [Gamma] + _RimWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + [Gamma] + _RimBias ("'Fill' {Min:0, Max:1}", Float) = 0 + _RimPower ("'Falloff' {Min:0.01}", Float) = 4 + + // Dissolve + [Toggle(_DISSOLVE_ON)] + _Dissolve ("'Dissolve' {Feature:{Color:12}}", Float) = 0 + [HDR] + _DissolveGlowColor ("'Glow Tint' {}", Color) = (1,1,1,1) + _DissolveTex ("'Glow Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _DissolveTexUV ("UV Set", Float) = 0 + _DissolveCutoff ("'Cutoff' {Min:0, Max:1}", Float) = 0 + [Gamma] + _DissolveGlowWeight ("'Glow Weight' {Min:0, Max:1}", Float) = 1 + _DissolveEdgeWidth ("'Glow Width' {Min:0, Max:1}", Float) = 0.01 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _Lightmapping ("'GI' {LightmapEmissionProperty:{}}", Float) = 1 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} + +SubShader { + Tags { + "Queue" = "Geometry" + "RenderType" = "Opaque" + //"DisableBatching" = "LODFading" + } + LOD 400 + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Legacy/Shaders/Definition/EyeballForward.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend One One + ZWrite Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _DECAL_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + + #include "Assets/Alloy/Legacy/Shaders/Definition/EyeballForward.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _DISSOLVE_ON + + #pragma multi_compile_shadowcaster + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_SHADOWCASTER + + #include "Assets/Alloy/Legacy/Shaders/Definition/EyeballForward.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Legacy/Shaders/Definition/EyeballForward.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +FallBack "VertexLit" +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Legacy/Shaders/3.0/Eye Eyeball Forward.shader.meta b/Assets/Alloy/Legacy/Shaders/3.0/Eye Eyeball Forward.shader.meta new file mode 100644 index 0000000..fa0c9c0 --- /dev/null +++ b/Assets/Alloy/Legacy/Shaders/3.0/Eye Eyeball Forward.shader.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: a6700881f29f31948bdf60ba565ab71c +ShaderImporter: + defaultTextures: + - _MainTex: {instanceID: 0} + - _SpecTex: {instanceID: 0} + - _BumpMap: {instanceID: 0} + - _DetailMask: {instanceID: 0} + - _DetailAlbedoMap: {instanceID: 0} + - _DetailMaterialMap: {fileID: 2800000, guid: 2b77d5cb601375f4ba50c6194c126e59, + type: 3} + - _DetailNormalMap: {instanceID: 0} + - _DecalTex: {instanceID: 0} + - _EmissionMap: {instanceID: 0} + - _IncandescenceMap: {instanceID: 0} + - _RimTex: {instanceID: 0} + - _DissolveTex: {instanceID: 0} + userData: + assetBundleName: diff --git a/Assets/Alloy/Legacy/Shaders/3.0/Eye Eyeball.shader b/Assets/Alloy/Legacy/Shaders/3.0/Eye Eyeball.shader new file mode 100644 index 0000000..1ebaebe --- /dev/null +++ b/Assets/Alloy/Legacy/Shaders/3.0/Eye Eyeball.shader @@ -0,0 +1,274 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Legacy/Human/Eye/Eyeball" { +Properties { + // Main Textures + _MainTextures ("'Eyeball Textures' {Section:{Color:0}}", Float) = 0 + [LM_Albedo] [LM_Transparency] + _Color ("'Tint' {}", Color) = (1,1,1,1) + [LM_MasterTilingOffset] [LM_Albedo] + _MainTex ("'Base Color(RGB) Iris Depth(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _MainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _MainTexUV ("UV Set", Float) = 0 + [LM_Metallic] + _SpecTex ("'Iris(R) AO(G) Spec(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_MainTex}", 2D) = "white" {} + [LM_NormalMap] + _BumpMap ("'Normals' {Visualize:{NRM}, Parent:_MainTex}", 2D) = "bump" {} + _BaseColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Main Properties + _MainPhysicalProperties ("'Main Properties' {Section:{Color:1}}", Float) = 0 + _Specularity ("'Specularity' {Min:0, Max:1}", Float) = 1 + _Roughness ("'Roughness' {Min:0, Max:1}", Float) = 1 + _Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _BumpScale ("'Normal Strength' {}", Float) = 1 + + // Eye Properties + _EyeProperties ("'Cornea' {Section:{Color:2}}", Float) = 0 + _EyeBumpMap ("'Normals' {Visualize:{NRM}, Parent:_MainTex}", 2D) = "bump" {} + _EyeCorneaWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _EyeRoughness ("'Roughness' {Min:0, Max:1}", Float) = 0 + + // Iris Properties + _IrisProperties ("'Iris' {Section:{Color:3}}", Float) = 0 + _EyeScleraColor("'Sclera Tint' {}", Color) = (1,1,1) + _EyeColor ("'Tint' {}", Color) = (1,1,1) + _EyeSpecularTint ("'Specular Tint' {Min:0, Max:1}", Float) = 1 + _EyeParallax ("'Depth' {Min:0, Max:0.08}", Float) = 0.08 + _EyePupilSize ("'Pupil Dilation' {Min:0, Max:1}", Float) = 0 + + // Detail + [Toggle(_DETAIL_MULX2)] + _DetailT ("'Detail' {Feature:{Color:7}}", Float) = 0 + [Enum(Mul, 0, MulX2, 1)] + _DetailMode ("'Color Mode' {Dropdown:{Mul:{}, MulX2:{}}}", Float) = 0 + _DetailAlbedoMap ("'Color(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _DetailAlbedoMapVelocity ("Scroll", Vector) = (0,0,0,0) + _DetailAlbedoMapUV ("UV Set", Float) = 0 + _DetailNormalMap ("'Normals' {Visualize:{NRM}, Parent:_DetailAlbedoMap}", 2D) = "bump" {} + _DetailWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DetailNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Decal + [Toggle(_DECAL_ON)] + _Decal ("'Decal' {Feature:{Color:9}}", Float) = 0 + _DecalColor ("'Tint' {}", Color) = (1,1,1,1) + _DecalTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "black" {} + _DecalTexUV ("UV Set", Float) = 0 + _DecalWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DecalSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _DecalAlphaVertexTint ("'Vertex Alpha Tint' {Min:0, Max:1}", Float) = 0 + + // Emission + [Toggle(_EMISSION)] + _Emission ("'Emission' {Feature:{Color:10}}", Float) = 0 + [LM_Emission] + [HDR] + _EmissionColor ("'Tint' {}", Color) = (1,1,1) + [LM_Emission] + _EmissionMap ("'Mask(RGB)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "white" {} + _IncandescenceMap ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _IncandescenceMapVelocity ("Scroll", Vector) = (0,0,0,0) + _IncandescenceMapUV ("UV Set", Float) = 0 + [Gamma] + _EmissionWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + + // Rim Emission + [Toggle(_RIM_ON)] + _Rim ("'Rim Emission' {Feature:{Color:11}}", Float) = 0 + [HDR] + _RimColor ("'Tint' {}", Color) = (1,1,1) + _RimTex ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _RimTexVelocity ("Scroll", Vector) = (0,0,0,0) + _RimTexUV ("UV Set", Float) = 0 + [Gamma] + _RimWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + [Gamma] + _RimBias ("'Fill' {Min:0, Max:1}", Float) = 0 + _RimPower ("'Falloff' {Min:0.01}", Float) = 4 + + // Dissolve + [Toggle(_DISSOLVE_ON)] + _Dissolve ("'Dissolve' {Feature:{Color:12}}", Float) = 0 + [HDR] + _DissolveGlowColor ("'Glow Tint' {}", Color) = (1,1,1,1) + _DissolveTex ("'Glow Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _DissolveTexUV ("UV Set", Float) = 0 + _DissolveCutoff ("'Cutoff' {Min:0, Max:1}", Float) = 0 + [Gamma] + _DissolveGlowWeight ("'Glow Weight' {Min:0, Max:1}", Float) = 1 + _DissolveEdgeWidth ("'Glow Width' {Min:0, Max:1}", Float) = 0.01 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _Lightmapping ("'GI' {LightmapEmissionProperty:{}}", Float) = 1 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} + +SubShader { + Tags { + "Queue" = "Geometry" + "RenderType" = "Opaque" + //"DisableBatching" = "LODFading" + } + LOD 400 + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Legacy/Shaders/Definition/Eyeball.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend One One + ZWrite Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _DECAL_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + + #include "Assets/Alloy/Legacy/Shaders/Definition/Eyeball.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _DISSOLVE_ON + + #pragma multi_compile_shadowcaster + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_SHADOWCASTER + + #include "Assets/Alloy/Legacy/Shaders/Definition/Eyeball.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } + + Pass { + Name "DEFERRED" + Tags { "LightMode" = "Deferred" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_prepassfinal + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_DEFERRED + + #include "Assets/Alloy/Legacy/Shaders/Definition/Eyeball.cginc" + #include "Assets/Alloy/Shaders/Forward/Gbuffer.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Legacy/Shaders/Definition/Eyeball.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +FallBack "VertexLit" +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Legacy/Shaders/3.0/Eye Eyeball.shader.meta b/Assets/Alloy/Legacy/Shaders/3.0/Eye Eyeball.shader.meta new file mode 100644 index 0000000..75e7761 --- /dev/null +++ b/Assets/Alloy/Legacy/Shaders/3.0/Eye Eyeball.shader.meta @@ -0,0 +1,22 @@ +fileFormatVersion: 2 +guid: 6e89d7e3bc26b204eb42d1294311d135 +timeCreated: 1439166597 +licenseType: Pro +ShaderImporter: + defaultTextures: + - _MainTex: {instanceID: 0} + - _SpecTex: {instanceID: 0} + - _BumpMap: {instanceID: 0} + - _EyeBumpMap: {instanceID: 0} + - _DetailAlbedoMap: {instanceID: 0} + - _DetailMaterialMap: {fileID: 2800000, guid: 2b77d5cb601375f4ba50c6194c126e59, + type: 3} + - _DetailNormalMap: {instanceID: 0} + - _DecalTex: {instanceID: 0} + - _EmissionMap: {instanceID: 0} + - _IncandescenceMap: {instanceID: 0} + - _RimTex: {instanceID: 0} + - _DissolveTex: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Legacy/Shaders/3.0/Eye Occlusion.shader b/Assets/Alloy/Legacy/Shaders/3.0/Eye Occlusion.shader new file mode 100644 index 0000000..803cda1 --- /dev/null +++ b/Assets/Alloy/Legacy/Shaders/3.0/Eye Occlusion.shader @@ -0,0 +1,86 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Legacy/Human/Eye/Occlusion" { +Properties { + // Main Textures + _MainTextures ("'Eye OcclusionTextures' {Section:{Color:0}}", Float) = 0 + _Color ("'Tint' {}", Color) = (1,1,1,1) + _MainTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _MainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _MainTexUV ("UV Set", Float) = 0 + _AoMap ("'Ambient Occlusion(G)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "white" {} + _BaseColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Main Properties + _MainPhysicalProperties ("'Main Properties' {Section:{Color:1}}", Float) = 0 + _Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + + // Dissolve + [Toggle(_DISSOLVE_ON)] + _Dissolve ("'Dissolve' {Feature:{Color:12}}", Float) = 0 + [HDR] + _DissolveGlowColor ("'Glow Tint' {}", Color) = (1,1,1,1) + _DissolveTex ("'Glow Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _DissolveTexUV ("UV Set", Float) = 0 + _DissolveCutoff ("'Cutoff' {Min:0, Max:1}", Float) = 0 + [Gamma] + _DissolveGlowWeight ("'Glow Weight' {Min:0, Max:1}", Float) = 1 + _DissolveEdgeWidth ("'Glow Width' {Min:0, Max:1}", Float) = 0.01 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} + +CGINCLUDE + #define _ALPHAPREMULTIPLY_ON +ENDCG + +SubShader { + Tags { + "Queue" = "Transparent-1" + "IgnoreProjector" = "True" + "RenderType" = "Transparent" + "ForceNoShadowCasting" = "True" + //"DisableBatching" = "LODFading" + } + LOD 400 + Offset -1,-1 + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + Blend SrcAlpha OneMinusSrcAlpha + ZWrite Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _DISSOLVE_ON + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Legacy/Shaders/Definition/EyeOcclusion.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } +} + +FallBack "VertexLit" +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Legacy/Shaders/3.0/Eye Occlusion.shader.meta b/Assets/Alloy/Legacy/Shaders/3.0/Eye Occlusion.shader.meta new file mode 100644 index 0000000..ded1a08 --- /dev/null +++ b/Assets/Alloy/Legacy/Shaders/3.0/Eye Occlusion.shader.meta @@ -0,0 +1,6 @@ +fileFormatVersion: 2 +guid: bf9bfe7eee33c564f8336f9a075aff86 +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: diff --git a/Assets/Alloy/Legacy/Shaders/3.0/Skin Forward.shader b/Assets/Alloy/Legacy/Shaders/3.0/Skin Forward.shader new file mode 100644 index 0000000..04a96b6 --- /dev/null +++ b/Assets/Alloy/Legacy/Shaders/3.0/Skin Forward.shader @@ -0,0 +1,272 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Legacy/Human/Skin (Forward)" { +Properties { + [Toggle(EFFECT_BUMP)] + _HasBumpMap ("'Normals Source' {Dropdown:{VertexNormals:{_BumpMap,_BumpScale,_SssBumpBlur,_DetailNormalMap,_DetailNormalMapScale,_WetNormalMap,_WetNormalMapScale}, NormalMaps:{}}}", Float) = 1 + + // Skin Textures + _MainTextures ("'Skin Textures' {Section:{Color:0}}", Float) = 0 + [LM_Albedo] [LM_Transparency] + _Color ("'Tint' {}", Color) = (1,1,1,1) + [LM_MasterTilingOffset] [LM_Albedo] + _MainTex ("'Base Color(RGB) SSS(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _MainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _MainTexUV ("UV Set", Float) = 0 + [LM_Metallic] + _SpecTex ("'Skin(R) AO(G) Spec(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_MainTex}", 2D) = "white" {} + [LM_NormalMap] + _BumpMap ("'Normals' {Visualize:{NRM}, Parent:_MainTex}", 2D) = "bump" {} + _BaseColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Skin Properties + _MainPhysicalProperties ("'Skin Properties' {Section:{Color:1}}", Float) = 0 + _Specularity ("'Specularity' {Min:0, Max:1}", Float) = 1 + _Roughness ("'Roughness' {Min:0, Max:1}", Float) = 1 + _Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _BumpScale ("'Normal Strength' {}", Float) = 1 + + // Scattering + _ScatteringProperties ("'Scattering' {Section:{Color:2}}", Float) = 0 + _SssBrdfTex ("'LUT' {Controls:False}", 2D) = "gray" {} + _SssBias ("'Bias' {Min:0, Max:1}", Float) = 0 + _SssScale ("'Scale' {Min:0, Max:1}", Float) = 1 + _SssAoSaturation ("'AO Saturation' {Min:0, Max:1}", Float) = 0.5 + _SssBumpBlur ("'Bump Blur' {Min:0, Max:1}", Float) = 0 + + // Transmission + _TransmissionProperties ("'Transmission' {Section:{Color:3}}", Float) = 0 + _TransColor ("'Tint' {}", Color) = (1,1,1) + [Gamma] + _TransScale ("'Weight' {Min:0, Max:1}", Float) = 1 + _TransPower ("'Falloff' {Min:1}", Float) = 1 + _TransDistortion ("'Bump Distortion' {Min:0, Max:1}", Float) = 0.1 + + // Detail + [Toggle(_DETAIL_MULX2)] + _DetailT ("'Detail' {Feature:{Color:7}}", Float) = 0 + [Toggle(_NORMALMAP)] + _DetailMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_DetailMask}}}", Float) = 0 + _DetailMask ("'Mask(A)' {Visualize:{A}, Parent:_MainTex}", 2D) = "white" {} + _DetailMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + [Enum(Mul, 0, MulX2, 1)] + _DetailMode ("'Color Mode' {Dropdown:{Mul:{}, MulX2:{}}}", Float) = 0 + _DetailAlbedoMap ("'Color(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _DetailAlbedoMapVelocity ("Scroll", Vector) = (0,0,0,0) + _DetailAlbedoMapUV ("UV Set", Float) = 0 + _DetailNormalMap ("'Normals' {Visualize:{NRM}, Parent:_DetailAlbedoMap}", 2D) = "bump" {} + _DetailWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DetailNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Team Color + [Toggle(_TEAMCOLOR_ON)] + _TeamColor ("'Team Color' {Feature:{Color:8}}", Float) = 0 + [Enum(Masks, 0, Tint, 1)] + _TeamColorMasksAsTint ("'Texture Mode' {Dropdown:{Masks:{}, Tint:{_TeamColorMasks, _TeamColor0, _TeamColor1, _TeamColor2, _TeamColor3}}}", Float) = 0 + _TeamColorMaskMap ("'Masks(RGBA)' {Visualize:{R, G, B, A, RGB}, Parent:_MainTex}", 2D) = "black" {} + _TeamColorMasks ("'Channels' {Vector:Channels}", Vector) = (1,1,1,0) + _TeamColor0 ("'Tint R' {}", Color) = (1,0,0) + _TeamColor1 ("'Tint G' {}", Color) = (0,1,0) + _TeamColor2 ("'Tint B' {}", Color) = (0,0,1) + _TeamColor3 ("'Tint A' {}", Color) = (0.5,0.5,0.5) + + // Decal + [Toggle(_DECAL_ON)] + _Decal ("'Decal' {Feature:{Color:9}}", Float) = 0 + _DecalColor ("'Tint' {}", Color) = (1,1,1,1) + _DecalTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "black" {} + _DecalTexUV ("UV Set", Float) = 0 + _DecalWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DecalSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _DecalAlphaVertexTint ("'Vertex Alpha Tint' {Min:0, Max:1}", Float) = 0 + + // Emission + [Toggle(_EMISSION)] + _Emission ("'Emission' {Feature:{Color:10}}", Float) = 0 + [LM_Emission] + [HDR] + _EmissionColor ("'Tint' {}", Color) = (1,1,1) + [LM_Emission] + _EmissionMap ("'Mask(RGB)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "white" {} + _IncandescenceMap ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _IncandescenceMapVelocity ("Scroll", Vector) = (0,0,0,0) + _IncandescenceMapUV ("UV Set", Float) = 0 + [Gamma] + _EmissionWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + + // Rim Emission + [Toggle(_RIM_ON)] + _Rim ("'Rim Emission' {Feature:{Color:11}}", Float) = 0 + [HDR] + _RimColor ("'Tint' {}", Color) = (1,1,1) + _RimTex ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _RimTexVelocity ("Scroll", Vector) = (0,0,0,0) + _RimTexUV ("UV Set", Float) = 0 + [Gamma] + _RimWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + [Gamma] + _RimBias ("'Fill' {Min:0, Max:1}", Float) = 0 + _RimPower ("'Falloff' {Min:0.01}", Float) = 4 + + // Dissolve + [Toggle(_DISSOLVE_ON)] + _Dissolve ("'Dissolve' {Feature:{Color:12}}", Float) = 0 + [HDR] + _DissolveGlowColor ("'Glow Tint' {}", Color) = (1,1,1,1) + _DissolveTex ("'Glow Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _DissolveTexUV ("UV Set", Float) = 0 + _DissolveCutoff ("'Cutoff' {Min:0, Max:1}", Float) = 0 + [Gamma] + _DissolveGlowWeight ("'Glow Weight' {Min:0, Max:1}", Float) = 1 + _DissolveEdgeWidth ("'Glow Width' {Min:0, Max:1}", Float) = 0.01 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _Lightmapping ("'GI' {LightmapEmissionProperty:{}}", Float) = 1 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} + +SubShader { + Tags { + "Queue" = "Geometry" + "RenderType" = "Opaque" + //"DisableBatching" = "LODFading" + } + LOD 400 + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Legacy/Shaders/Definition/SkinForward.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend One One + ZWrite Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + + #include "Assets/Alloy/Legacy/Shaders/Definition/SkinForward.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _DISSOLVE_ON + + #pragma multi_compile_shadowcaster + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_SHADOWCASTER + + #include "Assets/Alloy/Legacy/Shaders/Definition/SkinForward.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Legacy/Shaders/Definition/SkinForward.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +FallBack "VertexLit" +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Legacy/Shaders/3.0/Skin Forward.shader.meta b/Assets/Alloy/Legacy/Shaders/3.0/Skin Forward.shader.meta new file mode 100644 index 0000000..9081f99 --- /dev/null +++ b/Assets/Alloy/Legacy/Shaders/3.0/Skin Forward.shader.meta @@ -0,0 +1,21 @@ +fileFormatVersion: 2 +guid: 892fa42de78ef6445a6371150008d68a +ShaderImporter: + defaultTextures: + - _MainTex: {instanceID: 0} + - _SpecTex: {instanceID: 0} + - _BumpMap: {instanceID: 0} + - _SssBrdfTex: {fileID: 2800000, guid: d13510bb2be49aa40a66a0101efb6a36, type: 3} + - _DetailMask: {instanceID: 0} + - _DetailAlbedoMap: {instanceID: 0} + - _DetailMaterialMap: {fileID: 2800000, guid: 2b77d5cb601375f4ba50c6194c126e59, + type: 3} + - _DetailNormalMap: {instanceID: 0} + - _TeamColorMaskMap: {instanceID: 0} + - _DecalTex: {instanceID: 0} + - _EmissionMap: {instanceID: 0} + - _IncandescenceMap: {instanceID: 0} + - _RimTex: {instanceID: 0} + - _DissolveTex: {instanceID: 0} + userData: + assetBundleName: diff --git a/Assets/Alloy/Legacy/Shaders/3.0/Terrain 4Splat TriPlanar.shader b/Assets/Alloy/Legacy/Shaders/3.0/Terrain 4Splat TriPlanar.shader new file mode 100644 index 0000000..83ad5cb --- /dev/null +++ b/Assets/Alloy/Legacy/Shaders/3.0/Terrain 4Splat TriPlanar.shader @@ -0,0 +1,228 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Legacy/Nature/Terrain/4Splat TriPlanar" { +Properties { + // Splat 0 Properties + _Splat0Properties ("'Splat 0 Properties' {Section:{Color:0}}", Float) = 0 + _SplatSpecularity0 ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _SplatSpecularTint0 ("'Specular Tint' {Min:0, Max:1}", Float) = 0.0 + + // Splat 1 Properties + _Splat1Properties ("'Splat 1 Properties' {Section:{Color:0}}", Float) = 0 + _SplatSpecularity1 ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _SplatSpecularTint1 ("'Specular Tint' {Min:0, Max:1}", Float) = 0.0 + + // Splat 2 Properties + _Splat2Properties ("'Splat 2 Properties' {Section:{Color:0}}", Float) = 0 + _SplatSpecularity2 ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _SplatSpecularTint2 ("'Specular Tint' {Min:0, Max:1}", Float) = 0.0 + + // Splat 3 Properties + _Splat3Properties ("'Splat 3 Properties' {Section:{Color:0}}", Float) = 0 + _SplatSpecularity3 ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _SplatSpecularTint3 ("'Specular Tint' {Min:0, Max:1}", Float) = 0.0 + + // Distant Terrain + _DistantTerrainProperties ("'Distant Terrain' {Section:{Color:1}}", Float) = 0 + _FadeDist ("'Fade Distance' {Min:0}", Float) = 500.0 + _FadeRange ("'Fade Range' {Min:0.0001}", Float) = 100.0 + _DistantSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _DistantSpecularTint ("'Specular Tint' {Min:0, Max:1}", Float) = 0 + _DistantRoughness ("'Roughness' {Min:0, Max:1}", Float) = 0.5 + + // Triplanar + _TriplanarProperties ("'Triplanar' {Section:{Color:4}}", Float) = 0 + _TriplanarBlendSharpness ("'Sharpness' {Min:1, Max:50}", Float) = 2 + + // Detail + [Toggle(_DETAIL_MULX2)] + _DetailT ("'Detail' {Feature:{Color:7}}", Float) = 0 + [Enum(Mul, 0, MulX2, 1)] + _DetailMode ("'Color Mode' {Dropdown:{Mul:{}, MulX2:{}}}", Float) = 0 + _DetailAlbedoMap ("'Color(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _DetailNormalMap ("'Normals' {Visualize:{NRM}, Parent:_DetailAlbedoMap}", 2D) = "bump" {} + _DetailWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DetailNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _Lightmapping ("'GI' {LightmapEmissionProperty:{}}", Float) = 1 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + + // set by terrain engine + _Control ("Control (RGBA)", 2D) = "red" {} + _Splat3 ("Layer 3 (A)", 2D) = "white" {} + _Splat2 ("Layer 2 (B)", 2D) = "white" {} + _Splat1 ("Layer 1 (G)", 2D) = "white" {} + _Splat0 ("Layer 0 (R)", 2D) = "white" {} + _Normal3 ("Normal 3 (A)", 2D) = "bump" {} + _Normal2 ("Normal 2 (B)", 2D) = "bump" {} + _Normal1 ("Normal 1 (G)", 2D) = "bump" {} + _Normal0 ("Normal 0 (R)", 2D) = "bump" {} + _Metallic0 ("Metallic 0", Range(0.0, 1.0)) = 0.0 + _Metallic1 ("Metallic 1", Range(0.0, 1.0)) = 0.0 + _Metallic2 ("Metallic 2", Range(0.0, 1.0)) = 0.0 + _Metallic3 ("Metallic 3", Range(0.0, 1.0)) = 0.0 + + // used in fallback on old cards & base map + _MainTex ("BaseMap (RGB)", 2D) = "white" {} + _Color ("Main Color", Color) = (1,1,1,1) +} + +CGINCLUDE + #define _METALLICGLOSSMAP +ENDCG + +SubShader { + Tags { + "SplatCount" = "4" + "Queue" = "Geometry-100" + "RenderType" = "Opaque" + } + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + #pragma multi_compile __ _TERRAIN_NORMAL_MAP + + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Shaders/Definition/Terrain.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend One One + ZWrite Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + #pragma multi_compile __ _TERRAIN_NORMAL_MAP + + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + + #include "Assets/Alloy/Shaders/Definition/Terrain.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma multi_compile_shadowcaster + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_SHADOWCASTER + + #include "Assets/Alloy/Shaders/Definition/Terrain.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } + + Pass { + Name "DEFERRED" + Tags { "LightMode" = "Deferred" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + #pragma multi_compile __ _TERRAIN_NORMAL_MAP + + #pragma multi_compile_prepassfinal + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_DEFERRED + + #include "Assets/Alloy/Shaders/Definition/Terrain.cginc" + #include "Assets/Alloy/Shaders/Forward/Gbuffer.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _DETAIL_MULX2 + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Shaders/Definition/Terrain.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +Dependency "BaseMapShader" = "Hidden/Alloy/Nature/Terrain/Distant" + +Fallback "Hidden/Alloy/Nature/Terrain/Distant" +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Legacy/Shaders/3.0/Terrain 4Splat TriPlanar.shader.meta b/Assets/Alloy/Legacy/Shaders/3.0/Terrain 4Splat TriPlanar.shader.meta new file mode 100644 index 0000000..7a898f8 --- /dev/null +++ b/Assets/Alloy/Legacy/Shaders/3.0/Terrain 4Splat TriPlanar.shader.meta @@ -0,0 +1,23 @@ +fileFormatVersion: 2 +guid: 3c6bb95e34002934c85cc13970eee004 +timeCreated: 1456951947 +licenseType: Pro +ShaderImporter: + defaultTextures: + - _DetailAlbedoMap: {instanceID: 0} + - _DetailMaterialMap: {fileID: 2800000, guid: 2b77d5cb601375f4ba50c6194c126e59, + type: 3} + - _DetailNormalMap: {instanceID: 0} + - _Control: {instanceID: 0} + - _Splat3: {instanceID: 0} + - _Splat2: {instanceID: 0} + - _Splat1: {instanceID: 0} + - _Splat0: {instanceID: 0} + - _Normal3: {instanceID: 0} + - _Normal2: {instanceID: 0} + - _Normal1: {instanceID: 0} + - _Normal0: {instanceID: 0} + - _MainTex: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Legacy/Shaders/3.0/Terrain nSplat TriPlanar AddPass.shader b/Assets/Alloy/Legacy/Shaders/3.0/Terrain nSplat TriPlanar AddPass.shader new file mode 100644 index 0000000..61ee062 --- /dev/null +++ b/Assets/Alloy/Legacy/Shaders/3.0/Terrain nSplat TriPlanar AddPass.shader @@ -0,0 +1,213 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Hidden/Alloy/Legacy/Nature/Terrain/nSplat TriPlanar AddPass" { +Properties { + // Distant Terrain + _DistantTerrainProperties ("'Distant Terrain' {Section:{Color:1}}", Float) = 0 + _FadeDist ("'Fade Distance' {Min:0}", Float) = 500.0 + _FadeRange ("'Fade Range' {Min:0.0001}", Float) = 100.0 + _DistantSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _DistantSpecularTint ("'Specular Tint' {Min:0, Max:1}", Float) = 0 + _DistantRoughness ("'Roughness' {Min:0, Max:1}", Float) = 0.5 + + // Triplanar + _TriplanarProperties ("'Triplanar' {Section:{Color:4}}", Float) = 0 + _TriplanarBlendSharpness ("'Sharpness' {Min:1, Max:50}", Float) = 2 + + // Detail + [Toggle(_DETAIL_MULX2)] + _DetailT ("'Detail' {Feature:{Color:7}}", Float) = 0 + [Enum(Mul, 0, MulX2, 1)] + _DetailMode ("'Color Mode' {Dropdown:{Mul:{}, MulX2:{}}}", Float) = 0 + _DetailAlbedoMap ("'Color(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _DetailNormalMap ("'Normals' {Visualize:{NRM}, Parent:_DetailAlbedoMap}", 2D) = "bump" {} + _DetailWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DetailNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _Lightmapping ("'GI' {LightmapEmissionProperty:{}}", Float) = 1 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + + // set by terrain engine + _Control ("Control (RGBA)", 2D) = "red" {} + _Splat3 ("Layer 3 (A)", 2D) = "white" {} + _Splat2 ("Layer 2 (B)", 2D) = "white" {} + _Splat1 ("Layer 1 (G)", 2D) = "white" {} + _Splat0 ("Layer 0 (R)", 2D) = "white" {} + _Normal3 ("Normal 3 (A)", 2D) = "bump" {} + _Normal2 ("Normal 2 (B)", 2D) = "bump" {} + _Normal1 ("Normal 1 (G)", 2D) = "bump" {} + _Normal0 ("Normal 0 (R)", 2D) = "bump" {} + _Metallic0 ("Metallic 0", Range(0.0, 1.0)) = 0.0 + _Metallic1 ("Metallic 1", Range(0.0, 1.0)) = 0.0 + _Metallic2 ("Metallic 2", Range(0.0, 1.0)) = 0.0 + _Metallic3 ("Metallic 3", Range(0.0, 1.0)) = 0.0 + + // used in fallback on old cards & base map + _MainTex ("BaseMap (RGB)", 2D) = "white" {} + _Color ("Main Color", Color) = (1,1,1,1) +} + +CGINCLUDE + #define A_TERRAIN_NSPLAT_ADDPASS_SHADER + #define _METALLICGLOSSMAP + #define A_TERRAIN_NSPLAT_SHADER +ENDCG + +SubShader { + Tags{ + "Queue" = "Geometry-99" + "IgnoreProjector" = "True" + "RenderType" = "Opaque" + } + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + Blend One One + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + #pragma multi_compile __ _TERRAIN_NORMAL_MAP + + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Shaders/Definition/Terrain.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend One One + ZWrite Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + #pragma multi_compile __ _TERRAIN_NORMAL_MAP + + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + + #include "Assets/Alloy/Shaders/Definition/Terrain.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma multi_compile_shadowcaster + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_SHADOWCASTER + + #include "Assets/Alloy/Shaders/Definition/Terrain.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } + + Pass { + Name "DEFERRED" + Tags { "LightMode" = "Deferred" } + + Blend One One + ZWrite Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + #pragma multi_compile __ _TERRAIN_NORMAL_MAP + + #pragma multi_compile_prepassfinal + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_DEFERRED + + #include "Assets/Alloy/Shaders/Definition/Terrain.cginc" + #include "Assets/Alloy/Shaders/Forward/Gbuffer.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _DETAIL_MULX2 + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Shaders/Definition/Terrain.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +Fallback "Hidden/Alloy/Nature/Terrain/Distant" +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Legacy/Shaders/3.0/Terrain nSplat TriPlanar AddPass.shader.meta b/Assets/Alloy/Legacy/Shaders/3.0/Terrain nSplat TriPlanar AddPass.shader.meta new file mode 100644 index 0000000..2d6e322 --- /dev/null +++ b/Assets/Alloy/Legacy/Shaders/3.0/Terrain nSplat TriPlanar AddPass.shader.meta @@ -0,0 +1,23 @@ +fileFormatVersion: 2 +guid: 193d0086544cd0a4f965e6a50b5ac986 +timeCreated: 1456951922 +licenseType: Pro +ShaderImporter: + defaultTextures: + - _DetailAlbedoMap: {instanceID: 0} + - _DetailMaterialMap: {fileID: 2800000, guid: 2b77d5cb601375f4ba50c6194c126e59, + type: 3} + - _DetailNormalMap: {instanceID: 0} + - _Control: {instanceID: 0} + - _Splat3: {instanceID: 0} + - _Splat2: {instanceID: 0} + - _Splat1: {instanceID: 0} + - _Splat0: {instanceID: 0} + - _Normal3: {instanceID: 0} + - _Normal2: {instanceID: 0} + - _Normal1: {instanceID: 0} + - _Normal0: {instanceID: 0} + - _MainTex: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Legacy/Shaders/3.0/Terrain nSplat TriPlanar FirstPass.shader b/Assets/Alloy/Legacy/Shaders/3.0/Terrain nSplat TriPlanar FirstPass.shader new file mode 100644 index 0000000..d21beec --- /dev/null +++ b/Assets/Alloy/Legacy/Shaders/3.0/Terrain nSplat TriPlanar FirstPass.shader @@ -0,0 +1,209 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Legacy/Nature/Terrain/nSplat TriPlanar" { +Properties { + // Distant Terrain + _DistantTerrainProperties ("'Distant Terrain' {Section:{Color:1}}", Float) = 0 + _FadeDist ("'Fade Distance' {Min:0}", Float) = 500.0 + _FadeRange ("'Fade Range' {Min:0.0001}", Float) = 100.0 + _DistantSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _DistantSpecularTint ("'Specular Tint' {Min:0, Max:1}", Float) = 0 + _DistantRoughness ("'Roughness' {Min:0, Max:1}", Float) = 0.5 + + // Triplanar + _TriplanarProperties ("'Triplanar' {Section:{Color:4}}", Float) = 0 + _TriplanarBlendSharpness ("'Sharpness' {Min:1, Max:50}", Float) = 2 + + // Detail + [Toggle(_DETAIL_MULX2)] + _DetailT ("'Detail' {Feature:{Color:7}}", Float) = 0 + [Enum(Mul, 0, MulX2, 1)] + _DetailMode ("'Color Mode' {Dropdown:{Mul:{}, MulX2:{}}}", Float) = 0 + _DetailAlbedoMap ("'Color(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _DetailNormalMap ("'Normals' {Visualize:{NRM}, Parent:_DetailAlbedoMap}", 2D) = "bump" {} + _DetailWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DetailNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _Lightmapping ("'GI' {LightmapEmissionProperty:{}}", Float) = 1 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + + // set by terrain engine + _Control ("Control (RGBA)", 2D) = "red" {} + _Splat3 ("Layer 3 (A)", 2D) = "white" {} + _Splat2 ("Layer 2 (B)", 2D) = "white" {} + _Splat1 ("Layer 1 (G)", 2D) = "white" {} + _Splat0 ("Layer 0 (R)", 2D) = "white" {} + _Normal3 ("Normal 3 (A)", 2D) = "bump" {} + _Normal2 ("Normal 2 (B)", 2D) = "bump" {} + _Normal1 ("Normal 1 (G)", 2D) = "bump" {} + _Normal0 ("Normal 0 (R)", 2D) = "bump" {} + _Metallic0 ("Metallic 0", Range(0.0, 1.0)) = 0.0 + _Metallic1 ("Metallic 1", Range(0.0, 1.0)) = 0.0 + _Metallic2 ("Metallic 2", Range(0.0, 1.0)) = 0.0 + _Metallic3 ("Metallic 3", Range(0.0, 1.0)) = 0.0 + + // used in fallback on old cards & base map + _MainTex ("BaseMap (RGB)", 2D) = "white" {} + _Color ("Main Color", Color) = (1,1,1,1) +} + +CGINCLUDE + #define _METALLICGLOSSMAP + #define A_TERRAIN_NSPLAT_SHADER +ENDCG + +SubShader { + Tags{ + "Queue" = "Geometry-100" + "RenderType" = "Opaque" + } + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + #pragma multi_compile __ _TERRAIN_NORMAL_MAP + + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Shaders/Definition/Terrain.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend One One + ZWrite Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + #pragma multi_compile __ _TERRAIN_NORMAL_MAP + + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + + #include "Assets/Alloy/Shaders/Definition/Terrain.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma multi_compile_shadowcaster + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_SHADOWCASTER + + #include "Assets/Alloy/Shaders/Definition/Terrain.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } + + Pass { + Name "DEFERRED" + Tags { "LightMode" = "Deferred" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + #pragma multi_compile __ _TERRAIN_NORMAL_MAP + + #pragma multi_compile_prepassfinal + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_DEFERRED + + #include "Assets/Alloy/Shaders/Definition/Terrain.cginc" + #include "Assets/Alloy/Shaders/Forward/Gbuffer.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _DETAIL_MULX2 + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Shaders/Definition/Terrain.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +Dependency "AddPassShader" = "Hidden/Alloy/Legacy/Nature/Terrain/nSplat TriPlanar AddPass" +Dependency "BaseMapShader" = "Hidden/Alloy/Nature/Terrain/Distant" + +Fallback "Hidden/Alloy/Nature/Terrain/Distant" +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Legacy/Shaders/3.0/Terrain nSplat TriPlanar FirstPass.shader.meta b/Assets/Alloy/Legacy/Shaders/3.0/Terrain nSplat TriPlanar FirstPass.shader.meta new file mode 100644 index 0000000..49cc57c --- /dev/null +++ b/Assets/Alloy/Legacy/Shaders/3.0/Terrain nSplat TriPlanar FirstPass.shader.meta @@ -0,0 +1,23 @@ +fileFormatVersion: 2 +guid: e82d56854c63d4e4295dc63c542b0649 +timeCreated: 1456951907 +licenseType: Pro +ShaderImporter: + defaultTextures: + - _DetailAlbedoMap: {instanceID: 0} + - _DetailMaterialMap: {fileID: 2800000, guid: 2b77d5cb601375f4ba50c6194c126e59, + type: 3} + - _DetailNormalMap: {instanceID: 0} + - _Control: {instanceID: 0} + - _Splat3: {instanceID: 0} + - _Splat2: {instanceID: 0} + - _Splat1: {instanceID: 0} + - _Splat0: {instanceID: 0} + - _Normal3: {instanceID: 0} + - _Normal2: {instanceID: 0} + - _Normal1: {instanceID: 0} + - _Normal0: {instanceID: 0} + - _MainTex: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Legacy/Shaders/3.0/TriPlanar Lite.shader b/Assets/Alloy/Legacy/Shaders/3.0/TriPlanar Lite.shader new file mode 100644 index 0000000..cbd0012 --- /dev/null +++ b/Assets/Alloy/Legacy/Shaders/3.0/TriPlanar Lite.shader @@ -0,0 +1,274 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Legacy/TriPlanar/Lite" { +Properties { + // Global Settings + _Mode ("'Rendering Mode' {RenderingMode:{Opaque:{_Cutoff}, Cutout:{}, Fade:{_Cutoff}, Transparent:{_Cutoff}}}", Float) = 0 + _SrcBlend ("__src", Float) = 0 + _DstBlend ("__dst", Float) = 0 + _ZWrite ("__zw", Float) = 1 + [LM_TransparencyCutOff] + _Cutoff ("'Opacity Cutoff' {Min:0, Max:1}", Float) = 0.5 + [Toggle(EFFECT_BUMP)] + _HasBumpMap ("'Normals Source' {Dropdown:{VertexNormals:{_PrimaryBumpMap,_PrimaryBumpScale,_SecondaryBumpMap,_SecondaryBumpScale,_TertiaryBumpMap,_TertiaryBumpScale,_QuaternaryBumpMap,_QuaternaryBumpScale}, NormalMaps:{}}}", Float) = 1 + + // Primary Textures + _PrimaryTextures ("'Primary Textures' {Section:{Color:0}}", Float) = 0 + _PrimaryColor ("'Tint' {}", Color) = (1,1,1,1) + _PrimaryMainTex ("'Base Color(RGB) Rough(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _PrimaryMainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _PrimaryBumpMap ("'Normals' {Visualize:{NRM}, Parent:_PrimaryMainTex}", 2D) = "bump" {} + _PrimaryColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + _PrimaryMetallic ("'Metallic' {Min:0, Max:1}", Float) = 0 + _PrimarySpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _PrimarySpecularTint ("'Specular Tint' {Min:0, Max:1}", Float) = 0 + _PrimaryRoughness ("'Roughness' {Min:0, Max:1}", Float) = 1 + _PrimaryBumpScale ("'Normal Strength' {}", Float) = 1 + + // Secondary Textures + [Toggle(_SECONDARY_TRIPLANAR_ON)] + _SecondaryTextures ("'Secondary Textures' {Feature:{Color:1}}", Float) = 0 + _SecondaryColor ("'Tint' {}", Color) = (1,1,1,1) + _SecondaryMainTex ("'Base Color(RGB) Rough(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _SecondaryMainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _SecondaryBumpMap ("'Normals' {Visualize:{NRM}, Parent:_SecondaryMainTex}", 2D) = "bump" {} + _SecondaryColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + _SecondaryMetallic ("'Metallic' {Min:0, Max:1}", Float) = 0 + _SecondarySpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _SecondarySpecularTint ("'Specular Tint' {Min:0, Max:1}", Float) = 0 + _SecondaryRoughness ("'Roughness' {Min:0, Max:1}", Float) = 1 + _SecondaryBumpScale ("'Normal Strength' {}", Float) = 1 + + // Tertiary Textures + [Toggle(_TERTIARY_TRIPLANAR_ON)] + _TertiaryTextures ("'Tertiary Textures' {Feature:{Color:2}}", Float) = 0 + _TertiaryColor ("'Tint' {}", Color) = (1,1,1,1) + _TertiaryMainTex ("'Base Color(RGB) Rough(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _TertiaryMainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _TertiaryBumpMap ("'Normals' {Visualize:{NRM}, Parent:_TertiaryMainTex}", 2D) = "bump" {} + _TertiaryColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + _TertiaryMetallic ("'Metallic' {Min:0, Max:1}", Float) = 0 + _TertiarySpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _TertiarySpecularTint ("'Specular Tint' {Min:0, Max:1}", Float) = 0 + _TertiaryRoughness ("'Roughness' {Min:0, Max:1}", Float) = 1 + _TertiaryBumpScale ("'Normal Strength' {}", Float) = 1 + + // Quaternary Textures + [Toggle(_QUATERNARY_TRIPLANAR_ON)] + _QuaternaryTextures ("'Quaternary Textures' {Feature:{Color:3}}", Float) = 0 + _QuaternaryColor ("'Tint' {}", Color) = (1,1,1,1) + _QuaternaryMainTex ("'Base Color(RGB) Rough(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _QuaternaryMainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _QuaternaryBumpMap ("'Normals' {Visualize:{NRM}, Parent:_QuaternaryMainTex}", 2D) = "bump" {} + _QuaternaryColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + _QuaternaryMetallic ("'Metallic' {Min:0, Max:1}", Float) = 0 + _QuaternarySpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _QuaternarySpecularTint ("'Specular Tint' {Min:0, Max:1}", Float) = 0 + _QuaternaryRoughness ("'Roughness' {Min:0, Max:1}", Float) = 1 + _QuaternaryBumpScale ("'Normal Strength' {}", Float) = 1 + + // Triplanar + _TriplanarProperties ("'Triplanar' {Section:{Color:4}}", Float) = 0 + [Toggle(_TRIPLANARMODE_WORLD)] + _TriplanarMode ("'Mode' {Dropdown:{Object:{}, World:{}}}", Float) = 1 + _TriplanarBlendSharpness ("'Sharpness' {Min:1, Max:50}", Float) = 2 + + // Rim Emission + [Toggle(_RIM_ON)] + _Rim ("'Rim Emission' {Feature:{Color:11}}", Float) = 0 + [HDR] + _RimColor ("'Tint' {}", Color) = (1,1,1) + [Gamma] + _RimWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + [Gamma] + _RimBias ("'Fill' {Min:0, Max:1}", Float) = 0 + _RimPower ("'Falloff' {Min:0.01}", Float) = 4 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _Lightmapping ("'GI' {LightmapEmissionProperty:{}}", Float) = 1 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} + +SubShader { + Tags { + "Queue" = "Geometry" + "RenderType" = "Opaque" + //"DisableBatching" = "LODFading" + } + LOD 400 + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + Blend [_SrcBlend] [_DstBlend] + ZWrite [_ZWrite] + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _TRIPLANARMODE_WORLD + #pragma shader_feature _SECONDARY_TRIPLANAR_ON + #pragma shader_feature _TERTIARY_TRIPLANAR_ON + #pragma shader_feature _QUATERNARY_TRIPLANAR_ON + #pragma shader_feature _RIM_ON + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Legacy/Shaders/Definition/TriPlanar.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend [_SrcBlend] One + ZWrite Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _TRIPLANARMODE_WORLD + #pragma shader_feature _SECONDARY_TRIPLANAR_ON + #pragma shader_feature _TERTIARY_TRIPLANAR_ON + #pragma shader_feature _QUATERNARY_TRIPLANAR_ON + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + + #include "Assets/Alloy/Legacy/Shaders/Definition/TriPlanar.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature _TRIPLANARMODE_WORLD + #pragma shader_feature _SECONDARY_TRIPLANAR_ON + #pragma shader_feature _TERTIARY_TRIPLANAR_ON + #pragma shader_feature _QUATERNARY_TRIPLANAR_ON + + #pragma multi_compile_shadowcaster + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_SHADOWCASTER + + #include "Assets/Alloy/Legacy/Shaders/Definition/TriPlanar.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } + + Pass { + Name "DEFERRED" + Tags { "LightMode" = "Deferred" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _TRIPLANARMODE_WORLD + #pragma shader_feature _SECONDARY_TRIPLANAR_ON + #pragma shader_feature _TERTIARY_TRIPLANAR_ON + #pragma shader_feature _QUATERNARY_TRIPLANAR_ON + #pragma shader_feature _RIM_ON + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_prepassfinal + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_DEFERRED + + #include "Assets/Alloy/Legacy/Shaders/Definition/TriPlanar.cginc" + #include "Assets/Alloy/Shaders/Forward/Gbuffer.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _TRIPLANARMODE_WORLD + #pragma shader_feature _SECONDARY_TRIPLANAR_ON + #pragma shader_feature _TERTIARY_TRIPLANAR_ON + #pragma shader_feature _QUATERNARY_TRIPLANAR_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Legacy/Shaders/Definition/TriPlanar.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +FallBack "VertexLit" +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Legacy/Shaders/3.0/TriPlanar Lite.shader.meta b/Assets/Alloy/Legacy/Shaders/3.0/TriPlanar Lite.shader.meta new file mode 100644 index 0000000..b85888c --- /dev/null +++ b/Assets/Alloy/Legacy/Shaders/3.0/TriPlanar Lite.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 52a4bae08c3e93d4e8afd6dba372345e +timeCreated: 1432476384 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Legacy/Shaders/3.0/Vertex Blend 4Splat TriPlanar.shader b/Assets/Alloy/Legacy/Shaders/3.0/Vertex Blend 4Splat TriPlanar.shader new file mode 100644 index 0000000..6ec97ec --- /dev/null +++ b/Assets/Alloy/Legacy/Shaders/3.0/Vertex Blend 4Splat TriPlanar.shader @@ -0,0 +1,278 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Legacy/Vertex Blend/4Splat TriPlanar" { +Properties { + // Global Settings + _Mode ("'Rendering Mode' {RenderingMode:{Opaque:{_Cutoff}, Cutout:{}, Fade:{_Cutoff}, Transparent:{_Cutoff}}}", Float) = 0 + _SrcBlend ("__src", Float) = 0 + _DstBlend ("__dst", Float) = 0 + _ZWrite ("__zw", Float) = 1 + [LM_TransparencyCutOff] + _Cutoff ("'Opacity Cutoff' {Min:0, Max:1}", Float) = 0.5 + [Toggle(EFFECT_BUMP)] + _HasBumpMap ("'Normals Source' {Dropdown:{VertexNormals:{_Normal0,_Normal1,_Normal2,_Normal3,_DetailNormalMap,_DetailNormalMapScale}, NormalMaps:{}}}", Float) = 1 + + // Splat0 Properties + _Splat0Properties ("'Splat0' {Section:{Color:0}}", Float) = 0 + _Splat0Tint ("'Tint' {}", Color) = (1,1,1,1) + _Splat0 ("'Base Color(RGB) Rough(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _Splat0Velocity ("Scroll", Vector) = (0,0,0,0) + _Normal0 ("'Normals' {Visualize:{NRM}, Parent:_Splat0}", 2D) = "bump" {} + _Metallic0 ("'Metallic' {Min:0, Max:1}", Float) = 0.0 + _SplatSpecularity0 ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _SplatSpecularTint0 ("'Specular Tint' {Min:0, Max:1}", Float) = 0.0 + _SplatRoughness0 ("'Roughness' {Min:0, Max:1}", Float) = 1.0 + + // Splat1 Properties + _Splat1Properties ("'Splat1' {Section:{Color:1}}", Float) = 0 + _Splat1Tint ("'Tint' {}", Color) = (1,1,1,1) + _Splat1 ("'Base Color(RGB) Rough(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _Splat1Velocity ("Scroll", Vector) = (0,0,0,0) + _Normal1 ("'Normals' {Visualize:{NRM}, Parent:_Splat1}", 2D) = "bump" {} + _Metallic1 ("'Metallic' {Min:0, Max:1}", Float) = 0.0 + _SplatSpecularity1 ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _SplatSpecularTint1 ("'Specular Tint' {Min:0, Max:1}", Float) = 0.0 + _SplatRoughness1 ("'Roughness' {Min:0, Max:1}", Float) = 1.0 + + // Splat2 Properties + _Splat2Properties ("'Splat2' {Section:{Color:2}}", Float) = 0 + _Splat2Tint ("'Tint' {}", Color) = (1,1,1,1) + _Splat2 ("'Base Color(RGB) Rough(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _Splat2Velocity ("Scroll", Vector) = (0,0,0,0) + _Normal2 ("'Normals' {Visualize:{NRM}, Parent:_Splat2}", 2D) = "bump" {} + _Metallic2 ("'Metallic' {Min:0, Max:1}", Float) = 0.0 + _SplatSpecularity2 ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _SplatSpecularTint2 ("'Specular Tint' {Min:0, Max:1}", Float) = 0.0 + _SplatRoughness2 ("'Roughness' {Min:0, Max:1}", Float) = 1.0 + + // Splat3 Properties + _Splat3Properties ("'Splat3' {Section:{Color:3}}", Float) = 0 + _Splat3Tint ("'Tint' {}", Color) = (1,1,1,1) + _Splat3 ("'Base Color(RGB) Rough(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _Splat3Velocity ("Scroll", Vector) = (0,0,0,0) + _Normal3 ("'Normals' {Visualize:{NRM}, Parent:_Splat3}", 2D) = "bump" {} + _Metallic3 ("'Metallic' {Min:0, Max:1}", Float) = 0.0 + _SplatSpecularity3 ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _SplatSpecularTint3 ("'Specular Tint' {Min:0, Max:1}", Float) = 0.0 + _SplatRoughness3 ("'Roughness' {Min:0, Max:1}", Float) = 1.0 + + // Triplanar + _TriplanarProperties ("'Triplanar' {Section:{Color:4}}", Float) = 0 + [Toggle(_TRIPLANARMODE_WORLD)] + _TriplanarMode ("'Mode' {Dropdown:{Object:{}, World:{}}}", Float) = 1 + _TriplanarBlendSharpness ("'Sharpness' {Min:1, Max:50}", Float) = 2 + + // AO2 + [Toggle(_AO2_ON)] + _AO2 ("'AO2' {Feature:{Color:6}}", Float) = 0 + _Ao2Map ("'AO2(G)' {Visualize:{RGB}}", 2D) = "white" {} + _Ao2MapUV ("UV Set", Float) = 1 + _Ao2Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + + // Detail + [Toggle(_DETAIL_MULX2)] + _DetailT ("'Detail' {Feature:{Color:7}}", Float) = 0 + [Enum(Mul, 0, MulX2, 1)] + _DetailMode ("'Color Mode' {Dropdown:{Mul:{}, MulX2:{}}}", Float) = 0 + _DetailAlbedoMap ("'Color(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _DetailAlbedoMapUV ("UV Set", Float) = 0 + _DetailNormalMap ("'Normals' {Visualize:{NRM}, Parent:_DetailAlbedoMap}", 2D) = "bump" {} + _DetailWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DetailNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Decal + [Toggle(_DECAL_ON)] + _Decal ("'Decal' {Feature:{Color:9}}", Float) = 0 + _DecalColor ("'Tint' {}", Color) = (1,1,1,1) + _DecalTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "black" {} + _DecalTexUV ("UV Set", Float) = 0 + _DecalWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DecalSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _DecalAlphaVertexTint ("'Vertex Alpha Tint' {Min:0, Max:1}", Float) = 0 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _Lightmapping ("'GI' {LightmapEmissionProperty:{}}", Float) = 1 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} + +CGINCLUDE + #define _METALLICGLOSSMAP +ENDCG + +SubShader { + Tags { + "Queue" = "Geometry" + "RenderType" = "Opaque" + //"DisableBatching" = "LODFading" + } + LOD 400 + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + Blend [_SrcBlend] [_DstBlend] + ZWrite [_ZWrite] + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _TRIPLANARMODE_WORLD + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _DECAL_ON + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Legacy/Shaders/Definition/VertexBlend.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend [_SrcBlend] One + ZWrite Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _TRIPLANARMODE_WORLD + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _DECAL_ON + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + + #include "Assets/Alloy/Legacy/Shaders/Definition/VertexBlend.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature _TRIPLANARMODE_WORLD + + #pragma multi_compile_shadowcaster + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_SHADOWCASTER + + #include "Assets/Alloy/Legacy/Shaders/Definition/VertexBlend.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } + + Pass { + Name "DEFERRED" + Tags { "LightMode" = "Deferred" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _TRIPLANARMODE_WORLD + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _DECAL_ON + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_prepassfinal + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_DEFERRED + + #include "Assets/Alloy/Legacy/Shaders/Definition/VertexBlend.cginc" + #include "Assets/Alloy/Shaders/Forward/Gbuffer.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _TRIPLANARMODE_WORLD + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _DECAL_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Legacy/Shaders/Definition/VertexBlend.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +Fallback "VertexLit" +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Legacy/Shaders/3.0/Vertex Blend 4Splat TriPlanar.shader.meta b/Assets/Alloy/Legacy/Shaders/3.0/Vertex Blend 4Splat TriPlanar.shader.meta new file mode 100644 index 0000000..c57e786 --- /dev/null +++ b/Assets/Alloy/Legacy/Shaders/3.0/Vertex Blend 4Splat TriPlanar.shader.meta @@ -0,0 +1,21 @@ +fileFormatVersion: 2 +guid: 71329306b34654143a1092afc9197576 +timeCreated: 1456952688 +licenseType: Pro +ShaderImporter: + defaultTextures: + - _Splat0: {instanceID: 0} + - _Normal0: {instanceID: 0} + - _Splat1: {instanceID: 0} + - _Normal1: {instanceID: 0} + - _Splat2: {instanceID: 0} + - _Normal2: {instanceID: 0} + - _Splat3: {instanceID: 0} + - _Normal3: {instanceID: 0} + - _DetailAlbedoMap: {instanceID: 0} + - _DetailMaterialMap: {fileID: 2800000, guid: 2b77d5cb601375f4ba50c6194c126e59, + type: 3} + - _DetailNormalMap: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Legacy/Shaders/3.0/Vertex Blend 4Splat.shader b/Assets/Alloy/Legacy/Shaders/3.0/Vertex Blend 4Splat.shader new file mode 100644 index 0000000..00d5146 --- /dev/null +++ b/Assets/Alloy/Legacy/Shaders/3.0/Vertex Blend 4Splat.shader @@ -0,0 +1,267 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Legacy/Vertex Blend/4Splat" { +Properties { + // Global Settings + _Mode ("'Rendering Mode' {RenderingMode:{Opaque:{_Cutoff}, Cutout:{}, Fade:{_Cutoff}, Transparent:{_Cutoff}}}", Float) = 0 + _SrcBlend ("__src", Float) = 0 + _DstBlend ("__dst", Float) = 0 + _ZWrite ("__zw", Float) = 1 + [LM_TransparencyCutOff] + _Cutoff ("'Opacity Cutoff' {Min:0, Max:1}", Float) = 0.5 + [Toggle(EFFECT_BUMP)] + _HasBumpMap ("'Normals Source' {Dropdown:{VertexNormals:{_Normal0,_Normal1,_Normal2,_Normal3,_DetailNormalMap,_DetailNormalMapScale}, NormalMaps:{}}}", Float) = 1 + + // Splat0 Properties + _Splat0Properties ("'Splat0' {Section:{Color:0}}", Float) = 0 + _Splat0Tint ("'Tint' {}", Color) = (1,1,1,1) + _Splat0 ("'Base Color(RGB) Rough(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _Splat0Velocity ("Scroll", Vector) = (0,0,0,0) + _Splat0UV ("UV Set", Float) = 0 + _Normal0 ("'Normals' {Visualize:{NRM}, Parent:_Splat0}", 2D) = "bump" {} + _Metallic0 ("'Metallic' {Min:0, Max:1}", Float) = 0.0 + _SplatSpecularity0 ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _SplatSpecularTint0 ("'Specular Tint' {Min:0, Max:1}", Float) = 0.0 + _SplatRoughness0 ("'Roughness' {Min:0, Max:1}", Float) = 1.0 + + // Splat1 Properties + _Splat1Properties ("'Splat1' {Section:{Color:0}}", Float) = 0 + _Splat1Tint ("'Tint' {}", Color) = (1,1,1,1) + _Splat1 ("'Base Color(RGB) Rough(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _Splat1Velocity ("Scroll", Vector) = (0,0,0,0) + _Splat1UV ("UV Set", Float) = 0 + _Normal1 ("'Normals' {Visualize:{NRM}, Parent:_Splat1}", 2D) = "bump" {} + _Metallic1 ("'Metallic' {Min:0, Max:1}", Float) = 0.0 + _SplatSpecularity1 ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _SplatSpecularTint1 ("'Specular Tint' {Min:0, Max:1}", Float) = 0.0 + _SplatRoughness1 ("'Roughness' {Min:0, Max:1}", Float) = 1.0 + + // Splat2 Properties + _Splat2Properties ("'Splat2' {Section:{Color:0}}", Float) = 0 + _Splat2Tint ("'Tint' {}", Color) = (1,1,1,1) + _Splat2 ("'Base Color(RGB) Rough(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _Splat2Velocity ("Scroll", Vector) = (0,0,0,0) + _Splat2UV ("UV Set", Float) = 0 + _Normal2 ("'Normals' {Visualize:{NRM}, Parent:_Splat2}", 2D) = "bump" {} + _Metallic2 ("'Metallic' {Min:0, Max:1}", Float) = 0.0 + _SplatSpecularity2 ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _SplatSpecularTint2 ("'Specular Tint' {Min:0, Max:1}", Float) = 0.0 + _SplatRoughness2 ("'Roughness' {Min:0, Max:1}", Float) = 1.0 + + // Splat3 Properties + _Splat3Properties ("'Splat3' {Section:{Color:0}}", Float) = 0 + _Splat3Tint ("'Tint' {}", Color) = (1,1,1,1) + _Splat3 ("'Base Color(RGB) Rough(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _Splat3Velocity ("Scroll", Vector) = (0,0,0,0) + _Splat3UV ("UV Set", Float) = 0 + _Normal3 ("'Normals' {Visualize:{NRM}, Parent:_Splat3}", 2D) = "bump" {} + _Metallic3 ("'Metallic' {Min:0, Max:1}", Float) = 0.0 + _SplatSpecularity3 ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _SplatSpecularTint3 ("'Specular Tint' {Min:0, Max:1}", Float) = 0.0 + _SplatRoughness3 ("'Roughness' {Min:0, Max:1}", Float) = 1.0 + + // AO2 + [Toggle(_AO2_ON)] + _AO2 ("'AO2' {Feature:{Color:6}}", Float) = 0 + _Ao2Map ("'AO2(G)' {Visualize:{RGB}}", 2D) = "white" {} + _Ao2MapUV ("UV Set", Float) = 1 + _Ao2Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + + // Detail + [Toggle(_DETAIL_MULX2)] + _DetailT ("'Detail' {Feature:{Color:7}}", Float) = 0 + [Enum(Mul, 0, MulX2, 1)] + _DetailMode ("'Color Mode' {Dropdown:{Mul:{}, MulX2:{}}}", Float) = 0 + _DetailAlbedoMap ("'Color(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _DetailAlbedoMapUV ("UV Set", Float) = 0 + _DetailNormalMap ("'Normals' {Visualize:{NRM}, Parent:_DetailAlbedoMap}", 2D) = "bump" {} + _DetailWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DetailNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Decal + [Toggle(_DECAL_ON)] + _Decal ("'Decal' {Feature:{Color:9}}", Float) = 0 + _DecalColor ("'Tint' {}", Color) = (1,1,1,1) + _DecalTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "black" {} + _DecalTexUV ("UV Set", Float) = 0 + _DecalWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DecalSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _DecalAlphaVertexTint ("'Vertex Alpha Tint' {Min:0, Max:1}", Float) = 0 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _Lightmapping ("'GI' {LightmapEmissionProperty:{}}", Float) = 1 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} + +SubShader { + Tags { + "RenderType" = "Opaque" + "PerformanceChecks" = "False" + //"DisableBatching" = "LODFading" + } + LOD 300 + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + Blend [_SrcBlend] [_DstBlend] + ZWrite [_ZWrite] + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _DECAL_ON + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Legacy/Shaders/Definition/VertexBlend.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend [_SrcBlend] One + ZWrite Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _DECAL_ON + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + + #include "Assets/Alloy/Legacy/Shaders/Definition/VertexBlend.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + + #pragma multi_compile_shadowcaster + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_SHADOWCASTER + + #include "Assets/Alloy/Legacy/Shaders/Definition/VertexBlend.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } + + Pass { + Name "DEFERRED" + Tags { "LightMode" = "Deferred" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _DECAL_ON + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_prepassfinal + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_DEFERRED + + #include "Assets/Alloy/Legacy/Shaders/Definition/VertexBlend.cginc" + #include "Assets/Alloy/Shaders/Forward/Gbuffer.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _DECAL_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Legacy/Shaders/Definition/VertexBlend.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +Fallback "VertexLit" +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Legacy/Shaders/3.0/Vertex Blend 4Splat.shader.meta b/Assets/Alloy/Legacy/Shaders/3.0/Vertex Blend 4Splat.shader.meta new file mode 100644 index 0000000..03e3ab2 --- /dev/null +++ b/Assets/Alloy/Legacy/Shaders/3.0/Vertex Blend 4Splat.shader.meta @@ -0,0 +1,21 @@ +fileFormatVersion: 2 +guid: 7444e11578bca814e8e904991541ad38 +timeCreated: 1430267036 +licenseType: Pro +ShaderImporter: + defaultTextures: + - _Splat0: {instanceID: 0} + - _Normal0: {instanceID: 0} + - _Splat1: {instanceID: 0} + - _Normal1: {instanceID: 0} + - _Splat2: {instanceID: 0} + - _Normal2: {instanceID: 0} + - _Splat3: {instanceID: 0} + - _Normal3: {instanceID: 0} + - _DetailAlbedoMap: {instanceID: 0} + - _DetailMaterialMap: {fileID: 2800000, guid: 2b77d5cb601375f4ba50c6194c126e59, + type: 3} + - _DetailNormalMap: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Legacy/Shaders/4.6.meta b/Assets/Alloy/Legacy/Shaders/4.6.meta new file mode 100644 index 0000000..f3eea03 --- /dev/null +++ b/Assets/Alloy/Legacy/Shaders/4.6.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 538255ee068bbd14590d179e4730dc77 +folderAsset: yes +timeCreated: 1467836690 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Legacy/Shaders/4.6/Tessellation Eye Eyeball Forward.shader b/Assets/Alloy/Legacy/Shaders/4.6/Tessellation Eye Eyeball Forward.shader new file mode 100644 index 0000000..b078bd1 --- /dev/null +++ b/Assets/Alloy/Legacy/Shaders/4.6/Tessellation Eye Eyeball Forward.shader @@ -0,0 +1,267 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Legacy/Tessellation/Human/Eye/Eyeball (Forward)" { +Properties { + // Main Textures + _MainTextures ("'Eyeball Textures' {Section:{Color:0}}", Float) = 0 + [LM_Albedo] [LM_Transparency] + _Color ("'Tint' {}", Color) = (1,1,1,1) + [LM_MasterTilingOffset] [LM_Albedo] + _MainTex ("'Base Color(RGB) Iris Depth(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _MainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _MainTexUV ("UV Set", Float) = 0 + [LM_Metallic] + _SpecTex ("'Iris(R) AO(G) Spec(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_MainTex}", 2D) = "white" {} + [LM_NormalMap] + _BumpMap ("'Normals' {Visualize:{NRM}, Parent:_MainTex}", 2D) = "bump" {} + _BaseColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Main Properties + _MainPhysicalProperties ("'Main Properties' {Section:{Color:1}}", Float) = 0 + _Specularity ("'Specularity' {Min:0, Max:1}", Float) = 1 + _Roughness ("'Roughness' {Min:0, Max:1}", Float) = 1 + _Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _BumpScale ("'Normal Strength' {}", Float) = 1 + + // Eye Properties + _EyeProperties ("'Eye' {Section:{Color:2}}", Float) = 0 + _EyeScleraColor ("'Sclera Tint' {}", Color) = (1,1,1) + _EyeScleraScattering ("'Sclera Scattering' {Min:0, Max:1}", Float) = 0 + _EyeSpecularity ("'Cornea Specularity' {Min:0, Max:1}", Float) = 0.36 + _EyeRoughness ("'Cornea Roughness' {Min:0, Max:1}", Float) = 0 + + // Iris Properties + _IrisProperties ("'Iris' {Section:{Color:3}}", Float) = 0 + _EyeColor ("'Tint' {}", Color) = (1,1,1) + _EyeIrisScattering ("'Scattering' {Min:0, Max:1}", Float) = 0 + _EyeSpecularTint ("'Specular Tint' {Min:0, Max:1}", Float) = 1 + _EyeParallax ("'Depth' {Min:0, Max:0.08}", Float) = 0.08 + _EyePupilSize ("'Pupil Dilation' {Min:0, Max:1}", Float) = 0 + + // Tessellation + _TessellationProperties ("'Tessellation' {Section:{Color:5}}", Float) = 0 + [KeywordEnum(Displacement, Phong)] + _TessellationMode ("'Mode' {Dropdown:{Displacement:{_Phong}, Phong:{_DispTex, _Displacement}}}", Float) = 0 + _DispTex ("'Heightmap(G)' {Visualize:{RGB}}", 2D) = "black" {} + _DispTexVelocity ("Scroll", Vector) = (0,0,0,0) + _Displacement ("'Displacement' {Min:0, Max:30}", Float) = 0.3 + _Phong ("'Phong Strength' {Min:0, Max:1}", Float) = 0.5 + _EdgeLength ("'Edge Length' {Min:2, Max:50}", Float) = 15 + + // Detail + [Toggle(_DETAIL_MULX2)] + _DetailT ("'Detail' {Feature:{Color:7}}", Float) = 0 + [Enum(Mul, 0, MulX2, 1)] + _DetailMode ("'Color Mode' {Dropdown:{Mul:{}, MulX2:{}}}", Float) = 0 + _DetailAlbedoMap ("'Color(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _DetailAlbedoMapVelocity ("Scroll", Vector) = (0,0,0,0) + _DetailAlbedoMapUV ("UV Set", Float) = 0 + _DetailNormalMap ("'Normals' {Visualize:{NRM}, Parent:_DetailAlbedoMap}", 2D) = "bump" {} + _DetailWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DetailNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Decal + [Toggle(_DECAL_ON)] + _Decal ("'Decal' {Feature:{Color:9}}", Float) = 0 + _DecalColor ("'Tint' {}", Color) = (1,1,1,1) + _DecalTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "black" {} + _DecalTexUV ("UV Set", Float) = 0 + _DecalWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DecalSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _DecalAlphaVertexTint ("'Vertex Alpha Tint' {Min:0, Max:1}", Float) = 0 + + // Emission + [Toggle(_EMISSION)] + _Emission ("'Emission' {Feature:{Color:10}}", Float) = 0 + [LM_Emission] + [HDR] + _EmissionColor ("'Tint' {}", Color) = (1,1,1) + [LM_Emission] + _EmissionMap ("'Mask(RGB)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "white" {} + _IncandescenceMap ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _IncandescenceMapVelocity ("Scroll", Vector) = (0,0,0,0) + _IncandescenceMapUV ("UV Set", Float) = 0 + [Gamma] + _EmissionWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + + // Rim Emission + [Toggle(_RIM_ON)] + _Rim ("'Rim Emission' {Feature:{Color:11}}", Float) = 0 + [HDR] + _RimColor ("'Tint' {}", Color) = (1,1,1) + _RimTex ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _RimTexVelocity ("Scroll", Vector) = (0,0,0,0) + _RimTexUV ("UV Set", Float) = 0 + [Gamma] + _RimWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + [Gamma] + _RimBias ("'Fill' {Min:0, Max:1}", Float) = 0 + _RimPower ("'Falloff' {Min:0.01}", Float) = 4 + + // Dissolve + [Toggle(_DISSOLVE_ON)] + _Dissolve ("'Dissolve' {Feature:{Color:12}}", Float) = 0 + [HDR] + _DissolveGlowColor ("'Glow Tint' {}", Color) = (1,1,1,1) + _DissolveTex ("'Glow Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _DissolveTexUV ("UV Set", Float) = 0 + _DissolveCutoff ("'Cutoff' {Min:0, Max:1}", Float) = 0 + [Gamma] + _DissolveGlowWeight ("'Glow Weight' {Min:0, Max:1}", Float) = 1 + _DissolveEdgeWidth ("'Glow Width' {Min:0, Max:1}", Float) = 0.01 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _Lightmapping ("'GI' {LightmapEmissionProperty:{}}", Float) = 1 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} + +CGINCLUDE + #define A_TESSELLATION_SHADER +ENDCG + +SubShader { + Tags { + "Queue" = "Geometry" + "RenderType" = "Opaque" + //"DisableBatching" = "LODFading" + } + LOD 400 + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Legacy/Shaders/Definition/EyeballForward.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend One One + ZWrite Off + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _DECAL_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + + #include "Assets/Alloy/Legacy/Shaders/Definition/EyeballForward.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _DISSOLVE_ON + + #pragma multi_compile_shadowcaster + #pragma multi_compile_instancing + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_SHADOWCASTER + + #include "Assets/Alloy/Legacy/Shaders/Definition/EyeballForward.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Legacy/Shaders/Definition/EyeballForward.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +FallBack "Alloy/Legacy/Human/Eye/Eyeball (Forward)" +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Legacy/Shaders/4.6/Tessellation Eye Eyeball Forward.shader.meta b/Assets/Alloy/Legacy/Shaders/4.6/Tessellation Eye Eyeball Forward.shader.meta new file mode 100644 index 0000000..118d1f9 --- /dev/null +++ b/Assets/Alloy/Legacy/Shaders/4.6/Tessellation Eye Eyeball Forward.shader.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 45fdb5e0258f7bf44916ac39114720f4 +ShaderImporter: + defaultTextures: + - _MainTex: {instanceID: 0} + - _SpecTex: {instanceID: 0} + - _BumpMap: {instanceID: 0} + - _DetailMask: {instanceID: 0} + - _DetailAlbedoMap: {instanceID: 0} + - _DetailMaterialMap: {fileID: 2800000, guid: 2b77d5cb601375f4ba50c6194c126e59, + type: 3} + - _DetailNormalMap: {instanceID: 0} + - _DecalTex: {instanceID: 0} + - _EmissionMap: {instanceID: 0} + - _IncandescenceMap: {instanceID: 0} + - _RimTex: {instanceID: 0} + - _DissolveTex: {instanceID: 0} + userData: + assetBundleName: diff --git a/Assets/Alloy/Legacy/Shaders/4.6/Tessellation Eye Eyeball.shader b/Assets/Alloy/Legacy/Shaders/4.6/Tessellation Eye Eyeball.shader new file mode 100644 index 0000000..fb9fc09 --- /dev/null +++ b/Assets/Alloy/Legacy/Shaders/4.6/Tessellation Eye Eyeball.shader @@ -0,0 +1,300 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Legacy/Tessellation/Human/Eye/Eyeball" { +Properties { + // Main Textures + _MainTextures ("'Eyeball Textures' {Section:{Color:0}}", Float) = 0 + [LM_Albedo] [LM_Transparency] + _Color ("'Tint' {}", Color) = (1,1,1,1) + [LM_MasterTilingOffset] [LM_Albedo] + _MainTex ("'Base Color(RGB) Iris Depth(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _MainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _MainTexUV ("UV Set", Float) = 0 + [LM_Metallic] + _SpecTex ("'Iris(R) AO(G) Spec(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_MainTex}", 2D) = "white" {} + [LM_NormalMap] + _BumpMap ("'Normals' {Visualize:{NRM}, Parent:_MainTex}", 2D) = "bump" {} + _BaseColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Main Properties + _MainPhysicalProperties ("'Main Properties' {Section:{Color:1}}", Float) = 0 + _Specularity ("'Specularity' {Min:0, Max:1}", Float) = 1 + _Roughness ("'Roughness' {Min:0, Max:1}", Float) = 1 + _Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _BumpScale ("'Normal Strength' {}", Float) = 1 + + // Eye Properties + _EyeProperties ("'Cornea' {Section:{Color:2}}", Float) = 0 + _EyeBumpMap ("'Normals' {Visualize:{NRM}, Parent:_MainTex}", 2D) = "bump" {} + _EyeCorneaWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _EyeRoughness ("'Roughness' {Min:0, Max:1}", Float) = 0 + + // Iris Properties + _IrisProperties ("'Iris' {Section:{Color:3}}", Float) = 0 + _EyeScleraColor("'Sclera Tint' {}", Color) = (1,1,1) + _EyeColor ("'Tint' {}", Color) = (1,1,1) + _EyeSpecularTint ("'Specular Tint' {Min:0, Max:1}", Float) = 1 + _EyeParallax ("'Depth' {Min:0, Max:0.08}", Float) = 0.08 + _EyePupilSize ("'Pupil Dilation' {Min:0, Max:1}", Float) = 0 + + // Tessellation + _TessellationProperties ("'Tessellation' {Section:{Color:5}}", Float) = 0 + [KeywordEnum(Displacement, Phong)] + _TessellationMode ("'Mode' {Dropdown:{Displacement:{_Phong}, Phong:{_DispTex, _Displacement}}}", Float) = 0 + _DispTex ("'Heightmap(G)' {Visualize:{RGB}}", 2D) = "black" {} + _DispTexVelocity ("Scroll", Vector) = (0,0,0,0) + _Displacement ("'Displacement' {Min:0, Max:30}", Float) = 0.3 + _Phong ("'Phong Strength' {Min:0, Max:1}", Float) = 0.5 + _EdgeLength ("'Edge Length' {Min:2, Max:50}", Float) = 15 + + // Detail + [Toggle(_DETAIL_MULX2)] + _DetailT ("'Detail' {Feature:{Color:7}}", Float) = 0 + [Enum(Mul, 0, MulX2, 1)] + _DetailMode ("'Color Mode' {Dropdown:{Mul:{}, MulX2:{}}}", Float) = 0 + _DetailAlbedoMap ("'Color(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _DetailAlbedoMapVelocity ("Scroll", Vector) = (0,0,0,0) + _DetailAlbedoMapUV ("UV Set", Float) = 0 + _DetailNormalMap ("'Normals' {Visualize:{NRM}, Parent:_DetailAlbedoMap}", 2D) = "bump" {} + _DetailWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DetailNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Decal + [Toggle(_DECAL_ON)] + _Decal ("'Decal' {Feature:{Color:9}}", Float) = 0 + _DecalColor ("'Tint' {}", Color) = (1,1,1,1) + _DecalTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "black" {} + _DecalTexUV ("UV Set", Float) = 0 + _DecalWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DecalSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _DecalAlphaVertexTint ("'Vertex Alpha Tint' {Min:0, Max:1}", Float) = 0 + + // Emission + [Toggle(_EMISSION)] + _Emission ("'Emission' {Feature:{Color:10}}", Float) = 0 + [LM_Emission] + [HDR] + _EmissionColor ("'Tint' {}", Color) = (1,1,1) + [LM_Emission] + _EmissionMap ("'Mask(RGB)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "white" {} + _IncandescenceMap ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _IncandescenceMapVelocity ("Scroll", Vector) = (0,0,0,0) + _IncandescenceMapUV ("UV Set", Float) = 0 + [Gamma] + _EmissionWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + + // Rim Emission + [Toggle(_RIM_ON)] + _Rim ("'Rim Emission' {Feature:{Color:11}}", Float) = 0 + [HDR] + _RimColor ("'Tint' {}", Color) = (1,1,1) + _RimTex ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _RimTexVelocity ("Scroll", Vector) = (0,0,0,0) + _RimTexUV ("UV Set", Float) = 0 + [Gamma] + _RimWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + [Gamma] + _RimBias ("'Fill' {Min:0, Max:1}", Float) = 0 + _RimPower ("'Falloff' {Min:0.01}", Float) = 4 + + // Dissolve + [Toggle(_DISSOLVE_ON)] + _Dissolve ("'Dissolve' {Feature:{Color:12}}", Float) = 0 + [HDR] + _DissolveGlowColor ("'Glow Tint' {}", Color) = (1,1,1,1) + _DissolveTex ("'Glow Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _DissolveTexUV ("UV Set", Float) = 0 + _DissolveCutoff ("'Cutoff' {Min:0, Max:1}", Float) = 0 + [Gamma] + _DissolveGlowWeight ("'Glow Weight' {Min:0, Max:1}", Float) = 1 + _DissolveEdgeWidth ("'Glow Width' {Min:0, Max:1}", Float) = 0.01 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _Lightmapping ("'GI' {LightmapEmissionProperty:{}}", Float) = 1 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} + +CGINCLUDE + #define A_TESSELLATION_SHADER +ENDCG + +SubShader { + Tags { + "Queue" = "Geometry" + "RenderType" = "Opaque" + //"DisableBatching" = "LODFading" + } + LOD 400 + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Legacy/Shaders/Definition/Eyeball.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend One One + ZWrite Off + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _DECAL_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + + #include "Assets/Alloy/Legacy/Shaders/Definition/Eyeball.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _DISSOLVE_ON + + #pragma multi_compile_shadowcaster + #pragma multi_compile_instancing + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_SHADOWCASTER + + #include "Assets/Alloy/Legacy/Shaders/Definition/Eyeball.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } + + Pass { + Name "DEFERRED" + Tags { "LightMode" = "Deferred" } + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_prepassfinal + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + #pragma multi_compile_instancing + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_DEFERRED + + #include "Assets/Alloy/Legacy/Shaders/Definition/Eyeball.cginc" + #include "Assets/Alloy/Shaders/Forward/Gbuffer.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Legacy/Shaders/Definition/Eyeball.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +FallBack "Alloy/Legacy/Human/Eye/Eyeball" +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Legacy/Shaders/4.6/Tessellation Eye Eyeball.shader.meta b/Assets/Alloy/Legacy/Shaders/4.6/Tessellation Eye Eyeball.shader.meta new file mode 100644 index 0000000..b1383fb --- /dev/null +++ b/Assets/Alloy/Legacy/Shaders/4.6/Tessellation Eye Eyeball.shader.meta @@ -0,0 +1,23 @@ +fileFormatVersion: 2 +guid: c58fa41adb95452478df012706cfffba +timeCreated: 1445805716 +licenseType: Pro +ShaderImporter: + defaultTextures: + - _MainTex: {instanceID: 0} + - _SpecTex: {instanceID: 0} + - _BumpMap: {instanceID: 0} + - _EyeBumpMap: {instanceID: 0} + - _DispTex: {instanceID: 0} + - _DetailAlbedoMap: {instanceID: 0} + - _DetailMaterialMap: {fileID: 2800000, guid: 2b77d5cb601375f4ba50c6194c126e59, + type: 3} + - _DetailNormalMap: {instanceID: 0} + - _DecalTex: {instanceID: 0} + - _EmissionMap: {instanceID: 0} + - _IncandescenceMap: {instanceID: 0} + - _RimTex: {instanceID: 0} + - _DissolveTex: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Legacy/Shaders/4.6/Tessellation Eye Occlusion.shader b/Assets/Alloy/Legacy/Shaders/4.6/Tessellation Eye Occlusion.shader new file mode 100644 index 0000000..0f5e2e1 --- /dev/null +++ b/Assets/Alloy/Legacy/Shaders/4.6/Tessellation Eye Occlusion.shader @@ -0,0 +1,100 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Legacy/Tessellation/Human/Eye/Occlusion" { +Properties { + // Main Textures + _MainTextures ("'Eye OcclusionTextures' {Section:{Color:0}}", Float) = 0 + _Color ("'Tint' {}", Color) = (1,1,1,1) + _MainTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _MainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _MainTexUV ("UV Set", Float) = 0 + _AoMap ("'Ambient Occlusion(G)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "white" {} + _BaseColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Main Properties + _MainPhysicalProperties ("'Main Properties' {Section:{Color:1}}", Float) = 0 + _Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + + // Tessellation + _TessellationProperties ("'Tessellation' {Section:{Color:5}}", Float) = 0 + [KeywordEnum(Displacement, Phong)] + _TessellationMode ("'Mode' {Dropdown:{Displacement:{_Phong}, Phong:{_DispTex, _Displacement}}}", Float) = 0 + _DispTex ("'Heightmap(G)' {Visualize:{RGB}}", 2D) = "black" {} + _DispTexVelocity ("Scroll", Vector) = (0,0,0,0) + _Displacement ("'Displacement' {Min:0, Max:30}", Float) = 0.3 + _Phong ("'Phong Strength' {Min:0, Max:1}", Float) = 0.5 + _EdgeLength ("'Edge Length' {Min:2, Max:50}", Float) = 15 + + // Dissolve + [Toggle(_DISSOLVE_ON)] + _Dissolve ("'Dissolve' {Feature:{Color:12}}", Float) = 0 + [HDR] + _DissolveGlowColor ("'Glow Tint' {}", Color) = (1,1,1,1) + _DissolveTex ("'Glow Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _DissolveTexUV ("UV Set", Float) = 0 + _DissolveCutoff ("'Cutoff' {Min:0, Max:1}", Float) = 0 + [Gamma] + _DissolveGlowWeight ("'Glow Weight' {Min:0, Max:1}", Float) = 1 + _DissolveEdgeWidth ("'Glow Width' {Min:0, Max:1}", Float) = 0.01 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} + +CGINCLUDE + #define _ALPHAPREMULTIPLY_ON + #define A_TESSELLATION_SHADER +ENDCG + +SubShader { + Tags { + "Queue" = "Transparent-1" + "IgnoreProjector" = "True" + "RenderType" = "Transparent" + "ForceNoShadowCasting" = "True" + //"DisableBatching" = "LODFading" + } + LOD 400 + Offset -1,-1 + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + Blend SrcAlpha OneMinusSrcAlpha + ZWrite Off + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _DISSOLVE_ON + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Legacy/Shaders/Definition/EyeOcclusion.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } +} + +FallBack "Alloy/Legacy/Human/Eye/Occlusion" +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Legacy/Shaders/4.6/Tessellation Eye Occlusion.shader.meta b/Assets/Alloy/Legacy/Shaders/4.6/Tessellation Eye Occlusion.shader.meta new file mode 100644 index 0000000..f2bf151 --- /dev/null +++ b/Assets/Alloy/Legacy/Shaders/4.6/Tessellation Eye Occlusion.shader.meta @@ -0,0 +1,6 @@ +fileFormatVersion: 2 +guid: fd2ba45ab46492449b2d6f4dc2916d5d +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: diff --git a/Assets/Alloy/Legacy/Shaders/4.6/Tessellation Skin Forward.shader b/Assets/Alloy/Legacy/Shaders/4.6/Tessellation Skin Forward.shader new file mode 100644 index 0000000..3b0cd56 --- /dev/null +++ b/Assets/Alloy/Legacy/Shaders/4.6/Tessellation Skin Forward.shader @@ -0,0 +1,295 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Legacy/Tessellation/Human/Skin (Forward)" { +Properties { + [Toggle(EFFECT_BUMP)] + _HasBumpMap ("'Normals Source' {Dropdown:{VertexNormals:{_BumpMap,_BumpScale,_SssBumpBlur,_DetailNormalMap,_DetailNormalMapScale,_WetNormalMap,_WetNormalMapScale}, NormalMaps:{}}}", Float) = 1 + + // Skin Textures + _MainTextures ("'Skin Textures' {Section:{Color:0}}", Float) = 0 + [LM_Albedo] [LM_Transparency] + _Color ("'Tint' {}", Color) = (1,1,1,1) + [LM_MasterTilingOffset] [LM_Albedo] + _MainTex ("'Base Color(RGB) SSS(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _MainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _MainTexUV ("UV Set", Float) = 0 + [LM_Metallic] + _SpecTex ("'Skin(R) AO(G) Spec(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_MainTex}", 2D) = "white" {} + [LM_NormalMap] + _BumpMap ("'Normals' {Visualize:{NRM}, Parent:_MainTex}", 2D) = "bump" {} + _BaseColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Skin Properties + _MainPhysicalProperties ("'Skin Properties' {Section:{Color:1}}", Float) = 0 + _Specularity ("'Specularity' {Min:0, Max:1}", Float) = 1 + _Roughness ("'Roughness' {Min:0, Max:1}", Float) = 1 + _Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _BumpScale ("'Normal Strength' {}", Float) = 1 + + // Scattering + _ScatteringProperties ("'Scattering' {Section:{Color:2}}", Float) = 0 + _SssBrdfTex ("'LUT' {Controls:False}", 2D) = "gray" {} + _SssBias ("'Bias' {Min:0, Max:1}", Float) = 0 + _SssScale ("'Scale' {Min:0, Max:1}", Float) = 1 + _SssAoSaturation ("'AO Saturation' {Min:0, Max:1}", Float) = 0.5 + _SssBumpBlur ("'Bump Blur' {Min:0, Max:1}", Float) = 0 + + // Transmission + _TransmissionProperties ("'Transmission' {Section:{Color:3}}", Float) = 0 + _TransColor ("'Tint' {}", Color) = (1,1,1) + [Gamma] + _TransScale ("'Weight' {Min:0, Max:1}", Float) = 1 + _TransPower ("'Falloff' {Min:1}", Float) = 1 + _TransDistortion ("'Bump Distortion' {Min:0, Max:1}", Float) = 0.1 + + // Tessellation + _TessellationProperties ("'Tessellation' {Section:{Color:5}}", Float) = 0 + [KeywordEnum(Displacement, Phong)] + _TessellationMode ("'Mode' {Dropdown:{Displacement:{_Phong}, Phong:{_DispTex, _Displacement}}}", Float) = 0 + _DispTex ("'Heightmap(G)' {Visualize:{RGB}}", 2D) = "black" {} + _DispTexVelocity ("Scroll", Vector) = (0,0,0,0) + _Displacement ("'Displacement' {Min:0, Max:30}", Float) = 0.3 + _Phong ("'Phong Strength' {Min:0, Max:1}", Float) = 0.5 + _EdgeLength ("'Edge Length' {Min:2, Max:50}", Float) = 15 + + // Detail + [Toggle(_DETAIL_MULX2)] + _DetailT ("'Detail' {Feature:{Color:7}}", Float) = 0 + [Toggle(_NORMALMAP)] + _DetailMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_DetailMask}}}", Float) = 0 + _DetailMask ("'Mask(A)' {Visualize:{A}, Parent:_MainTex}", 2D) = "white" {} + _DetailMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + [Enum(Mul, 0, MulX2, 1)] + _DetailMode ("'Color Mode' {Dropdown:{Mul:{}, MulX2:{}}}", Float) = 0 + _DetailAlbedoMap ("'Color(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _DetailAlbedoMapVelocity ("Scroll", Vector) = (0,0,0,0) + _DetailAlbedoMapUV ("UV Set", Float) = 0 + _DetailNormalMap ("'Normals' {Visualize:{NRM}, Parent:_DetailAlbedoMap}", 2D) = "bump" {} + _DetailWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DetailNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Team Color + [Toggle(_TEAMCOLOR_ON)] + _TeamColor ("'Team Color' {Feature:{Color:8}}", Float) = 0 + [Enum(Masks, 0, Tint, 1)] + _TeamColorMasksAsTint ("'Texture Mode' {Dropdown:{Masks:{}, Tint:{_TeamColorMasks, _TeamColor0, _TeamColor1, _TeamColor2, _TeamColor3}}}", Float) = 0 + _TeamColorMaskMap ("'Masks(RGBA)' {Visualize:{R, G, B, A, RGB}, Parent:_MainTex}", 2D) = "black" {} + _TeamColorMasks ("'Channels' {Vector:Channels}", Vector) = (1,1,1,0) + _TeamColor0 ("'Tint R' {}", Color) = (1,0,0) + _TeamColor1 ("'Tint G' {}", Color) = (0,1,0) + _TeamColor2 ("'Tint B' {}", Color) = (0,0,1) + _TeamColor3 ("'Tint A' {}", Color) = (0.5,0.5,0.5) + + // Decal + [Toggle(_DECAL_ON)] + _Decal ("'Decal' {Feature:{Color:9}}", Float) = 0 + _DecalColor ("'Tint' {}", Color) = (1,1,1,1) + _DecalTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "black" {} + _DecalTexUV ("UV Set", Float) = 0 + _DecalWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DecalSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _DecalAlphaVertexTint ("'Vertex Alpha Tint' {Min:0, Max:1}", Float) = 0 + + // Emission + [Toggle(_EMISSION)] + _Emission ("'Emission' {Feature:{Color:10}}", Float) = 0 + [LM_Emission] + [HDR] + _EmissionColor ("'Tint' {}", Color) = (1,1,1) + [LM_Emission] + _EmissionMap ("'Mask(RGB)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "white" {} + _IncandescenceMap ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _IncandescenceMapVelocity ("Scroll", Vector) = (0,0,0,0) + _IncandescenceMapUV ("UV Set", Float) = 0 + [Gamma] + _EmissionWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + + // Rim Emission + [Toggle(_RIM_ON)] + _Rim ("'Rim Emission' {Feature:{Color:11}}", Float) = 0 + [HDR] + _RimColor ("'Tint' {}", Color) = (1,1,1) + _RimTex ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _RimTexVelocity ("Scroll", Vector) = (0,0,0,0) + _RimTexUV ("UV Set", Float) = 0 + [Gamma] + _RimWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + [Gamma] + _RimBias ("'Fill' {Min:0, Max:1}", Float) = 0 + _RimPower ("'Falloff' {Min:0.01}", Float) = 4 + + // Dissolve + [Toggle(_DISSOLVE_ON)] + _Dissolve ("'Dissolve' {Feature:{Color:12}}", Float) = 0 + [HDR] + _DissolveGlowColor ("'Glow Tint' {}", Color) = (1,1,1,1) + _DissolveTex ("'Glow Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _DissolveTexUV ("UV Set", Float) = 0 + _DissolveCutoff ("'Cutoff' {Min:0, Max:1}", Float) = 0 + [Gamma] + _DissolveGlowWeight ("'Glow Weight' {Min:0, Max:1}", Float) = 1 + _DissolveEdgeWidth ("'Glow Width' {Min:0, Max:1}", Float) = 0.01 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _Lightmapping ("'GI' {LightmapEmissionProperty:{}}", Float) = 1 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} + +CGINCLUDE + #define A_TESSELLATION_SHADER +ENDCG + +SubShader { + Tags { + "Queue" = "Geometry" + "RenderType" = "Opaque" + //"DisableBatching" = "LODFading" + } + LOD 400 + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Legacy/Shaders/Definition/SkinForward.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend One One + ZWrite Off + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + + #include "Assets/Alloy/Legacy/Shaders/Definition/SkinForward.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _DISSOLVE_ON + + #pragma multi_compile_shadowcaster + #pragma multi_compile_instancing + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_SHADOWCASTER + + #include "Assets/Alloy/Legacy/Shaders/Definition/SkinForward.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Legacy/Shaders/Definition/SkinForward.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +FallBack "Alloy/Legacy/Human/Skin (Forward)" +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Legacy/Shaders/4.6/Tessellation Skin Forward.shader.meta b/Assets/Alloy/Legacy/Shaders/4.6/Tessellation Skin Forward.shader.meta new file mode 100644 index 0000000..209292c --- /dev/null +++ b/Assets/Alloy/Legacy/Shaders/4.6/Tessellation Skin Forward.shader.meta @@ -0,0 +1,22 @@ +fileFormatVersion: 2 +guid: 2eb313efdbec1e74582aaa1d35f62038 +ShaderImporter: + defaultTextures: + - _MainTex: {instanceID: 0} + - _SpecTex: {instanceID: 0} + - _BumpMap: {instanceID: 0} + - _SssBrdfTex: {fileID: 2800000, guid: d13510bb2be49aa40a66a0101efb6a36, type: 3} + - _DispTex: {instanceID: 0} + - _DetailMask: {instanceID: 0} + - _DetailAlbedoMap: {instanceID: 0} + - _DetailMaterialMap: {fileID: 2800000, guid: 2b77d5cb601375f4ba50c6194c126e59, + type: 3} + - _DetailNormalMap: {instanceID: 0} + - _TeamColorMaskMap: {instanceID: 0} + - _DecalTex: {instanceID: 0} + - _EmissionMap: {instanceID: 0} + - _IncandescenceMap: {instanceID: 0} + - _RimTex: {instanceID: 0} + - _DissolveTex: {instanceID: 0} + userData: + assetBundleName: diff --git a/Assets/Alloy/Legacy/Shaders/4.6/Tessellation TriPlanar Lite.shader b/Assets/Alloy/Legacy/Shaders/4.6/Tessellation TriPlanar Lite.shader new file mode 100644 index 0000000..9127991 --- /dev/null +++ b/Assets/Alloy/Legacy/Shaders/4.6/Tessellation TriPlanar Lite.shader @@ -0,0 +1,292 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Legacy/Tessellation/TriPlanar/Lite" { +Properties { + // Global Settings + _Mode ("'Rendering Mode' {RenderingMode:{Opaque:{_Cutoff}, Cutout:{}, Fade:{_Cutoff}, Transparent:{_Cutoff}}}", Float) = 0 + _SrcBlend ("__src", Float) = 0 + _DstBlend ("__dst", Float) = 0 + _ZWrite ("__zw", Float) = 1 + [LM_TransparencyCutOff] + _Cutoff ("'Opacity Cutoff' {Min:0, Max:1}", Float) = 0.5 + [Toggle(EFFECT_BUMP)] + _HasBumpMap ("'Normals Source' {Dropdown:{VertexNormals:{_PrimaryBumpMap,_PrimaryBumpScale,_SecondaryBumpMap,_SecondaryBumpScale,_TertiaryBumpMap,_TertiaryBumpScale,_QuaternaryBumpMap,_QuaternaryBumpScale}, NormalMaps:{}}}", Float) = 1 + + // Primary Textures + _PrimaryTextures ("'Primary Textures' {Section:{Color:0}}", Float) = 0 + _PrimaryColor ("'Tint' {}", Color) = (1,1,1,1) + _PrimaryMainTex ("'Base Color(RGB) Rough(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _PrimaryMainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _PrimaryBumpMap ("'Normals' {Visualize:{NRM}, Parent:_PrimaryMainTex}", 2D) = "bump" {} + _PrimaryColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + _PrimaryMetallic ("'Metallic' {Min:0, Max:1}", Float) = 0 + _PrimarySpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _PrimarySpecularTint ("'Specular Tint' {Min:0, Max:1}", Float) = 0 + _PrimaryRoughness ("'Roughness' {Min:0, Max:1}", Float) = 1 + _PrimaryBumpScale ("'Normal Strength' {}", Float) = 1 + + // Secondary Textures + [Toggle(_SECONDARY_TRIPLANAR_ON)] + _SecondaryTextures ("'Secondary Textures' {Feature:{Color:1}}", Float) = 0 + _SecondaryColor ("'Tint' {}", Color) = (1,1,1,1) + _SecondaryMainTex ("'Base Color(RGB) Rough(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _SecondaryMainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _SecondaryBumpMap ("'Normals' {Visualize:{NRM}, Parent:_SecondaryMainTex}", 2D) = "bump" {} + _SecondaryColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + _SecondaryMetallic ("'Metallic' {Min:0, Max:1}", Float) = 0 + _SecondarySpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _SecondarySpecularTint ("'Specular Tint' {Min:0, Max:1}", Float) = 0 + _SecondaryRoughness ("'Roughness' {Min:0, Max:1}", Float) = 1 + _SecondaryBumpScale ("'Normal Strength' {}", Float) = 1 + + // Tertiary Textures + [Toggle(_TERTIARY_TRIPLANAR_ON)] + _TertiaryTextures ("'Tertiary Textures' {Feature:{Color:2}}", Float) = 0 + _TertiaryColor ("'Tint' {}", Color) = (1,1,1,1) + _TertiaryMainTex ("'Base Color(RGB) Rough(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _TertiaryMainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _TertiaryBumpMap ("'Normals' {Visualize:{NRM}, Parent:_TertiaryMainTex}", 2D) = "bump" {} + _TertiaryColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + _TertiaryMetallic ("'Metallic' {Min:0, Max:1}", Float) = 0 + _TertiarySpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _TertiarySpecularTint ("'Specular Tint' {Min:0, Max:1}", Float) = 0 + _TertiaryRoughness ("'Roughness' {Min:0, Max:1}", Float) = 1 + _TertiaryBumpScale ("'Normal Strength' {}", Float) = 1 + + // Quaternary Textures + [Toggle(_QUATERNARY_TRIPLANAR_ON)] + _QuaternaryTextures ("'Quaternary Textures' {Feature:{Color:3}}", Float) = 0 + _QuaternaryColor ("'Tint' {}", Color) = (1,1,1,1) + _QuaternaryMainTex ("'Base Color(RGB) Rough(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _QuaternaryMainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _QuaternaryBumpMap ("'Normals' {Visualize:{NRM}, Parent:_QuaternaryMainTex}", 2D) = "bump" {} + _QuaternaryColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + _QuaternaryMetallic ("'Metallic' {Min:0, Max:1}", Float) = 0 + _QuaternarySpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _QuaternarySpecularTint ("'Specular Tint' {Min:0, Max:1}", Float) = 0 + _QuaternaryRoughness ("'Roughness' {Min:0, Max:1}", Float) = 1 + _QuaternaryBumpScale ("'Normal Strength' {}", Float) = 1 + + // Triplanar + _TriplanarProperties ("'Triplanar' {Section:{Color:4}}", Float) = 0 + [Toggle(_TRIPLANARMODE_WORLD)] + _TriplanarMode ("'Mode' {Dropdown:{Object:{}, World:{}}}", Float) = 1 + _TriplanarBlendSharpness ("'Sharpness' {Min:1, Max:50}", Float) = 2 + + // Tessellation + _TessellationProperties ("'Tessellation' {Section:{Color:5}}", Float) = 0 + _Phong ("'Phong Strength' {Min:0, Max:1}", Float) = 0.5 + _EdgeLength ("'Edge Length' {Min:2, Max:50}", Float) = 15 + + // Rim Emission + [Toggle(_RIM_ON)] + _Rim ("'Rim Emission' {Feature:{Color:11}}", Float) = 0 + [HDR] + _RimColor ("'Tint' {}", Color) = (1,1,1) + [Gamma] + _RimWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + [Gamma] + _RimBias ("'Fill' {Min:0, Max:1}", Float) = 0 + _RimPower ("'Falloff' {Min:0.01}", Float) = 4 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _Lightmapping ("'GI' {LightmapEmissionProperty:{}}", Float) = 1 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} + +CGINCLUDE + #define A_TESSELLATION_SHADER + #define _TESSELLATIONMODE_PHONG +ENDCG + +SubShader { + Tags { + "Queue" = "Geometry" + "RenderType" = "Opaque" + //"DisableBatching" = "LODFading" + } + LOD 400 + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + Blend [_SrcBlend] [_DstBlend] + ZWrite [_ZWrite] + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _TRIPLANARMODE_WORLD + #pragma shader_feature _SECONDARY_TRIPLANAR_ON + #pragma shader_feature _TERTIARY_TRIPLANAR_ON + #pragma shader_feature _QUATERNARY_TRIPLANAR_ON + #pragma shader_feature _RIM_ON + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Legacy/Shaders/Definition/TriPlanar.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend [_SrcBlend] One + ZWrite Off + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _TRIPLANARMODE_WORLD + #pragma shader_feature _SECONDARY_TRIPLANAR_ON + #pragma shader_feature _TERTIARY_TRIPLANAR_ON + #pragma shader_feature _QUATERNARY_TRIPLANAR_ON + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + + #include "Assets/Alloy/Legacy/Shaders/Definition/TriPlanar.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature _TRIPLANARMODE_WORLD + #pragma shader_feature _SECONDARY_TRIPLANAR_ON + #pragma shader_feature _TERTIARY_TRIPLANAR_ON + #pragma shader_feature _QUATERNARY_TRIPLANAR_ON + + #pragma multi_compile_shadowcaster + #pragma multi_compile_instancing + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_SHADOWCASTER + + #include "Assets/Alloy/Legacy/Shaders/Definition/TriPlanar.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } + + Pass { + Name "DEFERRED" + Tags { "LightMode" = "Deferred" } + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _TRIPLANARMODE_WORLD + #pragma shader_feature _SECONDARY_TRIPLANAR_ON + #pragma shader_feature _TERTIARY_TRIPLANAR_ON + #pragma shader_feature _QUATERNARY_TRIPLANAR_ON + #pragma shader_feature _RIM_ON + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_prepassfinal + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + #pragma multi_compile_instancing + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_DEFERRED + + #include "Assets/Alloy/Legacy/Shaders/Definition/TriPlanar.cginc" + #include "Assets/Alloy/Shaders/Forward/Gbuffer.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _TRIPLANARMODE_WORLD + #pragma shader_feature _SECONDARY_TRIPLANAR_ON + #pragma shader_feature _TERTIARY_TRIPLANAR_ON + #pragma shader_feature _QUATERNARY_TRIPLANAR_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Legacy/Shaders/Definition/TriPlanar.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +FallBack "Alloy/Legacy/TriPlanar/Lite" +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Legacy/Shaders/4.6/Tessellation TriPlanar Lite.shader.meta b/Assets/Alloy/Legacy/Shaders/4.6/Tessellation TriPlanar Lite.shader.meta new file mode 100644 index 0000000..4a16762 --- /dev/null +++ b/Assets/Alloy/Legacy/Shaders/4.6/Tessellation TriPlanar Lite.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: f70ed737cdfac2b4fa9e10ac4cc4afcf +timeCreated: 1432487252 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Legacy/Shaders/4.6/Tessellation Vertex Blend 4Splat TriPlanar.shader b/Assets/Alloy/Legacy/Shaders/4.6/Tessellation Vertex Blend 4Splat TriPlanar.shader new file mode 100644 index 0000000..9521351 --- /dev/null +++ b/Assets/Alloy/Legacy/Shaders/4.6/Tessellation Vertex Blend 4Splat TriPlanar.shader @@ -0,0 +1,293 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Legacy/Tessellation/Vertex Blend/4Splat TriPlanar" { +Properties { + // Global Settings + _Mode ("'Rendering Mode' {RenderingMode:{Opaque:{_Cutoff}, Cutout:{}, Fade:{_Cutoff}, Transparent:{_Cutoff}}}", Float) = 0 + _SrcBlend ("__src", Float) = 0 + _DstBlend ("__dst", Float) = 0 + _ZWrite ("__zw", Float) = 1 + [LM_TransparencyCutOff] + _Cutoff ("'Opacity Cutoff' {Min:0, Max:1}", Float) = 0.5 + [Toggle(EFFECT_BUMP)] + _HasBumpMap ("'Normals Source' {Dropdown:{VertexNormals:{_Normal0,_Normal1,_Normal2,_Normal3,_DetailNormalMap,_DetailNormalMapScale}, NormalMaps:{}}}", Float) = 1 + + // Splat0 Properties + _Splat0Properties ("'Splat0' {Section:{Color:0}}", Float) = 0 + _Splat0Tint ("'Tint' {}", Color) = (1,1,1,1) + _Splat0 ("'Base Color(RGB) Rough(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _Splat0Velocity ("Scroll", Vector) = (0,0,0,0) + _Normal0 ("'Normals' {Visualize:{NRM}, Parent:_Splat0}", 2D) = "bump" {} + _Metallic0 ("'Metallic' {Min:0, Max:1}", Float) = 0.0 + _SplatSpecularity0 ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _SplatSpecularTint0 ("'Specular Tint' {Min:0, Max:1}", Float) = 0.0 + _SplatRoughness0 ("'Roughness' {Min:0, Max:1}", Float) = 1.0 + + // Splat1 Properties + _Splat1Properties ("'Splat1' {Section:{Color:1}}", Float) = 0 + _Splat1Tint ("'Tint' {}", Color) = (1,1,1,1) + _Splat1 ("'Base Color(RGB) Rough(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _Splat1Velocity ("Scroll", Vector) = (0,0,0,0) + _Normal1 ("'Normals' {Visualize:{NRM}, Parent:_Splat1}", 2D) = "bump" {} + _Metallic1 ("'Metallic' {Min:0, Max:1}", Float) = 0.0 + _SplatSpecularity1 ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _SplatSpecularTint1 ("'Specular Tint' {Min:0, Max:1}", Float) = 0.0 + _SplatRoughness1 ("'Roughness' {Min:0, Max:1}", Float) = 1.0 + + // Splat2 Properties + _Splat2Properties ("'Splat2' {Section:{Color:2}}", Float) = 0 + _Splat2Tint ("'Tint' {}", Color) = (1,1,1,1) + _Splat2 ("'Base Color(RGB) Rough(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _Splat2Velocity ("Scroll", Vector) = (0,0,0,0) + _Normal2 ("'Normals' {Visualize:{NRM}, Parent:_Splat2}", 2D) = "bump" {} + _Metallic2 ("'Metallic' {Min:0, Max:1}", Float) = 0.0 + _SplatSpecularity2 ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _SplatSpecularTint2 ("'Specular Tint' {Min:0, Max:1}", Float) = 0.0 + _SplatRoughness2 ("'Roughness' {Min:0, Max:1}", Float) = 1.0 + + // Splat3 Properties + _Splat3Properties ("'Splat3' {Section:{Color:3}}", Float) = 0 + _Splat3Tint ("'Tint' {}", Color) = (1,1,1,1) + _Splat3 ("'Base Color(RGB) Rough(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _Splat3Velocity ("Scroll", Vector) = (0,0,0,0) + _Normal3 ("'Normals' {Visualize:{NRM}, Parent:_Splat3}", 2D) = "bump" {} + _Metallic3 ("'Metallic' {Min:0, Max:1}", Float) = 0.0 + _SplatSpecularity3 ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _SplatSpecularTint3 ("'Specular Tint' {Min:0, Max:1}", Float) = 0.0 + _SplatRoughness3 ("'Roughness' {Min:0, Max:1}", Float) = 1.0 + + // Triplanar + _TriplanarProperties ("'Triplanar' {Section:{Color:4}}", Float) = 0 + [Toggle(_TRIPLANARMODE_WORLD)] + _TriplanarMode ("'Mode' {Dropdown:{Object:{}, World:{}}}", Float) = 1 + _TriplanarBlendSharpness ("'Sharpness' {Min:1, Max:50}", Float) = 2 + + // Tessellation + _TessellationProperties ("'Tessellation' {Section:{Color:5}}", Float) = 0 + _Phong ("'Phong Strength' {Min:0, Max:1}", Float) = 0.5 + _EdgeLength ("'Edge Length' {Min:2, Max:50}", Float) = 15 + + // AO2 + [Toggle(_AO2_ON)] + _AO2 ("'AO2' {Feature:{Color:6}}", Float) = 0 + _Ao2Map ("'AO2(G)' {Visualize:{RGB}}", 2D) = "white" {} + _Ao2MapUV ("UV Set", Float) = 1 + _Ao2Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + + // Detail + [Toggle(_DETAIL_MULX2)] + _DetailT ("'Detail' {Feature:{Color:7}}", Float) = 0 + [Enum(Mul, 0, MulX2, 1)] + _DetailMode ("'Color Mode' {Dropdown:{Mul:{}, MulX2:{}}}", Float) = 0 + _DetailAlbedoMap ("'Color(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _DetailAlbedoMapUV ("UV Set", Float) = 0 + _DetailNormalMap ("'Normals' {Visualize:{NRM}, Parent:_DetailAlbedoMap}", 2D) = "bump" {} + _DetailWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DetailNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Decal + [Toggle(_DECAL_ON)] + _Decal ("'Decal' {Feature:{Color:9}}", Float) = 0 + _DecalColor ("'Tint' {}", Color) = (1,1,1,1) + _DecalTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "black" {} + _DecalTexUV ("UV Set", Float) = 0 + _DecalWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DecalSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _DecalAlphaVertexTint ("'Vertex Alpha Tint' {Min:0, Max:1}", Float) = 0 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _Lightmapping ("'GI' {LightmapEmissionProperty:{}}", Float) = 1 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} + +CGINCLUDE + #define _METALLICGLOSSMAP + #define A_TESSELLATION_SHADER + #define _TESSELLATIONMODE_PHONG +ENDCG + +SubShader { + Tags { + "RenderType" = "Opaque" + "PerformanceChecks" = "False" + //"DisableBatching" = "LODFading" + } + LOD 300 + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + Blend [_SrcBlend] [_DstBlend] + ZWrite [_ZWrite] + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _TRIPLANARMODE_WORLD + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _DECAL_ON + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Legacy/Shaders/Definition/VertexBlend.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend [_SrcBlend] One + ZWrite Off + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _TRIPLANARMODE_WORLD + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _DECAL_ON + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + + #include "Assets/Alloy/Legacy/Shaders/Definition/VertexBlend.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature _TRIPLANARMODE_WORLD + + #pragma multi_compile_shadowcaster + #pragma multi_compile_instancing + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_SHADOWCASTER + + #include "Assets/Alloy/Legacy/Shaders/Definition/VertexBlend.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } + + Pass { + Name "DEFERRED" + Tags { "LightMode" = "Deferred" } + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _TRIPLANARMODE_WORLD + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _DECAL_ON + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_prepassfinal + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + #pragma multi_compile_instancing + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_DEFERRED + + #include "Assets/Alloy/Legacy/Shaders/Definition/VertexBlend.cginc" + #include "Assets/Alloy/Shaders/Forward/Gbuffer.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _TRIPLANARMODE_WORLD + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _DECAL_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Legacy/Shaders/Definition/VertexBlend.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +Fallback "Alloy/Legacy/Vertex Blend/4Splat TriPlanar" +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Legacy/Shaders/4.6/Tessellation Vertex Blend 4Splat TriPlanar.shader.meta b/Assets/Alloy/Legacy/Shaders/4.6/Tessellation Vertex Blend 4Splat TriPlanar.shader.meta new file mode 100644 index 0000000..5709f68 --- /dev/null +++ b/Assets/Alloy/Legacy/Shaders/4.6/Tessellation Vertex Blend 4Splat TriPlanar.shader.meta @@ -0,0 +1,21 @@ +fileFormatVersion: 2 +guid: 54dced0a2f15f5f459d21edaf7e8b721 +timeCreated: 1456952662 +licenseType: Pro +ShaderImporter: + defaultTextures: + - _Splat0: {instanceID: 0} + - _Normal0: {instanceID: 0} + - _Splat1: {instanceID: 0} + - _Normal1: {instanceID: 0} + - _Splat2: {instanceID: 0} + - _Normal2: {instanceID: 0} + - _Splat3: {instanceID: 0} + - _Normal3: {instanceID: 0} + - _DetailAlbedoMap: {instanceID: 0} + - _DetailMaterialMap: {fileID: 2800000, guid: 2b77d5cb601375f4ba50c6194c126e59, + type: 3} + - _DetailNormalMap: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Legacy/Shaders/4.6/Tessellation Vertex Blend 4Splat.shader b/Assets/Alloy/Legacy/Shaders/4.6/Tessellation Vertex Blend 4Splat.shader new file mode 100644 index 0000000..9ece38d --- /dev/null +++ b/Assets/Alloy/Legacy/Shaders/4.6/Tessellation Vertex Blend 4Splat.shader @@ -0,0 +1,293 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Legacy/Tessellation/Vertex Blend/4Splat" { +Properties { + // Global Settings + _Mode ("'Rendering Mode' {RenderingMode:{Opaque:{_Cutoff}, Cutout:{}, Fade:{_Cutoff}, Transparent:{_Cutoff}}}", Float) = 0 + _SrcBlend ("__src", Float) = 0 + _DstBlend ("__dst", Float) = 0 + _ZWrite ("__zw", Float) = 1 + [LM_TransparencyCutOff] + _Cutoff ("'Opacity Cutoff' {Min:0, Max:1}", Float) = 0.5 + [Toggle(EFFECT_BUMP)] + _HasBumpMap ("'Normals Source' {Dropdown:{VertexNormals:{_Normal0,_Normal1,_Normal2,_Normal3,_DetailNormalMap,_DetailNormalMapScale}, NormalMaps:{}}}", Float) = 1 + + // Splat0 Properties + _Splat0Properties ("'Splat0' {Section:{Color:0}}", Float) = 0 + _Splat0Tint ("'Tint' {}", Color) = (1,1,1,1) + _Splat0 ("'Base Color(RGB) Rough(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _Splat0Velocity ("Scroll", Vector) = (0,0,0,0) + _Splat0UV ("UV Set", Float) = 0 + _Normal0 ("'Normals' {Visualize:{NRM}, Parent:_Splat0}", 2D) = "bump" {} + _Metallic0 ("'Metallic' {Min:0, Max:1}", Float) = 0.0 + _SplatSpecularity0 ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _SplatSpecularTint0 ("'Specular Tint' {Min:0, Max:1}", Float) = 0.0 + _SplatRoughness0 ("'Roughness' {Min:0, Max:1}", Float) = 1.0 + + // Splat1 Properties + _Splat1Properties ("'Splat1' {Section:{Color:0}}", Float) = 0 + _Splat1Tint ("'Tint' {}", Color) = (1,1,1,1) + _Splat1 ("'Base Color(RGB) Rough(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _Splat1Velocity ("Scroll", Vector) = (0,0,0,0) + _Splat1UV ("UV Set", Float) = 0 + _Normal1 ("'Normals' {Visualize:{NRM}, Parent:_Splat1}", 2D) = "bump" {} + _Metallic1 ("'Metallic' {Min:0, Max:1}", Float) = 0.0 + _SplatSpecularity1 ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _SplatSpecularTint1 ("'Specular Tint' {Min:0, Max:1}", Float) = 0.0 + _SplatRoughness1 ("'Roughness' {Min:0, Max:1}", Float) = 1.0 + + // Splat2 Properties + _Splat2Properties ("'Splat2' {Section:{Color:0}}", Float) = 0 + _Splat2Tint ("'Tint' {}", Color) = (1,1,1,1) + _Splat2 ("'Base Color(RGB) Rough(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _Splat2Velocity ("Scroll", Vector) = (0,0,0,0) + _Splat2UV ("UV Set", Float) = 0 + _Normal2 ("'Normals' {Visualize:{NRM}, Parent:_Splat2}", 2D) = "bump" {} + _Metallic2 ("'Metallic' {Min:0, Max:1}", Float) = 0.0 + _SplatSpecularity2 ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _SplatSpecularTint2 ("'Specular Tint' {Min:0, Max:1}", Float) = 0.0 + _SplatRoughness2 ("'Roughness' {Min:0, Max:1}", Float) = 1.0 + + // Splat3 Properties + _Splat3Properties ("'Splat3' {Section:{Color:0}}", Float) = 0 + _Splat3Tint ("'Tint' {}", Color) = (1,1,1,1) + _Splat3 ("'Base Color(RGB) Rough(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _Splat3Velocity ("Scroll", Vector) = (0,0,0,0) + _Splat3UV ("UV Set", Float) = 0 + _Normal3 ("'Normals' {Visualize:{NRM}, Parent:_Splat3}", 2D) = "bump" {} + _Metallic3 ("'Metallic' {Min:0, Max:1}", Float) = 0.0 + _SplatSpecularity3 ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _SplatSpecularTint3 ("'Specular Tint' {Min:0, Max:1}", Float) = 0.0 + _SplatRoughness3 ("'Roughness' {Min:0, Max:1}", Float) = 1.0 + + // Tessellation + _TessellationProperties ("'Tessellation' {Section:{Color:5}}", Float) = 0 + [KeywordEnum(Displacement, Phong)] + _TessellationMode ("'Mode' {Dropdown:{Displacement:{_Phong}, Phong:{_DispTex, _Displacement}}}", Float) = 0 + _DispTex ("'Heightmap(G)' {Visualize:{RGB}}", 2D) = "black" {} + _DispTexVelocity ("Scroll", Vector) = (0,0,0,0) + _Displacement ("'Displacement' {Min:0, Max:30}", Float) = 0.3 + _Phong ("'Phong Strength' {Min:0, Max:1}", Float) = 0.5 + _EdgeLength ("'Edge Length' {Min:2, Max:50}", Float) = 15 + + // AO2 + [Toggle(_AO2_ON)] + _AO2 ("'AO2' {Feature:{Color:6}}", Float) = 0 + _Ao2Map ("'AO2(G)' {Visualize:{RGB}}", 2D) = "white" {} + _Ao2MapUV ("UV Set", Float) = 1 + _Ao2Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + + // Detail + [Toggle(_DETAIL_MULX2)] + _DetailT ("'Detail' {Feature:{Color:7}}", Float) = 0 + [Enum(Mul, 0, MulX2, 1)] + _DetailMode ("'Color Mode' {Dropdown:{Mul:{}, MulX2:{}}}", Float) = 0 + _DetailAlbedoMap ("'Color(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _DetailAlbedoMapUV ("UV Set", Float) = 0 + _DetailNormalMap ("'Normals' {Visualize:{NRM}, Parent:_DetailAlbedoMap}", 2D) = "bump" {} + _DetailWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DetailNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Decal + [Toggle(_DECAL_ON)] + _Decal ("'Decal' {Feature:{Color:9}}", Float) = 0 + _DecalColor ("'Tint' {}", Color) = (1,1,1,1) + _DecalTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "black" {} + _DecalTexUV ("UV Set", Float) = 0 + _DecalWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DecalSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _DecalAlphaVertexTint ("'Vertex Alpha Tint' {Min:0, Max:1}", Float) = 0 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _Lightmapping ("'GI' {LightmapEmissionProperty:{}}", Float) = 1 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} + +CGINCLUDE + #define A_TESSELLATION_SHADER +ENDCG + +SubShader { + Tags { + "RenderType" = "Opaque" + "PerformanceChecks" = "False" + //"DisableBatching" = "LODFading" + } + LOD 300 + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + Blend [_SrcBlend] [_DstBlend] + ZWrite [_ZWrite] + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _DECAL_ON + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Legacy/Shaders/Definition/VertexBlend.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend [_SrcBlend] One + ZWrite Off + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _DECAL_ON + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + + #include "Assets/Alloy/Legacy/Shaders/Definition/VertexBlend.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + + #pragma multi_compile_shadowcaster + #pragma multi_compile_instancing + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_SHADOWCASTER + + #include "Assets/Alloy/Legacy/Shaders/Definition/VertexBlend.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } + + Pass { + Name "DEFERRED" + Tags { "LightMode" = "Deferred" } + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _DECAL_ON + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_prepassfinal + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + #pragma multi_compile_instancing + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_DEFERRED + + #include "Assets/Alloy/Legacy/Shaders/Definition/VertexBlend.cginc" + #include "Assets/Alloy/Shaders/Forward/Gbuffer.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _DECAL_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Legacy/Shaders/Definition/VertexBlend.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +Fallback "Alloy/Legacy/Vertex Blend/4Splat" +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Legacy/Shaders/4.6/Tessellation Vertex Blend 4Splat.shader.meta b/Assets/Alloy/Legacy/Shaders/4.6/Tessellation Vertex Blend 4Splat.shader.meta new file mode 100644 index 0000000..296fd29 --- /dev/null +++ b/Assets/Alloy/Legacy/Shaders/4.6/Tessellation Vertex Blend 4Splat.shader.meta @@ -0,0 +1,21 @@ +fileFormatVersion: 2 +guid: 83274b1e531b99b4ab201213dbb130f2 +timeCreated: 1430267111 +licenseType: Pro +ShaderImporter: + defaultTextures: + - _Splat0: {instanceID: 0} + - _Normal0: {instanceID: 0} + - _Splat1: {instanceID: 0} + - _Normal1: {instanceID: 0} + - _Splat2: {instanceID: 0} + - _Normal2: {instanceID: 0} + - _Splat3: {instanceID: 0} + - _Normal3: {instanceID: 0} + - _DetailAlbedoMap: {instanceID: 0} + - _DetailMaterialMap: {fileID: 2800000, guid: 2b77d5cb601375f4ba50c6194c126e59, + type: 3} + - _DetailNormalMap: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Legacy/Shaders/Definition.meta b/Assets/Alloy/Legacy/Shaders/Definition.meta new file mode 100644 index 0000000..bee2818 --- /dev/null +++ b/Assets/Alloy/Legacy/Shaders/Definition.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: de96743fb3712fc48a3d55bdb34f7e9e +folderAsset: yes +timeCreated: 1467836697 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Legacy/Shaders/Definition/EyeOcclusion.cginc b/Assets/Alloy/Legacy/Shaders/Definition/EyeOcclusion.cginc new file mode 100644 index 0000000..7792478 --- /dev/null +++ b/Assets/Alloy/Legacy/Shaders/Definition/EyeOcclusion.cginc @@ -0,0 +1,53 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file EyeOcclusion.cginc +/// @brief Eye Occlusion surface shader definition. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_LEGACY_SHADERS_DEFINITION_EYE_OCCLUSION_CGINC +#define ALLOY_LEGACY_SHADERS_DEFINITION_EYE_OCCLUSION_CGINC + +#define A_AMBIENT_OCCLUSION_ON +#define A_EXPANDED_MATERIAL_MAPS + +#include "Assets/Alloy/Shaders/Framework/Lighting.cginc" +#include "Assets/Alloy/Shaders/Type/Standard.cginc" + +void aPreLighting( + inout ASurface s) +{ + aStandardPreLighting(s); + s.opacity *= 1.0h - s.specularOcclusion; +} + +half3 aDirectLighting( + ADirect d, + ASurface s) +{ + return d.color * (d.shadow * d.NdotL * s.ambientOcclusion) * s.albedo; +} + +half3 aIndirectLighting( + AIndirect i, + ASurface s) +{ + return i.diffuse * s.ambientOcclusion * s.albedo; +} + +void aSurfaceShader( + inout ASurface s) +{ + aDissolve(s); + + half4 base = aBase(s); + + s.baseColor = base.rgb; + s.opacity = base.a; + + s.ambientOcclusion = aLerpOneTo(tex2D(_AoMap, s.baseUv).g, _Occlusion); +} + +#endif // ALLOY_LEGACY_SHADERS_DEFINITION_EYE_OCCLUSION_CGINC diff --git a/Assets/Alloy/Legacy/Shaders/Definition/EyeOcclusion.cginc.meta b/Assets/Alloy/Legacy/Shaders/Definition/EyeOcclusion.cginc.meta new file mode 100644 index 0000000..c4cb0d5 --- /dev/null +++ b/Assets/Alloy/Legacy/Shaders/Definition/EyeOcclusion.cginc.meta @@ -0,0 +1,6 @@ +fileFormatVersion: 2 +guid: f6ce6c59434b4bd42829fc8e6a52e473 +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: diff --git a/Assets/Alloy/Legacy/Shaders/Definition/Eyeball.cginc b/Assets/Alloy/Legacy/Shaders/Definition/Eyeball.cginc new file mode 100644 index 0000000..ee3d126 --- /dev/null +++ b/Assets/Alloy/Legacy/Shaders/Definition/Eyeball.cginc @@ -0,0 +1,108 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file Eyeball.cginc +/// @brief Eyeball surface shader definition. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_LEGACY_SHADERS_DEFINITION_EYEBALL_CGINC +#define ALLOY_LEGACY_SHADERS_DEFINITION_EYEBALL_CGINC + +#define A_NORMAL_MAPPING_ON +#define A_AMBIENT_OCCLUSION_ON +#define A_SPECULAR_TINT_ON +#define A_CLEARCOAT_ON +#define A_EYE_PARALLAX_REFRACTION +#define A_DETAIL_MASK_OFF + +#include "Assets/Alloy/Shaders/Lighting/Standard.cginc" +#include "Assets/Alloy/Shaders/Type/Standard.cginc" +#include "Assets/Alloy/Legacy/Shaders/Feature/EyeParallax.cginc" + +/// Cornea normals. +/// Expects a compressed normal map. +sampler2D _EyeBumpMap; + +/// Cornea weight. +/// Expects values in the range [0,1]. +half _EyeCorneaWeight; + +/// Cornea roughness. +/// Expects values in the range [0,1]. +half _EyeRoughness; + +/// Schlera tint color. +/// Expects a linear LDR color. +half3 _EyeScleraColor; + +/// Iris tint color. +/// Expects a linear LDR color. +half3 _EyeColor; + +/// Iris specular tint by base color. +/// Expects values in the range [0,1]. +half _EyeSpecularTint; + +/// Samples and scales the base bump map. +/// @param s Material surface data. +/// @param scale Normal XY scale factor. +/// @return Normalized tangent-space normal. +half3 aSampleBumpScaleOld( + ASurface s, + half scale) +{ + half4 result = 0.0h; + +#ifdef _VIRTUALTEXTURING_ON + result = VTSampleNormal(s.baseVirtualCoord); +#else + result = tex2D(_BumpMap, s.baseUv); +#endif + + return UnpackScaleNormal(result, _BumpScale * scale); +} + +void aSurfaceShader( + inout ASurface s) +{ + float4 uv01 = s.uv01; + + aEyeParallax(s); + aDissolve(s); + + // Iris + half4 base = aBase(s); + half4 material = aSampleMaterial(s); + half irisMask = material.A_METALLIC_CHANNEL; + + s.baseColor = base.rgb * lerp(_EyeScleraColor, _EyeColor, irisMask); + s.metallic = 0.0h; + s.ambientOcclusion = aLerpOneTo(material.A_AO_CHANNEL, _Occlusion); + s.specularity = _Specularity * material.A_SPECULARITY_CHANNEL; + s.specularTint = _EyeSpecularTint * irisMask; + s.roughness = _Roughness * material.A_ROUGHNESS_CHANNEL; + + // Cornea + half bumpMask = s.clearCoat * 0.95h; + half3 corneaNormalTangent = UnpackScaleNormal(tex2D(_EyeBumpMap, s.baseUv), bumpMask); + half3 irisScleraNormalTangent = aSampleBumpScaleOld(s, 1.0h - bumpMask); + + s.clearCoat = _EyeCorneaWeight * irisMask; + s.clearCoatRoughness = _EyeRoughness; + s.normalTangent = A_NT(s, BlendNormals(irisScleraNormalTangent, corneaNormalTangent)); + + s.mask = 1.0h - irisMask; + aDetail(s); + s.mask = 1.0h; + + aEmission(s); + + // Remove parallax so these appears on top of the cornea! + s.uv01 = uv01; + aDecal(s); + aRim(s); +} + +#endif // ALLOY_LEGACY_SHADERS_DEFINITION_EYEBALL_CGINC diff --git a/Assets/Alloy/Legacy/Shaders/Definition/Eyeball.cginc.meta b/Assets/Alloy/Legacy/Shaders/Definition/Eyeball.cginc.meta new file mode 100644 index 0000000..77a409c --- /dev/null +++ b/Assets/Alloy/Legacy/Shaders/Definition/Eyeball.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 9c178cd0ac649324487ffea244d7e632 +timeCreated: 1438268034 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Legacy/Shaders/Definition/EyeballForward.cginc b/Assets/Alloy/Legacy/Shaders/Definition/EyeballForward.cginc new file mode 100644 index 0000000..5d3abcf --- /dev/null +++ b/Assets/Alloy/Legacy/Shaders/Definition/EyeballForward.cginc @@ -0,0 +1,273 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file Eyeball.cginc +/// @brief Eyeball surface shader definition. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_LEGACY_SHADERS_DEFINITION_EYEBALL_CGINC +#define ALLOY_LEGACY_SHADERS_DEFINITION_EYEBALL_CGINC + +#define A_NORMAL_MAPPING_ON +#define A_VIEW_DIR_TANGENT_ON +#define A_AMBIENT_OCCLUSION_ON +#define A_SPECULAR_TINT_ON +#define A_EYE_PARALLAX_REFRACTION +#define A_DETAIL_MASK_OFF + +#define A_SURFACE_CUSTOM_FIELDS \ + half3 corneaNormalWorld; \ + half3 irisF0; \ + half scattering; \ + half irisMask; \ + half corneaSpecularity; \ + half corneaRoughness; \ + half irisSpecularOcclusion; \ + half irisRoughness; \ + half irisBeckmannRoughness; \ + half irisNdotV; + +#include "Assets/Alloy/Shaders/Framework/Lighting.cginc" +#include "Assets/Alloy/Shaders/Type/Standard.cginc" +#include "Assets/Alloy/Legacy/Shaders/Feature/EyeParallax.cginc" + +/// Implements a scattering diffuse BRDF affected by roughness. +/// @param albedo Diffuse albedo LDR color. +/// @param subsurface Blend value between diffuse and scattering [0,1]. +/// @param roughness Linear roughness [0,1]. +/// @param LdotH Light and half-angle clamped dot product [0,1]. +/// @param NdotL Normal and light clamped dot product [0,1]. +/// @param NdotV Normal and view clamped dot product [0,1]. +/// @return Direct diffuse BRDF. +half3 aDiffuseBssrdf( + half3 albedo, + half subsurface, + half roughness, + half LdotH, + half NdotL, + half NdotV) +{ + // Impelementation of Brent Burley's diffuse scattering BRDF. + // Subject to Apache License, version 2.0 + // cf https://github.com/wdas/brdf/blob/master/src/brdfs/disney.brdf + half FL = aFresnel(NdotL); + half FV = aFresnel(NdotV); + half Fss90 = LdotH * LdotH * roughness; + half Fd90 = 0.5h + (2.0h * Fss90); + half Fd = aLerpOneTo(Fd90, FL) * aLerpOneTo(Fd90, FV); + half Fss = aLerpOneTo(Fss90, FL) * aLerpOneTo(Fss90, FV); + half ss = 1.25h * (Fss * (1.0h / max(NdotL + NdotV, A_EPSILON) - 0.5h) + 0.5h); + + // Pi is cancelled by implicit punctual lighting equation. + // cf http://seblagarde.wordpress.com/2012/01/08/pi-or-not-to-pi-in-game-lighting-equation/ + return albedo * lerp(Fd, ss, subsurface); +} + +/// A specular BRDF. +/// @param d Direct lighting data. +/// @param s Material surface data. +/// @return Direct specular BRDF. +half3 aLegacySpecularBrdf( + ADirect d, + ASurface s) +{ + // Schlick's Fresnel approximation. + half3 F = lerp(s.f0, A_WHITE, aFresnel(d.LdotH)); + + // GGX (Trowbridge-Reitz) NDF + // cf http://graphicrants.blogspot.com/2013/08/specular-brdf-reference.html + half a2 = s.beckmannRoughness * s.beckmannRoughness; + half denom = aLerpOneTo(a2, d.NdotH * d.NdotH); + + // John Hable's visibility function. + // cf http://www.filmicworlds.com/2014/04/21/optimizing-ggx-shaders-with-dotlh/ + half V = lerp(a2 * 0.25h, 1.0h, d.LdotH * d.LdotH); + + // Pi is cancelled by implicit punctual lighting equation. + // cf http://seblagarde.wordpress.com/2012/01/08/pi-or-not-to-pi-in-game-lighting-equation/ + half DV = a2 / (4.0h * V * denom * denom); + + // Cook-Torrance microfacet model. + // cf http://graphicrants.blogspot.com/2013/08/specular-brdf-reference.html + return F * (DV * s.specularOcclusion * d.specularIntensity); +} + +/// Indirect specular BRDF. +/// @param s Material surface data. +/// @return Environment BRDF. +half3 aLegacyEnvironmentBrdf( + ASurface s) +{ + // Brian Karis' modification of Dimitar Lazarov's Environment BRDF. + // cf https://www.unrealengine.com/blog/physically-based-shading-on-mobile + const half4 c0 = half4(-1.0h, -0.0275h, -0.572h, 0.022h); + const half4 c1 = half4(1.0h, 0.0425h, 1.04h, -0.04h); + half4 r = s.roughness * c0 + c1; + half a004 = min(r.x * r.x, exp2(-9.28h * s.NdotV)) * r.x + r.y; + half2 AB = half2(-1.04h, 1.04h) * a004 + r.zw; + return s.f0 * AB.x + AB.yyy; +} + +/// Calculates standard indirect diffuse plus specular illumination. +/// @param d Indirect light description. +/// @param s Material surface data. +/// @return Indirect illumination. +half3 aLegacyStandardIndirect( + AIndirect i, + ASurface s) +{ +#ifdef A_REFLECTION_PROBES_ON + half3 specular = i.specular * aLegacyEnvironmentBrdf(s); +#endif + +#ifndef A_AMBIENT_OCCLUSION_ON + half3 diffuse = s.albedo * i.diffuse; + + #ifndef A_REFLECTION_PROBES_ON + return diffuse; + #else + return diffuse + specular; + #endif +#else + // Yoshiharu Gotanda's fake interreflection for specular occlusion. + // Modified to better account for surface f0. + // cf http://research.tri-ace.com/Data/cedec2011_RealtimePBR_Implementation_e.pptx pg65 + half3 ambient = i.diffuse * s.ambientOcclusion; + + #ifndef A_REFLECTION_PROBES_ON + // Diffuse and fake interreflection only. + return ambient * (s.albedo + s.f0 * (1.0h - s.specularOcclusion)); + #else + // Full equation. + return ambient * s.albedo + + lerp(ambient * s.f0, specular, s.specularOcclusion); + #endif +#endif +} + +void aPreLighting( + inout ASurface s) +{ + aStandardPreLighting(s); + + // Tint the iris specular to fake caustics. + // cf http://game.watch.impress.co.jp/docs/news/20121129_575412.html + + // Iris & Sclera + s.irisNdotV = s.NdotV; + s.irisSpecularOcclusion = s.specularOcclusion; + s.irisF0 = s.f0; + s.irisRoughness = s.roughness; + s.irisBeckmannRoughness = s.beckmannRoughness; + + // Cornea + s.roughness = lerp(s.roughness, s.corneaRoughness, s.irisMask); + s.corneaNormalWorld = normalize(lerp(s.normalWorld, s.vertexNormalWorld, s.irisMask)); + s.reflectionVectorWorld = reflect(-s.viewDirWorld, s.corneaNormalWorld); + s.NdotV = aDotClamp(s.corneaNormalWorld, s.viewDirWorld); + s.FV = aFresnel(s.NdotV); + + s.specularOcclusion = lerp(s.irisSpecularOcclusion, 1.0h, s.irisMask); + s.f0 = lerp(s.irisF0, aSpecularityToF0(s.corneaSpecularity), s.irisMask); +} + +half3 aDirectLighting( + ADirect d, + ASurface s) +{ + half3 illum = 0.0h; + + // Iris & Sclera + illum = d.NdotL * ( + aDiffuseBssrdf(s.albedo, s.scattering, s.irisRoughness, d.LdotH, d.NdotL, s.irisNdotV)); + //+ (s.irisSpecularOcclusion * AlloyAreaLightNormalization(s.irisBeckmannRoughness, d.solidAngle) + // * aLegacySpecularBrdf(s.irisF0, s.irisBeckmannRoughness, d.LdotH, d.NdotH, d.NdotL, s.irisNdotV))); + + // Cornea + d.NdotH = aDotClamp(s.corneaNormalWorld, d.halfAngleWorld); + d.NdotL = aDotClamp(s.corneaNormalWorld, d.direction); + d.specularIntensity *= s.irisMask * d.NdotL; + + illum += aLegacySpecularBrdf(d, s); + return illum * d.color * d.shadow; +} + +half3 aIndirectLighting( + AIndirect i, + ASurface s) +{ + return aLegacyStandardIndirect(i, s); +} + +/// Schlera tint color. +/// Expects a linear LDR color. +half3 _EyeScleraColor; + +/// Schlera diffuse scattering amount. +/// Expects values in the range [0,1]. +half _EyeScleraScattering; + +/// Cornea specularity. +/// Expects values in the range [0,1]. +half _EyeSpecularity; + +/// Cornea roughness. +/// Expects values in the range [0,1]. +half _EyeRoughness; + +/// Iris tint color. +/// Expects a linear LDR color. +half3 _EyeColor; + +/// Iris diffuse scattering amount. +/// Expects values in the range [0,1]. +half _EyeIrisScattering; + +/// Iris specular tint by base color. +/// Expects values in the range [0,1]. +half _EyeSpecularTint; + +void aSurfaceShader( + inout ASurface s) +{ + float4 uv01 = s.uv01; + + aEyeParallax(s); + aDissolve(s); + + half4 base = aBase(s); + + s.baseColor = base.rgb; + + half4 material = aSampleMaterial(s); + + s.irisMask = material.A_METALLIC_CHANNEL; + s.metallic = 0.0h; + s.ambientOcclusion = aLerpOneTo(material.A_AO_CHANNEL, _Occlusion); + s.specularity = _Specularity * material.A_SPECULARITY_CHANNEL; + s.roughness = _Roughness * material.A_ROUGHNESS_CHANNEL; + + s.normalTangent = A_NT(s, aSampleBump(s)); + + s.baseColor *= lerp(_EyeScleraColor, _EyeColor, s.irisMask); + s.specularTint = s.irisMask * _EyeSpecularTint; + s.scattering = lerp(_EyeScleraScattering, _EyeIrisScattering, s.irisMask); + s.corneaSpecularity = _EyeSpecularity; + s.corneaRoughness = _EyeRoughness; + + // Don't allow detail normals in the iris. + s.mask = 1.0h - s.irisMask; + aDetail(s); + s.mask = 1.0h; + + aEmission(s); + aRim(s); + + // Remove parallax so this appears on top of the cornea! + s.uv01 = uv01; + aDecal(s); +} + +#endif // ALLOY_LEGACY_SHADERS_DEFINITION_EYEBALL_CGINC diff --git a/Assets/Alloy/Legacy/Shaders/Definition/EyeballForward.cginc.meta b/Assets/Alloy/Legacy/Shaders/Definition/EyeballForward.cginc.meta new file mode 100644 index 0000000..60e98eb --- /dev/null +++ b/Assets/Alloy/Legacy/Shaders/Definition/EyeballForward.cginc.meta @@ -0,0 +1,6 @@ +fileFormatVersion: 2 +guid: 0fb3f9db18784964cb344084b892a928 +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: diff --git a/Assets/Alloy/Legacy/Shaders/Definition/SkinForward.cginc b/Assets/Alloy/Legacy/Shaders/Definition/SkinForward.cginc new file mode 100644 index 0000000..1e73f96 --- /dev/null +++ b/Assets/Alloy/Legacy/Shaders/Definition/SkinForward.cginc @@ -0,0 +1,264 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file Skin.cginc +/// @brief Skin surface shader definition. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_LEGACY_SHADERS_DEFINITION_SKIN_CGINC +#define ALLOY_LEGACY_SHADERS_DEFINITION_SKIN_CGINC + +#define A_AMBIENT_OCCLUSION_ON + +#define A_SURFACE_CUSTOM_FIELDS \ + half scatteringMask; \ + half scattering; + +#include "Assets/Alloy/Shaders/Framework/Lighting.cginc" +#include "Assets/Alloy/Shaders/Type/Standard.cginc" + +// Jon Moore recommended this value in his blog post. +#define A_SKIN_BUMP_BLUR_BIAS (3.0) + +sampler2D _SssBrdfTex; + +/// Biases the thickness value used to look up in the skin LUT. +/// Expects values in the range [0,1]. +half _SssBias; + +/// Scales the thickness value used to look up in the skin LUT. +/// Expects values in the range [0,1]. +half _SssScale; + +/// Amount to colorize and darken AO to simulate local scattering. +/// Expects values in the range [0,1]. +half _SssAoSaturation; + +/// Increases the bluriness of the normal map for diffuse lighting. +/// Expects values in the range [0,1]. +half _SssBumpBlur; + +/// Transmission tint color. +/// Expects a linear LDR color. +half3 _TransColor; + +/// Weight of the transmission effect. +/// Expects linear space value in the range [0,1]. +half _TransScale; + +/// Falloff of the transmission effect. +/// Expects values in the range [1,n). +half _TransPower; + +/// Amount that the transmission is distorted by surface normals. +/// Expects values in the range [0,1]. +half _TransDistortion; + +/// Calculates standard indirect diffuse plus specular illumination. +/// @param d Direct lighting data. +/// @param s Material surface data. +/// @param skinLut Pre-Integrated scattering LUT. +/// @return Direct diffuse illumination with scattering effect. +half3 aLegacySkin( + ADirect d, + ASurface s, + sampler2D skinLut) +{ + // Scattering + // cf http://www.farfarer.com/blog/2013/02/11/pre-integrated-skin-shader-unity-3d/ + float ndlBlur = dot(s.ambientNormalWorld, d.direction) * 0.5h + 0.5h; + float2 sssLookupUv = float2(ndlBlur, s.scattering * aLuminance(d.color)); + half3 sss = s.scatteringMask * d.shadow * tex2D(skinLut, sssLookupUv).rgb; + + //#if !defined(SHADOWS_SCREEN) && !defined(SHADOWS_DEPTH) && !defined(SHADOWS_CUBE) + // // If shadows are off, we need to reduce the brightness + // // of the scattering on polys facing away from the light. + // sss *= saturate(ndlBlur * 4.0h - 1.0h); // [-1,3], then clamp + //#else + // sss *= d.shadow; + //#endif + + return d.color * s.albedo * sss; +} + +/// Calculates direct light transmission effect using per-pixel thickness. +/// @param d Indirect light description. +/// @param s Material surface data. +/// @param weight Weight of the transmission effect. +/// @param distortion Distortion due to surface normals. +/// @param falloff Tightness of the transmitted light. +/// @param shadowWeight Amount that the transsmision is shadowed. +/// @return Transmission effect. +half3 aLegacyTransmission( + ADirect d, + ASurface s, + half weight, + half distortion, + half falloff, + half shadowWeight) +{ + // Transmission + // cf http://www.farfarer.com/blog/2012/09/11/translucent-shader-unity3d/ + half3 transLightDir = d.direction + s.normalWorld * distortion; + half transLight = pow(aDotClamp(s.viewDirWorld, -transLightDir), falloff); + + transLight *= weight * aLerpOneTo(d.shadow, shadowWeight); + return d.color * s.subsurfaceColor * transLight; +} + +/// Direct diffuse and specular BRDF. +/// @param d Direct lighting data. +/// @param s Material surface data. +/// @return Direct diffuse BRDF. +half3 aLegacyDirectBrdf( + ADirect d, + ASurface s, + half diffuseWeight) +{ + // Cook-Torrance microfacet model. + // cf http://graphicrants.blogspot.com/2013/08/specular-brdf-reference.html + half LdotH2 = d.LdotH * d.LdotH; + + // Brent Burley diffuse BRDF. + // cf https://disney-animation.s3.amazonaws.com/library/s2012_pbs_disney_brdf_notes_v2.pdf pg14 + half FL = aFresnel(d.NdotL); + half Fd90 = 0.5h + (2.0h * LdotH2 * s.roughness); + half Fd = aLerpOneTo(Fd90, FL) * aLerpOneTo(Fd90, s.FV); + + // Schlick's Fresnel approximation. + half3 F = lerp(s.f0, A_WHITE, aFresnel(d.LdotH)); + + // John Hable's Visibility function. + // cf http://www.filmicworlds.com/2014/04/21/optimizing-ggx-shaders-with-dotlh/ + half a2 = s.beckmannRoughness * s.beckmannRoughness; + half k2 = a2 * 0.25h; // k = a/2; k*k = (a*a)/(2*2) = (a^2)/4. + half V = lerp(k2, 1.0h, LdotH2); + + // GGX (Trowbridge-Reitz) NDF. + // cf http://graphicrants.blogspot.com/2013/08/specular-brdf-reference.html + half denom = aLerpOneTo(a2, d.NdotH * d.NdotH); + half mDV = k2 / (V * denom * denom); // k2 is GGX a^2 and microfacet 1/4. + + // Punctual lighting equation. + // cf http://seblagarde.wordpress.com/2012/01/08/pi-or-not-to-pi-in-game-lighting-equation/ + return (d.shadow * d.NdotL) * ( + (s.albedo * (Fd * diffuseWeight)) + (F * (mDV * s.specularOcclusion * d.specularIntensity))); +} + +/// Indirect specular BRDF. +/// @param s Material surface data. +/// @return Environment BRDF. +half3 aLegacyEnvironmentBrdf( + ASurface s) +{ + // Brian Karis' modification of Dimitar Lazarov's Environment BRDF. + // cf https://www.unrealengine.com/blog/physically-based-shading-on-mobile + const half4 c0 = half4(-1.0h, -0.0275h, -0.572h, 0.022h); + const half4 c1 = half4(1.0h, 0.0425h, 1.04h, -0.04h); + half4 r = s.roughness * c0 + c1; + half a004 = min(r.x * r.x, exp2(-9.28h * s.NdotV)) * r.x + r.y; + half2 AB = half2(-1.04h, 1.04h) * a004 + r.zw; + return s.f0 * AB.x + AB.yyy; +} + +/// Calculates standard indirect diffuse plus specular illumination. +/// @param d Indirect light description. +/// @param s Material surface data. +/// @return Indirect illumination. +half3 aLegacyStandardIndirect( + AIndirect i, + ASurface s) +{ +#ifdef A_REFLECTION_PROBES_ON + half3 specular = i.specular * aLegacyEnvironmentBrdf(s); +#endif + +#ifndef A_AMBIENT_OCCLUSION_ON + half3 diffuse = s.albedo * i.diffuse; + + #ifndef A_REFLECTION_PROBES_ON + return diffuse; + #else + return diffuse + specular; + #endif +#else + // Yoshiharu Gotanda's fake interreflection for specular occlusion. + // Modified to better account for surface f0. + // cf http://research.tri-ace.com/Data/cedec2011_RealtimePBR_Implementation_e.pptx pg65 + half3 ambient = i.diffuse * s.ambientOcclusion; + + #ifndef A_REFLECTION_PROBES_ON + // Diffuse and fake interreflection only. + return ambient * (s.albedo + s.f0 * (1.0h - s.specularOcclusion)); + #else + // Full equation. + return ambient * s.albedo + + lerp(ambient * s.f0, specular, s.specularOcclusion); + #endif +#endif +} + +void aPreLighting( + inout ASurface s) +{ + aStandardPreLighting(s); + + // Blurred normals for indirect diffuse and direct scattering. + s.blurredNormalTangent = normalize(lerp(s.normalTangent, s.blurredNormalTangent, s.scatteringMask * _SssBumpBlur)); + s.ambientNormalWorld = aTangentToWorld(s, s.blurredNormalTangent); + s.subsurfaceColor = _TransScale * _TransColor * s.albedo * s.subsurface.rrr; + s.scattering = saturate(s.subsurface * _SssScale + _SssBias); +} + +half3 aDirectLighting( + ADirect d, + ASurface s) +{ + return (d.color * aLegacyDirectBrdf(d, s, 1.0h - s.scatteringMask)) + + aLegacySkin(d, s, _SssBrdfTex) + + aLegacyTransmission(d, s, 1.0h, _TransDistortion, _TransPower, 0.0h); +} + +half3 aIndirectLighting( + AIndirect i, + ASurface s) +{ + // Saturated AO. + // cf http://www.iryoku.com/downloads/Next-Generation-Character-Rendering-v6.pptx pg110 + half saturation = s.scatteringMask * _SssAoSaturation; + + s.albedo = pow(s.albedo, (1.0h + saturation) - saturation * s.ambientOcclusion); + return aLegacyStandardIndirect(i, s); +} + +void aSurfaceShader( + inout ASurface s) +{ + aDissolve(s); + + half4 base = aBase(s); + + s.baseColor = base.rgb; + s.subsurface = A_SS(s, base.a); + + half4 material = aSampleMaterial(s); + + s.scatteringMask = material.A_METALLIC_CHANNEL; + s.metallic = 0.0h; + s.ambientOcclusion = aLerpOneTo(material.A_AO_CHANNEL, _Occlusion); + s.specularity = _Specularity * material.A_SPECULARITY_CHANNEL; + s.roughness = _Roughness * material.A_ROUGHNESS_CHANNEL; + + s.normalTangent = A_NT(s, aSampleBump(s)); + s.blurredNormalTangent = aSampleBumpBias(s, A_SKIN_BUMP_BLUR_BIAS); + + aDetail(s); + aTeamColor(s); + aDecal(s); + aRim(s); + aEmission(s); +} + +#endif // ALLOY_LEGACY_SHADERS_DEFINITION_SKIN_CGINC diff --git a/Assets/Alloy/Legacy/Shaders/Definition/SkinForward.cginc.meta b/Assets/Alloy/Legacy/Shaders/Definition/SkinForward.cginc.meta new file mode 100644 index 0000000..00cfbb9 --- /dev/null +++ b/Assets/Alloy/Legacy/Shaders/Definition/SkinForward.cginc.meta @@ -0,0 +1,6 @@ +fileFormatVersion: 2 +guid: 592351fd2bda43b479a4596b48e53d66 +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: diff --git a/Assets/Alloy/Legacy/Shaders/Definition/TriPlanar.cginc b/Assets/Alloy/Legacy/Shaders/Definition/TriPlanar.cginc new file mode 100644 index 0000000..1823f8b --- /dev/null +++ b/Assets/Alloy/Legacy/Shaders/Definition/TriPlanar.cginc @@ -0,0 +1,27 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file TriPlanar.cginc +/// @brief TriPlanar shader definition. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_LEGACY_SHADERS_DEFINITION_TRIPLANAR_CGINC +#define ALLOY_LEGACY_SHADERS_DEFINITION_TRIPLANAR_CGINC + +#define A_ROUGHNESS_SOURCE_BASE_COLOR_ALPHA +#define A_TRIPLANAR_ON +#define A_RIM_EFFECTS_MAP_OFF + +#include "Assets/Alloy/Shaders/Lighting/Standard.cginc" +#include "Assets/Alloy/Shaders/Type/Standard.cginc" + +void aSurfaceShader( + inout ASurface s) +{ + aTriPlanar(s); + aRim(s); +} + +#endif // ALLOY_LEGACY_SHADERS_DEFINITION_TRIPLANAR_CGINC diff --git a/Assets/Alloy/Legacy/Shaders/Definition/TriPlanar.cginc.meta b/Assets/Alloy/Legacy/Shaders/Definition/TriPlanar.cginc.meta new file mode 100644 index 0000000..9338af5 --- /dev/null +++ b/Assets/Alloy/Legacy/Shaders/Definition/TriPlanar.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: af89b12906000ca4d949e437a831c082 +timeCreated: 1472680907 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Legacy/Shaders/Definition/VertexBlend.cginc b/Assets/Alloy/Legacy/Shaders/Definition/VertexBlend.cginc new file mode 100644 index 0000000..789a295 --- /dev/null +++ b/Assets/Alloy/Legacy/Shaders/Definition/VertexBlend.cginc @@ -0,0 +1,78 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file VertexBlend.cginc +/// @brief Vertex Blend shader definition. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_LEGACY_SHADERS_DEFINITION_VERTEX_BLEND_CGINC +#define ALLOY_LEGACY_SHADERS_DEFINITION_VERTEX_BLEND_CGINC + +#define A_ROUGHNESS_SOURCE_BASE_COLOR_ALPHA + +#ifndef A_VERTEX_COLOR_IS_DATA + #define A_VERTEX_COLOR_IS_DATA +#endif + +#define A_METALLIC_ON +#define A_SPECULAR_TINT_ON +#define A_DETAIL_MASK_OFF + +#include "Assets/Alloy/Shaders/Lighting/Standard.cginc" +#include "Assets/Alloy/Shaders/Type/Standard.cginc" + +half _TriplanarBlendSharpness; + +half4 _Splat0Tint; +A_SAMPLER_2D(_Splat0); +sampler2D _Normal0; +half _Metallic0; +half _SplatSpecularity0; +half _SplatSpecularTint0; +half _SplatRoughness0; + +half4 _Splat1Tint; +A_SAMPLER_2D(_Splat1); +sampler2D _Normal1; +half _Metallic1; +half _SplatSpecularity1; +half _SplatSpecularTint1; +half _SplatRoughness1; + +half4 _Splat2Tint; +A_SAMPLER_2D(_Splat2); +sampler2D _Normal2; +half _Metallic2; +half _SplatSpecularity2; +half _SplatSpecularTint2; +half _SplatRoughness2; + +half4 _Splat3Tint; +A_SAMPLER_2D(_Splat3); +sampler2D _Normal3; +half _Metallic3; +half _SplatSpecularity3; +half _SplatSpecularTint3; +half _SplatRoughness3; + +void aSurfaceShader( + inout ASurface s) +{ + half4 splatControl = s.vertexColor; + + splatControl /= (dot(splatControl, A_ONE4) + A_EPSILON); + + ASplatContext sc = aNewSplatContext(s, _TriplanarBlendSharpness, 1.0f); + ASplat sp0 = aNewSplat(sc, A_SAMPLER_2D_INPUT(_Splat0), _Splat0, _Normal0, _Splat0Tint, 0.0h, _Metallic0, _SplatSpecularity0, _SplatSpecularTint0, _SplatRoughness0, 1.0h, 1.0h); + ASplat sp1 = aNewSplat(sc, A_SAMPLER_2D_INPUT(_Splat1), _Splat1, _Normal1, _Splat1Tint, 0.0h, _Metallic1, _SplatSpecularity1, _SplatSpecularTint1, _SplatRoughness1, 1.0h, 1.0h); + ASplat sp2 = aNewSplat(sc, A_SAMPLER_2D_INPUT(_Splat2), _Splat2, _Normal2, _Splat2Tint, 0.0h, _Metallic2, _SplatSpecularity2, _SplatSpecularTint2, _SplatRoughness2, 1.0h, 1.0h); + ASplat sp3 = aNewSplat(sc, A_SAMPLER_2D_INPUT(_Splat3), _Splat3, _Normal3, _Splat3Tint, 0.0h, _Metallic3, _SplatSpecularity3, _SplatSpecularTint3, _SplatRoughness3, 1.0h, 1.0h); + + aApplyTerrainSplats(s, splatControl, sp0, sp1, sp2, sp3); + aCutout(s); + aDetail(s); +} + +#endif // ALLOY_LEGACY_SHADERS_DEFINITION_VERTEX_BLEND_CGINC diff --git a/Assets/Alloy/Legacy/Shaders/Definition/VertexBlend.cginc.meta b/Assets/Alloy/Legacy/Shaders/Definition/VertexBlend.cginc.meta new file mode 100644 index 0000000..894d4bb --- /dev/null +++ b/Assets/Alloy/Legacy/Shaders/Definition/VertexBlend.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 4336d3976cbfc8740a237887a1d65eb7 +timeCreated: 1430262367 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Legacy/Shaders/Feature.meta b/Assets/Alloy/Legacy/Shaders/Feature.meta new file mode 100644 index 0000000..fe053d9 --- /dev/null +++ b/Assets/Alloy/Legacy/Shaders/Feature.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: d3def653a70408e48b2e7c283f0a2c82 +folderAsset: yes +timeCreated: 1467836703 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Legacy/Shaders/Feature/EyeParallax.cginc b/Assets/Alloy/Legacy/Shaders/Feature/EyeParallax.cginc new file mode 100644 index 0000000..1290baf --- /dev/null +++ b/Assets/Alloy/Legacy/Shaders/Feature/EyeParallax.cginc @@ -0,0 +1,207 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file EyeParallax.cginc +/// @brief Surface heightmap-based texcoord modification. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_LEGACY_SHADERS_FEATURE_EYE_PARALLAX_CGINC +#define ALLOY_LEGACY_SHADERS_FEATURE_EYE_PARALLAX_CGINC + +#ifdef A_EYE_PARALLAX_REFRACTION + #if defined(UNITY_PASS_SHADOWCASTER) || defined(UNITY_PASS_META) + #undef A_EYE_PARALLAX_REFRACTION + #elif !defined(A_VIEW_DIR_TANGENT_ON) + #define A_VIEW_DIR_TANGENT_ON + #endif +#endif + +#include "Assets/Alloy/Shaders/Framework/Feature.cginc" + +#ifdef A_EYE_PARALLAX_REFRACTION + /// Number of samples used for direct view of POM effect. + /// Expects values in the range [1,n]. + float _MinSamples; + + /// Number of samples used for grazing view of POM effect. + /// Expects values in the range [1,n]. + float _MaxSamples; + + #ifdef A_EYE_PARALLAX_REFRACTION + /// Iris parallax depth scale. + /// Expects values in the range [0,1]. + half _EyeParallax; + + /// Iris pupil dilation. + /// Expects values in the range [0,1]. + half _EyePupilSize; + #endif +#endif + +/// Applies texture coordinate offsets to surface data. +/// @param[in,out] s Material surface data. +/// @param[in] offset Texture coordinate offset. +void aEyeApplyParallaxOffset( + inout ASurface s, + float2 offset) +{ + offset *= s.mask; + + // To apply the parallax offset to secondary textures without causing swimming, + // we must normalize it by removing the implicitly multiplied base map tiling. + s.uv01 += (offset / s.baseTiling).xyxy; + s.baseUv += A_BV(s, offset); +} + +/// Calculates Offset Bump Mapping texture offsets. +/// @param[in,out] s Material surface data. +/// @param[in] parallaxMap Height map. +/// @param[in] parallax Height scale of the heightmap [0,0.08]. +void aEyeOffsetBumpMapping( + inout ASurface s, + sampler2D parallaxMap, + half parallax) +{ + // NOTE: Prevents NaN compiler errors in DX9 mode for shadow pass. +#if !defined(UNITY_PASS_SHADOWCASTER) && !defined(UNITY_PASS_META) + #ifdef _VIRTUALTEXTURING_ON + half h = VTSampleBase(s.baseVirtualCoord).a; + #else + half h = tex2D(parallaxMap, s.baseUv).w; + #endif + + h = h * parallax - parallax / 2.0h; + + half3 v = s.viewDirTangent; + v.z += 0.42h; + + aEyeApplyParallaxOffset(s, h * (v.xy / v.z)); +#endif +} + +/// Calculates Parallax Occlusion Mapping texture offsets. +/// @param[in,out] s Material surface data. +/// @param[in] parallaxMap Height map. +/// @param[in] parallax Height scale of the heightmap [0,0.08]. +/// @param[in] minSamples Minimum number of samples for POM effect [1,n]. +/// @param[in] maxSamples Maximum number of samples for POM effect [1,n]. +void aEyeParallaxOcclusionMapping( + inout ASurface s, + sampler2D parallaxMap, + float parallax, + float minSamples, + float maxSamples) +{ + // NOTE: Prevents NaN compiler errors in DX9 mode for shadow pass. +#if !defined(UNITY_PASS_SHADOWCASTER) && !defined(UNITY_PASS_META) + // Parallax Occlusion Mapping + // cf http://www.gamedev.net/page/resources/_/technical/graphics-programming-and-theory/a-closer-look-at-parallax-occlusion-mapping-r3262 + float2 offset = float2(0.0f, 0.0f); + + // Calculate the parallax offset vector max length. + // This is equivalent to the tangent of the angle between the + // viewer position and the fragment location. + float parallaxLimit = -length(s.viewDirTangent.xy) / s.viewDirTangent.z; + + // Scale the parallax limit according to heightmap scale. + parallaxLimit *= parallax; + + // Calculate the parallax offset vector direction and maximum offset. + float2 offsetDirTangent = normalize(s.viewDirTangent.xy); + float2 maxOffset = offsetDirTangent * parallaxLimit; + + // Calculate how many samples should be taken along the view ray + // to find the surface intersection. This is based on the angle + // between the surface normal and the view vector. + int numSamples = (int)lerp(maxSamples, minSamples, s.NdotV); + int currentSample = 0; + + // Specify the view ray step size. Each sample will shift the current + // view ray by this amount. + float stepSize = 1.0f / (float)numSamples; + + // Initialize the starting view ray height and the texture offsets. + float currentRayHeight = 1.0f; + float2 lastOffset = float2(0.0f, 0.0f); + + float lastSampledHeight = 1.0f; + float currentSampledHeight = 1.0f; + + #ifdef _VIRTUALTEXTURING_ON + VirtualCoord vcoord = s.baseVirtualCoord; + #else + // Calculate the texture coordinate partial derivatives in screen + // space for the tex2Dgrad texture sampling instruction. + float2 dx = ddx(s.baseUv); + float2 dy = ddy(s.baseUv); + #endif + + while (currentSample < numSamples) { + #ifdef _VIRTUALTEXTURING_ON + vcoord = VTUpdateVirtualCoord(vcoord, s.baseUv + offset); + currentSampledHeight = VTSampleBase(vcoord).a; + #else + // Sample the heightmap at the current texcoord offset. + currentSampledHeight = tex2Dgrad(parallaxMap, s.baseUv + offset, dx, dy).w; + #endif + + // Test if the view ray has intersected the surface. + UNITY_BRANCH + if (currentSampledHeight > currentRayHeight) { + // Find the relative height delta before and after the intersection. + // This provides a measure of how close the intersection is to + // the final sample location. + float delta1 = currentSampledHeight - currentRayHeight; + float delta2 = (currentRayHeight + stepSize) - lastSampledHeight; + float ratio = delta1 / (delta1 + delta2); + + // Interpolate between the final two segments to + // find the true intersection point offset. + offset = lerp(offset, lastOffset, ratio); + + // Force the exit of the while loop + currentSample = numSamples + 1; + } + else { + // The intersection was not found. Now set up the loop for the next + // iteration by incrementing the sample count, + currentSample++; + + // take the next view ray height step, + currentRayHeight -= stepSize; + + // save the current texture coordinate offset and increment + // to the next sample location, + lastOffset = offset; + offset += stepSize * maxOffset; + + // and finally save the current heightmap height. + lastSampledHeight = currentSampledHeight; + } + } + + aEyeApplyParallaxOffset(s, offset); +#endif +} + +void aEyeParallax( + inout ASurface s) +{ +#ifdef A_EYE_PARALLAX_REFRACTION + // Cornea "Refraction". + aEyeParallaxOcclusionMapping(s, _MainTex, _EyeParallax * _Color.a, 10.0f, 25.0f); + //aEyeOffsetBumpMapping(s, _MainTex, _EyeParallax * _Color.a); + + // Pupil Dilation + // HACK: Use the heightmap as the gradient, since it matches the other maps. + // http://www.polycount.com/forum/showpost.php?p=1511423&postcount=13 + half mask = 1.0h - aSampleBase(s).a; + float2 centeredUv = frac(s.baseUv) + float2(-0.5f, -0.5f); + + s.baseUv -= A_BV(s, centeredUv * mask * _EyePupilSize); +#endif +} + +#endif // ALLOY_LEGACY_SHADERS_FEATURE_EYE_PARALLAX_CGINC diff --git a/Assets/Alloy/Legacy/Shaders/Feature/EyeParallax.cginc.meta b/Assets/Alloy/Legacy/Shaders/Feature/EyeParallax.cginc.meta new file mode 100644 index 0000000..7f30d4a --- /dev/null +++ b/Assets/Alloy/Legacy/Shaders/Feature/EyeParallax.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: aa57460a27e82314fa79975584c542f8 +timeCreated: 1467837473 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Mods.meta b/Assets/Alloy/Mods.meta new file mode 100644 index 0000000..b0110df --- /dev/null +++ b/Assets/Alloy/Mods.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 60c32806b6f7b7c40bfa3bf941691259 +folderAsset: yes +timeCreated: 1424477136 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Mods/Shaders.meta b/Assets/Alloy/Mods/Shaders.meta new file mode 100644 index 0000000..0648903 --- /dev/null +++ b/Assets/Alloy/Mods/Shaders.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 3a9504c88ae6159468f42f2549c3dc5a +folderAsset: yes +timeCreated: 1466474819 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Mods/Shaders/3.0.meta b/Assets/Alloy/Mods/Shaders/3.0.meta new file mode 100644 index 0000000..0140ca8 --- /dev/null +++ b/Assets/Alloy/Mods/Shaders/3.0.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 853c64b643ce96240ac0f8b27a6853f1 +folderAsset: yes +timeCreated: 1424477236 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Mods/Shaders/3.0/Car Paint Fast ClearCoat.shader b/Assets/Alloy/Mods/Shaders/3.0/Car Paint Fast ClearCoat.shader new file mode 100644 index 0000000..a3a9406 --- /dev/null +++ b/Assets/Alloy/Mods/Shaders/3.0/Car Paint Fast ClearCoat.shader @@ -0,0 +1,374 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy Mods/Car Paint Fast ClearCoat" { +Properties { + // Global Settings + _Mode ("'Rendering Mode' {RenderingMode:{Opaque:{_Cutoff}, Cutout:{}, Fade:{_Cutoff}, Transparent:{_Cutoff}}}", Float) = 0 + _SrcBlend ("__src", Float) = 0 + _DstBlend ("__dst", Float) = 0 + _ZWrite ("__zw", Float) = 1 + [LM_TransparencyCutOff] + _Cutoff ("'Opacity Cutoff' {Min:0, Max:1}", Float) = 0.5 + [Toggle(EFFECT_BUMP)] + _HasBumpMap ("'Normals Source' {Dropdown:{VertexNormals:{_BumpMap,_BumpScale,_DetailNormalMap,_DetailNormalMapScale,_WetNormalMap,_WetNormalMapScale}, NormalMaps:{}}}", Float) = 1 + + // Car Paint Textures + _MainTextures ("'Car Paint Textures' {Section:{Color:0}}", Float) = 0 + [LM_Albedo] [LM_Transparency] + _Color ("'Tint' {}", Color) = (1,1,1,1) + [LM_MasterTilingOffset] [LM_Albedo] + _MainTex ("'Base Color(RGB) Paint(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _MainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _MainTexUV ("UV Set", Float) = 0 + [LM_Metallic] + _SpecTex ("'Metal(R) AO(G) Spec(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_MainTex}", 2D) = "white" {} + [LM_NormalMap] + _BumpMap ("'Normals' {Visualize:{NRM}, Parent:_MainTex}", 2D) = "bump" {} + _BaseColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Car Paint Properties + _MainPhysicalProperties ("'Car Paint Properties' {Section:{Color:1}}", Float) = 0 + [LM_Metallic] + _Metal ("'Metallic' {Min:0, Max:1}", Float) = 1 + _Specularity ("'Specularity' {Min:0, Max:1}", Float) = 1 + _Roughness ("'Roughness' {Min:0, Max:1}", Float) = 1 + _Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _BumpScale ("'Normal Strength' {}", Float) = 1 + + // Paint + _PaintProperties ("'Paint' {Section:{Color:2}}", Float) = 0 + _CarPrimaryColor ("'Primary Color' {}", Color) = (1,1,1) + _CarSecondaryColor ("'Secondary Color' {}", Color) = (1,1,1) + _CarSecondaryColorWeight ("'Blend Weight' {Min:0, Max:1}", Float) = 1 + _CarSecondaryColorFalloff ("'Blend Falloff' {Min:0, Max:1}", Float) = 1 + _CarPaintClearCoatWeight ("'Clear Coat' {Min:0, Max:1}", Float) = 1 + _CarPaintClearCoatRoughness ("'Clear Coat Roughness' {Min:0, Max:1}", Float) = 0.01 + + // Flakes + _FlakeProperties ("'Flakes' {Section:{Color:3}}", Float) = 0 + _CarFlakeColor ("'Tint' {}", Color) = (1,1,1) + _CarFlakeMap ("'Color(RGB) Mask(A)' {Visualize:{RGB,A}}", 2D) = "black" {} + _CarFlakeMapUV ("UV Set", Float) = 0 + _CarFlakeMapFalloff ("'Mask Falloff' {Min:0.01}", Float) = 1 + _CarFlakeWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _CarFlakeSpread ("'Spread' {Min:0, Max:1}", Float) = 0.5 + _CarFlakeHighlightSpread ("'Highlight Spread' {Min:0, Max:1}", Float) = 0.5 + + // Parallax + [Toggle(_PARALLAXMAP)] + _ParallaxT ("'Parallax' {Feature:{Color:5}}", Float) = 0 + [Toggle(_BUMPMODE_POM)] + _BumpMode ("'Mode' {Dropdown:{Parallax:{_MinSamples, _MaxSamples}, POM:{}}}", Float) = 0 + _ParallaxMap ("'Heightmap(G)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "black" {} + _Parallax ("'Height' {Min:0, Max:0.08}", Float) = 0.02 + _MinSamples ("'Min Samples' {Min:1}", Float) = 4 + _MaxSamples ("'Max Samples' {Min:1}", Float) = 20 + + // AO2 + [Toggle(_AO2_ON)] + _AO2 ("'AO2' {Feature:{Color:6}}", Float) = 0 + _Ao2Map ("'AO2(G)' {Visualize:{RGB}}", 2D) = "white" {} + _Ao2MapUV ("UV Set", Float) = 1 + _Ao2Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + + // Detail + [Toggle(_DETAIL_MULX2)] + _DetailT ("'Detail' {Feature:{Color:7}}", Float) = 0 + [Toggle(_NORMALMAP)] + _DetailMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_DetailMask}}}", Float) = 0 + _DetailMask ("'Mask(A)' {Visualize:{A}, Parent:_MainTex}", 2D) = "white" {} + _DetailMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + [Enum(Mul, 0, MulX2, 1)] + _DetailMode ("'Color Mode' {Dropdown:{Mul:{}, MulX2:{}}}", Float) = 0 + _DetailAlbedoMap ("'Color(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _DetailAlbedoMapVelocity ("Scroll", Vector) = (0,0,0,0) + _DetailAlbedoMapUV ("UV Set", Float) = 0 + _DetailNormalMap ("'Normals' {Visualize:{NRM}, Parent:_DetailAlbedoMap}", 2D) = "bump" {} + _DetailWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DetailNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Team Color + [Toggle(_TEAMCOLOR_ON)] + _TeamColor ("'Team Color' {Feature:{Color:8}}", Float) = 0 + [Enum(Masks, 0, Tint, 1)] + _TeamColorMasksAsTint ("'Texture Mode' {Dropdown:{Masks:{}, Tint:{_TeamColorMasks, _TeamColor0, _TeamColor1, _TeamColor2, _TeamColor3}}}", Float) = 0 + _TeamColorMaskMap ("'Masks(RGBA)' {Visualize:{R, G, B, A, RGB}, Parent:_MainTex}", 2D) = "black" {} + _TeamColorMasks ("'Channels' {Vector:Channels}", Vector) = (1,1,1,0) + _TeamColor0 ("'Tint R' {}", Color) = (1,0,0) + _TeamColor1 ("'Tint G' {}", Color) = (0,1,0) + _TeamColor2 ("'Tint B' {}", Color) = (0,0,1) + _TeamColor3 ("'Tint A' {}", Color) = (0.5,0.5,0.5) + + // Decal + [Toggle(_DECAL_ON)] + _Decal ("'Decal' {Feature:{Color:9}}", Float) = 0 + _DecalColor ("'Tint' {}", Color) = (1,1,1,1) + _DecalTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "black" {} + _DecalTexUV ("UV Set", Float) = 0 + _DecalWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DecalSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _DecalAlphaVertexTint ("'Vertex Alpha Tint' {Min:0, Max:1}", Float) = 0 + + // Emission + [Toggle(_EMISSION)] + _Emission ("'Emission' {Feature:{Color:10}}", Float) = 0 + [LM_Emission] + [HDR] + _EmissionColor ("'Tint' {}", Color) = (1,1,1) + [LM_Emission] + _EmissionMap ("'Mask(RGB)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "white" {} + _IncandescenceMap ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _IncandescenceMapVelocity ("Scroll", Vector) = (0,0,0,0) + _IncandescenceMapUV ("UV Set", Float) = 0 + [Gamma] + _EmissionWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + + // Rim Emission + [Toggle(_RIM_ON)] + _Rim ("'Rim Emission' {Feature:{Color:11}}", Float) = 0 + [HDR] + _RimColor ("'Tint' {}", Color) = (1,1,1) + _RimTex ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _RimTexVelocity ("Scroll", Vector) = (0,0,0,0) + _RimTexUV ("UV Set", Float) = 0 + [Gamma] + _RimWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + [Gamma] + _RimBias ("'Fill' {Min:0, Max:1}", Float) = 0 + _RimPower ("'Falloff' {Min:0.01}", Float) = 4 + + // Dissolve + [Toggle(_DISSOLVE_ON)] + _Dissolve ("'Dissolve' {Feature:{Color:12}}", Float) = 0 + [HDR] + _DissolveGlowColor ("'Glow Tint' {}", Color) = (1,1,1,1) + _DissolveTex ("'Glow Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _DissolveTexUV ("UV Set", Float) = 0 + _DissolveCutoff ("'Cutoff' {Min:0, Max:1}", Float) = 0 + [Gamma] + _DissolveGlowWeight ("'Glow Weight' {Min:0, Max:1}", Float) = 1 + _DissolveEdgeWidth ("'Glow Width' {Min:0, Max:1}", Float) = 0.01 + + // Wetness + [Toggle(_WETNESS_ON)] + _WetnessProperties ("'Wetness' {Feature:{Color:13}}", Float) = 0 + [Toggle(_WETMASKSOURCE_VERTEXCOLORALPHA)] + _WetMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_WetMask}}}", Float) = 0 + _WetMask ("'Mask(A)' {Visualize:{A}}", 2D) = "white" {} + _WetMaskVelocity ("Scroll", Vector) = (0,0,0,0) + _WetMaskUV ("UV Set", Float) = 0 + _WetMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + _WetTint ("'Tint' {}", Color) = (1,1,1,1) + _WetNormalMap ("'Normals' {Visualize:{NRM}}", 2D) = "bump" {} + _WetNormalMapVelocity ("Scroll", Vector) = (0,0,0,0) + _WetNormalMapUV ("UV Set", Float) = 0 + _WetWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _WetRoughness ("'Roughness' {Min:0, Max:1}", Float) = 0.2 + _WetNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _Lightmapping ("'GI' {LightmapEmissionProperty:{}}", Float) = 1 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} + +SubShader { + Tags { + "RenderType" = "Opaque" + "PerformanceChecks" = "False" + //"DisableBatching" = "LODFading" + } + LOD 300 + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + Blend [_SrcBlend] [_DstBlend] + ZWrite [_ZWrite] + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Mods/Shaders/Definition/CarPaintFastClearCoat.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend [_SrcBlend] One + ZWrite Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + + #include "Assets/Alloy/Mods/Shaders/Definition/CarPaintFastClearCoat.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature _DISSOLVE_ON + + #pragma multi_compile_shadowcaster + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_SHADOWCASTER + + #include "Assets/Alloy/Mods/Shaders/Definition/CarPaintFastClearCoat.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } + + Pass { + Name "DEFERRED" + Tags { "LightMode" = "Deferred" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_prepassfinal + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_DEFERRED + + #include "Assets/Alloy/Mods/Shaders/Definition/CarPaintFastClearCoat.cginc" + #include "Assets/Alloy/Shaders/Forward/Gbuffer.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Mods/Shaders/Definition/CarPaintFastClearCoat.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +FallBack "VertexLit" +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Mods/Shaders/3.0/Car Paint Fast ClearCoat.shader.meta b/Assets/Alloy/Mods/Shaders/3.0/Car Paint Fast ClearCoat.shader.meta new file mode 100644 index 0000000..d64f0b7 --- /dev/null +++ b/Assets/Alloy/Mods/Shaders/3.0/Car Paint Fast ClearCoat.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 3455ea41aa7ae6246b7c7bd71927cc7d +timeCreated: 1467590707 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Mods/Shaders/3.0/Car Paint Full ClearCoat.shader b/Assets/Alloy/Mods/Shaders/3.0/Car Paint Full ClearCoat.shader new file mode 100644 index 0000000..94a45cd --- /dev/null +++ b/Assets/Alloy/Mods/Shaders/3.0/Car Paint Full ClearCoat.shader @@ -0,0 +1,399 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy Mods/Car Paint Full ClearCoat" { +Properties { + // Global Settings + _Mode ("'Rendering Mode' {RenderingMode:{Opaque:{_Cutoff}, Cutout:{}, Fade:{_Cutoff}, Transparent:{_Cutoff}}}", Float) = 0 + _SrcBlend ("__src", Float) = 0 + _DstBlend ("__dst", Float) = 0 + _ZWrite ("__zw", Float) = 1 + [LM_TransparencyCutOff] + _Cutoff ("'Opacity Cutoff' {Min:0, Max:1}", Float) = 0.5 + [Toggle(EFFECT_BUMP)] + _HasBumpMap ("'Normals Source' {Dropdown:{VertexNormals:{_BumpMap,_BumpScale,_DetailNormalMap,_DetailNormalMapScale,_WetNormalMap,_WetNormalMapScale}, NormalMaps:{}}}", Float) = 1 + + // Car Paint Textures + _MainTextures ("'Car Paint Textures' {Section:{Color:0}}", Float) = 0 + [LM_Albedo] [LM_Transparency] + _Color ("'Tint' {}", Color) = (1,1,1,1) + [LM_MasterTilingOffset] [LM_Albedo] + _MainTex ("'Base Color(RGB) Paint(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _MainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _MainTexUV ("UV Set", Float) = 0 + [LM_Metallic] + _SpecTex ("'Metal(R) AO(G) Spec(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_MainTex}", 2D) = "white" {} + [LM_NormalMap] + _BumpMap ("'Normals' {Visualize:{NRM}, Parent:_MainTex}", 2D) = "bump" {} + _BaseColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Car Paint Properties + _MainPhysicalProperties ("'Car Paint Properties' {Section:{Color:1}}", Float) = 0 + [LM_Metallic] + _Metal ("'Metallic' {Min:0, Max:1}", Float) = 1 + _Specularity ("'Specularity' {Min:0, Max:1}", Float) = 1 + _Roughness ("'Roughness' {Min:0, Max:1}", Float) = 1 + _Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _BumpScale ("'Normal Strength' {}", Float) = 1 + + // Paint + _PaintProperties ("'Paint' {Section:{Color:2}}", Float) = 0 + _CarPrimaryColor ("'Primary Color' {}", Color) = (1,1,1) + _CarSecondaryColor ("'Secondary Color' {}", Color) = (1,1,1) + _CarSecondaryColorWeight ("'Blend Weight' {Min:0, Max:1}", Float) = 1 + _CarSecondaryColorFalloff ("'Blend Falloff' {Min:0, Max:1}", Float) = 1 + + // Flakes + _FlakeProperties ("'Flakes' {Section:{Color:3}}", Float) = 0 + _CarFlakeColor ("'Tint' {}", Color) = (1,1,1) + _CarFlakeMap ("'Color(RGB) Mask(A)' {Visualize:{RGB,A}}", 2D) = "black" {} + _CarFlakeMapUV ("UV Set", Float) = 0 + _CarFlakeMapFalloff ("'Mask Falloff' {Min:0.01}", Float) = 1 + _CarFlakeWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _CarFlakeSpread ("'Spread' {Min:0, Max:1}", Float) = 0.5 + _CarFlakeHighlightSpread ("'Highlight Spread' {Min:0, Max:1}", Float) = 0.5 + + // ClearCoat Properties + _ClearCoatProperties ("'Clear Coat' {Section:{Color:3}}", Float) = 0 + _ClearCoatColor ("'Tint' {}", Color) = (0,0,0,0.25) + _ClearCoatRoughness ("'Roughness' {Min:0, Max:1}", Float) = 0 + + // Parallax + [Toggle(_PARALLAXMAP)] + _ParallaxT ("'Parallax' {Feature:{Color:5}}", Float) = 0 + [Toggle(_BUMPMODE_POM)] + _BumpMode ("'Mode' {Dropdown:{Parallax:{_MinSamples, _MaxSamples}, POM:{}}}", Float) = 0 + _ParallaxMap ("'Heightmap(G)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "black" {} + _Parallax ("'Height' {Min:0, Max:0.08}", Float) = 0.02 + _MinSamples ("'Min Samples' {Min:1}", Float) = 4 + _MaxSamples ("'Max Samples' {Min:1}", Float) = 20 + + // AO2 + [Toggle(_AO2_ON)] + _AO2 ("'AO2' {Feature:{Color:6}}", Float) = 0 + _Ao2Map ("'AO2(G)' {Visualize:{RGB}}", 2D) = "white" {} + _Ao2MapUV ("UV Set", Float) = 1 + _Ao2Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + + // Detail + [Toggle(_DETAIL_MULX2)] + _DetailT ("'Detail' {Feature:{Color:7}}", Float) = 0 + [Toggle(_NORMALMAP)] + _DetailMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_DetailMask}}}", Float) = 0 + _DetailMask ("'Mask(A)' {Visualize:{A}, Parent:_MainTex}", 2D) = "white" {} + _DetailMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + [Enum(Mul, 0, MulX2, 1)] + _DetailMode ("'Color Mode' {Dropdown:{Mul:{}, MulX2:{}}}", Float) = 0 + _DetailAlbedoMap ("'Color(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _DetailAlbedoMapVelocity ("Scroll", Vector) = (0,0,0,0) + _DetailAlbedoMapUV ("UV Set", Float) = 0 + _DetailNormalMap ("'Normals' {Visualize:{NRM}, Parent:_DetailAlbedoMap}", 2D) = "bump" {} + _DetailWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DetailNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Team Color + [Toggle(_TEAMCOLOR_ON)] + _TeamColor ("'Team Color' {Feature:{Color:8}}", Float) = 0 + [Enum(Masks, 0, Tint, 1)] + _TeamColorMasksAsTint ("'Texture Mode' {Dropdown:{Masks:{}, Tint:{_TeamColorMasks, _TeamColor0, _TeamColor1, _TeamColor2, _TeamColor3}}}", Float) = 0 + _TeamColorMaskMap ("'Masks(RGBA)' {Visualize:{R, G, B, A, RGB}, Parent:_MainTex}", 2D) = "black" {} + _TeamColorMasks ("'Channels' {Vector:Channels}", Vector) = (1,1,1,0) + _TeamColor0 ("'Tint R' {}", Color) = (1,0,0) + _TeamColor1 ("'Tint G' {}", Color) = (0,1,0) + _TeamColor2 ("'Tint B' {}", Color) = (0,0,1) + _TeamColor3 ("'Tint A' {}", Color) = (0.5,0.5,0.5) + + // Decal + [Toggle(_DECAL_ON)] + _Decal ("'Decal' {Feature:{Color:9}}", Float) = 0 + _DecalColor ("'Tint' {}", Color) = (1,1,1,1) + _DecalTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "black" {} + _DecalTexUV ("UV Set", Float) = 0 + _DecalWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DecalSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _DecalAlphaVertexTint ("'Vertex Alpha Tint' {Min:0, Max:1}", Float) = 0 + + // Emission + [Toggle(_EMISSION)] + _Emission ("'Emission' {Feature:{Color:10}}", Float) = 0 + [LM_Emission] + [HDR] + _EmissionColor ("'Tint' {}", Color) = (1,1,1) + [LM_Emission] + _EmissionMap ("'Mask(RGB)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "white" {} + _IncandescenceMap ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _IncandescenceMapVelocity ("Scroll", Vector) = (0,0,0,0) + _IncandescenceMapUV ("UV Set", Float) = 0 + [Gamma] + _EmissionWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + + // Rim Emission + [Toggle(_RIM_ON)] + _Rim ("'Rim Emission' {Feature:{Color:11}}", Float) = 0 + [HDR] + _RimColor ("'Tint' {}", Color) = (1,1,1) + _RimTex ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _RimTexVelocity ("Scroll", Vector) = (0,0,0,0) + _RimTexUV ("UV Set", Float) = 0 + [Gamma] + _RimWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + [Gamma] + _RimBias ("'Fill' {Min:0, Max:1}", Float) = 0 + _RimPower ("'Falloff' {Min:0.01}", Float) = 4 + + // Dissolve + [Toggle(_DISSOLVE_ON)] + _Dissolve ("'Dissolve' {Feature:{Color:12}}", Float) = 0 + [HDR] + _DissolveGlowColor ("'Glow Tint' {}", Color) = (1,1,1,1) + _DissolveTex ("'Glow Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _DissolveTexUV ("UV Set", Float) = 0 + _DissolveCutoff ("'Cutoff' {Min:0, Max:1}", Float) = 0 + [Gamma] + _DissolveGlowWeight ("'Glow Weight' {Min:0, Max:1}", Float) = 1 + _DissolveEdgeWidth ("'Glow Width' {Min:0, Max:1}", Float) = 0.01 + + // Wetness + [Toggle(_WETNESS_ON)] + _WetnessProperties ("'Wetness' {Feature:{Color:13}}", Float) = 0 + [Toggle(_WETMASKSOURCE_VERTEXCOLORALPHA)] + _WetMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_WetMask}}}", Float) = 0 + _WetMask ("'Mask(A)' {Visualize:{A}}", 2D) = "white" {} + _WetMaskVelocity ("Scroll", Vector) = (0,0,0,0) + _WetMaskUV ("UV Set", Float) = 0 + _WetMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + _WetTint ("'Tint' {}", Color) = (1,1,1,1) + _WetNormalMap ("'Normals' {Visualize:{NRM}}", 2D) = "bump" {} + _WetNormalMapVelocity ("Scroll", Vector) = (0,0,0,0) + _WetNormalMapUV ("UV Set", Float) = 0 + _WetWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _WetRoughness ("'Roughness' {Min:0, Max:1}", Float) = 0.2 + _WetNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _Lightmapping ("'GI' {LightmapEmissionProperty:{}}", Float) = 1 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} + +SubShader { + Tags { + "RenderType" = "Opaque" + "PerformanceChecks" = "False" + //"DisableBatching" = "LODFading" + } + LOD 300 + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + Blend [_SrcBlend] [_DstBlend] + ZWrite [_ZWrite] + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Shaders/Definition/CarPaint.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend [_SrcBlend] One + ZWrite Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + + #include "Assets/Alloy/Shaders/Definition/CarPaint.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "CLEARCOAT_FORWARD" + Tags { "LightMode" = "ForwardBase" } + + Blend SrcAlpha OneMinusSrcAlpha + ZWrite Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Mods/Shaders/Definition/CarPaintFullClearCoat.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "CLEARCOAT_FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend SrcAlpha One + ZWrite Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + + #include "Assets/Alloy/Mods/Shaders/Definition/CarPaintFullClearCoat.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature _DISSOLVE_ON + + #pragma multi_compile_shadowcaster + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_SHADOWCASTER + + #include "Assets/Alloy/Shaders/Definition/CarPaint.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Shaders/Definition/CarPaint.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +FallBack "VertexLit" +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Mods/Shaders/3.0/Car Paint Full ClearCoat.shader.meta b/Assets/Alloy/Mods/Shaders/3.0/Car Paint Full ClearCoat.shader.meta new file mode 100644 index 0000000..7ebe879 --- /dev/null +++ b/Assets/Alloy/Mods/Shaders/3.0/Car Paint Full ClearCoat.shader.meta @@ -0,0 +1,26 @@ +fileFormatVersion: 2 +guid: 3fe7630673d8340438ed4b0fcc808b83 +timeCreated: 1448128603 +licenseType: Pro +ShaderImporter: + defaultTextures: + - _MainTex: {instanceID: 0} + - _SpecTex: {instanceID: 0} + - _BumpMap: {instanceID: 0} + - _CarFlakeMap: {instanceID: 0} + - _ParallaxMap: {instanceID: 0} + - _Ao2Map: {instanceID: 0} + - _DetailMask: {instanceID: 0} + - _DetailAlbedoMap: {instanceID: 0} + - _DetailMaterialMap: {fileID: 2800000, guid: 2b77d5cb601375f4ba50c6194c126e59, + type: 3} + - _DetailNormalMap: {instanceID: 0} + - _TeamColorMaskMap: {instanceID: 0} + - _DecalTex: {instanceID: 0} + - _EmissionMap: {instanceID: 0} + - _IncandescenceMap: {instanceID: 0} + - _RimTex: {instanceID: 0} + - _DissolveTex: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Mods/Shaders/3.0/Core CrossFade.shader b/Assets/Alloy/Mods/Shaders/3.0/Core CrossFade.shader new file mode 100644 index 0000000..da3a6ea --- /dev/null +++ b/Assets/Alloy/Mods/Shaders/3.0/Core CrossFade.shader @@ -0,0 +1,363 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy Mods/Core CrossFade" { +Properties { + // Global Settings + _Mode ("'Rendering Mode' {RenderingMode:{Opaque:{_Cutoff}, Cutout:{}, Fade:{_Cutoff}, Transparent:{_Cutoff}}}", Float) = 0 + _SrcBlend ("__src", Float) = 0 + _DstBlend ("__dst", Float) = 0 + _ZWrite ("__zw", Float) = 1 + [LM_TransparencyCutOff] + _Cutoff ("'Opacity Cutoff' {Min:0, Max:1}", Float) = 0.5 + [Toggle(EFFECT_BUMP)] + _HasBumpMap ("'Normals Source' {Dropdown:{VertexNormals:{_BumpMap,_BumpScale,_DetailNormalMap,_DetailNormalMapScale,_WetNormalMap,_WetNormalMapScale}, NormalMaps:{}}}", Float) = 1 + [Toggle(_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A)] + _MainRoughnessSource ("'Roughness Source' {Dropdown:{PackedMapAlpha:{}, BaseColorAlpha:{_SpecTex,_Occlusion}}}", Float) = 0 + + // Main Textures + _MainTextures ("'Main Textures' {Section:{Color:0}}", Float) = 0 + [LM_Albedo] [LM_Transparency] + _Color ("'Tint' {}", Color) = (1,1,1,1) + [LM_MasterTilingOffset] [LM_Albedo] + _MainTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _MainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _MainTexUV ("UV Set", Float) = 0 + [LM_Metallic] + _SpecTex ("'Metal(R) AO(G) Spec(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_MainTex}", 2D) = "white" {} + [LM_NormalMap] + _BumpMap ("'Normals' {Visualize:{NRM}, Parent:_MainTex}", 2D) = "bump" {} + _BaseColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Main Properties + _MainPhysicalProperties ("'Main Properties' {Section:{Color:1}}", Float) = 0 + [LM_Metallic] + _Metal ("'Metallic' {Min:0, Max:1}", Float) = 1 + _Specularity ("'Specularity' {Min:0, Max:1}", Float) = 1 + _SpecularTint ("'Specular Tint' {Min:0, Max:1}", Float) = 0 + _Roughness ("'Roughness' {Min:0, Max:1}", Float) = 1 + _Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _BumpScale ("'Normal Strength' {}", Float) = 1 + + // Parallax + [Toggle(_PARALLAXMAP)] + _ParallaxT ("'Parallax' {Feature:{Color:5}}", Float) = 0 + [Toggle(_BUMPMODE_POM)] + _BumpMode ("'Mode' {Dropdown:{Parallax:{_MinSamples, _MaxSamples}, POM:{}}}", Float) = 0 + _ParallaxMap ("'Heightmap(G)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "black" {} + _Parallax ("'Height' {Min:0, Max:0.08}", Float) = 0.02 + _MinSamples ("'Min Samples' {Min:1}", Float) = 4 + _MaxSamples ("'Max Samples' {Min:1}", Float) = 20 + + // AO2 + [Toggle(_AO2_ON)] + _AO2 ("'AO2' {Feature:{Color:6}}", Float) = 0 + _Ao2Map ("'AO2(G)' {Visualize:{RGB}}", 2D) = "white" {} + _Ao2MapUV ("UV Set", Float) = 1 + _Ao2Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + + // Detail + [Toggle(_DETAIL_MULX2)] + _DetailT ("'Detail' {Feature:{Color:7}}", Float) = 0 + [Toggle(_NORMALMAP)] + _DetailMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_DetailMask}}}", Float) = 0 + _DetailMask ("'Mask(A)' {Visualize:{A}, Parent:_MainTex}", 2D) = "white" {} + _DetailMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + [Enum(Mul, 0, MulX2, 1)] + _DetailMode ("'Color Mode' {Dropdown:{Mul:{}, MulX2:{}}}", Float) = 0 + _DetailAlbedoMap ("'Color(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _DetailAlbedoMapVelocity ("Scroll", Vector) = (0,0,0,0) + _DetailAlbedoMapUV ("UV Set", Float) = 0 + _DetailNormalMap ("'Normals' {Visualize:{NRM}, Parent:_DetailAlbedoMap}", 2D) = "bump" {} + _DetailWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DetailNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Team Color + [Toggle(_TEAMCOLOR_ON)] + _TeamColor ("'Team Color' {Feature:{Color:8}}", Float) = 0 + [Enum(Masks, 0, Tint, 1)] + _TeamColorMasksAsTint ("'Texture Mode' {Dropdown:{Masks:{}, Tint:{_TeamColorMasks, _TeamColor0, _TeamColor1, _TeamColor2, _TeamColor3}}}", Float) = 0 + _TeamColorMaskMap ("'Masks(RGBA)' {Visualize:{R, G, B, A, RGB}, Parent:_MainTex}", 2D) = "black" {} + _TeamColorMasks ("'Channels' {Vector:Channels}", Vector) = (1,1,1,0) + _TeamColor0 ("'Tint R' {}", Color) = (1,0,0) + _TeamColor1 ("'Tint G' {}", Color) = (0,1,0) + _TeamColor2 ("'Tint B' {}", Color) = (0,0,1) + _TeamColor3 ("'Tint A' {}", Color) = (0.5,0.5,0.5) + + // Decal + [Toggle(_DECAL_ON)] + _Decal ("'Decal' {Feature:{Color:9}}", Float) = 0 + _DecalColor ("'Tint' {}", Color) = (1,1,1,1) + _DecalTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "black" {} + _DecalTexUV ("UV Set", Float) = 0 + _DecalWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DecalSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _DecalAlphaVertexTint ("'Vertex Alpha Tint' {Min:0, Max:1}", Float) = 0 + + // Emission + [Toggle(_EMISSION)] + _Emission ("'Emission' {Feature:{Color:10}}", Float) = 0 + [LM_Emission] + [HDR] + _EmissionColor ("'Tint' {}", Color) = (1,1,1) + [LM_Emission] + _EmissionMap ("'Mask(RGB)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "white" {} + _IncandescenceMap ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _IncandescenceMapVelocity ("Scroll", Vector) = (0,0,0,0) + _IncandescenceMapUV ("UV Set", Float) = 0 + [Gamma] + _EmissionWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + + // Rim Emission + [Toggle(_RIM_ON)] + _Rim ("'Rim Emission' {Feature:{Color:11}}", Float) = 0 + [HDR] + _RimColor ("'Tint' {}", Color) = (1,1,1) + _RimTex ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _RimTexVelocity ("Scroll", Vector) = (0,0,0,0) + _RimTexUV ("UV Set", Float) = 0 + [Gamma] + _RimWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + [Gamma] + _RimBias ("'Fill' {Min:0, Max:1}", Float) = 0 + _RimPower ("'Falloff' {Min:0.01}", Float) = 4 + + // Dissolve + [Toggle(_DISSOLVE_ON)] + _Dissolve ("'Dissolve' {Feature:{Color:12}}", Float) = 0 + [HDR] + _DissolveGlowColor ("'Glow Tint' {}", Color) = (1,1,1,1) + _DissolveTex ("'Glow Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _DissolveTexUV ("UV Set", Float) = 0 + _DissolveCutoff ("'Cutoff' {Min:0, Max:1}", Float) = 0 + [Gamma] + _DissolveGlowWeight ("'Glow Weight' {Min:0, Max:1}", Float) = 1 + _DissolveEdgeWidth ("'Glow Width' {Min:0, Max:1}", Float) = 0.01 + + // Wetness + [Toggle(_WETNESS_ON)] + _WetnessProperties ("'Wetness' {Feature:{Color:13}}", Float) = 0 + [Toggle(_WETMASKSOURCE_VERTEXCOLORALPHA)] + _WetMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_WetMask}}}", Float) = 0 + _WetMask ("'Mask(A)' {Visualize:{A}}", 2D) = "white" {} + _WetMaskVelocity ("Scroll", Vector) = (0,0,0,0) + _WetMaskUV ("UV Set", Float) = 0 + _WetMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + _WetTint ("'Tint' {}", Color) = (1,1,1,1) + _WetNormalMap ("'Normals' {Visualize:{NRM}}", 2D) = "bump" {} + _WetNormalMapVelocity ("Scroll", Vector) = (0,0,0,0) + _WetNormalMapUV ("UV Set", Float) = 0 + _WetWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _WetRoughness ("'Roughness' {Min:0, Max:1}", Float) = 0.2 + _WetNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _Lightmapping ("'GI' {LightmapEmissionProperty:{}}", Float) = 1 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} + +SubShader { + Tags { + "RenderType" = "Opaque" + "PerformanceChecks" = "False" + "DisableBatching" = "LODFading" + } + LOD 300 + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + Blend [_SrcBlend] [_DstBlend] + ZWrite [_ZWrite] + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + #pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Shaders/Definition/Core.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend [_SrcBlend] One + ZWrite Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + #pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + + #include "Assets/Alloy/Shaders/Definition/Core.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _DISSOLVE_ON + + #pragma multi_compile_shadowcaster + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_SHADOWCASTER + + #include "Assets/Alloy/Shaders/Definition/Core.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } + + Pass { + Name "DEFERRED" + Tags { "LightMode" = "Deferred" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + #pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_prepassfinal + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_DEFERRED + + #include "Assets/Alloy/Shaders/Definition/Core.cginc" + #include "Assets/Alloy/Shaders/Forward/Gbuffer.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Shaders/Definition/Core.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +FallBack "VertexLit" +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Mods/Shaders/3.0/Core CrossFade.shader.meta b/Assets/Alloy/Mods/Shaders/3.0/Core CrossFade.shader.meta new file mode 100644 index 0000000..f67c3f8 --- /dev/null +++ b/Assets/Alloy/Mods/Shaders/3.0/Core CrossFade.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: d06896bb415c9e44ab843675428549d1 +timeCreated: 1476219339 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Mods/Shaders/3.0/Curvature Test.shader b/Assets/Alloy/Mods/Shaders/3.0/Curvature Test.shader new file mode 100644 index 0000000..c3417cb --- /dev/null +++ b/Assets/Alloy/Mods/Shaders/3.0/Curvature Test.shader @@ -0,0 +1,51 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy Mods/Curvature Test" { +Properties { + _CurvatureScale ("'Curvature Scale' {Min:0.001, Max:0.1}", Float) = 0.005 + + // Advanced Options + _AdvancedOptions("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _RenderQueue("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} + +SubShader { + Tags { + "RenderType" = "Opaque" + "PerformanceChecks" = "False" + "ForceNoShadowCasting" = "True" + //"DisableBatching" = "LODFading" + } + LOD 300 + + Pass { + Name "BASE" + Tags { "LightMode" = "Always" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Mods/Shaders/Definition/CurvatureTest.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } +} + +FallBack "VertexLit" +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Mods/Shaders/3.0/Curvature Test.shader.meta b/Assets/Alloy/Mods/Shaders/3.0/Curvature Test.shader.meta new file mode 100644 index 0000000..14c224b --- /dev/null +++ b/Assets/Alloy/Mods/Shaders/3.0/Curvature Test.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 3a97280fa1bf1ae41a7392cc635defe8 +timeCreated: 1431312227 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Mods/Shaders/3.0/Deferred Decal Advanced.shader b/Assets/Alloy/Mods/Shaders/3.0/Deferred Decal Advanced.shader new file mode 100644 index 0000000..105c0ec --- /dev/null +++ b/Assets/Alloy/Mods/Shaders/3.0/Deferred Decal Advanced.shader @@ -0,0 +1,140 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy Mods/Deferred Decal Advanced" { +Properties { + [Toggle(EFFECT_BUMP)] + _HasBumpMap ("'Normals Source' {Dropdown:{VertexNormals:{_BumpMap,_BumpScale,_DetailNormalMap,_DetailNormalMapScale,_WetNormalMap,_WetNormalMapScale}, NormalMaps:{}}}", Float) = 1 + + // Main Textures + _MainTextures ("'Deferred Decal Textures' {Section:{Color:0}}", Float) = 0 + [LM_Albedo] [LM_Transparency] + _Color ("'Tint' {}", Color) = (1,1,1,1) + [HDR] + _GlowColor("'Glow Tint' {}", Color) = (0,0,0,1) + [LM_Metallic] + _SpecTex ("'Glow(R) AO(G) Alpha(B) Rough(A)' {Visualize:{R, G, B, A}}", 2D) = "white" {} + _SpecTexVelocity ("Scroll", Vector) = (0,0,0,0) + _SpecTexUV ("UV Set", Float) = 0 + [LM_NormalMap] + _BumpMap ("'Normals' {Visualize:{NRM}, Parent:_SpecTex}", 2D) = "bump" {} + _BaseColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Main Properties + _MainPhysicalProperties ("'Deferred Decal Properties' {Section:{Color:1}}", Float) = 0 + [LM_Metallic] + _Metal ("'Metallic' {Min:0, Max:1}", Float) = 1 + _Specularity ("'Specularity' {Min:0, Max:1}", Float) = 1 + _RoughnessMin ("'Roughness Min' {Min:0, Max:1}", Float) = 0 + _RoughnessMax ("'Roughness Max' {Min:0, Max:1}", Float) = 1 + _AoAsCavity ("'Occlusion Cavity' {Min:0, Max:1}", Float) = 0 + _Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _BumpScale ("'Normal Strength' {}", Float) = 1 + + // Decal Blend + _DecalBlendProperties ("'Decal Blend' {Section:{Color:2}}", Float) = 0 + _BaseColorWeight ("'Base Color' {Min:0, Max:1}", Float) = 0 + _NormalsWeight ("'Normals' {Min:0, Max:1}", Float) = 0 + + // Parallax + [Toggle(_PARALLAXMAP)] + _ParallaxT ("'Parallax' {Feature:{Color:5}}", Float) = 0 + [Toggle(_BUMPMODE_POM)] + _BumpMode ("'Mode' {Dropdown:{Parallax:{_MinSamples, _MaxSamples}, POM:{}}}", Float) = 0 + _ParallaxMap ("'Heightmap(G)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "black" {} + _Parallax ("'Height' {Min:0, Max:0.08}", Float) = 0.02 + _MinSamples ("'Min Samples' {Min:1}", Float) = 4 + _MaxSamples ("'Max Samples' {Min:1}", Float) = 20 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} +SubShader { + Tags { + "Queue" = "AlphaTest" + "IgnoreProjector" = "True" + "RenderType" = "Opaque" + "ForceNoShadowCasting" = "True" + //"DisableBatching" = "LODFading" + } + LOD 300 + Offset -1,-1 + + Pass { + Name "DEFERRED" + Tags { "LightMode" = "Deferred" } + + // Only overwrite G-Buffer RGB, but weight whole G-Buffer. + Blend SrcAlpha OneMinusSrcAlpha, Zero OneMinusSrcAlpha + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_prepassfinal + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_DEFERRED + #define A_DECAL_ALPHA_FIRSTPASS_SHADER + + #include "Assets/Alloy/Mods/Shaders/Definition/DeferredDecalAdvanced.cginc" + #include "Assets/Alloy/Shaders/Forward/Gbuffer.cginc" + + ENDCG + } + + Pass { + Name "DEFERRED_ALPHA" + Tags { "LightMode" = "Deferred" } + + // Only overwrite GBuffer A. + Blend One One + ColorMask A + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_prepassfinal + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_DEFERRED + + #include "Assets/Alloy/Mods/Shaders/Definition/DeferredDecalAdvanced.cginc" + #include "Assets/Alloy/Shaders/Forward/Gbuffer.cginc" + + ENDCG + } +} + +FallBack Off +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Mods/Shaders/3.0/Deferred Decal Advanced.shader.meta b/Assets/Alloy/Mods/Shaders/3.0/Deferred Decal Advanced.shader.meta new file mode 100644 index 0000000..7657b5c --- /dev/null +++ b/Assets/Alloy/Mods/Shaders/3.0/Deferred Decal Advanced.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 7a1e62cc814126545a15c640fe07c8d9 +timeCreated: 1448636324 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Mods/Shaders/3.0/Intersection Glow.shader b/Assets/Alloy/Mods/Shaders/3.0/Intersection Glow.shader new file mode 100644 index 0000000..8b4a39f --- /dev/null +++ b/Assets/Alloy/Mods/Shaders/3.0/Intersection Glow.shader @@ -0,0 +1,214 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy Mods/IntersectionGlow" { +Properties { + [Toggle(EFFECT_BUMP)] + _HasBumpMap ("'Normals Source' {Dropdown:{VertexNormals:{_BumpMap,_BumpScale,_DetailNormalMap,_DetailNormalMapScale,_WetNormalMap,_WetNormalMapScale}, NormalMaps:{}}}", Float) = 1 + + // Main Textures + _MainTextures ("'Main Textures' {Section:{Color:0}}", Float) = 0 + [LM_Albedo] [LM_Transparency] + _Color ("'Tint' {}", Color) = (1,1,1,1) + [LM_MasterTilingOffset] [LM_Albedo] + _MainTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _MainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _MainTexUV ("UV Set", Float) = 0 + [LM_Metallic] + _SpecTex ("'Metal(R) AO(G) Spec(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_MainTex}", 2D) = "white" {} + [LM_NormalMap] + _BumpMap ("'Normals' {Visualize:{NRM}, Parent:_MainTex}", 2D) = "bump" {} + _BaseColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Main Properties + _MainPhysicalProperties ("'Main Properties' {Section:{Color:1}}", Float) = 0 + [LM_Metallic] + _Metal ("'Metallic' {Min:0, Max:1}", Float) = 1 + _Specularity ("'Specularity' {Min:0, Max:1}", Float) = 1 + _Roughness ("'Roughness' {Min:0, Max:1}", Float) = 1 + _Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _BumpScale ("'Normal Strength' {}", Float) = 1 + + // Scan Line Properties + _ScanLineProperties ("'Scan Line' {Section:{Color:0}}", Float) = 0 + [HDR] + _ScanLineColor ("'Tint' {}", Color) = (1,1,1) + [Gamma] + _ScanLineWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _ScanLineWidth ("'Width' {Min:0, Max:1}", Float) = 0.1 + + // Emission + [Toggle(_EMISSION)] + _Emission ("'Emission' {Feature:{Color:10}}", Float) = 0 + [LM_Emission] + [HDR] + _EmissionColor ("'Tint' {}", Color) = (1,1,1) + [LM_Emission] + _EmissionMap ("'Mask(RGB)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "white" {} + _IncandescenceMap ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _IncandescenceMapVelocity ("Scroll", Vector) = (0,0,0,0) + _IncandescenceMapUV ("UV Set", Float) = 0 + [Gamma] + _EmissionWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + + // Rim Emission + [Toggle(_RIM_ON)] + _Rim ("'Rim Emission' {Feature:{Color:11}}", Float) = 0 + [HDR] + _RimColor ("'Tint' {}", Color) = (1,1,1) + _RimTex ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _RimTexVelocity ("Scroll", Vector) = (0,0,0,0) + _RimTexUV ("UV Set", Float) = 0 + [Gamma] + _RimWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + [Gamma] + _RimBias ("'Fill' {Min:0, Max:1}", Float) = 0 + _RimPower ("'Falloff' {Min:0.01}", Float) = 4 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} + +SubShader { + Tags{ + "Queue" = "Transparent" + "IgnoreProjector" = "True" + "RenderType" = "Transparent" + //"DisableBatching" = "LODFading" + } + LOD 300 + + Pass { + Name "FORWARD_BACK" + Tags { "LightMode" = "ForwardBase" } + + Blend One OneMinusSrcAlpha + Cull Front + ZWrite Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + #define _INTERSECTION_GLOW_BACKFACE + + #include "Assets/Alloy/Mods/Shaders/Definition/IntersectionGlow.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + Blend One OneMinusSrcAlpha + ZWrite Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Mods/Shaders/Definition/IntersectionGlow.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend One One + ZWrite Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + + #include "Assets/Alloy/Mods/Shaders/Definition/IntersectionGlow.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma multi_compile_shadowcaster + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_SHADOWCASTER + + #include "Assets/Alloy/Mods/Shaders/Definition/IntersectionGlow.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } +} + +FallBack "VertexLit" +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Mods/Shaders/3.0/Intersection Glow.shader.meta b/Assets/Alloy/Mods/Shaders/3.0/Intersection Glow.shader.meta new file mode 100644 index 0000000..617a9e6 --- /dev/null +++ b/Assets/Alloy/Mods/Shaders/3.0/Intersection Glow.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 18f708c060e1c5a4ebb2e44edb38fc1f +timeCreated: 1445983888 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Mods/Shaders/3.0/Masked Core.shader b/Assets/Alloy/Mods/Shaders/3.0/Masked Core.shader new file mode 100644 index 0000000..e2aba50 --- /dev/null +++ b/Assets/Alloy/Mods/Shaders/3.0/Masked Core.shader @@ -0,0 +1,357 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy Mods/Masked Core" { +Properties { + // Global Settings + _Mode ("'Rendering Mode' {RenderingMode:{Opaque:{_Cutoff}, Cutout:{}, Fade:{_Cutoff}, Transparent:{_Cutoff}}}", Float) = 0 + _SrcBlend ("__src", Float) = 0 + _DstBlend ("__dst", Float) = 0 + _ZWrite ("__zw", Float) = 1 + [LM_TransparencyCutOff] + _Cutoff ("'Opacity Cutoff' {Min:0, Max:1}", Float) = 0.5 + [Toggle(EFFECT_BUMP)] + _HasBumpMap ("'Normals Source' {Dropdown:{VertexNormals:{_BumpMap,_BumpScale,_DetailNormalMap,_DetailNormalMapScale,_WetNormalMap,_WetNormalMapScale}, NormalMaps:{}}}", Float) = 1 + [Toggle(_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A)] + _MainRoughnessSource ("'Roughness Source' {Dropdown:{PackedMapAlpha:{}, BaseColorAlpha:{_SpecTex,_Occlusion}}}", Float) = 0 + + // Main Textures + _MainTextures ("'Main Textures' {Section:{Color:0}}", Float) = 0 + [LM_Albedo] [LM_Transparency] + _Color ("'Tint' {}", Color) = (1,1,1,1) + [LM_MasterTilingOffset] [LM_Albedo] + _MainTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _MainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _MainTexUV ("UV Set", Float) = 0 + [LM_Metallic] + _SpecTex ("'Metal(R) AO(G) Spec(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_MainTex}", 2D) = "white" {} + [LM_NormalMap] + _BumpMap ("'Normals' {Visualize:{NRM}, Parent:_MainTex}", 2D) = "bump" {} + _MasksMap ("'Masks' {Visualize:{R, G, B, A}, Parent:_MainTex}", 2D) = "white" {} + _BaseColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Main Properties + _MainPhysicalProperties ("'Main Properties' {Section:{Color:1}}", Float) = 0 + [LM_Metallic] + _Metal ("'Metallic' {Min:0, Max:1}", Float) = 1 + _Specularity ("'Specularity' {Min:0, Max:1}", Float) = 1 + _SpecularTint ("'Specular Tint' {Min:0, Max:1}", Float) = 0 + _Roughness ("'Roughness' {Min:0, Max:1}", Float) = 1 + _Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _BumpScale ("'Normal Strength' {}", Float) = 1 + + // Parallax + [Toggle(_PARALLAXMAP)] + _ParallaxT ("'Parallax' {Feature:{Color:5}}", Float) = 0 + [Toggle(_BUMPMODE_POM)] + _BumpMode ("'Mode' {Dropdown:{Parallax:{_MinSamples, _MaxSamples}, POM:{}}}", Float) = 0 + _ParallaxMap ("'Heightmap(G)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "black" {} + _Parallax ("'Height' {Min:0, Max:0.08}", Float) = 0.02 + _MinSamples ("'Min Samples' {Min:1}", Float) = 4 + _MaxSamples ("'Max Samples' {Min:1}", Float) = 20 + + // AO2 + [Toggle(_AO2_ON)] + _AO2 ("'AO2' {Feature:{Color:6}}", Float) = 0 + _Ao2Map ("'AO2(G)' {Visualize:{RGB}}", 2D) = "white" {} + _Ao2MapUV ("UV Set", Float) = 1 + _Ao2Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + + // Detail + [Toggle(_DETAIL_MULX2)] + _DetailT ("'Detail' {Feature:{Color:7}}", Float) = 0 + _DetailMasks ("'Channels' {Vector:Channels}", Vector) = (0,0,0,1) + [Enum(Mul, 0, MulX2, 1)] + _DetailMode ("'Color Mode' {Dropdown:{Mul:{}, MulX2:{}}}", Float) = 0 + _DetailAlbedoMap ("'Color(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _DetailAlbedoMapVelocity ("Scroll", Vector) = (0,0,0,0) + _DetailAlbedoMapUV ("UV Set", Float) = 0 + _DetailNormalMap ("'Normals' {Visualize:{NRM}, Parent:_DetailAlbedoMap}", 2D) = "bump" {} + _DetailWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DetailNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Team Color + [Toggle(_TEAMCOLOR_ON)] + _TeamColor ("'Team Color' {Feature:{Color:8}}", Float) = 0 + [Enum(Masks, 0, Tint, 1)] + _TeamColorMasksAsTint ("'Texture Mode' {Dropdown:{Masks:{}, Tint:{_TeamColorMasks, _TeamColor0, _TeamColor1, _TeamColor2, _TeamColor3}}}", Float) = 0 + _TeamColorMaskMap ("'Masks(RGBA)' {Visualize:{R, G, B, A, RGB}, Parent:_MainTex}", 2D) = "black" {} + _TeamColorMasks ("'Channels' {Vector:Channels}", Vector) = (1,1,1,0) + _TeamColor0 ("'Tint R' {}", Color) = (1,0,0) + _TeamColor1 ("'Tint G' {}", Color) = (0,1,0) + _TeamColor2 ("'Tint B' {}", Color) = (0,0,1) + _TeamColor3 ("'Tint A' {}", Color) = (0.5,0.5,0.5) + + // Decal + [Toggle(_DECAL_ON)] + _Decal ("'Decal' {Feature:{Color:9}}", Float) = 0 + _DecalColor ("'Tint' {}", Color) = (1,1,1,1) + _DecalTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "black" {} + _DecalTexUV ("UV Set", Float) = 0 + _DecalWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DecalSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _DecalAlphaVertexTint ("'Vertex Alpha Tint' {Min:0, Max:1}", Float) = 0 + + // Emission + [Toggle(_EMISSION)] + _Emission ("'Emission' {Feature:{Color:10}}", Float) = 0 + _EmissionMasks ("'Channels' {Vector:Channels}", Vector) = (0,1,0,0) + [LM_Emission] + [HDR] + _EmissionColor ("'Tint' {}", Color) = (1,1,1) + _IncandescenceMap ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _IncandescenceMapVelocity ("Scroll", Vector) = (0,0,0,0) + _IncandescenceMapUV ("UV Set", Float) = 0 + [Gamma] + _EmissionWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + + // Rim Emission + [Toggle(_RIM_ON)] + _Rim ("'Rim Emission' {Feature:{Color:11}}", Float) = 0 + _RimMasks ("'Channels' {Vector:Channels}", Vector) = (1, 0, 0, 0) + [HDR] + _RimColor ("'Tint' {}", Color) = (1,1,1) + _RimTex ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _RimTexVelocity ("Scroll", Vector) = (0,0,0,0) + _RimTexUV ("UV Set", Float) = 0 + [Gamma] + _RimWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + [Gamma] + _RimBias ("'Fill' {Min:0, Max:1}", Float) = 0 + _RimPower ("'Falloff' {Min:0.01}", Float) = 4 + + // Dissolve + [Toggle(_DISSOLVE_ON)] + _Dissolve ("'Dissolve' {Feature:{Color:12}}", Float) = 0 + [HDR] + _DissolveGlowColor ("'Glow Tint' {}", Color) = (1,1,1,1) + _DissolveTex ("'Glow Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _DissolveTexUV ("UV Set", Float) = 0 + _DissolveCutoff ("'Cutoff' {Min:0, Max:1}", Float) = 0 + [Gamma] + _DissolveGlowWeight ("'Glow Weight' {Min:0, Max:1}", Float) = 1 + _DissolveEdgeWidth ("'Glow Width' {Min:0, Max:1}", Float) = 0.01 + + // Wetness + [Toggle(_WETNESS_ON)] + _WetnessProperties ("'Wetness' {Feature:{Color:13}}", Float) = 0 + [Toggle(_WETMASKSOURCE_VERTEXCOLORALPHA)] + _WetMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_WetMask}}}", Float) = 0 + _WetMask ("'Mask(A)' {Visualize:{A}}", 2D) = "white" {} + _WetMaskVelocity ("Scroll", Vector) = (0,0,0,0) + _WetMaskUV ("UV Set", Float) = 0 + _WetMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + _WetTint ("'Tint' {}", Color) = (1,1,1,1) + _WetNormalMap ("'Normals' {Visualize:{NRM}}", 2D) = "bump" {} + _WetNormalMapVelocity ("Scroll", Vector) = (0,0,0,0) + _WetNormalMapUV ("UV Set", Float) = 0 + _WetWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _WetRoughness ("'Roughness' {Min:0, Max:1}", Float) = 0.2 + _WetNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _Lightmapping ("'GI' {LightmapEmissionProperty:{}}", Float) = 1 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} + +SubShader { + Tags { + "RenderType" = "Opaque" + "PerformanceChecks" = "False" + //"DisableBatching" = "LODFading" + } + LOD 300 + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + Blend [_SrcBlend] [_DstBlend] + ZWrite [_ZWrite] + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Mods/Shaders/Definition/MaskedCore.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend [_SrcBlend] One + ZWrite Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + + #include "Assets/Alloy/Mods/Shaders/Definition/MaskedCore.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _DISSOLVE_ON + + #pragma multi_compile_shadowcaster + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_SHADOWCASTER + + #include "Assets/Alloy/Mods/Shaders/Definition/MaskedCore.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } + + Pass { + Name "DEFERRED" + Tags { "LightMode" = "Deferred" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_prepassfinal + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_DEFERRED + + #include "Assets/Alloy/Mods/Shaders/Definition/MaskedCore.cginc" + #include "Assets/Alloy/Shaders/Forward/Gbuffer.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Mods/Shaders/Definition/MaskedCore.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +FallBack "VertexLit" +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Mods/Shaders/3.0/Masked Core.shader.meta b/Assets/Alloy/Mods/Shaders/3.0/Masked Core.shader.meta new file mode 100644 index 0000000..9422294 --- /dev/null +++ b/Assets/Alloy/Mods/Shaders/3.0/Masked Core.shader.meta @@ -0,0 +1,24 @@ +fileFormatVersion: 2 +guid: 83788f668a8a8c94381852707767c49d +timeCreated: 1448128638 +licenseType: Pro +ShaderImporter: + defaultTextures: + - _MainTex: {instanceID: 0} + - _SpecTex: {instanceID: 0} + - _BumpMap: {instanceID: 0} + - _MasksMap: {instanceID: 0} + - _ParallaxMap: {instanceID: 0} + - _Ao2Map: {instanceID: 0} + - _DetailAlbedoMap: {instanceID: 0} + - _DetailMaterialMap: {fileID: 2800000, guid: 2b77d5cb601375f4ba50c6194c126e59, + type: 3} + - _DetailNormalMap: {instanceID: 0} + - _TeamColorMaskMap: {instanceID: 0} + - _DecalTex: {instanceID: 0} + - _IncandescenceMap: {instanceID: 0} + - _RimTex: {instanceID: 0} + - _DissolveTex: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Mods/Shaders/3.0/Mesh Particle Core.shader b/Assets/Alloy/Mods/Shaders/3.0/Mesh Particle Core.shader new file mode 100644 index 0000000..3e21eab --- /dev/null +++ b/Assets/Alloy/Mods/Shaders/3.0/Mesh Particle Core.shader @@ -0,0 +1,204 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy Mods/Mesh Particle Core" { +Properties { + // Global Settings + _Mode ("'Rendering Mode' {RenderingMode:{Opaque:{_Cutoff}, Cutout:{}, Fade:{_Cutoff}, Transparent:{_Cutoff}}}", Float) = 0 + _SrcBlend ("__src", Float) = 0 + _DstBlend ("__dst", Float) = 0 + _ZWrite ("__zw", Float) = 1 + [LM_TransparencyCutOff] + _Cutoff ("'Opacity Cutoff' {Min:0, Max:1}", Float) = 0.5 + + // Main Textures + _MainTextures ("'Main Textures' {Section:{Color:0}}", Float) = 0 + [LM_Albedo] [LM_Transparency] + _Color ("'Tint' {}", Color) = (1,1,1,1) + [LM_MasterTilingOffset] [LM_Albedo] + _BaseColorRamp ("'Base Color Ramp(RGB)' {Controls:False}", 2D) = "white" {} + _EmissionColorRamp ("'Emission Color Ramp(RGB)' {Controls:False}", 2D) = "black" {} + [Gamma] + _EmissionMin ("'Emission Minimum' {Min:0}", Float) = 0 + [Gamma] + _EmissionMax ("'Emission Maximum' {Min:0}", Float) = 1 + + // Main Properties + _MainPhysicalProperties ("'Main Properties' {Section:{Color:1}}", Float) = 0 + [LM_Metallic] + _Metal ("'Metallic' {Min:0, Max:1}", Float) = 1 + _Specularity ("'Specularity' {Min:0, Max:1}", Float) = 1 + _Roughness ("'Roughness' {Min:0, Max:1}", Float) = 1 + + // Rim Emission + [Toggle(_RIM_ON)] + _Rim ("'Rim Emission' {Feature:{Color:11}}", Float) = 0 + [HDR] + _RimColor ("'Tint' {}", Color) = (1,1,1) + _RimTex ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _RimTexVelocity ("Scroll", Vector) = (0,0,0,0) + _RimTexUV ("UV Set", Float) = 0 + [Gamma] + _RimWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + [Gamma] + _RimBias ("'Fill' {Min:0, Max:1}", Float) = 0 + _RimPower ("'Falloff' {Min:0.01}", Float) = 4 + + // Dissolve + [Toggle(_DISSOLVE_ON)] + _Dissolve ("'Dissolve' {Feature:{Color:12}}", Float) = 0 + [HDR] + _DissolveGlowColor ("'Glow Tint' {}", Color) = (1,1,1,1) + _DissolveTex ("'Glow Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _DissolveTexUV ("UV Set", Float) = 0 + _DissolveCutoff ("'Cutoff' {Min:0, Max:1}", Float) = 0 + [Gamma] + _DissolveGlowWeight ("'Glow Weight' {Min:0, Max:1}", Float) = 1 + _DissolveEdgeWidth ("'Glow Width' {Min:0, Max:1}", Float) = 0.01 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _Lightmapping ("'GI' {LightmapEmissionProperty:{}}", Float) = 1 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} + +SubShader { + Tags { + "RenderType" = "Opaque" + "PerformanceChecks" = "False" + //"DisableBatching" = "LODFading" + } + LOD 300 + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + Blend [_SrcBlend] [_DstBlend] + ZWrite [_ZWrite] + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Mods/Shaders/Definition/MeshParticleCore.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend [_SrcBlend] One + ZWrite Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + + #include "Assets/Alloy/Mods/Shaders/Definition/MeshParticleCore.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature _DISSOLVE_ON + + #pragma multi_compile_shadowcaster + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_SHADOWCASTER + + #include "Assets/Alloy/Mods/Shaders/Definition/MeshParticleCore.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } + + Pass { + Name "DEFERRED" + Tags { "LightMode" = "Deferred" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_prepassfinal + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_DEFERRED + + #include "Assets/Alloy/Mods/Shaders/Definition/MeshParticleCore.cginc" + #include "Assets/Alloy/Shaders/Forward/Gbuffer.cginc" + + ENDCG + } +} + +FallBack "VertexLit" +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Mods/Shaders/3.0/Mesh Particle Core.shader.meta b/Assets/Alloy/Mods/Shaders/3.0/Mesh Particle Core.shader.meta new file mode 100644 index 0000000..d445c3a --- /dev/null +++ b/Assets/Alloy/Mods/Shaders/3.0/Mesh Particle Core.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: e55a1c7ac55954b449607a5acd31fa70 +timeCreated: 1453767151 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Mods/Shaders/3.0/SP Car Paint.shader b/Assets/Alloy/Mods/Shaders/3.0/SP Car Paint.shader new file mode 100644 index 0000000..0861336 --- /dev/null +++ b/Assets/Alloy/Mods/Shaders/3.0/SP Car Paint.shader @@ -0,0 +1,369 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy Mods/SP Car Paint" { +Properties { + // Global Settings + _Mode ("'Rendering Mode' {RenderingMode:{Opaque:{_Cutoff}, Cutout:{}, Fade:{_Cutoff}, Transparent:{_Cutoff}}}", Float) = 0 + _SrcBlend ("__src", Float) = 0 + _DstBlend ("__dst", Float) = 0 + _ZWrite ("__zw", Float) = 1 + [LM_TransparencyCutOff] + _Cutoff ("'Opacity Cutoff' {Min:0, Max:1}", Float) = 0.5 + [Toggle(EFFECT_BUMP)] + _HasBumpMap ("'Normals Source' {Dropdown:{VertexNormals:{_BumpMap,_BumpScale,_DetailNormalMap,_DetailNormalMapScale,_WetNormalMap,_WetNormalMapScale}, NormalMaps:{}}}", Float) = 1 + + // Car Paint Textures + _MainTextures ("'Car Paint Textures' {Section:{Color:0}}", Float) = 0 + [LM_Albedo] [LM_Transparency] + _Color ("'Tint' {}", Color) = (1,1,1,1) + [LM_MasterTilingOffset] [LM_Albedo] + _MainTex ("'Base Color(RGB) Paint(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _MainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _MainTexUV ("UV Set", Float) = 0 + [LM_Metallic] + _SpecTex ("'Metal(R) AO(G) Spec(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_MainTex}", 2D) = "white" {} + [LM_NormalMap] + _BumpMap ("'Normals' {Visualize:{NRM}, Parent:_MainTex}", 2D) = "bump" {} + _BaseColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Car Paint Properties + _MainPhysicalProperties ("'Car Paint Properties' {Section:{Color:1}}", Float) = 0 + [LM_Metallic] + _Metal ("'Metallic' {Min:0, Max:1}", Float) = 1 + _Specularity ("'Specularity' {Min:0, Max:1}", Float) = 1 + _Roughness ("'Roughness' {Min:0, Max:1}", Float) = 1 + _Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _BumpScale ("'Normal Strength' {}", Float) = 1 + + // Paint + _CarPaintProperties ("'Paint' {Section:{Color:2}}", Float) = 0 + _CarPaintSecondaryColor ("'Secondary Color' {}", Color) = (1,1,1) + _CarPaintTertiaryColor ("'Tertiary Color' {}", Color) = (1,1,1) + _CarPaintClearCoatWeight ("'Clear Coat' {Min:0, Max:1}", Float) = 1 + _CarPaintClearCoatRoughness ("'Clear Coat Roughness' {Min:0, Max:1}", Float) = 0.01 + + // Flakes + _CarPaintFlakeProperties ("'Flakes' {Section:{Color:3}}", Float) = 0 + _CarPaintFlakeColor ("'Color' {}", Color) = (1,1,1) + _CarPaintFlakeNormalMap ("'Normals' {Visualize:{NRM}}", 2D) = "bump" {} + _CarPaintFlakeNormalMapUV ("UV Set", Float) = 0 + _CarPaintFlakeWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + + // Parallax + [Toggle(_PARALLAXMAP)] + _ParallaxT ("'Parallax' {Feature:{Color:5}}", Float) = 0 + [Toggle(_BUMPMODE_POM)] + _BumpMode ("'Mode' {Dropdown:{Parallax:{_MinSamples, _MaxSamples}, POM:{}}}", Float) = 0 + _ParallaxMap ("'Heightmap(G)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "black" {} + _Parallax ("'Height' {Min:0, Max:0.08}", Float) = 0.02 + _MinSamples ("'Min Samples' {Min:1}", Float) = 4 + _MaxSamples ("'Max Samples' {Min:1}", Float) = 20 + + // AO2 + [Toggle(_AO2_ON)] + _AO2 ("'AO2' {Feature:{Color:6}}", Float) = 0 + _Ao2Map ("'AO2(G)' {Visualize:{RGB}}", 2D) = "white" {} + _Ao2MapUV ("UV Set", Float) = 1 + _Ao2Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + + // Detail + [Toggle(_DETAIL_MULX2)] + _DetailT ("'Detail' {Feature:{Color:7}}", Float) = 0 + [Toggle(_NORMALMAP)] + _DetailMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_DetailMask}}}", Float) = 0 + _DetailMask ("'Mask(A)' {Visualize:{A}, Parent:_MainTex}", 2D) = "white" {} + _DetailMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + [Enum(Mul, 0, MulX2, 1)] + _DetailMode ("'Color Mode' {Dropdown:{Mul:{}, MulX2:{}}}", Float) = 0 + _DetailAlbedoMap ("'Color(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _DetailAlbedoMapVelocity ("Scroll", Vector) = (0,0,0,0) + _DetailAlbedoMapUV ("UV Set", Float) = 0 + _DetailNormalMap ("'Normals' {Visualize:{NRM}, Parent:_DetailAlbedoMap}", 2D) = "bump" {} + _DetailWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DetailNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Team Color + [Toggle(_TEAMCOLOR_ON)] + _TeamColor ("'Team Color' {Feature:{Color:8}}", Float) = 0 + [Enum(Masks, 0, Tint, 1)] + _TeamColorMasksAsTint ("'Texture Mode' {Dropdown:{Masks:{}, Tint:{_TeamColorMasks, _TeamColor0, _TeamColor1, _TeamColor2, _TeamColor3}}}", Float) = 0 + _TeamColorMaskMap ("'Masks(RGBA)' {Visualize:{R, G, B, A, RGB}, Parent:_MainTex}", 2D) = "black" {} + _TeamColorMasks ("'Channels' {Vector:Channels}", Vector) = (1,1,1,0) + _TeamColor0 ("'Tint R' {}", Color) = (1,0,0) + _TeamColor1 ("'Tint G' {}", Color) = (0,1,0) + _TeamColor2 ("'Tint B' {}", Color) = (0,0,1) + _TeamColor3 ("'Tint A' {}", Color) = (0.5,0.5,0.5) + + // Decal + [Toggle(_DECAL_ON)] + _Decal ("'Decal' {Feature:{Color:9}}", Float) = 0 + _DecalColor ("'Tint' {}", Color) = (1,1,1,1) + _DecalTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "black" {} + _DecalTexUV ("UV Set", Float) = 0 + _DecalWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DecalSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _DecalAlphaVertexTint ("'Vertex Alpha Tint' {Min:0, Max:1}", Float) = 0 + + // Emission + [Toggle(_EMISSION)] + _Emission ("'Emission' {Feature:{Color:10}}", Float) = 0 + [LM_Emission] + [HDR] + _EmissionColor ("'Tint' {}", Color) = (1,1,1) + [LM_Emission] + _EmissionMap ("'Mask(RGB)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "white" {} + _IncandescenceMap ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _IncandescenceMapVelocity ("Scroll", Vector) = (0,0,0,0) + _IncandescenceMapUV ("UV Set", Float) = 0 + [Gamma] + _EmissionWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + + // Rim Emission + [Toggle(_RIM_ON)] + _Rim ("'Rim Emission' {Feature:{Color:11}}", Float) = 0 + [HDR] + _RimColor ("'Tint' {}", Color) = (1,1,1) + _RimTex ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _RimTexVelocity ("Scroll", Vector) = (0,0,0,0) + _RimTexUV ("UV Set", Float) = 0 + [Gamma] + _RimWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + [Gamma] + _RimBias ("'Fill' {Min:0, Max:1}", Float) = 0 + _RimPower ("'Falloff' {Min:0.01}", Float) = 4 + + // Dissolve + [Toggle(_DISSOLVE_ON)] + _Dissolve ("'Dissolve' {Feature:{Color:12}}", Float) = 0 + [HDR] + _DissolveGlowColor ("'Glow Tint' {}", Color) = (1,1,1,1) + _DissolveTex ("'Glow Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _DissolveTexUV ("UV Set", Float) = 0 + _DissolveCutoff ("'Cutoff' {Min:0, Max:1}", Float) = 0 + [Gamma] + _DissolveGlowWeight ("'Glow Weight' {Min:0, Max:1}", Float) = 1 + _DissolveEdgeWidth ("'Glow Width' {Min:0, Max:1}", Float) = 0.01 + + // Wetness + [Toggle(_WETNESS_ON)] + _WetnessProperties ("'Wetness' {Feature:{Color:13}}", Float) = 0 + [Toggle(_WETMASKSOURCE_VERTEXCOLORALPHA)] + _WetMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_WetMask}}}", Float) = 0 + _WetMask ("'Mask(A)' {Visualize:{A}}", 2D) = "white" {} + _WetMaskVelocity ("Scroll", Vector) = (0,0,0,0) + _WetMaskUV ("UV Set", Float) = 0 + _WetMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + _WetTint ("'Tint' {}", Color) = (1,1,1,1) + _WetNormalMap ("'Normals' {Visualize:{NRM}}", 2D) = "bump" {} + _WetNormalMapVelocity ("Scroll", Vector) = (0,0,0,0) + _WetNormalMapUV ("UV Set", Float) = 0 + _WetWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _WetRoughness ("'Roughness' {Min:0, Max:1}", Float) = 0.2 + _WetNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _Lightmapping ("'GI' {LightmapEmissionProperty:{}}", Float) = 1 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} + +SubShader { + Tags { + "RenderType" = "Opaque" + "PerformanceChecks" = "False" + //"DisableBatching" = "LODFading" + } + LOD 300 + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + Blend [_SrcBlend] [_DstBlend] + ZWrite [_ZWrite] + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Mods/Shaders/Definition/SPCarPaint.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend [_SrcBlend] One + ZWrite Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + + #include "Assets/Alloy/Mods/Shaders/Definition/SPCarPaint.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature _DISSOLVE_ON + + #pragma multi_compile_shadowcaster + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_SHADOWCASTER + + #include "Assets/Alloy/Mods/Shaders/Definition/SPCarPaint.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } + + Pass { + Name "DEFERRED" + Tags { "LightMode" = "Deferred" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_prepassfinal + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_DEFERRED + + #include "Assets/Alloy/Mods/Shaders/Definition/SPCarPaint.cginc" + #include "Assets/Alloy/Shaders/Forward/Gbuffer.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Mods/Shaders/Definition/SPCarPaint.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +FallBack "VertexLit" +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Mods/Shaders/3.0/SP Car Paint.shader.meta b/Assets/Alloy/Mods/Shaders/3.0/SP Car Paint.shader.meta new file mode 100644 index 0000000..f3b64bb --- /dev/null +++ b/Assets/Alloy/Mods/Shaders/3.0/SP Car Paint.shader.meta @@ -0,0 +1,27 @@ +fileFormatVersion: 2 +guid: ee9bf235850577c4ba63885aa5357f98 +timeCreated: 1466377540 +licenseType: Pro +ShaderImporter: + defaultTextures: + - _MainTex: {instanceID: 0} + - _SpecTex: {instanceID: 0} + - _BumpMap: {instanceID: 0} + - _CarPaintFlakeNormalMap: {fileID: 2800000, guid: 29ebd85b3434f8c47be667250674ad7d, + type: 3} + - _ParallaxMap: {instanceID: 0} + - _Ao2Map: {instanceID: 0} + - _DetailMask: {instanceID: 0} + - _DetailAlbedoMap: {instanceID: 0} + - _DetailMaterialMap: {fileID: 2800000, guid: 2b77d5cb601375f4ba50c6194c126e59, + type: 3} + - _DetailNormalMap: {instanceID: 0} + - _TeamColorMaskMap: {instanceID: 0} + - _DecalTex: {instanceID: 0} + - _EmissionMap: {instanceID: 0} + - _IncandescenceMap: {instanceID: 0} + - _RimTex: {instanceID: 0} + - _DissolveTex: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Mods/Shaders/3.0/Skin VertexDetail Forward.shader b/Assets/Alloy/Mods/Shaders/3.0/Skin VertexDetail Forward.shader new file mode 100644 index 0000000..15ecfa5 --- /dev/null +++ b/Assets/Alloy/Mods/Shaders/3.0/Skin VertexDetail Forward.shader @@ -0,0 +1,330 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy Mods/Human/Skin VertexDetail (Forward)" { +Properties { + // Skin Textures + _MainTextures ("'Skin Textures' {Section:{Color:0}}", Float) = 0 + [LM_Albedo] [LM_Transparency] + _Color ("'Tint' {}", Color) = (1,1,1,1) + [LM_MasterTilingOffset] [LM_Albedo] + _MainTex ("'Base Color(RGB) SSS(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _MainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _MainTexUV ("UV Set", Float) = 0 + [LM_Metallic] + _SpecTex ("'Metal(R) AO(G) Spec(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_MainTex}", 2D) = "white" {} + [LM_NormalMap] + _BumpMap ("'Normals' {Visualize:{NRM}, Parent:_MainTex}", 2D) = "bump" {} + + // Skin Properties + _MainPhysicalProperties ("'Skin Properties' {Section:{Color:1}}", Float) = 0 + _Metal ("'Metallic' {Min:0, Max:1}", Float) = 1 + _Specularity ("'Specularity' {Min:0, Max:1}", Float) = 1 + _Roughness ("'Roughness' {Min:0, Max:1}", Float) = 1 + _Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _BumpScale ("'Normal Strength' {}", Float) = 1 + + // Skin Scattering + _SkinScatteringProperties ("'Skin Scattering' {Section:{Color:2}}", Float) = 0 + _SssBrdfTex ("'LUT' {Controls:False}", 2D) = "white" {} + _SssWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _SssMaskCutoff ("'Mask Cutoff' {Min:0.01, Max:1}", Float) = 0.1 + _SssBias ("'Bias' {Min:0, Max:1}", Float) = 0 + _SssScale ("'Scale' {Min:0, Max:1}", Float) = 1 + _SssBumpBlur ("'Bump Blur' {Min:0, Max:1}", Float) = 0.7 + _SssTransmissionAbsorption ("'Absorption' {Vector:3}", Vector) = (-8,-40,-64,0) + _SssColorBleedAoWeights ("'AO Color Bleed' {Vector:3}", Vector) = (0.4,0.15,0.13,0) + + // Transmission + _TransmissionProperties ("'Transmission' {Section:{Color:3}}", Float) = 0 + _TransWeight ("'Weight' {Min:0, Max:1}", Float) = 1.0 + _TransDistortion ("'Bump Distortion' {Min:0, Max:1}", Float) = 0.1 + _TransPower ("'Falloff' {Min:1}", Float) = 1 + + // Red Detail + _RedDetail ("'Red Detail' {Section:{Color:{150,0,0}}}", Float) = 0 + _RedDetailMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + _RedDetailNormalMap ("'Normals' {Visualize:{NRM}}", 2D) = "bump" {} + _RedDetailNormalMapVelocity ("Scroll", Vector) = (0,0,0,0) + _RedDetailNormalMapUV ("UV Set", Float) = 0 + _RedDetailWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _RedDetailNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Green Detail + _GreenDetail ("'Green Detail' {Section:{Color:{0,149,0}}}", Float) = 0 + _GreenDetailMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + _GreenDetailNormalMap ("'Normals' {Visualize:{NRM}}", 2D) = "bump" {} + _GreenDetailNormalMapVelocity ("Scroll", Vector) = (0,0,0,0) + _GreenDetailNormalMapUV ("UV Set", Float) = 0 + _GreenDetailWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _GreenDetailNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Blue Detail + _BlueDetail ("'Blue Detail' {Section:{Color:{11,0,148}}}", Float) = 0 + _BlueDetailMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + _BlueDetailNormalMap ("'Normals' {Visualize:{NRM}}", 2D) = "bump" {} + _BlueDetailNormalMapVelocity ("Scroll", Vector) = (0,0,0,0) + _BlueDetailNormalMapUV ("UV Set", Float) = 0 + _BlueDetailWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _BlueDetailNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Alpha Detail + [Toggle(_DETAIL_MULX2)] + _DetailT ("'Alpha Detail' {Feature:{Color:{0,0,0}}}", Float) = 0 + _DetailMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + _DetailNormalMap ("'Normals' {Visualize:{NRM}}", 2D) = "bump" {} + _DetailNormalMapVelocity ("Scroll", Vector) = (0,0,0,0) + _DetailNormalMapUV ("UV Set", Float) = 0 + _DetailWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DetailNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Parallax + [Toggle(_PARALLAXMAP)] + _ParallaxT ("'Parallax' {Feature:{Color:5}}", Float) = 0 + [Toggle(_BUMPMODE_POM)] + _BumpMode ("'Mode' {Dropdown:{Parallax:{_MinSamples, _MaxSamples}, POM:{}}}", Float) = 0 + _ParallaxMap ("'Heightmap(G)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "black" {} + _Parallax ("'Height' {Min:0, Max:0.08}", Float) = 0.02 + _MinSamples ("'Min Samples' {Min:1}", Float) = 4 + _MaxSamples ("'Max Samples' {Min:1}", Float) = 20 + + // Team Color + [Toggle(_TEAMCOLOR_ON)] + _TeamColor ("'Team Color' {Feature:{Color:8}}", Float) = 0 + [Enum(Masks, 0, Tint, 1)] + _TeamColorMasksAsTint ("'Texture Mode' {Dropdown:{Masks:{}, Tint:{_TeamColorMasks, _TeamColor0, _TeamColor1, _TeamColor2, _TeamColor3}}}", Float) = 0 + _TeamColorMaskMap ("'Masks(RGBA)' {Visualize:{R, G, B, A, RGB}, Parent:_MainTex}", 2D) = "black" {} + _TeamColorMasks ("'Channels' {Vector:Channels}", Vector) = (1,1,1,0) + _TeamColor0 ("'Tint R' {}", Color) = (1,0,0) + _TeamColor1 ("'Tint G' {}", Color) = (0,1,0) + _TeamColor2 ("'Tint B' {}", Color) = (0,0,1) + _TeamColor3 ("'Tint A' {}", Color) = (0.5,0.5,0.5) + + // Decal + [Toggle(_DECAL_ON)] + _Decal ("'Decal' {Feature:{Color:9}}", Float) = 0 + _DecalColor ("'Tint' {}", Color) = (1,1,1,1) + _DecalTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "black" {} + _DecalTexUV ("UV Set", Float) = 0 + _DecalWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DecalSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _DecalAlphaVertexTint ("'Vertex Alpha Tint' {Min:0, Max:1}", Float) = 0 + + // Emission + [Toggle(_EMISSION)] + _Emission ("'Emission' {Feature:{Color:10}}", Float) = 0 + [LM_Emission] + [HDR] + _EmissionColor ("'Tint' {}", Color) = (1,1,1) + [LM_Emission] + _EmissionMap ("'Mask(RGB)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "white" {} + _IncandescenceMap ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _IncandescenceMapVelocity ("Scroll", Vector) = (0,0,0,0) + _IncandescenceMapUV ("UV Set", Float) = 0 + [Gamma] + _EmissionWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + + // Rim Emission + [Toggle(_RIM_ON)] + _Rim ("'Rim Emission' {Feature:{Color:11}}", Float) = 0 + [HDR] + _RimColor ("'Tint' {}", Color) = (1,1,1) + _RimTex ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _RimTexVelocity ("Scroll", Vector) = (0,0,0,0) + _RimTexUV ("UV Set", Float) = 0 + [Gamma] + _RimWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + [Gamma] + _RimBias ("'Fill' {Min:0, Max:1}", Float) = 0 + _RimPower ("'Falloff' {Min:0.01}", Float) = 4 + + // Dissolve + [Toggle(_DISSOLVE_ON)] + _Dissolve ("'Dissolve' {Feature:{Color:12}}", Float) = 0 + [HDR] + _DissolveGlowColor ("'Glow Tint' {}", Color) = (1,1,1,1) + _DissolveTex ("'Glow Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _DissolveTexUV ("UV Set", Float) = 0 + _DissolveCutoff ("'Cutoff' {Min:0, Max:1}", Float) = 0 + [Gamma] + _DissolveGlowWeight ("'Glow Weight' {Min:0, Max:1}", Float) = 1 + _DissolveEdgeWidth ("'Glow Width' {Min:0, Max:1}", Float) = 0.01 + + // Wetness + [Toggle(_WETNESS_ON)] + _WetnessProperties ("'Wetness' {Feature:{Color:13}}", Float) = 0 + [Toggle(_WETMASKSOURCE_VERTEXCOLORALPHA)] + _WetMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_WetMask}}}", Float) = 0 + _WetMask ("'Mask(A)' {Visualize:{A}}", 2D) = "white" {} + _WetMaskVelocity ("Scroll", Vector) = (0,0,0,0) + _WetMaskUV ("UV Set", Float) = 0 + _WetMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + _WetTint ("'Tint' {}", Color) = (1,1,1,1) + _WetNormalMap ("'Normals' {Visualize:{NRM}}", 2D) = "bump" {} + _WetNormalMapVelocity ("Scroll", Vector) = (0,0,0,0) + _WetNormalMapUV ("UV Set", Float) = 0 + _WetWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _WetRoughness ("'Roughness' {Min:0, Max:1}", Float) = 0.2 + _WetNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _Lightmapping ("'GI' {LightmapEmissionProperty:{}}", Float) = 1 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} + +CGINCLUDE + #define A_FORWARD_ONLY_SHADER +ENDCG + +SubShader { + Tags { + "Queue" = "Geometry" + "RenderType" = "Opaque" + //"DisableBatching" = "LODFading" + } + LOD 400 + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Mods/Shaders/Definition/SkinVertexDetail.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend One One + ZWrite Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + + #include "Assets/Alloy/Mods/Shaders/Definition/SkinVertexDetail.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _DISSOLVE_ON + + #pragma multi_compile_shadowcaster + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_SHADOWCASTER + + #include "Assets/Alloy/Mods/Shaders/Definition/SkinVertexDetail.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Mods/Shaders/Definition/SkinVertexDetail.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +FallBack "VertexLit" +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Mods/Shaders/3.0/Skin VertexDetail Forward.shader.meta b/Assets/Alloy/Mods/Shaders/3.0/Skin VertexDetail Forward.shader.meta new file mode 100644 index 0000000..b145879 --- /dev/null +++ b/Assets/Alloy/Mods/Shaders/3.0/Skin VertexDetail Forward.shader.meta @@ -0,0 +1,26 @@ +fileFormatVersion: 2 +guid: ea49f5790c7892743bce919f4418de53 +timeCreated: 1476645599 +licenseType: Pro +ShaderImporter: + defaultTextures: + - _MainTex: {instanceID: 0} + - _SpecTex: {instanceID: 0} + - _BumpMap: {instanceID: 0} + - _SssBrdfTex: {fileID: 2800000, guid: d13510bb2be49aa40a66a0101efb6a36, type: 3} + - _ParallaxMap: {instanceID: 0} + - _RedDetailNormalMap: {instanceID: 0} + - _GreenDetailNormalMap: {instanceID: 0} + - _BlueDetailNormalMap: {instanceID: 0} + - _DetailNormalMap: {instanceID: 0} + - _TeamColorMaskMap: {instanceID: 0} + - _DecalTex: {instanceID: 0} + - _EmissionMap: {instanceID: 0} + - _IncandescenceMap: {instanceID: 0} + - _RimTex: {instanceID: 0} + - _DissolveTex: {instanceID: 0} + - _WetMask: {instanceID: 0} + - _WetNormalMap: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Mods/Shaders/3.0/Skin VertexDetail.shader b/Assets/Alloy/Mods/Shaders/3.0/Skin VertexDetail.shader new file mode 100644 index 0000000..38048ea --- /dev/null +++ b/Assets/Alloy/Mods/Shaders/3.0/Skin VertexDetail.shader @@ -0,0 +1,347 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy Mods/Human/Skin VertexDetail" { +Properties { + // Skin Textures + _MainTextures ("'Skin Textures' {Section:{Color:0}}", Float) = 0 + [LM_Albedo] [LM_Transparency] + _Color ("'Tint' {}", Color) = (1,1,1,1) + [LM_MasterTilingOffset] [LM_Albedo] + _MainTex ("'Base Color(RGB) SSS(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _MainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _MainTexUV ("UV Set", Float) = 0 + [LM_Metallic] + _SpecTex ("'Metal(R) AO(G) Spec(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_MainTex}", 2D) = "white" {} + [LM_NormalMap] + _BumpMap ("'Normals' {Visualize:{NRM}, Parent:_MainTex}", 2D) = "bump" {} + + // Skin Properties + _MainPhysicalProperties ("'Skin Properties' {Section:{Color:1}}", Float) = 0 + _Metal ("'Metallic' {Min:0, Max:1}", Float) = 1 + _Specularity ("'Specularity' {Min:0, Max:1}", Float) = 1 + _Roughness ("'Roughness' {Min:0, Max:1}", Float) = 1 + _Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _BumpScale ("'Normal Strength' {}", Float) = 1 + + // Red Detail + _RedDetail ("'Red Detail' {Section:{Color:{150,0,0}}}", Float) = 0 + _RedDetailMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + _RedDetailNormalMap ("'Normals' {Visualize:{NRM}}", 2D) = "bump" {} + _RedDetailNormalMapVelocity ("Scroll", Vector) = (0,0,0,0) + _RedDetailNormalMapUV ("UV Set", Float) = 0 + _RedDetailWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _RedDetailNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Green Detail + _GreenDetail ("'Green Detail' {Section:{Color:{0,149,0}}}", Float) = 0 + _GreenDetailMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + _GreenDetailNormalMap ("'Normals' {Visualize:{NRM}}", 2D) = "bump" {} + _GreenDetailNormalMapVelocity ("Scroll", Vector) = (0,0,0,0) + _GreenDetailNormalMapUV ("UV Set", Float) = 0 + _GreenDetailWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _GreenDetailNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Blue Detail + _BlueDetail ("'Blue Detail' {Section:{Color:{11,0,148}}}", Float) = 0 + _BlueDetailMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + _BlueDetailNormalMap ("'Normals' {Visualize:{NRM}}", 2D) = "bump" {} + _BlueDetailNormalMapVelocity ("Scroll", Vector) = (0,0,0,0) + _BlueDetailNormalMapUV ("UV Set", Float) = 0 + _BlueDetailWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _BlueDetailNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Alpha Detail + [Toggle(_DETAIL_MULX2)] + _DetailT ("'Alpha Detail' {Feature:{Color:{0,0,0}}}", Float) = 0 + _DetailMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + _DetailNormalMap ("'Normals' {Visualize:{NRM}}", 2D) = "bump" {} + _DetailNormalMapVelocity ("Scroll", Vector) = (0,0,0,0) + _DetailNormalMapUV ("UV Set", Float) = 0 + _DetailWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DetailNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Parallax + [Toggle(_PARALLAXMAP)] + _ParallaxT ("'Parallax' {Feature:{Color:5}}", Float) = 0 + [Toggle(_BUMPMODE_POM)] + _BumpMode ("'Mode' {Dropdown:{Parallax:{_MinSamples, _MaxSamples}, POM:{}}}", Float) = 0 + _ParallaxMap ("'Heightmap(G)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "black" {} + _Parallax ("'Height' {Min:0, Max:0.08}", Float) = 0.02 + _MinSamples ("'Min Samples' {Min:1}", Float) = 4 + _MaxSamples ("'Max Samples' {Min:1}", Float) = 20 + + // Team Color + [Toggle(_TEAMCOLOR_ON)] + _TeamColor ("'Team Color' {Feature:{Color:8}}", Float) = 0 + [Enum(Masks, 0, Tint, 1)] + _TeamColorMasksAsTint ("'Texture Mode' {Dropdown:{Masks:{}, Tint:{_TeamColorMasks, _TeamColor0, _TeamColor1, _TeamColor2, _TeamColor3}}}", Float) = 0 + _TeamColorMaskMap ("'Masks(RGBA)' {Visualize:{R, G, B, A, RGB}, Parent:_MainTex}", 2D) = "black" {} + _TeamColorMasks ("'Channels' {Vector:Channels}", Vector) = (1,1,1,0) + _TeamColor0 ("'Tint R' {}", Color) = (1,0,0) + _TeamColor1 ("'Tint G' {}", Color) = (0,1,0) + _TeamColor2 ("'Tint B' {}", Color) = (0,0,1) + _TeamColor3 ("'Tint A' {}", Color) = (0.5,0.5,0.5) + + // Decal + [Toggle(_DECAL_ON)] + _Decal ("'Decal' {Feature:{Color:9}}", Float) = 0 + _DecalColor ("'Tint' {}", Color) = (1,1,1,1) + _DecalTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "black" {} + _DecalTexUV ("UV Set", Float) = 0 + _DecalWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DecalSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _DecalAlphaVertexTint ("'Vertex Alpha Tint' {Min:0, Max:1}", Float) = 0 + + // Emission + [Toggle(_EMISSION)] + _Emission ("'Emission' {Feature:{Color:10}}", Float) = 0 + [LM_Emission] + [HDR] + _EmissionColor ("'Tint' {}", Color) = (1,1,1) + [LM_Emission] + _EmissionMap ("'Mask(RGB)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "white" {} + _IncandescenceMap ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _IncandescenceMapVelocity ("Scroll", Vector) = (0,0,0,0) + _IncandescenceMapUV ("UV Set", Float) = 0 + [Gamma] + _EmissionWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + + // Rim Emission + [Toggle(_RIM_ON)] + _Rim ("'Rim Emission' {Feature:{Color:11}}", Float) = 0 + [HDR] + _RimColor ("'Tint' {}", Color) = (1,1,1) + _RimTex ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _RimTexVelocity ("Scroll", Vector) = (0,0,0,0) + _RimTexUV ("UV Set", Float) = 0 + [Gamma] + _RimWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + [Gamma] + _RimBias ("'Fill' {Min:0, Max:1}", Float) = 0 + _RimPower ("'Falloff' {Min:0.01}", Float) = 4 + + // Dissolve + [Toggle(_DISSOLVE_ON)] + _Dissolve ("'Dissolve' {Feature:{Color:12}}", Float) = 0 + [HDR] + _DissolveGlowColor ("'Glow Tint' {}", Color) = (1,1,1,1) + _DissolveTex ("'Glow Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _DissolveTexUV ("UV Set", Float) = 0 + _DissolveCutoff ("'Cutoff' {Min:0, Max:1}", Float) = 0 + [Gamma] + _DissolveGlowWeight ("'Glow Weight' {Min:0, Max:1}", Float) = 1 + _DissolveEdgeWidth ("'Glow Width' {Min:0, Max:1}", Float) = 0.01 + + // Wetness + [Toggle(_WETNESS_ON)] + _WetnessProperties ("'Wetness' {Feature:{Color:13}}", Float) = 0 + [Toggle(_WETMASKSOURCE_VERTEXCOLORALPHA)] + _WetMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_WetMask}}}", Float) = 0 + _WetMask ("'Mask(A)' {Visualize:{A}}", 2D) = "white" {} + _WetMaskVelocity ("Scroll", Vector) = (0,0,0,0) + _WetMaskUV ("UV Set", Float) = 0 + _WetMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + _WetTint ("'Tint' {}", Color) = (1,1,1,1) + _WetNormalMap ("'Normals' {Visualize:{NRM}}", 2D) = "bump" {} + _WetNormalMapVelocity ("Scroll", Vector) = (0,0,0,0) + _WetNormalMapUV ("UV Set", Float) = 0 + _WetWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _WetRoughness ("'Roughness' {Min:0, Max:1}", Float) = 0.2 + _WetNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _Lightmapping ("'GI' {LightmapEmissionProperty:{}}", Float) = 1 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} + +SubShader { + Tags { + "Queue" = "Geometry" + "RenderType" = "Opaque" + //"DisableBatching" = "LODFading" + } + LOD 400 + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Mods/Shaders/Definition/SkinVertexDetail.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend One One + ZWrite Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + + #include "Assets/Alloy/Mods/Shaders/Definition/SkinVertexDetail.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _DISSOLVE_ON + + #pragma multi_compile_shadowcaster + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_SHADOWCASTER + + #include "Assets/Alloy/Mods/Shaders/Definition/SkinVertexDetail.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } + + Pass { + Name "DEFERRED" + Tags { "LightMode" = "Deferred" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_prepassfinal + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_DEFERRED + + #include "Assets/Alloy/Mods/Shaders/Definition/SkinVertexDetail.cginc" + #include "Assets/Alloy/Shaders/Forward/Gbuffer.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Mods/Shaders/Definition/SkinVertexDetail.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +FallBack "VertexLit" +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Mods/Shaders/3.0/Skin VertexDetail.shader.meta b/Assets/Alloy/Mods/Shaders/3.0/Skin VertexDetail.shader.meta new file mode 100644 index 0000000..ac907c1 --- /dev/null +++ b/Assets/Alloy/Mods/Shaders/3.0/Skin VertexDetail.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: f9c1080e758e7e34fb7f680ae135007a +timeCreated: 1476307332 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Mods/Shaders/3.0/Transition Lite.shader b/Assets/Alloy/Mods/Shaders/3.0/Transition Lite.shader new file mode 100644 index 0000000..d0ff99f --- /dev/null +++ b/Assets/Alloy/Mods/Shaders/3.0/Transition Lite.shader @@ -0,0 +1,238 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy Mods/Transition Lite" { +Properties { + // Global Settings + [Toggle(EFFECT_BUMP)] + _HasBumpMap ("'Normals Source' {Dropdown:{VertexNormals:{_BumpMap,_BumpScale,_DetailNormalMap,_DetailNormalMapScale,_WetNormalMap,_WetNormalMapScale,_BumpMap2,_BumpScale2}, NormalMaps:{}}}", Float) = 1 + [Toggle(_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A)] + _MainRoughnessSource ("'Roughness Source' {Dropdown:{PackedMapAlpha:{}, BaseColorAlpha:{_SpecTex,_Occlusion,_MaterialMap2,_Occlusion2}}}", Float) = 0 + + // Main Textures + _MainTextures ("'Main Textures' {Section:{Color:0}}", Float) = 0 + [LM_Albedo] [LM_Transparency] + _Color ("'Tint' {}", Color) = (1,1,1,1) + [LM_MasterTilingOffset] [LM_Albedo] + _MainTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _MainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _MainTexUV ("UV Set", Float) = 0 + [LM_Metallic] + _SpecTex ("'Metal(R) AO(G) Spec(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_MainTex}", 2D) = "white" {} + [LM_NormalMap] + _BumpMap ("'Normals' {Visualize:{NRM}, Parent:_MainTex}", 2D) = "bump" {} + _BaseColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Main Properties + _MainPhysicalProperties ("'Main Properties' {Section:{Color:1}}", Float) = 0 + [LM_Metallic] + _Metal ("'Metallic' {Min:0, Max:1}", Float) = 1 + _Specularity ("'Specularity' {Min:0, Max:1}", Float) = 1 + _SpecularTint ("'Specular Tint' {Min:0, Max:1}", Float) = 0 + _Roughness ("'Roughness' {Min:0, Max:1}", Float) = 1 + _Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _BumpScale ("'Normal Strength' {}", Float) = 1 + + // Dissolve + [Toggle(_DISSOLVE_ON)] + _Dissolve ("'Dissolve' {Feature:{Color:12}}", Float) = 0 + [HDR] + _DissolveGlowColor ("'Glow Tint' {}", Color) = (1,1,1,1) + _DissolveTex ("'Glow Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _DissolveTexUV ("UV Set", Float) = 0 + _DissolveCutoff ("'Cutoff' {Min:0, Max:1}", Float) = 0 + + // Transition + _TransitionProperties ("'Transition' {Section:{Color:14}}", Float) = 0 + [HDR] + _TransitionGlowColor ("'Glow Tint' {}", Color) = (1,1,1,1) + _TransitionTex ("'Glow Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _TransitionTexUV ("UV Set", Float) = 0 + _TransitionCutoff ("'Cutoff' {Min:0, Max:1}", Float) = 0 + + // Secondary Textures + _SecondaryTextures ("'Secondary Textures' {Section:{Color:15}}", Float) = 0 + _Color2 ("'Tint' {}", Color) = (1,1,1,1) + _MainTex2 ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _MainTex2Velocity ("Scroll", Vector) = (0,0,0,0) + _MainTex2UV ("UV Set", Float) = 0 + _MaterialMap2 ("'Metal(R) AO(G) Spec(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_MainTex2}", 2D) = "white" {} + _BumpMap2 ("'Normals' {Visualize:{NRM}, Parent:_MainTex2}", 2D) = "bump" {} + _BaseColorVertexTint2 ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Secondary Properties + _SecondaryPhysicalProperties ("'Secondary Properties' {Section:{Color:16}}", Float) = 0 + _Metallic2 ("'Metallic' {Min:0, Max:1}", Float) = 1 + _Specularity2 ("'Specularity' {Min:0, Max:1}", Float) = 1 + _SpecularTint2 ("'Specular Tint' {Min:0, Max:1}", Float) = 0 + _Roughness2 ("'Roughness' {Min:0, Max:1}", Float) = 1 + _Occlusion2 ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _BumpScale2 ("'Normal Strength' {}", Float) = 1 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _Lightmapping ("'GI' {LightmapEmissionProperty:{}}", Float) = 1 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} + +SubShader { + Tags { + "Queue" = "Geometry" + "RenderType" = "Opaque" + //"DisableBatching" = "LODFading" + } + LOD 300 + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Mods/Shaders/Definition/TransitionLite.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend One One + ZWrite Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + + #include "Assets/Alloy/Mods/Shaders/Definition/TransitionLite.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + + #pragma multi_compile_shadowcaster + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_SHADOWCASTER + + #include "Assets/Alloy/Mods/Shaders/Definition/TransitionLite.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } + + Pass { + Name "DEFERRED" + Tags { "LightMode" = "Deferred" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_prepassfinal + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_DEFERRED + + #include "Assets/Alloy/Mods/Shaders/Definition/TransitionLite.cginc" + #include "Assets/Alloy/Shaders/Forward/Gbuffer.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Mods/Shaders/Definition/TransitionLite.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +FallBack "VertexLit" +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Mods/Shaders/3.0/Transition Lite.shader.meta b/Assets/Alloy/Mods/Shaders/3.0/Transition Lite.shader.meta new file mode 100644 index 0000000..a4e3667 --- /dev/null +++ b/Assets/Alloy/Mods/Shaders/3.0/Transition Lite.shader.meta @@ -0,0 +1,30 @@ +fileFormatVersion: 2 +guid: cdfd689c0834c8e4d8999c344f3f269b +timeCreated: 1457402672 +licenseType: Pro +ShaderImporter: + defaultTextures: + - _MainTex: {instanceID: 0} + - _SpecTex: {instanceID: 0} + - _BumpMap: {instanceID: 0} + - _ParallaxMap: {instanceID: 0} + - _DetailMask: {instanceID: 0} + - _DetailAlbedoMap: {instanceID: 0} + - _DetailMaterialMap: {fileID: 2800000, guid: 2b77d5cb601375f4ba50c6194c126e59, + type: 3} + - _DetailNormalMap: {instanceID: 0} + - _TeamColorMaskMap: {instanceID: 0} + - _DecalTex: {instanceID: 0} + - _EmissionMap: {instanceID: 0} + - _IncandescenceMap: {instanceID: 0} + - _RimTex: {instanceID: 0} + - _DissolveTex: {instanceID: 0} + - _MainTex2: {instanceID: 0} + - _MaterialMap2: {instanceID: 0} + - _BumpMap2: {instanceID: 0} + - _EmissionMap2: {instanceID: 0} + - _IncandescenceMap2: {instanceID: 0} + - _RimTex2: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Mods/Shaders/3.0/Weathered Blend.shader b/Assets/Alloy/Mods/Shaders/3.0/Weathered Blend.shader new file mode 100644 index 0000000..5665b67 --- /dev/null +++ b/Assets/Alloy/Mods/Shaders/3.0/Weathered Blend.shader @@ -0,0 +1,347 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy Mods/Weathered Blend" { +Properties { + // Global Settings + _Mode ("'Rendering Mode' {RenderingMode:{Opaque:{_Cutoff}, Cutout:{}, Fade:{_Cutoff}, Transparent:{_Cutoff}}}", Float) = 0 + _SrcBlend ("__src", Float) = 0 + _DstBlend ("__dst", Float) = 0 + _ZWrite ("__zw", Float) = 1 + [LM_TransparencyCutOff] + _Cutoff ("'Opacity Cutoff' {Min:0, Max:1}", Float) = 0.5 + [Toggle(EFFECT_BUMP)] + _HasBumpMap ("'Normals Source' {Dropdown:{VertexNormals:{_Layered2MatBumpMap,_Layered2MatBumpScale,_BumpMap,_BumpScale,_DetailNormalMap,_DetailNormalMapScale,_WetNormalMap,_WetNormalMapScale,_BumpMap2,_BumpScale2}, NormalMaps:{}}}", Float) = 1 + [Toggle(_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A)] + _MainRoughnessSource ("'Roughness Source' {Dropdown:{PackedMapAlpha:{}, BaseColorAlpha:{_SpecTex,_Occlusion,_MaterialMap2,_Occlusion2}}}", Float) = 0 + + // Weathered Blend Textures + _Layered2MatTextures ("'Weathered Blend Textures' {Section:-1}", Float) = 0 + _Layered2MatPackedMap ("'Det(R) AO(G) Curv(B) Mask(A)' {Visualize:{R,G,B,A}}", 2D) = "white" {} + _Layered2MatPackedMapUV ("UV Set", Float) = 0 + _Layered2MatBumpMap ("'Normals' {Visualize:{NRM}, Parent:_Layered2MatPackedMap}", 2D) = "bump" {} + _Layered2MatPackedFxMap ("'E Mask(R) Map(G) R Mask(B) Map(A)' {Visualize:{R,G,B,A}, Parent:_Layered2MatPackedMap}", 2D) = "white" {} + + // Weathered Blend + _Layered2MatProperties ("'Weathered Blend' {Section:-1}", Float) = 0 + _Layered2MatOxidation ("'Oxidation' {Min:0, Max:1}", Float) = 1 + _Layered2MatDustTint ("'Dust Tint' {}", Color) = (1,1,1) + _Layered2MatDustiness ("'Dustiness' {Min:0, Max:1}", Float) = 1 + _Layered2MatRougherness ("'Rougherness' {Min:0, Max:1}", Float) = 1 + _Layered2MatOcclusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _Layered2MatBumpScale ("'Normal Strength' {}", Float) = 1 + + // Packed FX Emission Properties + [Toggle(_EMISSION)] + _Emission ("'Packed FX Emission' {Feature:{Color:10}}", Float) = 0 + [LM_Emission] + [HDR] + _EmissionColor ("'Tint' {}", Color) = (1,1,1) + _IncandescenceMap_ST ("'Texcoords' {Vector:TexCoord}", Vector) = (1,1,0,0) + _IncandescenceMapVelocity ("Scroll", Vector) = (0,0,0,0) + _IncandescenceMapUV ("UV Set", Float) = 0 + [Gamma] + _EmissionWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + + // Packed FX Rim Properties + [Toggle(_RIM_ON)] + _Rim ("'Packed FX Rim' {Feature:{Color:11}}", Float) = 0 + [HDR] + _RimColor ("'Tint' {}", Color) = (1,1,1) + _RimTex_ST ("'Texcoords' {Vector:TexCoord}", Vector) = (1,1,0,0) + _RimTexVelocity ("Scroll", Vector) = (0,0,0,0) + _RimTexUV ("UV Set", Float) = 0 + [Gamma] + _RimWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + [Gamma] + _RimBias ("'Fill' {Min:0, Max:1}", Float) = 0 + _RimPower ("'Falloff' {Min:0.01}", Float) = 4 + + // Parallax + [Toggle(_PARALLAXMAP)] + _ParallaxT ("'Parallax' {Feature:{Color:5}}", Float) = 0 + [Toggle(_BUMPMODE_POM)] + _BumpMode ("'Mode' {Dropdown:{Parallax:{_MinSamples, _MaxSamples}, POM:{}}}", Float) = 0 + _ParallaxMap ("'Heightmap(G)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "black" {} + _Parallax ("'Height' {Min:0, Max:0.08}", Float) = 0.02 + _MinSamples ("'Min Samples' {Min:1}", Float) = 4 + _MaxSamples ("'Max Samples' {Min:1}", Float) = 20 + + // Detail + [Toggle(_DETAIL_MULX2)] + _DetailT ("'Detail' {Feature:{Color:7}}", Float) = 0 + _DetailAlbedoMap ("'Color(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _DetailAlbedoMapVelocity ("Scroll", Vector) = (0,0,0,0) + _DetailAlbedoMapUV ("UV Set", Float) = 0 + _DetailNormalMap ("'Normals' {Visualize:{NRM}, Parent:_DetailAlbedoMap}", 2D) = "bump" {} + _DetailWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DetailNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Decal + [Toggle(_DECAL_ON)] + _Decal ("'Decal' {Feature:{Color:9}}", Float) = 0 + [Enum(All, 0, Mat1, 1, Mat2, 2)] + _DecalMode ("'Mode' {Dropdown:{All:{}, Mat1:{}, Mat2:{}}}", Float) = 0 + _DecalColor ("'Tint' {}", Color) = (1,1,1,1) + _DecalTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "black" {} + _DecalTexUV ("UV Set", Float) = 0 + _DecalWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DecalSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _DecalAlphaVertexTint ("'Vertex Alpha Tint' {Min:0, Max:1}", Float) = 0 + + // Wetness + [Toggle(_WETNESS_ON)] + _WetnessProperties ("'Wetness' {Feature:{Color:13}}", Float) = 0 + [Toggle(_WETMASKSOURCE_VERTEXCOLORALPHA)] + _WetMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_WetMask}}}", Float) = 0 + _WetMask ("'Mask(A)' {Visualize:{A}}", 2D) = "white" {} + _WetMaskVelocity ("Scroll", Vector) = (0,0,0,0) + _WetMaskUV ("UV Set", Float) = 0 + _WetMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + _WetTint ("'Tint' {}", Color) = (1,1,1,1) + _WetNormalMap ("'Normals' {Visualize:{NRM}}", 2D) = "bump" {} + _WetNormalMapVelocity ("Scroll", Vector) = (0,0,0,0) + _WetNormalMapUV ("UV Set", Float) = 0 + _WetWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _WetRoughness ("'Roughness' {Min:0, Max:1}", Float) = 0.2 + _WetNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Main Textures + _MainTextures ("'Main Textures' {Section:{Color:0}}", Float) = 0 + [LM_Albedo] [LM_Transparency] + _Color ("'Tint' {}", Color) = (1,1,1,1) + [LM_MasterTilingOffset] [LM_Albedo] + _MainTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _MainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _MainTexUV ("UV Set", Float) = 0 + [LM_Metallic] + _SpecTex ("'Metal(R) AO(G) Spec(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_MainTex}", 2D) = "white" {} + [LM_NormalMap] + _BumpMap ("'Normals' {Visualize:{NRM}, Parent:_MainTex}", 2D) = "bump" {} + _BaseColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Main Properties + _MainPhysicalProperties ("'Main Properties' {Section:{Color:1}}", Float) = 0 + [LM_Metallic] + _Metal ("'Metallic' {Min:0, Max:1}", Float) = 1 + _Specularity ("'Specularity' {Min:0, Max:1}", Float) = 1 + _SpecularTint ("'Specular Tint' {Min:0, Max:1}", Float) = 0 + _Roughness ("'Roughness' {Min:0, Max:1}", Float) = 1 + _Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _BumpScale ("'Normal Strength' {}", Float) = 1 + + // Secondary Textures + _SecondaryTextures ("'Secondary Textures' {Section:{Color:15}}", Float) = 0 + _Color2 ("'Tint' {}", Color) = (1,1,1,1) + _MainTex2 ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _MainTex2Velocity ("Scroll", Vector) = (0,0,0,0) + _MainTex2UV ("UV Set", Float) = 0 + _MaterialMap2 ("'Metal(R) AO(G) Spec(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_MainTex2}", 2D) = "white" {} + _BumpMap2 ("'Normals' {Visualize:{NRM}, Parent:_MainTex2}", 2D) = "bump" {} + _BaseColorVertexTint2 ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Secondary Properties + _SecondaryPhysicalProperties ("'Secondary Properties' {Section:{Color:16}}", Float) = 0 + _Metallic2 ("'Metallic' {Min:0, Max:1}", Float) = 1 + _Specularity2 ("'Specularity' {Min:0, Max:1}", Float) = 1 + _SpecularTint2 ("'Specular Tint' {Min:0, Max:1}", Float) = 0 + _Roughness2 ("'Roughness' {Min:0, Max:1}", Float) = 1 + _Occlusion2 ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _BumpScale2 ("'Normal Strength' {}", Float) = 1 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _Lightmapping ("'GI' {LightmapEmissionProperty:{}}", Float) = 1 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} + +SubShader { + Tags { + "RenderType" = "Opaque" + "PerformanceChecks" = "False" + //"DisableBatching" = "LODFading" + } + LOD 300 + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + Blend [_SrcBlend] [_DstBlend] + ZWrite [_ZWrite] + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Mods/Shaders/Definition/WeatheredBlend.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend [_SrcBlend] One + ZWrite Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _DECAL_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + + #include "Assets/Alloy/Mods/Shaders/Definition/WeatheredBlend.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _DISSOLVE_ON + + #pragma multi_compile_shadowcaster + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_SHADOWCASTER + + #include "Assets/Alloy/Mods/Shaders/Definition/WeatheredBlend.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } + + Pass { + Name "DEFERRED" + Tags { "LightMode" = "Deferred" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_prepassfinal + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_DEFERRED + + #include "Assets/Alloy/Mods/Shaders/Definition/WeatheredBlend.cginc" + #include "Assets/Alloy/Shaders/Forward/Gbuffer.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Mods/Shaders/Definition/WeatheredBlend.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +FallBack "VertexLit" +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Mods/Shaders/3.0/Weathered Blend.shader.meta b/Assets/Alloy/Mods/Shaders/3.0/Weathered Blend.shader.meta new file mode 100644 index 0000000..b55b069 --- /dev/null +++ b/Assets/Alloy/Mods/Shaders/3.0/Weathered Blend.shader.meta @@ -0,0 +1,30 @@ +fileFormatVersion: 2 +guid: 64552fa83c9d9dd42b542c829a17f848 +timeCreated: 1429547447 +licenseType: Pro +ShaderImporter: + defaultTextures: + - _MainTex: {instanceID: 0} + - _SpecTex: {instanceID: 0} + - _BumpMap: {instanceID: 0} + - _ParallaxMap: {instanceID: 0} + - _DetailMask: {instanceID: 0} + - _DetailAlbedoMap: {instanceID: 0} + - _DetailMaterialMap: {fileID: 2800000, guid: 2b77d5cb601375f4ba50c6194c126e59, + type: 3} + - _DetailNormalMap: {instanceID: 0} + - _TeamColorMaskMap: {instanceID: 0} + - _EmissionMap: {instanceID: 0} + - _IncandescenceMap: {instanceID: 0} + - _RimTex: {instanceID: 0} + - _DissolveTex: {instanceID: 0} + - _BlendMap: {instanceID: 0} + - _MainTex2: {instanceID: 0} + - _MaterialMap2: {instanceID: 0} + - _BumpMap2: {instanceID: 0} + - _EmissionMap2: {instanceID: 0} + - _IncandescenceMap2: {instanceID: 0} + - _RimTex2: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Mods/Shaders/Defaults.meta b/Assets/Alloy/Mods/Shaders/Defaults.meta new file mode 100644 index 0000000..d95e577 --- /dev/null +++ b/Assets/Alloy/Mods/Shaders/Defaults.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 1d5ce6b280940a04fba978681110b86c +folderAsset: yes +timeCreated: 1466474958 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Mods/Shaders/Defaults/FlakeSquares3.tga b/Assets/Alloy/Mods/Shaders/Defaults/FlakeSquares3.tga new file mode 100644 index 0000000..99d904f Binary files /dev/null and b/Assets/Alloy/Mods/Shaders/Defaults/FlakeSquares3.tga differ diff --git a/Assets/Alloy/Mods/Shaders/Defaults/FlakeSquares3.tga.meta b/Assets/Alloy/Mods/Shaders/Defaults/FlakeSquares3.tga.meta new file mode 100644 index 0000000..baa0971 --- /dev/null +++ b/Assets/Alloy/Mods/Shaders/Defaults/FlakeSquares3.tga.meta @@ -0,0 +1,58 @@ +fileFormatVersion: 2 +guid: 29ebd85b3434f8c47be667250674ad7d +timeCreated: 1466377404 +licenseType: Pro +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 1 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 7 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 1 + buildTargetSettings: [] + spriteSheet: + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Mods/Shaders/Defaults/HexFlake3.tga b/Assets/Alloy/Mods/Shaders/Defaults/HexFlake3.tga new file mode 100644 index 0000000..d232444 Binary files /dev/null and b/Assets/Alloy/Mods/Shaders/Defaults/HexFlake3.tga differ diff --git a/Assets/Alloy/Mods/Shaders/Defaults/HexFlake3.tga.meta b/Assets/Alloy/Mods/Shaders/Defaults/HexFlake3.tga.meta new file mode 100644 index 0000000..cfb3931 --- /dev/null +++ b/Assets/Alloy/Mods/Shaders/Defaults/HexFlake3.tga.meta @@ -0,0 +1,58 @@ +fileFormatVersion: 2 +guid: 5611b2c1a5dd360479bf938d404c9f35 +timeCreated: 1466377405 +licenseType: Pro +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 1 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 7 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 1 + buildTargetSettings: [] + spriteSheet: + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Mods/Shaders/Defaults/circlemap2_rgba.tga b/Assets/Alloy/Mods/Shaders/Defaults/circlemap2_rgba.tga new file mode 100644 index 0000000..3e99251 Binary files /dev/null and b/Assets/Alloy/Mods/Shaders/Defaults/circlemap2_rgba.tga differ diff --git a/Assets/Alloy/Mods/Shaders/Defaults/circlemap2_rgba.tga.meta b/Assets/Alloy/Mods/Shaders/Defaults/circlemap2_rgba.tga.meta new file mode 100644 index 0000000..bcc031e --- /dev/null +++ b/Assets/Alloy/Mods/Shaders/Defaults/circlemap2_rgba.tga.meta @@ -0,0 +1,55 @@ +fileFormatVersion: 2 +guid: ad02ce311db5cf14fbc0f0aca720d6c6 +timeCreated: 1427763994 +licenseType: Pro +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 8 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -3 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: 5 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Mods/Shaders/Definition.meta b/Assets/Alloy/Mods/Shaders/Definition.meta new file mode 100644 index 0000000..3862b82 --- /dev/null +++ b/Assets/Alloy/Mods/Shaders/Definition.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 1cd5430067795e24fb119bdb4c1a041a +folderAsset: yes +timeCreated: 1424044847 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Mods/Shaders/Definition/CarPaintFastClearCoat.cginc b/Assets/Alloy/Mods/Shaders/Definition/CarPaintFastClearCoat.cginc new file mode 100644 index 0000000..7929f10 --- /dev/null +++ b/Assets/Alloy/Mods/Shaders/Definition/CarPaintFastClearCoat.cginc @@ -0,0 +1,82 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file CarPaintFastClearCoat.cginc +/// @brief Car Paint surface shader definition. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_MODS_SHADERS_DEFINITION_CAR_PAINT_FAST_CLEARCOAT_CGINC +#define ALLOY_MODS_SHADERS_DEFINITION_CAR_PAINT_FAST_CLEARCOAT_CGINC + +#define A_METALLIC_ON +#define A_CLEARCOAT_ON +#define A_MAIN_TEXTURES_ON +#define A_CAR_PAINT_ON + +#ifndef A_NORMAL_WORLD_ON + #define A_NORMAL_WORLD_ON +#endif + +#ifndef A_VIEW_DIR_WORLD_ON + #define A_VIEW_DIR_WORLD_ON +#endif + +#include "Assets/Alloy/Shaders/Lighting/Standard.cginc" +#include "Assets/Alloy/Shaders/Type/Standard.cginc" + +/// Clear Coat weight. +/// Expects values in the range [0,1]. +half _CarPaintClearCoatWeight; + +/// Clear Coat roughness. +/// Expects values in the range [0,1]. +half _CarPaintClearCoatRoughness; + +void aSurfaceShader( + inout ASurface s) +{ + aParallax(s); + aDissolve(s); + aMainTextures(s); + aDetail(s); + aTeamColor(s); + + s.mask = s.opacity; + + // Multi-layer car paint. + // cf http://www.elliottpacel.co.uk/blog/pbr-practice + // cf http://blenderartists.org/forum/showthread.php?250127-Car-Paint-Materials-Iridescent-Layers-Carbon-Fiber-Leather&p=2083499&viewfull=1#post2083499 + + // Two-Tone Paint + half secondaryColorFalloff = 1.0h - pow(s.NdotV, 0.1 + 9.9h * _CarSecondaryColorFalloff); + half secondaryColorWeight = _CarSecondaryColorWeight * secondaryColorFalloff; + half3 paintColor = lerp(_CarPrimaryColor, _CarSecondaryColor, secondaryColorWeight); + + s.baseColor *= aLerpWhiteTo(paintColor, s.mask); + + // Metal Flakes + // NOTE: Metal brightness will overpower clearcoat, hiding roughness difference. + float2 flakeUv = A_TEX_TRANSFORM_UV(s, _CarFlakeMap); + half4 flakes = _CarFlakeColor * tex2D(_CarFlakeMap, flakeUv); + half flakeMask = pow(flakes.a, _CarFlakeMapFalloff); + half flakeSpread = pow(s.NdotV, _CarFlakeSpread * -9.9h + 10.0h); //[10,0] + half flakeWeight = s.mask * flakeMask * flakeSpread * _CarFlakeWeight; + + s.baseColor = lerp(s.baseColor, flakes.rgb, flakeWeight); + s.metallic = lerp(s.metallic, 1.0h, flakeWeight); + s.roughness = lerp(s.roughness, 1.0h, flakeWeight * _CarFlakeHighlightSpread); + + s.clearCoat = s.mask * _CarPaintClearCoatWeight; + s.clearCoatRoughness = _CarPaintClearCoatRoughness; + + s.mask = 1.0h; + aAo2(s); + aDecal(s); + aWetness(s); + aEmission(s); + aRim(s); +} + +#endif // ALLOY_MODS_SHADERS_DEFINITION_CAR_PAINT_FAST_CLEARCOAT_CGINC diff --git a/Assets/Alloy/Mods/Shaders/Definition/CarPaintFastClearCoat.cginc.meta b/Assets/Alloy/Mods/Shaders/Definition/CarPaintFastClearCoat.cginc.meta new file mode 100644 index 0000000..c7f7461 --- /dev/null +++ b/Assets/Alloy/Mods/Shaders/Definition/CarPaintFastClearCoat.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 910b1e25f2acf2e428595ac48716fb57 +timeCreated: 1467590645 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Mods/Shaders/Definition/CarPaintFullClearCoat.cginc b/Assets/Alloy/Mods/Shaders/Definition/CarPaintFullClearCoat.cginc new file mode 100644 index 0000000..413ccf2 --- /dev/null +++ b/Assets/Alloy/Mods/Shaders/Definition/CarPaintFullClearCoat.cginc @@ -0,0 +1,35 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file CarPaint.cginc +/// @brief Car Paint surface shader definition. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_MODS_SHADERS_DEFINITION_CAR_PAINT_CGINC +#define ALLOY_MODS_SHADERS_DEFINITION_CAR_PAINT_CGINC + +#define _ALPHABLEND_ON + +#include "Assets/Alloy/Shaders/Lighting/Standard.cginc" +#include "Assets/Alloy/Shaders/Type/Standard.cginc" + +half4 _ClearCoatColor; +half _ClearCoatRoughness; + +void aSurfaceShader( + inout ASurface s) +{ + aParallax(s); + aDissolve(s); + + // Clear coat should only appear over car paint mask. + half4 base = _Color * aSampleBase(s); + s.opacity = base.a * _ClearCoatColor.a; + s.baseColor = _ClearCoatColor.rgb; + s.roughness = _ClearCoatRoughness; + s.specularity = 0.5h; +} + +#endif // ALLOY_MODS_SHADERS_DEFINITION_CAR_PAINT_CGINC diff --git a/Assets/Alloy/Mods/Shaders/Definition/CarPaintFullClearCoat.cginc.meta b/Assets/Alloy/Mods/Shaders/Definition/CarPaintFullClearCoat.cginc.meta new file mode 100644 index 0000000..a161556 --- /dev/null +++ b/Assets/Alloy/Mods/Shaders/Definition/CarPaintFullClearCoat.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 96dbfa1e0991a4e42922c3df87494ba7 +timeCreated: 1448116598 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Mods/Shaders/Definition/CurvatureTest.cginc b/Assets/Alloy/Mods/Shaders/Definition/CurvatureTest.cginc new file mode 100644 index 0000000..6ab4412 --- /dev/null +++ b/Assets/Alloy/Mods/Shaders/Definition/CurvatureTest.cginc @@ -0,0 +1,32 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file Unlit.cginc +/// @brief Unlit surface shader definition. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_MODS_SHADERS_DEFINITION_UNLIT_CGINC +#define ALLOY_MODS_SHADERS_DEFINITION_UNLIT_CGINC + +#define A_POSITION_WORLD_ON +#define A_NORMAL_WORLD_ON +#define A_EMISSIVE_COLOR_ON + +#include "Assets/Alloy/Shaders/Lighting/Unlit.cginc" +#include "Assets/Alloy/Shaders/Type/Standard.cginc" + +half _CurvatureScale; + +void aSurfaceShader( + inout ASurface s) +{ + // Otherwise stick with ddx or dFdx, which can be replaced with fwidth. + float deltaWorldNormal = length(fwidth(s.normalWorld)); + float deltaWorldPosition = length(fwidth(s.positionWorld)); + + s.emissiveColor = ((deltaWorldNormal / deltaWorldPosition) * _CurvatureScale).rrr; +} + +#endif // ALLOY_MODS_SHADERS_DEFINITION_UNLIT_CGINC diff --git a/Assets/Alloy/Mods/Shaders/Definition/CurvatureTest.cginc.meta b/Assets/Alloy/Mods/Shaders/Definition/CurvatureTest.cginc.meta new file mode 100644 index 0000000..3d266c9 --- /dev/null +++ b/Assets/Alloy/Mods/Shaders/Definition/CurvatureTest.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: ebbe8b74502696940a26a58cc829eccc +timeCreated: 1431312196 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Mods/Shaders/Definition/DeferredDecalAdvanced.cginc b/Assets/Alloy/Mods/Shaders/Definition/DeferredDecalAdvanced.cginc new file mode 100644 index 0000000..455b3d8 --- /dev/null +++ b/Assets/Alloy/Mods/Shaders/Definition/DeferredDecalAdvanced.cginc @@ -0,0 +1,92 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file DeferredDecal.cginc +/// @brief Deferred Decal surface shader definition. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_MODS_SHADERS_DEFINITION_DECAL_CGINC +#define ALLOY_MODS_SHADERS_DEFINITION_DECAL_CGINC + +#define A_METALLIC_ON +#define A_AMBIENT_OCCLUSION_ON + +#define A_SURFACE_CUSTOM_FIELDS \ + half decalMask2; + +#include "Assets/Alloy/Shaders/Framework/Type.cginc" +#include "Assets/Alloy/Shaders/Lighting/Standard.cginc" + +half3 _GlowColor; +half _RoughnessMin; +half _RoughnessMax; +half _AoAsCavity; + +half _BaseColorWeight; +half _NormalsWeight; + +void aVertexShader( + inout AVertex v) +{ + aStandardVertexShader(v); +} + +void aColorShader( + inout half4 color, + ASurface s) +{ + aStandardColorShader(v); +} + +void aGbufferShader( + inout AGbuffer gb, + ASurface s) +{ +#ifdef A_DECAL_ALPHA_FIRSTPASS_SHADER + gb.diffuseOcclusion.a = s.decalMask2; + gb.specularSmoothness.a = s.opacity; + gb.normalType.a = s.opacity; + gb.emissionSubsurface.a = s.decalMask2; + + #ifdef A_SHADOW_MASKS_BUFFER_ON + gb.shadowMasks.a = s.opacity; + #endif +#else + gb.diffuseOcclusion.a *= s.decalMask2; + gb.specularSmoothness.a *= s.opacity; + gb.normalType.a *= s.opacity; + gb.emissionSubsurface.a *= s.decalMask2; // TODO: Apply AO to emission for outside areas' ambient. + + #ifdef A_SHADOW_MASKS_BUFFER_ON + gb.shadowMasks.a *= s.opacity; + #endif +#endif +} + +void aSurfaceShader( + inout ASurface s) +{ + s.baseUv = A_BV(s, A_TEX_TRANSFORM_UV_SCROLL(s, _SpecTex)); + s.baseTiling = _SpecTex_ST.xy; + aParallax(s); + + s.baseColor = _Color.rgb * aBaseVertexColorTint(s); + + half4 material = aSampleMaterial(s); + + s.opacity = _Color.a * material.A_SPECULARITY_CHANNEL; + //s.emissiveColor = _GlowColor * material.A_METALLIC_CHANNEL; + s.decalMask2 = material.A_METALLIC_CHANNEL; + + s.metallic = _Metal; + s.ambientOcclusion = aLerpOneTo(material.A_AO_CHANNEL, _Occlusion); + s.specularity = _Specularity; + s.roughness = lerp(_RoughnessMin, _RoughnessMax, material.A_ROUGHNESS_CHANNEL); + + s.baseColor *= aLerpOneTo(s.ambientOcclusion, _AoAsCavity); + s.normalTangent = A_NT(s, aSampleBump(s)); +} + +#endif // ALLOY_MODS_SHADERS_DEFINITION_DECAL_CGINC diff --git a/Assets/Alloy/Mods/Shaders/Definition/DeferredDecalAdvanced.cginc.meta b/Assets/Alloy/Mods/Shaders/Definition/DeferredDecalAdvanced.cginc.meta new file mode 100644 index 0000000..968113c --- /dev/null +++ b/Assets/Alloy/Mods/Shaders/Definition/DeferredDecalAdvanced.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 2c3e9b58eadb3cc48af3a218a28bd251 +timeCreated: 1448636753 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Mods/Shaders/Definition/IntersectionGlow.cginc b/Assets/Alloy/Mods/Shaders/Definition/IntersectionGlow.cginc new file mode 100644 index 0000000..cb2a1e8 --- /dev/null +++ b/Assets/Alloy/Mods/Shaders/Definition/IntersectionGlow.cginc @@ -0,0 +1,49 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file IntersectionGlow.cginc +/// @brief IntersectionGlow shader definition. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_MODS_SHADERS_DEFINITION_INTERSECTION_GLOW_CGINC +#define ALLOY_MODS_SHADERS_DEFINITION_INTERSECTION_GLOW_CGINC + +#define _ALPHAPREMULTIPLY_ON +#define A_VIEW_DEPTH_ON +#define A_SCREEN_UV_ON +#define A_AMBIENT_OCCLUSION_ON +#define A_EMISSIVE_COLOR_ON +#define A_MAIN_TEXTURES_ON + +#include "Assets/Alloy/Shaders/Lighting/Standard.cginc" +#include "Assets/Alloy/Shaders/Type/Standard.cginc" + +sampler2D_float _CameraDepthTexture; + +half3 _ScanLineColor; +half _ScanLineWeight; +half _ScanLineWidth; + +void aSurfaceShader( + inout ASurface s) +{ +#ifdef _INTERSECTION_GLOW_BACKFACE + s.baseColor = 0.0h; + s.opacity = 0.0h; + s.ambientOcclusion = 0.0h; +#else + aMainTextures(s); + aRim(s); + aEmission(s); +#endif + + float sceneZ = LinearEyeDepth(SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, s.screenUv)); + float fade = saturate(sceneZ - s.viewDepth); + half scan = step(1.0h - _ScanLineWidth, 1.0h - fade); + + s.emissiveColor = lerp(s.emissiveColor, _ScanLineColor * _ScanLineWeight, scan); +} + +#endif // ALLOY_MODS_SHADERS_DEFINITION_INTERSECTION_GLOW_CGINC diff --git a/Assets/Alloy/Mods/Shaders/Definition/IntersectionGlow.cginc.meta b/Assets/Alloy/Mods/Shaders/Definition/IntersectionGlow.cginc.meta new file mode 100644 index 0000000..48ba4da --- /dev/null +++ b/Assets/Alloy/Mods/Shaders/Definition/IntersectionGlow.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 90ddd208522210e4a8a8142de07104d1 +timeCreated: 1445983680 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Mods/Shaders/Definition/MaskedCore.cginc b/Assets/Alloy/Mods/Shaders/Definition/MaskedCore.cginc new file mode 100644 index 0000000..28d38dc --- /dev/null +++ b/Assets/Alloy/Mods/Shaders/Definition/MaskedCore.cginc @@ -0,0 +1,56 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file Core.cginc +/// @brief Core & Glass surface shader definition. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_MODS_SHADERS_DEFINITION_CORE_CGINC +#define ALLOY_MODS_SHADERS_DEFINITION_CORE_CGINC + +#define A_MAIN_TEXTURES_ON +#define A_DETAIL_MASK_OFF +#define A_EMISSION_MASK_MAP_OFF + +#include "Assets/Alloy/Shaders/Lighting/Standard.cginc" +#include "Assets/Alloy/Shaders/Type/Standard.cginc" + +sampler2D _MasksMap; +half4 _DetailMasks; +half4 _EmissionMasks; +half4 _RimMasks; + +void aSurfaceShader( + inout ASurface s) +{ + aParallax(s); + aDissolve(s); + aMainTextures(s); + +#if defined(A_DETAIL_ON) || defined(A_EMISSION_ON) || defined(A_RIM_ON) + half4 masks = tex2D(_MasksMap, s.baseUv); +#endif +#ifdef A_DETAIL_ON + s.mask = aDotClamp(_DetailMasks, masks); + aDetail(s); + s.mask = 1.0h; +#endif + + aTeamColor(s); + aAo2(s); + aDecal(s); + aWetness(s); + +#ifdef A_EMISSION_ON + s.mask = aGammaToLinear(aDotClamp(_EmissionMasks, masks)); + aEmission(s); +#endif +#ifdef A_RIM_ON + s.mask = aGammaToLinear(aDotClamp(_RimMasks, masks)); + aRim(s); +#endif +} + +#endif // ALLOY_MODS_SHADERS_DEFINITION_CORE_CGINC diff --git a/Assets/Alloy/Mods/Shaders/Definition/MaskedCore.cginc.meta b/Assets/Alloy/Mods/Shaders/Definition/MaskedCore.cginc.meta new file mode 100644 index 0000000..78d72be --- /dev/null +++ b/Assets/Alloy/Mods/Shaders/Definition/MaskedCore.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 9b8f57f51f9d4af42aac423cd316e40a +timeCreated: 1447985958 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Mods/Shaders/Definition/MeshParticleCore.cginc b/Assets/Alloy/Mods/Shaders/Definition/MeshParticleCore.cginc new file mode 100644 index 0000000..3aa2b85 --- /dev/null +++ b/Assets/Alloy/Mods/Shaders/Definition/MeshParticleCore.cginc @@ -0,0 +1,51 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file MeshParticleCore.cginc +/// @brief Shader designed for emissive mesh particles. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_MODS_SHADERS_DEFINITION_MESHPARTICLECORE_CGINC +#define ALLOY_MODS_SHADERS_DEFINITION_MESHPARTICLECORE_CGINC + +#ifndef A_VERTEX_COLOR_IS_DATA + #define A_VERTEX_COLOR_IS_DATA +#endif + +#define A_METALLIC_ON +#define A_EMISSIVE_COLOR_ON + +#include "Assets/Alloy/Shaders/Lighting/Standard.cginc" +#include "Assets/Alloy/Shaders/Type/Standard.cginc" + +sampler2D _BaseColorRamp; +sampler2D _EmissionColorRamp; + +// Assumes these are in linear space. +half _EmissionMin; +half _EmissionMax; + +void aSurfaceShader( + inout ASurface s) +{ + aDissolve(s); + + half4 base = _Color; + s.baseColor = base.rgb * tex2D(_BaseColorRamp, float2(s.vertexColor.r, 0.0f)).rgb; + s.opacity = base.a; + + aCutout(s); + + s.metallic = _Metal; + s.specularity = _Specularity; + s.roughness = _Roughness; + + half3 emissionColor = tex2D(_EmissionColorRamp, float2(s.vertexColor.g, 0.0f)).rgb; + s.emissiveColor += emissionColor * lerp(_EmissionMin, _EmissionMax, s.vertexColor.a); + + aRim(s); +} + +#endif // ALLOY_MODS_SHADERS_DEFINITION_MESHPARTICLECORE_CGINC diff --git a/Assets/Alloy/Mods/Shaders/Definition/MeshParticleCore.cginc.meta b/Assets/Alloy/Mods/Shaders/Definition/MeshParticleCore.cginc.meta new file mode 100644 index 0000000..747974b --- /dev/null +++ b/Assets/Alloy/Mods/Shaders/Definition/MeshParticleCore.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: d6e327e0f6664094991c834841a0d1b5 +timeCreated: 1453767149 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Mods/Shaders/Definition/SPCarPaint.cginc b/Assets/Alloy/Mods/Shaders/Definition/SPCarPaint.cginc new file mode 100644 index 0000000..9c074f4 --- /dev/null +++ b/Assets/Alloy/Mods/Shaders/Definition/SPCarPaint.cginc @@ -0,0 +1,85 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file SPCarPaint.cginc +/// @brief SP Car Paint surface shader definition. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_MODS_SHADERS_DEFINITION_SP_CAR_PAINT_CGINC +#define ALLOY_MODS_SHADERS_DEFINITION_SP_CAR_PAINT_CGINC + +#define A_CLEARCOAT_ON +#define A_MAIN_TEXTURES_ON + +#include "Assets/Alloy/Shaders/Lighting/Standard.cginc" +#include "Assets/Alloy/Shaders/Type/Standard.cginc" + +/// The secondary paint tint color. +/// Expects a linear LDR color. +half3 _CarPaintSecondaryColor; + +/// The tertiary paint tint color. +/// Expects a linear LDR color. +half3 _CarPaintTertiaryColor; + +/// Clear Coat weight. +/// Expects values in the range [0,1]. +half _CarPaintClearCoatWeight; + +/// Clear Coat roughness. +/// Expects values in the range [0,1]. +half _CarPaintClearCoatRoughness; + +/// The metallic flake tint color. +/// Expects a linear LDR color. +half3 _CarPaintFlakeColor; + +/// Flake normal map. +/// Expects a compressed normal map. +A_SAMPLER_2D(_CarPaintFlakeNormalMap); + +/// Flake weight. +/// Expects values in the range [0,1]. +half _CarPaintFlakeWeight; + +void aSurfaceShader( + inout ASurface s) +{ + aParallax(s); + aDissolve(s); + aMainTextures(s); + aDetail(s); + aTeamColor(s); + + s.mask = s.opacity; + + // Two-tone car paint with metal flakes. + // http://www.chrisoat.com/papers/Oat-Tatarchuk-Isidoro-Layered_Car_Paint_Shader_Print.pdf + float2 flakeUv = A_TEX_TRANSFORM_UV(s, _CarPaintFlakeNormalMap); + half3 flakeNormalTangent = UnpackScaleNormal(tex2D(_CarPaintFlakeNormalMap, flakeUv), 1.0h); + half3 paintNpWorld = aTangentToWorld(s, 0.2h * flakeNormalTangent + s.normalTangent); + half3 flakeNpWorld = aTangentToWorld(s, _CarPaintFlakeWeight * flakeNormalTangent + s.normalTangent); + half fresnel1 = aDotClamp(paintNpWorld, s.viewDirWorld); + half fresnel2 = aDotClamp(flakeNpWorld, s.viewDirWorld); + half fresnel1Sq = fresnel1 * fresnel1; + half3 paintColor = fresnel1 * s.baseColor + + fresnel1Sq * _CarPaintSecondaryColor + + fresnel1Sq * fresnel1Sq * _CarPaintTertiaryColor + + pow(fresnel2, 16.0h) * _CarPaintFlakeColor; + + // Clear Coat + s.baseColor = lerp(s.baseColor, paintColor, s.mask); + s.clearCoat = s.mask * _CarPaintClearCoatWeight; + s.clearCoatRoughness = _CarPaintClearCoatRoughness; + + s.mask = 1.0h; + aAo2(s); + aDecal(s); + aWetness(s); + aEmission(s); + aRim(s); +} + +#endif // ALLOY_MODS_SHADERS_DEFINITION_SP_CAR_PAINT_CGINC diff --git a/Assets/Alloy/Mods/Shaders/Definition/SPCarPaint.cginc.meta b/Assets/Alloy/Mods/Shaders/Definition/SPCarPaint.cginc.meta new file mode 100644 index 0000000..4e3b635 --- /dev/null +++ b/Assets/Alloy/Mods/Shaders/Definition/SPCarPaint.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 714d054b44b320c428841fc069b26933 +timeCreated: 1460926894 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Mods/Shaders/Definition/SkinVertexDetail.cginc b/Assets/Alloy/Mods/Shaders/Definition/SkinVertexDetail.cginc new file mode 100644 index 0000000..40966c2 --- /dev/null +++ b/Assets/Alloy/Mods/Shaders/Definition/SkinVertexDetail.cginc @@ -0,0 +1,76 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file Skin.cginc +/// @brief Skin surface shader definition. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_MODS_SHADERS_DEFINITION_SKIN_CGINC +#define ALLOY_MODS_SHADERS_DEFINITION_SKIN_CGINC + +#ifndef A_VERTEX_COLOR_IS_DATA + #define A_VERTEX_COLOR_IS_DATA +#endif + +#define A_NORMAL_MAPPING_ON +#define A_SKIN_TEXTURES_ON +#define A_DETAIL_MASK_VERTEX_COLOR_ALPHA_ON +#define A_DETAIL_COLOR_MAP_OFF + +#include "Assets/Alloy/Shaders/Lighting/Standard.cginc" +#include "Assets/Alloy/Shaders/Type/Standard.cginc" + +// Red Detail. +half _RedDetailMaskStrength; +A_SAMPLER_2D(_RedDetailNormalMap); +half _RedDetailWeight; +half _RedDetailNormalMapScale; + +// Green Detail. +half _GreenDetailMaskStrength; +A_SAMPLER_2D(_GreenDetailNormalMap); +half _GreenDetailWeight; +half _GreenDetailNormalMapScale; + +// Blue Detail. +half _BlueDetailMaskStrength; +A_SAMPLER_2D(_BlueDetailNormalMap); +half _BlueDetailWeight; +half _BlueDetailNormalMapScale; + +void aSurfaceShader( + inout ASurface s) +{ + aParallax(s); + aDissolve(s); + aSkinTextures(s); + + // Red Detail. + half mask = _RedDetailWeight * aLerpOneTo(s.vertexColor.r, _RedDetailMaskStrength); + float2 detailUv = A_TEX_TRANSFORM_UV_SCROLL(s, _RedDetailNormalMap); + half3 detailNormalTangent = UnpackScaleNormal(tex2D(_RedDetailNormalMap, detailUv), mask * _RedDetailNormalMapScale); + s.normalTangent = A_NT(s, BlendNormals(s.normalTangent, detailNormalTangent)); + + // Green Detail. + mask = _GreenDetailWeight * aLerpOneTo(s.vertexColor.g, _GreenDetailMaskStrength); + detailUv = A_TEX_TRANSFORM_UV_SCROLL(s, _GreenDetailNormalMap); + detailNormalTangent = UnpackScaleNormal(tex2D(_GreenDetailNormalMap, detailUv), mask * _GreenDetailNormalMapScale); + s.normalTangent = A_NT(s, BlendNormals(s.normalTangent, detailNormalTangent)); + + // Blue Detail. + mask = _BlueDetailWeight * aLerpOneTo(s.vertexColor.b, _BlueDetailMaskStrength); + detailUv = A_TEX_TRANSFORM_UV_SCROLL(s, _BlueDetailNormalMap); + detailNormalTangent = UnpackScaleNormal(tex2D(_BlueDetailNormalMap, detailUv), mask * _BlueDetailNormalMapScale); + s.normalTangent = A_NT(s, BlendNormals(s.normalTangent, detailNormalTangent)); + + aDetail(s); + aTeamColor(s); + aDecal(s); + aWetness(s); + aRim(s); + aEmission(s); +} + +#endif // ALLOY_MODS_SHADERS_DEFINITION_SKIN_CGINC diff --git a/Assets/Alloy/Mods/Shaders/Definition/SkinVertexDetail.cginc.meta b/Assets/Alloy/Mods/Shaders/Definition/SkinVertexDetail.cginc.meta new file mode 100644 index 0000000..6d3625e --- /dev/null +++ b/Assets/Alloy/Mods/Shaders/Definition/SkinVertexDetail.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 8b769521a5e9c1f42a85b0ba36d66ae1 +timeCreated: 1476307263 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Mods/Shaders/Definition/TransitionLite.cginc b/Assets/Alloy/Mods/Shaders/Definition/TransitionLite.cginc new file mode 100644 index 0000000..128f39a --- /dev/null +++ b/Assets/Alloy/Mods/Shaders/Definition/TransitionLite.cginc @@ -0,0 +1,31 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file TransitionLite.cginc +/// @brief Transition Lite shader definition. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_MODS_SHADERS_DEFINITION_TRANSITION_LITE_CGINC +#define ALLOY_MODS_SHADERS_DEFINITION_TRANSITION_LITE_CGINC + +#define A_DISSOLVE_GLOW_OFF +#define A_MAIN_TEXTURES_ON +#define A_TRANSITION_BLEND_ON +#define A_TRANSITION_BLEND_GLOW_OFF +#define A_SECONDARY_TEXTURES_ON + +#include "Assets/Alloy/Shaders/Lighting/Standard.cginc" +#include "Assets/Alloy/Shaders/Type/Standard.cginc" + +void aSurfaceShader( + inout ASurface s) +{ + aDissolve(s); + aMainTextures(s); + aTransitionBlend(s); + aSecondaryTextures(s); +} + +#endif // ALLOY_MODS_SHADERS_DEFINITION_TRANSITION_LITE_CGINC diff --git a/Assets/Alloy/Mods/Shaders/Definition/TransitionLite.cginc.meta b/Assets/Alloy/Mods/Shaders/Definition/TransitionLite.cginc.meta new file mode 100644 index 0000000..7f09d67 --- /dev/null +++ b/Assets/Alloy/Mods/Shaders/Definition/TransitionLite.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: cb517d364100f4c4e91c0e8cbbd68719 +timeCreated: 1457402665 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Mods/Shaders/Definition/WeatheredBlend.cginc b/Assets/Alloy/Mods/Shaders/Definition/WeatheredBlend.cginc new file mode 100644 index 0000000..7baf864 --- /dev/null +++ b/Assets/Alloy/Mods/Shaders/Definition/WeatheredBlend.cginc @@ -0,0 +1,84 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file WeatheredBlend.cginc +/// @brief Weathered Blend shader definition. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_MODS_SHADERS_DEFINITION_WEATHERED_BLEND_CGINC +#define ALLOY_MODS_SHADERS_DEFINITION_WEATHERED_BLEND_CGINC + +#define A_METALLIC_ON +#define A_AMBIENT_OCCLUSION_ON +#define A_MAIN_TEXTURES_ON +#define A_MAIN_TEXTURES_CUTOUT_OFF +#define A_EMISSION_MASK_MAP_OFF +#define A_EMISSION_EFFECTS_MAP_OFF +#define A_RIM_EFFECTS_MAP_OFF +#define A_SECONDARY_TEXTURES_ON + +#include "Assets/Alloy/Shaders/Lighting/Standard.cginc" +#include "Assets/Alloy/Shaders/Type/Standard.cginc" + +A_SAMPLER_2D(_Layered2MatPackedMap); +sampler2D _Layered2MatBumpMap; +sampler2D _Layered2MatPackedFxMap; +half _Layered2MatOxidation; +half3 _Layered2MatDustTint; +half _Layered2MatDustiness; +half _Layered2MatRougherness; +half _Layered2MatOcclusion; +half _Layered2MatBumpScale; + +float _DecalMode; + +void aSurfaceShader( + inout ASurface s) +{ + s.baseUv = A_BV(s, A_TEX_TRANSFORM_UV(s, _Layered2MatPackedMap)); + s.baseTiling = _Layered2MatPackedMap_ST.xy; + aParallax(s); + + half4 packedMap = tex2D(_Layered2MatPackedMap, s.baseUv); + half3 normals = UnpackScaleNormal(tex2D(_Layered2MatBumpMap, s.baseUv), _Layered2MatBumpScale); + half4 packedFx = tex2D(_Layered2MatPackedFxMap, s.baseUv); + + s.baseUv = A_BV(s, A_TEX_TRANSFORM_UV_SCROLL(s, _MainTex)); + aMainTextures(s); + + s.mask = 1.0h - packedMap.a; + aSecondaryTextures(s); + aCutout(s); + + s.normalTangent = A_NT(s, BlendNormals(s.normalTangent, normals)); + s.ambientOcclusion *= aOcclusionStrength(packedMap.g, _Layered2MatOcclusion); + s.mask = packedMap.r; + aDetail(s); + + s.mask = _DecalMode < 0.5f ? 1.0h : (_DecalMode < 1.5f ? packedMap.a : 1.0h - packedMap.a); + aDecal(s); + + s.mask = 1.0h; + aWetness(s); + + half curvature = packedMap.b; + s.baseColor *= lerp(_Layered2MatDustTint, A_WHITE, curvature); + s.specularity = lerp(s.specularity * (1.0h - _Layered2MatDustiness), s.specularity, curvature); + s.metallic = lerp(s.metallic * (1.0h - _Layered2MatOxidation), s.metallic, curvature); + s.roughness = lerp(lerp(s.roughness, 1.0h, _Layered2MatRougherness), s.roughness, curvature); + +#ifdef A_EMISSION_ON + float2 incandescenceUv = A_TEX_TRANSFORM_UV_SCROLL(s, _IncandescenceMap); + s.mask = aGammaToLinear(packedFx.r * tex2D(_Layered2MatPackedFxMap, incandescenceUv).g); + aEmission(s); +#endif +#ifdef A_RIM_ON + float2 rimUv = A_TEX_TRANSFORM_UV_SCROLL(s, _RimTex); + s.mask = aGammaToLinear(packedFx.b * tex2D(_Layered2MatPackedFxMap, rimUv).a); + aRim(s); +#endif +} + +#endif // ALLOY_MODS_SHADERS_DEFINITION_WEATHERED_BLEND_CGINC diff --git a/Assets/Alloy/Mods/Shaders/Definition/WeatheredBlend.cginc.meta b/Assets/Alloy/Mods/Shaders/Definition/WeatheredBlend.cginc.meta new file mode 100644 index 0000000..e25da0b --- /dev/null +++ b/Assets/Alloy/Mods/Shaders/Definition/WeatheredBlend.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 1cb3b1cc14873fb47a214688e355bd37 +timeCreated: 1429547227 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/README.md b/Assets/Alloy/README.md new file mode 100644 index 0000000..4e97673 --- /dev/null +++ b/Assets/Alloy/README.md @@ -0,0 +1,51 @@ +# Alloy +## Pre-Import Checklist +Alright, so we're ready to jump into some Alloy goodness, but there's a few things we want to make sure we're ready for depending on what the state of your project is, and what past version of Alloy (if any) are in your project. +First and foremost, if you are importing a new version of Alloy into a project where _any_ prior version of Alloy existed, it's probably a good idea to have a backup of it (manual or version controlled), just in case something goes awry. + +### Import Steps +1. Ensure you are in a new blank scene. +2. ENSURE that there are NO script errors in your console preventing unity from recompiling assemblies. Alloy will NOT function properly (including our editor scripts), if you attempt to import with standing errors in your project. +3. Import the Alloy package from the Unity Asset Store download window if you have not yet done so. +4. The first thing you'll notice in the Alloy folder is that there is a sub-directory called 'Packages'.Within this directory there will be a package named Alloy3xx_ShadersAndEditorCore. Import this package first. +5. If you are a Windows user, and wish to use Alloy Tesselation Shaders (DX11 only), import the Alloy3xx_SM5Shaders folder. In general these shaders take a bit longer to compile/import, so we suggest only importing the variants you intend on using. +6. Lastly, if you'd like to check out our shweet samples, import the Alloy3SampleAssets package. Enjoy! + +## Setting Up Your Project +Before using Alloy, there a couple things you MUST set up in your project: + +1. Open Edit->Project Settings->Graphics. +2. Set the 'Deferred' setting to 'Custom shader'. +3. Open the picker below, and select the 'Alloy Deferred Shading' shader. + * See "Advanced Setup" section for additional options. +4. Set the 'Deferred Reflections' setting to 'Custom shader'. +5. Open the picker below, and select the 'Alloy Deferred Reflections' shader. +6. Open Edit->Project Settings->Player. +7. Open the 'Other Settings' rollout. +8. Set 'Color Space' to 'Linear'. +9. If you wish to use many lights, set 'Rendering Path' to 'Deferred'. +10. Select your camera in your scene. +11. Check the 'HDR' box. +12. Open Edit->Project Settings->Quality. +13. Ensure 'Anti-aliasing' on the Quality Setting your are using is set to 'none', or HDR will be silently disabled on your camera (ಠ_ಠ THANKS UNITY ಠ_ಠ). +14. Go to Window->Alloy->Light Migrator and wait for it to finish updating your scene's existing lights. +15. Now save your scene. + +## Advanced Setup +To use the Skin, SpeedTree, and/or Transmission shaders in deferred mode, you MUST do the following: + +1. Open Edit->Project Settings->Graphics. +2. Set the 'Deferred' setting to 'Custom shader'. +3. Open the picker below, and select either the 'Alloy Deferred Skin' or 'Alloy Deferred Transmission' shader based on your performance requirements. + * 'Alloy Deferred Transmission' covers the SpeedTree and Transmission shaders. + * 'Alloy Deferred Skin' covers the Skin, SpeedTree, and Transmission shaders. +4. Go to the "Hierarchy" tab, and select your camera. +5. Add the component "Alloy/Alloy Effects Manager". +6. Add or remove the "Skin Scattering" and/or "Transmission" tabs to reduce cost. +7. Set your materials to the "Alloy/Human/Skin" or "Alloy/Transmission/*" shaders. + +## Documentation +1. Go to Window->Alloy->Documentation. +2. Change windows to the newly opened browser tab. + +Now you're ready to play! diff --git a/Assets/Alloy/README.md.meta b/Assets/Alloy/README.md.meta new file mode 100644 index 0000000..1ea5bed --- /dev/null +++ b/Assets/Alloy/README.md.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: f291bb48e3add3740b96366aa1abcaab +timeCreated: 1509893722 +licenseType: Pro +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/REQUIRED ACTIONS.txt b/Assets/Alloy/REQUIRED ACTIONS.txt new file mode 100644 index 0000000..4869cae --- /dev/null +++ b/Assets/Alloy/REQUIRED ACTIONS.txt @@ -0,0 +1,7 @@ +--ATTENTION-- +After upgrading to Alloy 4.1.1 or later for the first time, please do the following: +1.) Check if you have any materials with "Eye", "Directional Blend", "TriPlanar", or "Vertex Blend" in TriPlanar mode shaders in your project. +2.) If so, run "Window->Alloy->Material Migrator" tool ONLY once and never again. +3.) After it completes, save your project. + +For documentation, go to the menu "Window->Alloy->Documentation". \ No newline at end of file diff --git a/Assets/Alloy/REQUIRED ACTIONS.txt.meta b/Assets/Alloy/REQUIRED ACTIONS.txt.meta new file mode 100644 index 0000000..2b64199 --- /dev/null +++ b/Assets/Alloy/REQUIRED ACTIONS.txt.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 72358b1335c9b214783cf0a0c9c21d41 +timeCreated: 1490911051 +licenseType: Pro +TextScriptImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Scripts.meta b/Assets/Alloy/Scripts.meta new file mode 100644 index 0000000..2bc0114 --- /dev/null +++ b/Assets/Alloy/Scripts.meta @@ -0,0 +1,6 @@ +fileFormatVersion: 2 +guid: 76ed0b732f3dd7b40a598e20680a2fd7 +folderAsset: yes +DefaultImporter: + userData: + assetBundleName: diff --git a/Assets/Alloy/Scripts/AlloyPropertyAttributes.cs b/Assets/Alloy/Scripts/AlloyPropertyAttributes.cs new file mode 100644 index 0000000..abb90fe --- /dev/null +++ b/Assets/Alloy/Scripts/AlloyPropertyAttributes.cs @@ -0,0 +1,23 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +using UnityEngine; + +public class MinValueAttribute : PropertyAttribute { + public float Min; + + public MinValueAttribute(float min) { + Min = min; + } +} + + +public class MaxValueAttribute : PropertyAttribute { + public float Max; + + public MaxValueAttribute(float min) { + Max = min; + } +} + diff --git a/Assets/Alloy/Scripts/AlloyPropertyAttributes.cs.meta b/Assets/Alloy/Scripts/AlloyPropertyAttributes.cs.meta new file mode 100644 index 0000000..f125c22 --- /dev/null +++ b/Assets/Alloy/Scripts/AlloyPropertyAttributes.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 48d3cf2ec372bd34fa4b3bd9f05b6132 +timeCreated: 1445390687 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Scripts/AlloyUtils.cs b/Assets/Alloy/Scripts/AlloyUtils.cs new file mode 100644 index 0000000..477e0de --- /dev/null +++ b/Assets/Alloy/Scripts/AlloyUtils.cs @@ -0,0 +1,27 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +using UnityEngine; + +public static class AlloyUtils { + public const string Name = "Alloy"; + public const string Version = "3.6.4"; + public const float SectionColorMax = 20.0f; + + public const string Path = Name + "/"; + public const string MenuItem = "Window/" + Path; + public const string ComponentMenu = Path + Name + " "; + + public static string AssetsPath { + get { return Application.dataPath + "/" + Path; } + } + + //public static float IntensityToLumens(float intensity) { + // return Mathf.Floor(Mathf.GammaToLinearSpace(intensity) * 100.0f); + //} + + //public static float LumensToIntensity(float lumens) { + // return Mathf.LinearToGammaSpace(lumens / 100.0f); + //} +} diff --git a/Assets/Alloy/Scripts/AlloyUtils.cs.meta b/Assets/Alloy/Scripts/AlloyUtils.cs.meta new file mode 100644 index 0000000..b8afd05 --- /dev/null +++ b/Assets/Alloy/Scripts/AlloyUtils.cs.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: c9500e8a2783ced4aa7f8c3488e304b5 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: diff --git a/Assets/Alloy/Scripts/AreaLight.meta b/Assets/Alloy/Scripts/AreaLight.meta new file mode 100644 index 0000000..1383583 --- /dev/null +++ b/Assets/Alloy/Scripts/AreaLight.meta @@ -0,0 +1,6 @@ +fileFormatVersion: 2 +guid: 608acff29777b4548909fea9555edd26 +folderAsset: yes +DefaultImporter: + userData: + assetBundleName: diff --git a/Assets/Alloy/Scripts/AreaLight/AlloyAreaLight.cs b/Assets/Alloy/Scripts/AreaLight/AlloyAreaLight.cs new file mode 100644 index 0000000..e0b2094 --- /dev/null +++ b/Assets/Alloy/Scripts/AreaLight/AlloyAreaLight.cs @@ -0,0 +1,178 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ +// We don't need this for MeatKit because it gets imported with the game assembly. +/* +#if UNITY_EDITOR +using UnityEditor; +#endif + +using System; +using UnityEngine; +using UnityEngine.Serialization; + +[ExecuteInEditMode] +[RequireComponent(typeof(Light))] +[AddComponentMenu(AlloyUtils.ComponentMenu + "Area Light")] +public class AlloyAreaLight : MonoBehaviour { + // Minimum non-zero value for light size, so we can use sign for specular toggle. + const float c_minimumLightSize = 0.00001f; + + // Minimum light intensity to prevent divide by zero (because Epsilon causes infinity). + const float c_minimumLightIntensity = 0.01f; + + [HideInInspector] + public Texture2D DefaultSpotLightCookie; + + [FormerlySerializedAs("m_size")] + [SerializeField] + float m_radius; + + [SerializeField] + float m_length; + + [SerializeField] + bool m_hasSpecularHightlight = true; + + Light m_light; + Color m_lastColor; + float m_lastIntensity; + float m_lastRange; + + Light Light { + get { + // Ensures that we have the light component, even if light is disabled. + if (m_light == null) + m_light = GetComponent(); + + return m_light; + } + } + + public float Radius { + get { return m_radius; } + set { + if (m_radius != value) { + m_radius = value; + UpdateBinding(); + } + } + } + + public float Length { + get { return m_length; } + set { + if (m_length != value) { + m_length = value; + UpdateBinding(); + } + } + } + + public bool HasSpecularHighlight { + get { return m_hasSpecularHightlight; } + set { + if (m_hasSpecularHightlight != value) { + m_hasSpecularHightlight = value; + UpdateBinding(); + } + } + } + + void Reset() { + m_hasSpecularHightlight = true; + m_radius = 0.0f; + m_length = 0.0f; + + m_lastColor = Color.black; + m_lastIntensity = 0.0f; + m_lastRange = 0.0f; + + UpdateBinding(); + } + + // Must run after all other light scripts and animation clips. + void LateUpdate() { + var l = Light; + + // Poll the Light component, since we can't extend it. + if (l.color != m_lastColor + || l.intensity != m_lastIntensity + || l.range != m_lastRange) { + UpdateBinding(); + } + } + + public void UpdateBinding() { + var l = Light; + var color = l.color; + var intensity = l.intensity; + var range = l.range; + +#if UNITY_EDITOR + EnsureCookie(); +#endif + + if (l.type == LightType.Directional) { + m_radius = Mathf.Clamp01(m_radius); + color.a = 10.0f * m_radius; // Cancel 0.1 * n in the shader. + } + else { + // Radius packed into fractional component of number. + var maxRadius = range; + m_radius = Mathf.Clamp(m_radius, 0.0f, maxRadius); + color.a = Mathf.Min(0.999f, m_radius / maxRadius); + + if (l.type == LightType.Point) { + // Length packed into integer component of number. + var maxLength = 2.0f * range; + m_length = Mathf.Clamp(m_length, 0.0f, maxLength); + color.a += Mathf.Ceil(1000.0f * Mathf.Min(1.0f, m_length / maxLength)); + } + } + + // Specular highlight toggle in sign component of number. + color.a = Mathf.Max(c_minimumLightSize, color.a); // Must be non-zero! + color.a *= (m_hasSpecularHightlight ? 1.0f : -1.0f); + + // Cancel Unity's implicit intensity multiply. + color.a /= Mathf.Max(intensity, c_minimumLightIntensity); + l.color = color; + + m_lastColor = color; + m_lastIntensity = intensity; + m_lastRange = range; + } + +#if UNITY_EDITOR + public void EnsureCookie() { + var l = Light; + + if (l.type == LightType.Spot && l.cookie == null) { + l.cookie = DefaultSpotLightCookie; + EditorUtility.SetDirty(this); + } else if (l.type == LightType.Point && l.cookie == DefaultSpotLightCookie) { + l.cookie = null; + EditorUtility.SetDirty(this); + } + } +#endif + + // DEPRECATED BEGIN + [Obsolete("Please use Unity Light component's \"color\" field.")] + public Color Color { + get { return Light.color; } + set { Light.color = value; } + } + + [Obsolete("Please use Unity Light component's \"intensity\" field.")] + public float Intensity { + get { return Light.intensity; } + set { Light.intensity = value; } + } + + [Obsolete("No longer used. Please remove all references to it.")] + public bool IsAnimated { get; set; } + // DEPRECATED END +} +*/ \ No newline at end of file diff --git a/Assets/Alloy/Scripts/AreaLight/AlloyAreaLight.cs.meta b/Assets/Alloy/Scripts/AreaLight/AlloyAreaLight.cs.meta new file mode 100644 index 0000000..93e3b10 --- /dev/null +++ b/Assets/Alloy/Scripts/AreaLight/AlloyAreaLight.cs.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: e13ed666bcef6874386610d2ef878488 +timeCreated: 1468958632 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: + - DefaultSpotLightCookie: {fileID: 2800000, guid: d21bb2c11f0e5a2498a9ecc9cccfab62, + type: 3} + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Scripts/AreaLight/Defaults.meta b/Assets/Alloy/Scripts/AreaLight/Defaults.meta new file mode 100644 index 0000000..4ea045e --- /dev/null +++ b/Assets/Alloy/Scripts/AreaLight/Defaults.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: bc738ca46cba47944874e267a234d9a9 +folderAsset: yes +timeCreated: 1468957796 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Scripts/AreaLight/Defaults/DefaultSpotCookie.tif b/Assets/Alloy/Scripts/AreaLight/Defaults/DefaultSpotCookie.tif new file mode 100644 index 0000000..2ee37bd Binary files /dev/null and b/Assets/Alloy/Scripts/AreaLight/Defaults/DefaultSpotCookie.tif differ diff --git a/Assets/Alloy/Scripts/AreaLight/Defaults/DefaultSpotCookie.tif.meta b/Assets/Alloy/Scripts/AreaLight/Defaults/DefaultSpotCookie.tif.meta new file mode 100644 index 0000000..7535cf1 --- /dev/null +++ b/Assets/Alloy/Scripts/AreaLight/Defaults/DefaultSpotCookie.tif.meta @@ -0,0 +1,79 @@ +fileFormatVersion: 2 +guid: d21bb2c11f0e5a2498a9ecc9cccfab62 +timeCreated: 1442345799 +licenseType: Pro +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 1 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 8 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 1024 + textureSettings: + filterMode: 1 + aniso: 0 + mipBias: 0 + wrapMode: 1 + nPOTScale: 1 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 5 + buildTargetSettings: + - buildTarget: iPhone + maxTextureSize: 128 + textureFormat: 33 + compressionQuality: 50 + allowsAlphaSplitting: 0 + - buildTarget: Android + maxTextureSize: 128 + textureFormat: 13 + compressionQuality: 50 + allowsAlphaSplitting: 0 + - buildTarget: BlackBerry + maxTextureSize: 128 + textureFormat: 13 + compressionQuality: 50 + allowsAlphaSplitting: 0 + - buildTarget: WP8 + maxTextureSize: 128 + textureFormat: 12 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Scripts/AreaLight/Editor.meta b/Assets/Alloy/Scripts/AreaLight/Editor.meta new file mode 100644 index 0000000..eb3813b --- /dev/null +++ b/Assets/Alloy/Scripts/AreaLight/Editor.meta @@ -0,0 +1,6 @@ +fileFormatVersion: 2 +guid: 0e3681edec2f2044bbbc59c604b43ec3 +folderAsset: yes +DefaultImporter: + userData: + assetBundleName: diff --git a/Assets/Alloy/Scripts/AreaLight/Editor/AlloyAreaLightEditor.cs b/Assets/Alloy/Scripts/AreaLight/Editor/AlloyAreaLightEditor.cs new file mode 100644 index 0000000..0754ee4 --- /dev/null +++ b/Assets/Alloy/Scripts/AreaLight/Editor/AlloyAreaLightEditor.cs @@ -0,0 +1,190 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +using UnityEngine; +using UnityEditor; + +#if H3VR_IMPORTED +[CustomEditor(typeof(AlloyAreaLight))] +[CanEditMultipleObjects] +public class AlloyAreaLightEditor : Editor { + public override void OnInspectorGUI() { + serializedObject.Update(); + + var hasSpecularHightlight = serializedObject.FindProperty("m_hasSpecularHightlight"); + var maxRange = float.MaxValue; + var isSpecularAreaLight = false; + var isPointLight = false; + + // Light Type. + foreach (AlloyAreaLight area in targets) { + var light = area.GetComponent(); + + if (light.type == LightType.Directional) { + maxRange = 1.0f; + } + else { + maxRange = Mathf.Min(light.range, maxRange); + } + + isPointLight = light.type == LightType.Point; + + if (isPointLight + || light.type == LightType.Spot + || light.type == LightType.Directional) { + isSpecularAreaLight = true; + } + } + + // Specular Highlight. + if (isSpecularAreaLight) { + hasSpecularHightlight.boolValue = EditorGUILayout.Toggle("Specular Highlight", hasSpecularHightlight.boolValue); + isSpecularAreaLight = isSpecularAreaLight && hasSpecularHightlight.boolValue; + } + + // Radius. + if (isSpecularAreaLight) { + EditorGUILayout.Slider(serializedObject.FindProperty("m_radius"), 0.0f, maxRange); + } else { + var radius = serializedObject.FindProperty("m_radius"); + + if (radius.floatValue != 0.0f) { + GUI.changed = true; + radius.floatValue = 0.0f; + } + } + + // Length. + if (isSpecularAreaLight && isPointLight) { + EditorGUILayout.Slider(serializedObject.FindProperty("m_length"), 0.0f, maxRange * 2.0f); + } else { + var length = serializedObject.FindProperty("m_length"); + + if (length.floatValue != 0.0f) { + GUI.changed = true; + length.floatValue = 0.0f; + } + } + + serializedObject.ApplyModifiedProperties(); + + if (GUI.changed) { + foreach (AlloyAreaLight area in targets) { + area.UpdateBinding(); + } + } + } + + internal static void DrawTwoShadedWireDisc(Vector3 position, Vector3 axis, float radius) { + Color color1 = Handles.color; + Color color2 = color1; + + color1.a *= 0.2f; + Handles.color = color1; + Handles.DrawWireDisc(position, axis, radius); + Handles.color = color2; + } + + internal static void DrawTwoShadedWireDisc(Vector3 position, Vector3 axis, Vector3 from, float degrees, float radius) { + Handles.DrawWireArc(position, axis, from, degrees, radius); + + Color cur = Handles.color; + Color set = cur; + + set.a *= 0.2f; + Handles.color = set; + Handles.DrawWireArc(position, axis, from, degrees - 360f, radius); + Handles.color = cur; + } + + static Vector3[] s_directionArray = { + Vector3.right, + Vector3.up, + Vector3.forward, + -Vector3.right, + -Vector3.up, + -Vector3.forward + }; + + static void DoRadiusHandle(Vector3 position, float radius, float length) { + Vector3 dif = position - Camera.current.transform.position; + float sqrMagnitude = dif.sqrMagnitude; + float radiusSqr = radius * radius; + float radiusDiv = radiusSqr * radiusSqr / sqrMagnitude; + //float ratio = radiusDiv / radiusSqr; + float total = Mathf.Sqrt(radiusSqr - radiusDiv); + + Handles.DrawWireDisc(position - radiusSqr * dif / sqrMagnitude, dif, total); + + for (int j = 0; j < 3; j++) { + float angle = Vector3.Angle(dif, s_directionArray[j]); + + angle = 90f - Mathf.Min(angle, 180f - angle); + + float tanAngle = Mathf.Tan(angle * Mathf.Deg2Rad); + float viewSize = Mathf.Sqrt(radiusDiv + tanAngle * tanAngle * radiusDiv) / radius; + + if (viewSize < 1f) { + float finalArcAngle = Mathf.Asin(viewSize) * Mathf.Rad2Deg; + Vector3 vector2 = Vector3.Cross(s_directionArray[j], dif).normalized; + vector2 = Quaternion.AngleAxis(finalArcAngle, s_directionArray[j]) * vector2; + DrawTwoShadedWireDisc(position, s_directionArray[j], vector2, (90f - finalArcAngle) * 2f, radius); + } + else { + DrawTwoShadedWireDisc(position, s_directionArray[j], radius); + } + } + } + + float DrawCapsuleGizmo(Transform transform, float radius, float length) { + var fwd = Vector3.forward * radius; + var side = Vector3.up * radius; + var halfLength = 0.5f * length; + + // Exclude light transform scale, and pre-rotate capsule to follow the Y-axis. + Handles.matrix = Matrix4x4.TRS(transform.position, transform.rotation, Vector3.one) + * Matrix4x4.TRS(Vector3.zero, Quaternion.Euler(0.0f, 0.0f, 90.0f), Vector3.one); + + Handles.DrawWireArc(-halfLength * Vector3.right, Vector3.forward, Vector3.up, 180.0f, radius); + Handles.DrawWireArc(-halfLength * Vector3.right, Vector3.up, -Vector3.forward, 180.0f, radius); + + Handles.DrawWireArc(halfLength * Vector3.right, Vector3.forward, -Vector3.up, 180.0f, radius); + Handles.DrawWireArc(halfLength * Vector3.right, Vector3.up, Vector3.forward, 180.0f, radius); + + Handles.DrawWireDisc(-halfLength * Vector3.right, Vector3.right, radius); + Handles.DrawWireDisc(halfLength * Vector3.right, Vector3.right, radius); + + Handles.DrawLine(-halfLength * Vector3.right + fwd, halfLength * Vector3.right + fwd); + Handles.DrawLine(-halfLength * Vector3.right - fwd, halfLength * Vector3.right - fwd); + + Handles.DrawLine(-halfLength * Vector3.right + side, halfLength * Vector3.right + side); + Handles.DrawLine(-halfLength * Vector3.right - side, halfLength * Vector3.right - side); + + if (!Event.current.alt && !Event.current.shift) { + radius = Handles.RadiusHandle(Quaternion.identity, -halfLength * Vector3.right, radius, true); + radius = Handles.RadiusHandle(Quaternion.identity, halfLength * Vector3.right, radius, true); + } + + Handles.matrix = Matrix4x4.identity; + + return radius; + } + + void OnSceneGUI() { + var area = target as AlloyAreaLight; + var light = area.GetComponent(); + + if (light.type == LightType.Point + || light.type == LightType.Spot) { + area.Radius = DrawCapsuleGizmo(area.transform, area.Radius, area.Length); + } + + //DoRadiusHandle(area.transform.position, area.Size, 1.0f); + + if (GUI.changed) { + Undo.RecordObject(area, "Adjust area light"); + } + } +} +#endif \ No newline at end of file diff --git a/Assets/Alloy/Scripts/AreaLight/Editor/AlloyAreaLightEditor.cs.meta b/Assets/Alloy/Scripts/AreaLight/Editor/AlloyAreaLightEditor.cs.meta new file mode 100644 index 0000000..30a6344 --- /dev/null +++ b/Assets/Alloy/Scripts/AreaLight/Editor/AlloyAreaLightEditor.cs.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 895b6d1a02c68594f89e4586bdfff530 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: diff --git a/Assets/Alloy/Scripts/AreaLight/Editor/AlloyLightCreator.cs b/Assets/Alloy/Scripts/AreaLight/Editor/AlloyLightCreator.cs new file mode 100644 index 0000000..37ee804 --- /dev/null +++ b/Assets/Alloy/Scripts/AreaLight/Editor/AlloyLightCreator.cs @@ -0,0 +1,51 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +using UnityEditor; +using UnityEngine; + +public static class AlloyLightCreator { +#if H3VR_IMPORTED + const string c_lightMenuPath = "GameObject/Light/"; + const string c_undoMessage = "Created "; + const string c_directionalLight = "Alloy Directional Light"; + const string c_pointLight = "Alloy Point Light"; + const string c_spotLight = "Alloy Spotlight"; + + [MenuItem(c_lightMenuPath + c_directionalLight)] + static void CreateDirectionalLight() { + BuildLight(c_directionalLight, LightType.Directional); + } + + [MenuItem(c_lightMenuPath + c_pointLight)] + static void CreateSphereAreaLight() { + BuildLight(c_pointLight, LightType.Point); + } + + [MenuItem(c_lightMenuPath + c_spotLight)] + static void CreateSpotSphereAreaLight() { + BuildLight(c_spotLight, LightType.Spot); + } + + static void BuildLight(string name, LightType type) { + var go = new GameObject(); + var lastSceneView = SceneView.lastActiveSceneView; + + Undo.RegisterCreatedObjectUndo(go, c_undoMessage + name); + go.name = name; + + var light = go.AddComponent(); + light.type = type; + + go.AddComponent(); + + if (lastSceneView != null) + go.transform.position = lastSceneView.pivot; + else + go.transform.position = Vector3.zero; + + Selection.activeGameObject = go; + } +#endif +} \ No newline at end of file diff --git a/Assets/Alloy/Scripts/AreaLight/Editor/AlloyLightCreator.cs.meta b/Assets/Alloy/Scripts/AreaLight/Editor/AlloyLightCreator.cs.meta new file mode 100644 index 0000000..2254116 --- /dev/null +++ b/Assets/Alloy/Scripts/AreaLight/Editor/AlloyLightCreator.cs.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: f5d3ae613b034fe4599db89f5c75351a +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: diff --git a/Assets/Alloy/Scripts/AreaLight/Editor/AlloyLightEditor.cs b/Assets/Alloy/Scripts/AreaLight/Editor/AlloyLightEditor.cs new file mode 100644 index 0000000..6fe9f17 --- /dev/null +++ b/Assets/Alloy/Scripts/AreaLight/Editor/AlloyLightEditor.cs @@ -0,0 +1,67 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ +using System; +using System.Linq; +using System.Reflection; +using MeatKit; +using UnityEditor; +using UnityEngine; + + +[CustomEditor(typeof(Light))] +[CanEditMultipleObjects] +public class AlloyLightEditor : Editor { +#if H3VR_IMPORTED + Editor m_editor; + Action m_onSceneGUIReflected; + + Type GetTypeGlobal(string typeName) { + return AppDomain.CurrentDomain.GetAssemblies().SelectMany(a => a.GetTypesSafe()).FirstOrDefault(t => t.Name == typeName); + } + + void OnEnable() { + m_editor = CreateEditor(targets, GetTypeGlobal("LightEditor")); + Undo.undoRedoPerformed += RebindAreaLights; + RebindAreaLights(); + m_onSceneGUIReflected = (Action)Delegate.CreateDelegate(typeof(Action), m_editor, "OnSceneGUI", false, true); + } + + void OnSceneGUI() { + m_onSceneGUIReflected(); + } + + void OnDisable() { + Undo.undoRedoPerformed -= RebindAreaLights; + + //Calls on destroy on light editor + DestroyImmediate(m_editor); + } + + public override void OnInspectorGUI() { + m_editor.OnInspectorGUI(); + bool anyMissing = targets.Any(l => ((Light)l).GetComponent().type != LightType.Area + && ((Light)l).GetComponent() == null); + + if (anyMissing) { + if (GUILayout.Button("Convert to Alloy area light", EditorStyles.toolbarButton)) { + foreach (Light light in targets) { + Undo.AddComponent(light.gameObject); + } + } + } + + if (GUI.changed) { + RebindAreaLights(); + } + } + + void RebindAreaLights() { + var lights = targets.Select(l => ((Light)l).GetComponent()).Where(a => a != null); + + foreach (AlloyAreaLight ar in lights) { + ar.UpdateBinding(); + } + } +#endif +} \ No newline at end of file diff --git a/Assets/Alloy/Scripts/AreaLight/Editor/AlloyLightEditor.cs.meta b/Assets/Alloy/Scripts/AreaLight/Editor/AlloyLightEditor.cs.meta new file mode 100644 index 0000000..a13cd39 --- /dev/null +++ b/Assets/Alloy/Scripts/AreaLight/Editor/AlloyLightEditor.cs.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: f83832185bd1caa4d9aab41ddfbc423d +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: diff --git a/Assets/Alloy/Scripts/Editor.meta b/Assets/Alloy/Scripts/Editor.meta new file mode 100644 index 0000000..bca28d3 --- /dev/null +++ b/Assets/Alloy/Scripts/Editor.meta @@ -0,0 +1,6 @@ +fileFormatVersion: 2 +guid: 301e9fbda97de0d41a1f555dc127b9c9 +folderAsset: yes +DefaultImporter: + userData: + assetBundleName: diff --git a/Assets/Alloy/Scripts/Editor/AlloyEditor.cs b/Assets/Alloy/Scripts/Editor/AlloyEditor.cs new file mode 100644 index 0000000..83ffc48 --- /dev/null +++ b/Assets/Alloy/Scripts/Editor/AlloyEditor.cs @@ -0,0 +1,61 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +using UnityEngine; +using System.Collections.Generic; +using UnityEditor; + +public static class AlloyEditor { + public static void DrawAddTabGUI(List tabsToAdd) { + if (tabsToAdd.Count <= 0) { + return; + } + + GUI.color = new Color(0.8f, 0.8f, 0.8f, 0.8f); + GUILayout.Label(""); + var rect = GUILayoutUtility.GetLastRect(); + + rect.x -= 35.0f; + rect.width += 10.0f; + + GUI.color = Color.clear; + bool add = GUI.Button(rect, new GUIContent(""), "Box"); + GUI.color = new Color(0.8f, 0.8f, 0.8f, 0.8f); + Rect subRect = rect; + + foreach (var tab in tabsToAdd) { + GUI.color = tab.Color; + GUI.Box(subRect, "", "ShurikenModuleTitle"); + + subRect.x += rect.width / tabsToAdd.Count; + subRect.width -= rect.width / tabsToAdd.Count; + } + + GUI.color = new Color(0.8f, 0.8f, 0.8f, 0.8f); + + var delRect = rect; + delRect.xMin = rect.xMax; + delRect.xMax += 40.0f; + + if (GUI.Button(delRect, "", "ShurikenModuleTitle") || add) { + var menu = new GenericMenu(); + + foreach (var tab in tabsToAdd) { + menu.AddItem(new GUIContent(tab.Name), false, tab.Enable); + } + + menu.ShowAsContext(); + } + + delRect.x += 10.0f; + + GUI.Label(delRect, "+"); + rect.x += EditorGUIUtility.currentViewWidth / 2.0f - 30.0f; + + // Ensures tab text is always white, even when using light skin in pro. + GUI.color = EditorGUIUtility.isProSkin ? new Color(0.7f, 0.7f, 0.7f) : new Color(0.9f, 0.9f, 0.9f); + GUI.Label(rect, "Add tab", EditorStyles.whiteLabel); + GUI.color = Color.white; + } +} diff --git a/Assets/Alloy/Scripts/Editor/AlloyEditor.cs.meta b/Assets/Alloy/Scripts/Editor/AlloyEditor.cs.meta new file mode 100644 index 0000000..72623b5 --- /dev/null +++ b/Assets/Alloy/Scripts/Editor/AlloyEditor.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: dd3f45d6cfc037e43baa01683c2ead46 +timeCreated: 1447518555 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Scripts/Editor/AlloyMenuGroups.cs b/Assets/Alloy/Scripts/Editor/AlloyMenuGroups.cs new file mode 100644 index 0000000..1f1c7fc --- /dev/null +++ b/Assets/Alloy/Scripts/Editor/AlloyMenuGroups.cs @@ -0,0 +1,28 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +using UnityEditor; +using UnityEngine; + +public static class AlloyMenuGroups { + [MenuItem(AlloyUtils.MenuItem + "Documentation", false, 100)] + static void Documentation() { + Application.OpenURL("https://alloy.rustltd.com/documentation"); + } + + [MenuItem(AlloyUtils.MenuItem + "Samples", false, 100)] + static void Samples() { + Application.OpenURL("https://www.assetstore.unity3d.com/en/#!/content/43687"); + } + + [MenuItem(AlloyUtils.MenuItem + "Contact", false, 100)] + static void Contact() { + Application.OpenURL("https://alloy.rustltd.com/contact"); + } + + [MenuItem(AlloyUtils.MenuItem + "About", false, 100)] + static void About() { + Application.OpenURL("https://alloy.rustltd.com/"); + } +} diff --git a/Assets/Alloy/Scripts/Editor/AlloyMenuGroups.cs.meta b/Assets/Alloy/Scripts/Editor/AlloyMenuGroups.cs.meta new file mode 100644 index 0000000..9e5e498 --- /dev/null +++ b/Assets/Alloy/Scripts/Editor/AlloyMenuGroups.cs.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 85976895d5de5ee4f914e54f4aae9905 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: diff --git a/Assets/Alloy/Scripts/Editor/AlloyMigrationTools.cs b/Assets/Alloy/Scripts/Editor/AlloyMigrationTools.cs new file mode 100644 index 0000000..4b99567 --- /dev/null +++ b/Assets/Alloy/Scripts/Editor/AlloyMigrationTools.cs @@ -0,0 +1,289 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +using System.Collections.Generic; +using System.Linq; +using System.IO; +using UnityEditor; +using UnityEngine; + +public static class AlloyMigrationTools { +#if H3VR_IMPORTED + private const string keywordReportFilename = "/Alloy/Scripts/Material Report.txt"; + + [MenuItem(AlloyUtils.MenuItem + "Material Report", false, 11)] + private static void MaterialReport() { + var fileName = Application.dataPath + keywordReportFilename; + var sr = File.CreateText(fileName); + var materials = GetSceneMaterialsWithKeywords().OrderBy(m => m.name); + var keywordList = materials + .SelectMany(m => m.shaderKeywords) + .Where(k => !string.IsNullOrEmpty(k)) + .Distinct() + .OrderBy(k => k); + var keywordCount = keywordList.Count(); + var materialShaderNames = new List(); + + sr.WriteLine(" "); + sr.WriteLine("-----------------------------------------------------------------------"); + sr.WriteLine(" Keywords: " + keywordCount); + sr.WriteLine("-----------------------------------------------------------------------"); + + foreach (var keyword in keywordList) { + sr.WriteLine("\"" + keyword + "\","); + } + + sr.WriteLine(" "); + sr.WriteLine("-----------------------------------------------------------------------"); + sr.WriteLine(" Keywords -> Materials: " + keywordCount); + sr.WriteLine("-----------------------------------------------------------------------"); + + foreach (var keyword in keywordList) { + sr.WriteLine("\"" + keyword + "\","); + + foreach (var material in materials) { + var shaderKeywords = material.shaderKeywords; + + if (shaderKeywords.Contains(keyword)) { + sr.WriteLine(" " + material.name); + } + } + + sr.WriteLine(" "); + } + + sr.WriteLine("-----------------------------------------------------------------------"); + sr.WriteLine(" Materials -> Keywords: " + materials.Count()); + sr.WriteLine("-----------------------------------------------------------------------"); + + foreach (var material in materials) { + var shaderKeywords = material.shaderKeywords.OrderBy(k => k); + + sr.WriteLine(material.name); + + foreach (var keyword in shaderKeywords) { + if (!string.IsNullOrEmpty(keyword)) { + sr.WriteLine(" \"" + keyword + "\","); + } + } + + sr.WriteLine(" "); + materialShaderNames.Add(material.shader.name); + } + + var shaderNames = materialShaderNames.Distinct().OrderBy(s => s); + + sr.WriteLine("-----------------------------------------------------------------------"); + sr.WriteLine(" Shaders -> Materials: " + shaderNames.Count()); + sr.WriteLine("-----------------------------------------------------------------------"); + + foreach (var shaderName in shaderNames) { + var shaderMaterials = materials.Where(m => m.shader.name == shaderName).Select(m => m.name); + + sr.WriteLine("\"" + shaderName + "\""); + + foreach (var materialName in shaderMaterials) { + if (!string.IsNullOrEmpty(materialName)) { + sr.WriteLine(" " + materialName); + } + } + + sr.WriteLine(" "); + } + + sr.Close(); + System.Diagnostics.Process.Start(fileName); + } + +// [MenuItem(AlloyUtils.MenuItem + "Material Migrator", false, 11)] +// private static void MaterialMigrator() { +// var window = ScriptableObject.CreateInstance(); +// var dimensions = new Vector2(350, 100); +// +// window.position = new Rect(Screen.width / 2, Screen.height / 2, 0, 0); +// window.minSize = dimensions; +// window.maxSize = dimensions; +// window.ShowUtility(); +// } + + [MenuItem(AlloyUtils.MenuItem + "Light Converter", false, 11)] + private static void LightConverter() { + var lights = Resources.FindObjectsOfTypeAll(); + var lightsLength = lights.Length; + + for (int i = 0; i < lightsLength; i++) { + var light = lights[i]; + + EditorUtility.DisplayProgressBar( + "Converting lights...", + string.Format("Light {0} / {1}.", i + 1, lightsLength), + i / (lightsLength - 1.0f)); + + // Skip Unity baked Area Lights & Prefabs. + if (light.type != LightType.Area + && !EditorUtility.IsPersistent(light)) { + var area = light.GetComponent(); + + if (area == null) { + Undo.RecordObject(light.gameObject, "Convert to Alloy area lights."); + area = Undo.AddComponent(light.gameObject); + } + + Undo.RecordObject(light, "Set default light cookie"); + area.UpdateBinding(); + } + } + + EditorUtility.ClearProgressBar(); + } + + private static IEnumerable GetSceneMaterialsWithKeywords() { + return Resources.FindObjectsOfTypeAll().Where(m => m.shaderKeywords.Length > 0); + } +} + +public class AlloyMaterialMigratorPopup : EditorWindow { + private const string messageFilename = "/Alloy/Scripts/Editor/MaterialMigratorWarning.txt"; + private static string[] keywordsToRemove = new string[] { + "_AO2MAPUV_UV0", + "_AO2MAPUV_UV1", + "_BLENDMAPUV_UV0", + "_BLENDMAPUV_UV1", + "_BUMPMODE_BUMP", + "_BUMPMODE_PARALLAX", // Set by stupid KeywordEnum. + "_BUMPMODE_SPOM", + "_CARFLAKEMAPUV_UV0", + "_CARFLAKEMAPUV_UV1", + "_DECAL_OFF", + "_DECALMODE_NONE", + "_DECALTEXUV_UV0", + "_DECALTEXUV_UV1", + "_DETAIL_ON", // Replaced with _DETAIL_MULX2 + "_DETAILALBEDOMAPUV_UV0", + "_DETAILALBEDOMAPUV_UV1", + "_DETAILMASKSSOURCE_TEXTURE", // From when I was trying that Masks channel picker idea. >_< + "_DETAILMASKSOURCE_TEXTURE", // Discarded first attempt at name. + "_DETAILMASKSOURCE_TEXTUREALPHA", // Set by stupid KeywordEnum. + "_DETAILMASKSOURCE_VERTEXCOLORALPHA", // Replaced with _NORMALMAP + "_DETAILMODE_MUL", + "_DETAILMODE_MULX2", + "_DIRECTIONALBLENDMODE_OBJECT", // Set by stupid KeywordEnum. + "_DISSOLVETEXUV_UV0", + "_DISSOLVETEXUV_UV1", + "_EMISSION_ON", + "_ENVIRONMENTMAPMODE_RSRM", + "_ENVIRONMENTMAPMODE_SKYSHOP", + "_ENVIRONMENTMAPMODE_SKYSHOPSH", + "_INCANDESCENCEMAPUV_UV0", + "_INCANDESCENCEMAPUV_UV1", + "_INCANDESCENCEMAPUV2_UV0", + "_INCANDESCENCEMAPUV2_UV1", + "_MAINTEXTURESMODE_FULL", + "_MAINTEXTURESMODE_LITE", + "_MAINTEXTURESROUGHNESSSOURCE_BASECOLORALPHA", // Discarded first attempt at name. + "_MAINTEXTURESROUGHNESSSOURCE_MATERIALALPHA", // Discarded first attempt at name. + "_MAINROUGHNESSSOURCE_BASECOLORALPHA", // Replaced with _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + "_MAINROUGHNESSSOURCE_PACKEDMAPALPHA", // Set by stupid KeywordEnum. + "_ORIENTEDROUGHNESSSOURCE_BASECOLORALPHA", // Replaced with _SPECGLOSSMAP + "_ORIENTEDROUGHNESSSOURCE_PACKEDMAPALPHA", // Set by stupid KeywordEnum. + "_ORIENTEDTEXTURESMODE_FULL", + "_ORIENTEDTEXTURESMODE_LITE", + "_ORIENTEDTEXTURESROUGHNESSSOURCE_BASECOLORALPHA", // Discarded first attempt at name. + "_ORIENTEDTEXTURESROUGHNESSSOURCE_MATERIALALPHA", // Discarded first attempt at name. + "_PARALLAX_ON", // Replaced with _PARALLAXMAP + "_RIMTEXUV_UV0", + "_RIMTEXUV_UV1", + "_RIMTEXUV2_UV0", + "_RIMTEXUV2_UV1", + "_SECONDARYROUGHNESSSOURCE_BASECOLORALPHA", // Replaced with _METALLICGLOSSMAP + "_SECONDARYROUGHNESSSOURCE_PACKEDMAPALPHA", // Set by stupid KeywordEnum. + "_SECONDARYTEXTURESMODE_FULL", + "_SECONDARYTEXTURESMODE_LITE", + "_TESSELLATIONMODE_COMBINED", // Dropped this mode in favor of using two other modes keywords together. + "_TRANSITIONTEXUV_UV0", + "_TRANSITIONTEXUV_UV1", + "_TRIPLANARMODE_OBJECT", // Set by stupid KeywordEnum. + "_UVSEC_UV0", // Standard shader sets this. + "_UVSEC_UV1", // Standard shader sets this. + }; + + void OnGUI() { + var message = File.ReadAllText(Application.dataPath + messageFilename); + + titleContent = new GUIContent("Migrate Materials?"); + EditorGUILayout.LabelField(message, EditorStyles.wordWrappedLabel); + GUILayout.Space(10); + + EditorGUILayout.BeginHorizontal(); + GUILayout.FlexibleSpace(); + + if (GUILayout.Button("Confirm")) { + Close(); + MigrateMaterials(); + } + + if (GUILayout.Button("Cancel")) { + Close(); + } + + GUILayout.FlexibleSpace(); + EditorGUILayout.EndHorizontal(); + } + + void MigrateMaterials() { + try { + var materialGuids = AssetDatabase.FindAssets("t:material"); + var length = materialGuids.Length; + + for (int i = 0; i < length; i++) { + var material = AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(materialGuids[i]), typeof(Material)) as Material; + var toRemove = material.shaderKeywords.Intersect(keywordsToRemove); + var shaderName = material.shader.name; + + EditorUtility.DisplayProgressBar( + "Migrating Materials...", + string.Format("({0} / {1}) {2}", i, length, material.name), + i / (float)(length - 1)); + + if (shaderName.Contains("Alloy")) { + if (material.HasProperty("_HasBumpMap") + && Mathf.Approximately(material.GetFloat("_HasBumpMap"), 1.0f)) { + material.EnableKeyword("EFFECT_BUMP"); + } + + foreach (var keyword in toRemove) { + if (!string.IsNullOrEmpty(keyword)) { + material.DisableKeyword(keyword); + + // Migrate to Unity keywords. + switch (keyword) { + case "_DETAIL_ON": + material.EnableKeyword("_DETAIL_MULX2"); + break; + case "_DETAILMASKSOURCE_VERTEXCOLORALPHA": + material.EnableKeyword("_NORMALMAP"); + break; + case "_MAINROUGHNESSSOURCE_BASECOLORALPHA": + material.EnableKeyword("_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A"); + break; + case "_PARALLAX_ON": + material.EnableKeyword("_PARALLAXMAP"); + break; + } + } + } + + EditorUtility.SetDirty(material); + AssetDatabase.SaveAssets(); + material = null; + EditorUtility.UnloadUnusedAssetsImmediate(); + } + } + } + finally { + EditorUtility.ClearProgressBar(); + } + } +#endif +} \ No newline at end of file diff --git a/Assets/Alloy/Scripts/Editor/AlloyMigrationTools.cs.meta b/Assets/Alloy/Scripts/Editor/AlloyMigrationTools.cs.meta new file mode 100644 index 0000000..54b1544 --- /dev/null +++ b/Assets/Alloy/Scripts/Editor/AlloyMigrationTools.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 222acbd1878d5b3459b1f2946805fba9 +timeCreated: 1425000426 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Scripts/Editor/AlloyPropertyDrawers.cs b/Assets/Alloy/Scripts/Editor/AlloyPropertyDrawers.cs new file mode 100644 index 0000000..3211496 --- /dev/null +++ b/Assets/Alloy/Scripts/Editor/AlloyPropertyDrawers.cs @@ -0,0 +1,51 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +using UnityEditor; +using UnityEngine; + + +[CustomPropertyDrawer(typeof(MinValueAttribute))] +public class MinValueDrawer : PropertyDrawer { + // Draw the property inside the given rect + public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { + // Using BeginProperty / EndProperty on the parent property means that + // prefab override logic works on the entire property. + EditorGUI.BeginProperty(position, label, property); + + // Draw label + EditorGUI.BeginChangeCheck(); + + float newVal = EditorGUI.FloatField(position, label, property.floatValue); + + if (EditorGUI.EndChangeCheck()) { + newVal = Mathf.Max((attribute as MinValueAttribute).Min, newVal); + property.floatValue = newVal; + } + + EditorGUI.EndProperty(); + } +} + +[CustomPropertyDrawer(typeof(MaxValueAttribute))] +public class MaxValueDrawer : PropertyDrawer { + // Draw the property inside the given rect + public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { + // Using BeginProperty / EndProperty on the parent property means that + // prefab override logic works on the entire property. + EditorGUI.BeginProperty(position, label, property); + + // Draw label + + EditorGUI.BeginChangeCheck(); + + float newVal = EditorGUI.FloatField(position, label, property.floatValue); + + if (EditorGUI.EndChangeCheck()) { + newVal = Mathf.Min((attribute as MaxValueAttribute).Max, newVal); + property.floatValue = newVal; + } + EditorGUI.EndProperty(); + } +} \ No newline at end of file diff --git a/Assets/Alloy/Scripts/Editor/AlloyPropertyDrawers.cs.meta b/Assets/Alloy/Scripts/Editor/AlloyPropertyDrawers.cs.meta new file mode 100644 index 0000000..7c4f642 --- /dev/null +++ b/Assets/Alloy/Scripts/Editor/AlloyPropertyDrawers.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: cd608910999af3a4e960e52f543102ed +timeCreated: 1445390480 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Scripts/Editor/AlloyRequiredActions.cs b/Assets/Alloy/Scripts/Editor/AlloyRequiredActions.cs new file mode 100644 index 0000000..f654c7f --- /dev/null +++ b/Assets/Alloy/Scripts/Editor/AlloyRequiredActions.cs @@ -0,0 +1,54 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +using System.IO; + +using UnityEngine; +using UnityEditor; + +[InitializeOnLoad] +static class AlloyRequiredActions { + static AlloyRequiredActions() { + // Check if popup hasn't appeared for this version. + if (File.Exists(AlloyRequiredActionsPopup.MessageFilePath) + && EditorPrefs.GetString(AlloyRequiredActionsPopup.SettingsKey) != AlloyUtils.Version) { + var window = ScriptableObject.CreateInstance(); + var dimensions = new Vector2(350, 200); + + window.position = new Rect(Screen.width / 2, Screen.height / 2, 0, 0); + window.minSize = dimensions; + window.maxSize = dimensions; + window.ShowUtility(); + } + } +} + +public class AlloyRequiredActionsPopup : EditorWindow { + public const string SettingsKey = "AlloyRequiredActionsPopupShown"; + + public static string MessageFilePath { + get { return AlloyUtils.AssetsPath + "REQUIRED ACTIONS.txt"; } + } + + void OnGUI() { + var message = File.ReadAllText(MessageFilePath); + + titleContent = new GUIContent(string.Format("Required Actions for Alloy {0}...", AlloyUtils.Version)); + EditorGUILayout.LabelField(message, EditorStyles.wordWrappedLabel); + GUILayout.Space(10); + + EditorGUILayout.BeginHorizontal(); + GUILayout.FlexibleSpace(); + + if (GUILayout.Button("Okay")) { + Close(); + } + + GUILayout.FlexibleSpace(); + EditorGUILayout.EndHorizontal(); + + // Make sure it doesn't reappear again for this version. + EditorPrefs.SetString(SettingsKey, AlloyUtils.Version); + } +} \ No newline at end of file diff --git a/Assets/Alloy/Scripts/Editor/AlloyRequiredActions.cs.meta b/Assets/Alloy/Scripts/Editor/AlloyRequiredActions.cs.meta new file mode 100644 index 0000000..cee2b8d --- /dev/null +++ b/Assets/Alloy/Scripts/Editor/AlloyRequiredActions.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: c605d19298efffc45afeb01a1a5086fa +timeCreated: 1473702994 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Scripts/Editor/MaterialMigratorWarning.txt b/Assets/Alloy/Scripts/Editor/MaterialMigratorWarning.txt new file mode 100644 index 0000000..df060cc --- /dev/null +++ b/Assets/Alloy/Scripts/Editor/MaterialMigratorWarning.txt @@ -0,0 +1,3 @@ +We STRONGLY recommend that you save and back up your work before proceeding. + +Do you wish to continue? \ No newline at end of file diff --git a/Assets/Alloy/Scripts/Editor/MaterialMigratorWarning.txt.meta b/Assets/Alloy/Scripts/Editor/MaterialMigratorWarning.txt.meta new file mode 100644 index 0000000..f8ef2fe --- /dev/null +++ b/Assets/Alloy/Scripts/Editor/MaterialMigratorWarning.txt.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e579897034a773341b981f6cb2ab54c6 +timeCreated: 1474115145 +licenseType: Pro +TextScriptImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Scripts/EffectsManager.meta b/Assets/Alloy/Scripts/EffectsManager.meta new file mode 100644 index 0000000..c398346 --- /dev/null +++ b/Assets/Alloy/Scripts/EffectsManager.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: d774905ce3293694e97161cbf47d6542 +folderAsset: yes +timeCreated: 1439503600 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Scripts/EffectsManager/AlloyEffectsManager.cs b/Assets/Alloy/Scripts/EffectsManager/AlloyEffectsManager.cs new file mode 100644 index 0000000..214a703 --- /dev/null +++ b/Assets/Alloy/Scripts/EffectsManager/AlloyEffectsManager.cs @@ -0,0 +1,288 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +using System; +using UnityEngine; +using UnityEngine.Rendering; + +#if UNITY_EDITOR +using UnityEditor; +#endif + +[ExecuteInEditMode] +[ImageEffectAllowedInSceneView] +[RequireComponent(typeof (Camera))] +[AddComponentMenu(AlloyUtils.ComponentMenu + "Effects Manager")] +public class AlloyEffectsManager : MonoBehaviour { + + // Arbitrary range multiplier. + private const float c_blurWdith = 0.15f; + private const float c_blurDepthDifferenceMultiplier = 100.0f; + private const string c_copyTransmissionBufferName = "AlloyCopyTransmission"; + private const string c_blurNormalsBufferName = "AlloyBlurNormals"; + private const CameraEvent c_copyTransmissionEvent = CameraEvent.AfterGBuffer; + private const CameraEvent c_blurNormalsEvent = CameraEvent.BeforeLighting; + + [Serializable] + public struct SkinSettingsData { + public bool Enabled; + public Texture2D Lut; + + [Range(0.0f, 1.0f)] + public float Weight; + + [Range(0.01f, 1.0f)] + public float MaskCutoff; + + [Range(0.0f, 1.0f)] + public float Bias; + + [Range(0.0f, 1.0f)] + public float Scale; + + [Range(0.0f, 1.0f)] + public float BumpBlur; + + public Vector3 Absorption; + public Vector3 AoColorBleed; + } + + [Serializable] + public struct TransmissionSettingsData { + public bool Enabled; + + [Range(0.0f, 1.0f)] + public float Weight; + + [Range(0.0f, 1.0f)] + public float ShadowWeight; + + [Range(0.0f, 1.0f)] + [Tooltip("Amount that the transmission is distorted by surface normals.")] + public float BumpDistortion; + + [MinValue(1.0f)] + public float Falloff; + } + + public SkinSettingsData SkinSettings = new SkinSettingsData() { + Enabled = true, + Weight = 1.0f, + MaskCutoff = 0.1f, + Bias = 0.0f, + Scale = 1.0f, + BumpBlur = 0.7f, + Absorption = new Vector3(-8.0f, -40.0f, -64.0f), + AoColorBleed = new Vector3(0.4f, 0.15f, 0.13f), + }; + + public TransmissionSettingsData TransmissionSettings = new TransmissionSettingsData { + Enabled = true, + Weight = 1.0f, + ShadowWeight = 0.5f, + BumpDistortion = 0.05f, + Falloff = 1.0f + }; + + // LUT + [HideInInspector] public Texture2D SkinLut; + + // Shaders + [HideInInspector] public Shader TransmissionBlitShader; + [HideInInspector] public Shader BlurNormalsShader; + + // Private + private Material m_deferredTransmissionBlitMaterial; + private Material m_deferredBlurredNormalsMaterial; + + private Camera m_camera; + private bool m_isTransmissionEnabled; + private bool m_isScatteringEnabled; + + private CommandBuffer m_copyTransmission; + private CommandBuffer m_renderBlurredNormals; + +#if UNITY_EDITOR + private int lastWidth = 0; + private int lastHeight = 0; +#endif + + private void Awake() { + m_camera = GetComponent(); + } + + private void Reset() { + ResetCommandBuffers(); + } + +#if UNITY_EDITOR + private void Update() { + if (lastWidth != m_camera.pixelWidth + || lastHeight != m_camera.pixelHeight) { + ResetCommandBuffers(); + } + } +#endif + + private void OnEnable() { + ResetCommandBuffers(); + } + + private void OnDisable() { + DestroyCommandBuffers(); + } + + private void OnDestroy() { + DestroyCommandBuffers(); + } + + public void Refresh() { + bool scatteringEnabled = SkinSettings.Enabled; + bool transmissionEnabled = TransmissionSettings.Enabled || scatteringEnabled; + + if (m_isTransmissionEnabled == transmissionEnabled + && m_isScatteringEnabled == scatteringEnabled) { + RefreshProperties(); + } + else { + ResetCommandBuffers(); + } + } + + // Per camera properties. + private void RefreshProperties() { + if (m_isTransmissionEnabled || m_isScatteringEnabled) { + float transmissionWeight = m_isTransmissionEnabled ? Mathf.GammaToLinearSpace(TransmissionSettings.Weight) : 0.0f; + + Shader.SetGlobalVector("_DeferredTransmissionParams", + new Vector4(transmissionWeight, TransmissionSettings.Falloff, TransmissionSettings.BumpDistortion, TransmissionSettings.ShadowWeight)); + + if (m_isScatteringEnabled) { + // Blur shaders. + float distanceToProjectionWindow = 1.0f / Mathf.Tan(0.5f * Mathf.Deg2Rad * m_camera.fieldOfView); + float blurStepScale = c_blurWdith * distanceToProjectionWindow; + float blurDepthDifferenceScale = c_blurDepthDifferenceMultiplier * distanceToProjectionWindow; + + Shader.SetGlobalVector("_DeferredBlurredNormalsParams", new Vector2(blurStepScale, blurDepthDifferenceScale)); + + // Material shaders. + var absorption = SkinSettings.Absorption; + var aoColorBleed = SkinSettings.AoColorBleed; + + Shader.SetGlobalTexture("_DeferredSkinLut", SkinSettings.Lut); + Shader.SetGlobalVector("_DeferredSkinParams", new Vector3(SkinSettings.Weight, 1.0f / SkinSettings.MaskCutoff, SkinSettings.BumpBlur)); + Shader.SetGlobalVector("_DeferredSkinTransmissionAbsorption", new Vector4(absorption.x, absorption.y, absorption.z, SkinSettings.Bias)); + Shader.SetGlobalVector("_DeferredSkinColorBleedAoWeights", new Vector4(aoColorBleed.x, aoColorBleed.y, aoColorBleed.z, SkinSettings.Scale)); + } + } + } + + private void ResetCommandBuffers() { + m_isScatteringEnabled = SkinSettings.Enabled; + m_isTransmissionEnabled = TransmissionSettings.Enabled || m_isScatteringEnabled; + + if (SkinSettings.Lut == null) { + SkinSettings.Lut = SkinLut; + +#if UNITY_EDITOR + EditorUtility.SetDirty(this); +#endif + } + + DestroyCommandBuffers(); + + if ((m_isTransmissionEnabled || m_isScatteringEnabled) + && m_camera != null + && TransmissionBlitShader != null) { + int outputRT = Shader.PropertyToID("_DeferredPlusBuffer"); + +#if UNITY_EDITOR + // Reference for when screen size changes. + lastWidth = m_camera.pixelWidth; + lastHeight = m_camera.pixelHeight; +#endif + + m_deferredTransmissionBlitMaterial = new Material(TransmissionBlitShader); + m_deferredTransmissionBlitMaterial.hideFlags = HideFlags.HideAndDontSave; + + // Copy Gbuffer emission buffer so we can get at the alpha channel for transmission. + m_copyTransmission = new CommandBuffer(); + m_copyTransmission.name = c_copyTransmissionBufferName; + + if (!m_isScatteringEnabled) { + // Copy transmission from emission buffer alpha. + m_copyTransmission.GetTemporaryRT(outputRT, -1, -1, 0, FilterMode.Point, RenderTextureFormat.ARGB32, RenderTextureReadWrite.Linear); + m_copyTransmission.Blit(BuiltinRenderTextureType.CameraTarget, outputRT, m_deferredTransmissionBlitMaterial); + m_copyTransmission.ReleaseTemporaryRT(outputRT); + } + else if (BlurNormalsShader != null) { + int halfWidth = m_camera.pixelWidth / 2; + int halfHeight = m_camera.pixelHeight / 2; + int pingRT = Shader.PropertyToID("_DeferredBlurredNormalPingBuffer"); + int pongRT = Shader.PropertyToID("_DeferredBlurredNormalPongBuffer"); + + // Bind emission buffer to be copied in blurred normal upsample pass. + m_copyTransmission.SetGlobalTexture("_DeferredTransmissionBuffer", BuiltinRenderTextureType.CameraTarget); + + // Blur normals and copy transmission. + m_deferredBlurredNormalsMaterial = new Material(BlurNormalsShader); + m_deferredBlurredNormalsMaterial.hideFlags = HideFlags.HideAndDontSave; + + m_renderBlurredNormals = new CommandBuffer(); + m_renderBlurredNormals.name = c_blurNormalsBufferName; + + // RGBA8 target has sufficient precision for normals that are smooth and diffuse-only. + m_renderBlurredNormals.GetTemporaryRT(outputRT, -1, -1, 0, FilterMode.Point, RenderTextureFormat.ARGB32, RenderTextureReadWrite.Linear); + m_renderBlurredNormals.GetTemporaryRT(pingRT, halfWidth, halfHeight, 0, FilterMode.Point, RenderTextureFormat.ARGBHalf, RenderTextureReadWrite.Linear); + m_renderBlurredNormals.GetTemporaryRT(pongRT, halfWidth, halfHeight, 0, FilterMode.Point, RenderTextureFormat.ARGBHalf, RenderTextureReadWrite.Linear); + + // Downsample, Blur X, Blur Y, Upsample. + m_renderBlurredNormals.Blit(BuiltinRenderTextureType.GBuffer2, pingRT, m_deferredBlurredNormalsMaterial, 0); + m_renderBlurredNormals.Blit(pingRT, pongRT, m_deferredBlurredNormalsMaterial, 1); + m_renderBlurredNormals.Blit(pongRT, pingRT, m_deferredBlurredNormalsMaterial, 2); + m_renderBlurredNormals.Blit(pingRT, outputRT, m_deferredBlurredNormalsMaterial, 3); + + // Cleanup. + m_renderBlurredNormals.ReleaseTemporaryRT(outputRT); + m_renderBlurredNormals.ReleaseTemporaryRT(pingRT); + m_renderBlurredNormals.ReleaseTemporaryRT(pongRT); + + // Need depth texture for depth-aware upsample. + m_camera.depthTextureMode |= DepthTextureMode.Depth; + m_camera.AddCommandBuffer(c_blurNormalsEvent, m_renderBlurredNormals); + } + + m_camera.AddCommandBuffer(c_copyTransmissionEvent, m_copyTransmission); + } + + RefreshProperties(); + +#if UNITY_EDITOR + EditorUtility.SetDirty(m_camera); +#endif + } + + private void DestroyCommandBuffers() { + if (m_copyTransmission != null) { + m_camera.RemoveCommandBuffer(c_copyTransmissionEvent, m_copyTransmission); + } + + if (m_renderBlurredNormals != null) { + m_camera.RemoveCommandBuffer(c_blurNormalsEvent, m_renderBlurredNormals); + } + + if (m_deferredTransmissionBlitMaterial != null) { + DestroyImmediate(m_deferredTransmissionBlitMaterial); + } + + if (m_deferredBlurredNormalsMaterial != null) { + DestroyImmediate(m_deferredBlurredNormalsMaterial); + } + + m_copyTransmission = null; + m_renderBlurredNormals = null; + m_deferredTransmissionBlitMaterial = null; + m_deferredBlurredNormalsMaterial = null; + } +} \ No newline at end of file diff --git a/Assets/Alloy/Scripts/EffectsManager/AlloyEffectsManager.cs.meta b/Assets/Alloy/Scripts/EffectsManager/AlloyEffectsManager.cs.meta new file mode 100644 index 0000000..0a4b80e --- /dev/null +++ b/Assets/Alloy/Scripts/EffectsManager/AlloyEffectsManager.cs.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: bf5b97b13ec5bae41ac96a39caf39874 +timeCreated: 1487764061 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: + - SkinLut: {fileID: 2800000, guid: d13510bb2be49aa40a66a0101efb6a36, type: 3} + - TransmissionBlitShader: {fileID: 4800000, guid: 4bbeef29a84b4ed498f2d4a7d9fcefc4, + type: 3} + - BlurNormalsShader: {fileID: 4800000, guid: 5b34ef975c671984fb9c93adc7042982, type: 3} + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Scripts/EffectsManager/Editor.meta b/Assets/Alloy/Scripts/EffectsManager/Editor.meta new file mode 100644 index 0000000..882a16c --- /dev/null +++ b/Assets/Alloy/Scripts/EffectsManager/Editor.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: c7a3813b9ad39d847b4acc42619b3256 +folderAsset: yes +timeCreated: 1445386286 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Scripts/EffectsManager/Editor/AlloyCameraEditor.cs b/Assets/Alloy/Scripts/EffectsManager/Editor/AlloyCameraEditor.cs new file mode 100644 index 0000000..c0c144b --- /dev/null +++ b/Assets/Alloy/Scripts/EffectsManager/Editor/AlloyCameraEditor.cs @@ -0,0 +1,39 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ +using System; +using System.Linq; +using MeatKit; +using UnityEditor; +using UnityEngine; + +[CustomEditor(typeof(Camera))] +[CanEditMultipleObjects] +public class AlloyCameraEditor : Editor { + Editor m_editor; + + Type GetTypeGlobal(string typeName) { + return AppDomain.CurrentDomain.GetAssemblies().SelectMany(a => a.GetTypesSafe()).FirstOrDefault(t => t.Name == typeName); + } + + void OnEnable() { + m_editor = CreateEditor(targets, GetTypeGlobal("CameraEditor")); + } + + void OnDisable() { + DestroyImmediate(m_editor); + } + + public override void OnInspectorGUI() { + m_editor.OnInspectorGUI(); + bool anyMissing = targets.Any(c => ((Camera)c).GetComponent() == null); + + if (anyMissing) { + if (GUILayout.Button("Convert to Alloy Effects Manager", EditorStyles.toolbarButton)) { + foreach (Camera camera in targets) { + Undo.AddComponent(camera.gameObject); + } + } + } + } +} \ No newline at end of file diff --git a/Assets/Alloy/Scripts/EffectsManager/Editor/AlloyCameraEditor.cs.meta b/Assets/Alloy/Scripts/EffectsManager/Editor/AlloyCameraEditor.cs.meta new file mode 100644 index 0000000..599bc73 --- /dev/null +++ b/Assets/Alloy/Scripts/EffectsManager/Editor/AlloyCameraEditor.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: dc5a924e062584c4b994b26019b1b30c +timeCreated: 1491670701 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Scripts/EffectsManager/Editor/AlloyEffectsManagerEditor.cs b/Assets/Alloy/Scripts/EffectsManager/Editor/AlloyEffectsManagerEditor.cs new file mode 100644 index 0000000..33c513c --- /dev/null +++ b/Assets/Alloy/Scripts/EffectsManager/Editor/AlloyEffectsManagerEditor.cs @@ -0,0 +1,142 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +using System.Collections.Generic; +using System.Linq; +using Alloy; +using UnityEditor; +using UnityEditor.AnimatedValues; +using UnityEngine; + +[CustomEditor(typeof(AlloyEffectsManager))] +public class AlloyEffectsManagerEditor : Editor { + private const string c_skinTabName = "SkinTab"; + private const string c_transmissionTabName = "TransmissionTab"; + private static Color s_scatterColor = new Color(0.49f, 0.36f, 0.16f); + private static Color s_transmissionColor = new Color(0.49f, 0.46f, 0.16f); + + private AlloyTabGroup m_tabGroup; + private AnimBool m_skinGroup; + private AnimBool m_transmissionGroup; + private List m_tabAdd = new List(); + private GenericMenu m_menu; + + private void OnEnable() { + m_tabGroup = AlloyTabGroup.GetTabGroup(); + m_skinGroup = new AnimBool(m_tabGroup.IsOpen(c_skinTabName)); + m_transmissionGroup = new AnimBool(m_tabGroup.IsOpen(c_transmissionTabName)); + } + + public override void OnInspectorGUI() { + serializedObject.Update(); + m_tabAdd.Clear(); + + var skinEnabled = serializedObject.FindProperty("SkinSettings.Enabled"); + + if (skinEnabled.boolValue && !skinEnabled.hasMultipleDifferentValues) { + bool removed; + m_skinGroup.target = m_tabGroup.TabArea("Skin Scattering", s_scatterColor, true, out removed, + c_skinTabName); + + if (EditorGUILayout.BeginFadeGroup(m_skinGroup.faded)) { + var prop = serializedObject.FindProperty("SkinSettings"); + prop.Next(true); //skip flag + prop.Next(true); //skip enabled + + DrawRemainingProp(prop); + } + + EditorGUILayout.EndFadeGroup(); + + if (removed) { + skinEnabled.boolValue = false; + } + } + else { + m_tabAdd.Add(new AlloyTabAdd { + Color = s_scatterColor, + Name = "Skin Scattering", + Enable = EnableSkin + }); + } + + var transEnabled = serializedObject.FindProperty("TransmissionSettings.Enabled"); + + if (transEnabled.boolValue && !transEnabled.hasMultipleDifferentValues) { + bool removed; + m_transmissionGroup.target = m_tabGroup.TabArea("Transmission", s_transmissionColor, true, out removed, + c_transmissionTabName); + + if (EditorGUILayout.BeginFadeGroup(m_transmissionGroup.faded)) { + var prop = serializedObject.FindProperty("TransmissionSettings"); + prop.Next(true); //skip flag + prop.Next(true);//skip enabled + DrawRemainingProp(prop); + } + + EditorGUILayout.EndFadeGroup(); + + if (removed) { + transEnabled.boolValue = false; + } + } + else { + m_tabAdd.Add(new AlloyTabAdd { + Color = s_transmissionColor, + Name = "Transmission", + Enable = EnableTransmission + }); + } + + if (m_skinGroup.isAnimating || m_transmissionGroup.isAnimating) { + Repaint(); + } + + AlloyEditor.DrawAddTabGUI(m_tabAdd); + serializedObject.ApplyModifiedProperties(); + + if (GUI.changed) { + var deferredRendererPlus = serializedObject.targetObject as AlloyEffectsManager; + + if (deferredRendererPlus != null) { + deferredRendererPlus.Refresh(); + } + } + } + + private void EnableTransmission() { + foreach (AlloyEffectsManager rend in targets) { + rend.TransmissionSettings.Enabled = true; + EditorUtility.SetDirty(rend); + rend.Refresh(); + } + + m_transmissionGroup.value = false; + m_transmissionGroup.target = true; + m_tabGroup.SetOpen(c_transmissionTabName, true); + } + + private void EnableSkin() { + foreach (AlloyEffectsManager rend in targets) { + rend.SkinSettings.Enabled = true; + EditorUtility.SetDirty(rend); + rend.Refresh(); + } + + m_skinGroup.value = false; + m_skinGroup.target = true; + m_tabGroup.SetOpen(c_skinTabName, true); + } + + private static void DrawRemainingProp(SerializedProperty prop) { + int depth = prop.depth; + + while (true) { + bool child = EditorGUILayout.PropertyField(prop, true); + + if (!prop.Next(child) || prop.depth < depth) + break; + } + } +} diff --git a/Assets/Alloy/Scripts/EffectsManager/Editor/AlloyEffectsManagerEditor.cs.meta b/Assets/Alloy/Scripts/EffectsManager/Editor/AlloyEffectsManagerEditor.cs.meta new file mode 100644 index 0000000..0962871 --- /dev/null +++ b/Assets/Alloy/Scripts/EffectsManager/Editor/AlloyEffectsManagerEditor.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 4d4b26109848fff4daa6b5974417de47 +timeCreated: 1445386295 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Scripts/EffectsManager/Shaders.meta b/Assets/Alloy/Scripts/EffectsManager/Shaders.meta new file mode 100644 index 0000000..9fe15a7 --- /dev/null +++ b/Assets/Alloy/Scripts/EffectsManager/Shaders.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 979804faf9172f54dbdbf0974928665d +folderAsset: yes +timeCreated: 1439605207 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Scripts/EffectsManager/Shaders/BlurNormals.shader b/Assets/Alloy/Scripts/EffectsManager/Shaders/BlurNormals.shader new file mode 100644 index 0000000..59c306f --- /dev/null +++ b/Assets/Alloy/Scripts/EffectsManager/Shaders/BlurNormals.shader @@ -0,0 +1,232 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Hidden/Alloy/Blur Normals" { +Properties { + _MainTex ("Render Input", 2D) = "white" {} +} +SubShader { + ZTest Always Cull Off ZWrite Off Fog { Mode Off } + + CGINCLUDE + #pragma target 3.0 + #pragma exclude_renderers gles + + #include "Assets/Alloy/Shaders/Framework/Utility.cginc" + + #include "HLSLSupport.cginc" + #include "UnityCG.cginc" + #include "UnityDeferredLibrary.cginc" + + // Screen-space diffusion + // cf http://www.iryoku.com/screen-space-subsurface-scattering + // cf http://uaasoftware.com/xi/PDSS/diffuseShader.fx + + // blurWidth = 0.15 + // blurDepthDifferenceMultiplier = 100 + // distanceToProjectionWindow = 1 / tan(radians(FoV) / 2); + // blurStepScale = blurWidth * distanceToProjectionWindow + // blurDepthDifferenceScale = blurDepthDifferenceMultiplier * distanceToProjectionWindow + + /// Number of downsampling texture taps. + #define A_NUM_DOWNSAMPLE_TAPS 4 + + /// Downsampling texture coordinate offset directions. + static const float2 A_DOWNSAMPLE_OFFSETS[A_NUM_DOWNSAMPLE_TAPS] = { + float2(0.0f, 0.0f), + float2(1.0f, 0.0f), + float2(0.0f, 1.0f), + float2(1.0f, 1.0f) + }; + + /// Number of blur texture taps. + #define A_NUM_BLUR_TAPS 7 + + /// Gaussian Distribution blur texture coordinate offsets. + static const float A_BLUR_OFFSETS[A_NUM_BLUR_TAPS] = { + 0.0f, -3.0f, -2.0f, -1.0f, 1.0f, 2.0f, 3.0f + }; + + /// Gaussian Distribution blur sample weights. + static const half A_BLUR_WEIGHTS[A_NUM_BLUR_TAPS] = { + 0.199471h, 0.0647588h, 0.120985h, 0.176033h, 0.176033h, 0.120985h, 0.0647588h + }; + + /// Number of upsampling texture taps. + #define A_NUM_UPSAMPLE_TAPS 4 + + /// Upsampling texture coordinate offset directions. + static const float2 A_UPSAMPLE_OFFSETS[A_NUM_UPSAMPLE_TAPS] = { + float2(0.0f, 1.0f), + float2(1.0f, 0.0f), + float2(-1.0f, 0.0f), + float2(0.0f, -1.0f) + }; + + /// (X: blurStepScale, Y: blurDepthDifferenceScale). + float2 _DeferredBlurredNormalsParams; + + // G-Buffer LAB (transmission in alpha). + sampler2D _DeferredTransmissionBuffer; + + /// Pass source texture. + sampler2D _MainTex; + + /// Pass source texture (X: Tiling X, Y: Tiling Y, Z: Offset X, W: Offset Y). + float4 _MainTex_ST; + + /// Pass source texture (X: 1 / width, Y: 1 / height, Z: width, W: height). + float4 _MainTex_TexelSize; + + /// Normal buffer. + sampler2D _CameraGBufferTexture2; + + /// Interpolates offet normals to center normals at edge discontinuities. + /// @param normalDepth Offset sample (XYZ: Normals, W: Depth). + /// @param normalDepthM Center sample (XYZ: Normals, W: Depth). + /// @return Edge-corrected normal. + half3 aEdgeCorrectNormal( + half4 normalDepth, + half4 normalDepthM) + { + // Cheaper than a 5-way blend, which requires inverts and an accumulator. + half alpha = saturate(_DeferredBlurredNormalsParams.y * abs(normalDepth.w - normalDepthM.w)); + return lerp(normalDepth.xyz, normalDepthM.xyz, alpha); + } + + /// Downsamples the G-Buffer normals and depth to 1/2 resolution. + /// @param IN Vertex input. + /// @return Downsampled image (XYZ: Normals, W: Nearest Depth). + half4 aDownsample( + v2f_img IN) + { + half depth = 1.0h; + half3 normal = 0.0h; + + UNITY_UNROLL + for (int i = 1; i < A_NUM_DOWNSAMPLE_TAPS; i++) { + float2 coord = UnityStereoScreenSpaceUVAdjust(A_DOWNSAMPLE_OFFSETS[i] * _MainTex_TexelSize.xy + IN.uv, _MainTex_ST); + float4 sampleUv = float4(coord, 0.0f, 0.0f); + + // Pre-combine sample weight with normal scale-bias unpack. + // 0.25 * (normal * 2 - 1) = normal * 0.5 - 0.25 + normal += tex2Dlod(_MainTex, sampleUv).xyz * 0.5h - 0.25h; + + // Use projection depth directly to avoid linearizing cost per sample. + depth = min(depth, SAMPLE_DEPTH_TEXTURE_LOD(_CameraDepthTexture, sampleUv)); + } + + // Export unpacked normals and linear depth for subsequent passes. + return half4(normal, LinearEyeDepth(depth)); + } + + /// Blur the source image along the specified axis. + /// @param IN Vertex input. + /// @param axis Axis on which to blur. + /// @return (XYZ: Blurred Normals, W: Sharp Depth). + half4 aBlurAxis( + v2f_img IN, + float2 axis) + { + // Gaussian Blur. + half4 normalDepthM = tex2Dlod(_MainTex, float4(UnityStereoScreenSpaceUVAdjust(IN.uv, _MainTex_ST), 0.0f, 0.0f)); + float scale = _DeferredBlurredNormalsParams.x / normalDepthM.w; + float2 finalStep = scale * axis * _MainTex_TexelSize.xy; + half3 output = A_BLUR_WEIGHTS[0] * normalDepthM.xyz; + + UNITY_UNROLL + for (int i = 1; i < A_NUM_BLUR_TAPS; i++) { + float2 coord = UnityStereoScreenSpaceUVAdjust(A_BLUR_OFFSETS[i] * finalStep + IN.uv, _MainTex_ST); + half4 normalDepth = tex2Dlod(_MainTex, float4(coord, 0.0f, 0.0f)); + + // Lerp back to middle sample when blur sample crosses an edge. + output += A_BLUR_WEIGHTS[i] * aEdgeCorrectNormal(normalDepth, normalDepthM); + } + + // Transfer original depth for subsequent passes. + return half4(output, normalDepthM.w); + } + + /// Upsamples the blurred normals. + /// @param IN Vertex input. + /// @return Upsampled, packed blurred normals. + half4 aUpsample( + v2f_img IN) + { + // Cross Bilateral Upsample filter. + half4 normalDepthM; + half4 output = 0.0h; + float4 sampleUv = float4(UnityStereoScreenSpaceUVAdjust(IN.uv, _MainTex_ST), 0.0f, 0.0f); + + normalDepthM.xyz = tex2Dlod(_CameraGBufferTexture2, sampleUv).xyz * 2.0f - 1.0f; + normalDepthM.w = LinearEyeDepth(SAMPLE_DEPTH_TEXTURE_LOD(_CameraDepthTexture, sampleUv)); + + UNITY_UNROLL + for (int i = 0; i < A_NUM_UPSAMPLE_TAPS; i++) { + float2 coord = UnityStereoScreenSpaceUVAdjust(A_UPSAMPLE_OFFSETS[i] * _MainTex_TexelSize.xy + IN.uv, _MainTex_ST); + half4 normalDepth = tex2Dlod(_MainTex, float4(coord, 0.0f, 0.0f)); + + output.xyz += 0.25h * aEdgeCorrectNormal(normalDepth, normalDepthM); + } + + // Pack normals and transmission for RGBA8 storage. + output.xyz = normalize(output.xyz) * 0.5h + 0.5h; + output.w = tex2Dlod(_DeferredTransmissionBuffer, sampleUv).a; + return output; + } + ENDCG + + Pass { + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + #pragma vertex vert_img + #pragma fragment frag + + half4 frag(v2f_img IN) : SV_Target { + return aDownsample(IN); + } + ENDCG + } + + Pass { + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + #pragma vertex vert_img + #pragma fragment frag + + half4 frag(v2f_img IN) : SV_Target { + return aBlurAxis(IN, float2(1.0f, 0.0f)); + } + ENDCG + } + + Pass { + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + #pragma vertex vert_img + #pragma fragment frag + + half4 frag(v2f_img IN) : SV_Target { + return aBlurAxis(IN, float2(0.0f, 1.0f)); + } + ENDCG + } + + Pass { + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + #pragma vertex vert_img + #pragma fragment frag + + half4 frag(v2f_img IN) : SV_Target { + return aUpsample(IN); + } + ENDCG + } +} +} \ No newline at end of file diff --git a/Assets/Alloy/Scripts/EffectsManager/Shaders/BlurNormals.shader.meta b/Assets/Alloy/Scripts/EffectsManager/Shaders/BlurNormals.shader.meta new file mode 100644 index 0000000..f30808a --- /dev/null +++ b/Assets/Alloy/Scripts/EffectsManager/Shaders/BlurNormals.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 5b34ef975c671984fb9c93adc7042982 +timeCreated: 1439655606 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Scripts/EffectsManager/Shaders/TransmissionBlit.shader b/Assets/Alloy/Scripts/EffectsManager/Shaders/TransmissionBlit.shader new file mode 100644 index 0000000..0fc7ac7 --- /dev/null +++ b/Assets/Alloy/Scripts/EffectsManager/Shaders/TransmissionBlit.shader @@ -0,0 +1,33 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Hidden/Alloy/Transmission Blit" { +Properties { + _MainTex ("Render Input", 2D) = "white" {} +} +SubShader { + ZTest Always + Cull Off + ZWrite Off + Fog { Mode Off } + + Pass { + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + #pragma vertex vert_img + #pragma fragment frag + + #include "UnityCG.cginc" + + sampler2D _MainTex; + float4 _MainTex_ST; + + float4 frag(v2f_img IN) : SV_Target { + return tex2Dlod(_MainTex, float4(UnityStereoScreenSpaceUVAdjust(IN.uv, _MainTex_ST), 0.0f, 0.0f)); + } + ENDCG + } +} +} \ No newline at end of file diff --git a/Assets/Alloy/Scripts/EffectsManager/Shaders/TransmissionBlit.shader.meta b/Assets/Alloy/Scripts/EffectsManager/Shaders/TransmissionBlit.shader.meta new file mode 100644 index 0000000..7a55913 --- /dev/null +++ b/Assets/Alloy/Scripts/EffectsManager/Shaders/TransmissionBlit.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 4bbeef29a84b4ed498f2d4a7d9fcefc4 +timeCreated: 1439605218 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Scripts/MaterialInspectors.meta b/Assets/Alloy/Scripts/MaterialInspectors.meta new file mode 100644 index 0000000..0de5e85 --- /dev/null +++ b/Assets/Alloy/Scripts/MaterialInspectors.meta @@ -0,0 +1,6 @@ +fileFormatVersion: 2 +guid: a09bc1e2550271c4b80f0d54972ba858 +folderAsset: yes +DefaultImporter: + userData: + assetBundleName: diff --git a/Assets/Alloy/Scripts/MaterialInspectors/Editor.meta b/Assets/Alloy/Scripts/MaterialInspectors/Editor.meta new file mode 100644 index 0000000..2893fc7 --- /dev/null +++ b/Assets/Alloy/Scripts/MaterialInspectors/Editor.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: cdcd98ae1d577384abf903171eb390e1 +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/Alloy/Scripts/MaterialInspectors/Editor/AlloyInspectorBase.cs b/Assets/Alloy/Scripts/MaterialInspectors/Editor/AlloyInspectorBase.cs new file mode 100644 index 0000000..c4125dd --- /dev/null +++ b/Assets/Alloy/Scripts/MaterialInspectors/Editor/AlloyInspectorBase.cs @@ -0,0 +1,214 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +using UnityEngine; +using System.Collections.Generic; +using System.Linq; +using Alloy; +using UnityEditor; +using PropType = UnityEditor.MaterialProperty.PropType; + +static class AlloySceneDrawer { + static Dictionary s_inspectorKeeper = new Dictionary(); + static List s_removekeys = new List(); + + static AlloySceneDrawer() { + EditorApplication.update += Update; + } + + static void Update() { + var keys = s_inspectorKeeper.Keys; + s_removekeys.Clear(); + + foreach (var key in keys) { + if (s_inspectorKeeper[key] != null) { + continue; + } + + key.OnAlloyShaderDisable(); + s_removekeys.Add(key); + } + + foreach (var key in s_removekeys) { + s_inspectorKeeper.Remove(key); + } + } + + public static void Register(AlloyInspectorBase inspector, MaterialEditor keeper) { + if (!s_inspectorKeeper.ContainsKey(inspector)) { + s_inspectorKeeper.Add(inspector, keeper); + } + } +} + +public class AlloyInspectorBase : ShaderGUI { + public MaterialEditor MatEditor; + protected AlloyTabGroup TabGroup; + + public Object[] Targets { get { return MatEditor.targets; } } + public Material Target { get { return (Material) MatEditor.target; } } + + bool m_inited; + bool m_isValid = true; + + protected int MatInst { + get { + if (Selection.objects.Length == 1 && Selection.activeGameObject != null) { + var sharedMaterials = Selection.activeGameObject.GetComponent().sharedMaterials; + + if (sharedMaterials != null) { + return ArrayUtility.IndexOf(sharedMaterials, Target); + } + } + + return 0; + } + } + + void OnEnable(MaterialProperty[] properties) { + if (HasMutlipleShaders()) { + return; + } + + TabGroup = AlloyTabGroup.GetTabGroup(); + + if (Targets.Length > 1) { + if (MaterialsAreMismatched()) { + foreach (var target in Targets) { + var so = new SerializedObject(target); + so.Update(); + + + var textures = so.FindProperty("m_SavedProperties.m_TexEnvs"); + ClearMaterialArray(PropType.Texture, textures, properties); + + var floats = so.FindProperty("m_SavedProperties.m_Floats"); + ClearMaterialArray(PropType.Float, floats, properties); + + var colors = so.FindProperty("m_SavedProperties.m_Colors"); + ClearMaterialArray(PropType.Color, colors, properties); + so.ApplyModifiedProperties(); + so.Dispose(); + } + + m_isValid = false; + return; + } + } + + SceneView.onSceneGUIDelegate += OnAlloySceneGUI; + OnAlloyShaderEnable(); + } + + bool HasMutlipleShaders() { + if (MatEditor.targets.Length > 1) { + + return Targets.Any(o => { + var objMat = o as Material; + return objMat != null && (Target != null && objMat.shader != Target.shader); + }); + } + + return false; + } + + protected virtual void OnAlloyShaderGUI(MaterialProperty[] properties) { + } + + protected virtual void OnAlloyShaderEnable() { + } + + public virtual void OnAlloySceneGUI(SceneView sceneView) { + } + + + void ClearMaterialArray(PropType type, SerializedProperty props, MaterialProperty[] properties) { + for (int i = 0; i < props.arraySize; ++i) { + var prop = props.GetArrayElementAtIndex(i); + var nameProp = prop.FindPropertyRelative("first"); + string propName = nameProp.stringValue; + + MaterialProperty matProp = FindProperty(propName, properties, false); + + if (matProp == null || matProp.type != type) { + props.DeleteArrayElementAtIndex(i); + --i; + } + } + + MatEditor.OnEnable(); + } + + bool MaterialsAreMismatched() { + var textures = MatEditor.serializedObject.FindProperty("m_SavedProperties.m_TexEnvs"); + if (PropsInArrayMismatched(textures)) { + return true; + } + + var floats = MatEditor.serializedObject.FindProperty("m_SavedProperties.m_Floats"); + if (PropsInArrayMismatched(floats)) { + return true; + } + var colors = MatEditor.serializedObject.FindProperty("m_SavedProperties.m_Colors"); + if (PropsInArrayMismatched(colors)) { + return true; + } + + return false; + } + + bool PropsInArrayMismatched(SerializedProperty props) { + string original = props.propertyPath; + props.Next(true); + props.Next(true); + props.Next(true); + + //some weird unity behaviour where it collapses the array + if (!props.propertyPath.Contains(original)) { + return true; + } + + do { + var nameProp = props.FindPropertyRelative("first"); + + if (nameProp.hasMultipleDifferentValues) { + return true; + } + } while (props.NextVisible(false) && props.propertyPath.Contains(original)); + + return false; + } + + public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] properties) { + MatEditor = materialEditor; + m_isValid = true; + + if (!m_inited) { + AlloySceneDrawer.Register(this, MatEditor); + OnEnable(properties); + } + + if (!m_isValid) { + EditorGUILayout.LabelField("There's a problem with the inspector. Reselect the material to fix"); + EditorApplication.delayCall += () => MatEditor.Repaint(); + return; + } + + if (HasMutlipleShaders()) { + EditorGUILayout.HelpBox("Can't edit materials with different shaders!", MessageType.Warning); + return; + } + + GUILayout.Space(10.0f); + if (MatEditor.isVisible) { + OnAlloyShaderGUI(properties); + } + + m_inited = true; + } + + public virtual void OnAlloyShaderDisable() { + SceneView.onSceneGUIDelegate -= OnAlloySceneGUI; + } +} \ No newline at end of file diff --git a/Assets/Alloy/Scripts/MaterialInspectors/Editor/AlloyInspectorBase.cs.meta b/Assets/Alloy/Scripts/MaterialInspectors/Editor/AlloyInspectorBase.cs.meta new file mode 100644 index 0000000..e084c05 --- /dev/null +++ b/Assets/Alloy/Scripts/MaterialInspectors/Editor/AlloyInspectorBase.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b14f7264c7490be4e9efc64c33c313aa +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/Alloy/Scripts/MaterialInspectors/Editor/AlloyTabGroup.cs b/Assets/Alloy/Scripts/MaterialInspectors/Editor/AlloyTabGroup.cs new file mode 100644 index 0000000..df010d4 --- /dev/null +++ b/Assets/Alloy/Scripts/MaterialInspectors/Editor/AlloyTabGroup.cs @@ -0,0 +1,162 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +using System; +using System.Collections.Generic; +using UnityEngine; +using UnityEditor; + +namespace Alloy +{ + [Serializable] + public class AlloyTabGroup : ScriptableObject + { + [SerializeField] private List m_open; + [SerializeField] private List m_names; + private Action m_defaultTabFunction = (r) => GUI.Label(r, "-", EditorStyles.whiteLabel); + + + + public static AlloyTabGroup GetTabGroup() { + var o = Resources.FindObjectsOfTypeAll(); + AlloyTabGroup tab; + + if (o.Length != 0) { + tab = o[0]; + } else { + tab = CreateInstance(); + tab.hideFlags = HideFlags.HideAndDontSave; + tab.name = "AlloyTabGroup"; + } + + return tab; + } + + private void OnEnable() { + if (m_open != null && m_names != null) return; + + m_open = new List(); + m_names = new List(); + } + + private int DeclOpen(string nameDecl) { + string actual = nameDecl + GUI.depth; + + if (!m_names.Contains(actual)) { + m_open.Add(false); + m_names.Add(actual); + } + + return m_names.IndexOf(actual); + } + + public bool TabArea(string areaName, Color color, bool hasOptionalGui, out bool removed, string saveAs = "") { + return TabArea(areaName, color, hasOptionalGui, m_defaultTabFunction, out removed, saveAs); + } + + public bool TabArea(string areaName, Color color, bool hasOptionalGui, Action optionalGUI, out bool removed, string saveAs = "") + { + if (saveAs == "") { + saveAs = areaName; + } + + Color oldGuiColor = GUI.color; + Color oldBackgroundColor = GUI.backgroundColor; + + GUI.color = Color.Lerp(color, Color.white, 0.8f); + GUI.backgroundColor = color; + + bool ret = TabArea(areaName, hasOptionalGui, optionalGUI, out removed, saveAs); + GUI.color = oldGuiColor; + GUI.backgroundColor = oldBackgroundColor; + + return ret; + } + + public bool TabArea(string areaName, bool hasOptionalGui, out bool removed, string saveAs = "") { + return TabArea(areaName, hasOptionalGui, m_defaultTabFunction, out removed, saveAs); + } + + public bool TabArea(string areaName, bool hasOptionalGui, Action optionalGUI, out bool removed, string saveAs = "") + { + if (saveAs == "") { + saveAs = areaName; + } + + int i = DeclOpen(saveAs); + var tabTextColor = EditorGUIUtility.isProSkin ? new Color(0.7f, 0.7f, 0.7f) : new Color(0.9f, 0.9f, 0.9f); + var oldCol = GUI.color; + GUI.color = oldCol * (m_open[i] ? Color.white : new Color(0.8f, 0.8f, 0.8f)); + + GUILayout.Label(""); + + var rect = GUILayoutUtility.GetLastRect(); + rect.x -= 35.0f; + rect.width += hasOptionalGui ? 10.0f : 50.0f; + + m_open[i] = GUI.Toggle(rect, m_open[i], new GUIContent(""), "ShurikenModuleTitle"); + removed = false; + + if (hasOptionalGui) + { + var delRect = rect; + delRect.xMin = rect.xMax; + delRect.xMax += 40.0f; + + GUI.color = oldCol * (m_open[i] ? new Color(0.7f, 0.7f, 0.7f) : new Color(0.5f, 0.5f, 0.5f)); + + if (GUI.Button(delRect, "", "ShurikenModuleTitle")) { + removed = true; + } + + GUI.color = tabTextColor; + GUI.backgroundColor = Color.white; + delRect.x += 10.0f; + optionalGUI(delRect); + } + + rect.x += 35.0f; + GUI.color = tabTextColor; + GUI.Label(rect, areaName, EditorStyles.whiteLabel); + GUI.color = oldCol; + + if (GUI.changed) { + EditorUtility.SetDirty(this); + } + + return m_open[i]; + } + + public bool Foldout(string areaName, string saveName, params GUILayoutOption[] options) { + int i = DeclOpen(saveName); + + EditorGUILayout.BeginHorizontal(); + m_open[i] = EditorGUILayout.Toggle(new GUIContent(""), m_open[i], "foldout", options); + + if (areaName != "") + EditorGUILayout.LabelField(new GUIContent(areaName), GUILayout.ExpandWidth(false), GUILayout.Width(180.0f)); + EditorGUILayout.EndHorizontal(); + + if (GUI.changed) + EditorUtility.SetDirty(this); + + return m_open[i]; + } + + public bool IsOpen(string areaName) { + int i = DeclOpen(areaName); + return m_open[i]; + } + + public void SetOpen(string areaName, bool open) { + int i = DeclOpen(areaName); + m_open[i] = open; + } + + public void Close(string areaName) { + int i = DeclOpen(areaName); + m_open[i] = false; + } + } +} \ No newline at end of file diff --git a/Assets/Alloy/Scripts/MaterialInspectors/Editor/AlloyTabGroup.cs.meta b/Assets/Alloy/Scripts/MaterialInspectors/Editor/AlloyTabGroup.cs.meta new file mode 100644 index 0000000..b6e431b --- /dev/null +++ b/Assets/Alloy/Scripts/MaterialInspectors/Editor/AlloyTabGroup.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 700e2ca720a367c41877be522b433566 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/Alloy/Scripts/MaterialInspectors/Editor/FieldBased.meta b/Assets/Alloy/Scripts/MaterialInspectors/Editor/FieldBased.meta new file mode 100644 index 0000000..fc79d12 --- /dev/null +++ b/Assets/Alloy/Scripts/MaterialInspectors/Editor/FieldBased.meta @@ -0,0 +1,6 @@ +fileFormatVersion: 2 +guid: dadbee4584b61ec4792a816f7dfe5061 +folderAsset: yes +DefaultImporter: + userData: + assetBundleName: diff --git a/Assets/Alloy/Scripts/MaterialInspectors/Editor/FieldBased/AlloyFieldBasedEditor.cs b/Assets/Alloy/Scripts/MaterialInspectors/Editor/FieldBased/AlloyFieldBasedEditor.cs new file mode 100644 index 0000000..83021e2 --- /dev/null +++ b/Assets/Alloy/Scripts/MaterialInspectors/Editor/FieldBased/AlloyFieldBasedEditor.cs @@ -0,0 +1,167 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +using UnityEngine; +using System.Collections.Generic; +using System.Linq; +using UnityEditor; +using UnityEditor.AnimatedValues; + +[CanEditMultipleObjects] +public class AlloyFieldBasedEditor : AlloyInspectorBase { + Dictionary m_openCloseAnim = new Dictionary(); + AlloyFieldDrawer[] m_fieldDrawers; + + string[] m_allTabs; + + public bool TabIsEnabled(MaterialProperty prop) { + return !prop.hasMixedValue && prop.floatValue > 0.5f; + } + + public void EnableTab(string tab, MaterialProperty prop, int matInst) { + m_openCloseAnim[prop.name].value = false; + TabGroup.SetOpen(tab + matInst, true); + + prop.floatValue = 1.0f; + MaterialEditor.ApplyMaterialPropertyDrawers(Targets); + RepaintScene(); + } + + public void DisableTab(string tab, MaterialProperty prop, int matInst) { + prop.floatValue = 0.0f; + MaterialEditor.ApplyMaterialPropertyDrawers(Targets); + RepaintScene(); + + m_openCloseAnim[prop.name].target = false; + TabGroup.SetOpen(tab + matInst, false); + } + + protected override void OnAlloyShaderEnable() { + Undo.undoRedoPerformed += OnUndo; + } + + public override void OnAlloyShaderDisable() { + base.OnAlloyShaderDisable(); + + if (m_fieldDrawers != null) { + foreach (var drawer in m_fieldDrawers) { + if (drawer != null) { + drawer.OnDisable(); + } + } + } + } + + void OnUndo() { + MatEditor.Repaint(); + } + + static HashSet s_knownNulls = new HashSet(); + + protected override void OnAlloyShaderGUI(MaterialProperty[] properties) { + //Refresh drawer structure if needed + bool structuralChange = false; + if (m_fieldDrawers == null || m_fieldDrawers.Length != properties.Length) { + m_fieldDrawers = new AlloyFieldDrawer[properties.Length]; + structuralChange = true; + } + + for (int i = 0; i < properties.Length; ++i) { + string propName = properties[i].name; + + if (m_fieldDrawers[i] == null && !s_knownNulls.Contains(propName) || m_fieldDrawers[i] != null && m_fieldDrawers[i].Property.name != propName) { + m_fieldDrawers[i] = AlloyFieldDrawerFactory.GetFieldDrawer(this, properties[i]); + + if (m_fieldDrawers[i] == null) { + s_knownNulls.Add(propName); + } + else { + structuralChange = true; + } + } + } + + //If changed, update the animation stuff + if (structuralChange) { + m_openCloseAnim.Clear(); + var allTabs = new List(); + + for (var i = 0; i < m_fieldDrawers.Length; i++) { + var drawer = m_fieldDrawers[i]; + + if (!(drawer is AlloyTabDrawer)) { + continue; + } + + bool isOpenCur = TabGroup.IsOpen(drawer.DisplayName + MatInst); + + var anim = new AnimBool(isOpenCur) {speed = 6.0f, value = isOpenCur}; + m_openCloseAnim.Add(properties[i].name, anim); + allTabs.Add(drawer.DisplayName); + } + + m_allTabs = allTabs.ToArray(); + } + + + //Formulate arguments to pass to drawing + var args = new AlloyFieldDrawerArgs { + Editor = this, + Materials = Targets.Cast().ToArray(), + Properties = properties, + PropertiesSkip = new List(), + MatInst = MatInst, + TabGroup = TabGroup, + AllTabNames = m_allTabs, + OpenCloseAnim = m_openCloseAnim + }; + + + for (var i = 0; i < m_fieldDrawers.Length; i++) { + var drawer = m_fieldDrawers[i]; + + if (drawer == null) { + continue; + } + + drawer.Index = i; + drawer.Property = properties[i]; + + if (drawer.ShouldDraw(args)) { + drawer.Draw(args); + } + } + + if (!string.IsNullOrEmpty(args.CurrentTab)) { + EditorGUILayout.EndFadeGroup(); + } + + GUILayout.Space(10.0f); + + AlloyEditor.DrawAddTabGUI(args.TabsToAdd); + + //If animating -> Repaint + foreach (var animBool in m_openCloseAnim) { + if (animBool.Value.isAnimating) { + MatEditor.Repaint(); + break; + } + } + } + + public override void OnAlloySceneGUI(SceneView sceneView) { + foreach (var drawer in m_fieldDrawers) { + if (drawer != null) { + drawer.OnSceneGUI(Targets.Cast().ToArray()); + } + } + } + + private void RepaintScene() { + var lastSceneView = SceneView.lastActiveSceneView; + + if (lastSceneView != null) + lastSceneView.Repaint(); + } +} \ No newline at end of file diff --git a/Assets/Alloy/Scripts/MaterialInspectors/Editor/FieldBased/AlloyFieldBasedEditor.cs.meta b/Assets/Alloy/Scripts/MaterialInspectors/Editor/FieldBased/AlloyFieldBasedEditor.cs.meta new file mode 100644 index 0000000..fefe8f2 --- /dev/null +++ b/Assets/Alloy/Scripts/MaterialInspectors/Editor/FieldBased/AlloyFieldBasedEditor.cs.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: a42f0f341bef6df4c8093abde9d7e4f3 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: diff --git a/Assets/Alloy/Scripts/MaterialInspectors/Editor/FieldBased/AlloyFieldLexer.cs b/Assets/Alloy/Scripts/MaterialInspectors/Editor/FieldBased/AlloyFieldLexer.cs new file mode 100644 index 0000000..316ba2d --- /dev/null +++ b/Assets/Alloy/Scripts/MaterialInspectors/Editor/FieldBased/AlloyFieldLexer.cs @@ -0,0 +1,327 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +using System.Collections.Generic; +using System.Linq; +using UnityEngine; + +public abstract class AlloyToken +{ + public string Token; + + protected AlloyToken(string field, AlloyFieldLexer currentLexer) { + Token = field; + } +} + + +public class AlloyCollectionToken : AlloyToken +{ + public List SubTokens; + + public const char CollectionOpen = '{'; + public const char CollectionClose = '}'; + + public AlloyCollectionToken(string field, AlloyFieldLexer currentLexer) + : base(field, currentLexer) { + + + SubTokens = currentLexer.GenerateTokens(field); + } +} + + +public class AlloyArgumentToken : AlloyToken +{ + public const char ArgumentChar = ':'; + + public string ArgumentName; + public AlloyToken ArgumentToken; + + public AlloyArgumentToken(string field, AlloyFieldLexer currentLexer) + : base(field, currentLexer) { + int index = field.IndexOf(':'); + ArgumentName = field.Substring(0, index); + string valueStr = field.Substring(index + 1); + + + int outInd; + ArgumentToken = currentLexer.GenerateToken(valueStr, 0, out outInd); + } +} + + +public class AlloyValueToken : AlloyToken +{ + private const string c_true = "True"; + private const string c_false = "False"; + + public enum ValueTypeEnum + { + Bool, + Float, + String + } + + + public ValueTypeEnum ValueType { get; private set; } + private bool m_boolValue; + private float m_floatValue; + private string m_stringValue; + + + public bool BoolValue { + get { + ExpectType(ValueTypeEnum.Bool); + return m_boolValue; + } + } + + public float FloatValue { + get { + ExpectType(ValueTypeEnum.Float); + return m_floatValue; + } + } + + public string StringValue { + get { + ExpectType(ValueTypeEnum.String); + return m_stringValue; + } + } + + private void ExpectType(ValueTypeEnum type) { + if (ValueType != type) { + Debug.LogError("Cant read " + type + " value from token!"); + } + } + + public AlloyValueToken(string field, AlloyFieldLexer currentLexer) + : base(field, currentLexer) { + + if (field == c_true) { + ValueType = ValueTypeEnum.Bool; + m_boolValue = true; + return; + } + + + if (field == c_false) { + ValueType = ValueTypeEnum.Bool; + m_boolValue = false; + return; + } + + + + float val; + if (float.TryParse(field, out val)) { + ValueType = ValueTypeEnum.Float; + m_floatValue = val; + return; + } + + ValueType = ValueTypeEnum.String; + m_stringValue = field; + } +} + + +//The language defines a few concepts + +//A pure token will be intepreted as a value +//MyString -> string value MyString +//True -> bool True +//1.03 -> float 1.03 + + +//A collection token defines a set of tokens +//{1.03f True True {}} + +//A argument token defines a name and an associated token +//CollectionArgument:{True, False} + + + + + +public class AlloyFieldLexer +{ + private AlloyToken[] m_tokens; + private static char[] s_specialChars = { '.', ':', '_'}; + + + public List GenerateTokens(string parseString) { + + + var ret = new List(); + int index = 0; + + while (index != -1) { + var token = GenerateToken(parseString, index, out index); + + if (token == null) { + break; + } + + ret.Add(token); + } + + return ret; + } + + public AlloyToken GenerateToken(string parseString, int startIndex, out int index) { + parseString = PreprocessString(parseString); + + for (int i = startIndex; i < parseString.Length; ++i) { + char c = parseString[i]; + + if (c == ' ') { + continue; + } + + string token; + + switch (c) { + case AlloyCollectionToken.CollectionOpen: + token = ReadStackedUntil(parseString, i, AlloyCollectionToken.CollectionOpen, AlloyCollectionToken.CollectionClose); + index = i + token.Length + 1; + return new AlloyCollectionToken(token, this); + } + + bool charOpen = c == '\''; + + if (char.IsLetterOrDigit(c) || charOpen || s_specialChars.Contains(c)) { + bool argument; + token = ReadWord(parseString, i, out argument); + index = i + token.Length + 1; + + if (charOpen) { + ++index; + } + + if (argument) { + return new AlloyArgumentToken(token, this); + } + + return new AlloyValueToken(token, this); + } + } + + index = -1; + return null; + } + + private string PreprocessString(string parseString) { + return parseString.Replace(',', ' '); + } + + protected string ReadStackedUntil(string parseString, int index, char openC, char closeC) { + bool found = false; + int stack = 0; + int readIndex; + + for (readIndex = index; readIndex < parseString.Length; ++readIndex) { + char c = parseString[readIndex]; + + if (c == openC) { + ++stack; + } + else if (c == closeC) { + --stack; + } + + + if (stack == 0) { + found = true; + break; + } + } + + if (!found) { + Debug.LogError("Parsing fail. Could not find closing char" + closeC); + Debug.Log(parseString); + return null; + } + + return parseString.Substring(index + 1, readIndex - index); + } + + private string ReadWord(string parseString, int index, out bool isArgument) { + int readIndex = index; + bool found = false; + int stack = 0; + + bool inString = parseString[index] == '\''; + + if (inString) { + ++index; + } + + isArgument = false; + + + for (int i = index; i < parseString.Length; ++i) { + char curChar = parseString[i]; + + readIndex = i; + + + if (curChar == ':') { + isArgument = true; + } + + if (!inString) { + if (char.IsLetterOrDigit(curChar) || s_specialChars.Contains(curChar)) { + continue; + } + + if (curChar == AlloyCollectionToken.CollectionOpen) { + ++stack; + continue; + } + + if ((curChar == AlloyCollectionToken.CollectionClose) && stack != 0) { + --stack; + + if (stack == 0) { + break; + } + } + + if (stack != 0) { + continue; + } + } + else { + if (curChar != '\'') { + continue; + } + } + + found = true; + break; + } + + if (!found) { + readIndex++; + } + + string ret = parseString.Substring(index, readIndex - index); + + + //TODO: Handle argument:'StringToken' + /* + if (found) { + + //if (readIndex < parseString.Length - 1 && parseString[readIndex + 1] == ':') { + //ret += ReadWord(parseString, readIndex + 2); + //} + } + */ + + return ret; + } +} diff --git a/Assets/Alloy/Scripts/MaterialInspectors/Editor/FieldBased/AlloyFieldLexer.cs.meta b/Assets/Alloy/Scripts/MaterialInspectors/Editor/FieldBased/AlloyFieldLexer.cs.meta new file mode 100644 index 0000000..d1e663c --- /dev/null +++ b/Assets/Alloy/Scripts/MaterialInspectors/Editor/FieldBased/AlloyFieldLexer.cs.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 52de48504b3bb25439b7013a009de5e9 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: diff --git a/Assets/Alloy/Scripts/MaterialInspectors/Editor/FieldBased/AlloyFieldParser.cs b/Assets/Alloy/Scripts/MaterialInspectors/Editor/FieldBased/AlloyFieldParser.cs new file mode 100644 index 0000000..c4675bd --- /dev/null +++ b/Assets/Alloy/Scripts/MaterialInspectors/Editor/FieldBased/AlloyFieldParser.cs @@ -0,0 +1,156 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +using UnityEditor.AnimatedValues; +using UnityEngine; +using System.Collections.Generic; +using System.Linq; +using Alloy; +using UnityEditor; + + +//Generates drawers for a certain field +public abstract class AlloyFieldParser { + protected List Tokens; + + public bool HasSettings; + public string DisplayName; + + protected MaterialProperty MaterialProperty; + protected AlloyArgumentToken[] Arguments; + + protected AlloyFieldParser(MaterialProperty prop) { + var lexer = new AlloyFieldLexer(); + Tokens = lexer.GenerateTokens(prop.displayName); + + if (Tokens.Count == 0) { + Debug.LogError("No tokens found!"); + return; + } + + MaterialProperty = prop; + DisplayName = Tokens[0].Token; + + if (Tokens.Count <= 1) { + return; + } + + var settingsToken = Tokens[1] as AlloyCollectionToken; + if (settingsToken == null) { + return; + } + + HasSettings = true; + Arguments = settingsToken.SubTokens.OfType().ToArray(); + } + + public AlloyFieldDrawer GetDrawer(AlloyInspectorBase editor) { + if (!HasSettings) { + return null; + } + + var drawer = GenerateDrawer(editor); + if (drawer != null) { + drawer.DisplayName = DisplayName; + } + + return drawer; + } + + protected abstract AlloyFieldDrawer GenerateDrawer(AlloyInspectorBase editor); +} + +public class AlloyFieldDrawerArgs { + public AlloyFieldBasedEditor Editor; + public AlloyTabGroup TabGroup; + public Material[] Materials; + public MaterialProperty[] Properties; + public List PropertiesSkip = new List(); + public string CurrentTab; + public int MatInst; + public bool DoDraw = true; + public List TabsToAdd = new List(); + public string[] AllTabNames; + public Dictionary OpenCloseAnim; + + public MaterialProperty GetMaterialProperty(string velName) { + return Properties.FirstOrDefault(p => p.name == velName); + } +} + +public class AlloyTabAdd { + public string Name; + public Color Color; + + public GenericMenu.MenuFunction Enable; +} + +public abstract class AlloyFieldDrawer { + public MaterialProperty Property; + public int Index; + + public string DisplayName; + public abstract void Draw(AlloyFieldDrawerArgs args); + + protected MaterialEditor MatEditor; + + protected void BeginMaterialProperty(MaterialProperty property) { + MatEditor.BeginAnimatedCheck(Property); + EditorGUI.BeginChangeCheck(); + EditorGUI.showMixedValue = Property.hasMixedValue; + } + + protected bool EndMaterialProperty() { + bool change = EditorGUI.EndChangeCheck(); + MatEditor.EndAnimatedCheck(); + EditorGUI.showMixedValue = false; + return change; + } + + public AlloyFieldDrawer(AlloyInspectorBase editor, MaterialProperty property) { + Property = property; + MatEditor = editor.MatEditor; + } + + protected void FloatFieldMin(string displayName, float min) { + BeginMaterialProperty(Property); + float newVal = EditorGUILayout.FloatField(displayName, Property.floatValue); + + if (EndMaterialProperty()) { + Property.floatValue = Mathf.Max(newVal, min); + } + } + + protected void FloatFieldMax(string displayName, float max) { + BeginMaterialProperty(Property); + float newVal = EditorGUILayout.FloatField(displayName, Property.floatValue); + + if (EndMaterialProperty()) { + Property.floatValue = Mathf.Min(newVal, max); + } + } + + protected void FloatFieldSlider(string displayName, float min, float max) { + BeginMaterialProperty(Property); + float newVal = EditorGUILayout.Slider(displayName, Property.floatValue, min, max, GUILayout.MinWidth(20.0f)); + + if (EndMaterialProperty()) { + Property.floatValue = Mathf.Clamp(newVal, min, max); + } + } + + public void PropField(string displayName) { + MatEditor.ShaderProperty(Property, displayName); + } + + public virtual bool ShouldDraw(AlloyFieldDrawerArgs args) { + return args.DoDraw && !args.PropertiesSkip.Contains(Property.name); + } + + public virtual void OnSceneGUI(Material[] materials) { + } + + public virtual void OnDisable() { + } +} \ No newline at end of file diff --git a/Assets/Alloy/Scripts/MaterialInspectors/Editor/FieldBased/AlloyFieldParser.cs.meta b/Assets/Alloy/Scripts/MaterialInspectors/Editor/FieldBased/AlloyFieldParser.cs.meta new file mode 100644 index 0000000..bacc61a --- /dev/null +++ b/Assets/Alloy/Scripts/MaterialInspectors/Editor/FieldBased/AlloyFieldParser.cs.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 23f0b2f9bd608954ca3ef47baea748b7 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: diff --git a/Assets/Alloy/Scripts/MaterialInspectors/Editor/FieldBased/Drawers.meta b/Assets/Alloy/Scripts/MaterialInspectors/Editor/FieldBased/Drawers.meta new file mode 100644 index 0000000..a91e160 --- /dev/null +++ b/Assets/Alloy/Scripts/MaterialInspectors/Editor/FieldBased/Drawers.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: c8a42743b4a4aee4d901f3b88bbf641f +folderAsset: yes +timeCreated: 1430261445 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Scripts/MaterialInspectors/Editor/FieldBased/Drawers/AlloyFieldDrawerFactory.cs b/Assets/Alloy/Scripts/MaterialInspectors/Editor/FieldBased/Drawers/AlloyFieldDrawerFactory.cs new file mode 100644 index 0000000..126090f --- /dev/null +++ b/Assets/Alloy/Scripts/MaterialInspectors/Editor/FieldBased/Drawers/AlloyFieldDrawerFactory.cs @@ -0,0 +1,46 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + + +using UnityEditor; +using UnityEngine; + +public static class AlloyFieldDrawerFactory { + private static AlloyFieldParser GetFieldParser(MaterialProperty prop) { + + switch (prop.type) { + case MaterialProperty.PropType.Texture: + if (prop.textureDimension == UnityEngine.Rendering.TextureDimension.Cube) { + return new AlloyCubeParser(prop); + } + + return new AlloyTextureParser(prop); + + case MaterialProperty.PropType.Range: + case MaterialProperty.PropType.Float: + return new AlloyFloatParser(prop); + + case MaterialProperty.PropType.Color: + return new AlloyColorParser(prop); + + case MaterialProperty.PropType.Vector: + return new AlloyVectorParser(prop); + + default: + Debug.LogError("No appopriate parser found to generate a drawer"); + return null; + } + } + + public static AlloyFieldDrawer GetFieldDrawer(AlloyInspectorBase editor, MaterialProperty prop) { + AlloyFieldParser parser = GetFieldParser(prop); + + if (parser != null) { + return parser.GetDrawer(editor); + } + + return null; + } +} + diff --git a/Assets/Alloy/Scripts/MaterialInspectors/Editor/FieldBased/Drawers/AlloyFieldDrawerFactory.cs.meta b/Assets/Alloy/Scripts/MaterialInspectors/Editor/FieldBased/Drawers/AlloyFieldDrawerFactory.cs.meta new file mode 100644 index 0000000..032e074 --- /dev/null +++ b/Assets/Alloy/Scripts/MaterialInspectors/Editor/FieldBased/Drawers/AlloyFieldDrawerFactory.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 92100f25eeaa5f14c882772983cb2592 +timeCreated: 1430261698 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Scripts/MaterialInspectors/Editor/FieldBased/Drawers/AlloyFieldDrawers.cs b/Assets/Alloy/Scripts/MaterialInspectors/Editor/FieldBased/Drawers/AlloyFieldDrawers.cs new file mode 100644 index 0000000..8b8117e --- /dev/null +++ b/Assets/Alloy/Scripts/MaterialInspectors/Editor/FieldBased/Drawers/AlloyFieldDrawers.cs @@ -0,0 +1,189 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +using System.Linq; +using UnityEditor; +using UnityEngine; + +public class AlloyDefaultDrawer : AlloyFieldDrawer +{ + public override void Draw(AlloyFieldDrawerArgs args) { + PropField(DisplayName); + } + + public AlloyDefaultDrawer(AlloyInspectorBase editor, MaterialProperty property) : base(editor, property) { + } +} + +public class AlloyLightmapEmissionDrawer : AlloyFieldDrawer { + public override void Draw(AlloyFieldDrawerArgs args) { + args.Editor.MatEditor.LightmapEmissionProperty(); + + foreach (var material in args.Materials) { + // Setup lightmap emissive flags + MaterialGlobalIlluminationFlags flags = material.globalIlluminationFlags; + if ((flags & (MaterialGlobalIlluminationFlags.BakedEmissive | MaterialGlobalIlluminationFlags.RealtimeEmissive)) != 0) { + flags &= ~MaterialGlobalIlluminationFlags.EmissiveIsBlack; + + + material.globalIlluminationFlags = flags; + } + } + } + + public AlloyLightmapEmissionDrawer(AlloyInspectorBase editor, MaterialProperty property) : base(editor, property) { + } +} + +public class AlloyRenderQueueDrawer : AlloyFieldDrawer { + public override void Draw(AlloyFieldDrawerArgs args) { + args.Editor.MatEditor.RenderQueueField(); + } + + public AlloyRenderQueueDrawer(AlloyInspectorBase editor, MaterialProperty property) : base(editor, property) { + } +} + +public class AlloyEnableInstancingDrawer : AlloyFieldDrawer { + public override void Draw(AlloyFieldDrawerArgs args) { + args.Editor.MatEditor.EnableInstancingField(); + } + + public AlloyEnableInstancingDrawer(AlloyInspectorBase editor, MaterialProperty property) : base(editor, property) { + } +} + +public class AlloyRenderingModeDrawer : AlloyBlendModeDropdownDrawer { + private enum RenderingMode { + Opaque, + Cutout, + Fade, + Transparent + } + + private static readonly BlendModeOptionConfig[] s_renderingModes = { + new BlendModeOptionConfig() { + Type = (int)RenderingMode.Opaque, + OverrideTag = "", + SrcBlend = UnityEngine.Rendering.BlendMode.One, + DstBlend = UnityEngine.Rendering.BlendMode.Zero, + ZWrite = 1, + Keyword = "", + RenderQueue = -1 + }, + new BlendModeOptionConfig() { + Type = (int)RenderingMode.Cutout, + OverrideTag = "TransparentCutout", + SrcBlend = UnityEngine.Rendering.BlendMode.One, + DstBlend = UnityEngine.Rendering.BlendMode.Zero, + ZWrite = 1, + Keyword = "_ALPHATEST_ON", + RenderQueue = (int)UnityEngine.Rendering.RenderQueue.AlphaTest, + }, + new BlendModeOptionConfig() { + Type = (int)RenderingMode.Fade, + OverrideTag = "Transparent", + SrcBlend = UnityEngine.Rendering.BlendMode.SrcAlpha, + DstBlend = UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha, + ZWrite = 0, + Keyword = "_ALPHABLEND_ON", + RenderQueue = (int)UnityEngine.Rendering.RenderQueue.Transparent + }, + new BlendModeOptionConfig() { + Type = (int)RenderingMode.Transparent, + OverrideTag = "Transparent", + SrcBlend = UnityEngine.Rendering.BlendMode.One, + DstBlend = UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha, + ZWrite = 0, + Keyword = "_ALPHAPREMULTIPLY_ON", + RenderQueue = (int)UnityEngine.Rendering.RenderQueue.Transparent + }, + }; + + public AlloyRenderingModeDrawer(AlloyInspectorBase editor, MaterialProperty property) + : base(editor, property, s_renderingModes) { + } +} + +public class AlloySpeedTreeGeometryTypeDrawer : AlloyBlendModeDropdownDrawer { + private enum SpeedTreeGeometryType { + Branch, + BranchDetail, + Frond, + Leaf, + Mesh, + } + + private static readonly BlendModeOptionConfig[] s_geometryTypes = { + new BlendModeOptionConfig() { + Type = (int)SpeedTreeGeometryType.Branch, + OverrideTag = "", + SrcBlend = UnityEngine.Rendering.BlendMode.One, + DstBlend = UnityEngine.Rendering.BlendMode.Zero, + ZWrite = 1, + Keyword = "GEOM_TYPE_BRANCH", + RenderQueue = -1 + }, + new BlendModeOptionConfig() { + Type = (int)SpeedTreeGeometryType.BranchDetail, + OverrideTag = "", + SrcBlend = UnityEngine.Rendering.BlendMode.One, + DstBlend = UnityEngine.Rendering.BlendMode.Zero, + ZWrite = 1, + Keyword = "GEOM_TYPE_BRANCH_DETAIL", + RenderQueue = -1 + }, + new BlendModeOptionConfig() { + Type = (int)SpeedTreeGeometryType.Frond, + OverrideTag = "TransparentCutout", + SrcBlend = UnityEngine.Rendering.BlendMode.One, + DstBlend = UnityEngine.Rendering.BlendMode.Zero, + ZWrite = 1, + Keyword = "GEOM_TYPE_FROND", + RenderQueue = (int)UnityEngine.Rendering.RenderQueue.AlphaTest + }, + new BlendModeOptionConfig() { + Type = (int)SpeedTreeGeometryType.Leaf, + OverrideTag = "TransparentCutout", + SrcBlend = UnityEngine.Rendering.BlendMode.One, + DstBlend = UnityEngine.Rendering.BlendMode.Zero, + ZWrite = 1, + Keyword = "GEOM_TYPE_LEAF", + RenderQueue = (int)UnityEngine.Rendering.RenderQueue.AlphaTest + }, + new BlendModeOptionConfig() { + Type = (int)SpeedTreeGeometryType.Mesh, + OverrideTag = "", + SrcBlend = UnityEngine.Rendering.BlendMode.One, + DstBlend = UnityEngine.Rendering.BlendMode.Zero, + ZWrite = 1, + Keyword = "GEOM_TYPE_MESH", + RenderQueue = -1 + }, + }; + + public AlloySpeedTreeGeometryTypeDrawer(AlloyInspectorBase editor, MaterialProperty property) + : base(editor, property, s_geometryTypes) + { + } +} + +public class AlloyColorParser : AlloyFieldParser{ + protected override AlloyFieldDrawer GenerateDrawer(AlloyInspectorBase editor) { + var ret = new AlloyColorDrawer(editor, MaterialProperty); + return ret; + } + + public AlloyColorParser(MaterialProperty field) : base(field) { + } +} + +public class AlloyColorDrawer : AlloyFieldDrawer { + public override void Draw(AlloyFieldDrawerArgs args) { + PropField(DisplayName); + } + + public AlloyColorDrawer(AlloyInspectorBase editor, MaterialProperty property) : base(editor, property) { + } +} diff --git a/Assets/Alloy/Scripts/MaterialInspectors/Editor/FieldBased/Drawers/AlloyFieldDrawers.cs.meta b/Assets/Alloy/Scripts/MaterialInspectors/Editor/FieldBased/Drawers/AlloyFieldDrawers.cs.meta new file mode 100644 index 0000000..73c7cdf --- /dev/null +++ b/Assets/Alloy/Scripts/MaterialInspectors/Editor/FieldBased/Drawers/AlloyFieldDrawers.cs.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: ce2d4023424d8b24e830bed4c9fb55f5 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: diff --git a/Assets/Alloy/Scripts/MaterialInspectors/Editor/FieldBased/Drawers/AlloyFloatDrawers.cs b/Assets/Alloy/Scripts/MaterialInspectors/Editor/FieldBased/Drawers/AlloyFloatDrawers.cs new file mode 100644 index 0000000..26cb534 --- /dev/null +++ b/Assets/Alloy/Scripts/MaterialInspectors/Editor/FieldBased/Drawers/AlloyFloatDrawers.cs @@ -0,0 +1,511 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +using System; +using System.Text.RegularExpressions; +using UnityEngine; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using UnityEditor; + +public class AlloyDropdownOption { + public string Name; + public string[] HideFields; +} + +public class AlloyFloatParser : AlloyFieldParser { + private readonly Color32 c_defaultSectionColor = new Color32(97, 97, 97, 255); + + protected override AlloyFieldDrawer GenerateDrawer(AlloyInspectorBase editor) { + AlloyFieldDrawer retDrawer = null; + + foreach (var token in Arguments) { + var argName = token.ArgumentName; + var argToken = token.ArgumentToken; + + switch (argName) { + case "Min": + AlloyFloatDrawer minDrawer = null; + var minValToken = argToken as AlloyValueToken; + + if (retDrawer != null) + minDrawer = retDrawer as AlloyFloatDrawer; + + if (minDrawer == null) + minDrawer = new AlloyFloatDrawer(editor, MaterialProperty); + + minDrawer.HasMin = true; + minDrawer.MinValue = minValToken.FloatValue; + retDrawer = minDrawer; + break; + + case "Max": + AlloyFloatDrawer maxDrawer = null; + var maxValToken = argToken as AlloyValueToken; + + if (retDrawer != null) + maxDrawer = retDrawer as AlloyFloatDrawer; + + if (maxDrawer == null) + maxDrawer = new AlloyFloatDrawer(editor, MaterialProperty); + + maxDrawer.HasMax = true; + maxDrawer.MaxValue = maxValToken.FloatValue; + retDrawer = maxDrawer; + break; + + case "Section": + retDrawer = new AlloySectionDrawer(editor, MaterialProperty); + SetSectionOption(retDrawer, argToken); + break; + + case "Feature": + retDrawer = new AlloyFeatureDrawer(editor, MaterialProperty); + SetSectionOption(retDrawer, argToken); + break; + + case "Toggle": + retDrawer = new AlloyToggleDrawer(editor, MaterialProperty); + SetToggleOption(retDrawer, argToken); + break; + + case "SpeedTreeGeometryType": + retDrawer = new AlloySpeedTreeGeometryTypeDrawer(editor, MaterialProperty); + SetDropdownOption(retDrawer, argToken); + break; + + case "RenderingMode": + retDrawer = new AlloyRenderingModeDrawer(editor, MaterialProperty); + SetDropdownOption(retDrawer, argToken); + break; + + case "Dropdown": + retDrawer = new AlloyDropdownDrawer(editor, MaterialProperty); + SetDropdownOption(retDrawer, argToken); + break; + + case "LightmapEmissionProperty": + retDrawer = new AlloyLightmapEmissionDrawer(editor, MaterialProperty); + break; + + case "RenderQueue": + retDrawer = new AlloyRenderQueueDrawer(editor, MaterialProperty); + break; + + case "EnableInstancing": + retDrawer = new AlloyEnableInstancingDrawer(editor, MaterialProperty); + break; + } + } + + if (retDrawer == null) + retDrawer = new AlloyFloatDrawer(editor, MaterialProperty); + + return retDrawer; + } + + private static void SetDropdownOption(AlloyFieldDrawer retDrawer, AlloyToken argToken) { + var drawer = retDrawer as AlloyDropdownDrawer; + + if (drawer == null) { + return; + } + + var options = argToken as AlloyCollectionToken; + + if (options == null) { + return; + } + + var dropOptions = new List(); + + for (int i = 0; i < options.SubTokens.Count; i++) { + AlloyArgumentToken arg = (AlloyArgumentToken)options.SubTokens[i]; + var collection = arg.ArgumentToken as AlloyCollectionToken; + + if (collection == null) { + continue; + } + + + // Split PascalCase name into words separated by spaces while skipping acronyms. + var dropOption = new AlloyDropdownOption { + Name = Regex.Replace(arg.ArgumentName, @"(?<=[A-Za-z])(?=[A-Z][a-z])|(?<=[a-z0-9])(?=[0-9]?[A-Z])", " "), + HideFields = collection.SubTokens.Select(alloyToken => alloyToken.Token).ToArray() + }; + dropOptions.Add(dropOption); + } + + drawer.DropOptions = dropOptions.ToArray(); + } + + private static void SetToggleOption(AlloyFieldDrawer retDrawer, AlloyToken argToken) { + var drawer = retDrawer as AlloyToggleDrawer; + + if (drawer == null) { + return; + } + var collectionToken = argToken as AlloyCollectionToken; + + if (collectionToken == null) { + return; + } + foreach (var token in collectionToken.SubTokens) { + var arg = token as AlloyArgumentToken; + + if (arg != null && arg.ArgumentName == "On") { + var onToken = arg.ArgumentToken as AlloyCollectionToken; + + if (onToken != null) { + drawer.OnHideFields = onToken.SubTokens.Select(colToken => colToken.Token).ToArray(); + } + } + else if (arg != null && arg.ArgumentName == "Off") { + var offToken = arg.ArgumentToken as AlloyCollectionToken; + + if (offToken != null) { + drawer.OffHideFields = offToken.SubTokens.Select(colToken => colToken.Token).ToArray(); + } + } + } + } + + private static void SetMinOption(AlloyFieldDrawer retDrawer, AlloyToken argToken) { + var floatDrawer = retDrawer as AlloyFloatDrawer; + var minValToken = argToken as AlloyValueToken; + + if (floatDrawer != null) { + floatDrawer.HasMin = true; + + if (minValToken != null) { + floatDrawer.MinValue = minValToken.FloatValue; + } + } + } + + void SetSectionOption(AlloyFieldDrawer retDrawer, AlloyToken argToken) { + var sectionDrawer = retDrawer as AlloyTabDrawer; + + if (sectionDrawer != null) { + var collectionToken = argToken as AlloyCollectionToken; + + if (collectionToken == null) { + sectionDrawer.Color = c_defaultSectionColor; + } + else { + foreach (var token in collectionToken.SubTokens) { + var arg = token as AlloyArgumentToken; + + if (arg != null && arg.ArgumentName == "Color") { + var value = arg.ArgumentToken as AlloyValueToken; + + // Calculate color from section index and HSV scale factor. + if (value != null) { + var hueIndex = value.FloatValue; + + if (hueIndex > -0.1f) + sectionDrawer.Color = Color.HSVToRGB((hueIndex / AlloyUtils.SectionColorMax) * 0.6f, 0.75f, 0.5f); + } + else { + // Manually specify color. + var colCollection = arg.ArgumentToken as AlloyCollectionToken; + + if (colCollection != null) { + var r = colCollection.SubTokens[0] as AlloyValueToken; + var g = colCollection.SubTokens[1] as AlloyValueToken; + var b = colCollection.SubTokens[2] as AlloyValueToken; + + if (r != null && g != null && b != null) { + sectionDrawer.Color = new Color32((byte)r.FloatValue, (byte)g.FloatValue, (byte)b.FloatValue, 255); + } + } + } + } + else if (arg != null && arg.ArgumentName == "Hide") { + var featureDrawer = sectionDrawer as AlloyFeatureDrawer; + var offToken = arg.ArgumentToken as AlloyCollectionToken; + + if (offToken != null) { + featureDrawer.HideFields = offToken.SubTokens.Select(colToken => colToken.Token).ToArray(); + } + } + } + } + } + } + + public AlloyFloatParser(MaterialProperty field) + : base(field) { + } +} + + +public abstract class AlloyTabDrawer : AlloyFieldDrawer +{ + public Color Color; + Func> m_foldoutAction; + + protected void SetAllTabsOpenedTo(bool open, AlloyFieldDrawerArgs args) { + foreach (var tab in args.AllTabNames) { + args.TabGroup.SetOpen(tab + args.MatInst, open); + } + } + + public override bool ShouldDraw(AlloyFieldDrawerArgs args) { + return !args.PropertiesSkip.Contains(Property.name); + } + + protected void DrawNow(AlloyFieldDrawerArgs args, bool optional) { + var firstDrawer = Index == 0; + var firstTab = string.IsNullOrEmpty(args.CurrentTab); + + if (firstDrawer) { + GUILayout.Space(-10.0f); + } + else if (firstTab) { + GUILayout.Space(5.0f); + } + else { + if (args.DoDraw) { + GUILayout.Space(8.0f); + } + + EditorGUILayout.EndFadeGroup(); + } + + if (!optional || args.Editor.TabIsEnabled(Property)) { + bool open; + + if (firstTab && !optional) { + bool openAll = args.AllTabNames.All(tab => args.TabGroup.IsOpen(tab + args.MatInst)); + bool closeOpen; + bool all = openAll; + + open = args.TabGroup.TabArea(DisplayName, Color, true, m_foldoutAction(all), out closeOpen, DisplayName + args.MatInst); + + if (closeOpen) { + openAll = !openAll; + SetAllTabsOpenedTo(openAll, args); + } + } + else { + bool removed; + open = args.TabGroup.TabArea(DisplayName, Color, optional, out removed, DisplayName + args.MatInst); + + if (removed) { + args.Editor.DisableTab(DisplayName, Property, args.MatInst); + } + } + + var anim = args.OpenCloseAnim[Property.name]; + anim.target = open; + + args.CurrentTab = Property.name; + args.DoDraw = EditorGUILayout.BeginFadeGroup(anim.faded); + } + else { + args.DoDraw = false; + + args.TabsToAdd.Add(new AlloyTabAdd { Color = Color, Name = DisplayName, Enable = () => args.Editor.EnableTab(DisplayName, Property, args.MatInst) }); + } + } + + protected AlloyTabDrawer(AlloyInspectorBase editor, MaterialProperty property) + : base(editor, property) { + m_foldoutAction = all => r => GUI.Label(r, all ? "v" : ">", EditorStyles.whiteLabel); + } +} + +public class AlloySectionDrawer : AlloyTabDrawer { + public override void Draw(AlloyFieldDrawerArgs args) { + DrawNow(args, false); + } + + public AlloySectionDrawer(AlloyInspectorBase editor, MaterialProperty property) : base(editor, property) { + } +} + +public class AlloyFeatureDrawer : AlloyTabDrawer { + public string[] HideFields; + + public override bool ShouldDraw(AlloyFieldDrawerArgs args) { + return true; + } + + public override void Draw(AlloyFieldDrawerArgs args) { + bool current = Property.floatValue > 0.5f; + + DrawNow(args, true); + + if (!current) { + if (HideFields != null) { + args.PropertiesSkip.AddRange(HideFields); + } + } + } + + public AlloyFeatureDrawer(AlloyInspectorBase editor, MaterialProperty property) : base(editor, property) { + } +} + +public class AlloyFloatDrawer : AlloyFieldDrawer +{ + public bool HasMin; + public float MinValue; + + public bool HasMax; + public float MaxValue; + + int m_selectedIndex; + + public override void Draw(AlloyFieldDrawerArgs args) { + if (HasMin || HasMax) { + if (HasMin && HasMax) { + FloatFieldSlider(DisplayName, MinValue, MaxValue); + } + else if (HasMin) { + FloatFieldMin(DisplayName, MinValue); + } + else { + FloatFieldMax(DisplayName, MaxValue); + } + } + else { + PropField(DisplayName); + } + } + + public AlloyFloatDrawer(AlloyInspectorBase editor, MaterialProperty property) : base(editor, property) { + } +} + +public class AlloyDropdownDrawer : AlloyFieldDrawer { + public AlloyDropdownOption[] DropOptions; + + protected virtual bool OnSetOption(int newOption, AlloyFieldDrawerArgs args) { + return false; + } + + public override void Draw(AlloyFieldDrawerArgs args) { + int current = (int)Property.floatValue; + var label = new GUIContent(DisplayName); + + BeginMaterialProperty(Property); + + int newVal = EditorGUILayout.Popup(label, current, DropOptions.Select(option => new GUIContent(option.Name)).ToArray()); + EditorGUI.showMixedValue = false; + + if (!OnSetOption(newVal, args) && EditorGUI.EndChangeCheck()) { + Property.floatValue = newVal; + MaterialEditor.ApplyMaterialPropertyDrawers(args.Materials); + } + + MatEditor.EndAnimatedCheck(); + args.PropertiesSkip.AddRange(DropOptions[current].HideFields); + } + + public AlloyDropdownDrawer(AlloyInspectorBase editor, MaterialProperty property) : base(editor, property) { + } +} + +public abstract class AlloyBlendModeDropdownDrawer : AlloyDropdownDrawer { + public struct BlendModeOptionConfig { + public int Type; + public string OverrideTag; + public UnityEngine.Rendering.BlendMode SrcBlend; + public UnityEngine.Rendering.BlendMode DstBlend; + public int ZWrite; + public string Keyword; + public int RenderQueue; + } + + protected BlendModeOptionConfig[] BlendModeOptionConfigs = null; + + public AlloyBlendModeDropdownDrawer(AlloyInspectorBase editor, MaterialProperty property, BlendModeOptionConfig[] blendModeOptionConfigs) : base(editor, property) { + BlendModeOptionConfigs = blendModeOptionConfigs; + + // Get default from keyword. + var keywords = editor.Target.shaderKeywords; + property.floatValue = 0.0f; + + foreach (var setting in BlendModeOptionConfigs) { + if (keywords.Contains(setting.Keyword)) { + property.floatValue = setting.Type; + break; + } + } + } + + protected override bool OnSetOption(int newOption, AlloyFieldDrawerArgs args) { + base.OnSetOption(newOption, args); + + foreach (var material in args.Materials) { + if (Property.floatValue != newOption) { + foreach (var setting in BlendModeOptionConfigs) { + var keyword = setting.Keyword; + + if (newOption != setting.Type) { + material.DisableKeyword(keyword); + } + else { + material.SetOverrideTag("RenderType", setting.OverrideTag); + material.SetInt("_SrcBlend", (int)setting.SrcBlend); + material.SetInt("_DstBlend", (int)setting.DstBlend); + material.SetInt("_ZWrite", setting.ZWrite); + material.EnableKeyword(keyword); + material.renderQueue = setting.RenderQueue; + } + } + + material.SetInt(Property.name, newOption); + EditorUtility.SetDirty(material); + } + } + + Undo.RecordObjects(args.Materials, "set " + Property.name); + return true; + } +} + +public class AlloyToggleDrawer : AlloyFieldDrawer { + public string[] OnHideFields; + public string[] OffHideFields; + + public override void Draw(AlloyFieldDrawerArgs args) { + bool current = Property.floatValue > 0.5f; + var label = new GUIContent(DisplayName); + + + //EditorGUI.BeginProperty(new Rect(), label, Serialized); + + EditorGUI.showMixedValue = Property.hasMixedValue; + + EditorGUI.BeginChangeCheck(); + current = EditorGUILayout.Toggle(label, current); + + if (EditorGUI.EndChangeCheck()) { + Property.floatValue = current ? 1.0f : 0.0f; + MaterialEditor.ApplyMaterialPropertyDrawers(args.Materials); + } + + //EditorGUI.EndProperty(); + + EditorGUI.showMixedValue = false; + + + if (!current) { + if (OffHideFields != null) { + args.PropertiesSkip.AddRange(OffHideFields); + } + } else { + if (OnHideFields != null) { + args.PropertiesSkip.AddRange(OnHideFields); + } + } + } + + public AlloyToggleDrawer(AlloyInspectorBase editor, MaterialProperty property) : base(editor, property) { + } +} \ No newline at end of file diff --git a/Assets/Alloy/Scripts/MaterialInspectors/Editor/FieldBased/Drawers/AlloyFloatDrawers.cs.meta b/Assets/Alloy/Scripts/MaterialInspectors/Editor/FieldBased/Drawers/AlloyFloatDrawers.cs.meta new file mode 100644 index 0000000..c3815fa --- /dev/null +++ b/Assets/Alloy/Scripts/MaterialInspectors/Editor/FieldBased/Drawers/AlloyFloatDrawers.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 70c021998d433f440868615e1d5d09e2 +timeCreated: 1430261565 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Scripts/MaterialInspectors/Editor/FieldBased/Drawers/AlloyTextureDrawer.cs b/Assets/Alloy/Scripts/MaterialInspectors/Editor/FieldBased/Drawers/AlloyTextureDrawer.cs new file mode 100644 index 0000000..7123827 --- /dev/null +++ b/Assets/Alloy/Scripts/MaterialInspectors/Editor/FieldBased/Drawers/AlloyTextureDrawer.cs @@ -0,0 +1,400 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +using Alloy; +using UnityEditor; +using UnityEditor.AnimatedValues; +using UnityEngine; + +public class AlloyTextureFieldDrawer : AlloyFieldDrawer { + public enum TextureVisualizeMode { + None, + RGB, + R, + G, + B, + A, + NRM + } + + public string ParentTexture { + get { return m_parentTexture; } + set { + m_parentTexture = value; + m_hasParentTexture = !string.IsNullOrEmpty(value); + } + } + + public TextureVisualizeMode[] DisplayModes; + public bool Controls = true; + + protected int TexInst; + + string m_parentTexture = string.Empty; + bool m_hasParentTexture; + + protected AlloyTabGroup TabGroup; + + AnimBool m_tabOpen = new AnimBool(false); + bool m_firstDraw = true; + int m_vizIndex; + + Material m_visualizeMat; + Renderer m_oldSelect; + + static GUIContent[] s_uvModes = {new GUIContent("UV0"), new GUIContent("UV1")}; + static GUILayoutOption[] s_texLayout = new GUILayoutOption[2]; + + Material VisualizeMaterial { + get { + if (m_visualizeMat == null) { + m_visualizeMat = new Material(Shader.Find("Hidden/Alloy Visualize")) {hideFlags = HideFlags.HideAndDontSave}; + } + + return m_visualizeMat; + } + } + + protected virtual string TextureProp { get { return "m_Texture"; } } + + TextureVisualizeMode Mode { + get { return m_vizIndex == 0 ? TextureVisualizeMode.None : DisplayModes[m_vizIndex - 1]; } + } + + protected string SaveName { get { return Property.name + TexInst; } } + protected bool IsOpen { get { return TabGroup.IsOpen(SaveName); } } + + //Passed in by the base editor + public AlloyTextureFieldDrawer(AlloyInspectorBase editor, MaterialProperty property) + : base(editor, property) { + TabGroup = AlloyTabGroup.GetTabGroup(); + + m_tabOpen.value = TabGroup.IsOpen(SaveName); + m_tabOpen.speed = 4.0f; + } + + + void AdvanceMode() { + m_vizIndex = (m_vizIndex + 1) % (DisplayModes.Length + 1); + } + + string GetVisualizeButtonText() { + return Mode == TextureVisualizeMode.None ? "Visualize" : Mode.ToString(); + } + + void TextureField(float size, MaterialProperty prop, AlloyFieldDrawerArgs args) { + var rawRef = prop.textureValue; + + if (rawRef == null + && !prop.hasMixedValue + && (!IsOpen || m_hasParentTexture)) { + + s_texLayout[0] = GUILayout.Width(100.0f); + s_texLayout[1] = GUILayout.Height(16.0f); + } + else { + s_texLayout[0] = GUILayout.Width(size - 20.0f); + s_texLayout[1] = GUILayout.Height((size - 20.0f) * 0.9f); + } + + BeginMaterialProperty(Property); + + var tex = EditorGUILayout.ObjectField(rawRef, typeof(Texture), false, s_texLayout) as Texture; + + if (EndMaterialProperty()) { + prop.textureValue = tex; + } + } + + bool DrawWarningString(MaterialProperty texture) { + //normal map warning + if (DisplayModes == null) { + return false; + } + + if (ArrayUtility.Contains(DisplayModes, TextureVisualizeMode.NRM)) { + if (texture.hasMixedValue || texture.textureValue == null) { + return false; + } + + string path = AssetDatabase.GetAssetPath(texture.textureValue); + + if (!string.IsNullOrEmpty(path)) { + var imp = AssetImporter.GetAtPath(path); + var importer = imp as TextureImporter; + + // If the texture isn't a Normal Map, offer to convert it. + if (importer != null && importer.textureType != TextureImporterType.NormalMap) { + GUILayout.BeginHorizontal(); + EditorGUILayout.HelpBox("Texture not marked as normal map", MessageType.Warning, true); + + var rect = GUILayoutUtility.GetLastRect(); + + rect.xMin += rect.width / 2; + + GUILayout.BeginVertical(); + + GUILayout.Space(14.0f); + + if (GUILayout.Button("Fix now", EditorStyles.toolbarButton, GUILayout.Width(60.0f))) { + importer.textureType = TextureImporterType.NormalMap; + AssetDatabase.ImportAsset(path); + } + + GUILayout.EndVertical(); + + GUILayout.EndHorizontal(); + + return true; + } + } + } + + return false; + } + + void DrawVisualizeButton() { + if (DisplayModes != null && DisplayModes.Length > 0 + && Selection.activeGameObject && Selection.objects.Length == 1) { + if (GUILayout.Button(GetVisualizeButtonText(), EditorStyles.toolbarButton, GUILayout.Width(70.0f))) { + AdvanceMode(); + EditorApplication.delayCall += SceneView.RepaintAll; + } + } + } + + public override void OnDisable() { + if (Mode != TextureVisualizeMode.None) { + if (m_oldSelect != null) { + EditorUtility.SetSelectedRenderState(m_oldSelect, EditorSelectedRenderState.Highlight); + } + + m_vizIndex = 0; + } + } + + public override void OnSceneGUI(Material[] materials) { + if (materials.Length > 1) { + return; + } + + var material = materials[0]; + + if (Mode == TextureVisualizeMode.None || Selection.activeGameObject == null || Selection.objects.Length != 1) { + if (m_oldSelect != null) { + EditorUtility.SetSelectedRenderState(m_oldSelect, EditorSelectedRenderState.Highlight); + } + + return; + } + + var curTex = Property.textureValue; + + if (Mode == TextureVisualizeMode.None) { + return; + } + + var trans = Property.textureScaleAndOffset; + + var uvMode = 0.0f; + var uvName = !m_hasParentTexture ? Property.name + "UV" : m_parentTexture + "UV"; + + if (material.HasProperty(uvName)) { + uvMode = material.GetFloat(uvName); + } + + VisualizeMaterial.SetTexture("_MainTex", curTex); + VisualizeMaterial.SetFloat("_Mode", (int) Mode); + VisualizeMaterial.SetVector("_Trans", trans); + VisualizeMaterial.SetFloat("_UV", uvMode); + + var target = Selection.activeGameObject.GetComponent(); + + if (target != m_oldSelect && m_oldSelect != null) { + EditorApplication.delayCall += SceneView.RepaintAll; + EditorUtility.SetSelectedRenderState(target, EditorSelectedRenderState.Highlight); + return; + } + + m_oldSelect = target; + + Mesh mesh = null; + var meshFilter = target.GetComponent(); + var meshRenderer = target.GetComponent(); + + if (meshFilter != null && meshRenderer != null) { + mesh = meshFilter.sharedMesh; + } + + if (mesh == null) { + var skinnedMeshRenderer = target.GetComponent(); + + if (skinnedMeshRenderer != null) { + mesh = skinnedMeshRenderer.sharedMesh; + } + } + + if (mesh != null) { + EditorUtility.SetSelectedRenderState(target, EditorSelectedRenderState.Hidden); + Graphics.DrawMesh(mesh, target.localToWorldMatrix, VisualizeMaterial, 0, SceneView.currentDrawingSceneView.camera, + TexInst); + SceneView.currentDrawingSceneView.Repaint(); + } + else { + Debug.LogError("Game object does not have a mesh source."); + } + } + + public override void Draw(AlloyFieldDrawerArgs args) { + TexInst = args.MatInst; + + if (m_firstDraw) { + OnFirstDraw(); + m_firstDraw = false; + } + + var curTex = Property.textureValue; + GUILayout.Space(9.0f); + GUILayout.BeginHorizontal(); + EditorGUILayout.BeginVertical(); + + float oldWidth = EditorGUIUtility.labelWidth; + EditorGUIUtility.labelWidth = 80.0f; + + bool drewOpen = false; + + if (m_hasParentTexture || !Controls) { + GUILayout.Label(DisplayName); + } + else { + bool isOpen = TabGroup.Foldout(DisplayName, SaveName, GUILayout.Width(10.0f)); + m_tabOpen.target = isOpen; + + if (EditorGUILayout.BeginFadeGroup(m_tabOpen.faded)) { + drewOpen = true; + DrawTextureControls(args); + } + + EditorGUILayout.EndFadeGroup(); + } + + if ((EditorGUILayout.BeginFadeGroup(1.0f - m_tabOpen.faded) + || !Controls) + && curTex != null + && !Property.hasMixedValue) { + + if (!DrawWarningString(Property)) { + var oldCol = GUI.color; + GUI.color = EditorGUIUtility.isProSkin ? Color.gray : new Color(0.3f, 0.3f, 0.3f); + + string name = curTex.name; + if (name.Length > 17) { + name = name.Substring(0, 14) + ".."; + } + GUILayout.Label(name + " (" + curTex.width + "x" + curTex.height + ")", EditorStyles.whiteLabel); + GUI.color = oldCol; + } + } + + EditorGUILayout.EndFadeGroup(); + + if (curTex != null + && (!m_hasParentTexture || Controls) + && !Property.hasMixedValue) { + DrawVisualizeButton(); + } + + if (drewOpen) { + EditorGUILayout.EndVertical(); + TextureField(Mathf.Lerp(74.0f, 100.0f, m_tabOpen.faded), Property, args); + } + else { + GUILayout.EndVertical(); + + GUILayout.FlexibleSpace(); + TextureField(74.0f, Property, args); + } + + EditorGUIUtility.labelWidth = oldWidth; + GUILayout.EndHorizontal(); + + if (IsOpen) { + GUILayout.Space(10.0f); + } + + + if (m_tabOpen.isAnimating) { + args.Editor.MatEditor.Repaint(); + } + } + + protected void DrawTextureControls(AlloyFieldDrawerArgs args) { + + string velName = Property.name + "Velocity"; + var scrollProp = args.GetMaterialProperty(velName); + + string spinName = Property.name + "Spin"; + var spinProp = args.GetMaterialProperty(spinName); + + string uvName = Property.name + "UV"; + var uvProp = args.GetMaterialProperty(uvName); + + + BeginMaterialProperty(Property); + var trans = Property.textureScaleAndOffset; + + Vector2 tileVal = EditorGUILayout.Vector2Field("Tiling", new Vector2(trans.x, trans.y)); + Vector2 offsetVal = EditorGUILayout.Vector2Field("Offset", new Vector2(trans.z, trans.w)); + + trans.x = tileVal.x; + trans.y = tileVal.y; + trans.z = offsetVal.x; + trans.w = offsetVal.y; + + + if (scrollProp != null) { + BeginMaterialProperty(scrollProp); + Vector2 curScroll = EditorGUILayout.Vector2Field("Scroll", scrollProp.vectorValue); + + if (EndMaterialProperty()) { + scrollProp.vectorValue = curScroll; + } + } + + float old = EditorGUIUtility.labelWidth; + EditorGUIUtility.labelWidth = 75.0f; + + if (spinProp != null) { + BeginMaterialProperty(spinProp); + + float spin = spinProp.floatValue * Mathf.Rad2Deg; + spin = EditorGUILayout.FloatField(new GUIContent("Spin"), spin, GUILayout.Width(180.0f)); + + if (EndMaterialProperty()) { + spinProp.floatValue = spin * Mathf.Deg2Rad; + } + } + + if (uvProp != null) { + BeginMaterialProperty(uvProp); + + float newVal = EditorGUILayout.Popup(new GUIContent("UV Set"), (int) uvProp.floatValue, s_uvModes, + GUILayout.Width(180.0f)); + + if (EndMaterialProperty()) { + uvProp.floatValue = newVal; + } + } + + EditorGUIUtility.labelWidth = old; + + if (EndMaterialProperty()) { + Property.textureScaleAndOffset = trans; + } + } + + void OnFirstDraw() { + m_tabOpen.value = IsOpen; + } +} \ No newline at end of file diff --git a/Assets/Alloy/Scripts/MaterialInspectors/Editor/FieldBased/Drawers/AlloyTextureDrawer.cs.meta b/Assets/Alloy/Scripts/MaterialInspectors/Editor/FieldBased/Drawers/AlloyTextureDrawer.cs.meta new file mode 100644 index 0000000..cb80dc2 --- /dev/null +++ b/Assets/Alloy/Scripts/MaterialInspectors/Editor/FieldBased/Drawers/AlloyTextureDrawer.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 26f92e852a911224cbd5f29a496d6698 +timeCreated: 1430261489 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Scripts/MaterialInspectors/Editor/FieldBased/Drawers/AlloyTextureParser.cs b/Assets/Alloy/Scripts/MaterialInspectors/Editor/FieldBased/Drawers/AlloyTextureParser.cs new file mode 100644 index 0000000..9cc23cd --- /dev/null +++ b/Assets/Alloy/Scripts/MaterialInspectors/Editor/FieldBased/Drawers/AlloyTextureParser.cs @@ -0,0 +1,67 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +using System; +using System.Linq; +using UnityEditor; + +public class AlloyTextureParser : AlloyFieldParser +{ + protected override AlloyFieldDrawer GenerateDrawer(AlloyInspectorBase editor) { + var ret = new AlloyTextureFieldDrawer(editor, MaterialProperty); + + foreach (var token in Arguments) { + var argName = token.ArgumentName; + var argToken = token.ArgumentToken; + + switch (argName) { + case "Visualize": { + var container = argToken as AlloyCollectionToken; + if (container != null) { + ret.DisplayModes = container.SubTokens.Select(t => (AlloyTextureFieldDrawer.TextureVisualizeMode)Enum.Parse(typeof(AlloyTextureFieldDrawer.TextureVisualizeMode), t.Token)).ToArray(); + } + } + + break; + + case "Parent": { + ret.ParentTexture = argToken.Token; + } + + break; + + case "Controls": + var valueToken = argToken as AlloyValueToken; + if (valueToken != null) { + ret.Controls = valueToken.BoolValue; + } + break; + + // case "Keyword": + // ret.Keyword = argToken.Token; + // break; + } + } + + return ret; + } + + public AlloyTextureParser(MaterialProperty field) + : base(field) { + } +} + + + +public class AlloyCubeParser : AlloyFieldParser +{ + public AlloyCubeParser(MaterialProperty field) + : base(field) { + + } + + protected override AlloyFieldDrawer GenerateDrawer(AlloyInspectorBase editor) { + return new AlloyDefaultDrawer(editor, MaterialProperty); + } +} \ No newline at end of file diff --git a/Assets/Alloy/Scripts/MaterialInspectors/Editor/FieldBased/Drawers/AlloyTextureParser.cs.meta b/Assets/Alloy/Scripts/MaterialInspectors/Editor/FieldBased/Drawers/AlloyTextureParser.cs.meta new file mode 100644 index 0000000..06177a5 --- /dev/null +++ b/Assets/Alloy/Scripts/MaterialInspectors/Editor/FieldBased/Drawers/AlloyTextureParser.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 5767db00543c76746b04f3bf27442325 +timeCreated: 1430261463 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Scripts/MaterialInspectors/Editor/FieldBased/Drawers/AlloyVectorDrawers.cs b/Assets/Alloy/Scripts/MaterialInspectors/Editor/FieldBased/Drawers/AlloyVectorDrawers.cs new file mode 100644 index 0000000..524ee23 --- /dev/null +++ b/Assets/Alloy/Scripts/MaterialInspectors/Editor/FieldBased/Drawers/AlloyVectorDrawers.cs @@ -0,0 +1,184 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +using Alloy; +using UnityEditor; +using UnityEditor.AnimatedValues; +using UnityEngine; +using UnityEngine.UI; + +public class AlloyVectorParser : AlloyFieldParser { + protected override AlloyFieldDrawer GenerateDrawer(AlloyInspectorBase editor) { + AlloyFieldDrawer ret = null; + + for (int i = 0; i < Arguments.Length; i++) { + var argument = Arguments[i]; + var valProp = argument.ArgumentToken as AlloyValueToken; + + switch (argument.ArgumentName) { + case "Vector": + + if (valProp != null) { + ret = SetupVectorDrawer(editor, valProp, ret); + } + break; + } + } + + if (ret == null) { + ret = new AlloyVectorDrawer(editor, MaterialProperty); + ((AlloyVectorDrawer) ret).Mode = AlloyVectorDrawer.VectorMode.Vector4; + } + + + return ret; + } + + AlloyFieldDrawer SetupVectorDrawer(AlloyInspectorBase editor, + AlloyValueToken valProp, + AlloyFieldDrawer ret) { + if (valProp.ValueType == AlloyValueToken.ValueTypeEnum.String) { + switch (valProp.StringValue) { + case "Euler": + ret = new AlloyVectorDrawer(editor, MaterialProperty); + ((AlloyVectorDrawer) ret).Mode = AlloyVectorDrawer.VectorMode.Euler; + break; + + case "TexCoord": + ret = new AlloyTexCoordDrawer(editor, MaterialProperty); + break; + + case "Channels": + ret = new AlloyMaskDrawer(editor, MaterialProperty); + break; + + default: + Debug.LogError("Non supported vector property!"); + break; + } + } + else if (valProp.ValueType == AlloyValueToken.ValueTypeEnum.Float) { + switch ((int) valProp.FloatValue) { + case 2: + ret = new AlloyVectorDrawer(editor, MaterialProperty); + ((AlloyVectorDrawer) ret).Mode = AlloyVectorDrawer.VectorMode.Vector2; + break; + + case 3: + ret = new AlloyVectorDrawer(editor, MaterialProperty); + ((AlloyVectorDrawer) ret).Mode = AlloyVectorDrawer.VectorMode.Vector3; + break; + + case 4: + ret = new AlloyVectorDrawer(editor, MaterialProperty); + ((AlloyVectorDrawer) ret).Mode = AlloyVectorDrawer.VectorMode.Vector4; + break; + + default: + Debug.LogError("Non supported vector property!"); + break; + } + } + return ret; + } + + public AlloyVectorParser(MaterialProperty field) + : base(field) { + } +} + +public class AlloyVectorDrawer : AlloyFieldDrawer { + public enum VectorMode { + Vector2, + Vector3, + Vector4, + Euler + } + + public VectorMode Mode = VectorMode.Vector4; + + public override void Draw(AlloyFieldDrawerArgs args) { + Vector4 newVal = Vector4.zero; + var label = new GUIContent(DisplayName); + + BeginMaterialProperty(Property); + + switch (Mode) { + case VectorMode.Vector4: + newVal = EditorGUILayout.Vector4Field(label.text, Property.vectorValue); + break; + + case VectorMode.Vector3: + newVal = EditorGUILayout.Vector3Field(label.text, Property.vectorValue); + break; + + case VectorMode.Vector2: + newVal = EditorGUILayout.Vector2Field(label.text, Property.vectorValue); + break; + + case VectorMode.Euler: + var value = args.GetMaterialProperty(Property.name + "EulerUI").vectorValue; + //var value = (Vector4)args.Editor.GetProperty(MaterialProperty.PropType.Vector, Property.name + "EulerUI").colorValue; + newVal = Quaternion.Euler(value) * Vector3.up; + GUI.changed = true; + break; + } + + if (EndMaterialProperty()) { + Property.vectorValue = newVal; + } + } + + public AlloyVectorDrawer(AlloyInspectorBase editor, MaterialProperty property) : base(editor, property) { + } +} + +public class AlloyTexCoordDrawer : AlloyTextureFieldDrawer { + AnimBool m_tabOpen = new AnimBool(false); + + public AlloyTexCoordDrawer(AlloyInspectorBase editor, MaterialProperty property) : base(editor, property) { + } + + public override void Draw(AlloyFieldDrawerArgs args) { + TexInst = args.MatInst; + + bool isOpen = TabGroup.Foldout(DisplayName, SaveName, GUILayout.Width(10.0f)); + m_tabOpen.target = isOpen; + + if (m_tabOpen.value) { + EditorGUILayout.BeginFadeGroup(m_tabOpen.faded); + DrawTextureControls(args); + EditorGUILayout.EndFadeGroup(); + } + + if (m_tabOpen.isAnimating) { + args.Editor.MatEditor.Repaint(); + } + } +} + +public class AlloyMaskDrawer : AlloyFieldDrawer { + public AlloyMaskDrawer(AlloyInspectorBase editor, MaterialProperty property) : base(editor, property) { + } + + public override void Draw(AlloyFieldDrawerArgs args) { + Vector4 newVal = Property.vectorValue; + var label = new GUIContent(DisplayName); + + BeginMaterialProperty(Property); + + GUILayout.BeginHorizontal(); + GUILayout.Label(label); + + newVal.x = GUILayout.Toggle(newVal.x > 0.5f, "R", EditorStyles.toolbarButton) ? 1.0f : 0.0f; + newVal.y = GUILayout.Toggle(newVal.y > 0.5f, "G", EditorStyles.toolbarButton) ? 1.0f : 0.0f; + newVal.z = GUILayout.Toggle(newVal.z > 0.5f, "B", EditorStyles.toolbarButton) ? 1.0f : 0.0f; + newVal.w = GUILayout.Toggle(newVal.w > 0.5f, "A", EditorStyles.toolbarButton) ? 1.0f : 0.0f; + GUILayout.EndHorizontal(); + + if (EndMaterialProperty()) { + Property.vectorValue = newVal; + } + } +} \ No newline at end of file diff --git a/Assets/Alloy/Scripts/MaterialInspectors/Editor/FieldBased/Drawers/AlloyVectorDrawers.cs.meta b/Assets/Alloy/Scripts/MaterialInspectors/Editor/FieldBased/Drawers/AlloyVectorDrawers.cs.meta new file mode 100644 index 0000000..e562004 --- /dev/null +++ b/Assets/Alloy/Scripts/MaterialInspectors/Editor/FieldBased/Drawers/AlloyVectorDrawers.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 6c2ebab9324a76547a9d5df7b45cd747 +timeCreated: 1430261728 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Scripts/MaterialInspectors/Shaders.meta b/Assets/Alloy/Scripts/MaterialInspectors/Shaders.meta new file mode 100644 index 0000000..5ab002a --- /dev/null +++ b/Assets/Alloy/Scripts/MaterialInspectors/Shaders.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 6e87a104f11c6ab4295a1bec1f86e81c +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/Alloy/Scripts/MaterialInspectors/Shaders/AlloyVisualize.shader b/Assets/Alloy/Scripts/MaterialInspectors/Shaders/AlloyVisualize.shader new file mode 100644 index 0000000..a52e30b --- /dev/null +++ b/Assets/Alloy/Scripts/MaterialInspectors/Shaders/AlloyVisualize.shader @@ -0,0 +1,77 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Hidden/Alloy Visualize" { +Properties { + _MainTex ("Base (RGB)", 2D) = "white" {} + _Mode("Mode", Float) = 0 + _Trans("Trans", Vector) = (0, 0, 0, 0) + _UV("UV", Float) = 0 +} +SubShader { + Offset 0,-10 + + Pass { + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + #include "UnityCG.cginc" + #pragma target 3.0 + + struct v2f { + float4 pos : SV_POSITION; + float2 uv_MainTex : TEXCOORD0; + }; + + float4 _MainTex_ST; + float _Mode; + float _UV; + + v2f vert(appdata_full v) { + v2f o; + + o.pos = UnityObjectToClipPos(v.vertex.xyz); + float4 posWorld = mul(unity_ObjectToWorld, v.vertex); + + //o.pos.w += 1e-5; + + o.uv_MainTex = _UV == 0.0f ? v.texcoord.xy : v.texcoord1.xy; + return o; + } + + sampler2D _MainTex; + float4 _Trans; + + float4 frag(v2f IN) : SV_Target { + float4 c = tex2D (_MainTex, IN.uv_MainTex * _Trans.xy + _Trans.zw).rgba; + float eps = 0.001f; + + if (_Mode <= eps){ + c.rgb = 0.0f; + } + else if (_Mode <= 1 + eps) { + c.rgb = c.rgb; // Assumes automatic sRGB + } + else if (_Mode <= 2 + eps){ + c.rgb = pow(c.rrr, 2.2f); + } + else if (_Mode <= 3 + eps){ + c.rgb = pow(c.ggg, 2.2f); + } + else if (_Mode <= 4 + eps){ + c.rgb = pow(c.bbb, 2.2f); + } + else if (_Mode <= 5 + eps){ + c.rgb = pow(c.aaa, 2.2f); + } + else if (_Mode <= 6 + eps){ + c.rgb = pow(UnpackNormal(c) * 0.5f + 0.5f, 2.2f); + } + + return c; + } + ENDCG + } +} +} \ No newline at end of file diff --git a/Assets/Alloy/Scripts/MaterialInspectors/Shaders/AlloyVisualize.shader.meta b/Assets/Alloy/Scripts/MaterialInspectors/Shaders/AlloyVisualize.shader.meta new file mode 100644 index 0000000..e1d0aa4 --- /dev/null +++ b/Assets/Alloy/Scripts/MaterialInspectors/Shaders/AlloyVisualize.shader.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 5bca5ef19340cc044b0acb00214f111b +ShaderImporter: + defaultTextures: [] + userData: diff --git a/Assets/Alloy/Scripts/MaterialMapChannelPacker.meta b/Assets/Alloy/Scripts/MaterialMapChannelPacker.meta new file mode 100644 index 0000000..0869c13 --- /dev/null +++ b/Assets/Alloy/Scripts/MaterialMapChannelPacker.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 2c93dc09429ea9e4fa76bf67d52294fc +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/Alloy/Scripts/MaterialMapChannelPacker/Config.meta b/Assets/Alloy/Scripts/MaterialMapChannelPacker/Config.meta new file mode 100644 index 0000000..3c8de6d --- /dev/null +++ b/Assets/Alloy/Scripts/MaterialMapChannelPacker/Config.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: a69ac5a688c6fbb428b61b55448c7392 +folderAsset: yes +timeCreated: 1467548303 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Scripts/MaterialMapChannelPacker/Config/AlphaPack.asset b/Assets/Alloy/Scripts/MaterialMapChannelPacker/Config/AlphaPack.asset new file mode 100644 index 0000000..bc7fb7f --- /dev/null +++ b/Assets/Alloy/Scripts/MaterialMapChannelPacker/Config/AlphaPack.asset @@ -0,0 +1,41 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f11657fe81562504cb1b05d4e700d54d, type: 3} + m_Name: AlphaPack + m_EditorClassIdentifier: + Title: Alpha + Suffix: _AlloyAM + VarianceBias: 1 + ImportSettings: + IsLinear: 0 + Filter: 2 + DefaultCompressed: 1 + Channels: + - Title: Color + HelpText: + BackgroundColor: {r: 0, g: .583999991, b: .0520000011, a: 1} + CanInvert: 0 + InputChannels: 7 + OutputChannels: 7 + RoughnessCorrect: 0 + OutputVariance: 0 + HideChannel: 0 + DefaultMode: 4 + - Title: Alpha + HelpText: + BackgroundColor: {r: 0, g: 0, b: 0, a: 1} + CanInvert: 1 + InputChannels: 2 + OutputChannels: 8 + RoughnessCorrect: 0 + OutputVariance: 0 + HideChannel: 0 + DefaultMode: 4 diff --git a/Assets/Alloy/Scripts/MaterialMapChannelPacker/Config/AlphaPack.asset.meta b/Assets/Alloy/Scripts/MaterialMapChannelPacker/Config/AlphaPack.asset.meta new file mode 100644 index 0000000..33d8f81 --- /dev/null +++ b/Assets/Alloy/Scripts/MaterialMapChannelPacker/Config/AlphaPack.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5d1947582bfff244299d3af2cb6ab782 +timeCreated: 1439420452 +licenseType: Pro +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Scripts/MaterialMapChannelPacker/Config/MasksPack.asset b/Assets/Alloy/Scripts/MaterialMapChannelPacker/Config/MasksPack.asset new file mode 100644 index 0000000..4e97954 --- /dev/null +++ b/Assets/Alloy/Scripts/MaterialMapChannelPacker/Config/MasksPack.asset @@ -0,0 +1,65 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f11657fe81562504cb1b05d4e700d54d, type: 3} + m_Name: MasksPack + m_EditorClassIdentifier: + Title: Masks + Suffix: _AlloyMM + VarianceBias: 1 + ImportSettings: + IsLinear: 1 + Filter: 2 + DefaultCompressed: 1 + Channels: + - Title: Red + HelpText: + BackgroundColor: {r: 0.5882353, g: 0, b: 0, a: 1} + CanInvert: 1 + InvertByDefault: 0 + InputChannels: 2 + OutputChannels: 1 + RoughnessCorrect: 0 + OutputVariance: 0 + HideChannel: 0 + DefaultMode: 4 + - Title: Green + HelpText: + BackgroundColor: {r: 0, g: 0.584, b: 0.052, a: 1} + CanInvert: 1 + InvertByDefault: 0 + InputChannels: 2 + OutputChannels: 2 + RoughnessCorrect: 0 + OutputVariance: 0 + HideChannel: 0 + DefaultMode: 4 + - Title: Blue + HelpText: + BackgroundColor: {r: 0.043137256, g: 0, b: 0.5803922, a: 1} + CanInvert: 1 + InvertByDefault: 0 + InputChannels: 2 + OutputChannels: 4 + RoughnessCorrect: 0 + OutputVariance: 0 + HideChannel: 0 + DefaultMode: 4 + - Title: Alpha + HelpText: + BackgroundColor: {r: 0, g: 0, b: 0, a: 1} + CanInvert: 1 + InvertByDefault: 0 + InputChannels: 2 + OutputChannels: 8 + RoughnessCorrect: 0 + OutputVariance: 0 + HideChannel: 0 + DefaultMode: 4 diff --git a/Assets/Alloy/Scripts/MaterialMapChannelPacker/Config/MasksPack.asset.meta b/Assets/Alloy/Scripts/MaterialMapChannelPacker/Config/MasksPack.asset.meta new file mode 100644 index 0000000..2d50602 --- /dev/null +++ b/Assets/Alloy/Scripts/MaterialMapChannelPacker/Config/MasksPack.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f0d4fc30aba4a084ba51be9301faf8a9 +timeCreated: 1439420318 +licenseType: Pro +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Scripts/MaterialMapChannelPacker/Config/PackedPack.asset b/Assets/Alloy/Scripts/MaterialMapChannelPacker/Config/PackedPack.asset new file mode 100644 index 0000000..da05b54 --- /dev/null +++ b/Assets/Alloy/Scripts/MaterialMapChannelPacker/Config/PackedPack.asset @@ -0,0 +1,61 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f11657fe81562504cb1b05d4e700d54d, type: 3} + m_Name: PackedPack + m_EditorClassIdentifier: + Title: Packed + Suffix: _AlloyPM + VarianceBias: 1 + ImportSettings: + IsLinear: 1 + Filter: 2 + DefaultCompressed: 1 + Channels: + - Title: Metallic + HelpText: Black = Non-metal, White = Metal + BackgroundColor: {r: .588235319, g: 0, b: 0, a: 1} + CanInvert: 1 + InputChannels: 2 + OutputChannels: 1 + RoughnessCorrect: 0 + OutputVariance: 0 + HideChannel: 0 + DefaultMode: 4 + - Title: Occlusion + HelpText: Black = Occluded, White = Unoccluded + BackgroundColor: {r: 0, g: .583999991, b: .0520000011, a: 1} + CanInvert: 1 + InputChannels: 2 + OutputChannels: 2 + RoughnessCorrect: 0 + OutputVariance: 0 + HideChannel: 0 + DefaultMode: 4 + - Title: Specularity + HelpText: Black = Air, Gray = Paint, White = Gems + BackgroundColor: {r: .0431372561, g: 0, b: .580392182, a: 1} + CanInvert: 1 + InputChannels: 2 + OutputChannels: 4 + RoughnessCorrect: 0 + OutputVariance: 0 + HideChannel: 0 + DefaultMode: 1 + - Title: Roughness + HelpText: Black = Smooth, White = Rough + BackgroundColor: {r: 0, g: 0, b: 0, a: 1} + CanInvert: 1 + InputChannels: 2 + OutputChannels: 8 + RoughnessCorrect: 1 + OutputVariance: 0 + HideChannel: 0 + DefaultMode: 4 diff --git a/Assets/Alloy/Scripts/MaterialMapChannelPacker/Config/PackedPack.asset.meta b/Assets/Alloy/Scripts/MaterialMapChannelPacker/Config/PackedPack.asset.meta new file mode 100644 index 0000000..2a21169 --- /dev/null +++ b/Assets/Alloy/Scripts/MaterialMapChannelPacker/Config/PackedPack.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 1d42740116df09f4f9c9e144a4b9885f +timeCreated: 1439419411 +licenseType: Pro +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Scripts/MaterialMapChannelPacker/Config/TerrainPack.asset b/Assets/Alloy/Scripts/MaterialMapChannelPacker/Config/TerrainPack.asset new file mode 100644 index 0000000..e930e7c --- /dev/null +++ b/Assets/Alloy/Scripts/MaterialMapChannelPacker/Config/TerrainPack.asset @@ -0,0 +1,41 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f11657fe81562504cb1b05d4e700d54d, type: 3} + m_Name: TerrainPack + m_EditorClassIdentifier: + Title: Terrain + Suffix: _AlloyTM + VarianceBias: 1 + ImportSettings: + IsLinear: 0 + Filter: 2 + DefaultCompressed: 1 + Channels: + - Title: Color + HelpText: Base color for terrain. + BackgroundColor: {r: 0, g: 0.584, b: 0.052, a: 1} + CanInvert: 0 + InputChannels: 7 + OutputChannels: 7 + RoughnessCorrect: 0 + OutputVariance: 0 + HideChannel: 0 + DefaultMode: 4 + - Title: Roughness + HelpText: Black = Smooth, White = Rough + BackgroundColor: {r: 0, g: 0, b: 0, a: 1} + CanInvert: 1 + InputChannels: 2 + OutputChannels: 8 + RoughnessCorrect: 1 + OutputVariance: 0 + HideChannel: 0 + DefaultMode: 4 diff --git a/Assets/Alloy/Scripts/MaterialMapChannelPacker/Config/TerrainPack.asset.meta b/Assets/Alloy/Scripts/MaterialMapChannelPacker/Config/TerrainPack.asset.meta new file mode 100644 index 0000000..290063c --- /dev/null +++ b/Assets/Alloy/Scripts/MaterialMapChannelPacker/Config/TerrainPack.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 2bf47aefc6b2d2b4fa519cb677bb4346 +timeCreated: 1439420067 +licenseType: Pro +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Scripts/MaterialMapChannelPacker/Config/UnityPackedPack.asset b/Assets/Alloy/Scripts/MaterialMapChannelPacker/Config/UnityPackedPack.asset new file mode 100644 index 0000000..3d4e6c1 --- /dev/null +++ b/Assets/Alloy/Scripts/MaterialMapChannelPacker/Config/UnityPackedPack.asset @@ -0,0 +1,65 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f11657fe81562504cb1b05d4e700d54d, type: 3} + m_Name: UnityPackedPack + m_EditorClassIdentifier: + Title: Unity PM + Suffix: _AlloyUPM + VarianceBias: 1 + ImportSettings: + IsLinear: 1 + Filter: 2 + DefaultCompressed: 1 + Channels: + - Title: Metallic + HelpText: Black = Non-metal, White = Metal + BackgroundColor: {r: 0.5882353, g: 0, b: 0, a: 1} + CanInvert: 1 + InvertByDefault: 0 + InputChannels: 1 + OutputChannels: 1 + RoughnessCorrect: 0 + OutputVariance: 0 + HideChannel: 0 + DefaultMode: 4 + - Title: Occlusion + HelpText: Black = Occluded, White = Unoccluded + BackgroundColor: {r: 0, g: 0.584, b: 0.052, a: 1} + CanInvert: 1 + InvertByDefault: 0 + InputChannels: 2 + OutputChannels: 2 + RoughnessCorrect: 0 + OutputVariance: 0 + HideChannel: 0 + DefaultMode: 4 + - Title: Specularity + HelpText: Black = Air, Gray = Paint, White = Gems + BackgroundColor: {r: 0.043137256, g: 0, b: 0.5803922, a: 1} + CanInvert: 1 + InvertByDefault: 0 + InputChannels: 4 + OutputChannels: 4 + RoughnessCorrect: 0 + OutputVariance: 0 + HideChannel: 0 + DefaultMode: 1 + - Title: Smoothness + HelpText: Black = Rough, White = Smooth + BackgroundColor: {r: 0, g: 0, b: 0, a: 1} + CanInvert: 1 + InvertByDefault: 1 + InputChannels: 8 + OutputChannels: 8 + RoughnessCorrect: 1 + OutputVariance: 0 + HideChannel: 0 + DefaultMode: 4 diff --git a/Assets/Alloy/Scripts/MaterialMapChannelPacker/Config/UnityPackedPack.asset.meta b/Assets/Alloy/Scripts/MaterialMapChannelPacker/Config/UnityPackedPack.asset.meta new file mode 100644 index 0000000..2858f69 --- /dev/null +++ b/Assets/Alloy/Scripts/MaterialMapChannelPacker/Config/UnityPackedPack.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 23522b2d0809c9c4d9428659169ec2a1 +timeCreated: 1458592032 +licenseType: Pro +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Scripts/MaterialMapChannelPacker/Config/UnityTerrainPack.asset b/Assets/Alloy/Scripts/MaterialMapChannelPacker/Config/UnityTerrainPack.asset new file mode 100644 index 0000000..3130ad3 --- /dev/null +++ b/Assets/Alloy/Scripts/MaterialMapChannelPacker/Config/UnityTerrainPack.asset @@ -0,0 +1,43 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f11657fe81562504cb1b05d4e700d54d, type: 3} + m_Name: UnityTerrainPack + m_EditorClassIdentifier: + Title: Unity TM + Suffix: _AlloyUTM + VarianceBias: 1 + ImportSettings: + IsLinear: 0 + Filter: 2 + DefaultCompressed: 1 + Channels: + - Title: Color + HelpText: Base color for terrain. + BackgroundColor: {r: 0, g: 0.584, b: 0.052, a: 1} + CanInvert: 0 + InvertByDefault: 0 + InputChannels: 7 + OutputChannels: 7 + RoughnessCorrect: 0 + OutputVariance: 0 + HideChannel: 0 + DefaultMode: 4 + - Title: Smoothness + HelpText: Black = Rough, White = Smooth + BackgroundColor: {r: 0, g: 0, b: 0, a: 1} + CanInvert: 1 + InvertByDefault: 1 + InputChannels: 8 + OutputChannels: 8 + RoughnessCorrect: 1 + OutputVariance: 0 + HideChannel: 0 + DefaultMode: 4 diff --git a/Assets/Alloy/Scripts/MaterialMapChannelPacker/Config/UnityTerrainPack.asset.meta b/Assets/Alloy/Scripts/MaterialMapChannelPacker/Config/UnityTerrainPack.asset.meta new file mode 100644 index 0000000..a74e8c9 --- /dev/null +++ b/Assets/Alloy/Scripts/MaterialMapChannelPacker/Config/UnityTerrainPack.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 972cff293012f9740a9250f756d7418b +timeCreated: 1458593840 +licenseType: Pro +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Scripts/MaterialMapChannelPacker/Config/_PackerDefinition.asset b/Assets/Alloy/Scripts/MaterialMapChannelPacker/Config/_PackerDefinition.asset new file mode 100644 index 0000000..8315be5 --- /dev/null +++ b/Assets/Alloy/Scripts/MaterialMapChannelPacker/Config/_PackerDefinition.asset @@ -0,0 +1,26 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: e5c13c2962344f14d8d0d22b07fa9495, type: 3} + m_Name: _PackerDefinition + m_EditorClassIdentifier: + PackedMaps: + - {fileID: 11400000, guid: 1d42740116df09f4f9c9e144a4b9885f, type: 2} + - {fileID: 11400000, guid: 2bf47aefc6b2d2b4fa519cb677bb4346, type: 2} + - {fileID: 11400000, guid: f0d4fc30aba4a084ba51be9301faf8a9, type: 2} + - {fileID: 11400000, guid: 5d1947582bfff244299d3af2cb6ab782, type: 2} + - {fileID: 11400000, guid: 23522b2d0809c9c4d9428659169ec2a1, type: 2} + - {fileID: 11400000, guid: 972cff293012f9740a9250f756d7418b, type: 2} + NRMChannel: + Title: Normal map + HelpText: (Optional) Used for Specular AA + BackgroundColor: {r: 0.322, g: 0, b: 0.472, a: 1} + VarianceText: Bias normal map variance toward zero to reduce Specular AA effect. + AutoRegenerateText: Regenerate this map when any of its input textures are updated./ diff --git a/Assets/Alloy/Scripts/MaterialMapChannelPacker/Config/_PackerDefinition.asset.meta b/Assets/Alloy/Scripts/MaterialMapChannelPacker/Config/_PackerDefinition.asset.meta new file mode 100644 index 0000000..9909ffc --- /dev/null +++ b/Assets/Alloy/Scripts/MaterialMapChannelPacker/Config/_PackerDefinition.asset.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: e29b4e8febd8e3949a1d18cf25c0271a +timeCreated: 1491251285 +licenseType: Pro +NativeFormatImporter: + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Scripts/MaterialMapChannelPacker/Editor.meta b/Assets/Alloy/Scripts/MaterialMapChannelPacker/Editor.meta new file mode 100644 index 0000000..97c0b71 --- /dev/null +++ b/Assets/Alloy/Scripts/MaterialMapChannelPacker/Editor.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 0ce61627d85169d48874646872429200 +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/Alloy/Scripts/MaterialMapChannelPacker/Editor/AlloyCustomImportAction.cs b/Assets/Alloy/Scripts/MaterialMapChannelPacker/Editor/AlloyCustomImportAction.cs new file mode 100644 index 0000000..b13f3eb --- /dev/null +++ b/Assets/Alloy/Scripts/MaterialMapChannelPacker/Editor/AlloyCustomImportAction.cs @@ -0,0 +1,288 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +using System; +using System.Linq; +using System.IO; +using System.Reflection; +using UnityEditor; +using UnityEngine; +using Object = UnityEngine.Object; + +namespace Alloy { + public class AlloyCustomImportAction : AssetPostprocessor { + delegate void OnAlloyImportFunc(AlloyCustomImportObject settings, Texture2D texture, string path); + + public static bool IsAlloyPackedMapPath(string path) { + path = Path.GetFileNameWithoutExtension(path); + var definition = AlloyMaterialMapChannelPacker.GlobalDefinition; + + //Alloy not imported yet -> Assume we're either importing new alloy + //and we're importing it now + if (definition == null) { + return false; + } + + return definition.IsPackedMap(path); + } + + //Make sure to generate PNG alongside .asset file if it doesn't exist yet + private static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, + string[] movedFromAssetPath) { + foreach (var asset in importedAssets) { + if (!IsAlloyPackedMapPath(asset)) { + continue; + } + + if (File.Exists(asset.Replace(".asset", ".png"))) { + continue; + } + + var settings = AssetDatabase.LoadAssetAtPath(asset, typeof (AlloyCustomImportObject)) as AlloyCustomImportObject; + + if (settings != null) { + settings.GenerateMap(); + } + } + } + + private void OnAlloyImport(Texture2D texture, OnAlloyImportFunc onImport) { + // Check to see if this is an Alloy material that we need to edit. + if (!IsAlloyPackedMapPath(assetPath)) { + return; + } + + // and if we've got saved settings/data for it... + var textureName = Path.GetFileNameWithoutExtension(assetPath); + var path = Path.Combine(Path.GetDirectoryName(assetPath), textureName) + ".asset"; + + //Import can fail because of a variety of reasons, so make sure it's all good here + if (!File.Exists(path)) { + Debug.LogError(textureName + " has no post-processing data! Please contact Alloy support."); + Selection.activeObject = texture; + return; + } + + var settings = AssetDatabase.LoadAssetAtPath(path, typeof (AlloyCustomImportObject)) as AlloyCustomImportObject; + if (settings == null) { + if (AlloyImporterSupervisor.IsFinalTry) { + Debug.LogError(textureName + " settings file is corrupt! Contact Alloy support"); + return; + } + + AlloyImporterSupervisor.OnFailedImport(path); + return; + } + + for (int i = 0; i < 4; ++i) { + if (settings.SelectedModes[i] == TextureValueChannelMode.Texture && settings.GetTexture(i) == null) { + if (AlloyImporterSupervisor.IsFinalTry) { + Debug.LogError(textureName + " texture input " + (i + 1) + " can't be loaded!"); + return; + } + + AlloyImporterSupervisor.OnFailedImport(path); + return; + } + } + + if (!string.IsNullOrEmpty(settings.NormalGUID) && settings.NormalMapTexture == null) { + if (AlloyImporterSupervisor.IsFinalTry) { + Debug.LogError(textureName + " normalmap texture input can't be loaded!"); + return; + } + + AlloyImporterSupervisor.OnFailedImport(path); + return; + } + + //If it's all good, do the importing action + onImport(settings, texture, path); + } + + void ApplyImportSettings(AlloyCustomImportObject settings, Texture2D texture, string path) { + var importer = assetImporter as TextureImporter; + var size = settings.GetOutputSize(); + var def = settings.PackMode; + var importSettings = def.ImportSettings; + + importer.textureType = TextureImporterType.Default; + importer.sRGBTexture = !importSettings.IsLinear; + importer.filterMode = importSettings.Filter; + importer.mipmapEnabled = true; + + // They need the ability to set this themselves, but we should cap it. + var nextPowerOfTwo = Mathf.NextPowerOfTwo((int) Mathf.Max(size.x, size.y)); + + if (importer.maxTextureSize > nextPowerOfTwo) { + importer.maxTextureSize = nextPowerOfTwo; + } + + // Allow setting to uncompressed, else use compressed. Disallows any other format! + if (def.ImportSettings.DefaultCompressed + && importer.textureCompression != TextureImporterCompression.Uncompressed + && importer.textureCompression != TextureImporterCompression.CompressedLQ + && importer.textureCompression != TextureImporterCompression.CompressedHQ) { + importer.textureCompression = TextureImporterCompression.Compressed; + } + } + + private void HandleAutoRefresh() { + var paths = AssetDatabase.GetAllAssetPaths(); + var texGUID = AssetDatabase.AssetPathToGUID(assetPath); + + foreach (var path in paths) { + if (!IsAlloyPackedMapPath(path)) { + continue; + } + + var setting = AssetDatabase.LoadAssetAtPath(path, typeof (AlloyCustomImportObject)) as AlloyCustomImportObject; + if (setting == null || (texGUID != setting.NormalGUID && !setting.TexturesGUID.Contains(texGUID))) { + continue; + } + + if (setting.DoAutoRegenerate) { + AssetDatabase.ImportAsset(path.Replace(".asset", ".png")); + } + } + } + + private void OnPreprocessTexture() { + OnAlloyImport(null, ApplyImportSettings); + HandleAutoRefresh(); + } + + private void OnPostprocessTexture(Texture2D texture) { + OnAlloyImport(texture, GeneratePackedMaterialMap); + } + + public static void CreatePostProcessingInformation(string filePath, AlloyCustomImportObject settings) { + settings.hideFlags = HideFlags.None; + AssetDatabase.CreateAsset(settings, filePath); + } + + /// + /// Generates the packed material map for an object + /// + public static void GeneratePackedMaterialMap(AlloyCustomImportObject settings, Texture2D target, string filePath) { + var size = settings.GetOutputSize(); + var normalMap = settings.NormalMapTexture; + var useUnityGeneratedMipmaps = normalMap == null; + int width = (int) size.x; + int height = (int) size.y; + int mipmapCount = 1; + + // When explicitly generating mip levels pick output count based on the largest input texture. + if (!useUnityGeneratedMipmaps) { + mipmapCount = GetMipmapCount(normalMap); + + for (int i = 0; i < 4; ++i) { + if (settings.SelectedModes[i] != TextureValueChannelMode.Texture + || settings.GetTexture(i) == null) { + continue; + } + + mipmapCount = Math.Max(mipmapCount, GetMipmapCount(settings.GetTexture(i))); + } + } + + // Adjust the dimensions of the output texture if necessary. + if (target.width != width || target.height != height) { + target.Resize(width, height); + } + + if (!Mathf.IsPowerOfTwo(width) || !Mathf.IsPowerOfTwo(height)) { + Debug.LogWarning( + "Alloy: Texture resolution is not power of 2; will have issues generating correct mip maps if custom sizing is specified in generated texture platform settings."); + } + + // Get readable input textures. + var readableNormal = AlloyTextureReader.GetReadable(normalMap, true); + var readableTextures = new Texture2D[settings.TexturesGUID.Length]; + + for (int i = 0; i < settings.TexturesGUID.Length; ++i) { + if (settings.SelectedModes[i] != TextureValueChannelMode.Texture) { + continue; + } + + var settingsTex = settings.GetTexture(i); + + if (settingsTex == null) { + readableTextures[i] = null; + } else { + readableTextures[i] = AlloyTextureReader.GetReadable(settingsTex, false); + } + } + + // Use renderer to sample mipmaps. + try { + var message = string.Format("Packing: \"{0}\"", settings.name); + var progress = 1.0f; + var bodyText = message; + + for (int mipLevel = 0; mipLevel < mipmapCount; mipLevel++) { + if (mipmapCount > 1) { + progress = (float)mipLevel / (mipmapCount - 1); + bodyText = string.Format("{0} ({1})", message, progress.ToString("0%")); + } + + EditorUtility.DisplayProgressBar("Building Packed maps...", bodyText, progress); + + // CPU Method - more reliable/consistent across GPUs, but slower. + var normalCache = new AlloyTextureColorCache(readableNormal, target); + + UnityEngine.Profiling.Profiler.BeginSample("Read"); + var texCache = readableTextures.Select(tex => new AlloyTextureColorCache(tex, target)).ToArray(); + UnityEngine.Profiling.Profiler.EndSample(); + + AlloyPackerCompositor.CompositeMips(target, settings, texCache, normalCache, mipLevel); + } + } finally { + EditorUtility.ClearProgressBar(); + } + + // Clean up the readable textures. + foreach (var texture in readableTextures) { + Object.DestroyImmediate(texture); + } + + Object.DestroyImmediate(readableNormal); + + // Update the texture's associated settings .asset object. + settings.Width = width; + settings.Height = height; + settings.MaxResolution = 0; + EditorUtility.SetDirty(settings); + + // Update the texture object. + target.Apply(useUnityGeneratedMipmaps, false); + } + + private static int GetMipmapCount(Texture tex) { + int count = 1; + var texture2D = tex as Texture2D; + var renderTexture = tex as RenderTexture; + var proceduralTexture = tex as ProceduralTexture; + + if (texture2D != null) { + count = texture2D.mipmapCount; + } else if (renderTexture != null) { + count = renderTexture.useMipMap ? GetMipCountFromSize(tex) : 1; + } else if (proceduralTexture != null) { + var mat = + proceduralTexture.GetType() + .GetMethod("GetProceduralMaterial", BindingFlags.Instance | BindingFlags.NonPublic) + .Invoke(proceduralTexture, null) as ProceduralMaterial; + var imp = AssetImporter.GetAtPath(AssetDatabase.GetAssetPath(mat)) as SubstanceImporter; + count = imp != null && imp.GetGenerateMipMaps(mat) ? GetMipCountFromSize(tex) : 1; + } + + return count; + } + + private static int GetMipCountFromSize(Texture tex) { + return Mathf.CeilToInt(Mathf.Log(Mathf.Max(tex.width, tex.height), 2.0f)) + 1; + } + } +} diff --git a/Assets/Alloy/Scripts/MaterialMapChannelPacker/Editor/AlloyCustomImportAction.cs.meta b/Assets/Alloy/Scripts/MaterialMapChannelPacker/Editor/AlloyCustomImportAction.cs.meta new file mode 100644 index 0000000..80bc65e --- /dev/null +++ b/Assets/Alloy/Scripts/MaterialMapChannelPacker/Editor/AlloyCustomImportAction.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e111aca273d4c2b4783aa7111c7f715f +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/Alloy/Scripts/MaterialMapChannelPacker/Editor/AlloyCustomImportObject.cs b/Assets/Alloy/Scripts/MaterialMapChannelPacker/Editor/AlloyCustomImportObject.cs new file mode 100644 index 0000000..c759f47 --- /dev/null +++ b/Assets/Alloy/Scripts/MaterialMapChannelPacker/Editor/AlloyCustomImportObject.cs @@ -0,0 +1,161 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +using System; +using System.IO; +using UnityEditor; +using UnityEngine; + +namespace Alloy +{ + // This stores information used by the asset re-importer; + // to rebuild Mip Maps with corrected roughness information. + public class AlloyCustomImportObject : ScriptableObject + { + [HideInInspector] + public Vector4 ChannelValues = new Vector4(0.0f, 0.0f, 0.5f, 0.0f); + + public string[] TexturesGUID = {"", "", "", ""}; + public string NormalGUID; + + public bool[] DoInvert = {false, false, false, false}; + + + public float VarianceBias; + + public int Width; + public int Height; + + public bool DoAutoRegenerate; + public TextureValueChannelMode[] SelectedModes = { + TextureValueChannelMode.Texture, + TextureValueChannelMode.Texture, + TextureValueChannelMode.Gray, + TextureValueChannelMode.Texture + }; + + Texture2D[] m_textures; + public static readonly int[] s_Resolutions = {0, 32, 64, 128, 256, 512, 1024, 2048, 4096}; + [HideInInspector] public int MaxResolution = 0; + + + /// ///LEGACY: + public bool IsDetailMap; + public bool IsTerrainMap; + /// /// + + [SerializeField] + PackedMapDefinition m_packMode; + + public PackedMapDefinition PackMode { + get { + if (m_packMode == null) { + var defintion = AlloyMaterialMapChannelPacker.GlobalDefinition; + + if (IsDetailMap) { + m_packMode = defintion.DetailPack; + }else if (IsTerrainMap) { + m_packMode = defintion.TerrainPack; + } else { + m_packMode = defintion.PackedPack; + } + } + return m_packMode; + } + set { m_packMode = value; } + } + + + Texture2D m_normalTex; + public Texture2D NormalMapTexture { + get { + if (m_normalTex == null) { + m_normalTex = + AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(NormalGUID), typeof(Texture2D)) as Texture2D; + } + + return m_normalTex; + } + set { + m_normalTex = value; + NormalGUID = AssetDatabase.AssetPathToGUID(AssetDatabase.GetAssetPath(value)); + } + } + + + public void SetTextures(Texture2D[] textures, Texture2D normalMap) { + m_textures = textures; + NormalMapTexture = normalMap; + + TexturesGUID = new string[textures.Length]; + + for (int i = 0; i < textures.Length; ++i) { + TexturesGUID[i] = AssetDatabase.AssetPathToGUID(AssetDatabase.GetAssetPath(textures[i])); + } + + NormalGUID = AssetDatabase.AssetPathToGUID(AssetDatabase.GetAssetPath(normalMap)); + } + + public Texture2D GetTexture(int index) { + if (m_textures == null || m_textures.Length == 0) { + m_textures = new Texture2D[4]; + } + + if (m_textures[index] == null) { + m_textures[index] = + AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(TexturesGUID[index]), typeof (Texture2D)) as Texture2D; + } + + return m_textures[index]; + } + + public const int DefaultOutputWidth = 32, + DefaultOutputHeight = 32, + DefaultOutputMipmapCount = 1; + + public Vector2 GetOutputSize() { + int width = DefaultOutputWidth; + int height = DefaultOutputHeight; + + // Pick output texture dimensions based on the largest input texture. + for (int i = 0; i < 4; ++i) { + var texture = GetTexture(i); + + if (SelectedModes[i] == TextureValueChannelMode.Texture && texture != null) { + // So we can accomodate rectangles, if need be. + width = Math.Max(width, texture.width); + height = Math.Max(height, texture.height); + } + } + + if (NormalMapTexture != null) { + width = Math.Max(width, NormalMapTexture.width); + height = Math.Max(height, NormalMapTexture.height); + } + + return new Vector2(width, height); + } + + public void GenerateMap() { + string path = AssetDatabase.GetAssetPath(this).Replace(".asset", ".png"); + + var tempTex = new Texture2D(4, 4, TextureFormat.ARGB32, true); + AssetDatabase.DeleteAsset(path); + File.WriteAllBytes(path, tempTex.EncodeToPNG()); + AssetDatabase.Refresh(ImportAssetOptions.ForceSynchronousImport); + } + + public void SetTexture(Texture2D selTex, int texIndex) { + TexturesGUID[texIndex] = AssetDatabase.AssetPathToGUID(AssetDatabase.GetAssetPath(selTex)); + m_textures[texIndex] = selTex; + } + + public void ClearCache() { + m_textures[0] = null; + m_textures[1] = null; + m_textures[2] = null; + m_textures[3] = null; + } + } +} \ No newline at end of file diff --git a/Assets/Alloy/Scripts/MaterialMapChannelPacker/Editor/AlloyCustomImportObject.cs.meta b/Assets/Alloy/Scripts/MaterialMapChannelPacker/Editor/AlloyCustomImportObject.cs.meta new file mode 100644 index 0000000..50984fa --- /dev/null +++ b/Assets/Alloy/Scripts/MaterialMapChannelPacker/Editor/AlloyCustomImportObject.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3b158258a30cea746ad413697b1d071b +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/Alloy/Scripts/MaterialMapChannelPacker/Editor/AlloyCustomImportObjectEditor.cs b/Assets/Alloy/Scripts/MaterialMapChannelPacker/Editor/AlloyCustomImportObjectEditor.cs new file mode 100644 index 0000000..25ba0fa --- /dev/null +++ b/Assets/Alloy/Scripts/MaterialMapChannelPacker/Editor/AlloyCustomImportObjectEditor.cs @@ -0,0 +1,40 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +using UnityEditor; +using UnityEngine; + +namespace Alloy +{ + [CustomEditor(typeof(AlloyCustomImportObject))] + public class AlloyCustomImportObjectEditor : Editor + { + private AlloyMaterialMapChannelPacker m_packer; + + private Vector2 m_scrollPos; + + void OnEnable() { + m_packer = CreateInstance(); + m_packer.hideFlags = HideFlags.HideAndDontSave; + + m_packer.Target = target as AlloyCustomImportObject; + } + + void OnDisable() { + DestroyImmediate(m_packer); + } + + public override void OnInspectorGUI() { + m_scrollPos = GUILayout.BeginScrollView(m_scrollPos); + bool isValid = m_packer.BaseGUI(); + bool isButtonClicked = m_packer.GenerateButtonGUI("Regenerate", isValid); + + GUILayout.EndScrollView(); + + if (isButtonClicked) { + m_packer.Target.GenerateMap(); + } + } + } +} \ No newline at end of file diff --git a/Assets/Alloy/Scripts/MaterialMapChannelPacker/Editor/AlloyCustomImportObjectEditor.cs.meta b/Assets/Alloy/Scripts/MaterialMapChannelPacker/Editor/AlloyCustomImportObjectEditor.cs.meta new file mode 100644 index 0000000..7e5a3d1 --- /dev/null +++ b/Assets/Alloy/Scripts/MaterialMapChannelPacker/Editor/AlloyCustomImportObjectEditor.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a625ab56dacfde649b3eb51e51a49a52 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/Alloy/Scripts/MaterialMapChannelPacker/Editor/AlloyImporterSupervisor.cs b/Assets/Alloy/Scripts/MaterialMapChannelPacker/Editor/AlloyImporterSupervisor.cs new file mode 100644 index 0000000..8a0689a --- /dev/null +++ b/Assets/Alloy/Scripts/MaterialMapChannelPacker/Editor/AlloyImporterSupervisor.cs @@ -0,0 +1,83 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +using System.Collections.Generic; +using UnityEngine; +using UnityEditor; + +namespace Alloy +{ + public class AlloyImportFloat : ScriptableObject {} + + [InitializeOnLoad] + public static class AlloyImporterSupervisor + { + private static List s_failedImportAttempts = new List(); + + public static bool IsFinalTry; + private static AlloyImportFloat m_float; + + public static void OnFailedImport(string path) { + if (!s_failedImportAttempts.Contains(path)) { + s_failedImportAttempts.Add(path); + } + } + + static AlloyImporterSupervisor() { + var all = Resources.FindObjectsOfTypeAll(); + + if (all.Length == 0) { + m_float = ScriptableObject.CreateInstance(); + m_float.hideFlags = HideFlags.HideAndDontSave; + + ScanForLateImport(); + } else { + m_float = all[0]; + } + + EditorApplication.update += Update; + } + + private static void ScanForLateImport() { + var assets = AssetDatabase.FindAssets("t:AlloyCustomImportObject"); + + + foreach (var asset in assets) { + var path = AssetDatabase.GUIDToAssetPath(asset); + var png = path.Replace(".asset", ".png"); + var tex = AssetDatabase.LoadAssetAtPath(png); + + if (tex == null) { + AssetDatabase.ImportAsset(path); + } else { + if (tex.width == 4 && tex.height == 4) { + AssetDatabase.ImportAsset(png); + } + } + } + } + + // Update is called once per frame + private static void Update() { + if (s_failedImportAttempts.Count == 0) { + return; + } + + var failed = s_failedImportAttempts.ToArray(); + foreach (var path in failed) { + + var settings = AssetDatabase.LoadAssetAtPath(path, typeof (AlloyCustomImportObject)) as AlloyCustomImportObject; + if (settings == null) { + continue; + } + + IsFinalTry = true; + settings.GenerateMap(); + IsFinalTry = false; + + s_failedImportAttempts.Remove(path); + } + } + } +} \ No newline at end of file diff --git a/Assets/Alloy/Scripts/MaterialMapChannelPacker/Editor/AlloyImporterSupervisor.cs.meta b/Assets/Alloy/Scripts/MaterialMapChannelPacker/Editor/AlloyImporterSupervisor.cs.meta new file mode 100644 index 0000000..b10067b --- /dev/null +++ b/Assets/Alloy/Scripts/MaterialMapChannelPacker/Editor/AlloyImporterSupervisor.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ea64fb811f5753944b3b1fa1735e0f23 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/Alloy/Scripts/MaterialMapChannelPacker/Editor/AlloyMaterialMapChannelPacker.cs b/Assets/Alloy/Scripts/MaterialMapChannelPacker/Editor/AlloyMaterialMapChannelPacker.cs new file mode 100644 index 0000000..bbca35a --- /dev/null +++ b/Assets/Alloy/Scripts/MaterialMapChannelPacker/Editor/AlloyMaterialMapChannelPacker.cs @@ -0,0 +1,537 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +using System; +using System.IO; +using System.Linq; +using UnityEditor; +using UnityEngine; +using Alloy; +using Object = UnityEngine.Object; + +public class AlloyMaterialMapChannelPacker : EditorWindow { + protected const string SelectTextureOrValueErrorMessage = "Please select a texture or a value."; + protected const string EnterFilenameErrorMessage = "Please enter a filename."; + + private const string c_assetPathRoot = "Assets"; + private const string c_defaultFilename = "Output"; + + protected Vector2 ScrollPosition = new Vector2(0, 0); + + [SerializeField] + protected string SaveName = string.Empty; + + private static Texture2D s_rectTexture; + private static GUIStyle s_staticRectStyle; + + private void OnEnable() { + SaveName = GetSelectedOrDefaultFilename(); + Undo.undoRedoPerformed += UndoRedoPerformed; + + } + + private void OnSelectionChange() { + Repaint(); + SaveName = GetSelectedOrDefaultFilename(); + } + + protected string GetSelectedAssetPath() { + var path = c_assetPathRoot; + + foreach (Object obj in Selection.GetFiltered(typeof(Object), SelectionMode.Assets)) { + path = AssetDatabase.GetAssetPath(obj); + + if (File.Exists(path)) { + path = Path.GetDirectoryName(path); + } + + break; + } + + return path; + } + + protected string GetSelectedOrDefaultFilename() { + string fileName; + + var path = AssetDatabase.GetAssetPath(Selection.activeObject); + + if (string.IsNullOrEmpty(path) || !Path.HasExtension(path)) { + fileName = c_defaultFilename; + } else { + fileName = Path.GetFileNameWithoutExtension(path); + } + + return fileName; + } + + protected void TitleLabel(string text) { + GUILayout.Label(text, EditorStyles.boldLabel, GUILayout.Width(150.0f)); + } + + protected void HelpLabel(string text) { + GUI.color = EditorGUIUtility.isProSkin ? Color.gray : Color.black; + var wrappedWhiteLabel = new GUIStyle(EditorStyles.whiteLabel); + wrappedWhiteLabel.wordWrap = true; + GUILayout.Label(text, wrappedWhiteLabel); + } + + // Note that this function is only meant to be called from OnGUI() functions. + public static void GUIDrawRect(Rect position, Color color) { + if (s_rectTexture == null) { + // Use this format so that input colors are treated as though they + // are in gamma-space. + s_rectTexture = new Texture2D(1, 1, TextureFormat.RGB24, false, true); + } + + if (s_staticRectStyle == null) { + s_staticRectStyle = new GUIStyle(); + } + + s_rectTexture.SetPixel(0, 0, color); + + s_rectTexture.Apply(); + s_staticRectStyle.normal.background = s_rectTexture; + + GUI.Box(position, GUIContent.none, s_staticRectStyle); + } + + protected bool FileEntryGUI(string suffix, string extension, ref string filename, out string curPath) { + curPath = GetSelectedAssetPath(); + var displayPath = curPath + "/"; + + if (filename.Contains(suffix)) { + int fileExtPos = filename.LastIndexOf(suffix, StringComparison.Ordinal); + + if (fileExtPos >= 0) { + filename = filename.Substring(0, fileExtPos); + } + } + + displayPath = displayPath.Remove(0, 7); + var dirs = displayPath.Split('/'); + var dirsCount = dirs.Length - 4; + + for (int i = 0; i < dirsCount; i++) { + dirs[i] = ".."; + } + + displayPath = string.Join("/", dirs); + + // Output filename section. + using (new EditorGUILayout.VerticalScope()) { + using (new EditorGUILayout.HorizontalScope()) { + Color defaultContentColor = GUI.contentColor; + GUI.contentColor = EditorGUIUtility.isProSkin ? Color.yellow : Color.black; + GUILayout.Label(displayPath, EditorStyles.whiteLabel); + GUI.contentColor = defaultContentColor; + + GUILayout.Space(10.0f); + SaveName = GUILayout.TextField(filename, GUILayout.Width(180.0f)); + GUILayout.Label(suffix + extension); + GUILayout.FlexibleSpace(); + } + } + + GUILayout.Space(5.0f); + + // Warning message. + bool isValid = true; + + using (new EditorGUILayout.HorizontalScope()) { + if (string.IsNullOrEmpty(filename)) { + EditorGUILayout.HelpBox(EnterFilenameErrorMessage, MessageType.Warning); + isValid = false; + } + + if (filename.Contains("/") || filename.Contains("\\") || filename.Contains(".")) { + EditorGUILayout.HelpBox("Name is not valid!", MessageType.Warning); + isValid = false; + } + + GUILayout.FlexibleSpace(); + } + + return isValid; + } + + [SerializeField] public AlloyCustomImportObject Target; + static MaterialMapChannelPackerDefinition s_definition; + + public static MaterialMapChannelPackerDefinition GlobalDefinition { + get { + if (s_definition == null) { + string path = "Assets/Alloy/Scripts/MaterialMapChannelPacker/Config/_PackerDefinition.asset"; + s_definition = + AssetDatabase.LoadAssetAtPath(path, typeof (MaterialMapChannelPackerDefinition)) as + MaterialMapChannelPackerDefinition; + } + + return s_definition; + } + } + + private const int c_editorMinWidth = 236; + + [MenuItem(AlloyUtils.MenuItem + "Material Map Channel Packer", false, 0)] + private static void LoadWindow() { + var all = Resources.FindObjectsOfTypeAll(); + + foreach (var channelPacker in all) { + DestroyImmediate(channelPacker); + } + + GetWindow(false, "Material Map"); + } + + + private void UndoRedoPerformed() { + Target.ClearCache(); + Repaint(); + } + + private void OnDisable() { + if (Target != null && !EditorUtility.IsPersistent(Target)) { + DestroyImmediate(Target); + } + + Undo.undoRedoPerformed -= UndoRedoPerformed; + } + + + void OnGUI() { + if (Target == null) { + Target = CreateInstance(); + UpdateDefaults(); + } + + var definition = GlobalDefinition; + + + if (definition == null) { + EditorGUILayout.HelpBox("Error: Cannot find packed map defintion file. Please ask for support on the forum", MessageType.Error); + return; + } + + ScrollPosition = EditorGUILayout.BeginScrollView(ScrollPosition, false, false, + GUILayout.MinWidth(c_editorMinWidth), + GUILayout.MaxWidth(position.width)); + + GUILayout.Space(10.0f); + var def = Target.PackMode; + + // Pack mode tabs. + using (new EditorGUILayout.HorizontalScope()) { + foreach (var tabMode in definition.PackedMaps) { + EditorGUI.BeginChangeCheck(); + bool toggle = GUILayout.Toggle(def == tabMode, tabMode.Title, EditorStyles.toolbarButton); + + if (EditorGUI.EndChangeCheck()) { + if (toggle && def != tabMode) { + Target.PackMode = tabMode; // Update packed map definition. + UpdateDefaults(); + } + } + } + } + + string curPath; + var suffix = Target.PackMode.Suffix; + bool isValid = true; + + isValid = BaseGUI(); + isValid = FileEntryGUI(suffix, ".png", ref SaveName, out curPath) && isValid; + + if (GenerateButtonGUI("Generate", isValid)) { + var path = curPath + "/" + SaveName; + + path += suffix; + Target = Instantiate(Target); + AlloyCustomImportAction.CreatePostProcessingInformation(path + ".asset", Target); + } + + EditorGUILayout.EndScrollView(); + } + + private void UpdateDefaults() { + var channels = Target.PackMode.Channels; + + foreach (var channel in channels) { + var outIndices = channel.OutputIndices.ToArray(); + + foreach (var outIndex in outIndices) { + Target.DoInvert[outIndex] = channel.InvertByDefault; + Target.SelectedModes[outIndex] = channel.DefaultMode; + } + } + } + + bool DrawPackedMapDefinition(PackedMapDefinition def) { + var definition = GlobalDefinition; + + if (definition == null) { + EditorGUILayout.HelpBox("Error: Cannot find packed map defintion file. Please ask for support on the forum", MessageType.Error); + return true; + } + + bool anyNrm = false; + bool isValid = true; + + foreach (var channel in def.Channels) { + if (!(channel.OutputVariance || channel.HideChannel)) { + isValid = DrawChannel(channel, false) && isValid; + } + + if (channel.UseNormals) { + anyNrm = true; + } + } + + if (anyNrm) { + isValid = DrawChannel(definition.NRMChannel, true) && isValid; + } + + using (new EditorGUILayout.VerticalScope("HelpBox")) { + TitleLabel("Auto Regenerate"); + + using (new EditorGUILayout.HorizontalScope()) { + HelpLabel(definition.AutoRegenerateText); + GUI.color = Color.white; + GUILayout.FlexibleSpace(); + Target.DoAutoRegenerate = EditorGUILayout.Toggle("", Target.DoAutoRegenerate, GUILayout.Width(120.0f)); + } + + // Does anyone really use this? + //if (def.Channels.Any(c => c.UseNormals) && def.VarianceBias) { + // TitleLabel("Variance Bias"); + + // using (new EditorGUILayout.HorizontalScope()) { + // HelpLabel(GlobalDefinition.VarianceText); + // GUI.color = Color.white; + // GUILayout.FlexibleSpace(); + + // Target.VarianceBias = EditorGUILayout.Slider(Target.VarianceBias, 0.0f, 1.0f, GUILayout.Width(120.0f)); + // } + //} + } + + return isValid; + } + + private bool DrawChannel(BaseTextureChannelMapping def, bool normal) { + bool isValid = true; + + GUI.backgroundColor = def.BackgroundColor; + + using (new EditorGUILayout.VerticalScope("HelpBox")) { + GUI.backgroundColor = Color.white; + + using (new EditorGUILayout.HorizontalScope()) { + var map = def as MapTextureChannelMapping; + + using (new EditorGUILayout.VerticalScope()) { + using (new EditorGUILayout.HorizontalScope()) { + TitleLabel(def.Title); + + if (map != null) { + string inChannel = map.InputString; + string outChannel = map.OutputString; + + HelpLabel("(" + inChannel + " → " + outChannel + ")"); + } + } + HelpLabel(def.HelpText); + + GUI.color = Color.white; + + if (normal) { + Texture2D normalMap = Target.NormalMapTexture; + + if (normalMap != null) { + string path = AssetDatabase.GetAssetPath(normalMap); + + if (!string.IsNullOrEmpty(path)) { + TextureImporter importer = AssetImporter.GetAtPath(path) as TextureImporter; + + if (!importer.mipmapEnabled || importer.textureType != TextureImporterType.NormalMap) { + isValid = false; + EditorGUILayout.HelpBox("Texture type must be \"Normal map\" with mipmaps.", MessageType.Error); + } + } + } + } else if (map != null + && (Target.SelectedModes[map.MainIndex] == TextureValueChannelMode.Texture) + && Target.GetTexture(map.MainIndex) == null) { + isValid = false; + EditorGUILayout.HelpBox(SelectTextureOrValueErrorMessage, MessageType.Warning); + } + } + + GUILayout.FlexibleSpace(); + + if (normal) { + Target.NormalMapTexture = + EditorGUILayout.ObjectField(Target.NormalMapTexture, typeof (Texture2D), false, GUILayout.Width(70.0f), + GUILayout.Height(70.0f)) + as Texture2D; + } else if (map != null) { + int texIndex = map.MainIndex; + + var mode = Target.SelectedModes[texIndex]; + int index = (int) mode; + GUILayout.BeginVertical(); + + bool ch1 = GUILayout.Toggle(index == 0, "Black", EditorStyles.toolbarButton); + bool ch2 = GUILayout.Toggle(index == 1, "Gray", EditorStyles.toolbarButton); + bool ch3 = GUILayout.Toggle(index == 2, "White", EditorStyles.toolbarButton); + bool ch4 = GUILayout.Toggle(index == 3, "Custom", EditorStyles.toolbarButton); + bool ch5 = GUILayout.Toggle(index == 4, "Texture", EditorStyles.toolbarButton); + + float channelValue = 0.0f; + + if (ch1 && index != 0) { + index = 0; + } else if (ch2 && index != 1) { + index = 1; + } else if (ch3 && index != 2) { + index = 2; + } else if (ch4 && index != 3) { + index = 3; + } else if (ch5 && index != 4) { + index = 4; + } + + GUILayout.EndVertical(); + + var selTex = Target.GetTexture((int) texIndex); + + if (mode != TextureValueChannelMode.Texture) { + selTex = null; + } + + GUILayout.Space(10.0f); + // Color or texture picker. + switch (mode) { + case TextureValueChannelMode.Texture: + using (new EditorGUILayout.VerticalScope()) { + selTex = + EditorGUILayout.ObjectField(selTex, typeof (Texture2D), false, GUILayout.Width(70.0f), GUILayout.Height(70.0f)) + as Texture2D; + + if (map.CanInvert) { + float label = EditorGUIUtility.labelWidth; + EditorGUIUtility.labelWidth = 60.0f; + Target.DoInvert[texIndex] = EditorGUILayout.Toggle("Invert", Target.DoInvert[texIndex], GUILayout.Width(70.0f)); + EditorGUIUtility.labelWidth = label; + } + } + + Target.SetTexture(selTex, texIndex); + + foreach (var mapIndex in map.OutputIndices) { + Target.SetTexture(selTex, mapIndex); + Target.DoInvert[mapIndex] = Target.DoInvert[texIndex]; + } + break; + + + case TextureValueChannelMode.Black: + channelValue = 0.0f; + DrawColorBox(Color.black); + break; + case TextureValueChannelMode.Gray: + channelValue = 0.5f; + DrawColorBox(Color.gray); + break; + case TextureValueChannelMode.White: + channelValue = 1.0f; + DrawColorBox(Color.white); + break; + + case TextureValueChannelMode.Custom: + channelValue = Target.ChannelValues[(int) texIndex]; + EditorGUILayout.BeginVertical(); + channelValue = Mathf.Clamp01(channelValue); + channelValue = EditorGUILayout.FloatField(channelValue, + GUILayout.Width(50.0f)); + + DrawColorBox(new Color(channelValue, channelValue, channelValue)); + EditorGUILayout.EndVertical(); + break; + } + + if (mode != TextureValueChannelMode.Texture) { + foreach (var mapIndex in map.OutputIndices) { + Target.DoInvert[mapIndex] = false; + } + } + + Target.ChannelValues[texIndex] = channelValue; + Target.SelectedModes[texIndex] = (TextureValueChannelMode) index; + + foreach (var mapIndex in map.OutputIndices) { + Target.ChannelValues[mapIndex] = channelValue; + Target.SelectedModes[mapIndex] = (TextureValueChannelMode) index; + } + } + } + + GUILayout.Space(10.0f); + } + + return isValid; + } + + private static void DrawColorBox(Color col) { + var rect = GUILayoutUtility.GetRect(74.0f, 74.0f); + var borderColor = new Color { + r = (col.r + 0.2f) / 2.0f, + g = (col.g + 0.2f) / 2.0f, + b = (col.b + 0.2f) / 2.0f, + a = 1.0f + }; + + GUIDrawRect(rect, borderColor); + + rect.x += 2.0f; + rect.width -= 4.0f; + rect.y += 2.0f; + rect.height -= 4.0f; + + GUIDrawRect(rect, col); + } + + public bool BaseGUI() { + EditorGUI.BeginChangeCheck(); + Undo.RecordObject(Target, "Packed map"); + + bool isValid = DrawPackedMapDefinition(Target.PackMode); + + if (EditorGUI.EndChangeCheck()) { + EditorUtility.SetDirty(Target); + } + + return isValid; + } + + public bool GenerateButtonGUI(string text, bool enabled) + { + bool isButtonClicked; + + GUI.enabled = enabled; + + using (new EditorGUILayout.HorizontalScope()) + { + GUILayout.FlexibleSpace(); + isButtonClicked = GUILayout.Button(text, EditorStyles.toolbarButton, GUILayout.Width(120.0f), + GUILayout.Height(70.0f)); + GUILayout.FlexibleSpace(); + } + + GUI.enabled = true; + GUILayout.Space(5.0f); + + return isButtonClicked; + } +} \ No newline at end of file diff --git a/Assets/Alloy/Scripts/MaterialMapChannelPacker/Editor/AlloyMaterialMapChannelPacker.cs.meta b/Assets/Alloy/Scripts/MaterialMapChannelPacker/Editor/AlloyMaterialMapChannelPacker.cs.meta new file mode 100644 index 0000000..d6bb5a1 --- /dev/null +++ b/Assets/Alloy/Scripts/MaterialMapChannelPacker/Editor/AlloyMaterialMapChannelPacker.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: bdefa218d1369324ca83faefe3c27067 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/Alloy/Scripts/MaterialMapChannelPacker/Editor/AlloyPackerCompositor.cs b/Assets/Alloy/Scripts/MaterialMapChannelPacker/Editor/AlloyPackerCompositor.cs new file mode 100644 index 0000000..ffd4bcc --- /dev/null +++ b/Assets/Alloy/Scripts/MaterialMapChannelPacker/Editor/AlloyPackerCompositor.cs @@ -0,0 +1,294 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ +using System.Linq; +using UnityEngine; + +namespace Alloy { + public struct AlloyTextureColorCache { + public bool NativeSize; + public bool EmptyTexture; + + + public Color[] Values; + public float[] ValueChannelR; + public float[] ValueChannelG; + public float[] ValueChannelB; + public float[] ValueChannelA; + + public float[] ActiveChannel; + + private int m_texWidth; + private int m_texHeight; + + public AlloyTextureColorCache(Texture2D texture, Texture2D target) { + if (texture == null) { + EmptyTexture = true; + m_texWidth = 0; + m_texHeight = 0; + Values = null; + ValueChannelR = null; + ValueChannelG = null; + ValueChannelB = null; + ValueChannelA = null; + NativeSize = false; + } + else { + Values = texture.GetPixels(); + m_texWidth = texture.width; + m_texHeight = texture.height; + EmptyTexture = false; + NativeSize = texture.width == target.width && texture.height == target.height; + + + ValueChannelR = new float[Values.Length]; + ValueChannelG = new float[Values.Length]; + ValueChannelB = new float[Values.Length]; + ValueChannelA = new float[Values.Length]; + + for (int i = 0; i < Values.Length; ++i) { + ValueChannelR[i] = Values[i].r; + ValueChannelG[i] = Values[i].g; + ValueChannelB[i] = Values[i].b; + ValueChannelA[i] = Values[i].a; + } + } + + ActiveChannel = null; + } + + + public void SetActiveChannel(int channel) { + switch (channel) { + case 0: + ActiveChannel = ValueChannelR; + break; + + case 1: + ActiveChannel = ValueChannelG; + break; + + case 2: + ActiveChannel = ValueChannelB; + break; + + case 3: + ActiveChannel = ValueChannelA; + break; + } + } + + public float GetChannelBilinear(float u, float v, int mipLevel, float rangeX, float rangeY) { + + if (mipLevel == 0) { + u = Mathf.Clamp01(u); + v = Mathf.Clamp01(v); + + float uScaled = u * (m_texWidth - 1); + float vScaled = v * (m_texHeight - 1); + + int left = Mathf.FloorToInt(uScaled); + int bottom = Mathf.FloorToInt(vScaled); + + int right = Mathf.CeilToInt(uScaled); + int top = Mathf.CeilToInt(vScaled); + + float lbVal = ActiveChannel[left + bottom * m_texWidth]; + float rbVal = ActiveChannel[right + bottom * m_texWidth]; + + float luVal = ActiveChannel[left + top * m_texWidth]; + float ruVal = ActiveChannel[right + top * m_texWidth]; + + float uFrac = uScaled - Mathf.Floor(uScaled); + float vFrac = vScaled - Mathf.Floor(vScaled); + + float lrBottom = Mathf.LerpUnclamped(lbVal, rbVal, uFrac); + float lrUp = Mathf.LerpUnclamped(luVal, ruVal, uFrac); + + return Mathf.Lerp(lrBottom, lrUp, vFrac); + } + + float value = 0.0f; + // Averages the result over the area within the 'pixel' for this mip level + // this is similar, but not quite exactly the same as trilinear filtering. + for (int i = -mipLevel; i < mipLevel; ++i) { + for (int j = -mipLevel; j < mipLevel; ++j) { + float um = u + (i * rangeX); + float vm = v - (j * rangeY); + value += GetChannelBilinear(um, vm, 0, rangeX, rangeY); + } + } + int t = mipLevel * 2; + value /= t * t; + + return value; + } + + public Vector3 GetPixelNormal(float u, float v, int mipLevel, float rangeX, float rangeY) { + if (mipLevel == 0) { + u = Mathf.Clamp01(u); + v = Mathf.Clamp01(v); + + float uScaled = u * (m_texWidth - 1); + float vScaled = v * (m_texHeight - 1); + + int left = Mathf.FloorToInt(uScaled); + int bottom = Mathf.FloorToInt(vScaled); + + int right = Mathf.CeilToInt(uScaled); + int top = Mathf.CeilToInt(vScaled); + + Color lbVal = Values[left + bottom * m_texWidth]; + Color rbVal = Values[right + bottom * m_texWidth]; + + Color luVal = Values[left + top * m_texWidth]; + Color ruVal = Values[right + top * m_texWidth]; + + float uFrac = uScaled - Mathf.Floor(uScaled); + float vFrac = vScaled - Mathf.Floor(vScaled); + + float rLerp = Mathf.LerpUnclamped(Mathf.LerpUnclamped(lbVal.r, rbVal.r, uFrac), Mathf.LerpUnclamped(luVal.r, ruVal.r, uFrac), vFrac); + float gLerp = Mathf.LerpUnclamped(Mathf.LerpUnclamped(lbVal.g, rbVal.g, uFrac), Mathf.LerpUnclamped(luVal.g, ruVal.g, uFrac), vFrac); + float bLerp = Mathf.LerpUnclamped(Mathf.LerpUnclamped(lbVal.b, rbVal.b, uFrac), Mathf.LerpUnclamped(luVal.b, ruVal.b, uFrac), vFrac); + + return new Vector3(rLerp, gLerp, bLerp); + } + + Vector3 value = Vector3.zero; + // Averages the result over the area within the 'pixel' for this mip level + // this is similar, but not quite exactly the same as trilinear filtering. + for (int i = -mipLevel; i < mipLevel; ++i) { + for (int j = -mipLevel; j < mipLevel; ++j) { + float um = u + (i * rangeX); + float vm = v - (j * rangeY); + value += GetPixelNormal(um, vm, 0, rangeX, rangeY); + } + } + + int t = mipLevel * 2; + value /= t * t; + + return value; + } + } + + public static class AlloyPackerCompositor { + public static void CompositeMips(Texture2D target, AlloyCustomImportObject source, + AlloyTextureColorCache[] mapCache, AlloyTextureColorCache normalCache, int mipLevel) { + + + // Basically a 1:1 port of the original shader + // The only point of major difference is the filtering method used; which is a fraction simpler. + + // This was disabled, since it appears GetPixels results don't appear to be affected by Unity's messing with Linear inputs; the same way they do at runtime. Re-enable if you like. + + int w = Mathf.Max(2, target.width >> mipLevel); + int h = Mathf.Max(2, target.height >> mipLevel); + + var colors = new Color[w * h]; + + + float rangeX = (1.0f / (mipLevel + 1)) / target.width; + float rangeY = (1.0f / (mipLevel + 1)) / target.height; + + UnityEngine.Profiling.Profiler.BeginSample("Composite mips"); + for (int channelIndex = 0; channelIndex < source.PackMode.Channels.Count; channelIndex++) { + var channel = source.PackMode.Channels[channelIndex]; + var inIndices = channel.InputIndices.ToArray(); + var outIndices = channel.OutputIndices.ToArray(); + bool hasInputs = inIndices.Length > 0; + + for (int i = 0; i < outIndices.Length; ++i) { + int storeIndex = outIndices[i]; + var tex = mapCache[storeIndex]; + var channelVal = source.ChannelValues[storeIndex]; + + if (hasInputs) { + int readIndex = inIndices[Mathf.Min(i, inIndices.Length - 1)]; + + tex.SetActiveChannel(readIndex); + } + + bool doInvert = source.DoInvert[storeIndex]; + bool doNormal = channel.UseNormals && !normalCache.EmptyTexture; + bool doNative = hasInputs && tex.NativeSize && mipLevel == 0; + + UnityEngine.Profiling.Profiler.BeginSample("Blit"); + for (int x = 0; x < w; ++x) { + for (int y = 0; y < h; ++y) { + var pixelIndex = x + y * w; + var input = 0.0f; + + if (!hasInputs || tex.EmptyTexture) { + input = channelVal; + } + else if (doNative) { + input = tex.ActiveChannel[pixelIndex]; + } + else { + input = tex.GetChannelBilinear((float)x / (w - 1), (float)y / (h - 1), mipLevel, rangeX, rangeY); + } + + if (doInvert) { + input = 1.0f - input; + } + + if (doNormal) { + Vector3 normal; + + if (normalCache.NativeSize && mipLevel == 0) { + normal = (Vector4)normalCache.Values[pixelIndex]; + } + else { + normal = normalCache.GetPixelNormal((float)x / (w - 1), (float)y / (h - 1), mipLevel, rangeX, + rangeY); + } + + normal.x = (normal.x * 2.0f) - 1.0f; + normal.y = (normal.y * 2.0f) - 1.0f; + normal.z = (normal.z * 2.0f) - 1.0f; + + // Specular AA for Beckmann roughness. + // cf http://www.frostbite.com/wp-content/uploads/2014/11/course_notes_moving_frostbite_to_pbr.pdf pg92 + var variance = 0.0f; + var avgNormalLength = normal.magnitude; + var applyAA = avgNormalLength < 1.0f; + + if (applyAA) { + float avgNormLen2 = avgNormalLength * avgNormalLength; + float kappa = (3.0f * avgNormalLength - avgNormalLength * avgNormLen2) / (1.0f - avgNormLen2); + + variance = Mathf.Clamp01(1.0f / (2.0f * kappa));// - source.VarianceBias); + } + + if (channel.OutputVariance) { + input = variance; + } + else if (channel.RoughnessCorrect && applyAA) { + float a = input * input; + a = Mathf.Sqrt(Mathf.Clamp01(a * a + variance)); + input = Mathf.Sqrt(a); + } + } + + switch (storeIndex) { + case 0: colors[pixelIndex].r = input; break; + case 1: colors[pixelIndex].g = input; break; + case 2: colors[pixelIndex].b = input; break; + case 3: colors[pixelIndex].a = input; break; + } + } + } + + UnityEngine.Profiling.Profiler.EndSample(); + } + } + + UnityEngine.Profiling.Profiler.BeginSample("Set pixels"); + target.SetPixels(colors, mipLevel); + UnityEngine.Profiling.Profiler.EndSample(); + + UnityEngine.Profiling.Profiler.EndSample(); + } + } +} diff --git a/Assets/Alloy/Scripts/MaterialMapChannelPacker/Editor/AlloyPackerCompositor.cs.meta b/Assets/Alloy/Scripts/MaterialMapChannelPacker/Editor/AlloyPackerCompositor.cs.meta new file mode 100644 index 0000000..68be890 --- /dev/null +++ b/Assets/Alloy/Scripts/MaterialMapChannelPacker/Editor/AlloyPackerCompositor.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 71af2ea0d77504d40854c6460ae15f5e +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/Alloy/Scripts/MaterialMapChannelPacker/Editor/AlloyTextureReader.cs b/Assets/Alloy/Scripts/MaterialMapChannelPacker/Editor/AlloyTextureReader.cs new file mode 100644 index 0000000..ea1ff5d --- /dev/null +++ b/Assets/Alloy/Scripts/MaterialMapChannelPacker/Editor/AlloyTextureReader.cs @@ -0,0 +1,70 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +using UnityEditor; +using UnityEngine; + +namespace Alloy +{ + public class AlloyTextureReader{ + private static Material s_passthroughMat; + + protected static Material PassthroughMaterial { + get { + if (s_passthroughMat == null) { + s_passthroughMat = new Material(Shader.Find("Hidden/AlloyPassthroughBlit")) { hideFlags = HideFlags.HideAndDontSave }; + } + + return s_passthroughMat; + } + } + + private static Material s_normMat; + + protected static Material NormalMaterial { + get { + if (s_normMat == null) { + s_normMat = new Material(Shader.Find("Hidden/AlloyNormalBlit")); + + s_normMat.hideFlags = HideFlags.HideAndDontSave; + } + + return s_normMat; + } + } + + public static Texture2D GetReadable(Texture texture, bool normalMap) { + if (texture == null) { + return null; + } + + var texImporter = AssetImporter.GetAtPath(AssetDatabase.GetAssetPath(texture)) as TextureImporter; + + if (texImporter == null) { + Debug.LogError("Couldn't find packed map texture in asset database!"); + return null; + } + + bool isEditorInLinearSpace = PlayerSettings.colorSpace == ColorSpace.Linear; + bool linear = isEditorInLinearSpace && texImporter.sRGBTexture; + + Shader.SetGlobalFloat("_EditorIsLinear", linear ? 1.0f : 0.0f); + + var render = new RenderTexture(texture.width, texture.height, 0, RenderTextureFormat.ARGB32); + Graphics.Blit(texture, render, normalMap ? NormalMaterial : PassthroughMaterial); + + var readTex = new Texture2D(texture.width, texture.height, TextureFormat.ARGB32, false, false); + + Graphics.SetRenderTarget(render); + readTex.ReadPixels(new Rect(0, 0, texture.width, texture.height), 0, 0, false); + Graphics.SetRenderTarget(null); + + Object.DestroyImmediate(render); + + readTex.hideFlags = HideFlags.HideAndDontSave; + + return readTex; + } + } +} \ No newline at end of file diff --git a/Assets/Alloy/Scripts/MaterialMapChannelPacker/Editor/AlloyTextureReader.cs.meta b/Assets/Alloy/Scripts/MaterialMapChannelPacker/Editor/AlloyTextureReader.cs.meta new file mode 100644 index 0000000..659807c --- /dev/null +++ b/Assets/Alloy/Scripts/MaterialMapChannelPacker/Editor/AlloyTextureReader.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 94b668420c3f65e4c992ef2542203df6 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/Alloy/Scripts/MaterialMapChannelPacker/Editor/ChannelDrawer.cs b/Assets/Alloy/Scripts/MaterialMapChannelPacker/Editor/ChannelDrawer.cs new file mode 100644 index 0000000..8c14ba3 --- /dev/null +++ b/Assets/Alloy/Scripts/MaterialMapChannelPacker/Editor/ChannelDrawer.cs @@ -0,0 +1,24 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +using UnityEditor; +using UnityEngine; + +namespace Alloy { + [CustomPropertyDrawer(typeof(EnumFlagsAttribute))] + public class ChannelDrawer : PropertyDrawer { + public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { + EditorGUI.BeginProperty(position, label, property); + + EditorGUI.BeginChangeCheck(); + int index = EditorGUI.MaskField(position, label, property.intValue, property.enumDisplayNames); + + if (EditorGUI.EndChangeCheck()) { + property.intValue = index; + } + + EditorGUI.EndProperty(); + } + } +} \ No newline at end of file diff --git a/Assets/Alloy/Scripts/MaterialMapChannelPacker/Editor/ChannelDrawer.cs.meta b/Assets/Alloy/Scripts/MaterialMapChannelPacker/Editor/ChannelDrawer.cs.meta new file mode 100644 index 0000000..c74a372 --- /dev/null +++ b/Assets/Alloy/Scripts/MaterialMapChannelPacker/Editor/ChannelDrawer.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 8f9808b8cb7540540bbfbc3d58b51f3d +timeCreated: 1438474773 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Scripts/MaterialMapChannelPacker/Editor/MaterialMapChannelPackerDefinitionEditor.cs b/Assets/Alloy/Scripts/MaterialMapChannelPacker/Editor/MaterialMapChannelPackerDefinitionEditor.cs new file mode 100644 index 0000000..6d25ebc --- /dev/null +++ b/Assets/Alloy/Scripts/MaterialMapChannelPacker/Editor/MaterialMapChannelPackerDefinitionEditor.cs @@ -0,0 +1,105 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +using System.Linq; +using UnityEditor; +using UnityEngine; + +namespace Alloy { + [CustomEditor(typeof (PackedMapDefinition))] + public class PackedMapDefintionEdtior : Editor { + public override void OnInspectorGUI() { + serializedObject.Update(); + + EditorGUILayout.PropertyField(serializedObject.FindProperty("Title")); + EditorGUILayout.PropertyField(serializedObject.FindProperty("Suffix")); + EditorGUILayout.PropertyField(serializedObject.FindProperty("ImportSettings"), true); + + GUILayout.Space(20.0f); + + var map = target as PackedMapDefinition; + var channels = serializedObject.FindProperty("Channels"); + + //int rI = 0, gI = 0, bI = 0, aI = 0; + int rO = 0, gO = 0, bO = 0, aO = 0; + + int del = -1; + + for (int i = 0; i < channels.arraySize; i++) { + var ser = channels.GetArrayElementAtIndex(i); + var channel = map.Channels[i]; + var outputs = channel.OutputChannels; + + if (GUILayout.Button("", "OL Minus")) { + del = i; + } + + EditorGUILayout.PropertyField(ser.FindPropertyRelative("Title")); + EditorGUILayout.PropertyField(ser.FindPropertyRelative("HelpText")); + EditorGUILayout.PropertyField(ser.FindPropertyRelative("BackgroundColor")); + + if (!channel.RoughnessCorrect) { + EditorGUILayout.PropertyField(ser.FindPropertyRelative("OutputVariance")); + } + + if (!channel.OutputVariance) { + EditorGUILayout.PropertyField(ser.FindPropertyRelative("RoughnessCorrect")); + } + + EditorGUILayout.PropertyField(ser.FindPropertyRelative("HideChannel")); + + EditorGUILayout.PropertyField(ser.FindPropertyRelative("CanInvert")); + + if (channel.CanInvert) { + EditorGUILayout.PropertyField(ser.FindPropertyRelative("InvertByDefault")); + } + + EditorGUILayout.PropertyField(ser.FindPropertyRelative("InputChannels")); + EditorGUILayout.PropertyField(ser.FindPropertyRelative("OutputChannels")); + + EditorGUILayout.PropertyField(ser.FindPropertyRelative("DefaultMode")); + + if (outputs.HasFlag(MapChannel.R)) { + rO++; + } + + if (outputs.HasFlag(MapChannel.G)) { + gO++; + } + + if (outputs.HasFlag(MapChannel.B)) { + bO++; + } + + if (outputs.HasFlag(MapChannel.A)) { + aO++; + } + } + + if (rO == 0 || gO == 0 || bO == 0 || aO == 0) { + EditorGUILayout.HelpBox("Missing output channel!", MessageType.Error); + } + + if (rO > 1 || gO > 1 || bO > 1 || aO > 1) { + EditorGUILayout.HelpBox("Output channel is doubly written!", MessageType.Error); + } + + if (del != -1) { + channels.DeleteArrayElementAtIndex(del); + } + + if (GUILayout.Button("", "OL Plus")) { + channels.InsertArrayElementAtIndex(channels.arraySize); + } + + GUILayout.Space(10.0f); + + if (map.Channels.Any(channel => channel.UseNormals)) { + GUILayout.Label("Packed map uses normals"); + } + + serializedObject.ApplyModifiedProperties(); + } + } +} \ No newline at end of file diff --git a/Assets/Alloy/Scripts/MaterialMapChannelPacker/Editor/MaterialMapChannelPackerDefinitionEditor.cs.meta b/Assets/Alloy/Scripts/MaterialMapChannelPacker/Editor/MaterialMapChannelPackerDefinitionEditor.cs.meta new file mode 100644 index 0000000..b2695e5 --- /dev/null +++ b/Assets/Alloy/Scripts/MaterialMapChannelPacker/Editor/MaterialMapChannelPackerDefinitionEditor.cs.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: d517231fecc575946853bb6f5631de34 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Scripts/MaterialMapChannelPacker/EnumExtension.cs b/Assets/Alloy/Scripts/MaterialMapChannelPacker/EnumExtension.cs new file mode 100644 index 0000000..cd4f04e --- /dev/null +++ b/Assets/Alloy/Scripts/MaterialMapChannelPacker/EnumExtension.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + + +namespace Alloy { + public class EnumFlagsAttribute : PropertyAttribute { + } + + public static class EnumExtension { + public static bool HasFlag(this Enum keys, Enum flag) { + int keysVal = Convert.ToInt32(keys); + int flagVal = Convert.ToInt32(flag); + + return (keysVal & flagVal) == flagVal; + } + } + +} \ No newline at end of file diff --git a/Assets/Alloy/Scripts/MaterialMapChannelPacker/EnumExtension.cs.meta b/Assets/Alloy/Scripts/MaterialMapChannelPacker/EnumExtension.cs.meta new file mode 100644 index 0000000..2dac8d7 --- /dev/null +++ b/Assets/Alloy/Scripts/MaterialMapChannelPacker/EnumExtension.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 10d58e89b0610f145b6b5fdbce5dfb5f +timeCreated: 1491250871 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Scripts/MaterialMapChannelPacker/MaterialMapChannelPackerClasses.cs b/Assets/Alloy/Scripts/MaterialMapChannelPacker/MaterialMapChannelPackerClasses.cs new file mode 100644 index 0000000..60193b3 --- /dev/null +++ b/Assets/Alloy/Scripts/MaterialMapChannelPacker/MaterialMapChannelPackerClasses.cs @@ -0,0 +1,122 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +using System; +using System.Collections.Generic; +using System.Text; +using UnityEngine; + +namespace Alloy { + [Serializable] + public class BaseTextureChannelMapping { + public string Title; + public string HelpText; + public Color BackgroundColor; + } + + [Flags] + public enum MapChannel { + R = 1, + G = 2, + B = 4, + A = 8 + } + + public enum TextureValueChannelMode { + Black, + Gray, + White, + Custom, + Texture + } + + [Serializable] + public class MapTextureChannelMapping : BaseTextureChannelMapping { + public bool CanInvert; + public bool InvertByDefault; + + [EnumFlags] public MapChannel InputChannels; + [EnumFlags] public MapChannel OutputChannels; + public bool RoughnessCorrect; + public bool OutputVariance; + public bool HideChannel; + + public TextureValueChannelMode DefaultMode; + + + public int MainIndex { + get { + if (OutputChannels.HasFlag(MapChannel.R)) { + return 0; + } + if (OutputChannels.HasFlag(MapChannel.G)) { + return 1; + } + if (OutputChannels.HasFlag(MapChannel.B)) { + return 2; + } + if (OutputChannels.HasFlag(MapChannel.A)) { + return 3; + } + + Debug.LogError(" Packed map does not have any output channels"); + return 0; + } + } + + private IEnumerable GetIndices(MapChannel channel) { + if (channel.HasFlag(MapChannel.R)) { + yield return 0; + } + if (channel.HasFlag(MapChannel.G)) { + yield return 1; + } + if (channel.HasFlag(MapChannel.B)) { + yield return 2; + } + if (channel.HasFlag(MapChannel.A)) { + yield return 3; + } + } + + public IEnumerable InputIndices { + get { return GetIndices(InputChannels); } + } + + public IEnumerable OutputIndices { + get { return GetIndices(OutputChannels); } + } + + private string GetChannelString(MapChannel channel) { + StringBuilder sb = new StringBuilder(5); + if (channel.HasFlag(MapChannel.R)) { + sb.Append('R'); + } + if (channel.HasFlag(MapChannel.G)) { + sb.Append('G'); + } + if (channel.HasFlag(MapChannel.B)) { + sb.Append('B'); + } + if (channel.HasFlag(MapChannel.A)) { + sb.Append('A'); + } + + return sb.ToString(); + } + + public string InputString { get { return GetChannelString(InputChannels); } } + public string OutputString { get { return GetChannelString(OutputChannels); } } + public bool UseNormals { get { return OutputVariance || RoughnessCorrect; } } + } + + + [Serializable] public class NormalMapChannelTextureChannelMapping : BaseTextureChannelMapping { } + [Serializable] + public class TextureImportConfig { + public bool IsLinear; + public FilterMode Filter = FilterMode.Trilinear; + public bool DefaultCompressed; + } +} \ No newline at end of file diff --git a/Assets/Alloy/Scripts/MaterialMapChannelPacker/MaterialMapChannelPackerClasses.cs.meta b/Assets/Alloy/Scripts/MaterialMapChannelPacker/MaterialMapChannelPackerClasses.cs.meta new file mode 100644 index 0000000..4fcd0ec --- /dev/null +++ b/Assets/Alloy/Scripts/MaterialMapChannelPacker/MaterialMapChannelPackerClasses.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: b15924e141910b045a1574ea69cfcad9 +timeCreated: 1491250714 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Scripts/MaterialMapChannelPacker/MaterialMapChannelPackerDefinition.cs b/Assets/Alloy/Scripts/MaterialMapChannelPacker/MaterialMapChannelPackerDefinition.cs new file mode 100644 index 0000000..d5c3b5d --- /dev/null +++ b/Assets/Alloy/Scripts/MaterialMapChannelPacker/MaterialMapChannelPackerDefinition.cs @@ -0,0 +1,33 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +using System; +using System.Collections.Generic; +using Alloy; +using UnityEngine; + +public class MaterialMapChannelPackerDefinition : ScriptableObject { + public List PackedMaps; + + public PackedMapDefinition PackedPack { get { return PackedMaps[0]; } } + public PackedMapDefinition DetailPack { get { return PackedMaps[1]; } } + public PackedMapDefinition TerrainPack { get { return PackedMaps[2]; } } + + + [Header("Global settings")] public NormalMapChannelTextureChannelMapping NRMChannel = new NormalMapChannelTextureChannelMapping(); + + [Space(15.0f)] public string VarianceText; + public string AutoRegenerateText; + + public bool IsPackedMap(string path) { + for (int i = 0; i < PackedMaps.Count; i++) { + var map = PackedMaps[i]; + if (path.EndsWith(map.Suffix, StringComparison.InvariantCultureIgnoreCase)) { + return true; + } + } + + return false; + } +} \ No newline at end of file diff --git a/Assets/Alloy/Scripts/MaterialMapChannelPacker/MaterialMapChannelPackerDefinition.cs.meta b/Assets/Alloy/Scripts/MaterialMapChannelPacker/MaterialMapChannelPackerDefinition.cs.meta new file mode 100644 index 0000000..298b8e5 --- /dev/null +++ b/Assets/Alloy/Scripts/MaterialMapChannelPacker/MaterialMapChannelPackerDefinition.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: e5c13c2962344f14d8d0d22b07fa9495 +timeCreated: 1491251059 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Scripts/MaterialMapChannelPacker/PackedMapDefinition.cs b/Assets/Alloy/Scripts/MaterialMapChannelPacker/PackedMapDefinition.cs new file mode 100644 index 0000000..6421d26 --- /dev/null +++ b/Assets/Alloy/Scripts/MaterialMapChannelPacker/PackedMapDefinition.cs @@ -0,0 +1,20 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +using UnityEngine; +using System.Collections.Generic; + +namespace Alloy { + [CreateAssetMenu(fileName = "PackedMapDefinition.asset", menuName = "Alloy Packed Map Definition")] + public class PackedMapDefinition : ScriptableObject { + public string Title; + public string Suffix; + public bool VarianceBias = true; + + public TextureImportConfig ImportSettings = new TextureImportConfig(); + + + public List Channels = new List(); + } +} \ No newline at end of file diff --git a/Assets/Alloy/Scripts/MaterialMapChannelPacker/PackedMapDefinition.cs.meta b/Assets/Alloy/Scripts/MaterialMapChannelPacker/PackedMapDefinition.cs.meta new file mode 100644 index 0000000..a963668 --- /dev/null +++ b/Assets/Alloy/Scripts/MaterialMapChannelPacker/PackedMapDefinition.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: f11657fe81562504cb1b05d4e700d54d +timeCreated: 1438475246 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Scripts/MaterialMapChannelPacker/Shaders.meta b/Assets/Alloy/Scripts/MaterialMapChannelPacker/Shaders.meta new file mode 100644 index 0000000..83042b3 --- /dev/null +++ b/Assets/Alloy/Scripts/MaterialMapChannelPacker/Shaders.meta @@ -0,0 +1,6 @@ +fileFormatVersion: 2 +guid: 4cb8c45e0a7eb854b9a28ed578b99383 +folderAsset: yes +DefaultImporter: + userData: + assetBundleName: diff --git a/Assets/Alloy/Scripts/MaterialMapChannelPacker/Shaders/AlloyNormalBlit.shader b/Assets/Alloy/Scripts/MaterialMapChannelPacker/Shaders/AlloyNormalBlit.shader new file mode 100644 index 0000000..ed38795 --- /dev/null +++ b/Assets/Alloy/Scripts/MaterialMapChannelPacker/Shaders/AlloyNormalBlit.shader @@ -0,0 +1,28 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Hidden/AlloyNormalBlit" { + Properties { + _MainTex ("Render Input", 2D) = "white" {} + } + SubShader { + ZTest Always Cull Off ZWrite Off Fog { Mode Off } + Pass { + CGPROGRAM + #pragma vertex vert_img + #pragma fragment frag + #include "UnityCG.cginc" + + sampler2D _MainTex; + float _EditorIsLinear; + + float4 frag(v2f_img IN) : SV_Target { + half3 n = UnpackNormal(tex2D (_MainTex, IN.uv)); + half4 col = half4((n.x + 1.0f) / 2.0f, (n.y + 1.0f) / 2.0f, (n.z + 1.0f) / 2.0f, 1.0f); + return col; + } + ENDCG + } + } +} \ No newline at end of file diff --git a/Assets/Alloy/Scripts/MaterialMapChannelPacker/Shaders/AlloyNormalBlit.shader.meta b/Assets/Alloy/Scripts/MaterialMapChannelPacker/Shaders/AlloyNormalBlit.shader.meta new file mode 100644 index 0000000..5e12972 --- /dev/null +++ b/Assets/Alloy/Scripts/MaterialMapChannelPacker/Shaders/AlloyNormalBlit.shader.meta @@ -0,0 +1,6 @@ +fileFormatVersion: 2 +guid: 75d40b6b4e49a864bb9c2f02005b9c02 +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: diff --git a/Assets/Alloy/Scripts/MaterialMapChannelPacker/Shaders/AlloyPassthroughBlit.shader b/Assets/Alloy/Scripts/MaterialMapChannelPacker/Shaders/AlloyPassthroughBlit.shader new file mode 100644 index 0000000..0b2e768 --- /dev/null +++ b/Assets/Alloy/Scripts/MaterialMapChannelPacker/Shaders/AlloyPassthroughBlit.shader @@ -0,0 +1,33 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Hidden/AlloyPassthroughBlit" { + Properties { + _MainTex ("Render Input", 2D) = "white" {} + } + SubShader { + ZTest Always Cull Off ZWrite Off Fog { Mode Off } + Pass { + CGPROGRAM + #pragma vertex vert_img + #pragma fragment frag + #include "UnityCG.cginc" + + sampler2D _MainTex; + float _EditorIsLinear; + + float4 frag(v2f_img IN) : SV_Target { + half4 col = tex2D (_MainTex, IN.uv); + + if (_EditorIsLinear > 0.5f) { + //Source: http://chilliant.blogspot.nl/2012/08/srgb-approximations-for-hlsl.html + col = max(1.055f * pow(col, 0.416666667f) - 0.055f, 0); + } + + return col; + } + ENDCG + } + } +} \ No newline at end of file diff --git a/Assets/Alloy/Scripts/MaterialMapChannelPacker/Shaders/AlloyPassthroughBlit.shader.meta b/Assets/Alloy/Scripts/MaterialMapChannelPacker/Shaders/AlloyPassthroughBlit.shader.meta new file mode 100644 index 0000000..1487249 --- /dev/null +++ b/Assets/Alloy/Scripts/MaterialMapChannelPacker/Shaders/AlloyPassthroughBlit.shader.meta @@ -0,0 +1,6 @@ +fileFormatVersion: 2 +guid: 46e9194a7cb1e8e43b4bfa242f173dad +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: diff --git a/Assets/Alloy/ShaderVariantCollection.meta b/Assets/Alloy/ShaderVariantCollection.meta new file mode 100644 index 0000000..f800205 --- /dev/null +++ b/Assets/Alloy/ShaderVariantCollection.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 98783e1f7a8921e4b8efd18d98ec5e4c +folderAsset: yes +timeCreated: 1638032183 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/ShaderVariantCollection/H3_ShaderAsset3.shadervariants b/Assets/Alloy/ShaderVariantCollection/H3_ShaderAsset3.shadervariants new file mode 100644 index 0000000..988eb8f --- /dev/null +++ b/Assets/Alloy/ShaderVariantCollection/H3_ShaderAsset3.shadervariants @@ -0,0 +1,1975 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!200 &20000000 +ShaderVariantCollection: + m_Name: H3_ShaderAsset3 + m_Shaders: + - first: {fileID: 45, guid: 0000000000000000f000000000000000, type: 0} + second: + variants: + - keywords: DIRECTIONAL _EMISSION + passType: 4 + - keywords: DIRECTIONAL _NORMALMAP + passType: 4 + - keywords: DIRECTIONAL _EMISSION _SPECGLOSSMAP + passType: 4 + - keywords: DIRECTIONAL _NORMALMAP _SPECGLOSSMAP + passType: 4 + - keywords: DIRECTIONAL SHADOWS_SCREEN _NORMALMAP _SPECGLOSSMAP + passType: 4 + - keywords: DIRECTIONAL FOG_EXP _NORMALMAP _SPECGLOSSMAP + passType: 4 + - keywords: DIRECTIONAL FOG_EXP2 SHADOWS_SCREEN _NORMALMAP _SPECGLOSSMAP + passType: 4 + - keywords: DIRECTIONAL _EMISSION _NORMALMAP _SPECGLOSSMAP + passType: 4 + - keywords: DIRECTIONAL SHADOWS_SCREEN _EMISSION _NORMALMAP _SPECGLOSSMAP + passType: 4 + - keywords: DIRECTIONAL FOG_EXP2 _EMISSION _NORMALMAP _SPECGLOSSMAP + passType: 4 + - keywords: DIRECTIONAL FOG_EXP2 SHADOWS_SCREEN _EMISSION _NORMALMAP _SPECGLOSSMAP + passType: 4 + - keywords: DIRECTIONAL FOG_EXP2 SHADOWS_SHADOWMASK _EMISSION _NORMALMAP _SPECGLOSSMAP + passType: 4 + - keywords: DIRECTIONAL FOG_EXP2 LIGHTMAP_SHADOW_MIXING SHADOWS_SCREEN SHADOWS_SHADOWMASK _EMISSION _NORMALMAP _SPECGLOSSMAP + passType: 4 + - keywords: DIRECTIONAL _ALPHATEST_ON + passType: 4 + - keywords: DIRECTIONAL + passType: 5 + - keywords: DIRECTIONAL _NORMALMAP + passType: 5 + - keywords: DIRECTIONAL _SPECGLOSSMAP + passType: 5 + - keywords: DIRECTIONAL _NORMALMAP _SPECGLOSSMAP + passType: 5 + - keywords: DIRECTIONAL _ALPHATEST_ON + passType: 5 + - keywords: SHADOWS_DEPTH + passType: 8 + - keywords: SHADOWS_DEPTH _SPECGLOSSMAP + passType: 8 + - keywords: SHADOWS_DEPTH _ALPHATEST_ON + passType: 8 + - first: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} + second: + variants: + - keywords: DIRECTIONAL + passType: 4 + - keywords: DIRECTIONAL SHADOWS_SCREEN + passType: 4 + - keywords: DIRECTIONAL FOG_EXP + passType: 4 + - keywords: DIRECTIONAL FOG_EXP SHADOWS_SCREEN + passType: 4 + - keywords: DIRECTIONAL FOG_EXP2 + passType: 4 + - keywords: DIRECTIONAL FOG_EXP2 LIGHTMAP_SHADOW_MIXING SHADOWS_SCREEN SHADOWS_SHADOWMASK + passType: 4 + - keywords: DIRECTIONAL FOG_EXP2 LIGHTMAP_ON LIGHTMAP_SHADOW_MIXING SHADOWS_SCREEN SHADOWS_SHADOWMASK + passType: 4 + - keywords: DIRECTIONAL _EMISSION + passType: 4 + - keywords: DIRECTIONAL FOG_EXP2 SHADOWS_SHADOWMASK UNITY_SINGLE_PASS_STEREO + passType: 4 + - keywords: DIRECTIONAL FOG_EXP2 LIGHTMAP_SHADOW_MIXING SHADOWS_SCREEN SHADOWS_SHADOWMASK UNITY_SINGLE_PASS_STEREO + passType: 4 + - keywords: DIRECTIONAL _NORMALMAP + passType: 4 + - keywords: DIRECTIONAL _EMISSION _NORMALMAP + passType: 4 + - keywords: DIRECTIONAL _METALLICGLOSSMAP _NORMALMAP + passType: 4 + - keywords: DIRECTIONAL _EMISSION _METALLICGLOSSMAP _NORMALMAP + passType: 4 + - keywords: DIRECTIONAL FOG_EXP _EMISSION _METALLICGLOSSMAP _NORMALMAP + passType: 4 + - keywords: DIRECTIONAL FOG_EXP SHADOWS_SCREEN _EMISSION _METALLICGLOSSMAP _NORMALMAP + passType: 4 + - keywords: DIRECTIONAL FOG_EXP2 _EMISSION _METALLICGLOSSMAP _NORMALMAP + passType: 4 + - keywords: DIRECTIONAL FOG_EXP2 SHADOWS_SCREEN _EMISSION _METALLICGLOSSMAP _NORMALMAP + passType: 4 + - keywords: DIRECTIONAL _ALPHATEST_ON _METALLICGLOSSMAP _NORMALMAP + passType: 4 + - keywords: DIRECTIONAL _ALPHABLEND_ON _EMISSION + passType: 4 + - keywords: DIRECTIONAL _ALPHABLEND_ON _METALLICGLOSSMAP _NORMALMAP + passType: 4 + - keywords: DIRECTIONAL _DETAIL_MULX2 + passType: 4 + - keywords: DIRECTIONAL _DETAIL_MULX2 _NORMALMAP + passType: 4 + - keywords: DIRECTIONAL _ALPHAPREMULTIPLY_ON + passType: 4 + - keywords: DIRECTIONAL FOG_EXP2 _ALPHAPREMULTIPLY_ON + passType: 4 + - keywords: DIRECTIONAL FOG_EXP2 SHADOWS_SHADOWMASK _ALPHAPREMULTIPLY_ON + passType: 4 + - keywords: DIRECTIONAL _ALPHAPREMULTIPLY_ON _METALLICGLOSSMAP _NORMALMAP + passType: 4 + - keywords: SPOT + passType: 5 + - keywords: DIRECTIONAL + passType: 5 + - keywords: SHADOWS_DEPTH SPOT + passType: 5 + - keywords: SHADOWS_DEPTH SHADOWS_SOFT SPOT + passType: 5 + - keywords: DIRECTIONAL _NORMALMAP + passType: 5 + - keywords: DIRECTIONAL _METALLICGLOSSMAP _NORMALMAP + passType: 5 + - keywords: SHADOWS_DEPTH SHADOWS_SOFT SPOT _METALLICGLOSSMAP _NORMALMAP + passType: 5 + - keywords: DIRECTIONAL _ALPHATEST_ON _METALLICGLOSSMAP _NORMALMAP + passType: 5 + - keywords: DIRECTIONAL _ALPHABLEND_ON + passType: 5 + - keywords: DIRECTIONAL _ALPHABLEND_ON _METALLICGLOSSMAP _NORMALMAP + passType: 5 + - keywords: DIRECTIONAL _DETAIL_MULX2 + passType: 5 + - keywords: DIRECTIONAL _DETAIL_MULX2 _NORMALMAP + passType: 5 + - keywords: SPOT _ALPHAPREMULTIPLY_ON + passType: 5 + - keywords: DIRECTIONAL _ALPHAPREMULTIPLY_ON + passType: 5 + - keywords: DIRECTIONAL _ALPHAPREMULTIPLY_ON _METALLICGLOSSMAP _NORMALMAP + passType: 5 + - keywords: SHADOWS_DEPTH + passType: 8 + - keywords: SHADOWS_DEPTH UNITY_SINGLE_PASS_STEREO + passType: 8 + - keywords: SHADOWS_DEPTH _METALLICGLOSSMAP + passType: 8 + - keywords: SHADOWS_DEPTH _ALPHATEST_ON _METALLICGLOSSMAP + passType: 8 + - keywords: SHADOWS_DEPTH _ALPHABLEND_ON + passType: 8 + - keywords: SHADOWS_DEPTH _ALPHABLEND_ON _METALLICGLOSSMAP + passType: 8 + - keywords: SHADOWS_DEPTH _ALPHAPREMULTIPLY_ON + passType: 8 + - keywords: SHADOWS_DEPTH _ALPHAPREMULTIPLY_ON _METALLICGLOSSMAP + passType: 8 + - keywords: + passType: 11 + - first: {fileID: 7, guid: 0000000000000000f000000000000000, type: 0} + second: + variants: + - keywords: DIRECTIONAL + passType: 4 + - keywords: DIRECTIONAL + passType: 5 + - first: {fileID: 2, guid: 0000000000000000f000000000000000, type: 0} + second: + variants: + - keywords: DIRECTIONAL + passType: 4 + - keywords: DIRECTIONAL + passType: 5 + - first: {fileID: 4, guid: 0000000000000000f000000000000000, type: 0} + second: + variants: + - keywords: DIRECTIONAL + passType: 4 + - keywords: DIRECTIONAL + passType: 5 + - first: {fileID: 10, guid: 0000000000000000f000000000000000, type: 0} + second: + variants: + - keywords: DIRECTIONAL + passType: 4 + - keywords: DIRECTIONAL + passType: 5 + - first: {fileID: 30, guid: 0000000000000000f000000000000000, type: 0} + second: + variants: + - keywords: DIRECTIONAL + passType: 4 + - keywords: DIRECTIONAL + passType: 5 + - first: {fileID: 51, guid: 0000000000000000f000000000000000, type: 0} + second: + variants: + - keywords: DIRECTIONAL + passType: 4 + - keywords: DIRECTIONAL + passType: 5 + - keywords: SHADOWS_DEPTH + passType: 8 + - first: {fileID: 10512, guid: 0000000000000000f000000000000000, type: 0} + second: + variants: + - keywords: + passType: 0 + - keywords: FOG_EXP2 + passType: 0 + - first: {fileID: 103, guid: 0000000000000000f000000000000000, type: 0} + second: + variants: + - keywords: + passType: 0 + - first: {fileID: 104, guid: 0000000000000000f000000000000000, type: 0} + second: + variants: + - keywords: + passType: 0 + - first: {fileID: 106, guid: 0000000000000000f000000000000000, type: 0} + second: + variants: + - keywords: _SUNDISK_HIGH_QUALITY + passType: 0 + - keywords: UNITY_SINGLE_PASS_STEREO _SUNDISK_HIGH_QUALITY + passType: 0 + - keywords: _SUNDISK_NONE + passType: 0 + - keywords: _SUNDISK_SIMPLE + passType: 0 + - first: {fileID: 200, guid: 0000000000000000f000000000000000, type: 0} + second: + variants: + - keywords: + passType: 0 + - keywords: FOG_EXP + passType: 0 + - keywords: FOG_EXP2 + passType: 0 + - first: {fileID: 203, guid: 0000000000000000f000000000000000, type: 0} + second: + variants: + - keywords: + passType: 0 + - keywords: FOG_EXP + passType: 0 + - keywords: FOG_EXP2 + passType: 0 + - keywords: FOG_EXP2 UNITY_SINGLE_PASS_STEREO + passType: 0 + - first: {fileID: 207, guid: 0000000000000000f000000000000000, type: 0} + second: + variants: + - keywords: + passType: 0 + - first: {fileID: 208, guid: 0000000000000000f000000000000000, type: 0} + second: + variants: + - keywords: + passType: 1 + - first: {fileID: 10501, guid: 0000000000000000f000000000000000, type: 0} + second: + variants: + - keywords: SHADOWS_DEPTH + passType: 8 + - first: {fileID: 10502, guid: 0000000000000000f000000000000000, type: 0} + second: + variants: + - keywords: SHADOWS_DEPTH + passType: 8 + - first: {fileID: 10511, guid: 0000000000000000f000000000000000, type: 0} + second: + variants: + - keywords: + passType: 1 + - keywords: SHADOWS_DEPTH + passType: 8 + - first: {fileID: 10620, guid: 0000000000000000f000000000000000, type: 0} + second: + variants: + - keywords: DIRECTIONAL + passType: 4 + - keywords: DIRECTIONAL + passType: 5 + - first: {fileID: 10700, guid: 0000000000000000f000000000000000, type: 0} + second: + variants: + - keywords: + passType: 0 + - first: {fileID: 10720, guid: 0000000000000000f000000000000000, type: 0} + second: + variants: + - keywords: + passType: 0 + - first: {fileID: 10750, guid: 0000000000000000f000000000000000, type: 0} + second: + variants: + - keywords: + passType: 0 + - first: {fileID: 10752, guid: 0000000000000000f000000000000000, type: 0} + second: + variants: + - keywords: + passType: 0 + - first: {fileID: 10755, guid: 0000000000000000f000000000000000, type: 0} + second: + variants: + - keywords: + passType: 0 + - keywords: FOG_EXP2 + passType: 0 + - first: {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0} + second: + variants: + - keywords: + passType: 0 + - keywords: UNITY_SINGLE_PASS_STEREO + passType: 0 + - first: {fileID: 14000, guid: 0000000000000000f000000000000000, type: 0} + second: + variants: + - keywords: DIRECTIONAL GEOM_TYPE_BRANCH + passType: 4 + - keywords: DIRECTIONAL GEOM_TYPE_BRANCH SHADOWS_SCREEN + passType: 4 + - keywords: DIRECTIONAL GEOM_TYPE_BRANCH INSTANCING_ON + passType: 4 + - keywords: DIRECTIONAL GEOM_TYPE_BRANCH INSTANCING_ON SHADOWS_SCREEN + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP GEOM_TYPE_BRANCH + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP GEOM_TYPE_BRANCH SHADOWS_SCREEN + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP GEOM_TYPE_BRANCH INSTANCING_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP GEOM_TYPE_BRANCH INSTANCING_ON SHADOWS_SCREEN + passType: 4 + - keywords: DIRECTIONAL GEOM_TYPE_LEAF + passType: 4 + - keywords: DIRECTIONAL GEOM_TYPE_LEAF SHADOWS_SCREEN + passType: 4 + - keywords: DIRECTIONAL GEOM_TYPE_LEAF INSTANCING_ON + passType: 4 + - keywords: DIRECTIONAL GEOM_TYPE_LEAF INSTANCING_ON SHADOWS_SCREEN + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP GEOM_TYPE_LEAF + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP GEOM_TYPE_LEAF SHADOWS_SCREEN + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP GEOM_TYPE_LEAF INSTANCING_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP GEOM_TYPE_LEAF INSTANCING_ON SHADOWS_SCREEN + passType: 4 + - keywords: DIRECTIONAL GEOM_TYPE_FROND + passType: 4 + - keywords: DIRECTIONAL GEOM_TYPE_FROND SHADOWS_SCREEN + passType: 4 + - keywords: DIRECTIONAL FOG_EXP GEOM_TYPE_FROND + passType: 4 + - keywords: DIRECTIONAL FOG_EXP GEOM_TYPE_FROND SHADOWS_SCREEN + passType: 4 + - keywords: DIRECTIONAL FOG_EXP2 GEOM_TYPE_FROND + passType: 4 + - keywords: DIRECTIONAL FOG_EXP2 GEOM_TYPE_FROND SHADOWS_SCREEN + passType: 4 + - keywords: DIRECTIONAL GEOM_TYPE_FROND INSTANCING_ON + passType: 4 + - keywords: DIRECTIONAL GEOM_TYPE_FROND INSTANCING_ON SHADOWS_SCREEN + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP GEOM_TYPE_FROND + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP GEOM_TYPE_FROND SHADOWS_SCREEN + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP GEOM_TYPE_FROND INSTANCING_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP GEOM_TYPE_FROND INSTANCING_ON SHADOWS_SCREEN + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP EFFECT_HUE_VARIATION GEOM_TYPE_BRANCH + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP EFFECT_HUE_VARIATION GEOM_TYPE_BRANCH SHADOWS_SCREEN + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP EFFECT_HUE_VARIATION GEOM_TYPE_BRANCH INSTANCING_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP EFFECT_HUE_VARIATION GEOM_TYPE_BRANCH INSTANCING_ON SHADOWS_SCREEN + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP EFFECT_HUE_VARIATION GEOM_TYPE_LEAF + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP EFFECT_HUE_VARIATION GEOM_TYPE_LEAF SHADOWS_SCREEN + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP EFFECT_HUE_VARIATION GEOM_TYPE_LEAF INSTANCING_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP EFFECT_HUE_VARIATION GEOM_TYPE_LEAF INSTANCING_ON SHADOWS_SCREEN + passType: 4 + - keywords: DIRECTIONAL GEOM_TYPE_BRANCH + passType: 5 + - keywords: DIRECTIONAL EFFECT_BUMP GEOM_TYPE_BRANCH + passType: 5 + - keywords: DIRECTIONAL GEOM_TYPE_LEAF + passType: 5 + - keywords: DIRECTIONAL EFFECT_BUMP GEOM_TYPE_LEAF + passType: 5 + - keywords: GEOM_TYPE_FROND SPOT + passType: 5 + - keywords: DIRECTIONAL GEOM_TYPE_FROND + passType: 5 + - keywords: DIRECTIONAL EFFECT_BUMP GEOM_TYPE_FROND + passType: 5 + - keywords: DIRECTIONAL EFFECT_BUMP EFFECT_HUE_VARIATION GEOM_TYPE_BRANCH + passType: 5 + - keywords: DIRECTIONAL EFFECT_BUMP EFFECT_HUE_VARIATION GEOM_TYPE_LEAF + passType: 5 + - keywords: INSTANCING_ON SHADOWS_DEPTH + passType: 8 + - keywords: GEOM_TYPE_BRANCH SHADOWS_DEPTH + passType: 8 + - keywords: GEOM_TYPE_BRANCH INSTANCING_ON SHADOWS_DEPTH + passType: 8 + - keywords: GEOM_TYPE_LEAF SHADOWS_DEPTH + passType: 8 + - keywords: GEOM_TYPE_LEAF INSTANCING_ON SHADOWS_DEPTH + passType: 8 + - keywords: GEOM_TYPE_FROND SHADOWS_DEPTH + passType: 8 + - keywords: GEOM_TYPE_FROND INSTANCING_ON SHADOWS_DEPTH + passType: 8 + - first: {fileID: 15104, guid: 0000000000000000f000000000000000, type: 0} + second: + variants: + - keywords: + passType: 0 + - first: {fileID: 15105, guid: 0000000000000000f000000000000000, type: 0} + second: + variants: + - keywords: + passType: 0 + - first: {fileID: 15106, guid: 0000000000000000f000000000000000, type: 0} + second: + variants: + - keywords: + passType: 0 + - first: {fileID: 4800000, guid: 012a768062850d1489e6603cec5d80a0, type: 3} + second: + variants: + - keywords: UNITY_SINGLE_PASS_STEREO + passType: 0 + - first: {fileID: 4800000, guid: 81cb2e10981a2a146945222c56338e37, type: 3} + second: + variants: + - keywords: DIRECTIONAL + passType: 4 + - keywords: DIRECTIONAL SHADOWS_SCREEN + passType: 4 + - keywords: DIRECTIONAL LIGHTMAP_ON + passType: 4 + - keywords: DIRECTIONAL SHADOWS_SHADOWMASK + passType: 4 + - keywords: DIRECTIONAL LIGHTMAP_SHADOW_MIXING SHADOWS_SCREEN SHADOWS_SHADOWMASK + passType: 4 + - keywords: DIRECTIONAL FOG_EXP + passType: 4 + - keywords: DIRECTIONAL FOG_EXP SHADOWS_SCREEN + passType: 4 + - keywords: DIRECTIONAL FOG_EXP2 + passType: 4 + - keywords: DIRECTIONAL FOG_EXP2 SHADOWS_SCREEN + passType: 4 + - keywords: DIRECTIONAL FOG_EXP2 SHADOWS_SHADOWMASK + passType: 4 + - keywords: DIRECTIONAL FOG_EXP2 LIGHTMAP_SHADOW_MIXING SHADOWS_SCREEN SHADOWS_SHADOWMASK + passType: 4 + - keywords: DIRECTIONAL _EMISSION + passType: 4 + - keywords: DIRECTIONAL SHADOWS_SCREEN _EMISSION + passType: 4 + - keywords: DIRECTIONAL FOG_EXP2 _EMISSION + passType: 4 + - keywords: DIRECTIONAL FOG_EXP2 SHADOWS_SCREEN _EMISSION + passType: 4 + - keywords: DIRECTIONAL FOG_EXP2 SHADOWS_SHADOWMASK UNITY_SINGLE_PASS_STEREO + passType: 4 + - keywords: DIRECTIONAL FOG_EXP2 LIGHTMAP_SHADOW_MIXING SHADOWS_SCREEN SHADOWS_SHADOWMASK UNITY_SINGLE_PASS_STEREO + passType: 4 + - keywords: DIRECTIONAL SHADOWS_SCREEN _ALPHATEST_ON _EMISSION + passType: 4 + - keywords: DIRECTIONAL FOG_EXP2 _ALPHATEST_ON _EMISSION + passType: 4 + - keywords: DIRECTIONAL FOG_EXP2 SHADOWS_SCREEN _ALPHATEST_ON _EMISSION + passType: 4 + - keywords: DIRECTIONAL _ALPHABLEND_ON + passType: 4 + - keywords: DIRECTIONAL FOG_EXP _ALPHABLEND_ON + passType: 4 + - keywords: DIRECTIONAL FOG_EXP2 _ALPHABLEND_ON + passType: 4 + - keywords: DIRECTIONAL FOG_EXP2 SHADOWS_SHADOWMASK _ALPHABLEND_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP SHADOWS_SCREEN + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP LIGHTMAP_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP LIGHTMAP_ON SHADOWS_SCREEN + passType: 4 + - keywords: DIRECTIONAL DIRLIGHTMAP_COMBINED EFFECT_BUMP LIGHTMAP_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP SHADOWS_SHADOWMASK + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP LIGHTMAP_SHADOW_MIXING SHADOWS_SCREEN SHADOWS_SHADOWMASK + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP SHADOWS_SCREEN + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 SHADOWS_SCREEN + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 SHADOWS_SHADOWMASK + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 LIGHTMAP_SHADOW_MIXING SHADOWS_SCREEN SHADOWS_SHADOWMASK + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP _EMISSION + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP SHADOWS_SCREEN _EMISSION + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP _EMISSION + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP SHADOWS_SCREEN _EMISSION + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 _EMISSION + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 SHADOWS_SCREEN _EMISSION + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 SHADOWS_SHADOWMASK _EMISSION + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 LIGHTMAP_SHADOW_MIXING SHADOWS_SCREEN SHADOWS_SHADOWMASK _EMISSION + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 SHADOWS_SHADOWMASK UNITY_SINGLE_PASS_STEREO + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 LIGHTMAP_SHADOW_MIXING SHADOWS_SCREEN SHADOWS_SHADOWMASK UNITY_SINGLE_PASS_STEREO + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 SHADOWS_SHADOWMASK UNITY_SINGLE_PASS_STEREO _EMISSION + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 LIGHTMAP_SHADOW_MIXING SHADOWS_SCREEN SHADOWS_SHADOWMASK UNITY_SINGLE_PASS_STEREO _EMISSION + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP _NORMALMAP + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP SHADOWS_SCREEN _NORMALMAP + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP _NORMALMAP + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP SHADOWS_SCREEN _NORMALMAP + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 _NORMALMAP + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 SHADOWS_SCREEN _NORMALMAP + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 SHADOWS_SHADOWMASK _NORMALMAP + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 LIGHTMAP_SHADOW_MIXING SHADOWS_SCREEN SHADOWS_SHADOWMASK _NORMALMAP + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP _EMISSION _NORMALMAP + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP SHADOWS_SCREEN _EMISSION _NORMALMAP + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP _ALPHATEST_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP SHADOWS_SCREEN _ALPHATEST_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP _ALPHATEST_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP SHADOWS_SCREEN _ALPHATEST_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 _ALPHATEST_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 SHADOWS_SCREEN _ALPHATEST_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 SHADOWS_SHADOWMASK _ALPHATEST_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 LIGHTMAP_SHADOW_MIXING SHADOWS_SCREEN SHADOWS_SHADOWMASK _ALPHATEST_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP _ALPHATEST_ON _NORMALMAP + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP SHADOWS_SCREEN _ALPHATEST_ON _NORMALMAP + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 SHADOWS_SCREEN _ALPHATEST_ON _NORMALMAP + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP _ALPHABLEND_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP _ALPHABLEND_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 _ALPHABLEND_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 SHADOWS_SHADOWMASK _ALPHABLEND_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP _ALPHABLEND_ON _EMISSION + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP _DETAIL_MULX2 + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP SHADOWS_SCREEN _DETAIL_MULX2 + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP LIGHTMAP_ON _DETAIL_MULX2 + passType: 4 + - keywords: DIRECTIONAL DIRLIGHTMAP_COMBINED EFFECT_BUMP LIGHTMAP_ON _DETAIL_MULX2 + passType: 4 + - keywords: DIRECTIONAL DIRLIGHTMAP_COMBINED EFFECT_BUMP LIGHTMAP_ON SHADOWS_SCREEN _DETAIL_MULX2 + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP _DETAIL_MULX2 + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP SHADOWS_SCREEN _DETAIL_MULX2 + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 _DETAIL_MULX2 + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 SHADOWS_SCREEN _DETAIL_MULX2 + passType: 4 + - keywords: DIRECTIONAL DIRLIGHTMAP_COMBINED EFFECT_BUMP FOG_EXP2 LIGHTMAP_ON SHADOWS_SCREEN _DETAIL_MULX2 + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 SHADOWS_SHADOWMASK _DETAIL_MULX2 + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 LIGHTMAP_SHADOW_MIXING SHADOWS_SCREEN SHADOWS_SHADOWMASK _DETAIL_MULX2 + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP _ALPHAPREMULTIPLY_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP _ALPHAPREMULTIPLY_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 _ALPHAPREMULTIPLY_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 SHADOWS_SHADOWMASK _ALPHAPREMULTIPLY_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP _ALPHAPREMULTIPLY_ON _EMISSION + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP _ALPHAPREMULTIPLY_ON _NORMALMAP + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 _ALPHAPREMULTIPLY_ON _NORMALMAP + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 SHADOWS_SHADOWMASK _ALPHAPREMULTIPLY_ON _NORMALMAP + passType: 4 + - keywords: DIRECTIONAL _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL SHADOWS_SCREEN _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL LIGHTMAP_ON _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL SHADOWS_SHADOWMASK _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL LIGHTMAP_SHADOW_MIXING SHADOWS_SCREEN SHADOWS_SHADOWMASK _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL LIGHTMAP_ON LIGHTMAP_SHADOW_MIXING SHADOWS_SHADOWMASK _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL LIGHTMAP_ON LIGHTMAP_SHADOW_MIXING SHADOWS_SCREEN SHADOWS_SHADOWMASK _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL DYNAMICLIGHTMAP_ON LIGHTMAP_ON LIGHTMAP_SHADOW_MIXING SHADOWS_SHADOWMASK _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL DYNAMICLIGHTMAP_ON LIGHTMAP_ON LIGHTMAP_SHADOW_MIXING SHADOWS_SCREEN SHADOWS_SHADOWMASK _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL FOG_EXP _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL FOG_EXP SHADOWS_SCREEN _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL FOG_EXP2 _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL FOG_EXP2 SHADOWS_SCREEN _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL FOG_EXP2 SHADOWS_SHADOWMASK _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL FOG_EXP2 LIGHTMAP_SHADOW_MIXING SHADOWS_SCREEN SHADOWS_SHADOWMASK _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL FOG_EXP2 LIGHTMAP_ON LIGHTMAP_SHADOW_MIXING SHADOWS_SHADOWMASK _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL FOG_EXP2 LIGHTMAP_ON LIGHTMAP_SHADOW_MIXING SHADOWS_SCREEN SHADOWS_SHADOWMASK _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL DYNAMICLIGHTMAP_ON FOG_EXP2 LIGHTMAP_ON LIGHTMAP_SHADOW_MIXING SHADOWS_SHADOWMASK _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL DYNAMICLIGHTMAP_ON FOG_EXP2 LIGHTMAP_ON LIGHTMAP_SHADOW_MIXING SHADOWS_SCREEN SHADOWS_SHADOWMASK _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL _EMISSION _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL SHADOWS_SCREEN _EMISSION _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL SHADOWS_SHADOWMASK _EMISSION _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL LIGHTMAP_SHADOW_MIXING SHADOWS_SCREEN SHADOWS_SHADOWMASK _EMISSION _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL LIGHTMAP_ON LIGHTMAP_SHADOW_MIXING SHADOWS_SHADOWMASK _EMISSION _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL LIGHTMAP_ON LIGHTMAP_SHADOW_MIXING SHADOWS_SCREEN SHADOWS_SHADOWMASK _EMISSION _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL DYNAMICLIGHTMAP_ON LIGHTMAP_ON LIGHTMAP_SHADOW_MIXING SHADOWS_SHADOWMASK _EMISSION _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL DYNAMICLIGHTMAP_ON LIGHTMAP_ON LIGHTMAP_SHADOW_MIXING SHADOWS_SCREEN SHADOWS_SHADOWMASK _EMISSION _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL FOG_EXP _EMISSION _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL FOG_EXP SHADOWS_SCREEN _EMISSION _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL FOG_EXP2 _EMISSION _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL FOG_EXP2 SHADOWS_SCREEN _EMISSION _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL FOG_EXP2 SHADOWS_SHADOWMASK _EMISSION _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL FOG_EXP2 LIGHTMAP_SHADOW_MIXING SHADOWS_SCREEN SHADOWS_SHADOWMASK _EMISSION _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL FOG_EXP2 LIGHTMAP_ON LIGHTMAP_SHADOW_MIXING SHADOWS_SHADOWMASK _EMISSION _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL FOG_EXP2 LIGHTMAP_ON LIGHTMAP_SHADOW_MIXING SHADOWS_SCREEN SHADOWS_SHADOWMASK _EMISSION _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL DYNAMICLIGHTMAP_ON FOG_EXP2 LIGHTMAP_ON LIGHTMAP_SHADOW_MIXING SHADOWS_SHADOWMASK _EMISSION _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL DYNAMICLIGHTMAP_ON FOG_EXP2 LIGHTMAP_ON LIGHTMAP_SHADOW_MIXING SHADOWS_SCREEN SHADOWS_SHADOWMASK _EMISSION _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL FOG_EXP2 SHADOWS_SHADOWMASK UNITY_SINGLE_PASS_STEREO _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL FOG_EXP2 LIGHTMAP_SHADOW_MIXING SHADOWS_SCREEN SHADOWS_SHADOWMASK UNITY_SINGLE_PASS_STEREO _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL FOG_EXP2 LIGHTMAP_ON LIGHTMAP_SHADOW_MIXING SHADOWS_SHADOWMASK UNITY_SINGLE_PASS_STEREO _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL FOG_EXP2 LIGHTMAP_ON LIGHTMAP_SHADOW_MIXING SHADOWS_SCREEN SHADOWS_SHADOWMASK UNITY_SINGLE_PASS_STEREO _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL DYNAMICLIGHTMAP_ON FOG_EXP2 LIGHTMAP_ON LIGHTMAP_SHADOW_MIXING SHADOWS_SHADOWMASK UNITY_SINGLE_PASS_STEREO _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL DYNAMICLIGHTMAP_ON FOG_EXP2 LIGHTMAP_ON LIGHTMAP_SHADOW_MIXING SHADOWS_SCREEN SHADOWS_SHADOWMASK UNITY_SINGLE_PASS_STEREO _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL FOG_EXP2 SHADOWS_SHADOWMASK UNITY_SINGLE_PASS_STEREO _EMISSION _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL FOG_EXP2 LIGHTMAP_SHADOW_MIXING SHADOWS_SCREEN SHADOWS_SHADOWMASK UNITY_SINGLE_PASS_STEREO _EMISSION _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL FOG_EXP2 LIGHTMAP_ON LIGHTMAP_SHADOW_MIXING SHADOWS_SHADOWMASK UNITY_SINGLE_PASS_STEREO _EMISSION _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL FOG_EXP2 LIGHTMAP_ON LIGHTMAP_SHADOW_MIXING SHADOWS_SCREEN SHADOWS_SHADOWMASK UNITY_SINGLE_PASS_STEREO _EMISSION _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL _ALPHABLEND_ON _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL FOG_EXP _ALPHABLEND_ON _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL FOG_EXP2 _ALPHABLEND_ON _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL FOG_EXP2 SHADOWS_SHADOWMASK _ALPHABLEND_ON _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL FOG_EXP2 SHADOWS_SHADOWMASK UNITY_SINGLE_PASS_STEREO _ALPHABLEND_ON _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL _DETAIL_MULX2 _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL SHADOWS_SCREEN _DETAIL_MULX2 _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL _DETAIL_MULX2 _EMISSION _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP SHADOWS_SCREEN _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP LIGHTMAP_ON _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP LIGHTMAP_ON SHADOWS_SCREEN _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL DIRLIGHTMAP_COMBINED EFFECT_BUMP LIGHTMAP_ON _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL DIRLIGHTMAP_COMBINED EFFECT_BUMP LIGHTMAP_ON SHADOWS_SCREEN _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP SHADOWS_SHADOWMASK _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP LIGHTMAP_SHADOW_MIXING SHADOWS_SCREEN SHADOWS_SHADOWMASK _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP SHADOWS_SCREEN _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 SHADOWS_SCREEN _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL DIRLIGHTMAP_COMBINED EFFECT_BUMP FOG_EXP2 LIGHTMAP_ON SHADOWS_SCREEN _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 SHADOWS_SHADOWMASK _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 LIGHTMAP_SHADOW_MIXING SHADOWS_SCREEN SHADOWS_SHADOWMASK _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP _EMISSION _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP SHADOWS_SCREEN _EMISSION _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 _EMISSION _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 SHADOWS_SCREEN _EMISSION _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 SHADOWS_SHADOWMASK _EMISSION _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 LIGHTMAP_SHADOW_MIXING SHADOWS_SCREEN SHADOWS_SHADOWMASK _EMISSION _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 SHADOWS_SHADOWMASK UNITY_SINGLE_PASS_STEREO _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 LIGHTMAP_SHADOW_MIXING SHADOWS_SCREEN SHADOWS_SHADOWMASK UNITY_SINGLE_PASS_STEREO _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP _NORMALMAP _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP _NORMALMAP _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP SHADOWS_SCREEN _NORMALMAP _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP _DETAIL_MULX2 _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP SHADOWS_SCREEN _DETAIL_MULX2 _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP LIGHTMAP_ON _DETAIL_MULX2 _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL DIRLIGHTMAP_COMBINED EFFECT_BUMP LIGHTMAP_ON _DETAIL_MULX2 _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL DIRLIGHTMAP_COMBINED EFFECT_BUMP LIGHTMAP_ON SHADOWS_SCREEN _DETAIL_MULX2 _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 _DETAIL_MULX2 _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 SHADOWS_SCREEN _DETAIL_MULX2 _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL DIRLIGHTMAP_COMBINED EFFECT_BUMP FOG_EXP2 LIGHTMAP_ON SHADOWS_SCREEN _DETAIL_MULX2 _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP _DETAIL_MULX2 _NORMALMAP _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP SHADOWS_SCREEN _DETAIL_MULX2 _NORMALMAP _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP _ALPHABLEND_ON _DETAIL_MULX2 _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP _ALPHABLEND_ON _DETAIL_MULX2 _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP _ALPHAPREMULTIPLY_ON _DETAIL_MULX2 _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 _ALPHAPREMULTIPLY_ON _DETAIL_MULX2 _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP _DECAL_ON + passType: 4 + - keywords: DIRECTIONAL LIGHTMAP_ON _DECAL_ON _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP _DECAL_ON _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP SHADOWS_SCREEN _DECAL_ON _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP LIGHTMAP_ON SHADOWS_SCREEN _DECAL_ON _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL DIRLIGHTMAP_COMBINED EFFECT_BUMP LIGHTMAP_ON _DECAL_ON _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP _DECAL_ON _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP SHADOWS_SCREEN _DECAL_ON _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 _DECAL_ON _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 SHADOWS_SCREEN _DECAL_ON _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 SHADOWS_SHADOWMASK _DECAL_ON _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 LIGHTMAP_SHADOW_MIXING SHADOWS_SCREEN SHADOWS_SHADOWMASK _DECAL_ON _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP SHADOWS_SCREEN _DECAL_ON _DETAIL_MULX2 _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 _DECAL_ON _DETAIL_MULX2 _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 SHADOWS_SCREEN _DECAL_ON _DETAIL_MULX2 _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP _RIM_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP SHADOWS_SCREEN _RIM_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP SHADOWS_SHADOWMASK _RIM_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP LIGHTMAP_SHADOW_MIXING SHADOWS_SCREEN SHADOWS_SHADOWMASK _RIM_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP _RIM_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP SHADOWS_SCREEN _RIM_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 _RIM_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 SHADOWS_SCREEN _RIM_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 SHADOWS_SHADOWMASK _RIM_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 LIGHTMAP_SHADOW_MIXING SHADOWS_SCREEN SHADOWS_SHADOWMASK _RIM_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP _EMISSION _RIM_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP SHADOWS_SCREEN _EMISSION _RIM_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP _EMISSION _RIM_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP SHADOWS_SCREEN _EMISSION _RIM_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 _EMISSION _RIM_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 SHADOWS_SHADOWMASK _EMISSION _RIM_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 LIGHTMAP_SHADOW_MIXING SHADOWS_SCREEN SHADOWS_SHADOWMASK _EMISSION _RIM_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 SHADOWS_SHADOWMASK UNITY_SINGLE_PASS_STEREO _RIM_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 LIGHTMAP_SHADOW_MIXING SHADOWS_SCREEN SHADOWS_SHADOWMASK UNITY_SINGLE_PASS_STEREO _RIM_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP _ALPHABLEND_ON _RIM_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP _DETAIL_MULX2 _RIM_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP SHADOWS_SCREEN _DETAIL_MULX2 _RIM_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 _DETAIL_MULX2 _RIM_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 SHADOWS_SCREEN _DETAIL_MULX2 _RIM_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 SHADOWS_SHADOWMASK _DETAIL_MULX2 _RIM_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 LIGHTMAP_SHADOW_MIXING SHADOWS_SCREEN SHADOWS_SHADOWMASK _DETAIL_MULX2 _RIM_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP _ALPHAPREMULTIPLY_ON _RIM_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP SHADOWS_SHADOWMASK _ALPHAPREMULTIPLY_ON _RIM_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 _ALPHAPREMULTIPLY_ON _RIM_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 SHADOWS_SHADOWMASK _ALPHAPREMULTIPLY_ON _RIM_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP _ALPHAPREMULTIPLY_ON _EMISSION _RIM_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 SHADOWS_SHADOWMASK UNITY_SINGLE_PASS_STEREO _ALPHAPREMULTIPLY_ON _RIM_ON + passType: 4 + - keywords: DIRECTIONAL _RIM_ON _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL SHADOWS_SCREEN _RIM_ON _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL FOG_EXP SHADOWS_SCREEN _RIM_ON _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL FOG_EXP2 _RIM_ON _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL FOG_EXP2 SHADOWS_SCREEN _RIM_ON _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL FOG_EXP2 SHADOWS_SHADOWMASK _RIM_ON _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL FOG_EXP2 LIGHTMAP_SHADOW_MIXING SHADOWS_SCREEN SHADOWS_SHADOWMASK _RIM_ON _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP _RIM_ON _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP SHADOWS_SCREEN _RIM_ON _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP _RIM_ON _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP SHADOWS_SCREEN _RIM_ON _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 _RIM_ON _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 SHADOWS_SCREEN _RIM_ON _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 SHADOWS_SHADOWMASK _RIM_ON _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 LIGHTMAP_SHADOW_MIXING SHADOWS_SCREEN SHADOWS_SHADOWMASK _RIM_ON _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP _ALPHAPREMULTIPLY_ON _DETAIL_MULX2 _RIM_ON _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 _ALPHAPREMULTIPLY_ON _DETAIL_MULX2 _RIM_ON _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP _AO2_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP SHADOWS_SCREEN _AO2_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP _AO2_ON _DETAIL_MULX2 + passType: 4 + - keywords: DIRECTIONAL _AO2_ON _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL SHADOWS_SCREEN _AO2_ON _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL FOG_EXP2 SHADOWS_SCREEN _AO2_ON _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP _AO2_ON _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP SHADOWS_SCREEN _AO2_ON _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP _AO2_ON _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP SHADOWS_SCREEN _AO2_ON _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 _AO2_ON _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 SHADOWS_SCREEN _AO2_ON _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 SHADOWS_SHADOWMASK _AO2_ON _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 LIGHTMAP_SHADOW_MIXING SHADOWS_SCREEN SHADOWS_SHADOWMASK _AO2_ON _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP _PARALLAXMAP + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP _BUMPMODE_POM + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP SHADOWS_SCREEN _BUMPMODE_POM + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP LIGHTMAP_ON _BUMPMODE_POM + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP _DISSOLVE_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP _DISSOLVE_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP SHADOWS_SCREEN _DISSOLVE_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 LIGHTMAP_SHADOW_MIXING SHADOWS_SCREEN SHADOWS_SHADOWMASK _DISSOLVE_ON + passType: 4 + - keywords: DIRECTIONAL LIGHTMAP_ON _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A _TEAMCOLOR_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A _TEAMCOLOR_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP SHADOWS_SHADOWMASK _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A _TEAMCOLOR_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A _TEAMCOLOR_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 SHADOWS_SHADOWMASK _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A _TEAMCOLOR_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 LIGHTMAP_SHADOW_MIXING SHADOWS_SCREEN SHADOWS_SHADOWMASK _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A _TEAMCOLOR_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 SHADOWS_SHADOWMASK UNITY_SINGLE_PASS_STEREO _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A _TEAMCOLOR_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 LIGHTMAP_SHADOW_MIXING SHADOWS_SCREEN SHADOWS_SHADOWMASK UNITY_SINGLE_PASS_STEREO _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A _TEAMCOLOR_ON + passType: 4 + - keywords: SPOT + passType: 5 + - keywords: DIRECTIONAL + passType: 5 + - keywords: POINT_COOKIE + passType: 5 + - keywords: SHADOWS_DEPTH SHADOWS_SOFT SPOT + passType: 5 + - keywords: FOG_EXP2 POINT_COOKIE + passType: 5 + - keywords: FOG_EXP2 POINT UNITY_SINGLE_PASS_STEREO + passType: 5 + - keywords: FOG_EXP2 POINT_COOKIE UNITY_SINGLE_PASS_STEREO + passType: 5 + - keywords: SPOT _ALPHABLEND_ON + passType: 5 + - keywords: DIRECTIONAL _ALPHABLEND_ON + passType: 5 + - keywords: EFFECT_BUMP SPOT + passType: 5 + - keywords: DIRECTIONAL EFFECT_BUMP + passType: 5 + - keywords: EFFECT_BUMP POINT + passType: 5 + - keywords: EFFECT_BUMP POINT_COOKIE + passType: 5 + - keywords: EFFECT_BUMP SHADOWS_DEPTH SHADOWS_SOFT SPOT + passType: 5 + - keywords: EFFECT_BUMP POINT SHADOWS_CUBE SHADOWS_SOFT + passType: 5 + - keywords: EFFECT_BUMP FOG_EXP2 POINT + passType: 5 + - keywords: EFFECT_BUMP FOG_EXP2 POINT_COOKIE + passType: 5 + - keywords: EFFECT_BUMP FOG_EXP2 POINT UNITY_SINGLE_PASS_STEREO + passType: 5 + - keywords: EFFECT_BUMP FOG_EXP2 POINT_COOKIE UNITY_SINGLE_PASS_STEREO + passType: 5 + - keywords: EFFECT_BUMP SPOT _NORMALMAP + passType: 5 + - keywords: DIRECTIONAL EFFECT_BUMP _NORMALMAP + passType: 5 + - keywords: EFFECT_BUMP SHADOWS_DEPTH SHADOWS_SOFT SPOT _NORMALMAP + passType: 5 + - keywords: DIRECTIONAL EFFECT_BUMP _ALPHATEST_ON + passType: 5 + - keywords: EFFECT_BUMP SHADOWS_DEPTH SHADOWS_SOFT SPOT _ALPHATEST_ON + passType: 5 + - keywords: DIRECTIONAL EFFECT_BUMP _ALPHATEST_ON _NORMALMAP + passType: 5 + - keywords: EFFECT_BUMP SPOT _ALPHABLEND_ON + passType: 5 + - keywords: DIRECTIONAL EFFECT_BUMP _ALPHABLEND_ON + passType: 5 + - keywords: DIRECTIONAL EFFECT_BUMP _DETAIL_MULX2 + passType: 5 + - keywords: EFFECT_BUMP SHADOWS_DEPTH SHADOWS_SOFT SPOT _DETAIL_MULX2 + passType: 5 + - keywords: EFFECT_BUMP SPOT _ALPHAPREMULTIPLY_ON + passType: 5 + - keywords: DIRECTIONAL EFFECT_BUMP _ALPHAPREMULTIPLY_ON + passType: 5 + - keywords: EFFECT_BUMP POINT_COOKIE _ALPHAPREMULTIPLY_ON + passType: 5 + - keywords: EFFECT_BUMP FOG_EXP2 POINT UNITY_SINGLE_PASS_STEREO _ALPHAPREMULTIPLY_ON + passType: 5 + - keywords: EFFECT_BUMP FOG_EXP2 POINT_COOKIE UNITY_SINGLE_PASS_STEREO _ALPHAPREMULTIPLY_ON + passType: 5 + - keywords: DIRECTIONAL EFFECT_BUMP _ALPHAPREMULTIPLY_ON _NORMALMAP + passType: 5 + - keywords: SPOT _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 5 + - keywords: DIRECTIONAL _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 5 + - keywords: POINT _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 5 + - keywords: POINT_COOKIE _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 5 + - keywords: SHADOWS_DEPTH SHADOWS_SOFT SPOT _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 5 + - keywords: POINT SHADOWS_CUBE SHADOWS_SOFT _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 5 + - keywords: FOG_EXP2 SPOT _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 5 + - keywords: FOG_EXP2 POINT _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 5 + - keywords: FOG_EXP2 POINT_COOKIE _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 5 + - keywords: FOG_EXP2 SHADOWS_DEPTH SHADOWS_SOFT SPOT _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 5 + - keywords: FOG_EXP2 POINT UNITY_SINGLE_PASS_STEREO _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 5 + - keywords: FOG_EXP2 POINT_COOKIE UNITY_SINGLE_PASS_STEREO _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 5 + - keywords: SPOT _ALPHABLEND_ON _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 5 + - keywords: DIRECTIONAL _ALPHABLEND_ON _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 5 + - keywords: FOG_EXP2 POINT UNITY_SINGLE_PASS_STEREO _ALPHABLEND_ON _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 5 + - keywords: FOG_EXP2 POINT_COOKIE UNITY_SINGLE_PASS_STEREO _ALPHABLEND_ON _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 5 + - keywords: DIRECTIONAL _DETAIL_MULX2 _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 5 + - keywords: SHADOWS_DEPTH SHADOWS_SOFT SPOT _DETAIL_MULX2 _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 5 + - keywords: EFFECT_BUMP SPOT _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 5 + - keywords: DIRECTIONAL EFFECT_BUMP _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 5 + - keywords: EFFECT_BUMP POINT _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 5 + - keywords: EFFECT_BUMP POINT_COOKIE _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 5 + - keywords: EFFECT_BUMP SHADOWS_DEPTH SHADOWS_SOFT SPOT _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 5 + - keywords: EFFECT_BUMP POINT SHADOWS_CUBE SHADOWS_SOFT _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 5 + - keywords: EFFECT_BUMP FOG_EXP2 POINT _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 5 + - keywords: EFFECT_BUMP FOG_EXP2 POINT_COOKIE _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 5 + - keywords: EFFECT_BUMP FOG_EXP2 POINT UNITY_SINGLE_PASS_STEREO _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 5 + - keywords: EFFECT_BUMP FOG_EXP2 POINT_COOKIE UNITY_SINGLE_PASS_STEREO _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 5 + - keywords: EFFECT_BUMP SPOT _DETAIL_MULX2 _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 5 + - keywords: DIRECTIONAL EFFECT_BUMP _DETAIL_MULX2 _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 5 + - keywords: EFFECT_BUMP SHADOWS_DEPTH SHADOWS_SOFT SPOT _DETAIL_MULX2 _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 5 + - keywords: DIRECTIONAL EFFECT_BUMP _DETAIL_MULX2 _NORMALMAP _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 5 + - keywords: DIRECTIONAL EFFECT_BUMP _DECAL_ON + passType: 5 + - keywords: DIRECTIONAL EFFECT_BUMP _DECAL_ON _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 5 + - keywords: EFFECT_BUMP SHADOWS_DEPTH SHADOWS_SOFT SPOT _DECAL_ON _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 5 + - keywords: EFFECT_BUMP POINT SHADOWS_CUBE SHADOWS_SOFT _DECAL_ON _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 5 + - keywords: EFFECT_BUMP SPOT _AO2_ON + passType: 5 + - keywords: DIRECTIONAL EFFECT_BUMP _AO2_ON + passType: 5 + - keywords: EFFECT_BUMP SHADOWS_DEPTH SHADOWS_SOFT SPOT _AO2_ON + passType: 5 + - keywords: DIRECTIONAL EFFECT_BUMP _AO2_ON _DETAIL_MULX2 + passType: 5 + - keywords: DIRECTIONAL _AO2_ON _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 5 + - keywords: DIRECTIONAL EFFECT_BUMP _PARALLAXMAP + passType: 5 + - keywords: DIRECTIONAL EFFECT_BUMP _BUMPMODE_POM + passType: 5 + - keywords: EFFECT_BUMP SHADOWS_DEPTH SHADOWS_SOFT SPOT _BUMPMODE_POM + passType: 5 + - keywords: EFFECT_BUMP SPOT _DISSOLVE_ON + passType: 5 + - keywords: DIRECTIONAL EFFECT_BUMP _DISSOLVE_ON + passType: 5 + - keywords: EFFECT_BUMP SHADOWS_DEPTH SHADOWS_SOFT SPOT _DISSOLVE_ON + passType: 5 + - keywords: DIRECTIONAL EFFECT_BUMP _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A _TEAMCOLOR_ON + passType: 5 + - keywords: EFFECT_BUMP POINT_COOKIE _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A _TEAMCOLOR_ON + passType: 5 + - keywords: EFFECT_BUMP FOG_EXP2 POINT _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A _TEAMCOLOR_ON + passType: 5 + - keywords: EFFECT_BUMP FOG_EXP2 POINT_COOKIE _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A _TEAMCOLOR_ON + passType: 5 + - keywords: EFFECT_BUMP FOG_EXP2 POINT UNITY_SINGLE_PASS_STEREO _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A _TEAMCOLOR_ON + passType: 5 + - keywords: EFFECT_BUMP FOG_EXP2 POINT_COOKIE UNITY_SINGLE_PASS_STEREO _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A _TEAMCOLOR_ON + passType: 5 + - keywords: SHADOWS_DEPTH + passType: 8 + - keywords: SHADOWS_CUBE + passType: 8 + - keywords: SHADOWS_DEPTH UNITY_SINGLE_PASS_STEREO + passType: 8 + - keywords: SHADOWS_DEPTH _ALPHATEST_ON + passType: 8 + - keywords: SHADOWS_DEPTH _ALPHABLEND_ON + passType: 8 + - keywords: SHADOWS_DEPTH _ALPHAPREMULTIPLY_ON + passType: 8 + - keywords: SHADOWS_DEPTH _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 8 + - keywords: SHADOWS_CUBE _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 8 + - keywords: SHADOWS_DEPTH UNITY_SINGLE_PASS_STEREO _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 8 + - keywords: SHADOWS_DEPTH _ALPHABLEND_ON _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 8 + - keywords: SHADOWS_DEPTH _ALPHAPREMULTIPLY_ON _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 8 + - keywords: SHADOWS_DEPTH _DISSOLVE_ON + passType: 8 + - keywords: + passType: 11 + - keywords: _NORMALMAP + passType: 11 + - keywords: _DETAIL_MULX2 + passType: 11 + - keywords: _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 11 + - keywords: _EMISSION _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 11 + - keywords: _DETAIL_MULX2 _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 11 + - keywords: _DECAL_ON _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 11 + - keywords: _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A _TEAMCOLOR_ON + passType: 11 + - first: {fileID: 4800000, guid: 470919d76f297c440a5abb51c0f7eff7, type: 3} + second: + variants: + - keywords: + passType: 0 + - first: {fileID: 4800000, guid: 2369f73e8fbb97948964485f4fcd304c, type: 3} + second: + variants: + - keywords: DIRECTIONAL EFFECT_BUMP + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP SHADOWS_SCREEN + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP SHADOWS_SCREEN + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 SHADOWS_SCREEN + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 SHADOWS_SHADOWMASK + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 LIGHTMAP_SHADOW_MIXING SHADOWS_SCREEN SHADOWS_SHADOWMASK + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP _NORMALMAP + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP SHADOWS_SCREEN _NORMALMAP + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP _NORMALMAP + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP SHADOWS_SCREEN _NORMALMAP + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 _NORMALMAP + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 SHADOWS_SCREEN _NORMALMAP + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 SHADOWS_SHADOWMASK _NORMALMAP + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 LIGHTMAP_SHADOW_MIXING SHADOWS_SCREEN SHADOWS_SHADOWMASK _NORMALMAP + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP _DETAIL_MULX2 + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP _AO2_ON + passType: 4 + - keywords: EFFECT_BUMP SPOT + passType: 5 + - keywords: DIRECTIONAL EFFECT_BUMP + passType: 5 + - keywords: EFFECT_BUMP SHADOWS_DEPTH SHADOWS_SOFT SPOT + passType: 5 + - keywords: DIRECTIONAL EFFECT_BUMP _NORMALMAP + passType: 5 + - keywords: DIRECTIONAL EFFECT_BUMP _DETAIL_MULX2 + passType: 5 + - keywords: EFFECT_BUMP SHADOWS_DEPTH SHADOWS_SOFT SPOT _DETAIL_MULX2 + passType: 5 + - keywords: DIRECTIONAL EFFECT_BUMP _AO2_ON + passType: 5 + - keywords: SHADOWS_DEPTH + passType: 8 + - first: {fileID: 4800000, guid: 0eef33ec576d0d840af4de1e8bc5ade1, type: 3} + second: + variants: + - keywords: + passType: 0 + - first: {fileID: 4800000, guid: 1c6c999986d0bd347928a5f6e32288b8, type: 3} + second: + variants: + - keywords: DIRECTIONAL + passType: 4 + - keywords: DIRECTIONAL + passType: 5 + - first: {fileID: 4800000, guid: f8bfe4ef7ed49b94d89bf9453ce73085, type: 3} + second: + variants: + - keywords: + passType: 0 + - first: {fileID: 4800000, guid: 8a84684c0672ff84ca58e8a89993ba95, type: 3} + second: + variants: + - keywords: + passType: 0 + - keywords: FOG_EXP + passType: 0 + - keywords: FOG_EXP2 + passType: 0 + - keywords: FOG_EXP2 UNITY_SINGLE_PASS_STEREO + passType: 0 + - keywords: _RIM_FADE_ON + passType: 0 + - keywords: FOG_EXP2 _RIM_FADE_ON + passType: 0 + - keywords: FOG_EXP2 UNITY_SINGLE_PASS_STEREO _RIM_FADE_ON + passType: 0 + - keywords: _PARTICLE_EFFECTS_ON + passType: 0 + - keywords: _PARTICLE_EFFECTS_ON _RIM_FADE_ON + passType: 0 + - first: {fileID: 4800000, guid: 8f9324d49ecc40c4e939ad8ec95513f4, type: 3} + second: + variants: + - keywords: DIRECTIONAL + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP _DETAIL_MULX2 + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP SHADOWS_SCREEN _DETAIL_MULX2 + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 _DETAIL_MULX2 + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 SHADOWS_SCREEN _DETAIL_MULX2 + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 SHADOWS_SHADOWMASK _DETAIL_MULX2 + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 LIGHTMAP_SHADOW_MIXING SHADOWS_SCREEN SHADOWS_SHADOWMASK _DETAIL_MULX2 + passType: 4 + - keywords: DIRECTIONAL _RIM_ON + passType: 4 + - keywords: DIRECTIONAL SHADOWS_SCREEN _RIM_ON + passType: 4 + - keywords: DIRECTIONAL FOG_EXP2 _RIM_ON + passType: 4 + - keywords: DIRECTIONAL FOG_EXP2 SHADOWS_SCREEN _RIM_ON + passType: 4 + - keywords: DIRECTIONAL FOG_EXP2 SHADOWS_SHADOWMASK _RIM_ON + passType: 4 + - keywords: DIRECTIONAL FOG_EXP2 LIGHTMAP_SHADOW_MIXING SHADOWS_SCREEN SHADOWS_SHADOWMASK _RIM_ON + passType: 4 + - keywords: DIRECTIONAL _ALPHAPREMULTIPLY_ON _RIM_ON + passType: 4 + - keywords: DIRECTIONAL FOG_EXP2 _ALPHAPREMULTIPLY_ON _RIM_ON + passType: 4 + - keywords: DIRECTIONAL FOG_EXP2 SHADOWS_SHADOWMASK _ALPHAPREMULTIPLY_ON _RIM_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP _RIM_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP SHADOWS_SCREEN _RIM_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 _RIM_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 SHADOWS_SCREEN _RIM_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 SHADOWS_SHADOWMASK _RIM_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 LIGHTMAP_SHADOW_MIXING SHADOWS_SCREEN SHADOWS_SHADOWMASK _RIM_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP _DETAIL_MULX2 _RIM_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP SHADOWS_SCREEN _DETAIL_MULX2 _RIM_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP _DETAIL_MULX2 _RIM_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP SHADOWS_SCREEN _DETAIL_MULX2 _RIM_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 _DETAIL_MULX2 _RIM_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 SHADOWS_SCREEN _DETAIL_MULX2 _RIM_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 SHADOWS_SHADOWMASK _DETAIL_MULX2 _RIM_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 LIGHTMAP_SHADOW_MIXING SHADOWS_SCREEN SHADOWS_SHADOWMASK _DETAIL_MULX2 _RIM_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP _AO2_ON + passType: 4 + - keywords: DIRECTIONAL + passType: 5 + - keywords: DIRECTIONAL EFFECT_BUMP + passType: 5 + - keywords: DIRECTIONAL EFFECT_BUMP _DETAIL_MULX2 + passType: 5 + - keywords: DIRECTIONAL EFFECT_BUMP _AO2_ON + passType: 5 + - keywords: SHADOWS_DEPTH + passType: 8 + - keywords: SHADOWS_DEPTH _ALPHAPREMULTIPLY_ON + passType: 8 + - first: {fileID: 4800000, guid: e1efb5145cf7dfe4ab80ca6f8c883b9e, type: 3} + second: + variants: + - keywords: DIRECTIONAL + passType: 4 + - keywords: DIRECTIONAL SHADOWS_SHADOWMASK + passType: 4 + - keywords: DIRECTIONAL FOG_EXP + passType: 4 + - keywords: DIRECTIONAL FOG_EXP2 + passType: 4 + - keywords: DIRECTIONAL FOG_EXP2 SHADOWS_SHADOWMASK + passType: 4 + - keywords: DIRECTIONAL VERTEXLIGHT_ON + passType: 4 + - keywords: DIRECTIONAL FOG_EXP2 SHADOWS_SHADOWMASK UNITY_SINGLE_PASS_STEREO + passType: 4 + - first: {fileID: 4800000, guid: 903ab828a6b6874418e58457ca30b9e9, type: 3} + second: + variants: + - keywords: + passType: 0 + - keywords: FOG_EXP + passType: 0 + - keywords: FOG_EXP2 + passType: 0 + - keywords: FOG_EXP2 UNITY_SINGLE_PASS_STEREO + passType: 0 + - first: {fileID: 4800000, guid: 7aff51f1783515342b81900b7d1e45d8, type: 3} + second: + variants: + - keywords: + passType: 0 + - keywords: _RIM_FADE_ON + passType: 0 + - first: {fileID: 4800000, guid: 93fab51258431da46b091291c103d80d, type: 3} + second: + variants: + - keywords: + passType: 0 + - first: {fileID: 4800000, guid: 6879bdef54dbe5f449f13869e8dae30a, type: 3} + second: + variants: + - keywords: + passType: 4 + - keywords: FOG_EXP + passType: 4 + - keywords: FOG_EXP2 + passType: 4 + - keywords: _ALPHATEST_ON + passType: 4 + - keywords: FOG_EXP2 _ALPHATEST_ON + passType: 4 + - keywords: _ALPHABLEND_ON + passType: 4 + - keywords: FOG_EXP2 _ALPHABLEND_ON + passType: 4 + - keywords: _ALPHAPREMULTIPLY_ON + passType: 4 + - keywords: EFFECT_BUMP + passType: 4 + - keywords: EFFECT_BUMP FOG_EXP + passType: 4 + - keywords: EFFECT_BUMP FOG_EXP2 + passType: 4 + - keywords: EFFECT_BUMP _EMISSION + passType: 4 + - keywords: EFFECT_BUMP FOG_EXP2 UNITY_SINGLE_PASS_STEREO + passType: 4 + - keywords: EFFECT_BUMP _ALPHATEST_ON + passType: 4 + - keywords: EFFECT_BUMP _ALPHABLEND_ON + passType: 4 + - keywords: EFFECT_BUMP _ALPHAPREMULTIPLY_ON + passType: 4 + - keywords: EFFECT_BUMP FOG_EXP2 _ALPHAPREMULTIPLY_ON + passType: 4 + - keywords: _ALPHABLEND_ON _RIM_ON + passType: 4 + - keywords: EFFECT_BUMP _RIM_ON + passType: 4 + - keywords: EFFECT_BUMP _ALPHAPREMULTIPLY_ON _RIM_ON + passType: 4 + - keywords: SHADOWS_DEPTH + passType: 8 + - keywords: SHADOWS_DEPTH UNITY_SINGLE_PASS_STEREO + passType: 8 + - keywords: SHADOWS_DEPTH _ALPHATEST_ON + passType: 8 + - keywords: SHADOWS_DEPTH _ALPHABLEND_ON + passType: 8 + - keywords: SHADOWS_DEPTH _ALPHAPREMULTIPLY_ON + passType: 8 + - keywords: + passType: 11 + - first: {fileID: 4800000, guid: 02fc53e3769b9d3498006d7a420f6662, type: 3} + second: + variants: + - keywords: DIRECTIONAL EFFECT_BUMP + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP SHADOWS_SCREEN _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP _NORMALMAP _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP _DECAL_ON _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL DIRLIGHTMAP_COMBINED EFFECT_BUMP LIGHTMAP_ON _DECAL_ON _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP _DECAL_ON _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP + passType: 5 + - keywords: EFFECT_BUMP SPOT _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 5 + - keywords: DIRECTIONAL EFFECT_BUMP _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 5 + - keywords: EFFECT_BUMP POINT _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 5 + - keywords: EFFECT_BUMP SHADOWS_DEPTH SHADOWS_SOFT SPOT _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 5 + - keywords: DIRECTIONAL EFFECT_BUMP _NORMALMAP _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 5 + - keywords: DIRECTIONAL EFFECT_BUMP _DECAL_ON _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 5 + - keywords: EFFECT_BUMP POINT SHADOWS_CUBE SHADOWS_SOFT _DECAL_ON _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 5 + - keywords: SHADOWS_DEPTH + passType: 8 + - keywords: SHADOWS_DEPTH _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 8 + - keywords: SHADOWS_CUBE _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 8 + - keywords: _DECAL_ON _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 11 + - first: {fileID: 4800000, guid: f51491933db6f804d81c75bcbbc51000, type: 3} + second: + variants: + - keywords: + passType: 0 + - first: {fileID: 4800000, guid: 5127c1e2fc89a9640a64bb2733281603, type: 3} + second: + variants: + - keywords: + passType: 0 + - first: {fileID: 4800000, guid: dfd7de53dd608364c95ec3a24e271f32, type: 3} + second: + variants: + - keywords: + passType: 0 + - first: {fileID: 4800000, guid: af2c19d947b1e104297cf1888dbf483c, type: 3} + second: + variants: + - keywords: + passType: 0 + - first: {fileID: 4800000, guid: 08eb4d032d8439b45914f90c29e02c35, type: 3} + second: + variants: + - keywords: + passType: 0 + - first: {fileID: 4800000, guid: 1214f317505237b4a837eab90223a7a8, type: 3} + second: + variants: + - keywords: + passType: 0 + - first: {fileID: 4800000, guid: 02b434d0e3e677c44bc989c6a6719373, type: 3} + second: + variants: + - keywords: + passType: 0 + - keywords: UNITY_SINGLE_PASS_STEREO + passType: 0 + - first: {fileID: 4800000, guid: 9b7c90e73e21dee4284e9e87723a5c52, type: 3} + second: + variants: + - keywords: + passType: 0 + - first: {fileID: 4800000, guid: fca0cb1ed0b769544bf853528647b628, type: 3} + second: + variants: + - keywords: DIRECTIONAL + passType: 4 + - first: {fileID: 4800000, guid: decb76a408bd9fb4bbef941718abbc43, type: 3} + second: + variants: + - keywords: + passType: 0 + - first: {fileID: 4800000, guid: 86aa37f3ccfd0ce49beb9f6f7895792f, type: 3} + second: + variants: + - keywords: DIRECTIONAL + passType: 4 + - first: {fileID: 4800000, guid: 34d553b5440e9034e953dc524ded7f9e, type: 3} + second: + variants: + - keywords: DIRECTIONAL _DISSOLVE_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP _DISSOLVE_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP SHADOWS_SCREEN _DISSOLVE_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 _DISSOLVE_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 SHADOWS_SCREEN _DISSOLVE_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 SHADOWS_SHADOWMASK _DISSOLVE_ON + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP FOG_EXP2 LIGHTMAP_SHADOW_MIXING SHADOWS_SCREEN SHADOWS_SHADOWMASK _DISSOLVE_ON + passType: 4 + - keywords: DIRECTIONAL _DISSOLVE_ON _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL _DISSOLVE_ON + passType: 5 + - keywords: DIRECTIONAL EFFECT_BUMP _DISSOLVE_ON + passType: 5 + - keywords: DIRECTIONAL _DISSOLVE_ON _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 5 + - keywords: SHADOWS_DEPTH _DISSOLVE_ON + passType: 8 + - keywords: SHADOWS_DEPTH _DISSOLVE_ON _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 8 + - first: {fileID: 4800000, guid: 9917cc9bc27772a44a5f679fbb650ee4, type: 3} + second: + variants: + - keywords: + passType: 0 + - first: {fileID: 4800000, guid: 1bb3c517aa5c17347a03ac72dcee5dc4, type: 3} + second: + variants: + - keywords: + passType: 0 + - first: {fileID: 4800000, guid: 5c50eed50420f9b4db934ca3141f2bb0, type: 3} + second: + variants: + - keywords: + passType: 0 + - first: {fileID: 4800000, guid: 133a25c049b14ac41b883f5b48f7ef53, type: 3} + second: + variants: + - keywords: + passType: 0 + - first: {fileID: 4800000, guid: e6dfc64fcd8f5d248890f29d9299443e, type: 3} + second: + variants: + - keywords: + passType: 0 + - keywords: INSTA_OLD + passType: 0 + - first: {fileID: 4800000, guid: 14d797b3dd388e24bbebd0785b6b4653, type: 3} + second: + variants: + - keywords: DIRECTIONAL EFFECT_BUMP _ALPHABLEND_ON _DIRECTIONALBLENDMODE_WORLD _EMISSION + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP _ALPHABLEND_ON _DIRECTIONALBLENDMODE_WORLD + passType: 5 + - keywords: SHADOWS_DEPTH _ALPHABLEND_ON + passType: 8 + - first: {fileID: 4800000, guid: 1296886b256483d4e89ad13027f4a1eb, type: 3} + second: + variants: + - keywords: SHADOWS_DEPTH + passType: 8 + - first: {fileID: 4800000, guid: ece0d552a2d2ddf479abb76766cf2064, type: 3} + second: + variants: + - keywords: DIRECTIONAL + passType: 4 + - keywords: DIRECTIONAL SHADOWS_SCREEN + passType: 4 + - keywords: DIRECTIONAL _DETAIL_MULX2 + passType: 4 + - keywords: DIRECTIONAL SHADOWS_SCREEN _TERRAIN_NORMAL_MAP + passType: 4 + - keywords: SPOT + passType: 5 + - keywords: DIRECTIONAL + passType: 5 + - keywords: SHADOWS_DEPTH SHADOWS_SOFT SPOT + passType: 5 + - keywords: DIRECTIONAL _DETAIL_MULX2 + passType: 5 + - keywords: SHADOWS_DEPTH SHADOWS_SOFT SPOT _TERRAIN_NORMAL_MAP + passType: 5 + - keywords: SHADOWS_DEPTH + passType: 8 + - first: {fileID: 4800000, guid: ea289a82494c96147848cd0fd4d31b17, type: 3} + second: + variants: + - keywords: DIRECTIONAL + passType: 4 + - first: {fileID: 4800000, guid: b34b7504d0cffca47b5f8fadf05aa8b4, type: 3} + second: + variants: + - keywords: DIRECTIONAL + passType: 4 + - keywords: SHADOWS_DEPTH + passType: 8 + - first: {fileID: 4800000, guid: f29d4153b5e0ca8498d9aa6f258fdf0d, type: 3} + second: + variants: + - keywords: DIRECTIONAL + passType: 4 + - first: {fileID: 4800000, guid: c3920c1337019354d82b933cc1ddfac5, type: 3} + second: + variants: + - keywords: + passType: 0 + - first: {fileID: 4800000, guid: bf3a49a5dfacce447bdd63290457314f, type: 3} + second: + variants: + - keywords: + passType: 0 + - first: {fileID: 4800000, guid: 953813e8e19baf64796cb1babff0696e, type: 3} + second: + variants: + - keywords: + passType: 0 + - first: {fileID: 4800000, guid: 4f19b8eb33e1f85429fad2aed7e24712, type: 3} + second: + variants: + - keywords: + passType: 0 + - keywords: SHADOWS_DEPTH + passType: 8 + - first: {fileID: 4800000, guid: 6ced19f459f4a6d428553bfc1e22684b, type: 3} + second: + variants: + - keywords: DIRECTIONAL + passType: 4 + - keywords: DIRECTIONAL + passType: 5 + - keywords: SHADOWS_DEPTH + passType: 8 + - first: {fileID: 4800000, guid: 763cadd883886f14c97e8c8e1ba7bbd0, type: 3} + second: + variants: + - keywords: DIRECTIONAL + passType: 4 + - keywords: DIRECTIONAL + passType: 5 + - first: {fileID: 4800000, guid: 54929a8145ee83a43be090d830ba50c9, type: 3} + second: + variants: + - keywords: DIRECTIONAL + passType: 4 + - keywords: DIRECTIONAL + passType: 5 + - first: {fileID: 4800000, guid: 1cede42dd6343ac44a91a72430e330ab, type: 3} + second: + variants: + - keywords: + passType: 0 + - first: {fileID: 4800000, guid: f43977a149f0e404ea2abee650aaf151, type: 3} + second: + variants: + - keywords: + passType: 0 + - first: {fileID: 66, guid: 0000000000000000f000000000000000, type: 0} + second: + variants: + - keywords: + passType: 0 + - keywords: UNITY_SINGLE_PASS_STEREO + passType: 0 + - first: {fileID: 64, guid: 0000000000000000f000000000000000, type: 0} + second: + variants: + - keywords: SHADOWS_SPLIT_SPHERES + passType: 0 + - keywords: SHADOWS_SINGLE_CASCADE SHADOWS_SPLIT_SPHERES + passType: 0 + - keywords: SHADOWS_SINGLE_CASCADE SHADOWS_SPLIT_SPHERES UNITY_SINGLE_PASS_STEREO + passType: 0 + - first: {fileID: 9000, guid: 0000000000000000f000000000000000, type: 0} + second: + variants: + - keywords: + passType: 0 + - first: {fileID: 9001, guid: 0000000000000000f000000000000000, type: 0} + second: + variants: + - keywords: + passType: 0 + - first: {fileID: 9002, guid: 0000000000000000f000000000000000, type: 0} + second: + variants: + - keywords: + passType: 0 + - first: {fileID: 9003, guid: 0000000000000000f000000000000000, type: 0} + second: + variants: + - keywords: + passType: 0 + - first: {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0} + second: + variants: + - keywords: + passType: 0 + - first: {fileID: 4800000, guid: 22a545b3a625245499fe0bbcfab1cc20, type: 3} + second: + variants: + - keywords: DIRECTIONAL EFFECT_BUMP GEOM_TYPE_BRANCH + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP GEOM_TYPE_LEAF + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP GEOM_TYPE_FROND + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP EFFECT_HUE_VARIATION GEOM_TYPE_BRANCH + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP EFFECT_HUE_VARIATION GEOM_TYPE_LEAF + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP GEOM_TYPE_BRANCH + passType: 5 + - keywords: DIRECTIONAL EFFECT_BUMP GEOM_TYPE_LEAF + passType: 5 + - keywords: DIRECTIONAL EFFECT_BUMP GEOM_TYPE_FROND + passType: 5 + - keywords: DIRECTIONAL EFFECT_BUMP EFFECT_HUE_VARIATION GEOM_TYPE_BRANCH + passType: 5 + - keywords: DIRECTIONAL EFFECT_BUMP EFFECT_HUE_VARIATION GEOM_TYPE_LEAF + passType: 5 + - keywords: GEOM_TYPE_BRANCH SHADOWS_DEPTH + passType: 8 + - keywords: GEOM_TYPE_LEAF SHADOWS_DEPTH + passType: 8 + - keywords: GEOM_TYPE_FROND SHADOWS_DEPTH + passType: 8 + - first: {fileID: 4800000, guid: 5f6608b739d16cc47a9a06e34b6bb629, type: 3} + second: + variants: + - keywords: DIRECTIONAL _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A _TRIPLANARMODE_WORLD + passType: 4 + - keywords: DIRECTIONAL SHADOWS_SCREEN _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A _TRIPLANARMODE_WORLD + passType: 4 + - keywords: DIRECTIONAL FOG_EXP2 SHADOWS_SCREEN _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A _TRIPLANARMODE_WORLD + passType: 4 + - keywords: DIRECTIONAL _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A _SPECGLOSSMAP _TRIPLANARMODE_WORLD + passType: 4 + - keywords: DIRECTIONAL SHADOWS_SCREEN _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A _SPECGLOSSMAP _TRIPLANARMODE_WORLD + passType: 4 + - keywords: DIRECTIONAL FOG_EXP2 _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A _SPECGLOSSMAP _TRIPLANARMODE_WORLD + passType: 4 + - keywords: DIRECTIONAL FOG_EXP2 SHADOWS_SCREEN _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A _SPECGLOSSMAP _TRIPLANARMODE_WORLD + passType: 4 + - keywords: DIRECTIONAL _NORMALMAP _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A _SPECGLOSSMAP _TRIPLANARMODE_WORLD + passType: 4 + - keywords: DIRECTIONAL SHADOWS_SCREEN _NORMALMAP _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A _SPECGLOSSMAP _TRIPLANARMODE_WORLD + passType: 4 + - keywords: DIRECTIONAL _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A _TRIPLANARMODE_WORLD + passType: 5 + - keywords: DIRECTIONAL _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A _SPECGLOSSMAP _TRIPLANARMODE_WORLD + passType: 5 + - keywords: FOG_EXP2 POINT _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A _SPECGLOSSMAP _TRIPLANARMODE_WORLD + passType: 5 + - keywords: DIRECTIONAL _NORMALMAP _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A _SPECGLOSSMAP _TRIPLANARMODE_WORLD + passType: 5 + - keywords: SHADOWS_DEPTH _TRIPLANARMODE_WORLD + passType: 8 + - keywords: SHADOWS_DEPTH _SPECGLOSSMAP _TRIPLANARMODE_WORLD + passType: 8 + - first: {fileID: 4800000, guid: 9f5e5f3f424d9474982c98c7660222b8, type: 3} + second: + variants: + - keywords: DIRECTIONAL _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL SHADOWS_SCREEN _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL FOG_EXP _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL FOG_EXP SHADOWS_SCREEN _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 5 + - keywords: SHADOWS_DEPTH _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 8 + - first: {fileID: 4800000, guid: ed250f21a685a37489fc5698ae562ad0, type: 3} + second: + variants: + - keywords: DIRECTIONAL EFFECT_BUMP + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP SHADOWS_SCREEN _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP + passType: 5 + - keywords: DIRECTIONAL EFFECT_BUMP _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 5 + - keywords: SHADOWS_DEPTH + passType: 8 + - keywords: SHADOWS_DEPTH _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + passType: 8 + - first: {fileID: 4800000, guid: 2125f4bf302f62743afb691451f8289a, type: 3} + second: + variants: + - keywords: DIRECTIONAL _ALPHATEST_ON + passType: 4 + - keywords: DIRECTIONAL SHADOWS_SCREEN _ALPHATEST_ON + passType: 4 + - keywords: DIRECTIONAL FOG_EXP2 _ALPHATEST_ON + passType: 4 + - keywords: DIRECTIONAL FOG_EXP2 SHADOWS_SCREEN _ALPHATEST_ON + passType: 4 + - keywords: SHADOWS_DEPTH _ALPHATEST_ON + passType: 8 + - first: {fileID: 4800000, guid: 670c4ff875a0d0646b8bc975d8622ee8, type: 3} + second: + variants: + - keywords: + passType: 0 + - first: {fileID: 4800000, guid: bbeafc8974a3e454bb3f29e819a334a2, type: 3} + second: + variants: + - keywords: DIRECTIONAL EFFECT_BUMP _TRIPLANARMODE_WORLD + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP SHADOWS_SCREEN _TRIPLANARMODE_WORLD + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP LIGHTMAP_ON SHADOWS_SCREEN _TRIPLANARMODE_WORLD + passType: 4 + - keywords: DIRECTIONAL EFFECT_BUMP SHADOWS_SCREEN _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A _TRIPLANARMODE_WORLD + passType: 4 + - keywords: DIRECTIONAL _SECONDARY_TRIPLANAR_ON _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A _TERTIARY_TRIPLANAR_ON _TRIPLANARMODE_WORLD + passType: 4 + - keywords: DIRECTIONAL _SECONDARY_TRIPLANAR_ON _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A _TERTIARY_TRIPLANAR_ON _TRIPLANARMODE_WORLD + passType: 5 + - keywords: SHADOWS_DEPTH _TRIPLANARMODE_WORLD + passType: 8 + - keywords: SHADOWS_DEPTH _SECONDARY_TRIPLANAR_ON _TERTIARY_TRIPLANAR_ON _TRIPLANARMODE_WORLD + passType: 8 + - keywords: _TRIPLANARMODE_WORLD + passType: 11 + - first: {fileID: 4800000, guid: 42d945f1d75aef446a00e99986ca7e35, type: 3} + second: + variants: + - keywords: FINALPASS + passType: 0 + - keywords: BLOOM FINALPASS + passType: 0 + - keywords: BLOOM COLOR_GRADING_HDR_3D FINALPASS + passType: 0 + - keywords: BLOOM COLOR_GRADING_HDR_3D FINALPASS UNITY_SINGLE_PASS_STEREO + passType: 0 + - first: {fileID: 4800000, guid: 356058d37b077584bb7214d4531cb628, type: 3} + second: + variants: + - keywords: + passType: 0 + - keywords: UNITY_SINGLE_PASS_STEREO + passType: 0 + - first: {fileID: 4800000, guid: afef18b7456431b4fac1f4c2bd1f2e9a, type: 3} + second: + variants: + - keywords: + passType: 0 + - keywords: APPLY_FORWARD_FOG FOG_EXP + passType: 0 + - keywords: APPLY_FORWARD_FOG FOG_EXP2 + passType: 0 + - first: {fileID: 4800000, guid: 71cdbed0d00a596468b4f92db5fd4152, type: 3} + second: + variants: + - keywords: + passType: 0 + - keywords: UNITY_SINGLE_PASS_STEREO + passType: 0 diff --git a/Assets/Alloy/ShaderVariantCollection/H3_ShaderAsset3.shadervariants.meta b/Assets/Alloy/ShaderVariantCollection/H3_ShaderAsset3.shadervariants.meta new file mode 100644 index 0000000..78efee6 --- /dev/null +++ b/Assets/Alloy/ShaderVariantCollection/H3_ShaderAsset3.shadervariants.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 3a459384e2e4c82418fa885241e4424a +timeCreated: 1632871520 +licenseType: Free +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 20000000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders.meta b/Assets/Alloy/Shaders.meta new file mode 100644 index 0000000..db9bd69 --- /dev/null +++ b/Assets/Alloy/Shaders.meta @@ -0,0 +1,6 @@ +fileFormatVersion: 2 +guid: 3fb7c2b24a180544abbabf0f66276936 +folderAsset: yes +DefaultImporter: + userData: + assetBundleName: diff --git a/Assets/Alloy/Shaders/3.0.meta b/Assets/Alloy/Shaders/3.0.meta new file mode 100644 index 0000000..f349182 --- /dev/null +++ b/Assets/Alloy/Shaders/3.0.meta @@ -0,0 +1,6 @@ +fileFormatVersion: 2 +guid: 2ed21286fabab314ca3a5d6d37477890 +folderAsset: yes +DefaultImporter: + userData: + assetBundleName: diff --git a/Assets/Alloy/Shaders/3.0/Core.meta b/Assets/Alloy/Shaders/3.0/Core.meta new file mode 100644 index 0000000..e86d62f --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Core.meta @@ -0,0 +1,6 @@ +fileFormatVersion: 2 +guid: 5d8f95789bdeb8349abc933232933bd2 +folderAsset: yes +DefaultImporter: + userData: + assetBundleName: diff --git a/Assets/Alloy/Shaders/3.0/Core/Core.shader b/Assets/Alloy/Shaders/3.0/Core/Core.shader new file mode 100644 index 0000000..56e6ce4 --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Core/Core.shader @@ -0,0 +1,363 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Core" { +Properties { + // Global Settings + _Mode ("'Rendering Mode' {RenderingMode:{Opaque:{_Cutoff}, Cutout:{}, Fade:{_Cutoff}, Transparent:{_Cutoff}}}", Float) = 0 + _SrcBlend ("__src", Float) = 0 + _DstBlend ("__dst", Float) = 0 + _ZWrite ("__zw", Float) = 1 + [LM_TransparencyCutOff] + _Cutoff ("'Opacity Cutoff' {Min:0, Max:1}", Float) = 0.5 + [Toggle(EFFECT_BUMP)] + _HasBumpMap ("'Normals Source' {Dropdown:{VertexNormals:{_BumpMap,_BumpScale,_DetailNormalMap,_DetailNormalMapScale,_WetNormalMap,_WetNormalMapScale}, NormalMaps:{}}}", Float) = 1 + [Toggle(_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A)] + _MainRoughnessSource ("'Roughness Source' {Dropdown:{PackedMapAlpha:{}, BaseColorAlpha:{_SpecTex,_Occlusion}}}", Float) = 0 + + // Main Textures + _MainTextures ("'Main Textures' {Section:{Color:0}}", Float) = 0 + [LM_Albedo] [LM_Transparency] + _Color ("'Tint' {}", Color) = (1,1,1,1) + [LM_MasterTilingOffset] [LM_Albedo] + _MainTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _MainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _MainTexUV ("UV Set", Float) = 0 + [LM_Metallic] + _SpecTex ("'Metal(R) AO(G) Spec(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_MainTex}", 2D) = "white" {} + [LM_NormalMap] + _BumpMap ("'Normals' {Visualize:{NRM}, Parent:_MainTex}", 2D) = "bump" {} + _BaseColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Main Properties + _MainPhysicalProperties ("'Main Properties' {Section:{Color:1}}", Float) = 0 + [LM_Metallic] + _Metal ("'Metallic' {Min:0, Max:1}", Float) = 1 + _Specularity ("'Specularity' {Min:0, Max:1}", Float) = 1 + _SpecularTint ("'Specular Tint' {Min:0, Max:1}", Float) = 0 + _Roughness ("'Roughness' {Min:0, Max:1}", Float) = 1 + _Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _BumpScale ("'Normal Strength' {}", Float) = 1 + + // Parallax + [Toggle(_PARALLAXMAP)] + _ParallaxT ("'Parallax' {Feature:{Color:5}}", Float) = 0 + [Toggle(_BUMPMODE_POM)] + _BumpMode ("'Mode' {Dropdown:{Parallax:{_MinSamples, _MaxSamples}, POM:{}}}", Float) = 0 + _ParallaxMap ("'Heightmap(G)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "black" {} + _Parallax ("'Height' {Min:0, Max:0.08}", Float) = 0.02 + _MinSamples ("'Min Samples' {Min:1}", Float) = 4 + _MaxSamples ("'Max Samples' {Min:1}", Float) = 20 + + // AO2 + [Toggle(_AO2_ON)] + _AO2 ("'AO2' {Feature:{Color:6}}", Float) = 0 + _Ao2Map ("'AO2(G)' {Visualize:{RGB}}", 2D) = "white" {} + _Ao2MapUV ("UV Set", Float) = 1 + _Ao2Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + + // Detail + [Toggle(_DETAIL_MULX2)] + _DetailT ("'Detail' {Feature:{Color:7}}", Float) = 0 + [Toggle(_NORMALMAP)] + _DetailMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_DetailMask}}}", Float) = 0 + _DetailMask ("'Mask(A)' {Visualize:{A}, Parent:_MainTex}", 2D) = "white" {} + _DetailMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + [Enum(Mul, 0, MulX2, 1)] + _DetailMode ("'Color Mode' {Dropdown:{Mul:{}, MulX2:{}}}", Float) = 0 + _DetailAlbedoMap ("'Color(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _DetailAlbedoMapVelocity ("Scroll", Vector) = (0,0,0,0) + _DetailAlbedoMapUV ("UV Set", Float) = 0 + _DetailNormalMap ("'Normals' {Visualize:{NRM}, Parent:_DetailAlbedoMap}", 2D) = "bump" {} + _DetailWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DetailNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Team Color + [Toggle(_TEAMCOLOR_ON)] + _TeamColor ("'Team Color' {Feature:{Color:8}}", Float) = 0 + [Enum(Masks, 0, Tint, 1)] + _TeamColorMasksAsTint ("'Texture Mode' {Dropdown:{Masks:{}, Tint:{_TeamColorMasks, _TeamColor0, _TeamColor1, _TeamColor2, _TeamColor3}}}", Float) = 0 + _TeamColorMaskMap ("'Masks(RGBA)' {Visualize:{R, G, B, A, RGB}, Parent:_MainTex}", 2D) = "black" {} + _TeamColorMasks ("'Channels' {Vector:Channels}", Vector) = (1,1,1,0) + _TeamColor0 ("'Tint R' {}", Color) = (1,0,0) + _TeamColor1 ("'Tint G' {}", Color) = (0,1,0) + _TeamColor2 ("'Tint B' {}", Color) = (0,0,1) + _TeamColor3 ("'Tint A' {}", Color) = (0.5,0.5,0.5) + + // Decal + [Toggle(_DECAL_ON)] + _Decal ("'Decal' {Feature:{Color:9}}", Float) = 0 + _DecalColor ("'Tint' {}", Color) = (1,1,1,1) + _DecalTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "black" {} + _DecalTexUV ("UV Set", Float) = 0 + _DecalWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DecalSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _DecalAlphaVertexTint ("'Vertex Alpha Tint' {Min:0, Max:1}", Float) = 0 + + // Emission + [Toggle(_EMISSION)] + _Emission ("'Emission' {Feature:{Color:10}}", Float) = 0 + [LM_Emission] + [HDR] + _EmissionColor ("'Tint' {}", Color) = (1,1,1) + [LM_Emission] + _EmissionMap ("'Mask(RGB)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "white" {} + _IncandescenceMap ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _IncandescenceMapVelocity ("Scroll", Vector) = (0,0,0,0) + _IncandescenceMapUV ("UV Set", Float) = 0 + [Gamma] + _EmissionWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + + // Rim Emission + [Toggle(_RIM_ON)] + _Rim ("'Rim Emission' {Feature:{Color:11}}", Float) = 0 + [HDR] + _RimColor ("'Tint' {}", Color) = (1,1,1) + _RimTex ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _RimTexVelocity ("Scroll", Vector) = (0,0,0,0) + _RimTexUV ("UV Set", Float) = 0 + [Gamma] + _RimWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + [Gamma] + _RimBias ("'Fill' {Min:0, Max:1}", Float) = 0 + _RimPower ("'Falloff' {Min:0.01}", Float) = 4 + + // Dissolve + [Toggle(_DISSOLVE_ON)] + _Dissolve ("'Dissolve' {Feature:{Color:12}}", Float) = 0 + [HDR] + _DissolveGlowColor ("'Glow Tint' {}", Color) = (1,1,1,1) + _DissolveTex ("'Glow Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _DissolveTexUV ("UV Set", Float) = 0 + _DissolveCutoff ("'Cutoff' {Min:0, Max:1}", Float) = 0 + [Gamma] + _DissolveGlowWeight ("'Glow Weight' {Min:0, Max:1}", Float) = 1 + _DissolveEdgeWidth ("'Glow Width' {Min:0, Max:1}", Float) = 0.01 + + // Wetness + [Toggle(_WETNESS_ON)] + _WetnessProperties ("'Wetness' {Feature:{Color:13}}", Float) = 0 + [Toggle(_WETMASKSOURCE_VERTEXCOLORALPHA)] + _WetMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_WetMask}}}", Float) = 0 + _WetMask ("'Mask(A)' {Visualize:{A}}", 2D) = "white" {} + _WetMaskVelocity ("Scroll", Vector) = (0,0,0,0) + _WetMaskUV ("UV Set", Float) = 0 + _WetMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + _WetTint ("'Tint' {}", Color) = (1,1,1,1) + _WetNormalMap ("'Normals' {Visualize:{NRM}}", 2D) = "bump" {} + _WetNormalMapVelocity ("Scroll", Vector) = (0,0,0,0) + _WetNormalMapUV ("UV Set", Float) = 0 + _WetWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _WetRoughness ("'Roughness' {Min:0, Max:1}", Float) = 0.2 + _WetNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _Lightmapping ("'GI' {LightmapEmissionProperty:{}}", Float) = 1 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} + +SubShader { + Tags { + "RenderType" = "Opaque" + "PerformanceChecks" = "False" + //"DisableBatching" = "LODFading" + } + LOD 300 + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + Blend [_SrcBlend] [_DstBlend] + ZWrite [_ZWrite] + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Shaders/Definition/Core.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend [_SrcBlend] One + ZWrite Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + + #include "Assets/Alloy/Shaders/Definition/Core.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _DISSOLVE_ON + + #pragma multi_compile_shadowcaster + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_SHADOWCASTER + + #include "Assets/Alloy/Shaders/Definition/Core.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } + + Pass { + Name "DEFERRED" + Tags { "LightMode" = "Deferred" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_prepassfinal + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_DEFERRED + + #include "Assets/Alloy/Shaders/Definition/Core.cginc" + #include "Assets/Alloy/Shaders/Forward/Gbuffer.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Shaders/Definition/Core.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +FallBack "VertexLit" +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Shaders/3.0/Core/Core.shader.meta b/Assets/Alloy/Shaders/3.0/Core/Core.shader.meta new file mode 100644 index 0000000..ca01c44 --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Core/Core.shader.meta @@ -0,0 +1,21 @@ +fileFormatVersion: 2 +guid: 12c5a1911ed698d45920f1c6fa4d6d57 +ShaderImporter: + defaultTextures: + - _MainTex: {instanceID: 0} + - _SpecTex: {instanceID: 0} + - _BumpMap: {instanceID: 0} + - _ParallaxMap: {instanceID: 0} + - _DetailMask: {instanceID: 0} + - _DetailAlbedoMap: {instanceID: 0} + - _DetailMaterialMap: {fileID: 2800000, guid: 2b77d5cb601375f4ba50c6194c126e59, + type: 3} + - _DetailNormalMap: {instanceID: 0} + - _TeamColorMaskMap: {instanceID: 0} + - _DecalTex: {instanceID: 0} + - _EmissionMap: {instanceID: 0} + - _IncandescenceMap: {instanceID: 0} + - _RimTex: {instanceID: 0} + - _DissolveTex: {instanceID: 0} + userData: + assetBundleName: diff --git a/Assets/Alloy/Shaders/3.0/Core/Prototyping.shader b/Assets/Alloy/Shaders/3.0/Core/Prototyping.shader new file mode 100644 index 0000000..9b89bfc --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Core/Prototyping.shader @@ -0,0 +1,362 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Prototyping" { +Properties { + // Global Settings + _Mode ("'Rendering Mode' {RenderingMode:{Opaque:{_Cutoff}, Cutout:{}, Fade:{_Cutoff}, Transparent:{_Cutoff}}}", Float) = 0 + _SrcBlend ("__src", Float) = 0 + _DstBlend ("__dst", Float) = 0 + _ZWrite ("__zw", Float) = 1 + [LM_TransparencyCutOff] + _Cutoff ("'Opacity Cutoff' {Min:0, Max:1}", Float) = 0.5 + [Toggle(EFFECT_BUMP)] + _HasBumpMap ("'Normals Source' {Dropdown:{VertexNormals:{_BumpMap,_BumpScale,_DetailNormalMap,_DetailNormalMapScale,_WetNormalMap,_WetNormalMapScale}, NormalMaps:{}}}", Float) = 1 + + // Prototyping Textures + _MainTextures ("'Prototyping Textures' {Section:{Color:0}}", Float) = 0 + [LM_Albedo] [LM_Transparency] + _Color ("'Tint' {}", Color) = (1,1,1,1) + [LM_MasterTilingOffset] [LM_Albedo] + _MainTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _MainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _MainTexUV ("UV Set", Float) = 0 + [LM_Metallic] + _MetallicMap ("'Metallic(G)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "white" {} + _AoMap ("'Ambient Occlusion(G)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "white" {} + _SpecularityMap ("'Specularity(G)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "white" {} + _RoughnessMap ("'Roughness(G)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "white" {} + [LM_NormalMap] + _BumpMap ("'Normals' {Visualize:{NRM}, Parent:_MainTex}", 2D) = "bump" {} + _BaseColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Prototyping Properties + _MainPhysicalProperties ("'Prototyping Properties' {Section:{Color:1}}", Float) = 0 + [LM_Metallic] + _Metal ("'Metallic' {Min:0, Max:1}", Float) = 1 + _Specularity ("'Specularity' {Min:0, Max:1}", Float) = 1 + _Roughness ("'Roughness' {Min:0, Max:1}", Float) = 1 + _Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _BumpScale ("'Normal Strength' {}", Float) = 1 + + // Parallax + [Toggle(_PARALLAXMAP)] + _ParallaxT ("'Parallax' {Feature:{Color:5}}", Float) = 0 + [Toggle(_BUMPMODE_POM)] + _BumpMode ("'Mode' {Dropdown:{Parallax:{_MinSamples, _MaxSamples}, POM:{}}}", Float) = 0 + _ParallaxMap ("'Heightmap(G)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "black" {} + _Parallax ("'Height' {Min:0, Max:0.08}", Float) = 0.02 + _MinSamples ("'Min Samples' {Min:1}", Float) = 4 + _MaxSamples ("'Max Samples' {Min:1}", Float) = 20 + + // AO2 + [Toggle(_AO2_ON)] + _AO2 ("'AO2' {Feature:{Color:6}}", Float) = 0 + _Ao2Map ("'AO2(G)' {Visualize:{RGB}}", 2D) = "white" {} + _Ao2MapUV ("UV Set", Float) = 1 + _Ao2Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + + // Detail + [Toggle(_DETAIL_MULX2)] + _DetailT ("'Detail' {Feature:{Color:7}}", Float) = 0 + [Toggle(_NORMALMAP)] + _DetailMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_DetailMask}}}", Float) = 0 + _DetailMask ("'Mask(A)' {Visualize:{A}, Parent:_MainTex}", 2D) = "white" {} + _DetailMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + [Enum(Mul, 0, MulX2, 1)] + _DetailMode ("'Color Mode' {Dropdown:{Mul:{}, MulX2:{}}}", Float) = 0 + _DetailAlbedoMap ("'Color(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _DetailAlbedoMapVelocity ("Scroll", Vector) = (0,0,0,0) + _DetailAlbedoMapUV ("UV Set", Float) = 0 + _DetailNormalMap ("'Normals' {Visualize:{NRM}, Parent:_DetailAlbedoMap}", 2D) = "bump" {} + _DetailWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DetailNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Team Color + [Toggle(_TEAMCOLOR_ON)] + _TeamColor ("'Team Color' {Feature:{Color:8}}", Float) = 0 + [Enum(Masks, 0, Tint, 1)] + _TeamColorMasksAsTint ("'Texture Mode' {Dropdown:{Masks:{}, Tint:{_TeamColorMasks, _TeamColor0, _TeamColor1, _TeamColor2, _TeamColor3}}}", Float) = 0 + _TeamColorMaskMap ("'Masks(RGBA)' {Visualize:{R, G, B, A, RGB}, Parent:_MainTex}", 2D) = "black" {} + _TeamColorMasks ("'Channels' {Vector:Channels}", Vector) = (1,1,1,0) + _TeamColor0 ("'Tint R' {}", Color) = (1,0,0) + _TeamColor1 ("'Tint G' {}", Color) = (0,1,0) + _TeamColor2 ("'Tint B' {}", Color) = (0,0,1) + _TeamColor3 ("'Tint A' {}", Color) = (0.5,0.5,0.5) + + // Decal + [Toggle(_DECAL_ON)] + _Decal ("'Decal' {Feature:{Color:9}}", Float) = 0 + _DecalColor ("'Tint' {}", Color) = (1,1,1,1) + _DecalTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "black" {} + _DecalTexUV ("UV Set", Float) = 0 + _DecalWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DecalSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _DecalAlphaVertexTint ("'Vertex Alpha Tint' {Min:0, Max:1}", Float) = 0 + + // Emission + [Toggle(_EMISSION)] + _Emission ("'Emission' {Feature:{Color:10}}", Float) = 0 + [LM_Emission] + [HDR] + _EmissionColor ("'Tint' {}", Color) = (1,1,1) + [LM_Emission] + _EmissionMap ("'Mask(RGB)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "white" {} + _IncandescenceMap ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _IncandescenceMapVelocity ("Scroll", Vector) = (0,0,0,0) + _IncandescenceMapUV ("UV Set", Float) = 0 + [Gamma] + _EmissionWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + + // Rim Emission + [Toggle(_RIM_ON)] + _Rim ("'Rim Emission' {Feature:{Color:11}}", Float) = 0 + [HDR] + _RimColor ("'Tint' {}", Color) = (1,1,1) + _RimTex ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _RimTexVelocity ("Scroll", Vector) = (0,0,0,0) + _RimTexUV ("UV Set", Float) = 0 + [Gamma] + _RimWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + [Gamma] + _RimBias ("'Fill' {Min:0, Max:1}", Float) = 0 + _RimPower ("'Falloff' {Min:0.01}", Float) = 4 + + // Dissolve + [Toggle(_DISSOLVE_ON)] + _Dissolve ("'Dissolve' {Feature:{Color:12}}", Float) = 0 + [HDR] + _DissolveGlowColor ("'Glow Tint' {}", Color) = (1,1,1,1) + _DissolveTex ("'Glow Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _DissolveTexUV ("UV Set", Float) = 0 + _DissolveCutoff ("'Cutoff' {Min:0, Max:1}", Float) = 0 + [Gamma] + _DissolveGlowWeight ("'Glow Weight' {Min:0, Max:1}", Float) = 1 + _DissolveEdgeWidth ("'Glow Width' {Min:0, Max:1}", Float) = 0.01 + + // Wetness + [Toggle(_WETNESS_ON)] + _WetnessProperties ("'Wetness' {Feature:{Color:13}}", Float) = 0 + [Toggle(_WETMASKSOURCE_VERTEXCOLORALPHA)] + _WetMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_WetMask}}}", Float) = 0 + _WetMask ("'Mask(A)' {Visualize:{A}}", 2D) = "white" {} + _WetMaskVelocity ("Scroll", Vector) = (0,0,0,0) + _WetMaskUV ("UV Set", Float) = 0 + _WetMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + _WetTint ("'Tint' {}", Color) = (1,1,1,1) + _WetNormalMap ("'Normals' {Visualize:{NRM}}", 2D) = "bump" {} + _WetNormalMapVelocity ("Scroll", Vector) = (0,0,0,0) + _WetNormalMapUV ("UV Set", Float) = 0 + _WetWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _WetRoughness ("'Roughness' {Min:0, Max:1}", Float) = 0.2 + _WetNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _Lightmapping ("'GI' {LightmapEmissionProperty:{}}", Float) = 1 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} + +CGINCLUDE + #define A_EXPANDED_MATERIAL_MAPS +ENDCG + +SubShader { + Tags { + "RenderType" = "Opaque" + "PerformanceChecks" = "False" + //"DisableBatching" = "LODFading" + } + LOD 300 + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + Blend [_SrcBlend] [_DstBlend] + ZWrite [_ZWrite] + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Shaders/Definition/Core.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend [_SrcBlend] One + ZWrite Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + + #include "Assets/Alloy/Shaders/Definition/Core.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature _DISSOLVE_ON + + #pragma multi_compile_shadowcaster + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_SHADOWCASTER + + #include "Assets/Alloy/Shaders/Definition/Core.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } + + Pass { + Name "DEFERRED" + Tags { "LightMode" = "Deferred" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_prepassfinal + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_DEFERRED + + #include "Assets/Alloy/Shaders/Definition/Core.cginc" + #include "Assets/Alloy/Shaders/Forward/Gbuffer.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Shaders/Definition/Core.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +FallBack "VertexLit" +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Shaders/3.0/Core/Prototyping.shader.meta b/Assets/Alloy/Shaders/3.0/Core/Prototyping.shader.meta new file mode 100644 index 0000000..36d916b --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Core/Prototyping.shader.meta @@ -0,0 +1,21 @@ +fileFormatVersion: 2 +guid: 8bd11d9f3ca02ab4f9f7173d9fcb9b6f +ShaderImporter: + defaultTextures: + - _MainTex: {instanceID: 0} + - _SpecTex: {instanceID: 0} + - _BumpMap: {instanceID: 0} + - _ParallaxMap: {instanceID: 0} + - _DetailMask: {instanceID: 0} + - _DetailAlbedoMap: {instanceID: 0} + - _DetailMaterialMap: {fileID: 2800000, guid: 2b77d5cb601375f4ba50c6194c126e59, + type: 3} + - _DetailNormalMap: {instanceID: 0} + - _TeamColorMaskMap: {instanceID: 0} + - _DecalTex: {instanceID: 0} + - _EmissionMap: {instanceID: 0} + - _IncandescenceMap: {instanceID: 0} + - _RimTex: {instanceID: 0} + - _DissolveTex: {instanceID: 0} + userData: + assetBundleName: diff --git a/Assets/Alloy/Shaders/3.0/Decal.meta b/Assets/Alloy/Shaders/3.0/Decal.meta new file mode 100644 index 0000000..81f6d07 --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Decal.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 818063c431a7c4d4c851d32cb1d1359c +folderAsset: yes +timeCreated: 1448716765 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/3.0/Decal/Additive.shader b/Assets/Alloy/Shaders/3.0/Decal/Additive.shader new file mode 100644 index 0000000..4a5883a --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Decal/Additive.shader @@ -0,0 +1,207 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Decal/Additive" { +Properties { + [Toggle(EFFECT_BUMP)] + _HasBumpMap ("'Normals Source' {Dropdown:{VertexNormals:{_BumpMap,_BumpScale,_DetailNormalMap,_DetailNormalMapScale,_WetNormalMap,_WetNormalMapScale}, NormalMaps:{}}}", Float) = 1 + + // Main Textures + _MainTextures ("'Main Textures' {Section:{Color:0}}", Float) = 0 + [HDR][LM_Albedo] [LM_Transparency] + _Color ("'Tint' {}", Color) = (1,1,1,1) + [LM_MasterTilingOffset] [LM_Albedo] + _MainTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _MainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _MainTexUV ("UV Set", Float) = 0 + [LM_NormalMap] + _BumpMap ("'Normals' {Visualize:{NRM}, Parent:_MainTex}", 2D) = "bump" {} + _BaseColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Main Properties + _MainPhysicalProperties ("'Main Properties' {Section:{Color:1}}", Float) = 0 + _BumpScale ("'Normal Strength' {}", Float) = 1 + + // Parallax + [Toggle(_PARALLAXMAP)] + _ParallaxT ("'Parallax' {Feature:{Color:5}}", Float) = 0 + [Toggle(_BUMPMODE_POM)] + _BumpMode ("'Mode' {Dropdown:{Parallax:{_MinSamples, _MaxSamples}, POM:{}}}", Float) = 0 + _ParallaxMap ("'Heightmap(G)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "black" {} + _Parallax ("'Height' {Min:0, Max:0.08}", Float) = 0.02 + _MinSamples ("'Min Samples' {Min:1}", Float) = 4 + _MaxSamples ("'Max Samples' {Min:1}", Float) = 20 + + // Detail + [Toggle(_DETAIL_MULX2)] + _DetailT ("'Detail' {Feature:{Color:7}}", Float) = 0 + [Toggle(_NORMALMAP)] + _DetailMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_DetailMask}}}", Float) = 0 + _DetailMask ("'Mask(A)' {Visualize:{A}, Parent:_MainTex}", 2D) = "white" {} + _DetailMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + [Enum(Mul, 0, MulX2, 1)] + _DetailMode ("'Color Mode' {Dropdown:{Mul:{}, MulX2:{}}}", Float) = 0 + _DetailAlbedoMap ("'Color(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _DetailAlbedoMapVelocity ("Scroll", Vector) = (0,0,0,0) + _DetailAlbedoMapUV ("UV Set", Float) = 0 + _DetailNormalMap ("'Normals' {Visualize:{NRM}, Parent:_DetailAlbedoMap}", 2D) = "bump" {} + _DetailWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DetailNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Team Color + [Toggle(_TEAMCOLOR_ON)] + _TeamColor ("'Team Color' {Feature:{Color:8}}", Float) = 0 + [Enum(Masks, 0, Tint, 1)] + _TeamColorMasksAsTint ("'Texture Mode' {Dropdown:{Masks:{}, Tint:{_TeamColorMasks, _TeamColor0, _TeamColor1, _TeamColor2, _TeamColor3}}}", Float) = 0 + _TeamColorMaskMap ("'Masks(RGBA)' {Visualize:{R, G, B, A, RGB}, Parent:_MainTex}", 2D) = "black" {} + _TeamColorMasks ("'Channels' {Vector:Channels}", Vector) = (1,1,1,0) + _TeamColor0 ("'Tint R' {}", Color) = (1,0,0) + _TeamColor1 ("'Tint G' {}", Color) = (0,1,0) + _TeamColor2 ("'Tint B' {}", Color) = (0,0,1) + _TeamColor3 ("'Tint A' {}", Color) = (0.5,0.5,0.5) + + // Decal + [Toggle(_DECAL_ON)] + _Decal ("'Decal' {Feature:{Color:9}}", Float) = 0 + _DecalColor ("'Tint' {}", Color) = (1,1,1,1) + _DecalTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "black" {} + _DecalTexUV ("UV Set", Float) = 0 + + // Emission + [Toggle(_EMISSION)] + _Emission ("'Emission' {Feature:{Color:10}}", Float) = 0 + [LM_Emission] + [HDR] + _EmissionColor ("'Tint' {}", Color) = (1,1,1) + [LM_Emission] + _EmissionMap ("'Mask(RGB)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "white" {} + _IncandescenceMap ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _IncandescenceMapVelocity ("Scroll", Vector) = (0,0,0,0) + _IncandescenceMapUV ("UV Set", Float) = 0 + [Gamma] + _EmissionWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + + // Rim Emission + [Toggle(_RIM_ON)] + _Rim ("'Rim Emission' {Feature:{Color:11}}", Float) = 0 + [HDR] + _RimColor ("'Tint' {}", Color) = (1,1,1) + _RimTex ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _RimTexVelocity ("Scroll", Vector) = (0,0,0,0) + _RimTexUV ("UV Set", Float) = 0 + [Gamma] + _RimWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + [Gamma] + _RimBias ("'Fill' {Min:0, Max:1}", Float) = 0 + _RimPower ("'Falloff' {Min:0.01}", Float) = 4 + + // Dissolve + [Toggle(_DISSOLVE_ON)] + _Dissolve ("'Dissolve' {Feature:{Color:12}}", Float) = 0 + [HDR] + _DissolveGlowColor ("'Glow Tint' {}", Color) = (1,1,1,1) + _DissolveTex ("'Glow Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _DissolveTexUV ("UV Set", Float) = 0 + _DissolveCutoff ("'Cutoff' {Min:0, Max:1}", Float) = 0 + [Gamma] + _DissolveGlowWeight ("'Glow Weight' {Min:0, Max:1}", Float) = 1 + _DissolveEdgeWidth ("'Glow Width' {Min:0, Max:1}", Float) = 0.01 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} +SubShader { + Tags { + "Queue" = "AlphaTest" + "IgnoreProjector" = "True" + "RenderType" = "Opaque" + "ForceNoShadowCasting" = "True" + //"DisableBatching" = "LODFading" + } + LOD 300 + Offset -1,-1 + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + Blend One One + ZWrite Off + Cull Back + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Shaders/Definition/DecalAdditive.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "DEFERRED" + Tags { "LightMode" = "Deferred" } + + Blend One One + ZWrite Off + Cull Back + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile ___ UNITY_HDR_ON + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_DEFERRED + + #include "Assets/Alloy/Shaders/Definition/DecalAdditive.cginc" + #include "Assets/Alloy/Shaders/Forward/Gbuffer.cginc" + + ENDCG + } +} + +FallBack Off +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Shaders/3.0/Decal/Additive.shader.meta b/Assets/Alloy/Shaders/3.0/Decal/Additive.shader.meta new file mode 100644 index 0000000..5c65c2e --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Decal/Additive.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 12ac512bf7048ea4099a756618be6798 +timeCreated: 1449626937 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/3.0/Decal/Alpha.shader b/Assets/Alloy/Shaders/3.0/Decal/Alpha.shader new file mode 100644 index 0000000..c587087 --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Decal/Alpha.shader @@ -0,0 +1,346 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Decal/Alpha" { +Properties { + [Toggle(EFFECT_BUMP)] + _HasBumpMap ("'Normals Source' {Dropdown:{VertexNormals:{_BumpMap,_BumpScale,_DetailNormalMap,_DetailNormalMapScale,_WetNormalMap,_WetNormalMapScale}, NormalMaps:{}}}", Float) = 1 + + // Main Textures + _MainTextures ("'Main Textures' {Section:{Color:0}}", Float) = 0 + [LM_Albedo] [LM_Transparency] + _Color ("'Tint' {}", Color) = (1,1,1,1) + [LM_MasterTilingOffset] [LM_Albedo] + _MainTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _MainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _MainTexUV ("UV Set", Float) = 0 + [LM_Metallic] + _SpecTex ("'Metal(R) AO(G) Spec(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_MainTex}", 2D) = "white" {} + [LM_NormalMap] + _BumpMap ("'Normals' {Visualize:{NRM}, Parent:_MainTex}", 2D) = "bump" {} + _BaseColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Main Properties + _MainPhysicalProperties ("'Main Properties' {Section:{Color:1}}", Float) = 0 + [LM_Metallic] + _Metal ("'Metallic' {Min:0, Max:1}", Float) = 1 + _Specularity ("'Specularity' {Min:0, Max:1}", Float) = 1 + _Roughness ("'Roughness' {Min:0, Max:1}", Float) = 1 + _Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _BumpScale ("'Normal Strength' {}", Float) = 1 + + // Parallax + [Toggle(_PARALLAXMAP)] + _ParallaxT ("'Parallax' {Feature:{Color:5}}", Float) = 0 + [Toggle(_BUMPMODE_POM)] + _BumpMode ("'Mode' {Dropdown:{Parallax:{_MinSamples, _MaxSamples}, POM:{}}}", Float) = 0 + _ParallaxMap ("'Heightmap(G)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "black" {} + _Parallax ("'Height' {Min:0, Max:0.08}", Float) = 0.02 + _MinSamples ("'Min Samples' {Min:1}", Float) = 4 + _MaxSamples ("'Max Samples' {Min:1}", Float) = 20 + + // AO2 + [Toggle(_AO2_ON)] + _AO2 ("'AO2' {Feature:{Color:6}}", Float) = 0 + _Ao2Map ("'AO2(G)' {Visualize:{RGB}}", 2D) = "white" {} + _Ao2MapUV ("UV Set", Float) = 1 + _Ao2Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + + // Detail + [Toggle(_DETAIL_MULX2)] + _DetailT ("'Detail' {Feature:{Color:7}}", Float) = 0 + [Toggle(_NORMALMAP)] + _DetailMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_DetailMask}}}", Float) = 0 + _DetailMask ("'Mask(A)' {Visualize:{A}, Parent:_MainTex}", 2D) = "white" {} + _DetailMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + [Enum(Mul, 0, MulX2, 1)] + _DetailMode ("'Color Mode' {Dropdown:{Mul:{}, MulX2:{}}}", Float) = 0 + _DetailAlbedoMap ("'Color(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _DetailAlbedoMapVelocity ("Scroll", Vector) = (0,0,0,0) + _DetailAlbedoMapUV ("UV Set", Float) = 0 + _DetailNormalMap ("'Normals' {Visualize:{NRM}, Parent:_DetailAlbedoMap}", 2D) = "bump" {} + _DetailWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DetailNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Team Color + [Toggle(_TEAMCOLOR_ON)] + _TeamColor ("'Team Color' {Feature:{Color:8}}", Float) = 0 + [Enum(Masks, 0, Tint, 1)] + _TeamColorMasksAsTint ("'Texture Mode' {Dropdown:{Masks:{}, Tint:{_TeamColorMasks, _TeamColor0, _TeamColor1, _TeamColor2, _TeamColor3}}}", Float) = 0 + _TeamColorMaskMap ("'Masks(RGBA)' {Visualize:{R, G, B, A, RGB}, Parent:_MainTex}", 2D) = "black" {} + _TeamColorMasks ("'Channels' {Vector:Channels}", Vector) = (1,1,1,0) + _TeamColor0 ("'Tint R' {}", Color) = (1,0,0) + _TeamColor1 ("'Tint G' {}", Color) = (0,1,0) + _TeamColor2 ("'Tint B' {}", Color) = (0,0,1) + _TeamColor3 ("'Tint A' {}", Color) = (0.5,0.5,0.5) + + // Decal + [Toggle(_DECAL_ON)] + _Decal ("'Decal' {Feature:{Color:9}}", Float) = 0 + _DecalColor ("'Tint' {}", Color) = (1,1,1,1) + _DecalTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "black" {} + _DecalTexUV ("UV Set", Float) = 0 + _DecalWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DecalSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _DecalAlphaVertexTint ("'Vertex Alpha Tint' {Min:0, Max:1}", Float) = 0 + + // Emission + [Toggle(_EMISSION)] + _Emission ("'Emission' {Feature:{Color:10}}", Float) = 0 + [LM_Emission] + [HDR] + _EmissionColor ("'Tint' {}", Color) = (1,1,1) + [LM_Emission] + _EmissionMap ("'Mask(RGB)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "white" {} + _IncandescenceMap ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _IncandescenceMapVelocity ("Scroll", Vector) = (0,0,0,0) + _IncandescenceMapUV ("UV Set", Float) = 0 + [Gamma] + _EmissionWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + + // Rim Emission + [Toggle(_RIM_ON)] + _Rim ("'Rim Emission' {Feature:{Color:11}}", Float) = 0 + [HDR] + _RimColor ("'Tint' {}", Color) = (1,1,1) + _RimTex ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _RimTexVelocity ("Scroll", Vector) = (0,0,0,0) + _RimTexUV ("UV Set", Float) = 0 + [Gamma] + _RimWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + [Gamma] + _RimBias ("'Fill' {Min:0, Max:1}", Float) = 0 + _RimPower ("'Falloff' {Min:0.01}", Float) = 4 + + // Dissolve + [Toggle(_DISSOLVE_ON)] + _Dissolve ("'Dissolve' {Feature:{Color:12}}", Float) = 0 + [HDR] + _DissolveGlowColor ("'Glow Tint' {}", Color) = (1,1,1,1) + _DissolveTex ("'Glow Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _DissolveTexUV ("UV Set", Float) = 0 + _DissolveCutoff ("'Cutoff' {Min:0, Max:1}", Float) = 0 + [Gamma] + _DissolveGlowWeight ("'Glow Weight' {Min:0, Max:1}", Float) = 1 + _DissolveEdgeWidth ("'Glow Width' {Min:0, Max:1}", Float) = 0.01 + + // Wetness + [Toggle(_WETNESS_ON)] + _WetnessProperties ("'Wetness' {Feature:{Color:13}}", Float) = 0 + [Toggle(_WETMASKSOURCE_VERTEXCOLORALPHA)] + _WetMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_WetMask}}}", Float) = 0 + _WetMask ("'Mask(A)' {Visualize:{A}}", 2D) = "white" {} + _WetMaskVelocity ("Scroll", Vector) = (0,0,0,0) + _WetMaskUV ("UV Set", Float) = 0 + _WetMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + _WetTint ("'Tint' {}", Color) = (1,1,1,1) + _WetNormalMap ("'Normals' {Visualize:{NRM}}", 2D) = "bump" {} + _WetNormalMapVelocity ("Scroll", Vector) = (0,0,0,0) + _WetNormalMapUV ("UV Set", Float) = 0 + _WetWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _WetRoughness ("'Roughness' {Min:0, Max:1}", Float) = 0.2 + _WetNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} +SubShader { + Tags { + "Queue" = "AlphaTest" + "IgnoreProjector" = "True" + "RenderType" = "Opaque" + "ForceNoShadowCasting" = "True" + //"DisableBatching" = "LODFading" + } + LOD 300 + Offset -1,-1 + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + Blend SrcAlpha OneMinusSrcAlpha + ZWrite Off + Cull Back + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + #define _ALPHABLEND_ON + + #include "Assets/Alloy/Shaders/Definition/DecalAlpha.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend SrcAlpha One + ZWrite Off + Cull Back + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + #define _ALPHABLEND_ON + + #include "Assets/Alloy/Shaders/Definition/DecalAlpha.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "DEFERRED" + Tags { "LightMode" = "Deferred" } + + // Only overwrite G-Buffer RGB, but weight whole G-Buffer. + Blend SrcAlpha OneMinusSrcAlpha, Zero OneMinusSrcAlpha + ZWrite Off + Cull Back + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_prepassfinal + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_DEFERRED + #define A_DECAL_ALPHA_FIRSTPASS_SHADER + + #include "Assets/Alloy/Shaders/Definition/DecalAlpha.cginc" + #include "Assets/Alloy/Shaders/Forward/Gbuffer.cginc" + + ENDCG + } + + Pass { + Name "DEFERRED_ALPHA" + Tags { "LightMode" = "Deferred" } + + // Only overwrite GBuffer A. + Blend One One + ColorMask A + ZWrite Off + Cull Back + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _DECAL_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_prepassfinal + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_DEFERRED + + #include "Assets/Alloy/Shaders/Definition/DecalAlpha.cginc" + #include "Assets/Alloy/Shaders/Forward/Gbuffer.cginc" + + ENDCG + } +} + +FallBack Off +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Shaders/3.0/Decal/Alpha.shader.meta b/Assets/Alloy/Shaders/3.0/Decal/Alpha.shader.meta new file mode 100644 index 0000000..ebdccfc --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Decal/Alpha.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: c4bc202ce591528439c81f7d48e94e1e +timeCreated: 1448683605 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/3.0/Decal/Ambient.shader b/Assets/Alloy/Shaders/3.0/Decal/Ambient.shader new file mode 100644 index 0000000..aba50d1 --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Decal/Ambient.shader @@ -0,0 +1,107 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Decal/Ambient" { +Properties { + // Main Textures + _MainTextures ("'Main Textures' {Section:{Color:0}}", Float) = 0 + [LM_Albedo] [LM_Transparency] + _Color ("'Tint' {}", Color) = (1,1,1,1) + [LM_MasterTilingOffset] [LM_Albedo] + _MainTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB,A}}", 2D) = "white" {} + _MainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _MainTexUV ("UV Set", Float) = 0 + _BaseColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Team Color + [Toggle(_TEAMCOLOR_ON)] + _TeamColor ("'Team Color' {Feature:{Color:8}}", Float) = 0 + [Enum(Masks, 0, Tint, 1)] + _TeamColorMasksAsTint ("'Texture Mode' {Dropdown:{Masks:{}, Tint:{_TeamColorMasks, _TeamColor0, _TeamColor1, _TeamColor2, _TeamColor3}}}", Float) = 0 + _TeamColorMaskMap ("'Masks(RGBA)' {Visualize:{R, G, B, A, RGB}, Parent:_MainTex}", 2D) = "black" {} + _TeamColorMasks ("'Channels' {Vector:Channels}", Vector) = (1,1,1,0) + _TeamColor0 ("'Tint R' {}", Color) = (1,0,0) + _TeamColor1 ("'Tint G' {}", Color) = (0,1,0) + _TeamColor2 ("'Tint B' {}", Color) = (0,0,1) + _TeamColor3 ("'Tint A' {}", Color) = (0.5,0.5,0.5) + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} +SubShader { + Tags { + "Queue" = "AlphaTest" + "IgnoreProjector" = "True" + "RenderType" = "Opaque" + "ForceNoShadowCasting" = "True" + //"DisableBatching" = "LODFading" + } + LOD 300 + Offset -1,-1 + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + Blend DstColor Zero + ZWrite Off + Cull Back + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _TEAMCOLOR_ON + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Shaders/Definition/DecalAmbient.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "DEFERRED" + Tags { "LightMode" = "Deferred" } + + Blend DstColor Zero + ZWrite Off + Cull Back + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _TEAMCOLOR_ON + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile ___ UNITY_HDR_ON + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_DEFERRED + + #include "Assets/Alloy/Shaders/Definition/DecalAmbient.cginc" + #include "Assets/Alloy/Shaders/Forward/Gbuffer.cginc" + + ENDCG + } +} + +FallBack Off +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Shaders/3.0/Decal/Ambient.shader.meta b/Assets/Alloy/Shaders/3.0/Decal/Ambient.shader.meta new file mode 100644 index 0000000..007ad6b --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Decal/Ambient.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 595265e6de48e09468f3bf08192dd121 +timeCreated: 1458169207 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/3.0/Decal/Cutout.shader b/Assets/Alloy/Shaders/3.0/Decal/Cutout.shader new file mode 100644 index 0000000..bc199b3 --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Decal/Cutout.shader @@ -0,0 +1,302 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Decal/Cutout" { +Properties { + [LM_TransparencyCutOff] + _Cutoff ("'Opacity Cutoff' {Min:0, Max:1}", Float) = 0.5 + [Toggle(EFFECT_BUMP)] + _HasBumpMap ("'Normals Source' {Dropdown:{VertexNormals:{_BumpMap,_BumpScale,_DetailNormalMap,_DetailNormalMapScale,_WetNormalMap,_WetNormalMapScale}, NormalMaps:{}}}", Float) = 1 + + // Main Textures + _MainTextures ("'Main Textures' {Section:{Color:0}}", Float) = 0 + [LM_Albedo] [LM_Transparency] + _Color ("'Tint' {}", Color) = (1,1,1,1) + [LM_MasterTilingOffset] [LM_Albedo] + _MainTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _MainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _MainTexUV ("UV Set", Float) = 0 + [LM_Metallic] + _SpecTex ("'Metal(R) AO(G) Spec(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_MainTex}", 2D) = "white" {} + [LM_NormalMap] + _BumpMap ("'Normals' {Visualize:{NRM}, Parent:_MainTex}", 2D) = "bump" {} + _BaseColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Main Properties + _MainPhysicalProperties ("'Main Properties' {Section:{Color:1}}", Float) = 0 + [LM_Metallic] + _Metal ("'Metallic' {Min:0, Max:1}", Float) = 1 + _Specularity ("'Specularity' {Min:0, Max:1}", Float) = 1 + _Roughness ("'Roughness' {Min:0, Max:1}", Float) = 1 + _Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _BumpScale ("'Normal Strength' {}", Float) = 1 + + // Parallax + [Toggle(_PARALLAXMAP)] + _ParallaxT ("'Parallax' {Feature:{Color:5}}", Float) = 0 + [Toggle(_BUMPMODE_POM)] + _BumpMode ("'Mode' {Dropdown:{Parallax:{_MinSamples, _MaxSamples}, POM:{}}}", Float) = 0 + _ParallaxMap ("'Heightmap(G)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "black" {} + _Parallax ("'Height' {Min:0, Max:0.08}", Float) = 0.02 + _MinSamples ("'Min Samples' {Min:1}", Float) = 4 + _MaxSamples ("'Max Samples' {Min:1}", Float) = 20 + + // AO2 + [Toggle(_AO2_ON)] + _AO2 ("'AO2' {Feature:{Color:6}}", Float) = 0 + _Ao2Map ("'AO2(G)' {Visualize:{RGB}}", 2D) = "white" {} + _Ao2MapUV ("UV Set", Float) = 1 + _Ao2Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + + // Detail + [Toggle(_DETAIL_MULX2)] + _DetailT ("'Detail' {Feature:{Color:7}}", Float) = 0 + [Toggle(_NORMALMAP)] + _DetailMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_DetailMask}}}", Float) = 0 + _DetailMask ("'Mask(A)' {Visualize:{A}, Parent:_MainTex}", 2D) = "white" {} + _DetailMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + [Enum(Mul, 0, MulX2, 1)] + _DetailMode ("'Color Mode' {Dropdown:{Mul:{}, MulX2:{}}}", Float) = 0 + _DetailAlbedoMap ("'Color(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _DetailAlbedoMapVelocity ("Scroll", Vector) = (0,0,0,0) + _DetailAlbedoMapUV ("UV Set", Float) = 0 + _DetailNormalMap ("'Normals' {Visualize:{NRM}, Parent:_DetailAlbedoMap}", 2D) = "bump" {} + _DetailWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DetailNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Team Color + [Toggle(_TEAMCOLOR_ON)] + _TeamColor ("'Team Color' {Feature:{Color:8}}", Float) = 0 + [Enum(Masks, 0, Tint, 1)] + _TeamColorMasksAsTint ("'Texture Mode' {Dropdown:{Masks:{}, Tint:{_TeamColorMasks, _TeamColor0, _TeamColor1, _TeamColor2, _TeamColor3}}}", Float) = 0 + _TeamColorMaskMap ("'Masks(RGBA)' {Visualize:{R, G, B, A, RGB}, Parent:_MainTex}", 2D) = "black" {} + _TeamColorMasks ("'Channels' {Vector:Channels}", Vector) = (1,1,1,0) + _TeamColor0 ("'Tint R' {}", Color) = (1,0,0) + _TeamColor1 ("'Tint G' {}", Color) = (0,1,0) + _TeamColor2 ("'Tint B' {}", Color) = (0,0,1) + _TeamColor3 ("'Tint A' {}", Color) = (0.5,0.5,0.5) + + // Decal + [Toggle(_DECAL_ON)] + _Decal ("'Decal' {Feature:{Color:9}}", Float) = 0 + _DecalColor ("'Tint' {}", Color) = (1,1,1,1) + _DecalTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "black" {} + _DecalTexUV ("UV Set", Float) = 0 + _DecalWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DecalSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _DecalAlphaVertexTint ("'Vertex Alpha Tint' {Min:0, Max:1}", Float) = 0 + + // Emission + [Toggle(_EMISSION)] + _Emission ("'Emission' {Feature:{Color:10}}", Float) = 0 + [LM_Emission] + [HDR] + _EmissionColor ("'Tint' {}", Color) = (1,1,1) + [LM_Emission] + _EmissionMap ("'Mask(RGB)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "white" {} + _IncandescenceMap ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _IncandescenceMapVelocity ("Scroll", Vector) = (0,0,0,0) + _IncandescenceMapUV ("UV Set", Float) = 0 + [Gamma] + _EmissionWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + + // Rim Emission + [Toggle(_RIM_ON)] + _Rim ("'Rim Emission' {Feature:{Color:11}}", Float) = 0 + [HDR] + _RimColor ("'Tint' {}", Color) = (1,1,1) + _RimTex ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _RimTexVelocity ("Scroll", Vector) = (0,0,0,0) + _RimTexUV ("UV Set", Float) = 0 + [Gamma] + _RimWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + [Gamma] + _RimBias ("'Fill' {Min:0, Max:1}", Float) = 0 + _RimPower ("'Falloff' {Min:0.01}", Float) = 4 + + // Dissolve + [Toggle(_DISSOLVE_ON)] + _Dissolve ("'Dissolve' {Feature:{Color:12}}", Float) = 0 + [HDR] + _DissolveGlowColor ("'Glow Tint' {}", Color) = (1,1,1,1) + _DissolveTex ("'Glow Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _DissolveTexUV ("UV Set", Float) = 0 + _DissolveCutoff ("'Cutoff' {Min:0, Max:1}", Float) = 0 + [Gamma] + _DissolveGlowWeight ("'Glow Weight' {Min:0, Max:1}", Float) = 1 + _DissolveEdgeWidth ("'Glow Width' {Min:0, Max:1}", Float) = 0.01 + + // Wetness + [Toggle(_WETNESS_ON)] + _WetnessProperties ("'Wetness' {Feature:{Color:13}}", Float) = 0 + [Toggle(_WETMASKSOURCE_VERTEXCOLORALPHA)] + _WetMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_WetMask}}}", Float) = 0 + _WetMask ("'Mask(A)' {Visualize:{A}}", 2D) = "white" {} + _WetMaskVelocity ("Scroll", Vector) = (0,0,0,0) + _WetMaskUV ("UV Set", Float) = 0 + _WetMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + _WetTint ("'Tint' {}", Color) = (1,1,1,1) + _WetNormalMap ("'Normals' {Visualize:{NRM}}", 2D) = "bump" {} + _WetNormalMapVelocity ("Scroll", Vector) = (0,0,0,0) + _WetNormalMapUV ("UV Set", Float) = 0 + _WetWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _WetRoughness ("'Roughness' {Min:0, Max:1}", Float) = 0.2 + _WetNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} +SubShader { + Tags { + "Queue" = "AlphaTest" + "IgnoreProjector" = "True" + "RenderType" = "Opaque" + "ForceNoShadowCasting" = "True" + //"DisableBatching" = "LODFading" + } + LOD 300 + Offset -1,-1 + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + ZWrite Off + Cull Back + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + #define _ALPHATEST_ON + + #include "Assets/Alloy/Shaders/Definition/DecalAlpha.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + ZWrite Off + Cull Back + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + #define _ALPHATEST_ON + + #include "Assets/Alloy/Shaders/Definition/DecalAlpha.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "DEFERRED" + Tags { "LightMode" = "Deferred" } + + ZWrite Off + Cull Back + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_prepassfinal + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_DEFERRED + #define _ALPHATEST_ON + + #include "Assets/Alloy/Shaders/Definition/DecalAlpha.cginc" + #include "Assets/Alloy/Shaders/Forward/Gbuffer.cginc" + + ENDCG + } +} + +FallBack Off +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Shaders/3.0/Decal/Cutout.shader.meta b/Assets/Alloy/Shaders/3.0/Decal/Cutout.shader.meta new file mode 100644 index 0000000..3b0bbe8 --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Decal/Cutout.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 9ea50c0a5c0e147498db83e4ce446f40 +timeCreated: 1449193828 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/3.0/Decal/Multiplicative.shader b/Assets/Alloy/Shaders/3.0/Decal/Multiplicative.shader new file mode 100644 index 0000000..03b3fcd --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Decal/Multiplicative.shader @@ -0,0 +1,107 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Decal/Multiplicative" { +Properties { + // Main Textures + _MainTextures ("'Main Textures' {Section:{Color:0}}", Float) = 0 + [LM_Albedo] [LM_Transparency] + _Color ("'Tint' {}", Color) = (1,1,1,1) + [LM_MasterTilingOffset] [LM_Albedo] + _MainTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB,A}}", 2D) = "white" {} + _MainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _MainTexUV ("UV Set", Float) = 0 + _BaseColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Team Color + [Toggle(_TEAMCOLOR_ON)] + _TeamColor ("'Team Color' {Feature:{Color:8}}", Float) = 0 + [Enum(Masks, 0, Tint, 1)] + _TeamColorMasksAsTint ("'Texture Mode' {Dropdown:{Masks:{}, Tint:{_TeamColorMasks, _TeamColor0, _TeamColor1, _TeamColor2, _TeamColor3}}}", Float) = 0 + _TeamColorMaskMap ("'Masks(RGBA)' {Visualize:{R, G, B, A, RGB}, Parent:_MainTex}", 2D) = "black" {} + _TeamColorMasks ("'Channels' {Vector:Channels}", Vector) = (1,1,1,0) + _TeamColor0 ("'Tint R' {}", Color) = (1,0,0) + _TeamColor1 ("'Tint G' {}", Color) = (0,1,0) + _TeamColor2 ("'Tint B' {}", Color) = (0,0,1) + _TeamColor3 ("'Tint A' {}", Color) = (0.5,0.5,0.5) + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} +SubShader { + Tags { + "Queue" = "AlphaTest" + "IgnoreProjector" = "True" + "RenderType" = "Opaque" + "ForceNoShadowCasting" = "True" + //"DisableBatching" = "LODFading" + } + LOD 300 + Offset -1,-1 + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + Blend DstColor Zero + ZWrite Off + Cull Back + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _TEAMCOLOR_ON + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Shaders/Definition/DecalMultiplicative.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "DEFERRED" + Tags { "LightMode" = "Deferred" } + + Blend DstColor Zero + ZWrite Off + Cull Back + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _TEAMCOLOR_ON + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile ___ UNITY_HDR_ON + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_DEFERRED + + #include "Assets/Alloy/Shaders/Definition/DecalMultiplicative.cginc" + #include "Assets/Alloy/Shaders/Forward/Gbuffer.cginc" + + ENDCG + } +} + +FallBack Off +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Shaders/3.0/Decal/Multiplicative.shader.meta b/Assets/Alloy/Shaders/3.0/Decal/Multiplicative.shader.meta new file mode 100644 index 0000000..bc5174f --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Decal/Multiplicative.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 3a9003da41c357c49b61bffffd4c8942 +timeCreated: 1448718456 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/3.0/Deferred.meta b/Assets/Alloy/Shaders/3.0/Deferred.meta new file mode 100644 index 0000000..20c50b7 --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Deferred.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: f9b30ea8b93c4144985b9dd9a6f49c22 +folderAsset: yes +timeCreated: 1491187108 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/3.0/Deferred/Alloy Deferred Reflections.shader b/Assets/Alloy/Shaders/3.0/Deferred/Alloy Deferred Reflections.shader new file mode 100644 index 0000000..6a52b29 --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Deferred/Alloy Deferred Reflections.shader @@ -0,0 +1,49 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Hidden/Alloy/Deferred Reflections" { +Properties { + _SrcBlend ("", Float) = 1 + _DstBlend ("", Float) = 1 +} +SubShader { + // Calculates reflection contribution from a single probe (rendered as cubes) or default reflection (rendered as full screen quad) + Pass { + ZWrite Off + ZTest LEqual + Blend [_SrcBlend] [_DstBlend] + + CGPROGRAM + #pragma target 3.0 + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #include "Assets/Alloy/Shaders/Deferred/ReflectionProbe.cginc" + #include "Assets/Alloy/Shaders/Lighting/Standard.cginc" + + ENDCG + } + + // Adds reflection buffer to the lighting buffer + Pass + { + ZWrite Off + ZTest Always + Blend [_SrcBlend] [_DstBlend] + + CGPROGRAM + #pragma target 3.0 + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #pragma multi_compile ___ UNITY_HDR_ON + + #include "Assets/Alloy/Shaders/Deferred/ReflectionAdd.cginc" + + ENDCG + } +} +Fallback Off +} + diff --git a/Assets/Alloy/Shaders/3.0/Deferred/Alloy Deferred Reflections.shader.meta b/Assets/Alloy/Shaders/3.0/Deferred/Alloy Deferred Reflections.shader.meta new file mode 100644 index 0000000..4e6baf1 --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Deferred/Alloy Deferred Reflections.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: ce8a251dc626ff8489d8d3effba3d99f +timeCreated: 1438395189 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/3.0/Deferred/Alloy Deferred Shading.shader b/Assets/Alloy/Shaders/3.0/Deferred/Alloy Deferred Shading.shader new file mode 100644 index 0000000..3ae8f4a --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Deferred/Alloy Deferred Shading.shader @@ -0,0 +1,64 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Hidden/Alloy/Deferred Shading" { +Properties { + _LightTexture0 ("", any) = "" {} + _LightTextureB0 ("", 2D) = "" {} + _ShadowMapTexture ("", any) = "" {} + _SrcBlend ("", Float) = 1 + _DstBlend ("", Float) = 1 +} +SubShader { + // Pass 1: Lighting pass + // LDR case - Lighting encoded into a subtractive ARGB8 buffer + // HDR case - Lighting additively blended into floating point buffer + Pass { + ZWrite Off + Blend [_SrcBlend] [_DstBlend] + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt + + #pragma multi_compile_lightpass + #pragma multi_compile ___ UNITY_HDR_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #include "Assets/Alloy/Shaders/Deferred/Light.cginc" + #include "Assets/Alloy/Shaders/Lighting/Standard.cginc" + + ENDCG + } + + // Pass 2: Final decode pass. + // Used only with HDR off, to decode the logarithmic buffer into the main RT + Pass { + ZTest Always + Cull Off + ZWrite Off + Stencil { + ref [_StencilNonBackground] + readmask [_StencilNonBackground] + // Normally just comp would be sufficient, but there's a bug and only front face stencil state is set (case 583207) + compback equal + compfront equal + } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #include "Assets/Alloy/Shaders/Deferred/Decode.cginc" + + ENDCG + } +} +Fallback Off +} diff --git a/Assets/Alloy/Shaders/3.0/Deferred/Alloy Deferred Shading.shader.meta b/Assets/Alloy/Shaders/3.0/Deferred/Alloy Deferred Shading.shader.meta new file mode 100644 index 0000000..2755161 --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Deferred/Alloy Deferred Shading.shader.meta @@ -0,0 +1,6 @@ +fileFormatVersion: 2 +guid: f0f89d068d8dd1f4ca16be0691ef0407 +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: diff --git a/Assets/Alloy/Shaders/3.0/Deferred/Alloy Deferred Skin.shader b/Assets/Alloy/Shaders/3.0/Deferred/Alloy Deferred Skin.shader new file mode 100644 index 0000000..cf7b19b --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Deferred/Alloy Deferred Skin.shader @@ -0,0 +1,67 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Hidden/Alloy/Deferred Skin" { +Properties { + _LightTexture0 ("", any) = "" {} + _LightTextureB0 ("", 2D) = "" {} + _ShadowMapTexture ("", any) = "" {} + _SrcBlend ("", Float) = 1 + _DstBlend ("", Float) = 1 +} +SubShader { + // Pass 1: Lighting pass + // LDR case - Lighting encoded into a subtractive ARGB8 buffer + // HDR case - Lighting additively blended into floating point buffer + Pass { + ZWrite Off + Blend [_SrcBlend] [_DstBlend] + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt + + #pragma multi_compile_lightpass + #pragma multi_compile ___ UNITY_HDR_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define A_SUBSURFACE_ON + #define A_SCATTERING_ON + + #include "Assets/Alloy/Shaders/Deferred/Light.cginc" + #include "Assets/Alloy/Shaders/Lighting/Standard.cginc" + + ENDCG + } + + // Pass 2: Final decode pass. + // Used only with HDR off, to decode the logarithmic buffer into the main RT + Pass { + ZTest Always + Cull Off + ZWrite Off + Stencil { + ref [_StencilNonBackground] + readmask [_StencilNonBackground] + // Normally just comp would be sufficient, but there's a bug and only front face stencil state is set (case 583207) + compback equal + compfront equal + } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #include "Assets/Alloy/Shaders/Deferred/Decode.cginc" + + ENDCG + } +} +Fallback Off +} diff --git a/Assets/Alloy/Shaders/3.0/Deferred/Alloy Deferred Skin.shader.meta b/Assets/Alloy/Shaders/3.0/Deferred/Alloy Deferred Skin.shader.meta new file mode 100644 index 0000000..84bfccf --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Deferred/Alloy Deferred Skin.shader.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 778e2b6e13c09be4e950a2c198a47f1c +timeCreated: 1443913431 +licenseType: Pro +ShaderImporter: + defaultTextures: + - _DeferredSkinLut: {fileID: 2800000, guid: d13510bb2be49aa40a66a0101efb6a36, type: 3} + - _LightTexture0: {instanceID: 0} + - _LightTextureB0: {instanceID: 0} + - _ShadowMapTexture: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/3.0/Deferred/Alloy Deferred Transmission.shader b/Assets/Alloy/Shaders/3.0/Deferred/Alloy Deferred Transmission.shader new file mode 100644 index 0000000..1aa5446 --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Deferred/Alloy Deferred Transmission.shader @@ -0,0 +1,66 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Hidden/Alloy/Deferred Transmission" { +Properties { + _LightTexture0 ("", any) = "" {} + _LightTextureB0 ("", 2D) = "" {} + _ShadowMapTexture ("", any) = "" {} + _SrcBlend ("", Float) = 1 + _DstBlend ("", Float) = 1 +} +SubShader { + // Pass 1: Lighting pass + // LDR case - Lighting encoded into a subtractive ARGB8 buffer + // HDR case - Lighting additively blended into floating point buffer + Pass { + ZWrite Off + Blend [_SrcBlend] [_DstBlend] + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt + + #pragma multi_compile_lightpass + #pragma multi_compile ___ UNITY_HDR_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define A_SUBSURFACE_ON + + #include "Assets/Alloy/Shaders/Deferred/Light.cginc" + #include "Assets/Alloy/Shaders/Lighting/Standard.cginc" + + ENDCG + } + + // Pass 2: Final decode pass. + // Used only with HDR off, to decode the logarithmic buffer into the main RT + Pass { + ZTest Always + Cull Off + ZWrite Off + Stencil { + ref [_StencilNonBackground] + readmask [_StencilNonBackground] + // Normally just comp would be sufficient, but there's a bug and only front face stencil state is set (case 583207) + compback equal + compfront equal + } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #include "Assets/Alloy/Shaders/Deferred/Decode.cginc" + + ENDCG + } +} +Fallback Off +} diff --git a/Assets/Alloy/Shaders/3.0/Deferred/Alloy Deferred Transmission.shader.meta b/Assets/Alloy/Shaders/3.0/Deferred/Alloy Deferred Transmission.shader.meta new file mode 100644 index 0000000..b15755c --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Deferred/Alloy Deferred Transmission.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 423122318a7170d4fbaac265e27ad62c +timeCreated: 1439521648 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/3.0/Deferred/Alloy Deferred UBER.shader b/Assets/Alloy/Shaders/3.0/Deferred/Alloy Deferred UBER.shader new file mode 100644 index 0000000..595b37a --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Deferred/Alloy Deferred UBER.shader @@ -0,0 +1,237 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Hidden/Alloy/Deferred Shading UBER" { +Properties { + _LightTexture0 ("", any) = "" {} + _LightTextureB0 ("", 2D) = "" {} + _ShadowMapTexture ("", any) = "" {} + _SrcBlend ("", Float) = 1 + _DstBlend ("", Float) = 1 +} + +// =================================== BEGIN UBER SUPPORT =================================== +CGINCLUDE + // UBER - Standard Shader Ultra integration + // https://www.assetstore.unity3d.com/en/#!/content/39959 + + // when using both features check UBER_StandardConfig.cginc to configure Gbuffer channels + // by default translucency is passed in diffuse (A) gbuffer and self-shadows are passed in normal (A) channel + // + // NOTE that you're not supposed to use Standard shader with occlusion data together with UBER translucency in deferred, because Standard Shader writes occlusion velue in GBUFFER0 alpha as the translucency does ! + // + #define UBER_TRANSLUCENCY_DEFERRED + #define UBER_POM_SELF_SHADOWS_DEFERRED + // + // comment this out when you'd like to have translucency in deferred not influenced by diffuse/base object color + #define UBER_TRANSLUCENCY_DEFERRED_MULT_DIFFUSE + // + // define when you like to control translucency power per light (its color alpha channel) + // note, that this can interfere with solutions that uses light color.a for different purpose (like Alloy) + //#define UBER_TRANSLUCENCY_PER_LIGHT_ALPHA + // + // you can gently turn it up (like 0.3, 0.5) if you find front facing geometry overbrighten (esp. for point lights), + // but suppresion can negate albedo for high translucency values (they can become badly black) + #define TRANSLUCENCY_SUPPRESS_DIFFUSECOLOR 0.0 + + // change to 1 to get GGX specularity model in deferred + #define UNITY_BRDF_GGX 1 +ENDCG +// ==================================== END UBER SUPPORT ==================================== + +SubShader { + // Pass 1: Lighting pass + // LDR case - Lighting encoded into a subtractive ARGB8 buffer + // HDR case - Lighting additively blended into floating point buffer + Pass { + ZWrite Off + Blend [_SrcBlend] [_DstBlend] + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt + + #pragma multi_compile_lightpass + #pragma multi_compile ___ UNITY_HDR_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #include "Assets/Alloy/Shaders/Deferred/Light.cginc" + #include "Assets/Alloy/Shaders/Framework/Lighting.cginc" + + // =================================== BEGIN UBER SUPPORT =================================== + + // UBER - POM self-shadowing (for one realtime light) + #if defined(UBER_POM_SELF_SHADOWS_DEFERRED) + float4 _WorldSpaceLightPosCustom; + #endif + + // UBER - Translucency, POM self-shadowing, wetness values encoded + #if defined(UBER_POM_SELF_SHADOWS_DEFERRED) || defined(UBER_TRANSLUCENCY_DEFERRED) + sampler2D _UBERPropsBuffer; + #endif + + // UBER - Translucency + #if defined(UBER_TRANSLUCENCY_DEFERRED) + sampler2D _UBERTranslucencySetup; + struct TranslucencyParams { + half3 _TranslucencyColor; + half _TranslucencyStrength; + half _TranslucencyConstant; + half _TranslucencyNormalOffset; + half _TranslucencyExponent; + half _TranslucencyPointLightDirectionality; + half _TranslucencySuppressRealtimeShadows; + half _TranslucencyNDotL; + }; + + inline half Translucency(half3 normalWorld, ADirect d, half3 eyeVec, TranslucencyParams translucencyParams) { + #ifdef USING_DIRECTIONAL_LIGHT + half tLitDot = saturate(dot((d.direction + normalWorld * translucencyParams._TranslucencyNormalOffset), eyeVec)); + #else + float3 lightDirectional = normalize(_LightPos.xyz - _WorldSpaceCameraPos.xyz); + half3 light_dir = normalize(lerp(d.direction, lightDirectional, translucencyParams._TranslucencyPointLightDirectionality)); + half tLitDot = saturate(dot((light_dir + normalWorld * translucencyParams._TranslucencyNormalOffset), eyeVec)); + #endif + + tLitDot = exp2(-translucencyParams._TranslucencyExponent * (1 - tLitDot)) * translucencyParams._TranslucencyStrength; + float NDotL = abs(dot(d.direction, normalWorld)); + tLitDot *= lerp(1, NDotL, translucencyParams._TranslucencyNDotL); + + half translucencyAtten = (tLitDot + translucencyParams._TranslucencyConstant*(NDotL + 0.1)); + //#if defined(UBER_TRANSLUCENCY_PER_LIGHT_ALPHA) + // translucencyAtten *= _LightColor.a; + //#endif + + return translucencyAtten; + } + #endif + + void aPreLighting( + inout ASurface s) + { + aStandardPreLighting(s); + } + + half3 aDirectLighting( + ADirect d, + ASurface s) + { + half3 color = 0.0h; + + #if defined(UBER_POM_SELF_SHADOWS_DEFERRED) || defined(UBER_TRANSLUCENCY_DEFERRED) + // buffer decoded from _CameraGBufferTexture3.a in command buffer + half Wetness = 0; + half SS = 1; + half translucencySetupIndex = 0; + half translucency_thickness = 0; + float encoded = tex2D(_UBERPropsBuffer, s.screenUv).r; + if (encoded < 0) { + encoded = -encoded; + + // wetness (not used currently so below line should get compiled out) + encoded /= 8.0; // 3 bits + Wetness = frac(encoded) * (8.0 / 7.0); // to 0..1 range + encoded = floor(encoded); + + // self shadowing + encoded /= 4.0; // 2 bits + SS = 1 - frac(encoded) * (4.0 / 3.0); // to 0..1 range + encoded = floor(encoded); + + // translucency color index + encoded /= 4.0; // 2 bits + translucencySetupIndex = frac(encoded); // directly decoded as U coord in lookup texture + encoded = floor(encoded); + + // translucency thickness + encoded /= 15.0; // 4 bits (divide by 15 instead of 16 to bring it immediately to 0..1 range) + translucency_thickness = encoded; + } // else - no prop used for this pixel (no translucency, self-shadowing and surface is considered to be dry) + //translucencySetupIndex = 0; + //translucency_thickness = 1; + #endif + + // UBER - POM self-shadowing (for one realtime light) + #if defined(UBER_POM_SELF_SHADOWS_DEFERRED) + // conditional to attenuate only the selected realtime light + #if defined (DIRECTIONAL) || defined (DIRECTIONAL_COOKIE) + d.shadow = (abs(dot((_LightDir.xyz + _WorldSpaceLightPosCustom.xyz), float3(1, 1, 1))) < 0.01) ? min(d.shadow, SS) : d.shadow; + #else + d.shadow = (abs(dot((_LightDir.xyz - _WorldSpaceLightPosCustom.xyz), float3(1, 1, 1))) < 0.01) ? min(d.shadow, SS) : d.shadow; + #endif + #endif + + #if defined(UBER_TRANSLUCENCY_DEFERRED) + half setupIndex = translucencySetupIndex; // [0..1] to [0..1) range + + half4 val; + val = tex2D(_UBERTranslucencySetup, float2(setupIndex, 0)); + TranslucencyParams translucencyParams; + translucencyParams._TranslucencyColor = val.rgb; + translucencyParams._TranslucencyStrength = val.a; + val = tex2D(_UBERTranslucencySetup, float2(setupIndex, 0.4)); + translucencyParams._TranslucencyPointLightDirectionality = val.r; + translucencyParams._TranslucencyConstant = val.g; + translucencyParams._TranslucencyNormalOffset = val.b; + translucencyParams._TranslucencyExponent = val.a; + val = tex2D(_UBERTranslucencySetup, float2(setupIndex, 0.8)); + translucencyParams._TranslucencySuppressRealtimeShadows = val.r; + translucencyParams._TranslucencyNDotL = val.g; + + half3 TL = Translucency(s.normalWorld, d, -s.viewDirWorld, translucencyParams)*translucencyParams._TranslucencyColor; + #if defined(UBER_TRANSLUCENCY_DEFERRED_MULT_DIFFUSE) + TL *= s.albedo; + #endif + TL *= translucency_thickness; + s.albedo *= saturate(1 - max(max(TL.r, TL.g), TL.b) * TRANSLUCENCY_SUPPRESS_DIFFUSECOLOR); + // suppress shadows + d.shadow = lerp(d.shadow, 1, saturate(dot(TL, 1) * translucencyParams._TranslucencySuppressRealtimeShadows)); + + color.rgb += d.shadow * TL * d.color.rgb; + #endif + + return color.rgb + aStandardDirectLighting(d, s); + } + + half3 aIndirectLighting( + AIndirect i, + ASurface s) + { + return aStandardIndirectLighting(i, s); + } + // ==================================== END UBER SUPPORT ==================================== + + ENDCG + } + + // Pass 2: Final decode pass. + // Used only with HDR off, to decode the logarithmic buffer into the main RT + Pass { + ZTest Always + Cull Off + ZWrite Off + Stencil { + ref [_StencilNonBackground] + readmask [_StencilNonBackground] + // Normally just comp would be sufficient, but there's a bug and only front face stencil state is set (case 583207) + compback equal + compfront equal + } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #include "Assets/Alloy/Shaders/Deferred/Decode.cginc" + + ENDCG + } +} +Fallback Off +} diff --git a/Assets/Alloy/Shaders/3.0/Deferred/Alloy Deferred UBER.shader.meta b/Assets/Alloy/Shaders/3.0/Deferred/Alloy Deferred UBER.shader.meta new file mode 100644 index 0000000..8f5a19e --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Deferred/Alloy Deferred UBER.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 424325049d5e2ac409f4308920c4b14a +timeCreated: 1439521648 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/3.0/Human.meta b/Assets/Alloy/Shaders/3.0/Human.meta new file mode 100644 index 0000000..7646e14 --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Human.meta @@ -0,0 +1,6 @@ +fileFormatVersion: 2 +guid: 237b76c8eac1cfc4da6f0654e7e4d956 +folderAsset: yes +DefaultImporter: + userData: + assetBundleName: diff --git a/Assets/Alloy/Shaders/3.0/Human/Eye.shader b/Assets/Alloy/Shaders/3.0/Human/Eye.shader new file mode 100644 index 0000000..032ab89 --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Human/Eye.shader @@ -0,0 +1,268 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Human/Eye" { +Properties { + // Eye Textures + _EyeballTextures ("'Eye Textures' {Section:{Color:0}}", Float) = 0 + [LM_Albedo] [LM_Transparency] + _Color ("'Tint' {}", Color) = (1,1,1,1) + [LM_MasterTilingOffset] [LM_Albedo] + _MainTex ("'Base Color(RGB) Iris(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _ParallaxMap ("'Heightmap(G)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "black" {} + [LM_NormalMap] + _BumpMap ("'Normals' {Visualize:{NRM}, Parent:_MainTex}", 2D) = "bump" {} + _BaseColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Cornea Properties + _CorneaProperties ("'Cornea' {Section:{Color:1}}", Float) = 0 + _CorneaColor ("'Tint' {}", Color) = (0.5,0.5,0.5,0) + _CorneaNormalMap ("'Normals' {Visualize:{NRM}, Parent:_MainTex}", 2D) = "bump" {} + _CorneaSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.36 + _CorneaRoughness ("'Roughness' {Min:0, Max:1}", Float) = 0.1 + _CorneaNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Iris Properties + _IrisProperties("'Iris' {Section:{Color:2}}", Float) = 0 + _IrisColor ("'Tint' {}", Color) = (1,1,1) + _Parallax ("'Depth' {Min:0, Max:0.08}", Float) = 0.02 + _IrisPupilSize ("'Pupil Dilation' {Min:0, Max:1}", Float) = 0 + _IrisShadowing ("'Shadowing' {Min:0.01}", Float) = 1.1 + _IrisScatterIntensity ("'Scatter Intensity' {Min:0}", Float) = 2 + _IrisScatterPower ("'Scatter Power' {Min:0.01}", Float) = 2.5 + + // Sclera Properties + _ScleraProperties ("'Sclera' {Section:{Color:3}}", Float) = 0 + _ScleraColor ("'Tint' {}", Color) = (1,1,1) + _ScleraSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.36 + _ScleraRoughness ("'Roughness' {Min:0, Max:1}", Float) = 0.1 + _ScleraNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Detail + [Toggle(_DETAIL_MULX2)] + _DetailT ("'Detail' {Feature:{Color:7}}", Float) = 0 + _DetailNormalMap ("'Normals' {Visualize:{NRM}}", 2D) = "bump" {} + _DetailWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DetailNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Decal + [Toggle(_DECAL_ON)] + _Decal ("'Decal' {Feature:{Color:9}}", Float) = 0 + _DecalColor ("'Tint' {}", Color) = (1,1,1,1) + _DecalTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "black" {} + _DecalTexUV ("UV Set", Float) = 0 + _DecalWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DecalSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _DecalAlphaVertexTint ("'Vertex Alpha Tint' {Min:0, Max:1}", Float) = 0 + + // Emission + [Toggle(_EMISSION)] + _Emission ("'Emission' {Feature:{Color:10}}", Float) = 0 + [LM_Emission] + [HDR] + _EmissionColor ("'Tint' {}", Color) = (1,1,1) + [LM_Emission] + _EmissionMap ("'Mask(RGB)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "white" {} + _IncandescenceMap ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _IncandescenceMapVelocity ("Scroll", Vector) = (0,0,0,0) + _IncandescenceMapUV ("UV Set", Float) = 0 + [Gamma] + _EmissionWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + + // Rim Emission + [Toggle(_RIM_ON)] + _Rim ("'Rim Emission' {Feature:{Color:11}}", Float) = 0 + [HDR] + _RimColor ("'Tint' {}", Color) = (1,1,1) + _RimTex ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _RimTexVelocity ("Scroll", Vector) = (0,0,0,0) + _RimTexUV ("UV Set", Float) = 0 + [Gamma] + _RimWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + [Gamma] + _RimBias ("'Fill' {Min:0, Max:1}", Float) = 0 + _RimPower ("'Falloff' {Min:0.01}", Float) = 4 + + // Dissolve + [Toggle(_DISSOLVE_ON)] + _Dissolve ("'Dissolve' {Feature:{Color:12}}", Float) = 0 + [HDR] + _DissolveGlowColor ("'Glow Tint' {}", Color) = (1,1,1,1) + _DissolveTex ("'Glow Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _DissolveTexUV ("UV Set", Float) = 0 + _DissolveCutoff ("'Cutoff' {Min:0, Max:1}", Float) = 0 + [Gamma] + _DissolveGlowWeight ("'Glow Weight' {Min:0, Max:1}", Float) = 1 + _DissolveEdgeWidth ("'Glow Width' {Min:0, Max:1}", Float) = 0.01 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _Lightmapping ("'GI' {LightmapEmissionProperty:{}}", Float) = 1 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} + +SubShader { + Tags { + "Queue" = "Geometry" + "RenderType" = "Opaque" + //"DisableBatching" = "LODFading" + } + LOD 400 + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Shaders/Definition/Eye.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend One One + ZWrite Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _DECAL_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + + #include "Assets/Alloy/Shaders/Definition/Eye.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _DISSOLVE_ON + + #pragma multi_compile_shadowcaster + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_SHADOWCASTER + + #include "Assets/Alloy/Shaders/Definition/Eye.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } + + Pass { + Name "DEFERRED" + Tags { "LightMode" = "Deferred" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_prepassfinal + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_DEFERRED + + #include "Assets/Alloy/Shaders/Definition/Eye.cginc" + #include "Assets/Alloy/Shaders/Forward/Gbuffer.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Shaders/Definition/Eye.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +FallBack "VertexLit" +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Shaders/3.0/Human/Eye.shader.meta b/Assets/Alloy/Shaders/3.0/Human/Eye.shader.meta new file mode 100644 index 0000000..f16f3ce --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Human/Eye.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: e284a0f4248c43f44a7e8504f6cdc165 +timeCreated: 1467835759 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/3.0/Human/Hair HighQuality OneSided.shader b/Assets/Alloy/Shaders/3.0/Human/Hair HighQuality OneSided.shader new file mode 100644 index 0000000..ad2d6d1 --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Human/Hair HighQuality OneSided.shader @@ -0,0 +1,326 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Human/Hair/HighQuality OneSided" { +Properties { + // Global Settings + [LM_TransparencyCutOff] + _Cutoff ("'Opacity Cutoff' {Min:0, Max:1}", Float) = 0.5 + + // Hair Textures + _MainTextures ("'Hair Textures' {Section:{Color:0}}", Float) = 0 + [LM_Albedo] [LM_Transparency] + _Color ("'Tint' {}", Color) = (1,1,1,1) + [LM_MasterTilingOffset] [LM_Albedo] + _MainTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _MainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _MainTexUV ("UV Set", Float) = 0 + [LM_Metallic] + _SpecTex ("'Shift(R) AO(G) Noise(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_MainTex}", 2D) = "white" {} + [LM_NormalMap] + _BumpMap ("'Normals' {Visualize:{NRM}, Parent:_MainTex}", 2D) = "bump" {} + _BaseColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Hair Properties + _HairProperties ("'Hair Properties' {Section:{Color:1}}", Float) = 0 + _HairDiffuseWrapAmount ("'Diffuse Wrap' {Min:0, Max:1}", Float) = 0.25 + _HairSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.59 + _AnisoAngle ("'Highlight Rotation' {Min:0, Max:180}", Float) = 90 + _Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _BumpScale ("'Normal Strength' {}", Float) = 1 + + // Primary Highlight + _PrimaryAnisoProperties ("'Primary Highlight' {Section:{Color:2}}", Float) = 0 + _HighlightTint0 ("'Tint' {}", Color) = (1,1,1) + _HighlightWidth0 ("'Width' {Min:0, Max:1}", Float) = 0.25 + _HighlightShift0 ("'Shift' {}", Float) = 0 + + // Secondary Highlight + _SecondaryAnisoProperties ("'Secondary Highlight' {Section:{Color:3}}", Float) = 0 + _HighlightTint1 ("'Tint' {}", Color) = (1,1,1) + _HighlightWidth1 ("'Width' {Min:0, Max:1}", Float) = 0.25 + _HighlightShift1 ("'Shift' {}", Float) = 0 + + // Decal + [Toggle(_DECAL_ON)] + _Decal ("'Decal' {Feature:{Color:9}}", Float) = 0 + _DecalColor ("'Tint' {}", Color) = (1,1,1,1) + _DecalTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "black" {} + _DecalTexUV ("UV Set", Float) = 0 + _DecalWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DecalSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _DecalAlphaVertexTint ("'Vertex Alpha Tint' {Min:0, Max:1}", Float) = 0 + + // Emission + [Toggle(_EMISSION)] + _Emission ("'Emission' {Feature:{Color:10}}", Float) = 0 + [LM_Emission] + [HDR] + _EmissionColor ("'Tint' {}", Color) = (1,1,1) + [LM_Emission] + _EmissionMap ("'Mask(RGB)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "white" {} + _IncandescenceMap ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _IncandescenceMapVelocity ("Scroll", Vector) = (0,0,0,0) + _IncandescenceMapUV ("UV Set", Float) = 0 + [Gamma] + _EmissionWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + + // Rim Emission + [Toggle(_RIM_ON)] + _Rim ("'Rim Emission' {Feature:{Color:11}}", Float) = 0 + [HDR] + _RimColor ("'Tint' {}", Color) = (1,1,1) + _RimTex ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _RimTexVelocity ("Scroll", Vector) = (0,0,0,0) + _RimTexUV ("UV Set", Float) = 0 + [Gamma] + _RimWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + [Gamma] + _RimBias ("'Fill' {Min:0, Max:1}", Float) = 0 + _RimPower ("'Falloff' {Min:0.01}", Float) = 4 + + // Dissolve + [Toggle(_DISSOLVE_ON)] + _Dissolve ("'Dissolve' {Feature:{Color:12}}", Float) = 0 + [HDR] + _DissolveGlowColor ("'Glow Tint' {}", Color) = (1,1,1,1) + _DissolveTex ("'Glow Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _DissolveTexUV ("UV Set", Float) = 0 + _DissolveCutoff ("'Cutoff' {Min:0, Max:1}", Float) = 0 + [Gamma] + _DissolveGlowWeight ("'Glow Weight' {Min:0, Max:1}", Float) = 1 + _DissolveEdgeWidth ("'Glow Width' {Min:0, Max:1}", Float) = 0.01 + + // Wetness + [Toggle(_WETNESS_ON)] + _WetnessProperties ("'Wetness' {Feature:{Color:13}}", Float) = 0 + [Toggle(_WETMASKSOURCE_VERTEXCOLORALPHA)] + _WetMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_WetMask}}}", Float) = 0 + _WetMask ("'Mask(A)' {Visualize:{A}}", 2D) = "white" {} + _WetMaskVelocity ("Scroll", Vector) = (0,0,0,0) + _WetMaskUV ("UV Set", Float) = 0 + _WetMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + _WetTint ("'Tint' {}", Color) = (1,1,1,1) + _WetWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _WetRoughness ("'Roughness' {Min:0, Max:1}", Float) = 0.2 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _Lightmapping ("'GI' {LightmapEmissionProperty:{}}", Float) = 1 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} + +SubShader { + Tags{ + "Queue" = "AlphaTest+1" + "IgnoreProjector" = "True" + "RenderType" = "TransparentCutout" + //"DisableBatching" = "LODFading" + } + LOD 400 + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + #define _ALPHATEST_ON + + #include "Assets/Alloy/Shaders/Definition/Hair.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend One One + ZWrite Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _DECAL_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + #define _ALPHATEST_ON + + #include "Assets/Alloy/Shaders/Definition/Hair.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "TRANSLUCENT_FRONT_FORWARD" + Tags { "LightMode" = "ForwardBase" } + + Blend SrcAlpha OneMinusSrcAlpha + ZWrite Off + ZTest Less + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + #define _ALPHABLEND_ON + + #include "Assets/Alloy/Shaders/Definition/Hair.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "TRANSLUCENT_FRONT_FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend SrcAlpha One + ZWrite Off + ZTest Less + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _DECAL_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + #define _ALPHABLEND_ON + + #include "Assets/Alloy/Shaders/Definition/Hair.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _DISSOLVE_ON + + #pragma multi_compile_shadowcaster + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define _ALPHATEST_ON + #define UNITY_PASS_SHADOWCASTER + + #include "Assets/Alloy/Shaders/Definition/Hair.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Shaders/Definition/Hair.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +FallBack "VertexLit" +CustomEditor "AlloyFieldBasedEditor" +} \ No newline at end of file diff --git a/Assets/Alloy/Shaders/3.0/Human/Hair HighQuality OneSided.shader.meta b/Assets/Alloy/Shaders/3.0/Human/Hair HighQuality OneSided.shader.meta new file mode 100644 index 0000000..ee4b3ee --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Human/Hair HighQuality OneSided.shader.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: a5b11bdb9da17cf46a6a82a0074c37fc +ShaderImporter: + defaultTextures: + - _MainTex: {instanceID: 0} + - _SpecTex: {fileID: 2800000, guid: 33a37609d895f134d80ba24c3cf0f503, type: 3} + - _BumpMap: {instanceID: 0} + - _DecalTex: {instanceID: 0} + - _EmissionMap: {instanceID: 0} + - _IncandescenceMap: {instanceID: 0} + - _RimTex: {instanceID: 0} + - _DissolveTex: {instanceID: 0} + userData: + assetBundleName: diff --git a/Assets/Alloy/Shaders/3.0/Human/Hair HighQuality TwoSided.shader b/Assets/Alloy/Shaders/3.0/Human/Hair HighQuality TwoSided.shader new file mode 100644 index 0000000..2d4140c --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Human/Hair HighQuality TwoSided.shader @@ -0,0 +1,411 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Human/Hair/HighQuality TwoSided" { +Properties { + // Global Settings + [LM_TransparencyCutOff] + _Cutoff ("'Opacity Cutoff' {Min:0, Max:1}", Float) = 0.5 + + // Hair Textures + _MainTextures ("'Hair Textures' {Section:{Color:0}}", Float) = 0 + [LM_Albedo] [LM_Transparency] + _Color ("'Tint' {}", Color) = (1,1,1,1) + [LM_MasterTilingOffset] [LM_Albedo] + _MainTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _MainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _MainTexUV ("UV Set", Float) = 0 + [LM_Metallic] + _SpecTex ("'Shift(R) AO(G) Noise(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_MainTex}", 2D) = "white" {} + [LM_NormalMap] + _BumpMap ("'Normals' {Visualize:{NRM}, Parent:_MainTex}", 2D) = "bump" {} + _BaseColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Hair Properties + _HairProperties ("'Hair Properties' {Section:{Color:1}}", Float) = 0 + _HairDiffuseWrapAmount ("'Diffuse Wrap' {Min:0, Max:1}", Float) = 0.25 + _HairSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.59 + _AnisoAngle ("'Highlight Rotation' {Min:0, Max:180}", Float) = 90 + _Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _BumpScale ("'Normal Strength' {}", Float) = 1 + + // Primary Highlight + _PrimaryAnisoProperties ("'Primary Highlight' {Section:{Color:2}}", Float) = 0 + _HighlightTint0 ("'Tint' {}", Color) = (1,1,1) + _HighlightWidth0 ("'Width' {Min:0, Max:1}", Float) = 0.25 + _HighlightShift0 ("'Shift' {}", Float) = 0 + + // Secondary Highlight + _SecondaryAnisoProperties ("'Secondary Highlight' {Section:{Color:3}}", Float) = 0 + _HighlightTint1 ("'Tint' {}", Color) = (1,1,1) + _HighlightWidth1 ("'Width' {Min:0, Max:1}", Float) = 0.25 + _HighlightShift1 ("'Shift' {}", Float) = 0 + + // Decal + [Toggle(_DECAL_ON)] + _Decal ("'Decal' {Feature:{Color:9}}", Float) = 0 + _DecalColor ("'Tint' {}", Color) = (1,1,1,1) + _DecalTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "black" {} + _DecalTexUV ("UV Set", Float) = 0 + _DecalWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DecalSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _DecalAlphaVertexTint ("'Vertex Alpha Tint' {Min:0, Max:1}", Float) = 0 + + // Emission + [Toggle(_EMISSION)] + _Emission ("'Emission' {Feature:{Color:10}}", Float) = 0 + [LM_Emission] + [HDR] + _EmissionColor ("'Tint' {}", Color) = (1,1,1) + [LM_Emission] + _EmissionMap ("'Mask(RGB)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "white" {} + _IncandescenceMap ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _IncandescenceMapVelocity ("Scroll", Vector) = (0,0,0,0) + _IncandescenceMapUV ("UV Set", Float) = 0 + [Gamma] + _EmissionWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + + // Rim Emission + [Toggle(_RIM_ON)] + _Rim ("'Rim Emission' {Feature:{Color:11}}", Float) = 0 + [HDR] + _RimColor ("'Tint' {}", Color) = (1,1,1) + _RimTex ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _RimTexVelocity ("Scroll", Vector) = (0,0,0,0) + _RimTexUV ("UV Set", Float) = 0 + [Gamma] + _RimWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + [Gamma] + _RimBias ("'Fill' {Min:0, Max:1}", Float) = 0 + _RimPower ("'Falloff' {Min:0.01}", Float) = 4 + + // Dissolve + [Toggle(_DISSOLVE_ON)] + _Dissolve ("'Dissolve' {Feature:{Color:12}}", Float) = 0 + [HDR] + _DissolveGlowColor ("'Glow Tint' {}", Color) = (1,1,1,1) + _DissolveTex ("'Glow Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _DissolveTexUV ("UV Set", Float) = 0 + _DissolveCutoff ("'Cutoff' {Min:0, Max:1}", Float) = 0 + [Gamma] + _DissolveGlowWeight ("'Glow Weight' {Min:0, Max:1}", Float) = 1 + _DissolveEdgeWidth ("'Glow Width' {Min:0, Max:1}", Float) = 0.01 + + // Wetness + [Toggle(_WETNESS_ON)] + _WetnessProperties ("'Wetness' {Feature:{Color:13}}", Float) = 0 + [Toggle(_WETMASKSOURCE_VERTEXCOLORALPHA)] + _WetMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_WetMask}}}", Float) = 0 + _WetMask ("'Mask(A)' {Visualize:{A}}", 2D) = "white" {} + _WetMaskVelocity ("Scroll", Vector) = (0,0,0,0) + _WetMaskUV ("UV Set", Float) = 0 + _WetMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + _WetTint ("'Tint' {}", Color) = (1,1,1,1) + _WetWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _WetRoughness ("'Roughness' {Min:0, Max:1}", Float) = 0.2 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _Lightmapping ("'GI' {LightmapEmissionProperty:{}}", Float) = 1 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} + +CGINCLUDE + #define A_TWO_SIDED_SHADER +ENDCG + +SubShader { + Tags{ + "Queue" = "AlphaTest+1" + "IgnoreProjector" = "True" + "RenderType" = "TransparentCutout" + //"DisableBatching" = "LODFading" + } + LOD 400 + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + Cull Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + #define _ALPHATEST_ON + + #include "Assets/Alloy/Shaders/Definition/Hair.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend One One + ZWrite Off + Cull Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _DECAL_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + #define _ALPHATEST_ON + + #include "Assets/Alloy/Shaders/Definition/Hair.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "TRANSLUCENT_BACK_FORWARD" + Tags { "LightMode" = "ForwardBase" } + + Blend SrcAlpha OneMinusSrcAlpha + ZWrite Off + ZTest Less + Cull Front + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + #define _ALPHABLEND_ON + + #include "Assets/Alloy/Shaders/Definition/Hair.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "TRANSLUCENT_BACK_FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend SrcAlpha One + ZWrite Off + ZTest Less + Cull Front + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _DECAL_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + #define _ALPHABLEND_ON + + #include "Assets/Alloy/Shaders/Definition/Hair.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "TRANSLUCENT_FRONT_FORWARD" + Tags { "LightMode" = "ForwardBase" } + + Blend SrcAlpha OneMinusSrcAlpha + ZWrite Off + ZTest Less + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + #define _ALPHABLEND_ON + + #include "Assets/Alloy/Shaders/Definition/Hair.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "TRANSLUCENT_FRONT_FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend SrcAlpha One + ZWrite Off + ZTest Less + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _DECAL_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + #define _ALPHABLEND_ON + + #include "Assets/Alloy/Shaders/Definition/Hair.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + Cull Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _DISSOLVE_ON + + #pragma multi_compile_shadowcaster + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_SHADOWCASTER + #define _ALPHATEST_ON + + #include "Assets/Alloy/Shaders/Definition/Hair.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Shaders/Definition/Hair.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +FallBack "VertexLit" +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Shaders/3.0/Human/Hair HighQuality TwoSided.shader.meta b/Assets/Alloy/Shaders/3.0/Human/Hair HighQuality TwoSided.shader.meta new file mode 100644 index 0000000..c897d03 --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Human/Hair HighQuality TwoSided.shader.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: a4470eaf12f6ddd4693a852732ddcb36 +ShaderImporter: + defaultTextures: + - _MainTex: {instanceID: 0} + - _SpecTex: {fileID: 2800000, guid: 33a37609d895f134d80ba24c3cf0f503, type: 3} + - _BumpMap: {instanceID: 0} + - _DecalTex: {instanceID: 0} + - _EmissionMap: {instanceID: 0} + - _IncandescenceMap: {instanceID: 0} + - _RimTex: {instanceID: 0} + - _DissolveTex: {instanceID: 0} + userData: + assetBundleName: diff --git a/Assets/Alloy/Shaders/3.0/Human/Hair LowQuality OneSided.shader b/Assets/Alloy/Shaders/3.0/Human/Hair LowQuality OneSided.shader new file mode 100644 index 0000000..1e330a8 --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Human/Hair LowQuality OneSided.shader @@ -0,0 +1,263 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Human/Hair/LowQuality OneSided" { +Properties { + // Global Settings + _Mode ("'Rendering Mode' {RenderingMode:{Opaque:{_Cutoff}, Cutout:{}, Fade:{_Cutoff}, Transparent:{_Cutoff}}}", Float) = 0 + _SrcBlend ("__src", Float) = 0 + _DstBlend ("__dst", Float) = 0 + _ZWrite ("__zw", Float) = 1 + [LM_TransparencyCutOff] + _Cutoff ("'Opacity Cutoff' {Min:0, Max:1}", Float) = 0.5 + + // Hair Textures + _MainTextures ("'Hair Textures' {Section:{Color:0}}", Float) = 0 + [LM_Albedo] [LM_Transparency] + _Color ("'Tint' {}", Color) = (1,1,1,1) + [LM_MasterTilingOffset] [LM_Albedo] + _MainTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _MainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _MainTexUV ("UV Set", Float) = 0 + [LM_Metallic] + _SpecTex ("'Shift(R) AO(G) Noise(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_MainTex}", 2D) = "white" {} + [LM_NormalMap] + _BumpMap ("'Normals' {Visualize:{NRM}, Parent:_MainTex}", 2D) = "bump" {} + _BaseColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Hair Properties + _HairProperties ("'Hair Properties' {Section:{Color:1}}", Float) = 0 + _HairDiffuseWrapAmount ("'Diffuse Wrap' {Min:0, Max:1}", Float) = 0.25 + _HairSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.59 + _AnisoAngle ("'Highlight Rotation' {Min:0, Max:180}", Float) = 90 + _Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _BumpScale ("'Normal Strength' {}", Float) = 1 + + // Primary Highlight + _PrimaryAnisoProperties ("'Primary Highlight' {Section:{Color:2}}", Float) = 0 + _HighlightTint0 ("'Tint' {}", Color) = (1,1,1) + _HighlightWidth0 ("'Width' {Min:0, Max:1}", Float) = 0.25 + _HighlightShift0 ("'Shift' {}", Float) = 0 + + // Secondary Highlight + _SecondaryAnisoProperties ("'Secondary Highlight' {Section:{Color:3}}", Float) = 0 + _HighlightTint1 ("'Tint' {}", Color) = (1,1,1) + _HighlightWidth1 ("'Width' {Min:0, Max:1}", Float) = 0.25 + _HighlightShift1 ("'Shift' {}", Float) = 0 + + // Decal + [Toggle(_DECAL_ON)] + _Decal ("'Decal' {Feature:{Color:9}}", Float) = 0 + _DecalColor ("'Tint' {}", Color) = (1,1,1,1) + _DecalTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "black" {} + _DecalTexUV ("UV Set", Float) = 0 + + _DecalWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DecalSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _DecalAlphaVertexTint ("'Vertex Alpha Tint' {Min:0, Max:1}", Float) = 0 + + // Emission + [Toggle(_EMISSION)] + _Emission ("'Emission' {Feature:{Color:10}}", Float) = 0 + [LM_Emission] + [HDR] + _EmissionColor ("'Tint' {}", Color) = (1,1,1) + [LM_Emission] + _EmissionMap ("'Mask(RGB)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "white" {} + _IncandescenceMap ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _IncandescenceMapVelocity ("Scroll", Vector) = (0,0,0,0) + _IncandescenceMapUV ("UV Set", Float) = 0 + [Gamma] + _EmissionWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + + // Rim Emission + [Toggle(_RIM_ON)] + _Rim ("'Rim Emission' {Feature:{Color:11}}", Float) = 0 + [HDR] + _RimColor ("'Tint' {}", Color) = (1,1,1) + _RimTex ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _RimTexVelocity ("Scroll", Vector) = (0,0,0,0) + _RimTexUV ("UV Set", Float) = 0 + [Gamma] + _RimWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + [Gamma] + _RimBias ("'Fill' {Min:0, Max:1}", Float) = 0 + _RimPower ("'Falloff' {Min:0.01}", Float) = 4 + + // Dissolve + [Toggle(_DISSOLVE_ON)] + _Dissolve ("'Dissolve' {Feature:{Color:12}}", Float) = 0 + [HDR] + _DissolveGlowColor ("'Glow Tint' {}", Color) = (1,1,1,1) + _DissolveTex ("'Glow Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _DissolveTexUV ("UV Set", Float) = 0 + _DissolveCutoff ("'Cutoff' {Min:0, Max:1}", Float) = 0 + [Gamma] + _DissolveGlowWeight ("'Glow Weight' {Min:0, Max:1}", Float) = 1 + _DissolveEdgeWidth ("'Glow Width' {Min:0, Max:1}", Float) = 0.01 + + // Wetness + [Toggle(_WETNESS_ON)] + _WetnessProperties ("'Wetness' {Feature:{Color:13}}", Float) = 0 + [Toggle(_WETMASKSOURCE_VERTEXCOLORALPHA)] + _WetMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_WetMask}}}", Float) = 0 + _WetMask ("'Mask(A)' {Visualize:{A}}", 2D) = "white" {} + _WetMaskVelocity ("Scroll", Vector) = (0,0,0,0) + _WetMaskUV ("UV Set", Float) = 0 + _WetMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + _WetTint ("'Tint' {}", Color) = (1,1,1,1) + _WetWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _WetRoughness ("'Roughness' {Min:0, Max:1}", Float) = 0.2 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _Lightmapping ("'GI' {LightmapEmissionProperty:{}}", Float) = 1 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} + +SubShader { + Tags { + "RenderType" = "Opaque" + "PerformanceChecks" = "False" + //"DisableBatching" = "LODFading" + } + LOD 300 + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + Blend [_SrcBlend] [_DstBlend] + ZWrite [_ZWrite] + Cull Back + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Shaders/Definition/Hair.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend [_SrcBlend] One + ZWrite Off + Cull Back + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + + #include "Assets/Alloy/Shaders/Definition/Hair.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + Cull Back + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature _DISSOLVE_ON + + #pragma multi_compile_shadowcaster + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_SHADOWCASTER + + #include "Assets/Alloy/Shaders/Definition/Hair.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Shaders/Definition/Hair.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +FallBack "VertexLit" +CustomEditor "AlloyFieldBasedEditor" +} \ No newline at end of file diff --git a/Assets/Alloy/Shaders/3.0/Human/Hair LowQuality OneSided.shader.meta b/Assets/Alloy/Shaders/3.0/Human/Hair LowQuality OneSided.shader.meta new file mode 100644 index 0000000..ad1ec66 --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Human/Hair LowQuality OneSided.shader.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: ab9b48e546e5bb840863fb69105d68ea +ShaderImporter: + defaultTextures: + - _MainTex: {instanceID: 0} + - _SpecTex: {fileID: 2800000, guid: 33a37609d895f134d80ba24c3cf0f503, type: 3} + - _BumpMap: {instanceID: 0} + - _DecalTex: {instanceID: 0} + - _EmissionMap: {instanceID: 0} + - _IncandescenceMap: {instanceID: 0} + - _RimTex: {instanceID: 0} + - _DissolveTex: {instanceID: 0} + userData: + assetBundleName: diff --git a/Assets/Alloy/Shaders/3.0/Human/Hair LowQuality TwoSided.shader b/Assets/Alloy/Shaders/3.0/Human/Hair LowQuality TwoSided.shader new file mode 100644 index 0000000..f750c18 --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Human/Hair LowQuality TwoSided.shader @@ -0,0 +1,267 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Human/Hair/LowQuality TwoSided" { +Properties { + // Global Settings + _Mode ("'Rendering Mode' {RenderingMode:{Opaque:{_Cutoff}, Cutout:{}, Fade:{_Cutoff}, Transparent:{_Cutoff}}}", Float) = 0 + _SrcBlend ("__src", Float) = 0 + _DstBlend ("__dst", Float) = 0 + _ZWrite ("__zw", Float) = 1 + [LM_TransparencyCutOff] + _Cutoff ("'Opacity Cutoff' {Min:0, Max:1}", Float) = 0.5 + + // Hair Textures + _MainTextures ("'Hair Textures' {Section:{Color:0}}", Float) = 0 + [LM_Albedo] [LM_Transparency] + _Color ("'Tint' {}", Color) = (1,1,1,1) + [LM_MasterTilingOffset] [LM_Albedo] + _MainTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _MainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _MainTexUV ("UV Set", Float) = 0 + [LM_Metallic] + _SpecTex ("'Shift(R) AO(G) Noise(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_MainTex}", 2D) = "white" {} + [LM_NormalMap] + _BumpMap ("'Normals' {Visualize:{NRM}, Parent:_MainTex}", 2D) = "bump" {} + _BaseColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Hair Properties + _HairProperties ("'Hair Properties' {Section:{Color:1}}", Float) = 0 + _HairDiffuseWrapAmount ("'Diffuse Wrap' {Min:0, Max:1}", Float) = 0.25 + _HairSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.59 + _AnisoAngle ("'Highlight Rotation' {Min:0, Max:180}", Float) = 90 + _Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _BumpScale ("'Normal Strength' {}", Float) = 1 + + // Primary Highlight + _PrimaryAnisoProperties ("'Primary Highlight' {Section:{Color:2}}", Float) = 0 + _HighlightTint0 ("'Tint' {}", Color) = (1,1,1) + _HighlightWidth0 ("'Width' {Min:0, Max:1}", Float) = 0.25 + _HighlightShift0 ("'Shift' {}", Float) = 0 + + // Secondary Highlight + _SecondaryAnisoProperties ("'Secondary Highlight' {Section:{Color:3}}", Float) = 0 + _HighlightTint1 ("'Tint' {}", Color) = (1,1,1) + _HighlightWidth1 ("'Width' {Min:0, Max:1}", Float) = 0.25 + _HighlightShift1 ("'Shift' {}", Float) = 0 + + // Decal + [Toggle(_DECAL_ON)] + _Decal ("'Decal' {Feature:{Color:9}}", Float) = 0 + _DecalColor ("'Tint' {}", Color) = (1,1,1,1) + _DecalTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "black" {} + _DecalTexUV ("UV Set", Float) = 0 + + _DecalWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DecalSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _DecalAlphaVertexTint ("'Vertex Alpha Tint' {Min:0, Max:1}", Float) = 0 + + // Emission + [Toggle(_EMISSION)] + _Emission ("'Emission' {Feature:{Color:10}}", Float) = 0 + [LM_Emission] + [HDR] + _EmissionColor ("'Tint' {}", Color) = (1,1,1) + [LM_Emission] + _EmissionMap ("'Mask(RGB)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "white" {} + _IncandescenceMap ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _IncandescenceMapVelocity ("Scroll", Vector) = (0,0,0,0) + _IncandescenceMapUV ("UV Set", Float) = 0 + [Gamma] + _EmissionWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + + // Rim Emission + [Toggle(_RIM_ON)] + _Rim ("'Rim Emission' {Feature:{Color:11}}", Float) = 0 + [HDR] + _RimColor ("'Tint' {}", Color) = (1,1,1) + _RimTex ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _RimTexVelocity ("Scroll", Vector) = (0,0,0,0) + _RimTexUV ("UV Set", Float) = 0 + [Gamma] + _RimWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + [Gamma] + _RimBias ("'Fill' {Min:0, Max:1}", Float) = 0 + _RimPower ("'Falloff' {Min:0.01}", Float) = 4 + + // Dissolve + [Toggle(_DISSOLVE_ON)] + _Dissolve ("'Dissolve' {Feature:{Color:12}}", Float) = 0 + [HDR] + _DissolveGlowColor ("'Glow Tint' {}", Color) = (1,1,1,1) + _DissolveTex ("'Glow Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _DissolveTexUV ("UV Set", Float) = 0 + _DissolveCutoff ("'Cutoff' {Min:0, Max:1}", Float) = 0 + [Gamma] + _DissolveGlowWeight ("'Glow Weight' {Min:0, Max:1}", Float) = 1 + _DissolveEdgeWidth ("'Glow Width' {Min:0, Max:1}", Float) = 0.01 + + // Wetness + [Toggle(_WETNESS_ON)] + _WetnessProperties ("'Wetness' {Feature:{Color:13}}", Float) = 0 + [Toggle(_WETMASKSOURCE_VERTEXCOLORALPHA)] + _WetMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_WetMask}}}", Float) = 0 + _WetMask ("'Mask(A)' {Visualize:{A}}", 2D) = "white" {} + _WetMaskVelocity ("Scroll", Vector) = (0,0,0,0) + _WetMaskUV ("UV Set", Float) = 0 + _WetMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + _WetTint ("'Tint' {}", Color) = (1,1,1,1) + _WetWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _WetRoughness ("'Roughness' {Min:0, Max:1}", Float) = 0.2 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _Lightmapping ("'GI' {LightmapEmissionProperty:{}}", Float) = 1 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} + +CGINCLUDE + #define A_TWO_SIDED_SHADER +ENDCG + +SubShader { + Tags { + "RenderType" = "Opaque" + "PerformanceChecks" = "False" + //"DisableBatching" = "LODFading" + } + LOD 300 + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + Blend [_SrcBlend] [_DstBlend] + ZWrite [_ZWrite] + Cull Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Shaders/Definition/Hair.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend [_SrcBlend] One + ZWrite Off + Cull Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + + #include "Assets/Alloy/Shaders/Definition/Hair.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + Cull Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature _DISSOLVE_ON + + #pragma multi_compile_shadowcaster + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_SHADOWCASTER + + #include "Assets/Alloy/Shaders/Definition/Hair.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Shaders/Definition/Hair.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +FallBack "VertexLit" +CustomEditor "AlloyFieldBasedEditor" +} \ No newline at end of file diff --git a/Assets/Alloy/Shaders/3.0/Human/Hair LowQuality TwoSided.shader.meta b/Assets/Alloy/Shaders/3.0/Human/Hair LowQuality TwoSided.shader.meta new file mode 100644 index 0000000..91cb79e --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Human/Hair LowQuality TwoSided.shader.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 582ab6c109f22334ba5257f8c933ecc8 +ShaderImporter: + defaultTextures: + - _MainTex: {instanceID: 0} + - _SpecTex: {fileID: 2800000, guid: 33a37609d895f134d80ba24c3cf0f503, type: 3} + - _BumpMap: {instanceID: 0} + - _DecalTex: {instanceID: 0} + - _EmissionMap: {instanceID: 0} + - _IncandescenceMap: {instanceID: 0} + - _RimTex: {instanceID: 0} + - _DissolveTex: {instanceID: 0} + userData: + assetBundleName: diff --git a/Assets/Alloy/Shaders/3.0/Human/Skin Forward.shader b/Assets/Alloy/Shaders/3.0/Human/Skin Forward.shader new file mode 100644 index 0000000..018f47b --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Human/Skin Forward.shader @@ -0,0 +1,313 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Human/Skin (Forward)" { +Properties { + [Toggle(EFFECT_BUMP)] + _HasBumpMap ("'Normals Source' {Dropdown:{VertexNormals:{_BumpMap,_BumpScale,_SssBumpBlur,_DetailNormalMap,_DetailNormalMapScale,_WetNormalMap,_WetNormalMapScale}, NormalMaps:{}}}", Float) = 1 + + // Skin Textures + _MainTextures ("'Skin Textures' {Section:{Color:0}}", Float) = 0 + [LM_Albedo] [LM_Transparency] + _Color ("'Tint' {}", Color) = (1,1,1,1) + [LM_MasterTilingOffset] [LM_Albedo] + _MainTex ("'Base Color(RGB) SSS(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _MainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _MainTexUV ("UV Set", Float) = 0 + [LM_Metallic] + _SpecTex ("'Metal(R) AO(G) Spec(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_MainTex}", 2D) = "white" {} + [LM_NormalMap] + _BumpMap ("'Normals' {Visualize:{NRM}, Parent:_MainTex}", 2D) = "bump" {} + _BaseColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Skin Properties + _MainPhysicalProperties ("'Skin Properties' {Section:{Color:1}}", Float) = 0 + _Metal ("'Metallic' {Min:0, Max:1}", Float) = 1 + _Specularity ("'Specularity' {Min:0, Max:1}", Float) = 1 + _Roughness ("'Roughness' {Min:0, Max:1}", Float) = 1 + _Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _BumpScale ("'Normal Strength' {}", Float) = 1 + + // Skin Scattering + _SkinScatteringProperties ("'Skin Scattering' {Section:{Color:2}}", Float) = 0 + _SssBrdfTex ("'LUT' {Controls:False}", 2D) = "white" {} + _SssWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _SssMaskCutoff ("'Mask Cutoff' {Min:0.01, Max:1}", Float) = 0.1 + _SssBias ("'Bias' {Min:0, Max:1}", Float) = 0 + _SssScale ("'Scale' {Min:0, Max:1}", Float) = 1 + _SssBumpBlur ("'Bump Blur' {Min:0, Max:1}", Float) = 0.7 + _SssTransmissionAbsorption ("'Absorption' {Vector:3}", Vector) = (-8,-40,-64,0) + _SssColorBleedAoWeights ("'AO Color Bleed' {Vector:3}", Vector) = (0.4,0.15,0.13,0) + + // Transmission + _TransmissionProperties ("'Transmission' {Section:{Color:3}}", Float) = 0 + _TransWeight ("'Weight' {Min:0, Max:1}", Float) = 1.0 + _TransDistortion ("'Bump Distortion' {Min:0, Max:1}", Float) = 0.1 + _TransPower ("'Falloff' {Min:1}", Float) = 1 + + // Parallax + [Toggle(_PARALLAXMAP)] + _ParallaxT ("'Parallax' {Feature:{Color:5}}", Float) = 0 + [Toggle(_BUMPMODE_POM)] + _BumpMode ("'Mode' {Dropdown:{Parallax:{_MinSamples, _MaxSamples}, POM:{}}}", Float) = 0 + _ParallaxMap ("'Heightmap(G)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "black" {} + _Parallax ("'Height' {Min:0, Max:0.08}", Float) = 0.02 + _MinSamples ("'Min Samples' {Min:1}", Float) = 4 + _MaxSamples ("'Max Samples' {Min:1}", Float) = 20 + + // Detail + [Toggle(_DETAIL_MULX2)] + _DetailT ("'Detail' {Feature:{Color:7}}", Float) = 0 + [Toggle(_NORMALMAP)] + _DetailMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_DetailMask}}}", Float) = 0 + _DetailMask ("'Mask(A)' {Visualize:{A}, Parent:_MainTex}", 2D) = "white" {} + _DetailMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + [Enum(Mul, 0, MulX2, 1)] + _DetailMode ("'Color Mode' {Dropdown:{Mul:{}, MulX2:{}}}", Float) = 0 + _DetailAlbedoMap ("'Color(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _DetailAlbedoMapVelocity ("Scroll", Vector) = (0,0,0,0) + _DetailAlbedoMapUV ("UV Set", Float) = 0 + _DetailNormalMap ("'Normals' {Visualize:{NRM}, Parent:_DetailAlbedoMap}", 2D) = "bump" {} + _DetailWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DetailNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Team Color + [Toggle(_TEAMCOLOR_ON)] + _TeamColor ("'Team Color' {Feature:{Color:8}}", Float) = 0 + [Enum(Masks, 0, Tint, 1)] + _TeamColorMasksAsTint ("'Texture Mode' {Dropdown:{Masks:{}, Tint:{_TeamColorMasks, _TeamColor0, _TeamColor1, _TeamColor2, _TeamColor3}}}", Float) = 0 + _TeamColorMaskMap ("'Masks(RGBA)' {Visualize:{R, G, B, A, RGB}, Parent:_MainTex}", 2D) = "black" {} + _TeamColorMasks ("'Channels' {Vector:Channels}", Vector) = (1,1,1,0) + _TeamColor0 ("'Tint R' {}", Color) = (1,0,0) + _TeamColor1 ("'Tint G' {}", Color) = (0,1,0) + _TeamColor2 ("'Tint B' {}", Color) = (0,0,1) + _TeamColor3 ("'Tint A' {}", Color) = (0.5,0.5,0.5) + + // Decal + [Toggle(_DECAL_ON)] + _Decal ("'Decal' {Feature:{Color:9}}", Float) = 0 + _DecalColor ("'Tint' {}", Color) = (1,1,1,1) + _DecalTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "black" {} + _DecalTexUV ("UV Set", Float) = 0 + _DecalWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DecalSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _DecalAlphaVertexTint ("'Vertex Alpha Tint' {Min:0, Max:1}", Float) = 0 + + // Emission + [Toggle(_EMISSION)] + _Emission ("'Emission' {Feature:{Color:10}}", Float) = 0 + [LM_Emission] + [HDR] + _EmissionColor ("'Tint' {}", Color) = (1,1,1) + [LM_Emission] + _EmissionMap ("'Mask(RGB)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "white" {} + _IncandescenceMap ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _IncandescenceMapVelocity ("Scroll", Vector) = (0,0,0,0) + _IncandescenceMapUV ("UV Set", Float) = 0 + [Gamma] + _EmissionWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + + // Rim Emission + [Toggle(_RIM_ON)] + _Rim ("'Rim Emission' {Feature:{Color:11}}", Float) = 0 + [HDR] + _RimColor ("'Tint' {}", Color) = (1,1,1) + _RimTex ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _RimTexVelocity ("Scroll", Vector) = (0,0,0,0) + _RimTexUV ("UV Set", Float) = 0 + [Gamma] + _RimWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + [Gamma] + _RimBias ("'Fill' {Min:0, Max:1}", Float) = 0 + _RimPower ("'Falloff' {Min:0.01}", Float) = 4 + + // Dissolve + [Toggle(_DISSOLVE_ON)] + _Dissolve ("'Dissolve' {Feature:{Color:12}}", Float) = 0 + [HDR] + _DissolveGlowColor ("'Glow Tint' {}", Color) = (1,1,1,1) + _DissolveTex ("'Glow Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _DissolveTexUV ("UV Set", Float) = 0 + _DissolveCutoff ("'Cutoff' {Min:0, Max:1}", Float) = 0 + [Gamma] + _DissolveGlowWeight ("'Glow Weight' {Min:0, Max:1}", Float) = 1 + _DissolveEdgeWidth ("'Glow Width' {Min:0, Max:1}", Float) = 0.01 + + // Wetness + [Toggle(_WETNESS_ON)] + _WetnessProperties ("'Wetness' {Feature:{Color:13}}", Float) = 0 + [Toggle(_WETMASKSOURCE_VERTEXCOLORALPHA)] + _WetMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_WetMask}}}", Float) = 0 + _WetMask ("'Mask(A)' {Visualize:{A}}", 2D) = "white" {} + _WetMaskVelocity ("Scroll", Vector) = (0,0,0,0) + _WetMaskUV ("UV Set", Float) = 0 + _WetMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + _WetTint ("'Tint' {}", Color) = (1,1,1,1) + _WetNormalMap ("'Normals' {Visualize:{NRM}}", 2D) = "bump" {} + _WetNormalMapVelocity ("Scroll", Vector) = (0,0,0,0) + _WetNormalMapUV ("UV Set", Float) = 0 + _WetWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _WetRoughness ("'Roughness' {Min:0, Max:1}", Float) = 0.2 + _WetNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _Lightmapping ("'GI' {LightmapEmissionProperty:{}}", Float) = 1 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} + +CGINCLUDE + #define A_FORWARD_ONLY_SHADER +ENDCG + +SubShader { + Tags { + "Queue" = "Geometry" + "RenderType" = "Opaque" + //"DisableBatching" = "LODFading" + } + LOD 400 + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Shaders/Definition/Skin.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend One One + ZWrite Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + + #include "Assets/Alloy/Shaders/Definition/Skin.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _DISSOLVE_ON + + #pragma multi_compile_shadowcaster + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_SHADOWCASTER + + #include "Assets/Alloy/Shaders/Definition/Skin.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Shaders/Definition/Skin.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +FallBack "VertexLit" +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Shaders/3.0/Human/Skin Forward.shader.meta b/Assets/Alloy/Shaders/3.0/Human/Skin Forward.shader.meta new file mode 100644 index 0000000..5a6eae4 --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Human/Skin Forward.shader.meta @@ -0,0 +1,24 @@ +fileFormatVersion: 2 +guid: c77d275036f53204e8f439eeeafcad49 +timeCreated: 1461811049 +licenseType: Pro +ShaderImporter: + defaultTextures: + - _MainTex: {instanceID: 0} + - _SpecTex: {instanceID: 0} + - _BumpMap: {instanceID: 0} + - _SssBrdfTex: {fileID: 2800000, guid: d13510bb2be49aa40a66a0101efb6a36, type: 3} + - _DetailMask: {instanceID: 0} + - _DetailAlbedoMap: {instanceID: 0} + - _DetailMaterialMap: {fileID: 2800000, guid: 2b77d5cb601375f4ba50c6194c126e59, + type: 3} + - _DetailNormalMap: {instanceID: 0} + - _TeamColorMaskMap: {instanceID: 0} + - _DecalTex: {instanceID: 0} + - _EmissionMap: {instanceID: 0} + - _IncandescenceMap: {instanceID: 0} + - _RimTex: {instanceID: 0} + - _DissolveTex: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/3.0/Human/Skin.shader b/Assets/Alloy/Shaders/3.0/Human/Skin.shader new file mode 100644 index 0000000..d64d87a --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Human/Skin.shader @@ -0,0 +1,330 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Human/Skin" { +Properties { + [Toggle(EFFECT_BUMP)] + _HasBumpMap ("'Normals Source' {Dropdown:{VertexNormals:{_BumpMap,_BumpScale,_DetailNormalMap,_DetailNormalMapScale,_WetNormalMap,_WetNormalMapScale}, NormalMaps:{}}}", Float) = 1 + + // Skin Textures + _MainTextures ("'Skin Textures' {Section:{Color:0}}", Float) = 0 + [LM_Albedo] [LM_Transparency] + _Color ("'Tint' {}", Color) = (1,1,1,1) + [LM_MasterTilingOffset] [LM_Albedo] + _MainTex ("'Base Color(RGB) SSS(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _MainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _MainTexUV ("UV Set", Float) = 0 + [LM_Metallic] + _SpecTex ("'Metal(R) AO(G) Spec(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_MainTex}", 2D) = "white" {} + [LM_NormalMap] + _BumpMap ("'Normals' {Visualize:{NRM}, Parent:_MainTex}", 2D) = "bump" {} + _BaseColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Skin Properties + _MainPhysicalProperties ("'Skin Properties' {Section:{Color:1}}", Float) = 0 + _Metal ("'Metallic' {Min:0, Max:1}", Float) = 1 + _Specularity ("'Specularity' {Min:0, Max:1}", Float) = 1 + _Roughness ("'Roughness' {Min:0, Max:1}", Float) = 1 + _Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _BumpScale ("'Normal Strength' {}", Float) = 1 + + // Parallax + [Toggle(_PARALLAXMAP)] + _ParallaxT ("'Parallax' {Feature:{Color:5}}", Float) = 0 + [Toggle(_BUMPMODE_POM)] + _BumpMode ("'Mode' {Dropdown:{Parallax:{_MinSamples, _MaxSamples}, POM:{}}}", Float) = 0 + _ParallaxMap ("'Heightmap(G)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "black" {} + _Parallax ("'Height' {Min:0, Max:0.08}", Float) = 0.02 + _MinSamples ("'Min Samples' {Min:1}", Float) = 4 + _MaxSamples ("'Max Samples' {Min:1}", Float) = 20 + + // Detail + [Toggle(_DETAIL_MULX2)] + _DetailT ("'Detail' {Feature:{Color:7}}", Float) = 0 + [Toggle(_NORMALMAP)] + _DetailMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_DetailMask}}}", Float) = 0 + _DetailMask ("'Mask(A)' {Visualize:{A}, Parent:_MainTex}", 2D) = "white" {} + _DetailMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + [Enum(Mul, 0, MulX2, 1)] + _DetailMode ("'Color Mode' {Dropdown:{Mul:{}, MulX2:{}}}", Float) = 0 + _DetailAlbedoMap ("'Color(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _DetailAlbedoMapVelocity ("Scroll", Vector) = (0,0,0,0) + _DetailAlbedoMapUV ("UV Set", Float) = 0 + _DetailNormalMap ("'Normals' {Visualize:{NRM}, Parent:_DetailAlbedoMap}", 2D) = "bump" {} + _DetailWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DetailNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Team Color + [Toggle(_TEAMCOLOR_ON)] + _TeamColor ("'Team Color' {Feature:{Color:8}}", Float) = 0 + [Enum(Masks, 0, Tint, 1)] + _TeamColorMasksAsTint ("'Texture Mode' {Dropdown:{Masks:{}, Tint:{_TeamColorMasks, _TeamColor0, _TeamColor1, _TeamColor2, _TeamColor3}}}", Float) = 0 + _TeamColorMaskMap ("'Masks(RGBA)' {Visualize:{R, G, B, A, RGB}, Parent:_MainTex}", 2D) = "black" {} + _TeamColorMasks ("'Channels' {Vector:Channels}", Vector) = (1,1,1,0) + _TeamColor0 ("'Tint R' {}", Color) = (1,0,0) + _TeamColor1 ("'Tint G' {}", Color) = (0,1,0) + _TeamColor2 ("'Tint B' {}", Color) = (0,0,1) + _TeamColor3 ("'Tint A' {}", Color) = (0.5,0.5,0.5) + + // Decal + [Toggle(_DECAL_ON)] + _Decal ("'Decal' {Feature:{Color:9}}", Float) = 0 + _DecalColor ("'Tint' {}", Color) = (1,1,1,1) + _DecalTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "black" {} + _DecalTexUV ("UV Set", Float) = 0 + _DecalWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DecalSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _DecalAlphaVertexTint ("'Vertex Alpha Tint' {Min:0, Max:1}", Float) = 0 + + // Emission + [Toggle(_EMISSION)] + _Emission ("'Emission' {Feature:{Color:10}}", Float) = 0 + [LM_Emission] + [HDR] + _EmissionColor ("'Tint' {}", Color) = (1,1,1) + [LM_Emission] + _EmissionMap ("'Mask(RGB)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "white" {} + _IncandescenceMap ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _IncandescenceMapVelocity ("Scroll", Vector) = (0,0,0,0) + _IncandescenceMapUV ("UV Set", Float) = 0 + [Gamma] + _EmissionWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + + // Rim Emission + [Toggle(_RIM_ON)] + _Rim ("'Rim Emission' {Feature:{Color:11}}", Float) = 0 + [HDR] + _RimColor ("'Tint' {}", Color) = (1,1,1) + _RimTex ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _RimTexVelocity ("Scroll", Vector) = (0,0,0,0) + _RimTexUV ("UV Set", Float) = 0 + [Gamma] + _RimWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + [Gamma] + _RimBias ("'Fill' {Min:0, Max:1}", Float) = 0 + _RimPower ("'Falloff' {Min:0.01}", Float) = 4 + + // Dissolve + [Toggle(_DISSOLVE_ON)] + _Dissolve ("'Dissolve' {Feature:{Color:12}}", Float) = 0 + [HDR] + _DissolveGlowColor ("'Glow Tint' {}", Color) = (1,1,1,1) + _DissolveTex ("'Glow Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _DissolveTexUV ("UV Set", Float) = 0 + _DissolveCutoff ("'Cutoff' {Min:0, Max:1}", Float) = 0 + [Gamma] + _DissolveGlowWeight ("'Glow Weight' {Min:0, Max:1}", Float) = 1 + _DissolveEdgeWidth ("'Glow Width' {Min:0, Max:1}", Float) = 0.01 + + // Wetness + [Toggle(_WETNESS_ON)] + _WetnessProperties ("'Wetness' {Feature:{Color:13}}", Float) = 0 + [Toggle(_WETMASKSOURCE_VERTEXCOLORALPHA)] + _WetMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_WetMask}}}", Float) = 0 + _WetMask ("'Mask(A)' {Visualize:{A}}", 2D) = "white" {} + _WetMaskVelocity ("Scroll", Vector) = (0,0,0,0) + _WetMaskUV ("UV Set", Float) = 0 + _WetMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + _WetTint ("'Tint' {}", Color) = (1,1,1,1) + _WetNormalMap ("'Normals' {Visualize:{NRM}}", 2D) = "bump" {} + _WetNormalMapVelocity ("Scroll", Vector) = (0,0,0,0) + _WetNormalMapUV ("UV Set", Float) = 0 + _WetWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _WetRoughness ("'Roughness' {Min:0, Max:1}", Float) = 0.2 + _WetNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _Lightmapping ("'GI' {LightmapEmissionProperty:{}}", Float) = 1 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} + +SubShader { + Tags { + "Queue" = "Geometry" + "RenderType" = "Opaque" + //"DisableBatching" = "LODFading" + } + LOD 400 + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Shaders/Definition/Skin.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend One One + ZWrite Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + + #include "Assets/Alloy/Shaders/Definition/Skin.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _DISSOLVE_ON + + #pragma multi_compile_shadowcaster + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_SHADOWCASTER + + #include "Assets/Alloy/Shaders/Definition/Skin.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } + + Pass { + Name "DEFERRED" + Tags { "LightMode" = "Deferred" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_prepassfinal + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_DEFERRED + + #include "Assets/Alloy/Shaders/Definition/Skin.cginc" + #include "Assets/Alloy/Shaders/Forward/Gbuffer.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Shaders/Definition/Skin.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +FallBack "VertexLit" +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Shaders/3.0/Human/Skin.shader.meta b/Assets/Alloy/Shaders/3.0/Human/Skin.shader.meta new file mode 100644 index 0000000..168c924 --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Human/Skin.shader.meta @@ -0,0 +1,23 @@ +fileFormatVersion: 2 +guid: 187092ff52f5f9e4fb0591eab61399a5 +timeCreated: 1445805686 +licenseType: Pro +ShaderImporter: + defaultTextures: + - _MainTex: {instanceID: 0} + - _SpecTex: {instanceID: 0} + - _BumpMap: {instanceID: 0} + - _DetailMask: {instanceID: 0} + - _DetailAlbedoMap: {instanceID: 0} + - _DetailMaterialMap: {fileID: 2800000, guid: 2b77d5cb601375f4ba50c6194c126e59, + type: 3} + - _DetailNormalMap: {instanceID: 0} + - _TeamColorMaskMap: {instanceID: 0} + - _DecalTex: {instanceID: 0} + - _EmissionMap: {instanceID: 0} + - _IncandescenceMap: {instanceID: 0} + - _RimTex: {instanceID: 0} + - _DissolveTex: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/3.0/Nature.meta b/Assets/Alloy/Shaders/3.0/Nature.meta new file mode 100644 index 0000000..9ad09b7 --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Nature.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 481bbf795e9734241bbdf83a0d701d39 +folderAsset: yes +timeCreated: 1448388767 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/3.0/Nature/Details0.shader b/Assets/Alloy/Shaders/3.0/Nature/Details0.shader new file mode 100644 index 0000000..33bf4bd --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Nature/Details0.shader @@ -0,0 +1,161 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Hidden/Alloy/Nature/Terrain/Details0" { +Properties { + // Main Textures + _MainTextures ("'Main Textures' {Section:{Color:0}}", Float) = 0 + [LM_MasterTilingOffset] [LM_Albedo] + _MainTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _Lightmapping ("'GI' {LightmapEmissionProperty:{}}", Float) = 1 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} + +SubShader { + Tags { + "RenderType" = "Opaque" + } + LOD 200 + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Shaders/Definition/Details0.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend One One + ZWrite Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + + #include "Assets/Alloy/Shaders/Definition/Details0.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma multi_compile_shadowcaster + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_SHADOWCASTER + + #include "Assets/Alloy/Shaders/Definition/Details0.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } + + Pass { + Name "DEFERRED" + Tags { "LightMode" = "Deferred" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_prepassfinal + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_DEFERRED + + #include "Assets/Alloy/Shaders/Definition/Details0.cginc" + #include "Assets/Alloy/Shaders/Forward/Gbuffer.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Shaders/Definition/Details0.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +FallBack "VertexLit" +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Shaders/3.0/Nature/Details0.shader.meta b/Assets/Alloy/Shaders/3.0/Nature/Details0.shader.meta new file mode 100644 index 0000000..af5d786 --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Nature/Details0.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 5d86150e60d8eef4ea7a4df3214dd657 +timeCreated: 1477086134 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/3.0/Nature/Details1.shader b/Assets/Alloy/Shaders/3.0/Nature/Details1.shader new file mode 100644 index 0000000..102758c --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Nature/Details1.shader @@ -0,0 +1,170 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Hidden/Alloy/Nature/Terrain/Details1" { +Properties { + // Main Textures + _MainTextures ("'Main Textures' {Section:{Color:0}}", Float) = 0 + _WavingTint ("'Fade Color' {}", Color) = (.7,.6,.5, 0) + [LM_MasterTilingOffset] [LM_Albedo] + _MainTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _WaveAndDistance ("'Wave and distance' {}", Vector) = (12, 3.6, 1, 1) + [LM_TransparencyCutOff] + _Cutoff ("'Opacity Cutoff' {Min:0, Max:1}", Float) = 0.5 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _Lightmapping ("'GI' {LightmapEmissionProperty:{}}", Float) = 1 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} + +SubShader { + Tags { + "Queue" = "Geometry+200" + "IgnoreProjector"="True" + "RenderType"="Grass" + "DisableBatching"="True" + } + Cull Off + LOD 200 + ColorMask RGB + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Shaders/Definition/Details1.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend One One + ZWrite Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + + #include "Assets/Alloy/Shaders/Definition/Details1.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma multi_compile_shadowcaster + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_SHADOWCASTER + + #include "Assets/Alloy/Shaders/Definition/Details1.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } + + Pass { + Name "DEFERRED" + Tags { "LightMode" = "Deferred" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_prepassfinal + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_DEFERRED + + #include "Assets/Alloy/Shaders/Definition/Details1.cginc" + #include "Assets/Alloy/Shaders/Forward/Gbuffer.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Shaders/Definition/Details1.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +FallBack "VertexLit" +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Shaders/3.0/Nature/Details1.shader.meta b/Assets/Alloy/Shaders/3.0/Nature/Details1.shader.meta new file mode 100644 index 0000000..6638f5a --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Nature/Details1.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 1b6521e4ce2292a4ba838db900a54a67 +timeCreated: 1477086134 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/3.0/Nature/Details2.shader b/Assets/Alloy/Shaders/3.0/Nature/Details2.shader new file mode 100644 index 0000000..a47ea72 --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Nature/Details2.shader @@ -0,0 +1,170 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Hidden/Alloy/Nature/Terrain/Details2" { +Properties { + // Main Textures + _MainTextures ("'Main Textures' {Section:{Color:0}}", Float) = 0 + _WavingTint ("'Fade Color' {}", Color) = (.7,.6,.5, 0) + [LM_MasterTilingOffset] [LM_Albedo] + _MainTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _WaveAndDistance ("'Wave and distance' {}", Vector) = (12, 3.6, 1, 1) + [LM_TransparencyCutOff] + _Cutoff ("'Opacity Cutoff' {Min:0, Max:1}", Float) = 0.5 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _Lightmapping ("'GI' {LightmapEmissionProperty:{}}", Float) = 1 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} + +SubShader { + Tags { + "Queue" = "Geometry+200" + "IgnoreProjector"="True" + "RenderType"="GrassBillboard" + "DisableBatching"="True" + } + Cull Off + LOD 200 + ColorMask RGB + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Shaders/Definition/Details2.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend One One + ZWrite Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + + #include "Assets/Alloy/Shaders/Definition/Details2.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma multi_compile_shadowcaster + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_SHADOWCASTER + + #include "Assets/Alloy/Shaders/Definition/Details2.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } + + Pass { + Name "DEFERRED" + Tags { "LightMode" = "Deferred" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_prepassfinal + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_DEFERRED + + #include "Assets/Alloy/Shaders/Definition/Details2.cginc" + #include "Assets/Alloy/Shaders/Forward/Gbuffer.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Shaders/Definition/Details2.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +FallBack "VertexLit" +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Shaders/3.0/Nature/Details2.shader.meta b/Assets/Alloy/Shaders/3.0/Nature/Details2.shader.meta new file mode 100644 index 0000000..5561f1f --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Nature/Details2.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 90b3cc42b0986f34b9942b8ab428074e +timeCreated: 1477086135 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/3.0/Nature/SpeedTree Forward.shader b/Assets/Alloy/Shaders/3.0/Nature/SpeedTree Forward.shader new file mode 100644 index 0000000..fbe02d2 --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Nature/SpeedTree Forward.shader @@ -0,0 +1,302 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Nature/SpeedTree (Forward)" { +Properties { + // Global Settings + _GeometryType ("'Geometry Type' {SpeedTreeGeometryType:{Branch:{_Cutoff,_DetailTex,_DetailNormalMap,_TransmissionProperties,_TransTex,_TransScale,_TransColor,_TransShadowWeight,_TransDistortion,_TransPower}, BranchDetail:{_Cutoff,_TransmissionProperties,_TransTex,_TransScale,_TransColor,_TransShadowWeight,_TransDistortion,_TransPower}, Frond:{_DetailTex,_DetailNormalMap}, Leaf:{_DetailTex,_DetailNormalMap}, Mesh:{_Cutoff,_DetailTex,_DetailNormalMap,_TransmissionProperties,_TransTex,_TransScale,_TransColor,_TransShadowWeight,_TransDistortion,_TransPower}}}", Float) = 0 + [LM_TransparencyCutOff] + _Cutoff ("'Opacity Cutoff' {Min:0, Max:1}", Float) = 0.333 + [MaterialEnum(Off,0,Front,1,Back,2)] + _Cull ("'Cull Mode' {Dropdown:{Off:{}, Front:{}, Back:{}}}", Int) = 2 + [MaterialEnum(None,0,Fastest,1,Fast,2,Better,3,Best,4,Palm,5)] + _WindQuality ("'Wind Quality' {Dropdown:{None:{}, Fastest:{}, Fast:{}, Better:{}, Best:{}, Palm:{}}}", Float) = 0 + [Toggle(EFFECT_BUMP)] + _HasBumpMap ("'Normals Source' {Dropdown:{VertexNormals:{_BumpMap,_BumpScale,_DetailNormalMap,_WetNormalMap,_WetNormalMapScale}, NormalMaps:{}}}", Float) = 1 + + // SpeedTree Textures + _MainTextures ("'SpeedTree Textures' {Section:{Color:0}}", Float) = 0 + [LM_Albedo] [LM_Transparency] + _Color ("'Tint' {}", Color) = (1,1,1,1) + [LM_MasterTilingOffset] [LM_Albedo] + _MainTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}, Controls:False}", 2D) = "white" {} + [LM_NormalMap] + _BumpMap ("'Normals' {Visualize:{NRM}, Controls:False}", 2D) = "bump" {} + _DetailTex ("'Detail(RGB) Opacity(A)' {Visualize:{RGB}, Controls:False}", 2D) = "black" {} + _DetailNormalMap ("'Detail Normals' {Visualize:{NRM}, Controls:False}", 2D) = "bump" {} + [Toggle(EFFECT_HUE_VARIATION)] + _HasHueVariation ("'Hue Variation?' {Toggle:{On:{}, Off:{_HueVariation}}}", Float) = 1 + _HueVariation ("'Hue Variation' {}", Color) = (1.0,0.5,0.0,0.1) + + // SpeedTree Properties + _MainPhysicalProperties ("'SpeedTree Properties' {Section:{Color:1}}", Float) = 0 + _Specularity ("'Specularity' {Min:0, Max:1}", Float) = 1 + _SpecularTint ("'Specular Tint' {Min:0, Max:1}", Float) = 0.0 + _Roughness ("'Roughness' {Min:0, Max:1}", Float) = 0.9 + _Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _BumpScale ("'Normal Strength' {}", Float) = 1 + + // Transmission + _TransmissionProperties ("'Transmission' {Section:{Color:3}}", Float) = 0 + _TransColor ("'Tint' {}", Color) = (1,1,1) + _TransTex ("'Transmission(A)' {Visualize:{A}, Parent:_MainTex}", 2D) = "white" {} + //[Gamma] + _TransScale ("'Weight' {Min:0, Max:1}", Float) = 1.0 + _TransShadowWeight ("'Shadow Weight' {Min:0, Max:1}", Float) = 0.5 + _TransDistortion ("'Bump Distortion' {Min:0, Max:1}", Float) = 0.05 + _TransPower ("'Falloff' {Min:1}", Float) = 1 + + // Parallax + [Toggle(_PARALLAXMAP)] + _ParallaxT ("'Parallax' {Feature:{Color:5}}", Float) = 0 + [Toggle(_BUMPMODE_POM)] + _BumpMode ("'Mode' {Dropdown:{Parallax:{_MinSamples, _MaxSamples}, POM:{}}}", Float) = 0 + _ParallaxMap ("'Heightmap(G)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "black" {} + _Parallax ("'Height' {Min:0, Max:0.08}", Float) = 0.02 + _MinSamples ("'Min Samples' {Min:1}", Float) = 4 + _MaxSamples ("'Max Samples' {Min:1}", Float) = 20 + + // Team Color + [Toggle(_TEAMCOLOR_ON)] + _TeamColor ("'Team Color' {Feature:{Color:8}}", Float) = 0 + [Enum(Masks, 0, Tint, 1)] + _TeamColorMasksAsTint ("'Texture Mode' {Dropdown:{Masks:{}, Tint:{_TeamColorMasks, _TeamColor0, _TeamColor1, _TeamColor2, _TeamColor3}}}", Float) = 0 + _TeamColorMaskMap ("'Masks(RGBA)' {Visualize:{R, G, B, A, RGB}, Parent:_MainTex}", 2D) = "black" {} + _TeamColorMasks ("'Channels' {Vector:Channels}", Vector) = (1,1,1,0) + _TeamColor0 ("'Tint R' {}", Color) = (1,0,0) + _TeamColor1 ("'Tint G' {}", Color) = (0,1,0) + _TeamColor2 ("'Tint B' {}", Color) = (0,0,1) + _TeamColor3 ("'Tint A' {}", Color) = (0.5,0.5,0.5) + + // Decal + [Toggle(_DECAL_ON)] + _Decal ("'Decal' {Feature:{Color:9}}", Float) = 0 + _DecalColor ("'Tint' {}", Color) = (1,1,1,1) + _DecalTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "black" {} + _DecalWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DecalSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _DecalAlphaVertexTint ("'Vertex Alpha Tint' {Min:0, Max:1}", Float) = 0 + + // Emission + [Toggle(_EMISSION)] + _Emission ("'Emission' {Feature:{Color:10}}", Float) = 0 + [LM_Emission] + [HDR] + _EmissionColor ("'Tint' {}", Color) = (1,1,1) + [LM_Emission] + _EmissionMap ("'Mask(RGB)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "white" {} + _IncandescenceMap ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _IncandescenceMapVelocity ("Scroll", Vector) = (0,0,0,0) + [Gamma] + _EmissionWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + + // Rim Emission + [Toggle(_RIM_ON)] + _Rim ("'Rim Emission' {Feature:{Color:11}}", Float) = 0 + [HDR] + _RimColor ("'Tint' {}", Color) = (1,1,1) + _RimTex ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _RimTexVelocity ("Scroll", Vector) = (0,0,0,0) + [Gamma] + _RimWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + [Gamma] + _RimBias ("'Fill' {Min:0, Max:1}", Float) = 0 + _RimPower ("'Falloff' {Min:0.01}", Float) = 4 + + // Dissolve + [Toggle(_DISSOLVE_ON)] + _Dissolve ("'Dissolve' {Feature:{Color:12}}", Float) = 0 + [HDR] + _DissolveGlowColor ("'Glow Tint' {}", Color) = (1,1,1,1) + _DissolveTex ("'Glow Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _DissolveCutoff ("'Cutoff' {Min:0, Max:1}", Float) = 0 + [Gamma] + _DissolveGlowWeight ("'Glow Weight' {Min:0, Max:1}", Float) = 1 + _DissolveEdgeWidth ("'Glow Width' {Min:0, Max:1}", Float) = 0.01 + + // Wetness + [Toggle(_WETNESS_ON)] + _WetnessProperties ("'Wetness' {Feature:{Color:13}}", Float) = 0 + [Toggle(_WETMASKSOURCE_VERTEXCOLORALPHA)] + _WetMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_WetMask}}}", Float) = 0 + _WetMask ("'Mask(A)' {Visualize:{A}}", 2D) = "white" {} + _WetMaskVelocity ("Scroll", Vector) = (0,0,0,0) + _WetMaskUV ("UV Set", Float) = 0 + _WetMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + _WetTint ("'Tint' {}", Color) = (1,1,1,1) + _WetNormalMap ("'Normals' {Visualize:{NRM}}", 2D) = "bump" {} + _WetNormalMapVelocity ("Scroll", Vector) = (0,0,0,0) + _WetNormalMapUV ("UV Set", Float) = 0 + _WetWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _WetRoughness ("'Roughness' {Min:0, Max:1}", Float) = 0.2 + _WetNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _Lightmapping ("'GI' {LightmapEmissionProperty:{}}", Float) = 1 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} + +CGINCLUDE + #define A_FORWARD_ONLY_SHADER +ENDCG + +SubShader { + Tags { + "Queue" = "Geometry" + "IgnoreProjector" = "True" + "RenderType" = "Opaque" + "DisableBatching" = "LODFading" + } + LOD 400 + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + Cull [_Cull] + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature GEOM_TYPE_BRANCH GEOM_TYPE_BRANCH_DETAIL GEOM_TYPE_FROND GEOM_TYPE_LEAF GEOM_TYPE_MESH + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature EFFECT_HUE_VARIATION + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + #pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma instancing_options assumeuniformscaling lodfade maxcount:50 + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Shaders/Definition/SpeedTree.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend One One + ZWrite Off + Cull [_Cull] + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature GEOM_TYPE_BRANCH GEOM_TYPE_BRANCH_DETAIL GEOM_TYPE_FROND GEOM_TYPE_LEAF GEOM_TYPE_MESH + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature EFFECT_HUE_VARIATION + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + #pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + + #include "Assets/Alloy/Shaders/Definition/SpeedTree.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + Cull [_Cull] + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature GEOM_TYPE_BRANCH GEOM_TYPE_BRANCH_DETAIL GEOM_TYPE_FROND GEOM_TYPE_LEAF GEOM_TYPE_MESH + #pragma shader_feature _DISSOLVE_ON + + #pragma multi_compile_shadowcaster + #pragma multi_compile_instancing + //#pragma instancing_options assumeuniformscaling lodfade maxcount:50 + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_SHADOWCASTER + + #include "Assets/Alloy/Shaders/Definition/SpeedTree.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature GEOM_TYPE_BRANCH GEOM_TYPE_BRANCH_DETAIL GEOM_TYPE_FROND GEOM_TYPE_LEAF GEOM_TYPE_MESH + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Shaders/Definition/SpeedTree.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +FallBack "VertexLit" +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Shaders/3.0/Nature/SpeedTree Forward.shader.meta b/Assets/Alloy/Shaders/3.0/Nature/SpeedTree Forward.shader.meta new file mode 100644 index 0000000..097ee17 --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Nature/SpeedTree Forward.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 3d3c97a35b149ac42a129f059135b35a +timeCreated: 1473206667 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/3.0/Nature/SpeedTree.shader b/Assets/Alloy/Shaders/3.0/Nature/SpeedTree.shader new file mode 100644 index 0000000..6d8341f --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Nature/SpeedTree.shader @@ -0,0 +1,335 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Nature/SpeedTree" { +Properties { + // Global Settings + _GeometryType ("'Geometry Type' {SpeedTreeGeometryType:{Branch:{_Cutoff,_DetailTex,_DetailNormalMap,_TransmissionProperties,_TransTex,_TransScale}, BranchDetail:{_Cutoff,_TransmissionProperties,_TransTex,_TransScale}, Frond:{_DetailTex,_DetailNormalMap}, Leaf:{_DetailTex,_DetailNormalMap}, Mesh:{_Cutoff,_DetailTex,_DetailNormalMap,_TransmissionProperties,_TransTex,_TransScale}}}", Float) = 0 + [LM_TransparencyCutOff] + _Cutoff ("'Opacity Cutoff' {Min:0, Max:1}", Float) = 0.333 + [MaterialEnum(Off,0,Front,1,Back,2)] + _Cull ("'Cull Mode' {Dropdown:{Off:{}, Front:{}, Back:{}}}", Int) = 2 + [MaterialEnum(None,0,Fastest,1,Fast,2,Better,3,Best,4,Palm,5)] + _WindQuality ("'Wind Quality' {Dropdown:{None:{}, Fastest:{}, Fast:{}, Better:{}, Best:{}, Palm:{}}}", Float) = 0 + [Toggle(EFFECT_BUMP)] + _HasBumpMap ("'Normals Source' {Dropdown:{VertexNormals:{_BumpMap,_BumpScale,_DetailNormalMap,_WetNormalMap,_WetNormalMapScale}, NormalMaps:{}}}", Float) = 1 + + // SpeedTree Textures + _MainTextures ("'SpeedTree Textures' {Section:{Color:0}}", Float) = 0 + [LM_Albedo] [LM_Transparency] + _Color ("'Tint' {}", Color) = (1,1,1,1) + [LM_MasterTilingOffset] [LM_Albedo] + _MainTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}, Controls:False}", 2D) = "white" {} + [LM_NormalMap] + _BumpMap ("'Normals' {Visualize:{NRM}, Controls:False}", 2D) = "bump" {} + _DetailTex ("'Detail(RGB) Opacity(A)' {Visualize:{RGB}, Controls:False}", 2D) = "black" {} + _DetailNormalMap ("'Detail Normals' {Visualize:{NRM}, Controls:False}", 2D) = "bump" {} + [Toggle(EFFECT_HUE_VARIATION)] + _HasHueVariation ("'Hue Variation?' {Toggle:{On:{}, Off:{_HueVariation}}}", Float) = 1 + _HueVariation ("'Hue Variation' {}", Color) = (1.0,0.5,0.0,0.1) + + // SpeedTree Properties + _MainPhysicalProperties ("'SpeedTree Properties' {Section:{Color:1}}", Float) = 0 + _Specularity ("'Specularity' {Min:0, Max:1}", Float) = 1 + _SpecularTint ("'Specular Tint' {Min:0, Max:1}", Float) = 0.0 + _Roughness ("'Roughness' {Min:0, Max:1}", Float) = 0.9 + _Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _BumpScale ("'Normal Strength' {}", Float) = 1 + + // Transmission + _TransmissionProperties ("'Transmission' {Section:{Color:3}}", Float) = 0 + _TransTex ("'Transmission(A)' {Visualize:{A}, Parent:_MainTex}", 2D) = "white" {} + //[Gamma] + _TransScale ("'Weight' {Min:0, Max:1}", Float) = 1.0 + + // Parallax + [Toggle(_PARALLAXMAP)] + _ParallaxT ("'Parallax' {Feature:{Color:5}}", Float) = 0 + [Toggle(_BUMPMODE_POM)] + _BumpMode ("'Mode' {Dropdown:{Parallax:{_MinSamples, _MaxSamples}, POM:{}}}", Float) = 0 + _ParallaxMap ("'Heightmap(G)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "black" {} + _Parallax ("'Height' {Min:0, Max:0.08}", Float) = 0.02 + _MinSamples ("'Min Samples' {Min:1}", Float) = 4 + _MaxSamples ("'Max Samples' {Min:1}", Float) = 20 + + // Team Color + [Toggle(_TEAMCOLOR_ON)] + _TeamColor ("'Team Color' {Feature:{Color:8}}", Float) = 0 + [Enum(Masks, 0, Tint, 1)] + _TeamColorMasksAsTint ("'Texture Mode' {Dropdown:{Masks:{}, Tint:{_TeamColorMasks, _TeamColor0, _TeamColor1, _TeamColor2, _TeamColor3}}}", Float) = 0 + _TeamColorMaskMap ("'Masks(RGBA)' {Visualize:{R, G, B, A, RGB}, Parent:_MainTex}", 2D) = "black" {} + _TeamColorMasks ("'Channels' {Vector:Channels}", Vector) = (1,1,1,0) + _TeamColor0 ("'Tint R' {}", Color) = (1,0,0) + _TeamColor1 ("'Tint G' {}", Color) = (0,1,0) + _TeamColor2 ("'Tint B' {}", Color) = (0,0,1) + _TeamColor3 ("'Tint A' {}", Color) = (0.5,0.5,0.5) + + // Decal + [Toggle(_DECAL_ON)] + _Decal ("'Decal' {Feature:{Color:9}}", Float) = 0 + _DecalColor ("'Tint' {}", Color) = (1,1,1,1) + _DecalTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "black" {} + _DecalWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DecalSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _DecalAlphaVertexTint ("'Vertex Alpha Tint' {Min:0, Max:1}", Float) = 0 + + // Emission + [Toggle(_EMISSION)] + _Emission ("'Emission' {Feature:{Color:10}}", Float) = 0 + [LM_Emission] + [HDR] + _EmissionColor ("'Tint' {}", Color) = (1,1,1) + [LM_Emission] + _EmissionMap ("'Mask(RGB)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "white" {} + _IncandescenceMap ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _IncandescenceMapVelocity ("Scroll", Vector) = (0,0,0,0) + [Gamma] + _EmissionWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + + // Rim Emission + [Toggle(_RIM_ON)] + _Rim ("'Rim Emission' {Feature:{Color:11}}", Float) = 0 + [HDR] + _RimColor ("'Tint' {}", Color) = (1,1,1) + _RimTex ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _RimTexVelocity ("Scroll", Vector) = (0,0,0,0) + [Gamma] + _RimWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + [Gamma] + _RimBias ("'Fill' {Min:0, Max:1}", Float) = 0 + _RimPower ("'Falloff' {Min:0.01}", Float) = 4 + + // Dissolve + [Toggle(_DISSOLVE_ON)] + _Dissolve ("'Dissolve' {Feature:{Color:12}}", Float) = 0 + [HDR] + _DissolveGlowColor ("'Glow Tint' {}", Color) = (1,1,1,1) + _DissolveTex ("'Glow Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _DissolveCutoff ("'Cutoff' {Min:0, Max:1}", Float) = 0 + [Gamma] + _DissolveGlowWeight ("'Glow Weight' {Min:0, Max:1}", Float) = 1 + _DissolveEdgeWidth ("'Glow Width' {Min:0, Max:1}", Float) = 0.01 + + // Wetness + [Toggle(_WETNESS_ON)] + _WetnessProperties ("'Wetness' {Feature:{Color:13}}", Float) = 0 + [Toggle(_WETMASKSOURCE_VERTEXCOLORALPHA)] + _WetMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_WetMask}}}", Float) = 0 + _WetMask ("'Mask(A)' {Visualize:{A}}", 2D) = "white" {} + _WetMaskVelocity ("Scroll", Vector) = (0,0,0,0) + _WetMaskUV ("UV Set", Float) = 0 + _WetMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + _WetTint ("'Tint' {}", Color) = (1,1,1,1) + _WetNormalMap ("'Normals' {Visualize:{NRM}}", 2D) = "bump" {} + _WetNormalMapVelocity ("Scroll", Vector) = (0,0,0,0) + _WetNormalMapUV ("UV Set", Float) = 0 + _WetWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _WetRoughness ("'Roughness' {Min:0, Max:1}", Float) = 0.2 + _WetNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _Lightmapping ("'GI' {LightmapEmissionProperty:{}}", Float) = 1 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} + +SubShader { + Tags { + "Queue" = "Geometry" + "IgnoreProjector" = "True" + "RenderType" = "Opaque" + "DisableBatching" = "LODFading" + } + LOD 400 + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + Cull [_Cull] + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature GEOM_TYPE_BRANCH GEOM_TYPE_BRANCH_DETAIL GEOM_TYPE_FROND GEOM_TYPE_LEAF GEOM_TYPE_MESH + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature EFFECT_HUE_VARIATION + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + #pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma instancing_options assumeuniformscaling lodfade maxcount:50 + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Shaders/Definition/SpeedTree.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend One One + ZWrite Off + Cull [_Cull] + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature GEOM_TYPE_BRANCH GEOM_TYPE_BRANCH_DETAIL GEOM_TYPE_FROND GEOM_TYPE_LEAF GEOM_TYPE_MESH + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature EFFECT_HUE_VARIATION + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + #pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + + #include "Assets/Alloy/Shaders/Definition/SpeedTree.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + Cull [_Cull] + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature GEOM_TYPE_BRANCH GEOM_TYPE_BRANCH_DETAIL GEOM_TYPE_FROND GEOM_TYPE_LEAF GEOM_TYPE_MESH + #pragma shader_feature _DISSOLVE_ON + + #pragma multi_compile_shadowcaster + #pragma multi_compile_instancing + //#pragma instancing_options assumeuniformscaling lodfade maxcount:50 + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_SHADOWCASTER + + #include "Assets/Alloy/Shaders/Definition/SpeedTree.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } + + Pass { + Name "DEFERRED" + Tags { "LightMode" = "Deferred" } + + Cull [_Cull] + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature GEOM_TYPE_BRANCH GEOM_TYPE_BRANCH_DETAIL GEOM_TYPE_FROND GEOM_TYPE_LEAF GEOM_TYPE_MESH + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature EFFECT_HUE_VARIATION + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + #pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_prepassfinal + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + #pragma multi_compile_instancing + //#pragma instancing_options assumeuniformscaling lodfade maxcount:50 + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_DEFERRED + + #include "Assets/Alloy/Shaders/Definition/SpeedTree.cginc" + #include "Assets/Alloy/Shaders/Forward/Gbuffer.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature GEOM_TYPE_BRANCH GEOM_TYPE_BRANCH_DETAIL GEOM_TYPE_FROND GEOM_TYPE_LEAF GEOM_TYPE_MESH + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Shaders/Definition/SpeedTree.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +FallBack "VertexLit" +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Shaders/3.0/Nature/SpeedTree.shader.meta b/Assets/Alloy/Shaders/3.0/Nature/SpeedTree.shader.meta new file mode 100644 index 0000000..a81a9b0 --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Nature/SpeedTree.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 377539a520e28cc4881df47f17d1386b +timeCreated: 1442369247 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/3.0/Nature/SpeedTreeBillboard.shader b/Assets/Alloy/Shaders/3.0/Nature/SpeedTreeBillboard.shader new file mode 100644 index 0000000..60ab6d6 --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Nature/SpeedTreeBillboard.shader @@ -0,0 +1,199 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Nature/SpeedTree Billboard" { +Properties { + // Global Settings + [LM_TransparencyCutOff] + _Cutoff ("'Opacity Cutoff' {Min:0, Max:1}", Float) = 0.5 + [MaterialEnum(None,0,Fastest,1)] + _WindQuality ("'Wind Quality' {Dropdown:{None:{}, Fastest:{}}}", Float) = 0 + [Toggle(EFFECT_BUMP)] + _HasBumpMap ("'Normals Source' {Dropdown:{VertexNormals:{_BumpMap,_BumpScale}, NormalMaps:{}}}", Float) = 1 + + // Main Textures + _MainTextures ("'SpeedTree Textures' {Section:{Color:0}}", Float) = 0 + [LM_Albedo] [LM_Transparency] + _Color ("'Tint' {}", Color) = (1,1,1,1) + [LM_MasterTilingOffset] [LM_Albedo] + _MainTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}, Controls:False}", 2D) = "white" {} + [LM_NormalMap] + _BumpMap ("'Normals' {Visualize:{NRM}, Parent:_MainTex}", 2D) = "bump" {} + _HueVariation ("'Hue Variation' {}", Color) = (1.0,0.5,0.0,0.1) + + // Main Properties + _MainPhysicalProperties ("'SpeedTree Properties' {Section:{Color:1}}", Float) = 0 + _BumpScale ("'Normal Strength' {}", Float) = 1 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 +} + +// NOTE: Instancing disabled because it makes the billboard jump around wildly. + +SubShader { + Tags { + "Queue" = "AlphaTest" + "IgnoreProjector" = "True" + "RenderType" = "TransparentCutout" + //"DisableBatching" = "LODFading" + } + LOD 400 + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + Cull Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature EFFECT_HUE_VARIATION + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + #pragma multi_compile __ LOD_FADE_CROSSFADE + #pragma multi_compile __ BILLBOARD_FACE_CAMERA_POS + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Shaders/Definition/SpeedTreeBillboard.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend One One + ZWrite Off + Cull Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature EFFECT_HUE_VARIATION + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + #pragma multi_compile __ LOD_FADE_CROSSFADE + #pragma multi_compile __ BILLBOARD_FACE_CAMERA_POS + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + + #include "Assets/Alloy/Shaders/Definition/SpeedTreeBillboard.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + Cull Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma multi_compile __ LOD_FADE_CROSSFADE + #pragma multi_compile __ BILLBOARD_FACE_CAMERA_POS + #pragma multi_compile_shadowcaster + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_SHADOWCASTER + + #include "Assets/Alloy/Shaders/Definition/SpeedTreeBillboard.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } + + Pass { + Name "DEFERRED" + Tags { "LightMode" = "Deferred" } + + Cull Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature EFFECT_HUE_VARIATION + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + #pragma multi_compile __ LOD_FADE_CROSSFADE + #pragma multi_compile __ BILLBOARD_FACE_CAMERA_POS + #pragma multi_compile_prepassfinal + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_DEFERRED + + #include "Assets/Alloy/Shaders/Definition/SpeedTreeBillboard.cginc" + #include "Assets/Alloy/Shaders/Forward/Gbuffer.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma multi_compile __ LOD_FADE_CROSSFADE + #pragma multi_compile __ BILLBOARD_FACE_CAMERA_POS + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Shaders/Definition/SpeedTreeBillboard.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +FallBack "VertexLit" +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Shaders/3.0/Nature/SpeedTreeBillboard.shader.meta b/Assets/Alloy/Shaders/3.0/Nature/SpeedTreeBillboard.shader.meta new file mode 100644 index 0000000..0ac382b --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Nature/SpeedTreeBillboard.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 05c73c73340c44a4892a3d5e99b692a9 +timeCreated: 1442369236 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/3.0/Nature/Terrain 4Splat.shader b/Assets/Alloy/Shaders/3.0/Nature/Terrain 4Splat.shader new file mode 100644 index 0000000..8f68067 --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Nature/Terrain 4Splat.shader @@ -0,0 +1,235 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Nature/Terrain/4Splat" { +Properties { + // Splat 0 Properties + _Splat0Properties ("'Splat 0 Properties' {Section:{Color:0}}", Float) = 0 + _SplatSpecularity0 ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _SplatSpecularTint0 ("'Specular Tint' {Min:0, Max:1}", Float) = 0.0 + + // Splat 1 Properties + _Splat1Properties ("'Splat 1 Properties' {Section:{Color:0}}", Float) = 0 + _SplatSpecularity1 ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _SplatSpecularTint1 ("'Specular Tint' {Min:0, Max:1}", Float) = 0.0 + + // Splat 2 Properties + _Splat2Properties ("'Splat 2 Properties' {Section:{Color:0}}", Float) = 0 + _SplatSpecularity2 ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _SplatSpecularTint2 ("'Specular Tint' {Min:0, Max:1}", Float) = 0.0 + + // Splat 3 Properties + _Splat3Properties ("'Splat 3 Properties' {Section:{Color:0}}", Float) = 0 + _SplatSpecularity3 ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _SplatSpecularTint3 ("'Specular Tint' {Min:0, Max:1}", Float) = 0.0 + + // Distant Terrain + _DistantTerrainProperties ("'Distant Terrain' {Section:{Color:1}}", Float) = 0 + _FadeDist ("'Fade Distance' {Min:0}", Float) = 500.0 + _FadeRange ("'Fade Range' {Min:0.0001}", Float) = 100.0 + _DistantSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _DistantSpecularTint ("'Specular Tint' {Min:0, Max:1}", Float) = 0 + _DistantRoughness ("'Roughness' {Min:0, Max:1}", Float) = 0.5 + + // Triplanar + [Toggle(_METALLICGLOSSMAP)] + _TriplanarProperties ("'Triplanar' {Feature:{Color:4}}", Float) = 0 + _TriplanarBlendSharpness ("'Sharpness' {Min:1, Max:50}", Float) = 2 + + // Detail + [Toggle(_DETAIL_MULX2)] + _DetailT ("'Detail' {Feature:{Color:7}}", Float) = 0 + [Enum(Mul, 0, MulX2, 1)] + _DetailMode ("'Color Mode' {Dropdown:{Mul:{}, MulX2:{}}}", Float) = 0 + _DetailAlbedoMap ("'Color(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _DetailNormalMap ("'Normals' {Visualize:{NRM}, Parent:_DetailAlbedoMap}", 2D) = "bump" {} + _DetailWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DetailNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _Lightmapping ("'GI' {LightmapEmissionProperty:{}}", Float) = 1 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + + // set by terrain engine + _Control ("Control (RGBA)", 2D) = "red" {} + _Splat3 ("Layer 3 (A)", 2D) = "white" {} + _Splat2 ("Layer 2 (B)", 2D) = "white" {} + _Splat1 ("Layer 1 (G)", 2D) = "white" {} + _Splat0 ("Layer 0 (R)", 2D) = "white" {} + _Normal3 ("Normal 3 (A)", 2D) = "bump" {} + _Normal2 ("Normal 2 (B)", 2D) = "bump" {} + _Normal1 ("Normal 1 (G)", 2D) = "bump" {} + _Normal0 ("Normal 0 (R)", 2D) = "bump" {} + _Metallic0 ("Metallic 0", Range(0.0, 1.0)) = 0.0 + _Metallic1 ("Metallic 1", Range(0.0, 1.0)) = 0.0 + _Metallic2 ("Metallic 2", Range(0.0, 1.0)) = 0.0 + _Metallic3 ("Metallic 3", Range(0.0, 1.0)) = 0.0 + + // used in fallback on old cards & base map + _MainTex ("BaseMap (RGB)", 2D) = "white" {} + _Color ("Main Color", Color) = (1,1,1,1) +} + +SubShader { + Tags { + "SplatCount" = "4" + "Queue" = "Geometry-100" + "RenderType" = "Opaque" + } + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _METALLICGLOSSMAP + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + #pragma multi_compile __ _TERRAIN_NORMAL_MAP + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Shaders/Definition/Terrain.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend One One + ZWrite Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _METALLICGLOSSMAP + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + #pragma multi_compile __ _TERRAIN_NORMAL_MAP + + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + + #include "Assets/Alloy/Shaders/Definition/Terrain.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _METALLICGLOSSMAP + + #pragma multi_compile_shadowcaster + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_SHADOWCASTER + + #include "Assets/Alloy/Shaders/Definition/Terrain.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } + + Pass { + Name "DEFERRED" + Tags { "LightMode" = "Deferred" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _METALLICGLOSSMAP + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + #pragma multi_compile __ _TERRAIN_NORMAL_MAP + + #pragma multi_compile_prepassfinal + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_DEFERRED + + #include "Assets/Alloy/Shaders/Definition/Terrain.cginc" + #include "Assets/Alloy/Shaders/Forward/Gbuffer.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _METALLICGLOSSMAP + #pragma shader_feature _DETAIL_MULX2 + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Shaders/Definition/Terrain.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +Dependency "BaseMapShader" = "Hidden/Alloy/Nature/Terrain/Distant" +Dependency "Details0" = "Hidden/Alloy/Nature/Terrain/Details0" +Dependency "Details1" = "Hidden/Alloy/Nature/Terrain/Details1" +Dependency "Details2" = "Hidden/Alloy/Nature/Terrain/Details2" +Dependency "Tree0" = "Hidden/TerrainEngine/BillboardTree" + +Fallback "Hidden/Alloy/Nature/Terrain/Distant" +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Shaders/3.0/Nature/Terrain 4Splat.shader.meta b/Assets/Alloy/Shaders/3.0/Nature/Terrain 4Splat.shader.meta new file mode 100644 index 0000000..a1f72de --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Nature/Terrain 4Splat.shader.meta @@ -0,0 +1,20 @@ +fileFormatVersion: 2 +guid: fdbf03d8e48878c40a2a56716086db37 +ShaderImporter: + defaultTextures: + - _DetailAlbedoMap: {instanceID: 0} + - _DetailMaterialMap: {fileID: 2800000, guid: 2b77d5cb601375f4ba50c6194c126e59, + type: 3} + - _DetailNormalMap: {instanceID: 0} + - _Control: {instanceID: 0} + - _Splat3: {instanceID: 0} + - _Splat2: {instanceID: 0} + - _Splat1: {instanceID: 0} + - _Splat0: {instanceID: 0} + - _Normal3: {instanceID: 0} + - _Normal2: {instanceID: 0} + - _Normal1: {instanceID: 0} + - _Normal0: {instanceID: 0} + - _MainTex: {instanceID: 0} + userData: + assetBundleName: diff --git a/Assets/Alloy/Shaders/3.0/Nature/Terrain Distant.shader b/Assets/Alloy/Shaders/3.0/Nature/Terrain Distant.shader new file mode 100644 index 0000000..917dc3e --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Nature/Terrain Distant.shader @@ -0,0 +1,178 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Hidden/Alloy/Nature/Terrain/Distant" { +Properties { + // Distant Terrain + _DistantSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _DistantSpecularTint ("'Specular Tint' {Min:0, Max:1}", Float) = 0 + _DistantRoughness ("'Roughness' {Min:0, Max:1}", Float) = 0.5 + + // Detail + [Toggle(_DETAIL_MULX2)] + _DetailT ("'Detail' {Feature:{Color:7}}", Float) = 0 + [Enum(Mul, 0, MulX2, 1)] + _DetailMode ("'Color Mode' {Dropdown:{Mul:{}, MulX2:{}}}", Float) = 0 + _DetailAlbedoMap ("'Color(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _DetailNormalMap ("'Normals' {Visualize:{NRM}, Parent:_DetailAlbedoMap}", 2D) = "bump" {} + _DetailWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DetailNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _Lightmapping ("'GI' {LightmapEmissionProperty:{}}", Float) = 1 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + + // set by terrain engine + _MainTex ("Base (RGB) Smoothness (A)", 2D) = "white" {} + _MetallicTex ("Metallic (R)", 2D) = "white" {} + _Smoothness ("Smoothness", Range(0.0, 1.0)) = 0.0 +} + +CGINCLUDE + #define A_TERRAIN_DISTANT +ENDCG + +SubShader { + Tags { + "RenderType" = "Opaque" + "Queue" = "Geometry-100" + } + LOD 200 + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ VTRANSPARENCY_ON + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Shaders/Definition/Terrain.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend One One + ZWrite Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + //#pragma multi_compile __ VTRANSPARENCY_ON + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + + #include "Assets/Alloy/Shaders/Definition/Terrain.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma multi_compile_shadowcaster + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_SHADOWCASTER + + #include "Assets/Alloy/Shaders/Definition/Terrain.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } + + Pass { + Name "DEFERRED" + Tags { "LightMode" = "Deferred" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + #pragma multi_compile_prepassfinal + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_DEFERRED + + #include "Assets/Alloy/Shaders/Definition/Terrain.cginc" + #include "Assets/Alloy/Shaders/Forward/Gbuffer.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _DETAIL_MULX2 + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Shaders/Definition/Terrain.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +FallBack "Diffuse" +} diff --git a/Assets/Alloy/Shaders/3.0/Nature/Terrain Distant.shader.meta b/Assets/Alloy/Shaders/3.0/Nature/Terrain Distant.shader.meta new file mode 100644 index 0000000..f462429 --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Nature/Terrain Distant.shader.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: ef968fede0fa8be47be2bb35732ddaab +ShaderImporter: + defaultTextures: + - _DetailAlbedoMap: {instanceID: 0} + - _DetailMaterialMap: {fileID: 2800000, guid: 2b77d5cb601375f4ba50c6194c126e59, + type: 3} + - _DetailNormalMap: {instanceID: 0} + userData: + assetBundleName: diff --git a/Assets/Alloy/Shaders/3.0/Nature/Terrain nSplat AddPass.shader b/Assets/Alloy/Shaders/3.0/Nature/Terrain nSplat AddPass.shader new file mode 100644 index 0000000..0e25890 --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Nature/Terrain nSplat AddPass.shader @@ -0,0 +1,221 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Hidden/Alloy/Nature/Terrain/nSplat AddPass" { +Properties { + // Distant Terrain + _DistantTerrainProperties ("'Terrain' {Section:{Color:1}}", Float) = 0 + _FadeDist ("'Fade Distance' {Min:0}", Float) = 500.0 + _FadeRange ("'Fade Range' {Min:0.0001}", Float) = 100.0 + _DistantSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _DistantSpecularTint ("'Specular Tint' {Min:0, Max:1}", Float) = 0 + _DistantRoughness ("'Roughness' {Min:0, Max:1}", Float) = 0.5 + + // Triplanar + [Toggle(_METALLICGLOSSMAP)] + _TriplanarProperties ("'Triplanar' {Feature:{Color:4}}", Float) = 0 + _TriplanarBlendSharpness ("'Sharpness' {Min:1, Max:50}", Float) = 2 + + // Detail + [Toggle(_DETAIL_MULX2)] + _DetailT ("'Detail' {Feature:{Color:7}}", Float) = 0 + [Enum(Mul, 0, MulX2, 1)] + _DetailMode ("'Color Mode' {Dropdown:{Mul:{}, MulX2:{}}}", Float) = 0 + _DetailAlbedoMap ("'Color(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _DetailNormalMap ("'Normals' {Visualize:{NRM}, Parent:_DetailAlbedoMap}", 2D) = "bump" {} + _DetailWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DetailNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _Lightmapping ("'GI' {LightmapEmissionProperty:{}}", Float) = 1 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + + // set by terrain engine + _Control ("Control (RGBA)", 2D) = "red" {} + _Splat3 ("Layer 3 (A)", 2D) = "white" {} + _Splat2 ("Layer 2 (B)", 2D) = "white" {} + _Splat1 ("Layer 1 (G)", 2D) = "white" {} + _Splat0 ("Layer 0 (R)", 2D) = "white" {} + _Normal3 ("Normal 3 (A)", 2D) = "bump" {} + _Normal2 ("Normal 2 (B)", 2D) = "bump" {} + _Normal1 ("Normal 1 (G)", 2D) = "bump" {} + _Normal0 ("Normal 0 (R)", 2D) = "bump" {} + _Metallic0 ("Metallic 0", Range(0.0, 1.0)) = 0.0 + _Metallic1 ("Metallic 1", Range(0.0, 1.0)) = 0.0 + _Metallic2 ("Metallic 2", Range(0.0, 1.0)) = 0.0 + _Metallic3 ("Metallic 3", Range(0.0, 1.0)) = 0.0 + + // used in fallback on old cards & base map + _MainTex ("BaseMap (RGB)", 2D) = "white" {} + _Color ("Main Color", Color) = (1,1,1,1) +} + +CGINCLUDE + #define A_TERRAIN_NSPLAT_ADDPASS_SHADER + #define A_TERRAIN_NSPLAT_SHADER +ENDCG + +SubShader { + Tags { + "Queue" = "Geometry-99" + "IgnoreProjector"="True" + "RenderType" = "Opaque" + } + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + Blend One One + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _METALLICGLOSSMAP + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + #pragma multi_compile __ _TERRAIN_NORMAL_MAP + + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Shaders/Definition/Terrain.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend One One + ZWrite Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _METALLICGLOSSMAP + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + #pragma multi_compile __ _TERRAIN_NORMAL_MAP + + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + + #include "Assets/Alloy/Shaders/Definition/Terrain.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _METALLICGLOSSMAP + + #pragma multi_compile_shadowcaster + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_SHADOWCASTER + + #include "Assets/Alloy/Shaders/Definition/Terrain.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } + + Pass { + Name "DEFERRED" + Tags { "LightMode" = "Deferred" } + + Blend One One + ZWrite Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _METALLICGLOSSMAP + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + #pragma multi_compile __ _TERRAIN_NORMAL_MAP + + #pragma multi_compile_prepassfinal + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_DEFERRED + + #include "Assets/Alloy/Shaders/Definition/Terrain.cginc" + #include "Assets/Alloy/Shaders/Forward/Gbuffer.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _METALLICGLOSSMAP + #pragma shader_feature _DETAIL_MULX2 + + #pragma multi_compile __ _TERRAIN_NORMAL_MAP + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Shaders/Definition/Terrain.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +Fallback "Hidden/Alloy/Nature/Terrain/Distant" +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Shaders/3.0/Nature/Terrain nSplat AddPass.shader.meta b/Assets/Alloy/Shaders/3.0/Nature/Terrain nSplat AddPass.shader.meta new file mode 100644 index 0000000..b1767e5 --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Nature/Terrain nSplat AddPass.shader.meta @@ -0,0 +1,23 @@ +fileFormatVersion: 2 +guid: cf6b2ed382d740849a7fbf3f707cbbbf +timeCreated: 1456952070 +licenseType: Pro +ShaderImporter: + defaultTextures: + - _DetailAlbedoMap: {instanceID: 0} + - _DetailMaterialMap: {fileID: 2800000, guid: 2b77d5cb601375f4ba50c6194c126e59, + type: 3} + - _DetailNormalMap: {instanceID: 0} + - _Control: {instanceID: 0} + - _Splat3: {instanceID: 0} + - _Splat2: {instanceID: 0} + - _Splat1: {instanceID: 0} + - _Splat0: {instanceID: 0} + - _Normal3: {instanceID: 0} + - _Normal2: {instanceID: 0} + - _Normal1: {instanceID: 0} + - _Normal0: {instanceID: 0} + - _MainTex: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/3.0/Nature/Terrain nSplat FirstPass.shader b/Assets/Alloy/Shaders/3.0/Nature/Terrain nSplat FirstPass.shader new file mode 100644 index 0000000..e8027b5 --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Nature/Terrain nSplat FirstPass.shader @@ -0,0 +1,221 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Nature/Terrain/nSplat" { +Properties { + // Distant Terrain + _DistantTerrainProperties ("'Terrain' {Section:{Color:1}}", Float) = 0 + _FadeDist ("'Fade Distance' {Min:0}", Float) = 500.0 + _FadeRange ("'Fade Range' {Min:0.0001}", Float) = 100.0 + _DistantSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _DistantSpecularTint ("'Specular Tint' {Min:0, Max:1}", Float) = 0 + _DistantRoughness ("'Roughness' {Min:0, Max:1}", Float) = 0.5 + + // Triplanar + [Toggle(_METALLICGLOSSMAP)] + _TriplanarProperties ("'Triplanar' {Feature:{Color:4}}", Float) = 0 + _TriplanarBlendSharpness ("'Sharpness' {Min:1, Max:50}", Float) = 2 + + // Detail + [Toggle(_DETAIL_MULX2)] + _DetailT ("'Detail' {Feature:{Color:7}}", Float) = 0 + [Enum(Mul, 0, MulX2, 1)] + _DetailMode ("'Color Mode' {Dropdown:{Mul:{}, MulX2:{}}}", Float) = 0 + _DetailAlbedoMap ("'Color(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _DetailNormalMap ("'Normals' {Visualize:{NRM}, Parent:_DetailAlbedoMap}", 2D) = "bump" {} + _DetailWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DetailNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _Lightmapping ("'GI' {LightmapEmissionProperty:{}}", Float) = 1 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + + // set by terrain engine + _Control ("Control (RGBA)", 2D) = "red" {} + _Splat3 ("Layer 3 (A)", 2D) = "white" {} + _Splat2 ("Layer 2 (B)", 2D) = "white" {} + _Splat1 ("Layer 1 (G)", 2D) = "white" {} + _Splat0 ("Layer 0 (R)", 2D) = "white" {} + _Normal3 ("Normal 3 (A)", 2D) = "bump" {} + _Normal2 ("Normal 2 (B)", 2D) = "bump" {} + _Normal1 ("Normal 1 (G)", 2D) = "bump" {} + _Normal0 ("Normal 0 (R)", 2D) = "bump" {} + _Metallic0 ("Metallic 0", Range(0.0, 1.0)) = 0.0 + _Metallic1 ("Metallic 1", Range(0.0, 1.0)) = 0.0 + _Metallic2 ("Metallic 2", Range(0.0, 1.0)) = 0.0 + _Metallic3 ("Metallic 3", Range(0.0, 1.0)) = 0.0 + + // used in fallback on old cards & base map + _MainTex ("BaseMap (RGB)", 2D) = "white" {} + _Color ("Main Color", Color) = (1,1,1,1) +} + +CGINCLUDE + #define A_TERRAIN_NSPLAT_SHADER +ENDCG + +SubShader { + Tags{ + "Queue" = "Geometry-100" + "RenderType" = "Opaque" + } + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _METALLICGLOSSMAP + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + #pragma multi_compile __ _TERRAIN_NORMAL_MAP + + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Shaders/Definition/Terrain.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend One One + ZWrite Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _METALLICGLOSSMAP + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + #pragma multi_compile __ _TERRAIN_NORMAL_MAP + + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + + #include "Assets/Alloy/Shaders/Definition/Terrain.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _METALLICGLOSSMAP + + #pragma multi_compile_shadowcaster + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_SHADOWCASTER + + #include "Assets/Alloy/Shaders/Definition/Terrain.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } + + Pass { + Name "DEFERRED" + Tags { "LightMode" = "Deferred" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _METALLICGLOSSMAP + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + #pragma multi_compile __ _TERRAIN_NORMAL_MAP + + #pragma multi_compile_prepassfinal + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_DEFERRED + + #include "Assets/Alloy/Shaders/Definition/Terrain.cginc" + #include "Assets/Alloy/Shaders/Forward/Gbuffer.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _METALLICGLOSSMAP + #pragma shader_feature _DETAIL_MULX2 + + #pragma multi_compile __ _TERRAIN_NORMAL_MAP + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Shaders/Definition/Terrain.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +Dependency "AddPassShader" = "Hidden/Alloy/Nature/Terrain/nSplat AddPass" +Dependency "BaseMapShader" = "Hidden/Alloy/Nature/Terrain/Distant" +Dependency "Details0" = "Hidden/Alloy/Nature/Terrain/Details0" +Dependency "Details1" = "Hidden/Alloy/Nature/Terrain/Details1" +Dependency "Details2" = "Hidden/Alloy/Nature/Terrain/Details2" +Dependency "Tree0" = "Hidden/TerrainEngine/BillboardTree" + +Fallback "Hidden/Alloy/Nature/Terrain/Distant" +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Shaders/3.0/Nature/Terrain nSplat FirstPass.shader.meta b/Assets/Alloy/Shaders/3.0/Nature/Terrain nSplat FirstPass.shader.meta new file mode 100644 index 0000000..d5d36a8 --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Nature/Terrain nSplat FirstPass.shader.meta @@ -0,0 +1,23 @@ +fileFormatVersion: 2 +guid: a2e70721346c6844595ff93ec1163dbb +timeCreated: 1456952084 +licenseType: Pro +ShaderImporter: + defaultTextures: + - _DetailAlbedoMap: {instanceID: 0} + - _DetailMaterialMap: {fileID: 2800000, guid: 2b77d5cb601375f4ba50c6194c126e59, + type: 3} + - _DetailNormalMap: {instanceID: 0} + - _Control: {instanceID: 0} + - _Splat3: {instanceID: 0} + - _Splat2: {instanceID: 0} + - _Splat1: {instanceID: 0} + - _Splat0: {instanceID: 0} + - _Normal3: {instanceID: 0} + - _Normal2: {instanceID: 0} + - _Normal1: {instanceID: 0} + - _Normal0: {instanceID: 0} + - _MainTex: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/3.0/Specialist.meta b/Assets/Alloy/Shaders/3.0/Specialist.meta new file mode 100644 index 0000000..be32cb1 --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Specialist.meta @@ -0,0 +1,6 @@ +fileFormatVersion: 2 +guid: 5b0fee9953ed6b540b6f7bb2e85232fa +folderAsset: yes +DefaultImporter: + userData: + assetBundleName: diff --git a/Assets/Alloy/Shaders/3.0/Specialist/Car Paint.shader b/Assets/Alloy/Shaders/3.0/Specialist/Car Paint.shader new file mode 100644 index 0000000..8076304 --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Specialist/Car Paint.shader @@ -0,0 +1,373 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Car Paint" { +Properties { + // Global Settings + _Mode ("'Rendering Mode' {RenderingMode:{Opaque:{_Cutoff}, Cutout:{}, Fade:{_Cutoff}, Transparent:{_Cutoff}}}", Float) = 0 + _SrcBlend ("__src", Float) = 0 + _DstBlend ("__dst", Float) = 0 + _ZWrite ("__zw", Float) = 1 + [LM_TransparencyCutOff] + _Cutoff ("'Opacity Cutoff' {Min:0, Max:1}", Float) = 0.5 + [Toggle(EFFECT_BUMP)] + _HasBumpMap ("'Normals Source' {Dropdown:{VertexNormals:{_BumpMap,_BumpScale,_DetailNormalMap,_DetailNormalMapScale,_WetNormalMap,_WetNormalMapScale}, NormalMaps:{}}}", Float) = 1 + + // Car Paint Textures + _MainTextures ("'Car Paint Textures' {Section:{Color:0}}", Float) = 0 + [LM_Albedo] [LM_Transparency] + _Color ("'Tint' {}", Color) = (1,1,1,1) + [LM_MasterTilingOffset] [LM_Albedo] + _MainTex ("'Base Color(RGB) Paint(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _MainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _MainTexUV ("UV Set", Float) = 0 + [LM_Metallic] + _SpecTex ("'Metal(R) AO(G) Spec(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_MainTex}", 2D) = "white" {} + [LM_NormalMap] + _BumpMap ("'Normals' {Visualize:{NRM}, Parent:_MainTex}", 2D) = "bump" {} + _BaseColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Car Paint Properties + _MainPhysicalProperties ("'Car Paint Properties' {Section:{Color:1}}", Float) = 0 + [LM_Metallic] + _Metal ("'Metallic' {Min:0, Max:1}", Float) = 1 + _Specularity ("'Specularity' {Min:0, Max:1}", Float) = 1 + _SpecularTint ("'Specular Tint' {Min:0, Max:1}", Float) = 0 + _Roughness ("'Roughness' {Min:0, Max:1}", Float) = 1 + _Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _BumpScale ("'Normal Strength' {}", Float) = 1 + + // Paint + _PaintProperties ("'Paint' {Section:{Color:2}}", Float) = 0 + _CarPrimaryColor ("'Primary Color' {}", Color) = (1,1,1) + _CarSecondaryColor ("'Secondary Color' {}", Color) = (1,1,1) + _CarSecondaryColorWeight ("'Blend Weight' {Min:0, Max:1}", Float) = 1 + _CarSecondaryColorFalloff ("'Blend Falloff' {Min:0, Max:1}", Float) = 1 + + // Flakes + _FlakeProperties ("'Flakes' {Section:{Color:3}}", Float) = 0 + _CarFlakeColor ("'Tint' {}", Color) = (1,1,1) + _CarFlakeMap ("'Color(RGB) Mask(A)' {Visualize:{RGB,A}}", 2D) = "black" {} + _CarFlakeMapUV ("UV Set", Float) = 0 + _CarFlakeMapFalloff ("'Mask Falloff' {Min:0.01}", Float) = 1 + _CarFlakeWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _CarFlakeSpread ("'Spread' {Min:0, Max:1}", Float) = 0.5 + _CarFlakeHighlightSpread ("'Highlight Spread' {Min:0, Max:1}", Float) = 0.5 + + // Parallax + [Toggle(_PARALLAXMAP)] + _ParallaxT ("'Parallax' {Feature:{Color:5}}", Float) = 0 + [Toggle(_BUMPMODE_POM)] + _BumpMode ("'Mode' {Dropdown:{Parallax:{_MinSamples, _MaxSamples}, POM:{}}}", Float) = 0 + _ParallaxMap ("'Heightmap(G)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "black" {} + _Parallax ("'Height' {Min:0, Max:0.08}", Float) = 0.02 + _MinSamples ("'Min Samples' {Min:1}", Float) = 4 + _MaxSamples ("'Max Samples' {Min:1}", Float) = 20 + + // AO2 + [Toggle(_AO2_ON)] + _AO2 ("'AO2' {Feature:{Color:6}}", Float) = 0 + _Ao2Map ("'AO2(G)' {Visualize:{RGB}}", 2D) = "white" {} + _Ao2MapUV ("UV Set", Float) = 1 + _Ao2Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + + // Detail + [Toggle(_DETAIL_MULX2)] + _DetailT ("'Detail' {Feature:{Color:7}}", Float) = 0 + [Toggle(_NORMALMAP)] + _DetailMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_DetailMask}}}", Float) = 0 + _DetailMask ("'Mask(A)' {Visualize:{A}, Parent:_MainTex}", 2D) = "white" {} + _DetailMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + [Enum(Mul, 0, MulX2, 1)] + _DetailMode ("'Color Mode' {Dropdown:{Mul:{}, MulX2:{}}}", Float) = 0 + _DetailAlbedoMap ("'Color(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _DetailAlbedoMapVelocity ("Scroll", Vector) = (0,0,0,0) + _DetailAlbedoMapUV ("UV Set", Float) = 0 + _DetailNormalMap ("'Normals' {Visualize:{NRM}, Parent:_DetailAlbedoMap}", 2D) = "bump" {} + _DetailWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DetailNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Team Color + [Toggle(_TEAMCOLOR_ON)] + _TeamColor ("'Team Color' {Feature:{Color:8}}", Float) = 0 + [Enum(Masks, 0, Tint, 1)] + _TeamColorMasksAsTint ("'Texture Mode' {Dropdown:{Masks:{}, Tint:{_TeamColorMasks, _TeamColor0, _TeamColor1, _TeamColor2, _TeamColor3}}}", Float) = 0 + _TeamColorMaskMap ("'Masks(RGBA)' {Visualize:{R, G, B, A, RGB}, Parent:_MainTex}", 2D) = "black" {} + _TeamColorMasks("'Channels' {Vector:Channels}", Vector) = (1,1,1,0) + _TeamColor0 ("'Tint R' {}", Color) = (1,0,0) + _TeamColor1 ("'Tint G' {}", Color) = (0,1,0) + _TeamColor2 ("'Tint B' {}", Color) = (0,0,1) + _TeamColor3 ("'Tint A' {}", Color) = (0.5,0.5,0.5) + + // Decal + [Toggle(_DECAL_ON)] + _Decal ("'Decal' {Feature:{Color:9}}", Float) = 0 + _DecalColor ("'Tint' {}", Color) = (1,1,1,1) + _DecalTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "black" {} + _DecalTexUV ("UV Set", Float) = 0 + _DecalWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DecalSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _DecalAlphaVertexTint ("'Vertex Alpha Tint' {Min:0, Max:1}", Float) = 0 + + // Emission + [Toggle(_EMISSION)] + _Emission ("'Emission' {Feature:{Color:10}}", Float) = 0 + [LM_Emission] + [HDR] + _EmissionColor ("'Tint' {}", Color) = (1,1,1) + [LM_Emission] + _EmissionMap ("'Mask(RGB)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "white" {} + _IncandescenceMap ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _IncandescenceMapVelocity ("Scroll", Vector) = (0,0,0,0) + _IncandescenceMapUV ("UV Set", Float) = 0 + [Gamma] + _EmissionWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + + // Rim Emission + [Toggle(_RIM_ON)] + _Rim ("'Rim Emission' {Feature:{Color:11}}", Float) = 0 + [HDR] + _RimColor ("'Tint' {}", Color) = (1,1,1) + _RimTex ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _RimTexVelocity ("Scroll", Vector) = (0,0,0,0) + _RimTexUV ("UV Set", Float) = 0 + [Gamma] + _RimWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + [Gamma] + _RimBias ("'Fill' {Min:0, Max:1}", Float) = 0 + _RimPower ("'Falloff' {Min:0.01}", Float) = 4 + + // Dissolve + [Toggle(_DISSOLVE_ON)] + _Dissolve ("'Dissolve' {Feature:{Color:12}}", Float) = 0 + [HDR] + _DissolveGlowColor ("'Glow Tint' {}", Color) = (1,1,1,1) + _DissolveTex ("'Glow Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _DissolveTexUV ("UV Set", Float) = 0 + _DissolveCutoff ("'Cutoff' {Min:0, Max:1}", Float) = 0 + [Gamma] + _DissolveGlowWeight ("'Glow Weight' {Min:0, Max:1}", Float) = 1 + _DissolveEdgeWidth ("'Glow Width' {Min:0, Max:1}", Float) = 0.01 + + // Wetness + [Toggle(_WETNESS_ON)] + _WetnessProperties ("'Wetness' {Feature:{Color:13}}", Float) = 0 + [Toggle(_WETMASKSOURCE_VERTEXCOLORALPHA)] + _WetMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_WetMask}}}", Float) = 0 + _WetMask ("'Mask(A)' {Visualize:{A}}", 2D) = "white" {} + _WetMaskVelocity ("Scroll", Vector) = (0,0,0,0) + _WetMaskUV ("UV Set", Float) = 0 + _WetMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + _WetTint ("'Tint' {}", Color) = (1,1,1,1) + _WetNormalMap ("'Normals' {Visualize:{NRM}}", 2D) = "bump" {} + _WetNormalMapVelocity ("Scroll", Vector) = (0,0,0,0) + _WetNormalMapUV ("UV Set", Float) = 0 + _WetWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _WetRoughness ("'Roughness' {Min:0, Max:1}", Float) = 0.2 + _WetNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _Lightmapping ("'GI' {LightmapEmissionProperty:{}}", Float) = 1 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} + +SubShader { + Tags { + "RenderType" = "Opaque" + "PerformanceChecks" = "False" + //"DisableBatching" = "LODFading" + } + LOD 300 + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + Blend [_SrcBlend] [_DstBlend] + ZWrite [_ZWrite] + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Shaders/Definition/CarPaint.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend [_SrcBlend] One + ZWrite Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + + #include "Assets/Alloy/Shaders/Definition/CarPaint.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature _DISSOLVE_ON + + #pragma multi_compile_shadowcaster + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_SHADOWCASTER + + #include "Assets/Alloy/Shaders/Definition/CarPaint.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } + + Pass { + Name "DEFERRED" + Tags { "LightMode" = "Deferred" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_prepassfinal + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_DEFERRED + + #include "Assets/Alloy/Shaders/Definition/CarPaint.cginc" + #include "Assets/Alloy/Shaders/Forward/Gbuffer.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Shaders/Definition/CarPaint.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +FallBack "VertexLit" +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Shaders/3.0/Specialist/Car Paint.shader.meta b/Assets/Alloy/Shaders/3.0/Specialist/Car Paint.shader.meta new file mode 100644 index 0000000..ede7251 --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Specialist/Car Paint.shader.meta @@ -0,0 +1,22 @@ +fileFormatVersion: 2 +guid: 4f29be92954ba6f4bb866de299ea5a9b +ShaderImporter: + defaultTextures: + - _MainTex: {instanceID: 0} + - _SpecTex: {instanceID: 0} + - _BumpMap: {instanceID: 0} + - _CarFlakeMap: {instanceID: 0} + - _ParallaxMap: {instanceID: 0} + - _DetailMask: {instanceID: 0} + - _DetailAlbedoMap: {instanceID: 0} + - _DetailMaterialMap: {fileID: 2800000, guid: 2b77d5cb601375f4ba50c6194c126e59, + type: 3} + - _DetailNormalMap: {instanceID: 0} + - _TeamColorMaskMap: {instanceID: 0} + - _DecalTex: {instanceID: 0} + - _EmissionMap: {instanceID: 0} + - _IncandescenceMap: {instanceID: 0} + - _RimTex: {instanceID: 0} + - _DissolveTex: {instanceID: 0} + userData: + assetBundleName: diff --git a/Assets/Alloy/Shaders/3.0/Specialist/Directional Blend.shader b/Assets/Alloy/Shaders/3.0/Specialist/Directional Blend.shader new file mode 100644 index 0000000..214d6d2 --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Specialist/Directional Blend.shader @@ -0,0 +1,397 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Directional Blend" { +Properties { + // Global Settings + _Mode ("'Rendering Mode' {RenderingMode:{Opaque:{_Cutoff}, Cutout:{}, Fade:{_Cutoff}, Transparent:{_Cutoff}}}", Float) = 0 + _SrcBlend ("__src", Float) = 0 + _DstBlend ("__dst", Float) = 0 + _ZWrite ("__zw", Float) = 1 + [LM_TransparencyCutOff] + _Cutoff ("'Opacity Cutoff' {Min:0, Max:1}", Float) = 0.5 + [Toggle(EFFECT_BUMP)] + _HasBumpMap ("'Normals Source' {Dropdown:{VertexNormals:{_BumpMap,_BumpScale,_DetailNormalMap,_DetailNormalMapScale,_WetNormalMap,_WetNormalMapScale,_BumpMap2,_BumpScale2}, NormalMaps:{}}}", Float) = 1 + [Toggle(_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A)] + _MainRoughnessSource ("'Roughness Source' {Dropdown:{PackedMapAlpha:{}, BaseColorAlpha:{_SpecTex,_Occlusion,_MaterialMap2,_Occlusion2}}}", Float) = 0 + + // Main Textures + _MainTextures ("'Main Textures' {Section:{Color:0}}", Float) = 0 + [LM_Albedo] [LM_Transparency] + _Color ("'Tint' {}", Color) = (1,1,1,1) + [LM_MasterTilingOffset] [LM_Albedo] + _MainTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _MainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _MainTexUV ("UV Set", Float) = 0 + [LM_Metallic] + _SpecTex ("'Metal(R) AO(G) Spec(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_MainTex}", 2D) = "white" {} + [LM_NormalMap] + _BumpMap ("'Normals' {Visualize:{NRM}, Parent:_MainTex}", 2D) = "bump" {} + _BaseColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Main Properties + _MainPhysicalProperties ("'Main Properties' {Section:{Color:1}}", Float) = 0 + [LM_Metallic] + _Metal ("'Metallic' {Min:0, Max:1}", Float) = 1 + _Specularity ("'Specularity' {Min:0, Max:1}", Float) = 1 + _SpecularTint ("'Specular Tint' {Min:0, Max:1}", Float) = 0 + _Roughness ("'Roughness' {Min:0, Max:1}", Float) = 1 + _Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _BumpScale ("'Normal Strength' {}", Float) = 1 + + // Parallax + [Toggle(_PARALLAXMAP)] + _ParallaxT ("'Parallax' {Feature:{Color:5}}", Float) = 0 + [Toggle(_BUMPMODE_POM)] + _BumpMode ("'Mode' {Dropdown:{Parallax:{_MinSamples, _MaxSamples}, POM:{}}}", Float) = 0 + _ParallaxMap ("'Heightmap(G)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "black" {} + _Parallax ("'Height' {Min:0, Max:0.08}", Float) = 0.02 + _MinSamples ("'Min Samples' {Min:1}", Float) = 4 + _MaxSamples ("'Max Samples' {Min:1}", Float) = 20 + + // AO2 + [Toggle(_AO2_ON)] + _AO2 ("'AO2' {Feature:{Color:6}}", Float) = 0 + _Ao2Map ("'AO2(G)' {Visualize:{RGB}}", 2D) = "white" {} + _Ao2MapUV ("UV Set", Float) = 1 + _Ao2Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + + // Detail + [Toggle(_DETAIL_MULX2)] + _DetailT ("'Detail' {Feature:{Color:7}}", Float) = 0 + [Toggle(_NORMALMAP)] + _DetailMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_DetailMask}}}", Float) = 0 + _DetailMask ("'Mask(A)' {Visualize:{A}, Parent:_MainTex}", 2D) = "white" {} + _DetailMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + [Enum(Mul, 0, MulX2, 1)] + _DetailMode ("'Color Mode' {Dropdown:{Mul:{}, MulX2:{}}}", Float) = 0 + _DetailAlbedoMap ("'Color(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _DetailAlbedoMapVelocity ("Scroll", Vector) = (0,0,0,0) + _DetailAlbedoMapUV ("UV Set", Float) = 0 + _DetailNormalMap ("'Normals' {Visualize:{NRM}, Parent:_DetailAlbedoMap}", 2D) = "bump" {} + _DetailWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DetailNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Team Color + [Toggle(_TEAMCOLOR_ON)] + _TeamColor ("'Team Color' {Feature:{Color:8}}", Float) = 0 + [Enum(Masks, 0, Tint, 1)] + _TeamColorMasksAsTint ("'Texture Mode' {Dropdown:{Masks:{}, Tint:{_TeamColorMasks, _TeamColor0, _TeamColor1, _TeamColor2, _TeamColor3}}}", Float) = 0 + _TeamColorMaskMap ("'Masks(RGBA)' {Visualize:{R, G, B, A, RGB}, Parent:_MainTex}", 2D) = "black" {} + _TeamColorMasks ("'Channels' {Vector:Channels}", Vector) = (1,1,1,0) + _TeamColor0 ("'Tint R' {}", Color) = (1,0,0) + _TeamColor1 ("'Tint G' {}", Color) = (0,1,0) + _TeamColor2 ("'Tint B' {}", Color) = (0,0,1) + _TeamColor3 ("'Tint A' {}", Color) = (0.5,0.5,0.5) + + // Decal + [Toggle(_DECAL_ON)] + _Decal ("'Decal' {Feature:{Color:9}}", Float) = 0 + _DecalColor ("'Tint' {}", Color) = (1,1,1,1) + _DecalTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "black" {} + _DecalTexUV ("UV Set", Float) = 0 + _DecalWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DecalSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _DecalAlphaVertexTint ("'Vertex Alpha Tint' {Min:0, Max:1}", Float) = 0 + + // Emission + [Toggle(_EMISSION)] + _Emission ("'Emission' {Feature:{Color:10}}", Float) = 0 + [LM_Emission] + [HDR] + _EmissionColor ("'Tint' {}", Color) = (1,1,1) + [LM_Emission] + _EmissionMap ("'Mask(RGB)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "white" {} + _IncandescenceMap ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _IncandescenceMapVelocity ("Scroll", Vector) = (0,0,0,0) + _IncandescenceMapUV ("UV Set", Float) = 0 + [Gamma] + _EmissionWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + + // Rim Emission + [Toggle(_RIM_ON)] + _Rim ("'Rim Emission' {Feature:{Color:11}}", Float) = 0 + [HDR] + _RimColor ("'Tint' {}", Color) = (1,1,1) + _RimTex ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _RimTexVelocity ("Scroll", Vector) = (0,0,0,0) + _RimTexUV ("UV Set", Float) = 0 + [Gamma] + _RimWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + [Gamma] + _RimBias ("'Fill' {Min:0, Max:1}", Float) = 0 + _RimPower ("'Falloff' {Min:0.01}", Float) = 4 + + // Dissolve + [Toggle(_DISSOLVE_ON)] + _Dissolve ("'Dissolve' {Feature:{Color:12}}", Float) = 0 + [HDR] + _DissolveGlowColor ("'Glow Tint' {}", Color) = (1,1,1,1) + _DissolveTex ("'Glow Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _DissolveTexUV ("UV Set", Float) = 0 + _DissolveCutoff ("'Cutoff' {Min:0, Max:1}", Float) = 0 + [Gamma] + _DissolveGlowWeight ("'Glow Weight' {Min:0, Max:1}", Float) = 1 + _DissolveEdgeWidth ("'Glow Width' {Min:0, Max:1}", Float) = 0.01 + + // Wetness + [Toggle(_WETNESS_ON)] + _WetnessProperties ("'Wetness' {Feature:{Color:13}}", Float) = 0 + [Toggle(_WETMASKSOURCE_VERTEXCOLORALPHA)] + _WetMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_WetMask}}}", Float) = 0 + _WetMask ("'Mask(A)' {Visualize:{A}}", 2D) = "white" {} + _WetMaskVelocity ("Scroll", Vector) = (0,0,0,0) + _WetMaskUV ("UV Set", Float) = 0 + _WetMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + _WetTint ("'Tint' {}", Color) = (1,1,1,1) + _WetNormalMap ("'Normals' {Visualize:{NRM}}", 2D) = "bump" {} + _WetNormalMapVelocity ("Scroll", Vector) = (0,0,0,0) + _WetNormalMapUV ("UV Set", Float) = 0 + _WetWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _WetRoughness ("'Roughness' {Min:0, Max:1}", Float) = 0.2 + _WetNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Directional Blend + _DirectionalBlendProperties ("'Directional Blend' {Section:{Color:14}}", Float) = 0 + [Toggle(_DIRECTIONALBLENDMODE_WORLD)] + _DirectionalBlendMode ("'Mode' {Dropdown:{Object:{}, World:{}}}", Float) = 1 + _DirectionalBlendDirection ("'Direction' {Vector:Euler}", Vector) = (0,1,0,0) + _DirectionalBlendDirectionEulerUI ("'Rotation' {Vector:3}", Vector) = (0,0,0,0) + _OrientedScale ("'Weight' {Min:0, Max:1}", Float) = 1.0 + _OrientedCutoff ("'Cutoff' {Min:0, Max:1}", Float) = 0.25 + _OrientedBlend ("'Blend' {Min:0.0001, Max:1}", Float) = 0.1 + _DirectionalBlendAlphaVertexTint ("'Vertex Alpha Tint' {Min:0, Max:1}", Float) = 0 + + // Secondary Textures + _SecondaryTextures ("'Secondary Textures' {Section:{Color:15}}", Float) = 0 + _Color2 ("'Tint' {}", Color) = (1,1,1,1) + _MainTex2 ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _MainTex2Velocity ("Scroll", Vector) = (0,0,0,0) + _MainTex2UV ("UV Set", Float) = 0 + _MaterialMap2 ("'Metal(R) AO(G) Spec(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_MainTex2}", 2D) = "white" {} + _BumpMap2 ("'Normals' {Visualize:{NRM}, Parent:_MainTex2}", 2D) = "bump" {} + _BaseColorVertexTint2 ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Secondary Properties + _SecondaryPhysicalProperties ("'Secondary Properties' {Section:{Color:16}}", Float) = 0 + _Metallic2 ("'Metallic' {Min:0, Max:1}", Float) = 1 + _Specularity2 ("'Specularity' {Min:0, Max:1}", Float) = 1 + _SpecularTint2 ("'Specular Tint' {Min:0, Max:1}", Float) = 0 + _Roughness2 ("'Roughness' {Min:0, Max:1}", Float) = 1 + _Occlusion2 ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _BumpScale2 ("'Normal Strength' {}", Float) = 1 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _Lightmapping ("'GI' {LightmapEmissionProperty:{}}", Float) = 1 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} + +SubShader { + Tags { + "RenderType" = "Opaque" + "PerformanceChecks" = "False" + //"DisableBatching" = "LODFading" + } + LOD 300 + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + Blend [_SrcBlend] [_DstBlend] + ZWrite [_ZWrite] + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _DIRECTIONALBLENDMODE_WORLD + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Shaders/Definition/DirectionalBlend.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend [_SrcBlend] One + ZWrite Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _DIRECTIONALBLENDMODE_WORLD + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + + #include "Assets/Alloy/Shaders/Definition/DirectionalBlend.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _DISSOLVE_ON + + #pragma multi_compile_shadowcaster + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_SHADOWCASTER + + #include "Assets/Alloy/Shaders/Definition/DirectionalBlend.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } + + Pass { + Name "DEFERRED" + Tags { "LightMode" = "Deferred" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _DIRECTIONALBLENDMODE_WORLD + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_prepassfinal + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_DEFERRED + + #include "Assets/Alloy/Shaders/Definition/DirectionalBlend.cginc" + #include "Assets/Alloy/Shaders/Forward/Gbuffer.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _DIRECTIONALBLENDMODE_WORLD + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Shaders/Definition/DirectionalBlend.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +FallBack "VertexLit" +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Shaders/3.0/Specialist/Directional Blend.shader.meta b/Assets/Alloy/Shaders/3.0/Specialist/Directional Blend.shader.meta new file mode 100644 index 0000000..4fed765 --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Specialist/Directional Blend.shader.meta @@ -0,0 +1,28 @@ +fileFormatVersion: 2 +guid: 2c999d9dc16fef6439bf62c73d3329ed +timeCreated: 1430053204 +licenseType: Pro +ShaderImporter: + defaultTextures: + - _MainTex: {instanceID: 0} + - _SpecTex: {instanceID: 0} + - _BumpMap: {instanceID: 0} + - _ParallaxMap: {instanceID: 0} + - _Ao2Map: {instanceID: 0} + - _DetailMask: {instanceID: 0} + - _DetailAlbedoMap: {instanceID: 0} + - _DetailMaterialMap: {fileID: 2800000, guid: 2b77d5cb601375f4ba50c6194c126e59, + type: 3} + - _DetailNormalMap: {instanceID: 0} + - _TeamColorMaskMap: {instanceID: 0} + - _DecalTex: {instanceID: 0} + - _EmissionMap: {instanceID: 0} + - _IncandescenceMap: {instanceID: 0} + - _RimTex: {instanceID: 0} + - _DissolveTex: {instanceID: 0} + - _OrientedMainTex: {instanceID: 0} + - _OrientedMaterialMap: {instanceID: 0} + - _OrientedBumpMap: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/3.0/Specialist/Glass HighQuality.shader b/Assets/Alloy/Shaders/3.0/Specialist/Glass HighQuality.shader new file mode 100644 index 0000000..6227190 --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Specialist/Glass HighQuality.shader @@ -0,0 +1,360 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Glass/HighQuality" { +Properties { + [Toggle(EFFECT_BUMP)] + _HasBumpMap ("'Normals Source' {Dropdown:{VertexNormals:{_BumpMap,_BumpScale,_DetailNormalMap,_DetailNormalMapScale,_WetNormalMap,_WetNormalMapScale}, NormalMaps:{}}}", Float) = 1 + [Toggle(_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A)] + _MainRoughnessSource ("'Roughness Source' {Dropdown:{PackedMapAlpha:{}, BaseColorAlpha:{_SpecTex,_Occlusion}}}", Float) = 0 + + // Main Textures + _MainTextures ("'Main Textures' {Section:{Color:0}}", Float) = 0 + [LM_Albedo] [LM_Transparency] + _Color ("'Tint' {}", Color) = (1,1,1,1) + [LM_MasterTilingOffset] [LM_Albedo] + _MainTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _MainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _MainTexUV ("UV Set", Float) = 0 + [LM_Metallic] + _SpecTex ("'Metal(R) AO(G) Spec(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_MainTex}", 2D) = "white" {} + [LM_NormalMap] + _BumpMap ("'Normals' {Visualize:{NRM}, Parent:_MainTex}", 2D) = "bump" {} + _BaseColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Main Properties + _MainPhysicalProperties ("'Main Properties' {Section:{Color:1}}", Float) = 0 + [LM_Metallic] + _Metal ("'Metallic' {Min:0, Max:1}", Float) = 1 + _Specularity ("'Specularity' {Min:0, Max:1}", Float) = 1 + _SpecularTint ("'Specular Tint' {Min:0, Max:1}", Float) = 0 + _Roughness ("'Roughness' {Min:0, Max:1}", Float) = 1 + _Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _BumpScale ("'Normal Strength' {}", Float) = 1 + + // Distortion Properties + _DistortionProperties ("'Distortion' {Section:{Color:2}}", Float) = 0 + _DistortWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DistortIntensity ("'Intensity' {Min:0, Max:128}", Float) = 10 + _DistortGeoWeight ("'Geometry Influence' {Min:0, Max:1}", Float) = 1 + + // Parallax + [Toggle(_PARALLAXMAP)] + _ParallaxT ("'Parallax' {Feature:{Color:5}}", Float) = 0 + [Toggle(_BUMPMODE_POM)] + _BumpMode ("'Mode' {Dropdown:{Parallax:{_MinSamples, _MaxSamples}, POM:{}}}", Float) = 0 + _ParallaxMap ("'Heightmap(G)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "black" {} + _Parallax ("'Height' {Min:0, Max:0.08}", Float) = 0.02 + _MinSamples ("'Min Samples' {Min:1}", Float) = 4 + _MaxSamples ("'Max Samples' {Min:1}", Float) = 20 + + // AO2 + [Toggle(_AO2_ON)] + _AO2 ("'AO2' {Feature:{Color:6}}", Float) = 0 + _Ao2Map ("'AO2(G)' {Visualize:{RGB}}", 2D) = "white" {} + _Ao2MapUV ("UV Set", Float) = 1 + _Ao2Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + + // Detail + [Toggle(_DETAIL_MULX2)] + _DetailT ("'Detail' {Feature:{Color:7}}", Float) = 0 + [Toggle(_NORMALMAP)] + _DetailMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_DetailMask}}}", Float) = 0 + _DetailMask ("'Mask(A)' {Visualize:{A}, Parent:_MainTex}", 2D) = "white" {} + _DetailMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + [Enum(Mul, 0, MulX2, 1)] + _DetailMode ("'Color Mode' {Dropdown:{Mul:{}, MulX2:{}}}", Float) = 0 + _DetailAlbedoMap ("'Color(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _DetailAlbedoMapVelocity ("Scroll", Vector) = (0,0,0,0) + _DetailAlbedoMapUV ("UV Set", Float) = 0 + _DetailNormalMap ("'Normals' {Visualize:{NRM}, Parent:_DetailAlbedoMap}", 2D) = "bump" {} + _DetailWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DetailNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Team Color + [Toggle(_TEAMCOLOR_ON)] + _TeamColor ("'Team Color' {Feature:{Color:8}}", Float) = 0 + [Enum(Masks, 0, Tint, 1)] + _TeamColorMasksAsTint ("'Texture Mode' {Dropdown:{Masks:{}, Tint:{_TeamColorMasks, _TeamColor0, _TeamColor1, _TeamColor2, _TeamColor3}}}", Float) = 0 + _TeamColorMaskMap ("'Masks(RGBA)' {Visualize:{R, G, B, A, RGB}, Parent:_MainTex}", 2D) = "black" {} + _TeamColorMasks ("'Channels' {Vector:Channels}", Vector) = (1,1,1,0) + _TeamColor0 ("'Tint R' {}", Color) = (1,0,0) + _TeamColor1 ("'Tint G' {}", Color) = (0,1,0) + _TeamColor2 ("'Tint B' {}", Color) = (0,0,1) + _TeamColor3 ("'Tint A' {}", Color) = (0.5,0.5,0.5) + + // Decal + [Toggle(_DECAL_ON)] + _Decal ("'Decal' {Feature:{Color:9}}", Float) = 0 + _DecalColor ("'Tint' {}", Color) = (1,1,1,1) + _DecalTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "black" {} + _DecalTexUV ("UV Set", Float) = 0 + _DecalWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DecalSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _DecalAlphaVertexTint ("'Vertex Alpha Tint' {Min:0, Max:1}", Float) = 0 + + // Emission + [Toggle(_EMISSION)] + _Emission ("'Emission' {Feature:{Color:10}}", Float) = 0 + [LM_Emission] + [HDR] + _EmissionColor ("'Tint' {}", Color) = (1,1,1) + [LM_Emission] + _EmissionMap ("'Mask(RGB)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "white" {} + _IncandescenceMap ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _IncandescenceMapVelocity ("Scroll", Vector) = (0,0,0,0) + _IncandescenceMapUV ("UV Set", Float) = 0 + [Gamma] + _EmissionWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + + // Rim Emission + [Toggle(_RIM_ON)] + _Rim ("'Rim Emission' {Feature:{Color:11}}", Float) = 0 + [HDR] + _RimColor ("'Tint' {}", Color) = (1,1,1) + _RimTex ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _RimTexVelocity ("Scroll", Vector) = (0,0,0,0) + _RimTexUV ("UV Set", Float) = 0 + [Gamma] + _RimWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + [Gamma] + _RimBias ("'Fill' {Min:0, Max:1}", Float) = 0 + _RimPower ("'Falloff' {Min:0.01}", Float) = 4 + + // Dissolve + [Toggle(_DISSOLVE_ON)] + _Dissolve ("'Dissolve' {Feature:{Color:12}}", Float) = 0 + [HDR] + _DissolveGlowColor ("'Glow Tint' {}", Color) = (1,1,1,1) + _DissolveTex ("'Glow Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _DissolveTexUV ("UV Set", Float) = 0 + _DissolveCutoff ("'Cutoff' {Min:0, Max:1}", Float) = 0 + [Gamma] + _DissolveGlowWeight ("'Glow Weight' {Min:0, Max:1}", Float) = 1 + _DissolveEdgeWidth ("'Glow Width' {Min:0, Max:1}", Float) = 0.01 + + // Wetness + [Toggle(_WETNESS_ON)] + _WetnessProperties ("'Wetness' {Feature:{Color:13}}", Float) = 0 + [Toggle(_WETMASKSOURCE_VERTEXCOLORALPHA)] + _WetMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_WetMask}}}", Float) = 0 + _WetMask ("'Mask(A)' {Visualize:{A}}", 2D) = "white" {} + _WetMaskVelocity ("Scroll", Vector) = (0,0,0,0) + _WetMaskUV ("UV Set", Float) = 0 + _WetMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + _WetTint ("'Tint' {}", Color) = (1,1,1,1) + _WetNormalMap ("'Normals' {Visualize:{NRM}}", 2D) = "bump" {} + _WetNormalMapVelocity ("Scroll", Vector) = (0,0,0,0) + _WetNormalMapUV ("UV Set", Float) = 0 + _WetWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _WetRoughness ("'Roughness' {Min:0, Max:1}", Float) = 0.2 + _WetNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _Lightmapping ("'GI' {LightmapEmissionProperty:{}}", Float) = 1 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} + +CGINCLUDE + #define _ALPHAPREMULTIPLY_ON +ENDCG + +SubShader { + // We must be transparent, so other objects are drawn before this one. + Tags { + "Queue" = "Transparent" + "IgnoreProjector" = "True" + "RenderType" = "Opaque" + //"DisableBatching" = "LODFading" + } + LOD 500 + + GrabPass { } + + Pass { + Name "DISTORT" + Tags { "LightMode" = "Always" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define A_PASS_DISTORT + + #include "Assets/Alloy/Shaders/Definition/Core.cginc" + #include "Assets/Alloy/Shaders/Forward/Distort.cginc" + ENDCG + } + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + Blend One OneMinusSrcAlpha + ZWrite Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Shaders/Definition/Core.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend One One + ZWrite Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + + #include "Assets/Alloy/Shaders/Definition/Core.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _DISSOLVE_ON + + #pragma multi_compile_shadowcaster + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_SHADOWCASTER + + #include "Assets/Alloy/Shaders/Definition/Core.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Shaders/Definition/Core.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +FallBack "VertexLit" +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Shaders/3.0/Specialist/Glass HighQuality.shader.meta b/Assets/Alloy/Shaders/3.0/Specialist/Glass HighQuality.shader.meta new file mode 100644 index 0000000..dccbc35 --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Specialist/Glass HighQuality.shader.meta @@ -0,0 +1,21 @@ +fileFormatVersion: 2 +guid: ce7db1584d54c3447b3f409ec5d4aff0 +ShaderImporter: + defaultTextures: + - _MainTex: {instanceID: 0} + - _SpecTex: {instanceID: 0} + - _BumpMap: {instanceID: 0} + - _ParallaxMap: {instanceID: 0} + - _DetailMask: {instanceID: 0} + - _DetailAlbedoMap: {instanceID: 0} + - _DetailMaterialMap: {fileID: 2800000, guid: 2b77d5cb601375f4ba50c6194c126e59, + type: 3} + - _DetailNormalMap: {instanceID: 0} + - _TeamColorMaskMap: {instanceID: 0} + - _DecalTex: {instanceID: 0} + - _EmissionMap: {instanceID: 0} + - _IncandescenceMap: {instanceID: 0} + - _RimTex: {instanceID: 0} + - _DissolveTex: {instanceID: 0} + userData: + assetBundleName: diff --git a/Assets/Alloy/Shaders/3.0/Specialist/Glass LowQuality.shader b/Assets/Alloy/Shaders/3.0/Specialist/Glass LowQuality.shader new file mode 100644 index 0000000..2263709 --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Specialist/Glass LowQuality.shader @@ -0,0 +1,362 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Glass/LowQuality" { +Properties { + [Toggle(EFFECT_BUMP)] + _HasBumpMap ("'Normals Source' {Dropdown:{VertexNormals:{_BumpMap,_BumpScale,_DetailNormalMap,_DetailNormalMapScale,_WetNormalMap,_WetNormalMapScale}, NormalMaps:{}}}", Float) = 1 + [Toggle(_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A)] + _MainRoughnessSource ("'Roughness Source' {Dropdown:{PackedMapAlpha:{}, BaseColorAlpha:{_SpecTex,_Occlusion}}}", Float) = 0 + + // Main Textures + _MainTextures ("'Main Textures' {Section:{Color:0}}", Float) = 0 + [LM_Albedo] [LM_Transparency] + _Color ("'Tint' {}", Color) = (1,1,1,1) + [LM_MasterTilingOffset] [LM_Albedo] + _MainTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _MainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _MainTexUV ("UV Set", Float) = 0 + [LM_Metallic] + _SpecTex ("'Metal(R) AO(G) Spec(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_MainTex}", 2D) = "white" {} + [LM_NormalMap] + _BumpMap ("'Normals' {Visualize:{NRM}, Parent:_MainTex}", 2D) = "bump" {} + _BaseColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Main Properties + _MainPhysicalProperties ("'Main Properties' {Section:{Color:1}}", Float) = 0 + [LM_Metallic] + _Metal ("'Metallic' {Min:0, Max:1}", Float) = 1 + _Specularity ("'Specularity' {Min:0, Max:1}", Float) = 1 + _SpecularTint ("'Specular Tint' {Min:0, Max:1}", Float) = 0 + _Roughness ("'Roughness' {Min:0, Max:1}", Float) = 1 + _Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _BumpScale ("'Normal Strength' {}", Float) = 1 + + // Distortion Properties + _DistortionProperties ("'Distortion' {Section:{Color:2}}", Float) = 0 + _DistortWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DistortIntensity ("'Intensity' {Min:0, Max:128}", Float) = 10 + _DistortGeoWeight ("'Geometry Influence' {Min:0, Max:1}", Float) = 1 + + // Parallax + [Toggle(_PARALLAXMAP)] + _ParallaxT ("'Parallax' {Feature:{Color:5}}", Float) = 0 + [Toggle(_BUMPMODE_POM)] + _BumpMode ("'Mode' {Dropdown:{Parallax:{_MinSamples, _MaxSamples}, POM:{}}}", Float) = 0 + _ParallaxMap ("'Heightmap(G)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "black" {} + _Parallax ("'Height' {Min:0, Max:0.08}", Float) = 0.02 + _MinSamples ("'Min Samples' {Min:1}", Float) = 4 + _MaxSamples ("'Max Samples' {Min:1}", Float) = 20 + + // AO2 + [Toggle(_AO2_ON)] + _AO2 ("'AO2' {Feature:{Color:6}}", Float) = 0 + _Ao2Map ("'AO2(G)' {Visualize:{RGB}}", 2D) = "white" {} + _Ao2MapUV ("UV Set", Float) = 1 + _Ao2Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + + // Detail + [Toggle(_DETAIL_MULX2)] + _DetailT ("'Detail' {Feature:{Color:7}}", Float) = 0 + [Toggle(_NORMALMAP)] + _DetailMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_DetailMask}}}", Float) = 0 + _DetailMask ("'Mask(A)' {Visualize:{A}, Parent:_MainTex}", 2D) = "white" {} + _DetailMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + [Enum(Mul, 0, MulX2, 1)] + _DetailMode ("'Color Mode' {Dropdown:{Mul:{}, MulX2:{}}}", Float) = 0 + _DetailAlbedoMap ("'Color(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _DetailAlbedoMapVelocity ("Scroll", Vector) = (0,0,0,0) + _DetailAlbedoMapUV ("UV Set", Float) = 0 + _DetailNormalMap ("'Normals' {Visualize:{NRM}, Parent:_DetailAlbedoMap}", 2D) = "bump" {} + _DetailWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DetailNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Team Color + [Toggle(_TEAMCOLOR_ON)] + _TeamColor ("'Team Color' {Feature:{Color:8}}", Float) = 0 + [Enum(Masks, 0, Tint, 1)] + _TeamColorMasksAsTint ("'Texture Mode' {Dropdown:{Masks:{}, Tint:{_TeamColorMasks, _TeamColor0, _TeamColor1, _TeamColor2, _TeamColor3}}}", Float) = 0 + _TeamColorMaskMap ("'Masks(RGBA)' {Visualize:{R, G, B, A, RGB}, Parent:_MainTex}", 2D) = "black" {} + _TeamColorMasks ("'Channels' {Vector:Channels}", Vector) = (1,1,1,0) + _TeamColor0 ("'Tint R' {}", Color) = (1,0,0) + _TeamColor1 ("'Tint G' {}", Color) = (0,1,0) + _TeamColor2 ("'Tint B' {}", Color) = (0,0,1) + _TeamColor3 ("'Tint A' {}", Color) = (0.5,0.5,0.5) + + // Decal + [Toggle(_DECAL_ON)] + _Decal ("'Decal' {Feature:{Color:9}}", Float) = 0 + _DecalColor ("'Tint' {}", Color) = (1,1,1,1) + _DecalTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "black" {} + _DecalTexUV ("UV Set", Float) = 0 + _DecalWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DecalSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _DecalAlphaVertexTint ("'Vertex Alpha Tint' {Min:0, Max:1}", Float) = 0 + + // Emission + [Toggle(_EMISSION)] + _Emission ("'Emission' {Feature:{Color:10}}", Float) = 0 + [LM_Emission] + [HDR] + _EmissionColor ("'Tint' {}", Color) = (1,1,1) + [LM_Emission] + _EmissionMap ("'Mask(RGB)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "white" {} + _IncandescenceMap ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _IncandescenceMapVelocity ("Scroll", Vector) = (0,0,0,0) + _IncandescenceMapUV ("UV Set", Float) = 0 + [Gamma] + _EmissionWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + + // Rim Emission + [Toggle(_RIM_ON)] + _Rim ("'Rim Emission' {Feature:{Color:11}}", Float) = 0 + [HDR] + _RimColor ("'Tint' {}", Color) = (1,1,1) + _RimTex ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _RimTexVelocity ("Scroll", Vector) = (0,0,0,0) + _RimTexUV ("UV Set", Float) = 0 + [Gamma] + _RimWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + [Gamma] + _RimBias ("'Fill' {Min:0, Max:1}", Float) = 0 + _RimPower ("'Falloff' {Min:0.01}", Float) = 4 + + // Dissolve + [Toggle(_DISSOLVE_ON)] + _Dissolve ("'Dissolve' {Feature:{Color:12}}", Float) = 0 + [HDR] + _DissolveGlowColor ("'Glow Tint' {}", Color) = (1,1,1,1) + _DissolveTex ("'Glow Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _DissolveTexUV ("UV Set", Float) = 0 + _DissolveCutoff ("'Cutoff' {Min:0, Max:1}", Float) = 0 + [Gamma] + _DissolveGlowWeight ("'Glow Weight' {Min:0, Max:1}", Float) = 1 + _DissolveEdgeWidth ("'Glow Width' {Min:0, Max:1}", Float) = 0.01 + + // Wetness + [Toggle(_WETNESS_ON)] + _WetnessProperties ("'Wetness' {Feature:{Color:13}}", Float) = 0 + [Toggle(_WETMASKSOURCE_VERTEXCOLORALPHA)] + _WetMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_WetMask}}}", Float) = 0 + _WetMask ("'Mask(A)' {Visualize:{A}}", 2D) = "white" {} + _WetMaskVelocity ("Scroll", Vector) = (0,0,0,0) + _WetMaskUV ("UV Set", Float) = 0 + _WetMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + _WetTint ("'Tint' {}", Color) = (1,1,1,1) + _WetNormalMap ("'Normals' {Visualize:{NRM}}", 2D) = "bump" {} + _WetNormalMapVelocity ("Scroll", Vector) = (0,0,0,0) + _WetNormalMapUV ("UV Set", Float) = 0 + _WetWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _WetRoughness ("'Roughness' {Min:0, Max:1}", Float) = 0.2 + _WetNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _Lightmapping ("'GI' {LightmapEmissionProperty:{}}", Float) = 1 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} + +CGINCLUDE + #define _ALPHAPREMULTIPLY_ON + + #define A_DISTORT_TEXTURE _AlloyGlassGrabTexture +ENDCG + +SubShader { + // We must be transparent, so other objects are drawn before this one. + Tags { + "Queue" = "Transparent" + "IgnoreProjector" = "True" + "RenderType" = "Opaque" + //"DisableBatching" = "LODFading" + } + LOD 500 + + GrabPass { "_AlloyGlassGrabTexture" } + + Pass { + Name "DISTORT" + Tags { "LightMode" = "Always" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define A_PASS_DISTORT + + #include "Assets/Alloy/Shaders/Definition/Core.cginc" + #include "Assets/Alloy/Shaders/Forward/Distort.cginc" + ENDCG + } + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + Blend One OneMinusSrcAlpha + ZWrite Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Shaders/Definition/Core.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend One One + ZWrite Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + + #include "Assets/Alloy/Shaders/Definition/Core.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _DISSOLVE_ON + + #pragma multi_compile_shadowcaster + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_SHADOWCASTER + + #include "Assets/Alloy/Shaders/Definition/Core.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Shaders/Definition/Core.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +FallBack "VertexLit" +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Shaders/3.0/Specialist/Glass LowQuality.shader.meta b/Assets/Alloy/Shaders/3.0/Specialist/Glass LowQuality.shader.meta new file mode 100644 index 0000000..2c3e2a2 --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Specialist/Glass LowQuality.shader.meta @@ -0,0 +1,22 @@ +fileFormatVersion: 2 +guid: 0a472145c854eb34e8256501c092943e +ShaderImporter: + defaultTextures: + - _MainTex: {instanceID: 0} + - _SpecTex: {instanceID: 0} + - _BumpMap: {instanceID: 0} + - _ParallaxMap: {instanceID: 0} + - _Ao2Map: {instanceID: 0} + - _DetailMask: {instanceID: 0} + - _DetailAlbedoMap: {instanceID: 0} + - _DetailMaterialMap: {fileID: 2800000, guid: 2b77d5cb601375f4ba50c6194c126e59, + type: 3} + - _DetailNormalMap: {instanceID: 0} + - _TeamColorMaskMap: {instanceID: 0} + - _DecalTex: {instanceID: 0} + - _EmissionMap: {instanceID: 0} + - _IncandescenceMap: {instanceID: 0} + - _RimTex: {instanceID: 0} + - _DissolveTex: {instanceID: 0} + userData: + assetBundleName: diff --git a/Assets/Alloy/Shaders/3.0/Specialist/Oriented Blend.shader b/Assets/Alloy/Shaders/3.0/Specialist/Oriented Blend.shader new file mode 100644 index 0000000..a5e4e84 --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Specialist/Oriented Blend.shader @@ -0,0 +1,390 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Oriented/Blend" { +Properties { + // Global Settings + _Mode ("'Rendering Mode' {RenderingMode:{Opaque:{_Cutoff}, Cutout:{}, Fade:{_Cutoff}, Transparent:{_Cutoff}}}", Float) = 0 + _SrcBlend ("__src", Float) = 0 + _DstBlend ("__dst", Float) = 0 + _ZWrite ("__zw", Float) = 1 + [LM_TransparencyCutOff] + _Cutoff ("'Opacity Cutoff' {Min:0, Max:1}", Float) = 0.5 + [Toggle(EFFECT_BUMP)] + _HasBumpMap ("'Normals Source' {Dropdown:{VertexNormals:{_BumpMap,_BumpScale,_DetailNormalMap,_DetailNormalMapScale,_WetNormalMap,_WetNormalMapScale,_OrientedBumpMap,_OrientedNormalMapScale}, NormalMaps:{}}}", Float) = 1 + [Toggle(_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A)] + _MainRoughnessSource ("'Roughness Source' {Dropdown:{PackedMapAlpha:{}, BaseColorAlpha:{_SpecTex,_Occlusion,_OrientedMaterialMap,_OrientedOcclusion}}}", Float) = 0 + + // Main Textures + _MainTextures ("'Main Textures' {Section:{Color:0}}", Float) = 0 + [LM_Albedo] [LM_Transparency] + _Color ("'Tint' {}", Color) = (1,1,1,1) + [LM_MasterTilingOffset] [LM_Albedo] + _MainTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _MainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _MainTexUV ("UV Set", Float) = 0 + [LM_Metallic] + _SpecTex ("'Metal(R) AO(G) Spec(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_MainTex}", 2D) = "white" {} + [LM_NormalMap] + _BumpMap ("'Normals' {Visualize:{NRM}, Parent:_MainTex}", 2D) = "bump" {} + _BaseColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Main Properties + _MainPhysicalProperties ("'Main Properties' {Section:{Color:1}}", Float) = 0 + [LM_Metallic] + _Metal ("'Metallic' {Min:0, Max:1}", Float) = 1 + _Specularity ("'Specularity' {Min:0, Max:1}", Float) = 1 + _SpecularTint ("'Specular Tint' {Min:0, Max:1}", Float) = 0 + _Roughness ("'Roughness' {Min:0, Max:1}", Float) = 1 + _Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _BumpScale ("'Normal Strength' {}", Float) = 1 + + // Parallax + [Toggle(_PARALLAXMAP)] + _ParallaxT ("'Parallax' {Feature:{Color:5}}", Float) = 0 + [Toggle(_BUMPMODE_POM)] + _BumpMode ("'Mode' {Dropdown:{Parallax:{_MinSamples, _MaxSamples}, POM:{}}}", Float) = 0 + _ParallaxMap ("'Heightmap(G)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "black" {} + _Parallax ("'Height' {Min:0, Max:0.08}", Float) = 0.02 + _MinSamples ("'Min Samples' {Min:1}", Float) = 4 + _MaxSamples ("'Max Samples' {Min:1}", Float) = 20 + + // AO2 + [Toggle(_AO2_ON)] + _AO2 ("'AO2' {Feature:{Color:6}}", Float) = 0 + _Ao2Map ("'AO2(G)' {Visualize:{RGB}}", 2D) = "white" {} + _Ao2MapUV ("UV Set", Float) = 1 + _Ao2Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + + // Detail + [Toggle(_DETAIL_MULX2)] + _DetailT ("'Detail' {Feature:{Color:7}}", Float) = 0 + [Toggle(_NORMALMAP)] + _DetailMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_DetailMask}}}", Float) = 0 + _DetailMask ("'Mask(A)' {Visualize:{A}, Parent:_MainTex}", 2D) = "white" {} + _DetailMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + [Enum(Mul, 0, MulX2, 1)] + _DetailMode ("'Color Mode' {Dropdown:{Mul:{}, MulX2:{}}}", Float) = 0 + _DetailAlbedoMap ("'Color(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _DetailAlbedoMapVelocity ("Scroll", Vector) = (0,0,0,0) + _DetailAlbedoMapUV ("UV Set", Float) = 0 + _DetailNormalMap ("'Normals' {Visualize:{NRM}, Parent:_DetailAlbedoMap}", 2D) = "bump" {} + _DetailWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DetailNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Team Color + [Toggle(_TEAMCOLOR_ON)] + _TeamColor ("'Team Color' {Feature:{Color:8}}", Float) = 0 + [Enum(Masks, 0, Tint, 1)] + _TeamColorMasksAsTint ("'Texture Mode' {Dropdown:{Masks:{}, Tint:{_TeamColorMasks, _TeamColor0, _TeamColor1, _TeamColor2, _TeamColor3}}}", Float) = 0 + _TeamColorMaskMap ("'Masks(RGBA)' {Visualize:{R, G, B, A, RGB}, Parent:_MainTex}", 2D) = "black" {} + _TeamColorMasks ("'Channels' {Vector:Channels}", Vector) = (1,1,1,0) + _TeamColor0 ("'Tint R' {}", Color) = (1,0,0) + _TeamColor1 ("'Tint G' {}", Color) = (0,1,0) + _TeamColor2 ("'Tint B' {}", Color) = (0,0,1) + _TeamColor3 ("'Tint A' {}", Color) = (0.5,0.5,0.5) + + // Decal + [Toggle(_DECAL_ON)] + _Decal ("'Decal' {Feature:{Color:9}}", Float) = 0 + _DecalColor ("'Tint' {}", Color) = (1,1,1,1) + _DecalTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "black" {} + _DecalTexUV ("UV Set", Float) = 0 + _DecalWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DecalSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _DecalAlphaVertexTint ("'Vertex Alpha Tint' {Min:0, Max:1}", Float) = 0 + + // Emission + [Toggle(_EMISSION)] + _Emission ("'Emission' {Feature:{Color:10}}", Float) = 0 + [LM_Emission] + [HDR] + _EmissionColor ("'Tint' {}", Color) = (1,1,1) + [LM_Emission] + _EmissionMap ("'Mask(RGB)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "white" {} + _IncandescenceMap ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _IncandescenceMapVelocity ("Scroll", Vector) = (0,0,0,0) + _IncandescenceMapUV ("UV Set", Float) = 0 + [Gamma] + _EmissionWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + + // Rim Emission + [Toggle(_RIM_ON)] + _Rim ("'Rim Emission' {Feature:{Color:11}}", Float) = 0 + [HDR] + _RimColor ("'Tint' {}", Color) = (1,1,1) + _RimTex ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _RimTexVelocity ("Scroll", Vector) = (0,0,0,0) + _RimTexUV ("UV Set", Float) = 0 + [Gamma] + _RimWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + [Gamma] + _RimBias ("'Fill' {Min:0, Max:1}", Float) = 0 + _RimPower ("'Falloff' {Min:0.01}", Float) = 4 + + // Dissolve + [Toggle(_DISSOLVE_ON)] + _Dissolve ("'Dissolve' {Feature:{Color:12}}", Float) = 0 + [HDR] + _DissolveGlowColor ("'Glow Tint' {}", Color) = (1,1,1,1) + _DissolveTex ("'Glow Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _DissolveTexUV ("UV Set", Float) = 0 + _DissolveCutoff ("'Cutoff' {Min:0, Max:1}", Float) = 0 + [Gamma] + _DissolveGlowWeight ("'Glow Weight' {Min:0, Max:1}", Float) = 1 + _DissolveEdgeWidth ("'Glow Width' {Min:0, Max:1}", Float) = 0.01 + + // Wetness + [Toggle(_WETNESS_ON)] + _WetnessProperties ("'Wetness' {Feature:{Color:13}}", Float) = 0 + [Toggle(_WETMASKSOURCE_VERTEXCOLORALPHA)] + _WetMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_WetMask}}}", Float) = 0 + _WetMask ("'Mask(A)' {Visualize:{A}}", 2D) = "white" {} + _WetMaskVelocity ("Scroll", Vector) = (0,0,0,0) + _WetMaskUV ("UV Set", Float) = 0 + _WetMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + _WetTint ("'Tint' {}", Color) = (1,1,1,1) + _WetNormalMap ("'Normals' {Visualize:{NRM}}", 2D) = "bump" {} + _WetNormalMapVelocity ("Scroll", Vector) = (0,0,0,0) + _WetNormalMapUV ("UV Set", Float) = 0 + _WetWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _WetRoughness ("'Roughness' {Min:0, Max:1}", Float) = 0.2 + _WetNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Directional Blend + _DirectionalBlendProperties ("'Directional Blend' {Section:{Color:14}}", Float) = 0 + _DirectionalBlendDirection ("'Direction' {Vector:Euler}", Vector) = (0,1,0,0) + _DirectionalBlendDirectionEulerUI ("'Rotation' {Vector:3}", Vector) = (0,0,0,0) + _OrientedScale ("'Weight' {Min:0, Max:1}", Float) = 1.0 + _OrientedCutoff ("'Cutoff' {Min:0, Max:1}", Float) = 0.25 + _OrientedBlend ("'Blend' {Min:0.0001, Max:1}", Float) = 0.1 + _DirectionalBlendAlphaVertexTint ("'Vertex Alpha Tint' {Min:0, Max:1}", Float) = 0 + + // Oriented Textures + _OrientedTextures ("'Oriented Textures' {Section:{Color:15}}", Float) = 0 + _OrientedColor ("'Tint' {}", Color) = (1,1,1,1) + _OrientedMainTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _OrientedMainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _OrientedMaterialMap ("'Metal(R) AO(G) Spec(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_OrientedMainTex}", 2D) = "white" {} + _OrientedBumpMap ("'Normals' {Visualize:{NRM}, Parent:_OrientedMainTex}", 2D) = "bump" {} + _OrientedColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Oriented Properties + _OrientedPhysicalProperties ("'Oriented Properties' {Section:{Color:16}}", Float) = 0 + _OrientedMetallic ("'Metallic' {Min:0, Max:1}", Float) = 1 + _OrientedSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 1 + _OrientedSpecularTint ("'Specular Tint' {Min:0, Max:1}", Float) = 0 + _OrientedRoughness ("'Roughness' {Min:0, Max:1}", Float) = 1 + _OrientedOcclusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _OrientedNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _Lightmapping ("'GI' {LightmapEmissionProperty:{}}", Float) = 1 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} + +SubShader { + Tags { + "RenderType" = "Opaque" + "PerformanceChecks" = "False" + //"DisableBatching" = "LODFading" + } + LOD 300 + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + Blend [_SrcBlend] [_DstBlend] + ZWrite [_ZWrite] + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Shaders/Definition/OrientedBlend.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend [_SrcBlend] One + ZWrite Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + + #include "Assets/Alloy/Shaders/Definition/OrientedBlend.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _DISSOLVE_ON + + #pragma multi_compile_shadowcaster + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_SHADOWCASTER + + #include "Assets/Alloy/Shaders/Definition/OrientedBlend.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } + + Pass { + Name "DEFERRED" + Tags { "LightMode" = "Deferred" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_prepassfinal + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_DEFERRED + + #include "Assets/Alloy/Shaders/Definition/OrientedBlend.cginc" + #include "Assets/Alloy/Shaders/Forward/Gbuffer.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Shaders/Definition/OrientedBlend.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +FallBack "VertexLit" +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Shaders/3.0/Specialist/Oriented Blend.shader.meta b/Assets/Alloy/Shaders/3.0/Specialist/Oriented Blend.shader.meta new file mode 100644 index 0000000..47d3bda --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Specialist/Oriented Blend.shader.meta @@ -0,0 +1,30 @@ +fileFormatVersion: 2 +guid: 4caca71c514d0d545ae5889fcd6720ee +timeCreated: 1422805925 +licenseType: Pro +ShaderImporter: + defaultTextures: + - _MainTex: {instanceID: 0} + - _SpecTex: {instanceID: 0} + - _BumpMap: {instanceID: 0} + - _ParallaxMap: {instanceID: 0} + - _DetailMask: {instanceID: 0} + - _DetailAlbedoMap: {instanceID: 0} + - _DetailMaterialMap: {fileID: 2800000, guid: 2b77d5cb601375f4ba50c6194c126e59, + type: 3} + - _DetailNormalMap: {instanceID: 0} + - _TeamColorMaskMap: {instanceID: 0} + - _EmissionMap: {instanceID: 0} + - _IncandescenceMap: {instanceID: 0} + - _RimTex: {instanceID: 0} + - _DissolveTex: {instanceID: 0} + - _BlendMap: {instanceID: 0} + - _MainTex2: {instanceID: 0} + - _MaterialMap2: {instanceID: 0} + - _BumpMap2: {instanceID: 0} + - _EmissionMap2: {instanceID: 0} + - _IncandescenceMap2: {instanceID: 0} + - _RimTex2: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/3.0/Specialist/Oriented Core.shader b/Assets/Alloy/Shaders/3.0/Specialist/Oriented Core.shader new file mode 100644 index 0000000..5a71209 --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Specialist/Oriented Core.shader @@ -0,0 +1,204 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Oriented/Core" { +Properties { + // Global Settings + _Mode ("'Rendering Mode' {RenderingMode:{Opaque:{_Cutoff}, Cutout:{}, Fade:{_Cutoff}, Transparent:{_Cutoff}}}", Float) = 0 + _SrcBlend ("__src", Float) = 0 + _DstBlend ("__dst", Float) = 0 + _ZWrite ("__zw", Float) = 1 + [LM_TransparencyCutOff] + _Cutoff ("'Opacity Cutoff' {Min:0, Max:1}", Float) = 0.5 + [Toggle(EFFECT_BUMP)] + _HasBumpMap ("'Normals Source' {Dropdown:{VertexNormals:{_OrientedBumpMap,_OrientedNormalMapScale}, NormalMaps:{}}}", Float) = 1 + [Toggle(_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A)] + _MainRoughnessSource ("'Roughness Source' {Dropdown:{PackedMapAlpha:{}, BaseColorAlpha:{_SpecTex,_Occlusion,_OrientedMaterialMap,_OrientedOcclusion}}}", Float) = 0 + + // Oriented Textures + _OrientedTextures ("'Oriented Textures' {Section:{Color:15}}", Float) = 0 + _OrientedColor ("'Tint' {}", Color) = (1,1,1,1) + _OrientedMainTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _OrientedMainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _OrientedMaterialMap ("'Metal(R) AO(G) Spec(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_OrientedMainTex}", 2D) = "white" {} + _OrientedBumpMap ("'Normals' {Visualize:{NRM}, Parent:_OrientedMainTex}", 2D) = "bump" {} + _OrientedColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Oriented Properties + _OrientedPhysicalProperties ("'Oriented Properties' {Section:{Color:16}}", Float) = 0 + _OrientedMetallic ("'Metallic' {Min:0, Max:1}", Float) = 1 + _OrientedSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 1 + _OrientedSpecularTint ("'Specular Tint' {Min:0, Max:1}", Float) = 0 + _OrientedRoughness ("'Roughness' {Min:0, Max:1}", Float) = 1 + _OrientedOcclusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _OrientedNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} + +SubShader { + Tags { + "RenderType" = "Opaque" + "PerformanceChecks" = "False" + //"DisableBatching" = "LODFading" + } + LOD 300 + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + Blend [_SrcBlend] [_DstBlend] + ZWrite [_ZWrite] + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Shaders/Definition/OrientedCore.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend [_SrcBlend] One + ZWrite Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + + #include "Assets/Alloy/Shaders/Definition/OrientedCore.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + + #pragma multi_compile_shadowcaster + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_SHADOWCASTER + + #include "Assets/Alloy/Shaders/Definition/OrientedCore.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } + + Pass { + Name "DEFERRED" + Tags { "LightMode" = "Deferred" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_prepassfinal + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_DEFERRED + + #include "Assets/Alloy/Shaders/Definition/OrientedCore.cginc" + #include "Assets/Alloy/Shaders/Forward/Gbuffer.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Shaders/Definition/OrientedCore.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +FallBack "VertexLit" +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Shaders/3.0/Specialist/Oriented Core.shader.meta b/Assets/Alloy/Shaders/3.0/Specialist/Oriented Core.shader.meta new file mode 100644 index 0000000..6dd86ab --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Specialist/Oriented Core.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 72c1bfcb574a0ae488e57b7d388ec419 +timeCreated: 1423409017 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/3.0/Specialist/Transmission OneSided Forward.shader b/Assets/Alloy/Shaders/3.0/Specialist/Transmission OneSided Forward.shader new file mode 100644 index 0000000..3686a0f --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Specialist/Transmission OneSided Forward.shader @@ -0,0 +1,339 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Transmission/OneSided (Forward)" { +Properties { + // Global Settings + _Mode ("'Rendering Mode' {RenderingMode:{Opaque:{_Cutoff}, Cutout:{}, Fade:{_Cutoff}, Transparent:{_Cutoff}}}", Float) = 0 + _SrcBlend ("__src", Float) = 0 + _DstBlend ("__dst", Float) = 0 + _ZWrite ("__zw", Float) = 1 + [LM_TransparencyCutOff] + _Cutoff ("'Opacity Cutoff' {Min:0, Max:1}", Float) = 0.5 + [Toggle(EFFECT_BUMP)] + _HasBumpMap ("'Normals Source' {Dropdown:{VertexNormals:{_BumpMap,_BumpScale,_DetailNormalMap,_DetailNormalMapScale,_WetNormalMap,_WetNormalMapScale}, NormalMaps:{}}}", Float) = 1 + [Toggle(_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A)] + _MainRoughnessSource ("'Roughness Source' {Dropdown:{PackedMapAlpha:{}, BaseColorAlpha:{_SpecTex,_Occlusion}}}", Float) = 0 + [Enum(Front, 1, Back, 2)] + _ShadowCullMode ("'Shadow Cull Mode' {Dropdown:{Off:{}, Front:{}, Back:{}}}", Float) = 2 + + // Main Textures + _MainTextures ("'Main Textures' {Section:{Color:0}}", Float) = 0 + [LM_Albedo] [LM_Transparency] + _Color ("'Tint' {}", Color) = (1,1,1,1) + [LM_MasterTilingOffset] [LM_Albedo] + _MainTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _MainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _MainTexUV ("UV Set", Float) = 0 + [LM_Metallic] + _SpecTex ("'Metal(R) AO(G) Spec(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_MainTex}", 2D) = "white" {} + [LM_NormalMap] + _BumpMap ("'Normals' {Visualize:{NRM}, Parent:_MainTex}", 2D) = "bump" {} + _BaseColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Main Properties + _MainPhysicalProperties ("'Main Properties' {Section:{Color:1}}", Float) = 0 + [LM_Metallic] + _Metal ("'Metallic' {Min:0, Max:1}", Float) = 1 + _Specularity ("'Specularity' {Min:0, Max:1}", Float) = 1 + _SpecularTint ("'Specular Tint' {Min:0, Max:1}", Float) = 0 + _Roughness ("'Roughness' {Min:0, Max:1}", Float) = 1 + _Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _BumpScale ("'Normal Strength' {}", Float) = 1 + + // Transmission + _TransmissionProperties ("'Transmission' {Section:{Color:3}}", Float) = 0 + _TransColor ("'Tint' {}", Color) = (1,1,1) + _TransTex ("'Transmission(RGB)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "white" {} + [Gamma] + _TransScale ("'Weight' {Min:0, Max:1}", Float) = 1 + _TransDistortion ("'Bump Distortion' {Min:0, Max:1}", Float) = 0.05 + _TransPower ("'Falloff' {Min:1}", Float) = 1 + + // Parallax + [Toggle(_PARALLAXMAP)] + _ParallaxT ("'Parallax' {Feature:{Color:5}}", Float) = 0 + [Toggle(_BUMPMODE_POM)] + _BumpMode ("'Mode' {Dropdown:{Parallax:{_MinSamples, _MaxSamples}, POM:{}}}", Float) = 0 + _ParallaxMap ("'Heightmap(G)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "black" {} + _Parallax ("'Height' {Min:0, Max:0.08}", Float) = 0.02 + _MinSamples ("'Min Samples' {Min:1}", Float) = 4 + _MaxSamples ("'Max Samples' {Min:1}", Float) = 20 + + // AO2 + [Toggle(_AO2_ON)] + _AO2 ("'AO2' {Feature:{Color:6}}", Float) = 0 + _Ao2Map ("'AO2(G)' {Visualize:{RGB}}", 2D) = "white" {} + _Ao2MapUV ("UV Set", Float) = 1 + _Ao2Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + + // Detail + [Toggle(_DETAIL_MULX2)] + _DetailT ("'Detail' {Feature:{Color:7}}", Float) = 0 + [Toggle(_NORMALMAP)] + _DetailMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_DetailMask}}}", Float) = 0 + _DetailMask ("'Mask(A)' {Visualize:{A}, Parent:_MainTex}", 2D) = "white" {} + _DetailMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + [Enum(Mul, 0, MulX2, 1)] + _DetailMode ("'Color Mode' {Dropdown:{Mul:{}, MulX2:{}}}", Float) = 0 + _DetailAlbedoMap ("'Color(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _DetailAlbedoMapVelocity ("Scroll", Vector) = (0,0,0,0) + _DetailAlbedoMapUV ("UV Set", Float) = 0 + _DetailNormalMap ("'Normals' {Visualize:{NRM}, Parent:_DetailAlbedoMap}", 2D) = "bump" {} + _DetailWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DetailNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Team Color + [Toggle(_TEAMCOLOR_ON)] + _TeamColor ("'Team Color' {Feature:{Color:8}}", Float) = 0 + [Enum(Masks, 0, Tint, 1)] + _TeamColorMasksAsTint ("'Texture Mode' {Dropdown:{Masks:{}, Tint:{_TeamColorMasks, _TeamColor0, _TeamColor1, _TeamColor2, _TeamColor3}}}", Float) = 0 + _TeamColorMaskMap ("'Masks(RGBA)' {Visualize:{R, G, B, A, RGB}, Parent:_MainTex}", 2D) = "black" {} + _TeamColorMasks ("'Channels' {Vector:Channels}", Vector) = (1,1,1,0) + _TeamColor0 ("'Tint R' {}", Color) = (1,0,0) + _TeamColor1 ("'Tint G' {}", Color) = (0,1,0) + _TeamColor2 ("'Tint B' {}", Color) = (0,0,1) + _TeamColor3 ("'Tint A' {}", Color) = (0.5,0.5,0.5) + + // Decal + [Toggle(_DECAL_ON)] + _Decal ("'Decal' {Feature:{Color:9}}", Float) = 0 + _DecalColor ("'Tint' {}", Color) = (1,1,1,1) + _DecalTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "black" {} + _DecalTexUV ("UV Set", Float) = 0 + _DecalWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DecalSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _DecalAlphaVertexTint ("'Vertex Alpha Tint' {Min:0, Max:1}", Float) = 0 + + // Emission + [Toggle(_EMISSION)] + _Emission ("'Emission' {Feature:{Color:10}}", Float) = 0 + [LM_Emission] + [HDR] + _EmissionColor ("'Tint' {}", Color) = (1,1,1) + [LM_Emission] + _EmissionMap ("'Mask(RGB)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "white" {} + _IncandescenceMap ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _IncandescenceMapVelocity ("Scroll", Vector) = (0,0,0,0) + _IncandescenceMapUV ("UV Set", Float) = 0 + [Gamma] + _EmissionWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + + // Rim Emission + [Toggle(_RIM_ON)] + _Rim ("'Rim Emission' {Feature:{Color:11}}", Float) = 0 + [HDR] + _RimColor ("'Tint' {}", Color) = (1,1,1) + _RimTex ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _RimTexVelocity ("Scroll", Vector) = (0,0,0,0) + _RimTexUV ("UV Set", Float) = 0 + [Gamma] + _RimWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + [Gamma] + _RimBias ("'Fill' {Min:0, Max:1}", Float) = 0 + _RimPower ("'Falloff' {Min:0.01}", Float) = 4 + + // Dissolve + [Toggle(_DISSOLVE_ON)] + _Dissolve ("'Dissolve' {Feature:{Color:12}}", Float) = 0 + [HDR] + _DissolveGlowColor ("'Glow Tint' {}", Color) = (1,1,1,1) + _DissolveTex ("'Glow Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _DissolveTexUV ("UV Set", Float) = 0 + _DissolveCutoff ("'Cutoff' {Min:0, Max:1}", Float) = 0 + [Gamma] + _DissolveGlowWeight ("'Glow Weight' {Min:0, Max:1}", Float) = 1 + _DissolveEdgeWidth ("'Glow Width' {Min:0, Max:1}", Float) = 0.01 + + // Wetness + [Toggle(_WETNESS_ON)] + _WetnessProperties ("'Wetness' {Feature:{Color:13}}", Float) = 0 + [Toggle(_WETMASKSOURCE_VERTEXCOLORALPHA)] + _WetMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_WetMask}}}", Float) = 0 + _WetMask ("'Mask(A)' {Visualize:{A}}", 2D) = "white" {} + _WetMaskVelocity ("Scroll", Vector) = (0,0,0,0) + _WetMaskUV ("UV Set", Float) = 0 + _WetMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + _WetTint ("'Tint' {}", Color) = (1,1,1,1) + _WetNormalMap ("'Normals' {Visualize:{NRM}}", 2D) = "bump" {} + _WetNormalMapVelocity ("Scroll", Vector) = (0,0,0,0) + _WetNormalMapUV ("UV Set", Float) = 0 + _WetWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _WetRoughness ("'Roughness' {Min:0, Max:1}", Float) = 0.2 + _WetNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _Lightmapping ("'GI' {LightmapEmissionProperty:{}}", Float) = 1 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} + +CGINCLUDE + #define A_FORWARD_ONLY_SHADER +ENDCG + +SubShader { + Tags { + "RenderType" = "Opaque" + "PerformanceChecks" = "False" + //"DisableBatching" = "LODFading" + } + LOD 300 + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + Blend [_SrcBlend] [_DstBlend] + ZWrite [_ZWrite] + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Shaders/Definition/Transmission.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend [_SrcBlend] One + ZWrite Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + + #include "Assets/Alloy/Shaders/Definition/Transmission.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + Cull [_ShadowCullMode] + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _DISSOLVE_ON + + #pragma multi_compile_shadowcaster + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_SHADOWCASTER + + #include "Assets/Alloy/Shaders/Definition/Transmission.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Shaders/Definition/Transmission.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +FallBack "VertexLit" +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Shaders/3.0/Specialist/Transmission OneSided Forward.shader.meta b/Assets/Alloy/Shaders/3.0/Specialist/Transmission OneSided Forward.shader.meta new file mode 100644 index 0000000..fc01cb0 --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Specialist/Transmission OneSided Forward.shader.meta @@ -0,0 +1,22 @@ +fileFormatVersion: 2 +guid: a0e9aab18dbb41d4eade405c13b9b4e1 +ShaderImporter: + defaultTextures: + - _MainTex: {instanceID: 0} + - _SpecTex: {instanceID: 0} + - _BumpMap: {instanceID: 0} + - _TransTex: {instanceID: 0} + - _ParallaxMap: {instanceID: 0} + - _DetailMask: {instanceID: 0} + - _DetailAlbedoMap: {instanceID: 0} + - _DetailMaterialMap: {fileID: 2800000, guid: 2b77d5cb601375f4ba50c6194c126e59, + type: 3} + - _DetailNormalMap: {instanceID: 0} + - _TeamColorMaskMap: {instanceID: 0} + - _DecalTex: {instanceID: 0} + - _EmissionMap: {instanceID: 0} + - _IncandescenceMap: {instanceID: 0} + - _RimTex: {instanceID: 0} + - _DissolveTex: {instanceID: 0} + userData: + assetBundleName: diff --git a/Assets/Alloy/Shaders/3.0/Specialist/Transmission OneSided.shader b/Assets/Alloy/Shaders/3.0/Specialist/Transmission OneSided.shader new file mode 100644 index 0000000..565c6c5 --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Specialist/Transmission OneSided.shader @@ -0,0 +1,373 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Transmission/OneSided" { +Properties { + // Global Settings + _Mode ("'Rendering Mode' {RenderingMode:{Opaque:{_Cutoff}, Cutout:{}, Fade:{_Cutoff}, Transparent:{_Cutoff}}}", Float) = 0 + _SrcBlend ("__src", Float) = 0 + _DstBlend ("__dst", Float) = 0 + _ZWrite ("__zw", Float) = 1 + [LM_TransparencyCutOff] + _Cutoff ("'Opacity Cutoff' {Min:0, Max:1}", Float) = 0.5 + [Toggle(EFFECT_BUMP)] + _HasBumpMap ("'Normals Source' {Dropdown:{VertexNormals:{_BumpMap,_BumpScale,_DetailNormalMap,_DetailNormalMapScale,_WetNormalMap,_WetNormalMapScale}, NormalMaps:{}}}", Float) = 1 + [Toggle(_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A)] + _MainRoughnessSource ("'Roughness Source' {Dropdown:{PackedMapAlpha:{}, BaseColorAlpha:{_SpecTex,_Occlusion}}}", Float) = 0 + [Enum(Front, 1, Back, 2)] + _ShadowCullMode ("'Shadow Cull Mode' {Dropdown:{Off:{}, Front:{}, Back:{}}}", Float) = 2 + + // Main Textures + _MainTextures ("'Main Textures' {Section:{Color:0}}", Float) = 0 + [LM_Albedo] [LM_Transparency] + _Color ("'Tint' {}", Color) = (1,1,1,1) + [LM_MasterTilingOffset] [LM_Albedo] + _MainTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _MainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _MainTexUV ("UV Set", Float) = 0 + [LM_Metallic] + _SpecTex ("'Metal(R) AO(G) Spec(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_MainTex}", 2D) = "white" {} + [LM_NormalMap] + _BumpMap ("'Normals' {Visualize:{NRM}, Parent:_MainTex}", 2D) = "bump" {} + _BaseColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Main Properties + _MainPhysicalProperties ("'Main Properties' {Section:{Color:1}}", Float) = 0 + [LM_Metallic] + _Metal ("'Metallic' {Min:0, Max:1}", Float) = 1 + _Specularity ("'Specularity' {Min:0, Max:1}", Float) = 1 + _SpecularTint ("'Specular Tint' {Min:0, Max:1}", Float) = 0 + _Roughness ("'Roughness' {Min:0, Max:1}", Float) = 1 + _Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _BumpScale ("'Normal Strength' {}", Float) = 1 + + // Transmission + _TransmissionProperties ("'Transmission' {Section:{Color:3}}", Float) = 0 + _TransTex ("'Transmission(G)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "white" {} + [Gamma] + _TransScale ("'Weight' {Min:0, Max:1}", Float) = 1 + + // Parallax + [Toggle(_PARALLAXMAP)] + _ParallaxT ("'Parallax' {Feature:{Color:5}}", Float) = 0 + [Toggle(_BUMPMODE_POM)] + _BumpMode ("'Mode' {Dropdown:{Parallax:{_MinSamples, _MaxSamples}, POM:{}}}", Float) = 0 + _ParallaxMap ("'Heightmap(G)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "black" {} + _Parallax ("'Height' {Min:0, Max:0.08}", Float) = 0.02 + _MinSamples ("'Min Samples' {Min:1}", Float) = 4 + _MaxSamples ("'Max Samples' {Min:1}", Float) = 20 + + // AO2 + [Toggle(_AO2_ON)] + _AO2 ("'AO2' {Feature:{Color:6}}", Float) = 0 + _Ao2Map ("'AO2(G)' {Visualize:{RGB}}", 2D) = "white" {} + _Ao2MapUV ("UV Set", Float) = 1 + _Ao2Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + + // Detail + [Toggle(_DETAIL_MULX2)] + _DetailT ("'Detail' {Feature:{Color:7}}", Float) = 0 + [Toggle(_NORMALMAP)] + _DetailMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_DetailMask}}}", Float) = 0 + _DetailMask ("'Mask(A)' {Visualize:{A}, Parent:_MainTex}", 2D) = "white" {} + _DetailMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + [Enum(Mul, 0, MulX2, 1)] + _DetailMode ("'Color Mode' {Dropdown:{Mul:{}, MulX2:{}}}", Float) = 0 + _DetailAlbedoMap ("'Color(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _DetailAlbedoMapVelocity ("Scroll", Vector) = (0,0,0,0) + _DetailAlbedoMapUV ("UV Set", Float) = 0 + _DetailNormalMap ("'Normals' {Visualize:{NRM}, Parent:_DetailAlbedoMap}", 2D) = "bump" {} + _DetailWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DetailNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Team Color + [Toggle(_TEAMCOLOR_ON)] + _TeamColor ("'Team Color' {Feature:{Color:8}}", Float) = 0 + [Enum(Masks, 0, Tint, 1)] + _TeamColorMasksAsTint ("'Texture Mode' {Dropdown:{Masks:{}, Tint:{_TeamColorMasks, _TeamColor0, _TeamColor1, _TeamColor2, _TeamColor3}}}", Float) = 0 + _TeamColorMaskMap ("'Masks(RGBA)' {Visualize:{R, G, B, A, RGB}, Parent:_MainTex}", 2D) = "black" {} + _TeamColorMasks ("'Channels' {Vector:Channels}", Vector) = (1,1,1,0) + _TeamColor0 ("'Tint R' {}", Color) = (1,0,0) + _TeamColor1 ("'Tint G' {}", Color) = (0,1,0) + _TeamColor2 ("'Tint B' {}", Color) = (0,0,1) + _TeamColor3 ("'Tint A' {}", Color) = (0.5,0.5,0.5) + + // Decal + [Toggle(_DECAL_ON)] + _Decal ("'Decal' {Feature:{Color:9}}", Float) = 0 + _DecalColor ("'Tint' {}", Color) = (1,1,1,1) + _DecalTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "black" {} + _DecalTexUV ("UV Set", Float) = 0 + _DecalWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DecalSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _DecalAlphaVertexTint ("'Vertex Alpha Tint' {Min:0, Max:1}", Float) = 0 + + // Emission + [Toggle(_EMISSION)] + _Emission ("'Emission' {Feature:{Color:10}}", Float) = 0 + [LM_Emission] + [HDR] + _EmissionColor ("'Tint' {}", Color) = (1,1,1) + [LM_Emission] + _EmissionMap ("'Mask(RGB)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "white" {} + _IncandescenceMap ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _IncandescenceMapVelocity ("Scroll", Vector) = (0,0,0,0) + _IncandescenceMapUV ("UV Set", Float) = 0 + [Gamma] + _EmissionWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + + // Rim Emission + [Toggle(_RIM_ON)] + _Rim ("'Rim Emission' {Feature:{Color:11}}", Float) = 0 + [HDR] + _RimColor ("'Tint' {}", Color) = (1,1,1) + _RimTex ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _RimTexVelocity ("Scroll", Vector) = (0,0,0,0) + _RimTexUV ("UV Set", Float) = 0 + [Gamma] + _RimWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + [Gamma] + _RimBias ("'Fill' {Min:0, Max:1}", Float) = 0 + _RimPower ("'Falloff' {Min:0.01}", Float) = 4 + + // Dissolve + [Toggle(_DISSOLVE_ON)] + _Dissolve ("'Dissolve' {Feature:{Color:12}}", Float) = 0 + [HDR] + _DissolveGlowColor ("'Glow Tint' {}", Color) = (1,1,1,1) + _DissolveTex ("'Glow Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _DissolveTexUV ("UV Set", Float) = 0 + _DissolveCutoff ("'Cutoff' {Min:0, Max:1}", Float) = 0 + [Gamma] + _DissolveGlowWeight ("'Glow Weight' {Min:0, Max:1}", Float) = 1 + _DissolveEdgeWidth ("'Glow Width' {Min:0, Max:1}", Float) = 0.01 + + // Wetness + [Toggle(_WETNESS_ON)] + _WetnessProperties ("'Wetness' {Feature:{Color:13}}", Float) = 0 + [Toggle(_WETMASKSOURCE_VERTEXCOLORALPHA)] + _WetMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_WetMask}}}", Float) = 0 + _WetMask ("'Mask(A)' {Visualize:{A}}", 2D) = "white" {} + _WetMaskVelocity ("Scroll", Vector) = (0,0,0,0) + _WetMaskUV ("UV Set", Float) = 0 + _WetMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + _WetTint ("'Tint' {}", Color) = (1,1,1,1) + _WetNormalMap ("'Normals' {Visualize:{NRM}}", 2D) = "bump" {} + _WetNormalMapVelocity ("Scroll", Vector) = (0,0,0,0) + _WetNormalMapUV ("UV Set", Float) = 0 + _WetWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _WetRoughness ("'Roughness' {Min:0, Max:1}", Float) = 0.2 + _WetNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _Lightmapping ("'GI' {LightmapEmissionProperty:{}}", Float) = 1 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} + +SubShader { + Tags { + "RenderType" = "Opaque" + "PerformanceChecks" = "False" + //"DisableBatching" = "LODFading" + } + LOD 300 + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + Blend [_SrcBlend] [_DstBlend] + ZWrite [_ZWrite] + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Shaders/Definition/Transmission.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend [_SrcBlend] One + ZWrite Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + + #include "Assets/Alloy/Shaders/Definition/Transmission.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + Cull [_ShadowCullMode] + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _DISSOLVE_ON + + #pragma multi_compile_shadowcaster + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_SHADOWCASTER + + #include "Assets/Alloy/Shaders/Definition/Transmission.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } + + Pass { + Name "DEFERRED" + Tags { "LightMode" = "Deferred" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_prepassfinal + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_DEFERRED + + #include "Assets/Alloy/Shaders/Definition/Transmission.cginc" + #include "Assets/Alloy/Shaders/Forward/Gbuffer.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Shaders/Definition/Transmission.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +FallBack "VertexLit" +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Shaders/3.0/Specialist/Transmission OneSided.shader.meta b/Assets/Alloy/Shaders/3.0/Specialist/Transmission OneSided.shader.meta new file mode 100644 index 0000000..4d388c1 --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Specialist/Transmission OneSided.shader.meta @@ -0,0 +1,26 @@ +fileFormatVersion: 2 +guid: 8c9015e629b0b4240b578c63a1b4bcdc +timeCreated: 1441334746 +licenseType: Pro +ShaderImporter: + defaultTextures: + - _MainTex: {instanceID: 0} + - _SpecTex: {instanceID: 0} + - _BumpMap: {instanceID: 0} + - _TransTex: {instanceID: 0} + - _ParallaxMap: {instanceID: 0} + - _Ao2Map: {instanceID: 0} + - _DetailMask: {instanceID: 0} + - _DetailAlbedoMap: {instanceID: 0} + - _DetailMaterialMap: {fileID: 2800000, guid: 2b77d5cb601375f4ba50c6194c126e59, + type: 3} + - _DetailNormalMap: {instanceID: 0} + - _TeamColorMaskMap: {instanceID: 0} + - _DecalTex: {instanceID: 0} + - _EmissionMap: {instanceID: 0} + - _IncandescenceMap: {instanceID: 0} + - _RimTex: {instanceID: 0} + - _DissolveTex: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/3.0/Specialist/Transmission TwoSided Forward.shader b/Assets/Alloy/Shaders/3.0/Specialist/Transmission TwoSided Forward.shader new file mode 100644 index 0000000..d6291ef --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Specialist/Transmission TwoSided Forward.shader @@ -0,0 +1,342 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Transmission/TwoSided (Forward)" { +Properties { + // Global Settings + _Mode ("'Rendering Mode' {RenderingMode:{Opaque:{_Cutoff}, Cutout:{}, Fade:{_Cutoff}, Transparent:{_Cutoff}}}", Float) = 0 + _SrcBlend ("__src", Float) = 0 + _DstBlend ("__dst", Float) = 0 + _ZWrite ("__zw", Float) = 1 + [LM_TransparencyCutOff] + _Cutoff ("'Opacity Cutoff' {Min:0, Max:1}", Float) = 0.5 + [Toggle(EFFECT_BUMP)] + _HasBumpMap ("'Normals Source' {Dropdown:{VertexNormals:{_TransInvertBackNormal,_BumpMap,_BumpScale,_DetailNormalMap,_DetailNormalMapScale,_WetNormalMap,_WetNormalMapScale}, NormalMaps:{}}}", Float) = 1 + [Toggle(_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A)] + _MainRoughnessSource ("'Roughness Source' {Dropdown:{PackedMapAlpha:{}, BaseColorAlpha:{_SpecTex,_Occlusion}}}", Float) = 0 + _TransInvertBackNormal ("'Invert Back Normals' {Toggle:{On:{}, Off:{}}}", Float) = 0 + + // Main Textures + _MainTextures ("'Main Textures' {Section:{Color:0}}", Float) = 0 + [LM_Albedo] [LM_Transparency] + _Color ("'Tint' {}", Color) = (1,1,1,1) + [LM_MasterTilingOffset] [LM_Albedo] + _MainTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _MainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _MainTexUV ("UV Set", Float) = 0 + [LM_Metallic] + _SpecTex ("'Metal(R) AO(G) Spec(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_MainTex}", 2D) = "white" {} + [LM_NormalMap] + _BumpMap ("'Normals' {Visualize:{NRM}, Parent:_MainTex}", 2D) = "bump" {} + _BaseColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Main Properties + _MainPhysicalProperties ("'Main Properties' {Section:{Color:1}}", Float) = 0 + [LM_Metallic] + _Metal ("'Metallic' {Min:0, Max:1}", Float) = 1 + _Specularity ("'Specularity' {Min:0, Max:1}", Float) = 1 + _SpecularTint ("'Specular Tint' {Min:0, Max:1}", Float) = 0 + _Roughness ("'Roughness' {Min:0, Max:1}", Float) = 1 + _Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _BumpScale ("'Normal Strength' {}", Float) = 1 + + // Transmission + _TransmissionProperties ("'Transmission' {Section:{Color:3}}", Float) = 0 + _TransColor ("'Tint' {}", Color) = (1,1,1) + _TransTex ("'Transmission(RGB)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "white" {} + [Gamma] + _TransScale ("'Weight' {Min:0, Max:1}", Float) = 1 + _TransShadowWeight ("'Shadow Weight' {Min:0, Max:1}", Float) = 0.5 + _TransDistortion ("'Bump Distortion' {Min:0, Max:1}", Float) = 0.05 + _TransPower ("'Falloff' {Min:1}", Float) = 1 + + // Parallax + [Toggle(_PARALLAXMAP)] + _ParallaxT ("'Parallax' {Feature:{Color:5}}", Float) = 0 + [Toggle(_BUMPMODE_POM)] + _BumpMode ("'Mode' {Dropdown:{Parallax:{_MinSamples, _MaxSamples}, POM:{}}}", Float) = 0 + _ParallaxMap ("'Heightmap(G)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "black" {} + _Parallax ("'Height' {Min:0, Max:0.08}", Float) = 0.02 + _MinSamples ("'Min Samples' {Min:1}", Float) = 4 + _MaxSamples ("'Max Samples' {Min:1}", Float) = 20 + + // AO2 + [Toggle(_AO2_ON)] + _AO2 ("'AO2' {Feature:{Color:6}}", Float) = 0 + _Ao2Map ("'AO2(G)' {Visualize:{RGB}}", 2D) = "white" {} + _Ao2MapUV ("UV Set", Float) = 1 + _Ao2Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + + // Detail + [Toggle(_DETAIL_MULX2)] + _DetailT ("'Detail' {Feature:{Color:7}}", Float) = 0 + [Toggle(_NORMALMAP)] + _DetailMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_DetailMask}}}", Float) = 0 + _DetailMask ("'Mask(A)' {Visualize:{A}, Parent:_MainTex}", 2D) = "white" {} + _DetailMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + [Enum(Mul, 0, MulX2, 1)] + _DetailMode ("'Color Mode' {Dropdown:{Mul:{}, MulX2:{}}}", Float) = 0 + _DetailAlbedoMap ("'Color(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _DetailAlbedoMapVelocity ("Scroll", Vector) = (0,0,0,0) + _DetailAlbedoMapUV ("UV Set", Float) = 0 + _DetailNormalMap ("'Normals' {Visualize:{NRM}, Parent:_DetailAlbedoMap}", 2D) = "bump" {} + _DetailWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DetailNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Team Color + [Toggle(_TEAMCOLOR_ON)] + _TeamColor ("'Team Color' {Feature:{Color:8}}", Float) = 0 + [Enum(Masks, 0, Tint, 1)] + _TeamColorMasksAsTint ("'Texture Mode' {Dropdown:{Masks:{}, Tint:{_TeamColorMasks, _TeamColor0, _TeamColor1, _TeamColor2, _TeamColor3}}}", Float) = 0 + _TeamColorMaskMap ("'Masks(RGBA)' {Visualize:{R, G, B, A, RGB}, Parent:_MainTex}", 2D) = "black" {} + _TeamColorMasks ("'Channels' {Vector:Channels}", Vector) = (1,1,1,0) + _TeamColor0 ("'Tint R' {}", Color) = (1,0,0) + _TeamColor1 ("'Tint G' {}", Color) = (0,1,0) + _TeamColor2 ("'Tint B' {}", Color) = (0,0,1) + _TeamColor3 ("'Tint A' {}", Color) = (0.5,0.5,0.5) + + // Decal + [Toggle(_DECAL_ON)] + _Decal ("'Decal' {Feature:{Color:9}}", Float) = 0 + _DecalColor ("'Tint' {}", Color) = (1,1,1,1) + _DecalTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "black" {} + _DecalTexUV ("UV Set", Float) = 0 + _DecalWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DecalSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _DecalAlphaVertexTint ("'Vertex Alpha Tint' {Min:0, Max:1}", Float) = 0 + + // Emission + [Toggle(_EMISSION)] + _Emission ("'Emission' {Feature:{Color:10}}", Float) = 0 + [LM_Emission] + [HDR] + _EmissionColor ("'Tint' {}", Color) = (1,1,1) + [LM_Emission] + _EmissionMap ("'Mask(RGB)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "white" {} + _IncandescenceMap ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _IncandescenceMapVelocity ("Scroll", Vector) = (0,0,0,0) + _IncandescenceMapUV ("UV Set", Float) = 0 + [Gamma] + _EmissionWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + + // Rim Emission + [Toggle(_RIM_ON)] + _Rim ("'Rim Emission' {Feature:{Color:11}}", Float) = 0 + [HDR] + _RimColor ("'Tint' {}", Color) = (1,1,1) + _RimTex ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _RimTexVelocity ("Scroll", Vector) = (0,0,0,0) + _RimTexUV ("UV Set", Float) = 0 + [Gamma] + _RimWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + [Gamma] + _RimBias ("'Fill' {Min:0, Max:1}", Float) = 0 + _RimPower ("'Falloff' {Min:0.01}", Float) = 4 + + // Dissolve + [Toggle(_DISSOLVE_ON)] + _Dissolve ("'Dissolve' {Feature:{Color:12}}", Float) = 0 + [HDR] + _DissolveGlowColor ("'Glow Tint' {}", Color) = (1,1,1,1) + _DissolveTex ("'Glow Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _DissolveTexUV ("UV Set", Float) = 0 + _DissolveCutoff ("'Cutoff' {Min:0, Max:1}", Float) = 0 + [Gamma] + _DissolveGlowWeight ("'Glow Weight' {Min:0, Max:1}", Float) = 1 + _DissolveEdgeWidth ("'Glow Width' {Min:0, Max:1}", Float) = 0.01 + + // Wetness + [Toggle(_WETNESS_ON)] + _WetnessProperties ("'Wetness' {Feature:{Color:13}}", Float) = 0 + [Toggle(_WETMASKSOURCE_VERTEXCOLORALPHA)] + _WetMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_WetMask}}}", Float) = 0 + _WetMask ("'Mask(A)' {Visualize:{A}}", 2D) = "white" {} + _WetMaskVelocity ("Scroll", Vector) = (0,0,0,0) + _WetMaskUV ("UV Set", Float) = 0 + _WetMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + _WetTint ("'Tint' {}", Color) = (1,1,1,1) + _WetNormalMap ("'Normals' {Visualize:{NRM}}", 2D) = "bump" {} + _WetNormalMapVelocity ("Scroll", Vector) = (0,0,0,0) + _WetNormalMapUV ("UV Set", Float) = 0 + _WetWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _WetRoughness ("'Roughness' {Min:0, Max:1}", Float) = 0.2 + _WetNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _Lightmapping ("'GI' {LightmapEmissionProperty:{}}", Float) = 1 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} + +CGINCLUDE + #define A_FORWARD_ONLY_SHADER + #define A_TWO_SIDED_SHADER +ENDCG + +SubShader { + Tags { + "RenderType" = "Opaque" + "PerformanceChecks" = "False" + //"DisableBatching" = "LODFading" + } + LOD 300 + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + Blend [_SrcBlend] [_DstBlend] + ZWrite [_ZWrite] + Cull Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Shaders/Definition/Transmission.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend [_SrcBlend] One + ZWrite Off + Cull Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + + #include "Assets/Alloy/Shaders/Definition/Transmission.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + Cull Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _DISSOLVE_ON + + #pragma multi_compile_shadowcaster + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_SHADOWCASTER + + #include "Assets/Alloy/Shaders/Definition/Transmission.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Shaders/Definition/Transmission.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +FallBack "VertexLit" +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Shaders/3.0/Specialist/Transmission TwoSided Forward.shader.meta b/Assets/Alloy/Shaders/3.0/Specialist/Transmission TwoSided Forward.shader.meta new file mode 100644 index 0000000..f4e87e4 --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Specialist/Transmission TwoSided Forward.shader.meta @@ -0,0 +1,22 @@ +fileFormatVersion: 2 +guid: fc44eed2d2e28e243b23ee0b37fa873d +ShaderImporter: + defaultTextures: + - _MainTex: {instanceID: 0} + - _SpecTex: {instanceID: 0} + - _BumpMap: {instanceID: 0} + - _TransTex: {instanceID: 0} + - _ParallaxMap: {instanceID: 0} + - _DetailMask: {instanceID: 0} + - _DetailAlbedoMap: {instanceID: 0} + - _DetailMaterialMap: {fileID: 2800000, guid: 2b77d5cb601375f4ba50c6194c126e59, + type: 3} + - _DetailNormalMap: {instanceID: 0} + - _TeamColorMaskMap: {instanceID: 0} + - _DecalTex: {instanceID: 0} + - _EmissionMap: {instanceID: 0} + - _IncandescenceMap: {instanceID: 0} + - _RimTex: {instanceID: 0} + - _DissolveTex: {instanceID: 0} + userData: + assetBundleName: diff --git a/Assets/Alloy/Shaders/3.0/Specialist/Transmission TwoSided.shader b/Assets/Alloy/Shaders/3.0/Specialist/Transmission TwoSided.shader new file mode 100644 index 0000000..8d3bd74 --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Specialist/Transmission TwoSided.shader @@ -0,0 +1,380 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Transmission/TwoSided" { +Properties { + // Global Settings + _Mode ("'Rendering Mode' {RenderingMode:{Opaque:{_Cutoff}, Cutout:{}, Fade:{_Cutoff}, Transparent:{_Cutoff}}}", Float) = 0 + _SrcBlend ("__src", Float) = 0 + _DstBlend ("__dst", Float) = 0 + _ZWrite ("__zw", Float) = 1 + [LM_TransparencyCutOff] + _Cutoff ("'Opacity Cutoff' {Min:0, Max:1}", Float) = 0.5 + [Toggle(EFFECT_BUMP)] + _HasBumpMap ("'Normals Source' {Dropdown:{VertexNormals:{_TransInvertBackNormal,_BumpMap,_BumpScale,_DetailNormalMap,_DetailNormalMapScale,_WetNormalMap,_WetNormalMapScale}, NormalMaps:{}}}", Float) = 1 + [Toggle(_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A)] + _MainRoughnessSource ("'Roughness Source' {Dropdown:{PackedMapAlpha:{}, BaseColorAlpha:{_SpecTex,_Occlusion}}}", Float) = 0 + _TransInvertBackNormal ("'Invert Back Normals' {Toggle:{On:{}, Off:{}}}", Float) = 0 + + // Main Textures + _MainTextures ("'Main Textures' {Section:{Color:0}}", Float) = 0 + [LM_Albedo] [LM_Transparency] + _Color ("'Tint' {}", Color) = (1,1,1,1) + [LM_MasterTilingOffset] [LM_Albedo] + _MainTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _MainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _MainTexUV ("UV Set", Float) = 0 + [LM_Metallic] + _SpecTex ("'Metal(R) AO(G) Spec(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_MainTex}", 2D) = "white" {} + [LM_NormalMap] + _BumpMap ("'Normals' {Visualize:{NRM}, Parent:_MainTex}", 2D) = "bump" {} + _BaseColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Main Properties + _MainPhysicalProperties ("'Main Properties' {Section:{Color:1}}", Float) = 0 + [LM_Metallic] + _Metal ("'Metallic' {Min:0, Max:1}", Float) = 1 + _Specularity ("'Specularity' {Min:0, Max:1}", Float) = 1 + _SpecularTint ("'Specular Tint' {Min:0, Max:1}", Float) = 0 + _Roughness ("'Roughness' {Min:0, Max:1}", Float) = 1 + _Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _BumpScale ("'Normal Strength' {}", Float) = 1 + + // Transmission + _TransmissionProperties ("'Transmission' {Section:{Color:3}}", Float) = 0 + _TransTex ("'Transmission(G)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "white" {} + [Gamma] + _TransScale ("'Weight' {Min:0, Max:1}", Float) = 1 + + // Parallax + [Toggle(_PARALLAXMAP)] + _ParallaxT ("'Parallax' {Feature:{Color:5}}", Float) = 0 + [Toggle(_BUMPMODE_POM)] + _BumpMode ("'Mode' {Dropdown:{Parallax:{_MinSamples, _MaxSamples}, POM:{}}}", Float) = 0 + _ParallaxMap ("'Heightmap(G)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "black" {} + _Parallax ("'Height' {Min:0, Max:0.08}", Float) = 0.02 + _MinSamples ("'Min Samples' {Min:1}", Float) = 4 + _MaxSamples ("'Max Samples' {Min:1}", Float) = 20 + + // AO2 + [Toggle(_AO2_ON)] + _AO2 ("'AO2' {Feature:{Color:6}}", Float) = 0 + _Ao2Map ("'AO2(G)' {Visualize:{RGB}}", 2D) = "white" {} + _Ao2MapUV ("UV Set", Float) = 1 + _Ao2Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + + // Detail + [Toggle(_DETAIL_MULX2)] + _DetailT ("'Detail' {Feature:{Color:7}}", Float) = 0 + [Toggle(_NORMALMAP)] + _DetailMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_DetailMask}}}", Float) = 0 + _DetailMask ("'Mask(A)' {Visualize:{A}, Parent:_MainTex}", 2D) = "white" {} + _DetailMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + [Enum(Mul, 0, MulX2, 1)] + _DetailMode ("'Color Mode' {Dropdown:{Mul:{}, MulX2:{}}}", Float) = 0 + _DetailAlbedoMap ("'Color(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _DetailAlbedoMapVelocity ("Scroll", Vector) = (0,0,0,0) + _DetailAlbedoMapUV ("UV Set", Float) = 0 + _DetailNormalMap ("'Normals' {Visualize:{NRM}, Parent:_DetailAlbedoMap}", 2D) = "bump" {} + _DetailWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DetailNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Team Color + [Toggle(_TEAMCOLOR_ON)] + _TeamColor ("'Team Color' {Feature:{Color:8}}", Float) = 0 + [Enum(Masks, 0, Tint, 1)] + _TeamColorMasksAsTint ("'Texture Mode' {Dropdown:{Masks:{}, Tint:{_TeamColorMasks, _TeamColor0, _TeamColor1, _TeamColor2, _TeamColor3}}}", Float) = 0 + _TeamColorMaskMap ("'Masks(RGBA)' {Visualize:{R, G, B, A, RGB}, Parent:_MainTex}", 2D) = "black" {} + _TeamColorMasks ("'Channels' {Vector:Channels}", Vector) = (1,1,1,0) + _TeamColor0 ("'Tint R' {}", Color) = (1,0,0) + _TeamColor1 ("'Tint G' {}", Color) = (0,1,0) + _TeamColor2 ("'Tint B' {}", Color) = (0,0,1) + _TeamColor3 ("'Tint A' {}", Color) = (0.5,0.5,0.5) + + // Decal + [Toggle(_DECAL_ON)] + _Decal ("'Decal' {Feature:{Color:9}}", Float) = 0 + _DecalColor ("'Tint' {}", Color) = (1,1,1,1) + _DecalTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "black" {} + _DecalTexUV ("UV Set", Float) = 0 + _DecalWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DecalSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _DecalAlphaVertexTint ("'Vertex Alpha Tint' {Min:0, Max:1}", Float) = 0 + + // Emission + [Toggle(_EMISSION)] + _Emission ("'Emission' {Feature:{Color:10}}", Float) = 0 + [LM_Emission] + [HDR] + _EmissionColor ("'Tint' {}", Color) = (1,1,1) + [LM_Emission] + _EmissionMap ("'Mask(RGB)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "white" {} + _IncandescenceMap ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _IncandescenceMapVelocity ("Scroll", Vector) = (0,0,0,0) + _IncandescenceMapUV ("UV Set", Float) = 0 + [Gamma] + _EmissionWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + + // Rim Emission + [Toggle(_RIM_ON)] + _Rim ("'Rim Emission' {Feature:{Color:11}}", Float) = 0 + [HDR] + _RimColor ("'Tint' {}", Color) = (1,1,1) + _RimTex ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _RimTexVelocity ("Scroll", Vector) = (0,0,0,0) + _RimTexUV ("UV Set", Float) = 0 + [Gamma] + _RimWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + [Gamma] + _RimBias ("'Fill' {Min:0, Max:1}", Float) = 0 + _RimPower ("'Falloff' {Min:0.01}", Float) = 4 + + // Dissolve + [Toggle(_DISSOLVE_ON)] + _Dissolve ("'Dissolve' {Feature:{Color:12}}", Float) = 0 + [HDR] + _DissolveGlowColor ("'Glow Tint' {}", Color) = (1,1,1,1) + _DissolveTex ("'Glow Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _DissolveTexUV ("UV Set", Float) = 0 + _DissolveCutoff ("'Cutoff' {Min:0, Max:1}", Float) = 0 + [Gamma] + _DissolveGlowWeight ("'Glow Weight' {Min:0, Max:1}", Float) = 1 + _DissolveEdgeWidth ("'Glow Width' {Min:0, Max:1}", Float) = 0.01 + + // Wetness + [Toggle(_WETNESS_ON)] + _WetnessProperties ("'Wetness' {Feature:{Color:13}}", Float) = 0 + [Toggle(_WETMASKSOURCE_VERTEXCOLORALPHA)] + _WetMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_WetMask}}}", Float) = 0 + _WetMask ("'Mask(A)' {Visualize:{A}}", 2D) = "white" {} + _WetMaskVelocity ("Scroll", Vector) = (0,0,0,0) + _WetMaskUV ("UV Set", Float) = 0 + _WetMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + _WetTint ("'Tint' {}", Color) = (1,1,1,1) + _WetNormalMap ("'Normals' {Visualize:{NRM}}", 2D) = "bump" {} + _WetNormalMapVelocity ("Scroll", Vector) = (0,0,0,0) + _WetNormalMapUV ("UV Set", Float) = 0 + _WetWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _WetRoughness ("'Roughness' {Min:0, Max:1}", Float) = 0.2 + _WetNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _Lightmapping ("'GI' {LightmapEmissionProperty:{}}", Float) = 1 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} + +CGINCLUDE + #define A_TWO_SIDED_SHADER +ENDCG + +SubShader { + Tags { + "RenderType" = "Opaque" + "PerformanceChecks" = "False" + //"DisableBatching" = "LODFading" + } + LOD 300 + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + Blend [_SrcBlend] [_DstBlend] + ZWrite [_ZWrite] + Cull Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Shaders/Definition/Transmission.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend [_SrcBlend] One + ZWrite Off + Cull Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + + #include "Assets/Alloy/Shaders/Definition/Transmission.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + Cull Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _DISSOLVE_ON + + #pragma multi_compile_shadowcaster + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_SHADOWCASTER + + #include "Assets/Alloy/Shaders/Definition/Transmission.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } + + Pass { + Name "DEFERRED" + Tags { "LightMode" = "Deferred" } + + Cull Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_prepassfinal + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_DEFERRED + + #include "Assets/Alloy/Shaders/Definition/Transmission.cginc" + #include "Assets/Alloy/Shaders/Forward/Gbuffer.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Shaders/Definition/Transmission.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +FallBack "VertexLit" +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Shaders/3.0/Specialist/Transmission TwoSided.shader.meta b/Assets/Alloy/Shaders/3.0/Specialist/Transmission TwoSided.shader.meta new file mode 100644 index 0000000..53e0ec0 --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Specialist/Transmission TwoSided.shader.meta @@ -0,0 +1,26 @@ +fileFormatVersion: 2 +guid: 44a25746c408e294798fbba0db332085 +timeCreated: 1441334738 +licenseType: Pro +ShaderImporter: + defaultTextures: + - _MainTex: {instanceID: 0} + - _SpecTex: {instanceID: 0} + - _BumpMap: {instanceID: 0} + - _TransTex: {instanceID: 0} + - _ParallaxMap: {instanceID: 0} + - _Ao2Map: {instanceID: 0} + - _DetailMask: {instanceID: 0} + - _DetailAlbedoMap: {instanceID: 0} + - _DetailMaterialMap: {fileID: 2800000, guid: 2b77d5cb601375f4ba50c6194c126e59, + type: 3} + - _DetailNormalMap: {instanceID: 0} + - _TeamColorMaskMap: {instanceID: 0} + - _DecalTex: {instanceID: 0} + - _EmissionMap: {instanceID: 0} + - _IncandescenceMap: {instanceID: 0} + - _RimTex: {instanceID: 0} + - _DissolveTex: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/3.0/Specialist/TriPlanar.shader b/Assets/Alloy/Shaders/3.0/Specialist/TriPlanar.shader new file mode 100644 index 0000000..d8f63ef --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Specialist/TriPlanar.shader @@ -0,0 +1,300 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/TriPlanar" { +Properties { + // Global Settings + _Mode ("'Rendering Mode' {RenderingMode:{Opaque:{_Cutoff}, Cutout:{}, Fade:{_Cutoff}, Transparent:{_Cutoff}}}", Float) = 0 + _SrcBlend ("__src", Float) = 0 + _DstBlend ("__dst", Float) = 0 + _ZWrite ("__zw", Float) = 1 + [LM_TransparencyCutOff] + _Cutoff ("'Opacity Cutoff' {Min:0, Max:1}", Float) = 0.5 + [Toggle(EFFECT_BUMP)] + _HasBumpMap ("'Normals Source' {Dropdown:{VertexNormals:{_PrimaryBumpMap,_PrimaryBumpScale,_SecondaryBumpMap,_SecondaryBumpScale,_TertiaryBumpMap,_TertiaryBumpScale,_QuaternaryBumpMap,_QuaternaryBumpScale}, NormalMaps:{}}}", Float) = 1 + [Toggle(_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A)] + _MainRoughnessSource ("'Roughness Source' {Dropdown:{PackedMapAlpha:{}, BaseColorAlpha:{_PrimaryMaterialMap,_PrimaryOcclusion,_SecondaryMaterialMap,_SecondaryOcclusion,_TertiaryMaterialMap,_TertiaryOcclusion,_QuaternaryMaterialMap,_QuaternaryOcclusion}}}", Float) = 0 + + // Primary Textures + _PrimaryTextures ("'Primary Textures' {Section:{Color:0}}", Float) = 0 + _PrimaryColor ("'Tint' {}", Color) = (1,1,1,1) + _PrimaryMainTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _PrimaryMainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _PrimaryMaterialMap ("'Metal(R) AO(G) Spec(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_PrimaryMainTex}", 2D) = "white" {} + _PrimaryBumpMap ("'Normals' {Visualize:{NRM}, Parent:_PrimaryMainTex}", 2D) = "bump" {} + _PrimaryColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Primary Properties + _PrimaryPhysicalProperties ("'Primary Properties' {Section:{Color:0}}", Float) = 0 + _PrimaryMetallic ("'Metallic' {Min:0, Max:1}", Float) = 1 + _PrimarySpecularity ("'Specularity' {Min:0, Max:1}", Float) = 1 + _PrimarySpecularTint ("'Specular Tint' {Min:0, Max:1}", Float) = 0 + _PrimaryRoughness ("'Roughness' {Min:0, Max:1}", Float) = 1 + _PrimaryOcclusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _PrimaryBumpScale ("'Normal Strength' {}", Float) = 1 + + // Secondary Textures + [Toggle(_SECONDARY_TRIPLANAR_ON)] + _SecondaryTextures ("'Secondary Textures' {Feature:{Color:1, Hide:{_SecondaryPhysicalProperties}}}", Float) = 0 + _SecondaryColor ("'Tint' {}", Color) = (1,1,1,1) + _SecondaryMainTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _SecondaryMainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _SecondaryMaterialMap ("'Metal(R) AO(G) Spec(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_SecondaryMainTex}", 2D) = "white" {} + _SecondaryBumpMap ("'Normals' {Visualize:{NRM}, Parent:_SecondaryMainTex}", 2D) = "bump" {} + _SecondaryColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Secondary Properties + _SecondaryPhysicalProperties ("'Secondary Properties' {Section:{Color:1}}", Float) = 0 + _SecondaryMetallic ("'Metallic' {Min:0, Max:1}", Float) = 1 + _SecondarySpecularity ("'Specularity' {Min:0, Max:1}", Float) = 1 + _SecondarySpecularTint ("'Specular Tint' {Min:0, Max:1}", Float) = 0 + _SecondaryRoughness ("'Roughness' {Min:0, Max:1}", Float) = 1 + _SecondaryOcclusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _SecondaryBumpScale ("'Normal Strength' {}", Float) = 1 + + // Tertiary Textures + [Toggle(_TERTIARY_TRIPLANAR_ON)] + _TertiaryTextures ("'Tertiary Textures' {Feature:{Color:2, Hide:{_TertiaryPhysicalProperties}}}", Float) = 0 + _TertiaryColor ("'Tint' {}", Color) = (1,1,1,1) + _TertiaryMainTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _TertiaryMainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _TertiaryMaterialMap ("'Metal(R) AO(G) Spec(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_TertiaryMainTex}", 2D) = "white" {} + _TertiaryBumpMap ("'Normals' {Visualize:{NRM}, Parent:_TertiaryMainTex}", 2D) = "bump" {} + _TertiaryColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Tertiary Properties + _TertiaryPhysicalProperties ("'Tertiary Properties' {Section:{Color:2}}", Float) = 0 + _TertiaryMetallic ("'Metallic' {Min:0, Max:1}", Float) = 1 + _TertiarySpecularity ("'Specularity' {Min:0, Max:1}", Float) = 1 + _TertiarySpecularTint ("'Specular Tint' {Min:0, Max:1}", Float) = 0 + _TertiaryRoughness ("'Roughness' {Min:0, Max:1}", Float) = 1 + _TertiaryOcclusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _TertiaryBumpScale ("'Normal Strength' {}", Float) = 1 + + // Quaternary Textures + [Toggle(_QUATERNARY_TRIPLANAR_ON)] + _QuaternaryTextures ("'Quaternary Textures' {Feature:{Color:3, Hide:{_QuaternaryPhysicalProperties}}}", Float) = 0 + _QuaternaryColor ("'Tint' {}", Color) = (1,1,1,1) + _QuaternaryMainTex ("'Base Color(RGB) Rough(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _QuaternaryMainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _QuaternaryMaterialMap ("'Metal(R) AO(G) Spec(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_QuaternaryMainTex}", 2D) = "white" {} + _QuaternaryBumpMap ("'Normals' {Visualize:{NRM}, Parent:_QuaternaryMainTex}", 2D) = "bump" {} + _QuaternaryColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Quaternary Properties + _QuaternaryPhysicalProperties ("'Quaternary Properties' {Section:{Color:3}}", Float) = 0 + _QuaternaryMetallic ("'Metallic' {Min:0, Max:1}", Float) = 0 + _QuaternarySpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _QuaternarySpecularTint ("'Specular Tint' {Min:0, Max:1}", Float) = 0 + _QuaternaryRoughness ("'Roughness' {Min:0, Max:1}", Float) = 1 + _QuaternaryOcclusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _QuaternaryBumpScale ("'Normal Strength' {}", Float) = 1 + + // Triplanar + _TriplanarProperties ("'Triplanar' {Section:{Color:4}}", Float) = 0 + [Toggle(_TRIPLANARMODE_WORLD)] + _TriplanarMode ("'Mode' {Dropdown:{Object:{}, World:{}}}", Float) = 1 + _TriplanarBlendSharpness ("'Sharpness' {Min:1, Max:50}", Float) = 2 + + // Rim Emission + [Toggle(_RIM_ON)] + _Rim ("'Rim Emission' {Feature:{Color:11}}", Float) = 0 + [HDR] + _RimColor ("'Tint' {}", Color) = (1,1,1) + [Gamma] + _RimWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + [Gamma] + _RimBias ("'Fill' {Min:0, Max:1}", Float) = 0 + _RimPower ("'Falloff' {Min:0.01}", Float) = 4 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _Lightmapping ("'GI' {LightmapEmissionProperty:{}}", Float) = 1 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} + +SubShader { + Tags { + "Queue" = "Geometry" + "RenderType" = "Opaque" + //"DisableBatching" = "LODFading" + } + LOD 400 + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + Blend [_SrcBlend] [_DstBlend] + ZWrite [_ZWrite] + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _TRIPLANARMODE_WORLD + #pragma shader_feature _SECONDARY_TRIPLANAR_ON + #pragma shader_feature _TERTIARY_TRIPLANAR_ON + #pragma shader_feature _QUATERNARY_TRIPLANAR_ON + #pragma shader_feature _RIM_ON + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Shaders/Definition/TriPlanar.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend [_SrcBlend] One + ZWrite Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _TRIPLANARMODE_WORLD + #pragma shader_feature _SECONDARY_TRIPLANAR_ON + #pragma shader_feature _TERTIARY_TRIPLANAR_ON + #pragma shader_feature _QUATERNARY_TRIPLANAR_ON + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + + #include "Assets/Alloy/Shaders/Definition/TriPlanar.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature _TRIPLANARMODE_WORLD + #pragma shader_feature _SECONDARY_TRIPLANAR_ON + #pragma shader_feature _TERTIARY_TRIPLANAR_ON + #pragma shader_feature _QUATERNARY_TRIPLANAR_ON + + #pragma multi_compile_shadowcaster + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_SHADOWCASTER + + #include "Assets/Alloy/Shaders/Definition/TriPlanar.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } + + Pass { + Name "DEFERRED" + Tags { "LightMode" = "Deferred" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _TRIPLANARMODE_WORLD + #pragma shader_feature _SECONDARY_TRIPLANAR_ON + #pragma shader_feature _TERTIARY_TRIPLANAR_ON + #pragma shader_feature _QUATERNARY_TRIPLANAR_ON + #pragma shader_feature _RIM_ON + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_prepassfinal + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_DEFERRED + + #include "Assets/Alloy/Shaders/Definition/TriPlanar.cginc" + #include "Assets/Alloy/Shaders/Forward/Gbuffer.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _TRIPLANARMODE_WORLD + #pragma shader_feature _SECONDARY_TRIPLANAR_ON + #pragma shader_feature _TERTIARY_TRIPLANAR_ON + #pragma shader_feature _QUATERNARY_TRIPLANAR_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Shaders/Definition/TriPlanar.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +FallBack "VertexLit" +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Shaders/3.0/Specialist/TriPlanar.shader.meta b/Assets/Alloy/Shaders/3.0/Specialist/TriPlanar.shader.meta new file mode 100644 index 0000000..a186036 --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Specialist/TriPlanar.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 2b91f6aff1a953b4687dfa34aeb0fce7 +timeCreated: 1431268696 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/3.0/Specialist/Vertex Blend.shader b/Assets/Alloy/Shaders/3.0/Specialist/Vertex Blend.shader new file mode 100644 index 0000000..483fdc3 --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Specialist/Vertex Blend.shader @@ -0,0 +1,352 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Vertex Blend" { +Properties { + // Global Settings + _Mode ("'Rendering Mode' {RenderingMode:{Opaque:{_Cutoff}, Cutout:{}, Fade:{_Cutoff}, Transparent:{_Cutoff}}}", Float) = 0 + _SrcBlend ("__src", Float) = 0 + _DstBlend ("__dst", Float) = 0 + _ZWrite ("__zw", Float) = 1 + [LM_TransparencyCutOff] + _Cutoff ("'Opacity Cutoff' {Min:0, Max:1}", Float) = 0.5 + [Toggle(EFFECT_BUMP)] + _HasBumpMap ("'Normals Source' {Dropdown:{VertexNormals:{_Normal0,_SplatBumpScale0,_Normal1,_SplatBumpScale1,_Normal2,_SplatBumpScale2,_Normal3,_SplatBumpScale3,_DetailNormalMap,_DetailNormalMapScale,_WetNormalMap,_WetNormalMapScale}, NormalMaps:{}}}", Float) = 1 + [Toggle(_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A)] + _MainRoughnessSource ("'Roughness Source' {Dropdown:{PackedMapAlpha:{}, BaseColorAlpha:{_MaterialMap0,_SplatOcclusion0,_MaterialMap1,_SplatOcclusion1,_MaterialMap2,_SplatOcclusion2,_MaterialMap3,_SplatOcclusion3}}}", Float) = 0 + + // Red Splat + _Splat0Textures ("'Red Splat' {Section:{Color:{150,0,0}}}", Float) = 0 + _Splat0Tint ("'Tint' {}", Color) = (1,1,1,1) + _Splat0 ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _Splat0Velocity ("Scroll", Vector) = (0,0,0,0) + _Splat0UV ("UV Set", Float) = 0 + _MaterialMap0 ("'Metal(R) AO(G) Spec(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_Splat0}", 2D) = "white" {} + _Normal0 ("'Normals' {Visualize:{NRM}, Parent:_Splat0}", 2D) = "bump" {} + + // Red Splat Properties + _Splat0PhysicalProperties("'Red Splat Properties' {Section:{Color:{150,0,0}}}", Float) = 0 + _Metallic0 ("'Metallic' {Min:0, Max:1}", Float) = 0.0 + _SplatSpecularity0 ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _SplatSpecularTint0 ("'Specular Tint' {Min:0, Max:1}", Float) = 0.0 + _SplatRoughness0 ("'Roughness' {Min:0, Max:1}", Float) = 1.0 + _SplatOcclusion0 ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _SplatBumpScale0 ("'Normal Strength' {}", Float) = 1 + + // Green Splat + _Splat1Textures ("'Green Splat' {Section:{Color:{0,149,0}}}", Float) = 0 + _Splat1Tint ("'Tint' {}", Color) = (1,1,1,1) + _Splat1 ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _Splat1Velocity ("Scroll", Vector) = (0,0,0,0) + _Splat1UV ("UV Set", Float) = 0 + _MaterialMap1 ("'Metal(R) AO(G) Spec(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_Splat1}", 2D) = "white" {} + _Normal1 ("'Normals' {Visualize:{NRM}, Parent:_Splat1}", 2D) = "bump" {} + + // Green Splat Properties + _Splat1PhysicalProperties("'Green Splat Properties' {Section:{Color:{0,149,0}}}", Float) = 0 + _Metallic1 ("'Metallic' {Min:0, Max:1}", Float) = 0.0 + _SplatSpecularity1 ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _SplatSpecularTint1 ("'Specular Tint' {Min:0, Max:1}", Float) = 0.0 + _SplatRoughness1 ("'Roughness' {Min:0, Max:1}", Float) = 1.0 + _SplatOcclusion1 ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _SplatBumpScale1 ("'Normal Strength' {}", Float) = 1 + + // Blue Splat + _Splat2Textures ("'Blue Splat' {Section:{Color:{11,0,148}}}", Float) = 0 + _Splat2Tint ("'Tint' {}", Color) = (1,1,1,1) + _Splat2 ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _Splat2Velocity ("Scroll", Vector) = (0,0,0,0) + _Splat2UV ("UV Set", Float) = 0 + _MaterialMap2 ("'Metal(R) AO(G) Spec(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_Splat2}", 2D) = "white" {} + _Normal2 ("'Normals' {Visualize:{NRM}, Parent:_Splat2}", 2D) = "bump" {} + + // Blue Splat Properties + _Splat2PhysicalProperties("'Blue Splat Properties' {Section:{Color:{11,0,148}}}", Float) = 0 + _Metallic2 ("'Metallic' {Min:0, Max:1}", Float) = 0.0 + _SplatSpecularity2 ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _SplatSpecularTint2 ("'Specular Tint' {Min:0, Max:1}", Float) = 0.0 + _SplatRoughness2 ("'Roughness' {Min:0, Max:1}", Float) = 1.0 + _SplatOcclusion2 ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _SplatBumpScale2 ("'Normal Strength' {}", Float) = 1 + + // Alpha Splat + [Toggle(_SPECGLOSSMAP)] + _Splat3Textures("'Alpha Splat' {Feature:{Color:{0,0,0},Hide:{_Splat3PhysicalProperties}}}", Float) = 0 + _Splat3Tint ("'Tint' {}", Color) = (1,1,1,1) + _Splat3 ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _Splat3Velocity ("Scroll", Vector) = (0,0,0,0) + _Splat3UV ("UV Set", Float) = 0 + _MaterialMap3 ("'Metal(R) AO(G) Spec(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_Splat3}", 2D) = "white" {} + _Normal3 ("'Normals' {Visualize:{NRM}, Parent:_Splat3}", 2D) = "bump" {} + + // Alpha Splat Properties + _Splat3PhysicalProperties("'Alpha Splat Properties' {Section:{Color:{0,0,0}}}", Float) = 0 + _Metallic3 ("'Metallic' {Min:0, Max:1}", Float) = 0.0 + _SplatSpecularity3 ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _SplatSpecularTint3 ("'Specular Tint' {Min:0, Max:1}", Float) = 0.0 + _SplatRoughness3 ("'Roughness' {Min:0, Max:1}", Float) = 1.0 + _SplatOcclusion3 ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _SplatBumpScale3 ("'Normal Strength' {}", Float) = 1 + + // Triplanar + [Toggle(_METALLICGLOSSMAP)] + _TriplanarProperties ("'Triplanar' {Feature:{Color:4}}", Float) = 0 + [Toggle(_TRIPLANARMODE_WORLD)] + _TriplanarMode ("'Mode' {Dropdown:{Object:{}, World:{}}}", Float) = 1 + _TriplanarBlendSharpness ("'Sharpness' {Min:1, Max:50}", Float) = 2 + + // AO2 + [Toggle(_AO2_ON)] + _AO2 ("'AO2' {Feature:{Color:6}}", Float) = 0 + _Ao2Map ("'AO2(G)' {Visualize:{RGB}}", 2D) = "white" {} + _Ao2MapUV ("UV Set", Float) = 1 + _Ao2Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + + // Detail + [Toggle(_DETAIL_MULX2)] + _DetailT ("'Detail' {Feature:{Color:7}}", Float) = 0 + [Toggle(_NORMALMAP)] + _DetailMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_DetailMask}}}", Float) = 0 + _DetailMask ("'Mask(A)' {Visualize:{A}, Parent:_MainTex}", 2D) = "white" {} + _DetailMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + [Enum(Mul, 0, MulX2, 1)] + _DetailMode ("'Color Mode' {Dropdown:{Mul:{}, MulX2:{}}}", Float) = 0 + _DetailAlbedoMap ("'Color(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _DetailAlbedoMapVelocity ("Scroll", Vector) = (0,0,0,0) + _DetailAlbedoMapUV ("UV Set", Float) = 0 + _DetailNormalMap ("'Normals' {Visualize:{NRM}, Parent:_DetailAlbedoMap}", 2D) = "bump" {} + _DetailWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DetailNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Decal + [Toggle(_DECAL_ON)] + _Decal ("'Decal' {Feature:{Color:9}}", Float) = 0 + _DecalColor ("'Tint' {}", Color) = (1,1,1,1) + _DecalTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "black" {} + _DecalTexUV ("UV Set", Float) = 0 + _DecalWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DecalSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _DecalAlphaVertexTint ("'Vertex Alpha Tint' {Min:0, Max:1}", Float) = 0 + + // Wetness + [Toggle(_WETNESS_ON)] + _WetnessProperties ("'Wetness' {Feature:{Color:13}}", Float) = 0 + [Toggle(_WETMASKSOURCE_VERTEXCOLORALPHA)] + _WetMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_WetMask}}}", Float) = 0 + _WetMask ("'Mask(A)' {Visualize:{A}}", 2D) = "white" {} + _WetMaskVelocity ("Scroll", Vector) = (0,0,0,0) + _WetMaskUV ("UV Set", Float) = 0 + _WetMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + _WetTint ("'Tint' {}", Color) = (1,1,1,1) + _WetNormalMap ("'Normals' {Visualize:{NRM}}", 2D) = "bump" {} + _WetNormalMapVelocity ("Scroll", Vector) = (0,0,0,0) + _WetNormalMapUV ("UV Set", Float) = 0 + _WetWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _WetRoughness ("'Roughness' {Min:0, Max:1}", Float) = 0.2 + _WetNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _Lightmapping ("'GI' {LightmapEmissionProperty:{}}", Float) = 1 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} + +SubShader { + Tags { + "RenderType" = "Opaque" + "PerformanceChecks" = "False" + //"DisableBatching" = "LODFading" + } + LOD 300 + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + Blend [_SrcBlend] [_DstBlend] + ZWrite [_ZWrite] + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _SPECGLOSSMAP + #pragma shader_feature _METALLICGLOSSMAP + #pragma shader_feature _TRIPLANARMODE_WORLD + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _DECAL_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Shaders/Definition/VertexBlend.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend [_SrcBlend] One + ZWrite Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _SPECGLOSSMAP + #pragma shader_feature _METALLICGLOSSMAP + #pragma shader_feature _TRIPLANARMODE_WORLD + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _DECAL_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + + #include "Assets/Alloy/Shaders/Definition/VertexBlend.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature _SPECGLOSSMAP + #pragma shader_feature _METALLICGLOSSMAP + #pragma shader_feature _TRIPLANARMODE_WORLD + + #pragma multi_compile_shadowcaster + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_SHADOWCASTER + + #include "Assets/Alloy/Shaders/Definition/VertexBlend.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } + + Pass { + Name "DEFERRED" + Tags { "LightMode" = "Deferred" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _SPECGLOSSMAP + #pragma shader_feature _METALLICGLOSSMAP + #pragma shader_feature _TRIPLANARMODE_WORLD + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _DECAL_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_prepassfinal + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_DEFERRED + + #include "Assets/Alloy/Shaders/Definition/VertexBlend.cginc" + #include "Assets/Alloy/Shaders/Forward/Gbuffer.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _SPECGLOSSMAP + #pragma shader_feature _METALLICGLOSSMAP + #pragma shader_feature _TRIPLANARMODE_WORLD + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _DECAL_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Shaders/Definition/VertexBlend.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +Fallback "VertexLit" +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Shaders/3.0/Specialist/Vertex Blend.shader.meta b/Assets/Alloy/Shaders/3.0/Specialist/Vertex Blend.shader.meta new file mode 100644 index 0000000..c47abb4 --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Specialist/Vertex Blend.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 3d91c8b84edaa51408e097e8e8464303 +timeCreated: 1472697217 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/3.0/Specialist/Weighted Blend.shader b/Assets/Alloy/Shaders/3.0/Specialist/Weighted Blend.shader new file mode 100644 index 0000000..4ab6083 --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Specialist/Weighted Blend.shader @@ -0,0 +1,406 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Weighted Blend" { +Properties { + // Global Settings + _Mode ("'Rendering Mode' {RenderingMode:{Opaque:{_Cutoff}, Cutout:{}, Fade:{_Cutoff}, Transparent:{_Cutoff}}}", Float) = 0 + _SrcBlend ("__src", Float) = 0 + _DstBlend ("__dst", Float) = 0 + _ZWrite ("__zw", Float) = 1 + [LM_TransparencyCutOff] + _Cutoff ("'Opacity Cutoff' {Min:0, Max:1}", Float) = 0.5 + [Toggle(EFFECT_BUMP)] + _HasBumpMap ("'Normals Source' {Dropdown:{VertexNormals:{_BumpMap,_BumpScale,_DetailNormalMap,_DetailNormalMapScale,_WetNormalMap,_WetNormalMapScale,_BumpMap2,_BumpScale2}, NormalMaps:{}}}", Float) = 1 + [Toggle(_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A)] + _MainRoughnessSource ("'Roughness Source' {Dropdown:{PackedMapAlpha:{}, BaseColorAlpha:{_SpecTex,_Occlusion,_MaterialMap2,_Occlusion2}}}", Float) = 0 + + // Main Textures + _MainTextures ("'Main Textures' {Section:{Color:0}}", Float) = 0 + [LM_Albedo] [LM_Transparency] + _Color ("'Tint' {}", Color) = (1,1,1,1) + [LM_MasterTilingOffset] [LM_Albedo] + _MainTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _MainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _MainTexUV ("UV Set", Float) = 0 + [LM_Metallic] + _SpecTex ("'Metal(R) AO(G) Spec(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_MainTex}", 2D) = "white" {} + [LM_NormalMap] + _BumpMap ("'Normals' {Visualize:{NRM}, Parent:_MainTex}", 2D) = "bump" {} + _BaseColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Main Properties + _MainPhysicalProperties ("'Main Properties' {Section:{Color:1}}", Float) = 0 + [LM_Metallic] + _Metal ("'Metallic' {Min:0, Max:1}", Float) = 1 + _Specularity ("'Specularity' {Min:0, Max:1}", Float) = 1 + _SpecularTint ("'Specular Tint' {Min:0, Max:1}", Float) = 0 + _Roughness ("'Roughness' {Min:0, Max:1}", Float) = 1 + _Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _BumpScale ("'Normal Strength' {}", Float) = 1 + + // Parallax + [Toggle(_PARALLAXMAP)] + _ParallaxT ("'Parallax' {Feature:{Color:5}}", Float) = 0 + [Toggle(_BUMPMODE_POM)] + _BumpMode ("'Mode' {Dropdown:{Parallax:{_MinSamples, _MaxSamples}, POM:{}}}", Float) = 0 + _ParallaxMap ("'Heightmap(G)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "black" {} + _Parallax ("'Height' {Min:0, Max:0.08}", Float) = 0.02 + _MinSamples ("'Min Samples' {Min:1}", Float) = 4 + _MaxSamples ("'Max Samples' {Min:1}", Float) = 20 + + // AO2 + [Toggle(_AO2_ON)] + _AO2 ("'AO2' {Feature:{Color:6}}", Float) = 0 + _Ao2Map ("'AO2(G)' {Visualize:{RGB}}", 2D) = "white" {} + _Ao2MapUV ("UV Set", Float) = 1 + _Ao2Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + + // Detail + [Toggle(_DETAIL_MULX2)] + _DetailT ("'Detail' {Feature:{Color:7}}", Float) = 0 + [Toggle(_NORMALMAP)] + _DetailMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_DetailMask}}}", Float) = 0 + _DetailMask ("'Mask(A)' {Visualize:{A}, Parent:_MainTex}", 2D) = "white" {} + _DetailMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + [Enum(Mul, 0, MulX2, 1)] + _DetailMode ("'Color Mode' {Dropdown:{Mul:{}, MulX2:{}}}", Float) = 0 + _DetailAlbedoMap ("'Color(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _DetailAlbedoMapVelocity ("Scroll", Vector) = (0,0,0,0) + _DetailAlbedoMapUV ("UV Set", Float) = 0 + _DetailNormalMap ("'Normals' {Visualize:{NRM}, Parent:_DetailAlbedoMap}", 2D) = "bump" {} + _DetailWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DetailNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Team Color + [Toggle(_TEAMCOLOR_ON)] + _TeamColor ("'Team Color' {Feature:{Color:8}}", Float) = 0 + [Enum(Masks, 0, Tint, 1)] + _TeamColorMasksAsTint ("'Texture Mode' {Dropdown:{Masks:{}, Tint:{_TeamColorMasks, _TeamColor0, _TeamColor1, _TeamColor2, _TeamColor3}}}", Float) = 0 + _TeamColorMaskMap ("'Masks(RGBA)' {Visualize:{R, G, B, A, RGB}, Parent:_MainTex}", 2D) = "black" {} + _TeamColorMasks ("'Channels' {Vector:Channels}", Vector) = (1,1,1,0) + _TeamColor0 ("'Tint R' {}", Color) = (1,0,0) + _TeamColor1 ("'Tint G' {}", Color) = (0,1,0) + _TeamColor2 ("'Tint B' {}", Color) = (0,0,1) + _TeamColor3 ("'Tint A' {}", Color) = (0.5,0.5,0.5) + + // Decal + [Toggle(_DECAL_ON)] + _Decal ("'Decal' {Feature:{Color:9}}", Float) = 0 + _DecalColor ("'Tint' {}", Color) = (1,1,1,1) + _DecalTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "black" {} + _DecalTexUV ("UV Set", Float) = 0 + _DecalWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DecalSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _DecalAlphaVertexTint ("'Vertex Alpha Tint' {Min:0, Max:1}", Float) = 0 + + // Emission + [Toggle(_EMISSION)] + _Emission ("'Emission' {Feature:{Color:10}}", Float) = 0 + [LM_Emission] + [HDR] + _EmissionColor ("'Tint' {}", Color) = (1,1,1) + [LM_Emission] + _EmissionMap ("'Mask(RGB)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "white" {} + _IncandescenceMap ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _IncandescenceMapVelocity ("Scroll", Vector) = (0,0,0,0) + _IncandescenceMapUV ("UV Set", Float) = 0 + [Gamma] + _EmissionWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + + // Rim Emission + [Toggle(_RIM_ON)] + _Rim ("'Rim Emission' {Feature:{Color:11}}", Float) = 0 + [HDR] + _RimColor ("'Tint' {}", Color) = (1,1,1) + _RimTex ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _RimTexVelocity ("Scroll", Vector) = (0,0,0,0) + _RimTexUV ("UV Set", Float) = 0 + [Gamma] + _RimWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + [Gamma] + _RimBias ("'Fill' {Min:0, Max:1}", Float) = 0 + _RimPower ("'Falloff' {Min:0.01}", Float) = 4 + + // Dissolve + [Toggle(_DISSOLVE_ON)] + _Dissolve ("'Dissolve' {Feature:{Color:12}}", Float) = 0 + [HDR] + _DissolveGlowColor ("'Glow Tint' {}", Color) = (1,1,1,1) + _DissolveTex ("'Glow Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _DissolveTexUV ("UV Set", Float) = 0 + _DissolveCutoff ("'Cutoff' {Min:0, Max:1}", Float) = 0 + [Gamma] + _DissolveGlowWeight ("'Glow Weight' {Min:0, Max:1}", Float) = 1 + _DissolveEdgeWidth ("'Glow Width' {Min:0, Max:1}", Float) = 0.01 + + // Wetness + [Toggle(_WETNESS_ON)] + _WetnessProperties ("'Wetness' {Feature:{Color:13}}", Float) = 0 + [Toggle(_WETMASKSOURCE_VERTEXCOLORALPHA)] + _WetMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_WetMask}}}", Float) = 0 + _WetMask ("'Mask(A)' {Visualize:{A}}", 2D) = "white" {} + _WetMaskVelocity ("Scroll", Vector) = (0,0,0,0) + _WetMaskUV ("UV Set", Float) = 0 + _WetMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + _WetTint ("'Tint' {}", Color) = (1,1,1,1) + _WetNormalMap ("'Normals' {Visualize:{NRM}}", 2D) = "bump" {} + _WetNormalMapVelocity ("Scroll", Vector) = (0,0,0,0) + _WetNormalMapUV ("UV Set", Float) = 0 + _WetWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _WetRoughness ("'Roughness' {Min:0, Max:1}", Float) = 0.2 + _WetNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Weighted Blend + _WeightedBlendProperties ("'Weighted Blend' {Section:{Color:14}}", Float) = 0 + _BlendMap ("'Heightmap(G)' {Visualize:{RGB}}", 2D) = "white" {} + _BlendMapUV ("UV Set", Float) = 0 + _BlendScale ("'Weight' {Min:0, Max:1}", Float) = 1.0 + _BlendCutoff ("'Cutoff' {Min:0, Max:1}", Float) = 0.25 + _Blend ("'Blend' {Min:0.0001, Max:1}", Float) = 0.1 + _BlendAlphaVertexTint ("'Vertex Alpha Tint' {Min:0, Max:1}", Float) = 0 + + // Secondary Textures + _SecondaryTextures ("'Secondary Textures' {Section:{Color:15}}", Float) = 0 + _Color2 ("'Tint' {}", Color) = (1,1,1,1) + _MainTex2 ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _MainTex2Velocity ("Scroll", Vector) = (0,0,0,0) + _MainTex2UV ("UV Set", Float) = 0 + _MaterialMap2 ("'Metal(R) AO(G) Spec(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_MainTex2}", 2D) = "white" {} + _BumpMap2 ("'Normals' {Visualize:{NRM}, Parent:_MainTex2}", 2D) = "bump" {} + _BaseColorVertexTint2 ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Secondary Properties + _SecondaryPhysicalProperties ("'Secondary Properties' {Section:{Color:16}}", Float) = 0 + _Metallic2 ("'Metallic' {Min:0, Max:1}", Float) = 1 + _Specularity2 ("'Specularity' {Min:0, Max:1}", Float) = 1 + _SpecularTint2 ("'Specular Tint' {Min:0, Max:1}", Float) = 0 + _Roughness2 ("'Roughness' {Min:0, Max:1}", Float) = 1 + _Occlusion2 ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _BumpScale2 ("'Normal Strength' {}", Float) = 1 + + // Secondary Emission + [Toggle(_EMISSION2_ON)] + _Emission2 ("'Secondary Emission' {Feature:{Color:17}}", Float) = 0 + [HDR] + _Emission2Color ("'Tint' {}", Color) = (1,1,1) + _EmissionMap2 ("'Mask(RGB)' {Visualize:{RGB}, Parent:_MainTex2}", 2D) = "white" {} + _IncandescenceMap2 ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _IncandescenceMap2Velocity ("Scroll", Vector) = (0,0,0,0) + _IncandescenceMap2UV ("UV Set", Float) = 0 + [Gamma] + _Emission2Weight ("'Weight' {Min:0, Max:1}", Float) = 1 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _Lightmapping ("'GI' {LightmapEmissionProperty:{}}", Float) = 1 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} + +SubShader { + Tags { + "RenderType" = "Opaque" + "PerformanceChecks" = "False" + //"DisableBatching" = "LODFading" + } + LOD 300 + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + Blend [_SrcBlend] [_DstBlend] + ZWrite [_ZWrite] + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _EMISSION2_ON + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Shaders/Definition/WeightedBlend.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend [_SrcBlend] One + ZWrite Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + + #include "Assets/Alloy/Shaders/Definition/WeightedBlend.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _DISSOLVE_ON + + #pragma multi_compile_shadowcaster + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_SHADOWCASTER + + #include "Assets/Alloy/Shaders/Definition/WeightedBlend.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } + + Pass { + Name "DEFERRED" + Tags { "LightMode" = "Deferred" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _EMISSION2_ON + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_prepassfinal + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_DEFERRED + + #include "Assets/Alloy/Shaders/Definition/WeightedBlend.cginc" + #include "Assets/Alloy/Shaders/Forward/Gbuffer.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _EMISSION2_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Shaders/Definition/WeightedBlend.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +FallBack "VertexLit" +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Shaders/3.0/Specialist/Weighted Blend.shader.meta b/Assets/Alloy/Shaders/3.0/Specialist/Weighted Blend.shader.meta new file mode 100644 index 0000000..4b8fb05 --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/Specialist/Weighted Blend.shader.meta @@ -0,0 +1,27 @@ +fileFormatVersion: 2 +guid: 390afd9107179ea41ac85504d12ec180 +ShaderImporter: + defaultTextures: + - _MainTex: {instanceID: 0} + - _SpecTex: {instanceID: 0} + - _BumpMap: {instanceID: 0} + - _ParallaxMap: {instanceID: 0} + - _DetailMask: {instanceID: 0} + - _DetailAlbedoMap: {instanceID: 0} + - _DetailMaterialMap: {fileID: 2800000, guid: 2b77d5cb601375f4ba50c6194c126e59, + type: 3} + - _DetailNormalMap: {instanceID: 0} + - _TeamColorMaskMap: {instanceID: 0} + - _EmissionMap: {instanceID: 0} + - _IncandescenceMap: {instanceID: 0} + - _RimTex: {instanceID: 0} + - _DissolveTex: {instanceID: 0} + - _BlendMap: {instanceID: 0} + - _MainTex2: {instanceID: 0} + - _MaterialMap2: {instanceID: 0} + - _BumpMap2: {instanceID: 0} + - _EmissionMap2: {instanceID: 0} + - _IncandescenceMap2: {instanceID: 0} + - _RimTex2: {instanceID: 0} + userData: + assetBundleName: diff --git a/Assets/Alloy/Shaders/3.0/VisualEffects.meta b/Assets/Alloy/Shaders/3.0/VisualEffects.meta new file mode 100644 index 0000000..bde5283 --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/VisualEffects.meta @@ -0,0 +1,6 @@ +fileFormatVersion: 2 +guid: 3804da1ec747999468ebd274ed567567 +folderAsset: yes +DefaultImporter: + userData: + assetBundleName: diff --git a/Assets/Alloy/Shaders/3.0/VisualEffects/Particle Add.shader b/Assets/Alloy/Shaders/3.0/VisualEffects/Particle Add.shader new file mode 100644 index 0000000..0323db7 --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/VisualEffects/Particle Add.shader @@ -0,0 +1,87 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Particles/Additive" { +Properties { + // Particle Properties + _ParticleProperties ("'Particle Textures' {Section:{Color:0}}", Float) = 0 + [HDR] + _TintColor ("'Tint' {}", Color) = (0.5,0.5,0.5,0.5) + [LM_MasterTilingOffset] [LM_Albedo] + _MainTex ("'Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _MainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _MainTexSpin ("Spin", Float) = 0 + [Gamma] + _TintWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _InvFade ("'Soft Particles Factor' {Min:0.01, Max:3}", Float) = 1 + + // Particle Effects Properties + [Toggle(_PARTICLE_EFFECTS_ON)] + _ParticleEffects ("'Particle Effects' {Feature:{Color:1}}", Float) = 0 + _ParticleEffectMask1 ("'Mask 1(RGBA)' {Visualize:{RGB, A}}", 2D) = "white" {} + _ParticleEffectMask1Velocity ("Scroll", Vector) = (0,0,0,0) + _ParticleEffectMask1Spin ("Spin", Float) = 0 + _ParticleEffectMask2 ("'Mask 2(RGBA)' {Visualize:{RGB, A}}", 2D) = "white" {} + _ParticleEffectMask2Velocity ("Scroll", Vector) = (0,0,0,0) + _ParticleEffectMask2Spin ("Spin", Float) = 0 + + // Rim Fade Properties + [Toggle(_RIM_FADE_ON)] + _RimFadeProperties ("'Rim Fade' {Feature:{Color:2}}", Float) = 0 + [Gamma] + _RimFadeWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _RimFadePower ("'Falloff' {Min:0.01}", Float) = 4 + + // Distance Fade Properties + [Toggle(_DISTANCE_FADE_ON)] + _DistanceFadeProperties ("'Distance Fade' {Feature:{Color:3}}", Float) = 0 + _DistanceFadeNearFadeCutoff ("'Near Fade Cutoff' {Min:0}", Float) = 1 + _DistanceFadeRange ("'Range' {Min:0.5}", Float) = 1 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 +} + +Category { + Tags { + "Queue" = "Transparent" + "IgnoreProjector" = "True" + "RenderType" = "Transparent" + "PreviewType" = "Plane" + } + Blend SrcAlpha One + AlphaTest Greater .01 + ColorMask RGB + Cull Off Lighting Off ZWrite Off + + SubShader { + Pass { + CGPROGRAM + #pragma target 3.0 + + #pragma shader_feature _PARTICLE_EFFECTS_ON + #pragma shader_feature _RIM_FADE_ON + #pragma shader_feature _DISTANCE_FADE_ON + + #pragma multi_compile_particles + #pragma multi_compile_fog + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #include "Assets/Alloy/Shaders/Framework/Particle.cginc" + + half4 aMainFragmentShader( + AFragmentInput i) : SV_Target + { + i.color.a *= aFadeParticle(i); + return aParticleOutputAdd(i, 2.0f * i.color * _TintColor * aParticleEffects(i)); + } + ENDCG + } + } +} +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Shaders/3.0/VisualEffects/Particle Add.shader.meta b/Assets/Alloy/Shaders/3.0/VisualEffects/Particle Add.shader.meta new file mode 100644 index 0000000..98b94ae --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/VisualEffects/Particle Add.shader.meta @@ -0,0 +1,6 @@ +fileFormatVersion: 2 +guid: 4a113e75fd13ca840855749134da4d5a +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: diff --git a/Assets/Alloy/Shaders/3.0/VisualEffects/Particle AddMultiply.shader b/Assets/Alloy/Shaders/3.0/VisualEffects/Particle AddMultiply.shader new file mode 100644 index 0000000..c2cb413 --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/VisualEffects/Particle AddMultiply.shader @@ -0,0 +1,92 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Particles/~Additive-Multiply" { +Properties { + // Particle Properties + _ParticleProperties ("'Particle Textures' {Section:{Color:0}}", Float) = 0 + [HDR] + _TintColor ("'Tint' {}", Color) = (0.5,0.5,0.5,0.5) + [LM_MasterTilingOffset] [LM_Albedo] + _MainTex ("'Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _MainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _MainTexSpin ("Spin", Float) = 0 + [Gamma] + _TintWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _InvFade ("'Soft Particles Factor' {Min:0.01, Max:3}", Float) = 1 + + // Particle Effects Properties + [Toggle(_PARTICLE_EFFECTS_ON)] + _ParticleEffects ("'Particle Effects' {Feature:{Color:1}}", Float) = 0 + _ParticleEffectMask1 ("'Mask 1(RGBA)' {Visualize:{RGB, A}}", 2D) = "white" {} + _ParticleEffectMask1Velocity ("Scroll", Vector) = (0,0,0,0) + _ParticleEffectMask1Spin ("Spin", Float) = 0 + _ParticleEffectMask2 ("'Mask 2(RGBA)' {Visualize:{RGB, A}}", 2D) = "white" {} + _ParticleEffectMask2Velocity ("Scroll", Vector) = (0,0,0,0) + _ParticleEffectMask2Spin ("Spin", Float) = 0 + + // Rim Fade Properties + [Toggle(_RIM_FADE_ON)] + _RimFadeProperties ("'Rim Fade' {Feature:{Color:2}}", Float) = 0 + [Gamma] + _RimFadeWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _RimFadePower ("'Falloff' {Min:0.01}", Float) = 4 + + // Distance Fade Properties + [Toggle(_DISTANCE_FADE_ON)] + _DistanceFadeProperties ("'Distance Fade' {Feature:{Color:3}}", Float) = 0 + _DistanceFadeNearFadeCutoff ("'Near Fade Cutoff' {Min:0}", Float) = 1 + _DistanceFadeRange ("'Range' {Min:0.5}", Float) = 1 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 +} + +Category { + Tags { + "Queue" = "Transparent" + "IgnoreProjector" = "True" + "RenderType" = "Transparent" + "PreviewType" = "Plane" + } + Blend One OneMinusSrcAlpha + ColorMask RGB + Cull Off Lighting Off ZWrite Off + + SubShader { + Pass { + CGPROGRAM + #pragma target 3.0 + + #pragma shader_feature _PARTICLE_EFFECTS_ON + #pragma shader_feature _RIM_FADE_ON + #pragma shader_feature _DISTANCE_FADE_ON + + #pragma multi_compile_particles + #pragma multi_compile_fog + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #include "Assets/Alloy/Shaders/Framework/Particle.cginc" + + half4 aMainFragmentShader( + AFragmentInput i) : SV_Target + { + i.color *= aFadeParticle(i); + + half4 col; + half4 tex = aParticleEffects(i); + col.rgb = _TintColor.rgb * tex.rgb * i.color.rgb * 2.0f; + col.a = (1 - tex.a) * (_TintColor.a * i.color.a * 2.0f); + return aParticleOutputAdd(i, col); + } + ENDCG + } + } + +} +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Shaders/3.0/VisualEffects/Particle AddMultiply.shader.meta b/Assets/Alloy/Shaders/3.0/VisualEffects/Particle AddMultiply.shader.meta new file mode 100644 index 0000000..6e5ef4c --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/VisualEffects/Particle AddMultiply.shader.meta @@ -0,0 +1,6 @@ +fileFormatVersion: 2 +guid: 4529fc113df270944ada8ca30b3c630e +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: diff --git a/Assets/Alloy/Shaders/3.0/VisualEffects/Particle AddSmooth.shader b/Assets/Alloy/Shaders/3.0/VisualEffects/Particle AddSmooth.shader new file mode 100644 index 0000000..deb81fb --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/VisualEffects/Particle AddSmooth.shader @@ -0,0 +1,89 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Particles/Additive (Soft)" { +Properties { + // Particle Properties + _ParticleProperties ("'Particle Textures' {Section:{Color:0}}", Float) = 0 + [HDR] + _TintColor ("'Tint' {}", Color) = (1,1,1,1) + [LM_MasterTilingOffset] [LM_Albedo] + _MainTex ("'Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _MainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _MainTexSpin ("Spin", Float) = 0 + [Gamma] + _TintWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _InvFade ("'Soft Particles Factor' {Min:0.01, Max:3}", Float) = 1 + + // Particle Effects Properties + [Toggle(_PARTICLE_EFFECTS_ON)] + _ParticleEffects ("'Particle Effects' {Feature:{Color:1}}", Float) = 0 + _ParticleEffectMask1 ("'Mask 1(RGBA)' {Visualize:{RGB, A}}", 2D) = "white" {} + _ParticleEffectMask1Velocity ("Scroll", Vector) = (0,0,0,0) + _ParticleEffectMask1Spin ("Spin", Float) = 0 + _ParticleEffectMask2 ("'Mask 2(RGBA)' {Visualize:{RGB, A}}", 2D) = "white" {} + _ParticleEffectMask2Velocity ("Scroll", Vector) = (0,0,0,0) + _ParticleEffectMask2Spin ("Spin", Float) = 0 + + // Rim Fade Properties + [Toggle(_RIM_FADE_ON)] + _RimFadeProperties ("'Rim Fade' {Feature:{Color:2}}", Float) = 0 + [Gamma] + _RimFadeWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _RimFadePower ("'Falloff' {Min:0.01}", Float) = 4 + + // Distance Fade Properties + [Toggle(_DISTANCE_FADE_ON)] + _DistanceFadeProperties ("'Distance Fade' {Feature:{Color:3}}", Float) = 0 + _DistanceFadeNearFadeCutoff ("'Near Fade Cutoff' {Min:0}", Float) = 1 + _DistanceFadeRange ("'Range' {Min:0.5}", Float) = 1 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 +} + +Category { + Tags { + "Queue" = "Transparent" + "IgnoreProjector" = "True" + "RenderType" = "Transparent" + "PreviewType" = "Plane" + } + Blend One OneMinusSrcColor + ColorMask RGB + Cull Off Lighting Off ZWrite Off + + SubShader { + Pass { + CGPROGRAM + #pragma target 3.0 + + #pragma shader_feature _PARTICLE_EFFECTS_ON + #pragma shader_feature _RIM_FADE_ON + #pragma shader_feature _DISTANCE_FADE_ON + + #pragma multi_compile_particles + #pragma multi_compile_fog + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #include "Assets/Alloy/Shaders/Framework/Particle.cginc" + + half4 aMainFragmentShader( + AFragmentInput i) : SV_Target + { + i.color.a *= aFadeParticle(i); + + half4 col = i.color * _TintColor * aParticleEffects(i); + col.rgb *= col.a; + return aParticleOutputAdd(i, col); + } + ENDCG + } + } +} +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Shaders/3.0/VisualEffects/Particle AddSmooth.shader.meta b/Assets/Alloy/Shaders/3.0/VisualEffects/Particle AddSmooth.shader.meta new file mode 100644 index 0000000..24233b1 --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/VisualEffects/Particle AddSmooth.shader.meta @@ -0,0 +1,6 @@ +fileFormatVersion: 2 +guid: ec45c513ae41df548a09353377bd9f03 +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: diff --git a/Assets/Alloy/Shaders/3.0/VisualEffects/Particle Alpha Blend.shader b/Assets/Alloy/Shaders/3.0/VisualEffects/Particle Alpha Blend.shader new file mode 100644 index 0000000..6457864 --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/VisualEffects/Particle Alpha Blend.shader @@ -0,0 +1,87 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Particles/Alpha Blended" { +Properties { + // Particle Properties + _ParticleProperties ("'Particle Textures' {Section:{Color:0}}", Float) = 0 + [HDR] + _TintColor ("'Tint' {}", Color) = (0.5,0.5,0.5,0.5) + [LM_MasterTilingOffset] [LM_Albedo] + _MainTex ("'Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _MainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _MainTexSpin ("Spin", Float) = 0 + [Gamma] + _TintWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _InvFade ("'Soft Particles Factor' {Min:0.01, Max:3}", Float) = 1 + + // Particle Effects Properties + [Toggle(_PARTICLE_EFFECTS_ON)] + _ParticleEffects ("'Particle Effects' {Feature:{Color:1}}", Float) = 0 + _ParticleEffectMask1 ("'Mask 1(RGBA)' {Visualize:{RGB, A}}", 2D) = "white" {} + _ParticleEffectMask1Velocity ("Scroll", Vector) = (0,0,0,0) + _ParticleEffectMask1Spin ("Spin", Float) = 0 + _ParticleEffectMask2 ("'Mask 2(RGBA)' {Visualize:{RGB, A}}", 2D) = "white" {} + _ParticleEffectMask2Velocity ("Scroll", Vector) = (0,0,0,0) + _ParticleEffectMask2Spin ("Spin", Float) = 0 + + // Rim Fade Properties + [Toggle(_RIM_FADE_ON)] + _RimFadeProperties ("'Rim Fade' {Feature:{Color:2}}", Float) = 0 + [Gamma] + _RimFadeWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _RimFadePower ("'Falloff' {Min:0.01}", Float) = 4 + + // Distance Fade Properties + [Toggle(_DISTANCE_FADE_ON)] + _DistanceFadeProperties ("'Distance Fade' {Feature:{Color:3}}", Float) = 0 + _DistanceFadeNearFadeCutoff ("'Near Fade Cutoff' {Min:0}", Float) = 1 + _DistanceFadeRange ("'Range' {Min:0.5}", Float) = 1 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 +} + +Category { + Tags { + "Queue" = "Transparent" + "IgnoreProjector" = "True" + "RenderType" = "Transparent" + "PreviewType" = "Plane" + } + Blend SrcAlpha OneMinusSrcAlpha + AlphaTest Greater .01 + ColorMask RGB + Cull Off Lighting Off ZWrite Off + + SubShader { + Pass { + CGPROGRAM + #pragma target 3.0 + + #pragma shader_feature _PARTICLE_EFFECTS_ON + #pragma shader_feature _RIM_FADE_ON + #pragma shader_feature _DISTANCE_FADE_ON + + #pragma multi_compile_particles + #pragma multi_compile_fog + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #include "Assets/Alloy/Shaders/Framework/Particle.cginc" + + half4 aMainFragmentShader( + AFragmentInput i) : SV_Target + { + i.color.a *= aFadeParticle(i); + return aParticleOutputBase(i, 2.0f * i.color * _TintColor * aParticleEffects(i)); + } + ENDCG + } + } +} +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Shaders/3.0/VisualEffects/Particle Alpha Blend.shader.meta b/Assets/Alloy/Shaders/3.0/VisualEffects/Particle Alpha Blend.shader.meta new file mode 100644 index 0000000..28ed5b0 --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/VisualEffects/Particle Alpha Blend.shader.meta @@ -0,0 +1,6 @@ +fileFormatVersion: 2 +guid: a9361741646c2c145b040385d32039f0 +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: diff --git a/Assets/Alloy/Shaders/3.0/VisualEffects/Particle Anim Alpha Blended.shader b/Assets/Alloy/Shaders/3.0/VisualEffects/Particle Anim Alpha Blended.shader new file mode 100644 index 0000000..6422049 --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/VisualEffects/Particle Anim Alpha Blended.shader @@ -0,0 +1,88 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Particles/Anim Alpha Blended" { +Properties { + // Particle Properties + _ParticleProperties ("'Particle Textures' {Section:{Color:0}}", Float) = 0 + [HDR] + _TintColor ("'Tint' {}", Color) = (0.5,0.5,0.5,0.5) + [LM_MasterTilingOffset] [LM_Albedo] + _MainTex ("'Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _MainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _MainTexSpin ("Spin", Float) = 0 + [Gamma] + _TintWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _InvFade ("'Soft Particles Factor' {Min:0.01, Max:3}", Float) = 1 + + // Particle Effects Properties + [Toggle(_PARTICLE_EFFECTS_ON)] + _ParticleEffects ("'Particle Effects' {Feature:{Color:1}}", Float) = 0 + _ParticleEffectMask1 ("'Mask 1(RGBA)' {Visualize:{RGB, A}}", 2D) = "white" {} + _ParticleEffectMask1Velocity ("Scroll", Vector) = (0,0,0,0) + _ParticleEffectMask1Spin ("Spin", Float) = 0 + _ParticleEffectMask2 ("'Mask 2(RGBA)' {Visualize:{RGB, A}}", 2D) = "white" {} + _ParticleEffectMask2Velocity ("Scroll", Vector) = (0,0,0,0) + _ParticleEffectMask2Spin ("Spin", Float) = 0 + + // Rim Fade Properties + [Toggle(_RIM_FADE_ON)] + _RimFadeProperties ("'Rim Fade' {Feature:{Color:2}}", Float) = 0 + [Gamma] + _RimFadeWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _RimFadePower ("'Falloff' {Min:0.01}", Float) = 4 + + // Distance Fade Properties + [Toggle(_DISTANCE_FADE_ON)] + _DistanceFadeProperties ("'Distance Fade' {Feature:{Color:3}}", Float) = 0 + _DistanceFadeNearFadeCutoff ("'Near Fade Cutoff' {Min:0}", Float) = 1 + _DistanceFadeRange ("'Range' {Min:0.5}", Float) = 1 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 +} + +Category { + Tags { + "Queue" = "Transparent" + "IgnoreProjector" = "True" + "RenderType" = "Transparent" + "PreviewType" = "Plane" + } + Blend SrcAlpha OneMinusSrcAlpha + ColorMask RGB + Cull Off Lighting Off ZWrite Off + + SubShader { + Pass { + CGPROGRAM + #pragma target 3.0 + + #pragma shader_feature _PARTICLE_EFFECTS_ON + #pragma shader_feature _RIM_FADE_ON + #pragma shader_feature _DISTANCE_FADE_ON + + #pragma multi_compile_particles + #pragma multi_compile_fog + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define A_PARTICLE_TEXTURE_BLEND_ON + + #include "Assets/Alloy/Shaders/Framework/Particle.cginc" + + half4 aMainFragmentShader( + AFragmentInput i) : SV_Target + { + i.color.a *= aFadeParticle(i); + return aParticleOutputBase(i, 2.0f * i.color * _TintColor * aParticleEffects(i)); + } + ENDCG + } + } +} +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Shaders/3.0/VisualEffects/Particle Anim Alpha Blended.shader.meta b/Assets/Alloy/Shaders/3.0/VisualEffects/Particle Anim Alpha Blended.shader.meta new file mode 100644 index 0000000..1153bf4 --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/VisualEffects/Particle Anim Alpha Blended.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 82e61b0c473cf064c9fc7cb23d9d339e +timeCreated: 1489325920 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/3.0/VisualEffects/Particle Blend.shader b/Assets/Alloy/Shaders/3.0/VisualEffects/Particle Blend.shader new file mode 100644 index 0000000..407bdd6 --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/VisualEffects/Particle Blend.shader @@ -0,0 +1,86 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Particles/Blend" { +Properties { + // Particle Properties + _ParticleProperties ("'Particle Textures' {Section:{Color:0}}", Float) = 0 + [HDR] + _TintColor ("'Tint' {}", Color) = (1,1,1,1) + [LM_MasterTilingOffset] [LM_Albedo] + _MainTex ("'Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _MainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _MainTexSpin ("Spin", Float) = 0 + [Gamma] + _TintWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _InvFade ("'Soft Particles Factor' {Min:0.01, Max:3}", Float) = 1 + + // Particle Effects Properties + [Toggle(_PARTICLE_EFFECTS_ON)] + _ParticleEffects ("'Particle Effects' {Feature:{Color:1}}", Float) = 0 + _ParticleEffectMask1 ("'Mask 1(RGBA)' {Visualize:{RGB, A}}", 2D) = "white" {} + _ParticleEffectMask1Velocity ("Scroll", Vector) = (0,0,0,0) + _ParticleEffectMask1Spin ("Spin", Float) = 0 + _ParticleEffectMask2 ("'Mask 2(RGBA)' {Visualize:{RGB, A}}", 2D) = "white" {} + _ParticleEffectMask2Velocity ("Scroll", Vector) = (0,0,0,0) + _ParticleEffectMask2Spin ("Spin", Float) = 0 + + // Rim Fade Properties + [Toggle(_RIM_FADE_ON)] + _RimFadeProperties ("'Rim Fade' {Feature:{Color:2}}", Float) = 0 + [Gamma] + _RimFadeWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _RimFadePower ("'Falloff' {Min:0.01}", Float) = 4 + + // Distance Fade Properties + [Toggle(_DISTANCE_FADE_ON)] + _DistanceFadeProperties ("'Distance Fade' {Feature:{Color:3}}", Float) = 0 + _DistanceFadeNearFadeCutoff ("'Near Fade Cutoff' {Min:0}", Float) = 1 + _DistanceFadeRange ("'Range' {Min:0.5}", Float) = 1 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 +} + +Category { + Tags { + "Queue" = "Transparent" + "IgnoreProjector" = "True" + "RenderType" = "Transparent" + "PreviewType" = "Plane" + } + Blend DstColor One + ColorMask RGB + Cull Off Lighting Off ZWrite Off + + SubShader { + Pass { + CGPROGRAM + #pragma target 3.0 + + #pragma shader_feature _PARTICLE_EFFECTS_ON + #pragma shader_feature _RIM_FADE_ON + #pragma shader_feature _DISTANCE_FADE_ON + + #pragma multi_compile_particles + #pragma multi_compile_fog + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #include "Assets/Alloy/Shaders/Framework/Particle.cginc" + + half4 aMainFragmentShader( + AFragmentInput i) : SV_Target + { + i.color *= aFadeParticle(i); + return aParticleOutputAdd(i, i.color * _TintColor * aParticleEffects(i)); + } + ENDCG + } + } +} +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Shaders/3.0/VisualEffects/Particle Blend.shader.meta b/Assets/Alloy/Shaders/3.0/VisualEffects/Particle Blend.shader.meta new file mode 100644 index 0000000..f7f8c0e --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/VisualEffects/Particle Blend.shader.meta @@ -0,0 +1,6 @@ +fileFormatVersion: 2 +guid: eb4fe5f4068166848b385c78be153db1 +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: diff --git a/Assets/Alloy/Shaders/3.0/VisualEffects/Particle Multiply.shader b/Assets/Alloy/Shaders/3.0/VisualEffects/Particle Multiply.shader new file mode 100644 index 0000000..8756047 --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/VisualEffects/Particle Multiply.shader @@ -0,0 +1,87 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Particles/Multiply" { +Properties { + // Particle Properties + _ParticleProperties ("'Particle Textures' {Section:{Color:0}}", Float) = 0 + [HDR] + _TintColor ("'Tint' {}", Color) = (1,1,1,1) + [LM_MasterTilingOffset] [LM_Albedo] + _MainTex ("'Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _MainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _MainTexSpin ("Spin", Float) = 0 + [Gamma] + _TintWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _InvFade ("'Soft Particles Factor' {Min:0.01, Max:3}", Float) = 1 + + // Particle Effects Properties + [Toggle(_PARTICLE_EFFECTS_ON)] + _ParticleEffects ("'Particle Effects' {Feature:{Color:1}}", Float) = 0 + _ParticleEffectMask1 ("'Mask 1(RGBA)' {Visualize:{RGB, A}}", 2D) = "white" {} + _ParticleEffectMask1Velocity ("Scroll", Vector) = (0,0,0,0) + _ParticleEffectMask1Spin ("Spin", Float) = 0 + _ParticleEffectMask2 ("'Mask 2(RGBA)' {Visualize:{RGB, A}}", 2D) = "white" {} + _ParticleEffectMask2Velocity ("Scroll", Vector) = (0,0,0,0) + _ParticleEffectMask2Spin ("Spin", Float) = 0 + + // Rim Fade Properties + [Toggle(_RIM_FADE_ON)] + _RimFadeProperties ("'Rim Fade' {Feature:{Color:2}}", Float) = 0 + [Gamma] + _RimFadeWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _RimFadePower ("'Falloff' {Min:0.01}", Float) = 4 + + // Distance Fade Properties + [Toggle(_DISTANCE_FADE_ON)] + _DistanceFadeProperties ("'Distance Fade' {Feature:{Color:3}}", Float) = 0 + _DistanceFadeNearFadeCutoff ("'Near Fade Cutoff' {Min:0}", Float) = 1 + _DistanceFadeRange ("'Range' {Min:0.5}", Float) = 1 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 +} + +Category { + Tags { + "Queue" = "Transparent" + "IgnoreProjector" = "True" + "RenderType" = "Transparent" + "PreviewType" = "Plane" + } + Blend Zero SrcColor + Cull Off Lighting Off ZWrite Off + + SubShader { + Pass { + CGPROGRAM + #pragma target 3.0 + + #pragma shader_feature _PARTICLE_EFFECTS_ON + #pragma shader_feature _RIM_FADE_ON + #pragma shader_feature _DISTANCE_FADE_ON + + #pragma multi_compile_particles + #pragma multi_compile_fog + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #include "Assets/Alloy/Shaders/Framework/Particle.cginc" + + half4 aMainFragmentShader( + AFragmentInput i) : SV_Target + { + i.color.a *= aFadeParticle(i); + + half4 prev = i.color * _TintColor * aParticleEffects(i); + return aParticleOutputMultiply(i, lerp(half4(1,1,1,1), prev, prev.a)); + } + ENDCG + } + } +} +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Shaders/3.0/VisualEffects/Particle Multiply.shader.meta b/Assets/Alloy/Shaders/3.0/VisualEffects/Particle Multiply.shader.meta new file mode 100644 index 0000000..1cbabb5 --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/VisualEffects/Particle Multiply.shader.meta @@ -0,0 +1,6 @@ +fileFormatVersion: 2 +guid: bfebb08b521b54543ba157edc5ba0402 +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: diff --git a/Assets/Alloy/Shaders/3.0/VisualEffects/Particle MultiplyDouble.shader b/Assets/Alloy/Shaders/3.0/VisualEffects/Particle MultiplyDouble.shader new file mode 100644 index 0000000..984f374 --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/VisualEffects/Particle MultiplyDouble.shader @@ -0,0 +1,94 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Particles/Multiply (Double)" { +Properties { + // Particle Properties + _ParticleProperties ("'Particle Textures' {Section:{Color:0}}", Float) = 0 + [HDR] + _TintColor ("'Tint' {}", Color) = (1,1,1,1) + [LM_MasterTilingOffset] [LM_Albedo] + _MainTex ("'Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _MainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _MainTexSpin ("Spin", Float) = 0 + [Gamma] + _TintWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _InvFade ("'Soft Particles Factor' {Min:0.01, Max:3}", Float) = 1 + + // Particle Effects Properties + [Toggle(_PARTICLE_EFFECTS_ON)] + _ParticleEffects ("'Particle Effects' {Feature:{Color:1}}", Float) = 0 + _ParticleEffectMask1 ("'Mask 1(RGBA)' {Visualize:{RGB, A}}", 2D) = "white" {} + _ParticleEffectMask1Velocity ("Scroll", Vector) = (0,0,0,0) + _ParticleEffectMask1Spin ("Spin", Float) = 0 + _ParticleEffectMask2 ("'Mask 2(RGBA)' {Visualize:{RGB, A}}", 2D) = "white" {} + _ParticleEffectMask2Velocity ("Scroll", Vector) = (0,0,0,0) + _ParticleEffectMask2Spin ("Spin", Float) = 0 + + // Rim Fade Properties + [Toggle(_RIM_FADE_ON)] + _RimFadeProperties ("'Rim Fade' {Feature:{Color:2}}", Float) = 0 + [Gamma] + _RimFadeWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _RimFadePower ("'Falloff' {Min:0.01}", Float) = 4 + + // Distance Fade Properties + [Toggle(_DISTANCE_FADE_ON)] + _DistanceFadeProperties ("'Distance Fade' {Feature:{Color:3}}", Float) = 0 + _DistanceFadeNearFadeCutoff ("'Near Fade Cutoff' {Min:0}", Float) = 1 + _DistanceFadeRange ("'Range' {Min:0.5}", Float) = 1 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 +} + +Category { + Tags { + "Queue" = "Transparent" + "IgnoreProjector" = "True" + "RenderType" = "Transparent" + "PreviewType" = "Plane" + } + Blend DstColor SrcColor + ColorMask RGB + Cull Off Lighting Off ZWrite Off + + SubShader { + Pass { + CGPROGRAM + #pragma target 3.0 + + #pragma shader_feature _PARTICLE_EFFECTS_ON + #pragma shader_feature _RIM_FADE_ON + #pragma shader_feature _DISTANCE_FADE_ON + + #pragma multi_compile_particles + #pragma multi_compile_fog + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #include "Assets/Alloy/Shaders/Framework/Particle.cginc" + + half4 aMainFragmentShader( + AFragmentInput i) : SV_Target + { + i.color.a *= aFadeParticle(i); + + half4 col; + half4 tex = _TintColor * aParticleEffects(i); + col.rgb = tex.rgb * i.color.rgb * 2; + col.a = i.color.a * tex.a; + col = lerp(fixed4(0.5f,0.5f,0.5f,0.5f), col, col.a); + UNITY_APPLY_FOG_COLOR(i.fogCoord, col, fixed4(0.5,0.5,0.5,0.5)); // fog towards gray due to our blend mode + col.rgb = aHdrClamp(col.rgb); + return col; + } + ENDCG + } + } +} +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Shaders/3.0/VisualEffects/Particle MultiplyDouble.shader.meta b/Assets/Alloy/Shaders/3.0/VisualEffects/Particle MultiplyDouble.shader.meta new file mode 100644 index 0000000..9386b6a --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/VisualEffects/Particle MultiplyDouble.shader.meta @@ -0,0 +1,6 @@ +fileFormatVersion: 2 +guid: b981159d95820e34d9fe0d9773764964 +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: diff --git a/Assets/Alloy/Shaders/3.0/VisualEffects/Particle Premultiply Blend.shader b/Assets/Alloy/Shaders/3.0/VisualEffects/Particle Premultiply Blend.shader new file mode 100644 index 0000000..b5b306c --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/VisualEffects/Particle Premultiply Blend.shader @@ -0,0 +1,88 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Particles/Alpha Blended Premultiply" { +Properties { + // Particle Properties + _ParticleProperties ("'Particle Textures' {Section:{Color:0}}", Float) = 0 + [HDR] + _TintColor ("'Tint' {}", Color) = (1,1,1,1) + [LM_MasterTilingOffset] [LM_Albedo] + _MainTex ("'Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _MainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _MainTexSpin ("Spin", Float) = 0 + [Gamma] + _TintWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _InvFade ("'Soft Particles Factor' {Min:0.01, Max:3}", Float) = 1 + + // Particle Effects Properties + [Toggle(_PARTICLE_EFFECTS_ON)] + _ParticleEffects ("'Particle Effects' {Feature:{Color:1}}", Float) = 0 + _ParticleEffectMask1 ("'Mask 1(RGBA)' {Visualize:{RGB, A}}", 2D) = "white" {} + _ParticleEffectMask1Velocity ("Scroll", Vector) = (0,0,0,0) + _ParticleEffectMask1Spin ("Spin", Float) = 0 + _ParticleEffectMask2 ("'Mask 2(RGBA)' {Visualize:{RGB, A}}", 2D) = "white" {} + _ParticleEffectMask2Velocity ("Scroll", Vector) = (0,0,0,0) + _ParticleEffectMask2Spin ("Spin", Float) = 0 + + // Rim Fade Properties + [Toggle(_RIM_FADE_ON)] + _RimFadeProperties ("'Rim Fade' {Feature:{Color:2}}", Float) = 0 + [Gamma] + _RimFadeWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _RimFadePower ("'Falloff' {Min:0.01}", Float) = 4 + + // Distance Fade Properties + [Toggle(_DISTANCE_FADE_ON)] + _DistanceFadeProperties ("'Distance Fade' {Feature:{Color:3}}", Float) = 0 + _DistanceFadeNearFadeCutoff ("'Near Fade Cutoff' {Min:0}", Float) = 1 + _DistanceFadeRange ("'Range' {Min:0.5}", Float) = 1 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 +} + +Category { + Tags { + "Queue" = "Transparent" + "IgnoreProjector" = "True" + "RenderType" = "Transparent" + "PreviewType" = "Plane" + } + Blend One OneMinusSrcAlpha + ColorMask RGB + Cull Off Lighting Off ZWrite Off + + SubShader { + Pass { + CGPROGRAM + #pragma target 3.0 + + #pragma shader_feature _PARTICLE_EFFECTS_ON + #pragma shader_feature _RIM_FADE_ON + #pragma shader_feature _DISTANCE_FADE_ON + + #pragma multi_compile_particles + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #include "Assets/Alloy/Shaders/Framework/Particle.cginc" + + half4 aMainFragmentShader( + AFragmentInput i) : SV_Target + { + i.color.a *= aFadeParticle(i); + + half4 col = i.color * i.color.a * _TintColor * aParticleEffects(i); + col.rgb = aHdrClamp(col.rgb); + return col; + } + ENDCG + } + } +} +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Shaders/3.0/VisualEffects/Particle Premultiply Blend.shader.meta b/Assets/Alloy/Shaders/3.0/VisualEffects/Particle Premultiply Blend.shader.meta new file mode 100644 index 0000000..6435b8a --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/VisualEffects/Particle Premultiply Blend.shader.meta @@ -0,0 +1,6 @@ +fileFormatVersion: 2 +guid: 38d9dabce16684044a0894a1e89a9a42 +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: diff --git a/Assets/Alloy/Shaders/3.0/VisualEffects/Particle VertexLit Blended.shader b/Assets/Alloy/Shaders/3.0/VisualEffects/Particle VertexLit Blended.shader new file mode 100644 index 0000000..aa1a5a7 --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/VisualEffects/Particle VertexLit Blended.shader @@ -0,0 +1,93 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Particles/VertexLit Blended" { +Properties { + // Particle Properties + _ParticleProperties ("'Particle Textures' {Section:{Color:0}}", Float) = 0 + [HDR] + _TintColor ("'Tint' {}", Color) = (0.5,0.5,0.5,0.5) + [LM_MasterTilingOffset] [LM_Albedo] + _MainTex ("'Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _MainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _MainTexSpin ("Spin", Float) = 0 + [Gamma] + _TintWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _InvFade ("'Soft Particles Factor' {Min:0.01, Max:3}", Float) = 1 + + // Particle Effects Properties + [Toggle(_PARTICLE_EFFECTS_ON)] + _ParticleEffects ("'Particle Effects' {Feature:{Color:1}}", Float) = 0 + _ParticleEffectMask1 ("'Mask 1(RGBA)' {Visualize:{RGB, A}}", 2D) = "white" {} + _ParticleEffectMask1Velocity ("Scroll", Vector) = (0,0,0,0) + _ParticleEffectMask1Spin ("Spin", Float) = 0 + _ParticleEffectMask2 ("'Mask 2(RGBA)' {Visualize:{RGB, A}}", 2D) = "white" {} + _ParticleEffectMask2Velocity ("Scroll", Vector) = (0,0,0,0) + _ParticleEffectMask2Spin ("Spin", Float) = 0 + + // Rim Fade Properties + [Toggle(_RIM_FADE_ON)] + _RimFadeProperties ("'Rim Fade' {Feature:{Color:2}}", Float) = 0 + [Gamma] + _RimFadeWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _RimFadePower ("'Falloff' {Min:0.01}", Float) = 4 + + // Distance Fade Properties + [Toggle(_DISTANCE_FADE_ON)] + _DistanceFadeProperties ("'Distance Fade' {Feature:{Color:3}}", Float) = 0 + _DistanceFadeNearFadeCutoff ("'Near Fade Cutoff' {Min:0}", Float) = 1 + _DistanceFadeRange ("'Range' {Min:0.5}", Float) = 1 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 +} + +Category { + Tags { + "Queue" = "Transparent" + "IgnoreProjector" = "True" + "RenderType" = "Transparent" + "PreviewType" = "Plane" + } + Blend SrcAlpha OneMinusSrcAlpha + AlphaTest Greater .01 + ColorMask RGB + Cull Off Lighting On ZWrite Off + + SubShader { + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + CGPROGRAM + #pragma target 3.0 + + #pragma shader_feature _PARTICLE_EFFECTS_ON + #pragma shader_feature _RIM_FADE_ON + #pragma shader_feature _DISTANCE_FADE_ON + + #pragma multi_compile_particles + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define A_PARTICLE_LIGHTING_ON + + #include "Assets/Alloy/Shaders/Framework/Particle.cginc" + + half4 aMainFragmentShader( + AFragmentInput i) : SV_Target + { + i.color.a *= aFadeParticle(i); + return aParticleOutputBase(i, 2.0f * i.color * _TintColor * aParticleEffects(i)); + } + ENDCG + } + } +} +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Shaders/3.0/VisualEffects/Particle VertexLit Blended.shader.meta b/Assets/Alloy/Shaders/3.0/VisualEffects/Particle VertexLit Blended.shader.meta new file mode 100644 index 0000000..ab4248b --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/VisualEffects/Particle VertexLit Blended.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 528f497bd1b2cc4428a4436dc25af907 +timeCreated: 1437314212 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/3.0/VisualEffects/Transition.shader b/Assets/Alloy/Shaders/3.0/VisualEffects/Transition.shader new file mode 100644 index 0000000..687155d --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/VisualEffects/Transition.shader @@ -0,0 +1,423 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Transition" { +Properties { + // Global Settings + _Mode ("'Rendering Mode' {RenderingMode:{Opaque:{_Cutoff}, Cutout:{}, Fade:{_Cutoff}, Transparent:{_Cutoff}}}", Float) = 0 + _SrcBlend ("__src", Float) = 0 + _DstBlend ("__dst", Float) = 0 + _ZWrite ("__zw", Float) = 1 + [LM_TransparencyCutOff] + _Cutoff ("'Opacity Cutoff' {Min:0, Max:1}", Float) = 0.5 + [Toggle(EFFECT_BUMP)] + _HasBumpMap ("'Normals Source' {Dropdown:{VertexNormals:{_BumpMap,_BumpScale,_DetailNormalMap,_DetailNormalMapScale,_WetNormalMap,_WetNormalMapScale,_BumpMap2,_BumpScale2}, NormalMaps:{}}}", Float) = 1 + [Toggle(_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A)] + _MainRoughnessSource ("'Roughness Source' {Dropdown:{PackedMapAlpha:{}, BaseColorAlpha:{_SpecTex,_Occlusion,_MaterialMap2,_Occlusion2}}}", Float) = 0 + + // Main Textures + _MainTextures ("'Main Textures' {Section:{Color:0}}", Float) = 0 + [LM_Albedo] [LM_Transparency] + _Color ("'Tint' {}", Color) = (1,1,1,1) + [LM_MasterTilingOffset] [LM_Albedo] + _MainTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _MainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _MainTexUV ("UV Set", Float) = 0 + [LM_Metallic] + _SpecTex ("'Metal(R) AO(G) Spec(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_MainTex}", 2D) = "white" {} + [LM_NormalMap] + _BumpMap ("'Normals' {Visualize:{NRM}, Parent:_MainTex}", 2D) = "bump" {} + _BaseColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Main Properties + _MainPhysicalProperties ("'Main Properties' {Section:{Color:1}}", Float) = 0 + [LM_Metallic] + _Metal ("'Metallic' {Min:0, Max:1}", Float) = 1 + _Specularity ("'Specularity' {Min:0, Max:1}", Float) = 1 + _SpecularTint ("'Specular Tint' {Min:0, Max:1}", Float) = 0 + _Roughness ("'Roughness' {Min:0, Max:1}", Float) = 1 + _Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _BumpScale ("'Normal Strength' {}", Float) = 1 + + // Parallax + [Toggle(_PARALLAXMAP)] + _ParallaxT ("'Parallax' {Feature:{Color:5}}", Float) = 0 + [Toggle(_BUMPMODE_POM)] + _BumpMode ("'Mode' {Dropdown:{Parallax:{_MinSamples, _MaxSamples}, POM:{}}}", Float) = 0 + _ParallaxMap ("'Heightmap(G)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "black" {} + _Parallax ("'Height' {Min:0, Max:0.08}", Float) = 0.02 + _MinSamples ("'Min Samples' {Min:1}", Float) = 4 + _MaxSamples ("'Max Samples' {Min:1}", Float) = 20 + + // AO2 + [Toggle(_AO2_ON)] + _AO2 ("'AO2' {Feature:{Color:6}}", Float) = 0 + _Ao2Map ("'AO2(G)' {Visualize:{RGB}}", 2D) = "white" {} + _Ao2MapUV ("UV Set", Float) = 1 + _Ao2Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + + // Detail + [Toggle(_DETAIL_MULX2)] + _DetailT ("'Detail' {Feature:{Color:7}}", Float) = 0 + [Toggle(_NORMALMAP)] + _DetailMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_DetailMask}}}", Float) = 0 + _DetailMask ("'Mask(A)' {Visualize:{A}, Parent:_MainTex}", 2D) = "white" {} + _DetailMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + [Enum(Mul, 0, MulX2, 1)] + _DetailMode ("'Color Mode' {Dropdown:{Mul:{}, MulX2:{}}}", Float) = 0 + _DetailAlbedoMap ("'Color(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _DetailAlbedoMapVelocity ("Scroll", Vector) = (0,0,0,0) + _DetailAlbedoMapUV ("UV Set", Float) = 0 + _DetailNormalMap ("'Normals' {Visualize:{NRM}, Parent:_DetailAlbedoMap}", 2D) = "bump" {} + _DetailWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DetailNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Team Color + [Toggle(_TEAMCOLOR_ON)] + _TeamColor ("'Team Color' {Feature:{Color:8}}", Float) = 0 + [Enum(Masks, 0, Tint, 1)] + _TeamColorMasksAsTint ("'Texture Mode' {Dropdown:{Masks:{}, Tint:{_TeamColorMasks, _TeamColor0, _TeamColor1, _TeamColor2, _TeamColor3}}}", Float) = 0 + _TeamColorMaskMap ("'Masks(RGBA)' {Visualize:{R, G, B, A, RGB}, Parent:_MainTex}", 2D) = "black" {} + _TeamColorMasks ("'Channels' {Vector:Channels}", Vector) = (1,1,1,0) + _TeamColor0 ("'Tint R' {}", Color) = (1,0,0) + _TeamColor1 ("'Tint G' {}", Color) = (0,1,0) + _TeamColor2 ("'Tint B' {}", Color) = (0,0,1) + _TeamColor3 ("'Tint A' {}", Color) = (0.5,0.5,0.5) + + // Decal + [Toggle(_DECAL_ON)] + _Decal ("'Decal' {Feature:{Color:9}}", Float) = 0 + _DecalColor ("'Tint' {}", Color) = (1,1,1,1) + _DecalTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "black" {} + _DecalTexUV ("UV Set", Float) = 0 + _DecalWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DecalSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _DecalAlphaVertexTint ("'Vertex Alpha Tint' {Min:0, Max:1}", Float) = 0 + + // Emission + [Toggle(_EMISSION)] + _Emission ("'Emission' {Feature:{Color:10}}", Float) = 0 + [LM_Emission] + [HDR] + _EmissionColor ("'Tint' {}", Color) = (1,1,1) + [LM_Emission] + _EmissionMap ("'Mask(RGB)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "white" {} + _IncandescenceMap ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _IncandescenceMapVelocity ("Scroll", Vector) = (0,0,0,0) + _IncandescenceMapUV ("UV Set", Float) = 0 + [Gamma] + _EmissionWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + + // Rim Emission + [Toggle(_RIM_ON)] + _Rim ("'Rim Emission' {Feature:{Color:11}}", Float) = 0 + [HDR] + _RimColor ("'Tint' {}", Color) = (1,1,1) + _RimTex ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _RimTexVelocity ("Scroll", Vector) = (0,0,0,0) + _RimTexUV ("UV Set", Float) = 0 + [Gamma] + _RimWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + [Gamma] + _RimBias ("'Fill' {Min:0, Max:1}", Float) = 0 + _RimPower ("'Falloff' {Min:0.01}", Float) = 4 + + // Dissolve + [Toggle(_DISSOLVE_ON)] + _Dissolve ("'Dissolve' {Feature:{Color:12}}", Float) = 0 + [HDR] + _DissolveGlowColor ("'Glow Tint' {}", Color) = (1,1,1,1) + _DissolveTex ("'Glow Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _DissolveTexUV ("UV Set", Float) = 0 + _DissolveCutoff ("'Cutoff' {Min:0, Max:1}", Float) = 0 + [Gamma] + _DissolveGlowWeight ("'Glow Weight' {Min:0, Max:1}", Float) = 1 + _DissolveEdgeWidth ("'Glow Width' {Min:0, Max:1}", Float) = 0.01 + + // Wetness + [Toggle(_WETNESS_ON)] + _WetnessProperties ("'Wetness' {Feature:{Color:13}}", Float) = 0 + [Toggle(_WETMASKSOURCE_VERTEXCOLORALPHA)] + _WetMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_WetMask}}}", Float) = 0 + _WetMask ("'Mask(A)' {Visualize:{A}}", 2D) = "white" {} + _WetMaskVelocity ("Scroll", Vector) = (0,0,0,0) + _WetMaskUV ("UV Set", Float) = 0 + _WetMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + _WetTint ("'Tint' {}", Color) = (1,1,1,1) + _WetNormalMap ("'Normals' {Visualize:{NRM}}", 2D) = "bump" {} + _WetNormalMapVelocity ("Scroll", Vector) = (0,0,0,0) + _WetNormalMapUV ("UV Set", Float) = 0 + _WetWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _WetRoughness ("'Roughness' {Min:0, Max:1}", Float) = 0.2 + _WetNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Transition + _TransitionProperties ("'Transition' {Section:{Color:14}}", Float) = 0 + [HDR] + _TransitionGlowColor ("'Glow Tint' {}", Color) = (1,1,1,1) + _TransitionTex ("'Glow Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _TransitionTexUV ("UV Set", Float) = 0 + _TransitionCutoff ("'Cutoff' {Min:0, Max:1}", Float) = 0 + [Gamma] + _TransitionGlowWeight ("'Glow Weight' {Min:0, Max:1}", Float) = 1 + _TransitionEdgeWidth ("'Glow Width' {Min:0, Max:1}", Float) = 0.01 + + // Secondary Textures + _SecondaryTextures ("'Secondary Textures' {Section:{Color:15}}", Float) = 0 + _Color2 ("'Tint' {}", Color) = (1,1,1,1) + _MainTex2 ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _MainTex2Velocity ("Scroll", Vector) = (0,0,0,0) + _MainTex2UV ("UV Set", Float) = 0 + _MaterialMap2 ("'Metal(R) AO(G) Spec(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_MainTex2}", 2D) = "white" {} + _BumpMap2 ("'Normals' {Visualize:{NRM}, Parent:_MainTex2}", 2D) = "bump" {} + _BaseColorVertexTint2 ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Secondary Properties + _SecondaryPhysicalProperties ("'Secondary Properties' {Section:{Color:16}}", Float) = 0 + _Metallic2 ("'Metallic' {Min:0, Max:1}", Float) = 1 + _Specularity2 ("'Specularity' {Min:0, Max:1}", Float) = 1 + _SpecularTint2 ("'Specular Tint' {Min:0, Max:1}", Float) = 0 + _Roughness2 ("'Roughness' {Min:0, Max:1}", Float) = 1 + _Occlusion2 ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _BumpScale2 ("'Normal Strength' {}", Float) = 1 + + // Secondary Emission + [Toggle(_EMISSION2_ON)] + _Emission2 ("'Secondary Emission' {Feature:{Color:17}}", Float) = 0 + [HDR] + _Emission2Color ("'Tint' {}", Color) = (1,1,1) + _EmissionMap2 ("'Mask(RGB)' {Visualize:{RGB}, Parent:_MainTex2}", 2D) = "white" {} + _IncandescenceMap2 ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _IncandescenceMap2Velocity ("Scroll", Vector) = (0,0,0,0) + _IncandescenceMap2UV ("UV Set", Float) = 0 + [Gamma] + _Emission2Weight ("'Weight' {Min:0, Max:1}", Float) = 1 + + // Secondary Rim Emission + [Toggle(_RIM2_ON)] + _Rim2 ("'Secondary Rim Emission' {Feature:{Color:18}}", Float) = 0 + [HDR] + _Rim2Color ("'Tint' {}", Color) = (1,1,1) + _RimTex2 ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _RimTex2Velocity ("Scroll", Vector) = (0,0,0,0) + _RimTex2UV ("UV Set", Float) = 0 + [Gamma] + _Rim2Weight ("'Weight' {Min:0, Max:1}", Float) = 1 + [Gamma] + _Rim2Bias ("'Fill' {Min:0, Max:1}", Float) = 0 + _Rim2Power ("'Falloff' {Min:0}", Float) = 4 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _Lightmapping ("'GI' {LightmapEmissionProperty:{}}", Float) = 1 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} + +SubShader { + Tags { + "RenderType" = "Opaque" + "PerformanceChecks" = "False" + //"DisableBatching" = "LODFading" + } + LOD 300 + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + Blend [_SrcBlend] [_DstBlend] + ZWrite [_ZWrite] + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _EMISSION2_ON + #pragma shader_feature _RIM2_ON + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Shaders/Definition/Transition.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend [_SrcBlend] One + ZWrite Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + + #include "Assets/Alloy/Shaders/Definition/Transition.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _DISSOLVE_ON + + #pragma multi_compile_shadowcaster + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_SHADOWCASTER + + #include "Assets/Alloy/Shaders/Definition/Transition.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } + + Pass { + Name "DEFERRED" + Tags { "LightMode" = "Deferred" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _EMISSION2_ON + #pragma shader_feature _RIM2_ON + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_prepassfinal + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_DEFERRED + + #include "Assets/Alloy/Shaders/Definition/Transition.cginc" + #include "Assets/Alloy/Shaders/Forward/Gbuffer.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _EMISSION2_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Shaders/Definition/Transition.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +FallBack "VertexLit" +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Shaders/3.0/VisualEffects/Transition.shader.meta b/Assets/Alloy/Shaders/3.0/VisualEffects/Transition.shader.meta new file mode 100644 index 0000000..a9a865c --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/VisualEffects/Transition.shader.meta @@ -0,0 +1,27 @@ +fileFormatVersion: 2 +guid: a5239abca68a29a48879bdcd076b42df +ShaderImporter: + defaultTextures: + - _MainTex: {instanceID: 0} + - _SpecTex: {instanceID: 0} + - _BumpMap: {instanceID: 0} + - _ParallaxMap: {instanceID: 0} + - _DetailMask: {instanceID: 0} + - _DetailAlbedoMap: {instanceID: 0} + - _DetailMaterialMap: {fileID: 2800000, guid: 2b77d5cb601375f4ba50c6194c126e59, + type: 3} + - _DetailNormalMap: {instanceID: 0} + - _TeamColorMaskMap: {instanceID: 0} + - _DecalTex: {instanceID: 0} + - _EmissionMap: {instanceID: 0} + - _IncandescenceMap: {instanceID: 0} + - _RimTex: {instanceID: 0} + - _DissolveTex: {instanceID: 0} + - _MainTex2: {instanceID: 0} + - _MaterialMap2: {instanceID: 0} + - _BumpMap2: {instanceID: 0} + - _EmissionMap2: {instanceID: 0} + - _IncandescenceMap2: {instanceID: 0} + - _RimTex2: {instanceID: 0} + userData: + assetBundleName: diff --git a/Assets/Alloy/Shaders/3.0/VisualEffects/Unlit.shader b/Assets/Alloy/Shaders/3.0/VisualEffects/Unlit.shader new file mode 100644 index 0000000..3ceb182 --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/VisualEffects/Unlit.shader @@ -0,0 +1,240 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Unlit" { +Properties { + // Global Settings + _Mode ("'Rendering Mode' {RenderingMode:{Opaque:{_Cutoff}, Cutout:{}, Fade:{_Cutoff}, Transparent:{_Cutoff}}}", Float) = 0 + _SrcBlend ("__src", Float) = 0 + _DstBlend ("__dst", Float) = 0 + _ZWrite ("__zw", Float) = 1 + [LM_TransparencyCutOff] + _Cutoff ("'Opacity Cutoff' {Min:0, Max:1}", Float) = 0.5 + [Toggle(EFFECT_BUMP)] + _HasBumpMap ("'Normals Source' {Dropdown:{VertexNormals:{_BumpMap,_BumpScale,_DetailNormalMap,_DetailNormalMapScale,_WetNormalMap,_WetNormalMapScale}, NormalMaps:{}}}", Float) = 1 + [MaterialEnum(Off,0,Front,1,Back,2)] + _Cull ("'Cull Mode' {Dropdown:{Off:{}, Front:{}, Back:{}}}", Int) = 2 + + // Main Textures + _MainTextures ("'Main Textures' {Section:{Color:0}}", Float) = 0 + [HDR][LM_Albedo] [LM_Transparency] + _Color ("'Tint' {}", Color) = (1,1,1,1) + [LM_MasterTilingOffset] [LM_Albedo] + _MainTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _MainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _MainTexUV ("UV Set", Float) = 0 + [LM_NormalMap] + _BumpMap ("'Normals' {Visualize:{NRM}, Parent:_MainTex}", 2D) = "bump" {} + _BaseColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Main Properties + _MainPhysicalProperties ("'Main Properties' {Section:{Color:1}}", Float) = 0 + _BumpScale ("'Normal Strength' {}", Float) = 1 + + // Parallax + [Toggle(_PARALLAXMAP)] + _ParallaxT ("'Parallax' {Feature:{Color:5}}", Float) = 0 + [Toggle(_BUMPMODE_POM)] + _BumpMode ("'Mode' {Dropdown:{Parallax:{_MinSamples, _MaxSamples}, POM:{}}}", Float) = 0 + _ParallaxMap ("'Heightmap(G)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "black" {} + _Parallax ("'Height' {Min:0, Max:0.08}", Float) = 0.02 + _MinSamples ("'Min Samples' {Min:1}", Float) = 4 + _MaxSamples ("'Max Samples' {Min:1}", Float) = 20 + + // Detail + [Toggle(_DETAIL_MULX2)] + _DetailT ("'Detail' {Feature:{Color:7}}", Float) = 0 + [Toggle(_NORMALMAP)] + _DetailMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_DetailMask}}}", Float) = 0 + _DetailMask ("'Mask(A)' {Visualize:{A}, Parent:_MainTex}", 2D) = "white" {} + _DetailMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + [Enum(Mul, 0, MulX2, 1)] + _DetailMode ("'Color Mode' {Dropdown:{Mul:{}, MulX2:{}}}", Float) = 0 + _DetailAlbedoMap ("'Color(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _DetailAlbedoMapVelocity ("Scroll", Vector) = (0,0,0,0) + _DetailAlbedoMapUV ("UV Set", Float) = 0 + _DetailNormalMap ("'Normals' {Visualize:{NRM}, Parent:_DetailAlbedoMap}", 2D) = "bump" {} + _DetailWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DetailNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Team Color + [Toggle(_TEAMCOLOR_ON)] + _TeamColor ("'Team Color' {Feature:{Color:8}}", Float) = 0 + [Enum(Masks, 0, Tint, 1)] + _TeamColorMasksAsTint ("'Texture Mode' {Dropdown:{Masks:{}, Tint:{_TeamColorMasks, _TeamColor0, _TeamColor1, _TeamColor2, _TeamColor3}}}", Float) = 0 + _TeamColorMaskMap ("'Masks(RGBA)' {Visualize:{R, G, B, A, RGB}, Parent:_MainTex}", 2D) = "black" {} + _TeamColorMasks ("'Channels' {Vector:Channels}", Vector) = (1,1,1,0) + _TeamColor0 ("'Tint R' {}", Color) = (1,0,0) + _TeamColor1 ("'Tint G' {}", Color) = (0,1,0) + _TeamColor2 ("'Tint B' {}", Color) = (0,0,1) + _TeamColor3 ("'Tint A' {}", Color) = (0.5,0.5,0.5) + + // Decal + [Toggle(_DECAL_ON)] + _Decal ("'Decal' {Feature:{Color:9}}", Float) = 0 + _DecalColor ("'Tint' {}", Color) = (1,1,1,1) + _DecalTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "black" {} + _DecalTexUV ("UV Set", Float) = 0 + + // Emission + [Toggle(_EMISSION)] + _Emission ("'Emission' {Feature:{Color:10}}", Float) = 0 + [LM_Emission] + [HDR] + _EmissionColor ("'Tint' {}", Color) = (1,1,1) + [LM_Emission] + _EmissionMap ("'Mask(RGB)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "white" {} + _IncandescenceMap ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _IncandescenceMapVelocity ("Scroll", Vector) = (0,0,0,0) + _IncandescenceMapUV ("UV Set", Float) = 0 + [Gamma] + _EmissionWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + + // Rim Emission + [Toggle(_RIM_ON)] + _Rim ("'Rim Emission' {Feature:{Color:11}}", Float) = 0 + [HDR] + _RimColor ("'Tint' {}", Color) = (1,1,1) + _RimTex ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _RimTexVelocity ("Scroll", Vector) = (0,0,0,0) + _RimTexUV ("UV Set", Float) = 0 + [Gamma] + _RimWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + [Gamma] + _RimBias ("'Fill' {Min:0, Max:1}", Float) = 0 + _RimPower ("'Falloff' {Min:0.01}", Float) = 4 + + // Dissolve + [Toggle(_DISSOLVE_ON)] + _Dissolve ("'Dissolve' {Feature:{Color:12}}", Float) = 0 + [HDR] + _DissolveGlowColor ("'Glow Tint' {}", Color) = (1,1,1,1) + _DissolveTex ("'Glow Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _DissolveTexUV ("UV Set", Float) = 0 + _DissolveCutoff ("'Cutoff' {Min:0, Max:1}", Float) = 0 + [Gamma] + _DissolveGlowWeight ("'Glow Weight' {Min:0, Max:1}", Float) = 1 + _DissolveEdgeWidth ("'Glow Width' {Min:0, Max:1}", Float) = 0.01 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _Lightmapping ("'GI' {LightmapEmissionProperty:{}}", Float) = 1 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} + +SubShader { + Tags { + "RenderType" = "Opaque" + "PerformanceChecks" = "False" + "ForceNoShadowCasting" = "True" + //"DisableBatching" = "LODFading" + } + LOD 300 + Cull [_Cull] + + Pass { + Name "BASE" + Tags { "LightMode" = "ForwardBase" } + + Blend [_SrcBlend] [_DstBlend] + ZWrite [_ZWrite] + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fog + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Shaders/Definition/Unlit.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "DEFERRED" + Tags { "LightMode" = "Deferred" } + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _PARALLAXMAP + #pragma shader_feature _BUMPMODE_POM + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile ___ UNITY_HDR_ON + #pragma multi_compile_instancing + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_DEFERRED + + #include "Assets/Alloy/Shaders/Definition/Unlit.cginc" + #include "Assets/Alloy/Shaders/Forward/Gbuffer.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Shaders/Definition/Unlit.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +FallBack "VertexLit" +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Shaders/3.0/VisualEffects/Unlit.shader.meta b/Assets/Alloy/Shaders/3.0/VisualEffects/Unlit.shader.meta new file mode 100644 index 0000000..a17a0b8 --- /dev/null +++ b/Assets/Alloy/Shaders/3.0/VisualEffects/Unlit.shader.meta @@ -0,0 +1,20 @@ +fileFormatVersion: 2 +guid: fbb4081eebb667f4e8715a93d992afa9 +ShaderImporter: + defaultTextures: + - _MainTex: {instanceID: 0} + - _BumpMap: {instanceID: 0} + - _ParallaxMap: {instanceID: 0} + - _DetailMask: {instanceID: 0} + - _DetailAlbedoMap: {instanceID: 0} + - _DetailMaterialMap: {fileID: 2800000, guid: 2b77d5cb601375f4ba50c6194c126e59, + type: 3} + - _DetailNormalMap: {instanceID: 0} + - _TeamColorMaskMap: {instanceID: 0} + - _DecalTex: {instanceID: 0} + - _EmissionMap: {instanceID: 0} + - _IncandescenceMap: {instanceID: 0} + - _RimTex: {instanceID: 0} + - _DissolveTex: {instanceID: 0} + userData: + assetBundleName: diff --git a/Assets/Alloy/Shaders/4.6.meta b/Assets/Alloy/Shaders/4.6.meta new file mode 100644 index 0000000..ad029a1 --- /dev/null +++ b/Assets/Alloy/Shaders/4.6.meta @@ -0,0 +1,6 @@ +fileFormatVersion: 2 +guid: 580291f356b5dc0489041fda2145ec7a +folderAsset: yes +DefaultImporter: + userData: + assetBundleName: diff --git a/Assets/Alloy/Shaders/4.6/Core.meta b/Assets/Alloy/Shaders/4.6/Core.meta new file mode 100644 index 0000000..2866c6a --- /dev/null +++ b/Assets/Alloy/Shaders/4.6/Core.meta @@ -0,0 +1,6 @@ +fileFormatVersion: 2 +guid: b51354ba1aa8efa4ab1397b531a733e7 +folderAsset: yes +DefaultImporter: + userData: + assetBundleName: diff --git a/Assets/Alloy/Shaders/4.6/Core/Tessellation Core.shader b/Assets/Alloy/Shaders/4.6/Core/Tessellation Core.shader new file mode 100644 index 0000000..8d06dc8 --- /dev/null +++ b/Assets/Alloy/Shaders/4.6/Core/Tessellation Core.shader @@ -0,0 +1,373 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Tessellation/Core" { +Properties { + // Global Settings + _Mode ("'Rendering Mode' {RenderingMode:{Opaque:{_Cutoff}, Cutout:{}, Fade:{_Cutoff}, Transparent:{_Cutoff}}}", Float) = 0 + _SrcBlend ("__src", Float) = 0 + _DstBlend ("__dst", Float) = 0 + _ZWrite ("__zw", Float) = 1 + [LM_TransparencyCutOff] + _Cutoff ("'Opacity Cutoff' {Min:0, Max:1}", Float) = 0.5 + [Toggle(EFFECT_BUMP)] + _HasBumpMap ("'Normals Source' {Dropdown:{VertexNormals:{_BumpMap,_BumpScale,_DetailNormalMap,_DetailNormalMapScale,_WetNormalMap,_WetNormalMapScale}, NormalMaps:{}}}", Float) = 1 + [Toggle(_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A)] + _MainRoughnessSource ("'Roughness Source' {Dropdown:{PackedMapAlpha:{}, BaseColorAlpha:{_SpecTex,_Occlusion}}}", Float) = 0 + + // Main Textures + _MainTextures ("'Main Textures' {Section:{Color:0}}", Float) = 0 + [LM_Albedo] [LM_Transparency] + _Color ("'Tint' {}", Color) = (1,1,1,1) + [LM_MasterTilingOffset] [LM_Albedo] + _MainTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _MainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _MainTexUV ("UV Set", Float) = 0 + [LM_Metallic] + _SpecTex ("'Metal(R) AO(G) Spec(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_MainTex}", 2D) = "white" {} + [LM_NormalMap] + _BumpMap ("'Normals' {Visualize:{NRM}, Parent:_MainTex}", 2D) = "bump" {} + _BaseColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Main Properties + _MainPhysicalProperties ("'Main Properties' {Section:{Color:1}}", Float) = 0 + [LM_Metallic] + _Metal ("'Metallic' {Min:0, Max:1}", Float) = 1 + _Specularity ("'Specularity' {Min:0, Max:1}", Float) = 1 + _SpecularTint ("'Specular Tint' {Min:0, Max:1}", Float) = 0 + _Roughness ("'Roughness' {Min:0, Max:1}", Float) = 1 + _Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _BumpScale ("'Normal Strength' {}", Float) = 1 + + // Tessellation + _TessellationProperties ("'Tessellation' {Section:{Color:5}}", Float) = 0 + [KeywordEnum(Displacement, Phong)] + _TessellationMode ("'Mode' {Dropdown:{Displacement:{_Phong}, Phong:{_DispTex, _Displacement}}}", Float) = 0 + _DispTex ("'Heightmap(G)' {Visualize:{RGB}}", 2D) = "black" {} + _DispTexVelocity ("Scroll", Vector) = (0,0,0,0) + _Displacement ("'Displacement' {Min:0, Max:30}", Float) = 0.3 + _Phong ("'Phong Strength' {Min:0, Max:1}", Float) = 0.5 + _EdgeLength ("'Edge Length' {Min:2, Max:50}", Float) = 15 + + // AO2 + [Toggle(_AO2_ON)] + _AO2 ("'AO2' {Feature:{Color:6}}", Float) = 0 + _Ao2Map ("'AO2(G)' {Visualize:{RGB}}", 2D) = "white" {} + _Ao2MapUV ("UV Set", Float) = 1 + _Ao2Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + + // Detail + [Toggle(_DETAIL_MULX2)] + _DetailT ("'Detail' {Feature:{Color:7}}", Float) = 0 + [Toggle(_NORMALMAP)] + _DetailMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_DetailMask}}}", Float) = 0 + _DetailMask ("'Mask(A)' {Visualize:{A}, Parent:_MainTex}", 2D) = "white" {} + _DetailMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + [Enum(Mul, 0, MulX2, 1)] + _DetailMode ("'Color Mode' {Dropdown:{Mul:{}, MulX2:{}}}", Float) = 0 + _DetailAlbedoMap ("'Color(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _DetailAlbedoMapVelocity ("Scroll", Vector) = (0,0,0,0) + _DetailAlbedoMapUV ("UV Set", Float) = 0 + _DetailNormalMap ("'Normals' {Visualize:{NRM}, Parent:_DetailAlbedoMap}", 2D) = "bump" {} + _DetailWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DetailNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Team Color + [Toggle(_TEAMCOLOR_ON)] + _TeamColor ("'Team Color' {Feature:{Color:8}}", Float) = 0 + [Enum(Masks, 0, Tint, 1)] + _TeamColorMasksAsTint ("'Texture Mode' {Dropdown:{Masks:{}, Tint:{_TeamColorMasks, _TeamColor0, _TeamColor1, _TeamColor2, _TeamColor3}}}", Float) = 0 + _TeamColorMaskMap ("'Masks(RGBA)' {Visualize:{R, G, B, A, RGB}, Parent:_MainTex}", 2D) = "black" {} + _TeamColorMasks ("'Channels' {Vector:Channels}", Vector) = (1,1,1,0) + _TeamColor0 ("'Tint R' {}", Color) = (1,0,0) + _TeamColor1 ("'Tint G' {}", Color) = (0,1,0) + _TeamColor2 ("'Tint B' {}", Color) = (0,0,1) + _TeamColor3 ("'Tint A' {}", Color) = (0.5,0.5,0.5) + + // Decal + [Toggle(_DECAL_ON)] + _Decal ("'Decal' {Feature:{Color:9}}", Float) = 0 + _DecalColor ("'Tint' {}", Color) = (1,1,1,1) + _DecalTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "black" {} + _DecalTexUV ("UV Set", Float) = 0 + _DecalWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DecalSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _DecalAlphaVertexTint ("'Vertex Alpha Tint' {Min:0, Max:1}", Float) = 0 + + // Emission + [Toggle(_EMISSION)] + _Emission ("'Emission' {Feature:{Color:10}}", Float) = 0 + [LM_Emission] + [HDR] + _EmissionColor ("'Tint' {}", Color) = (1,1,1) + [LM_Emission] + _EmissionMap ("'Mask(RGB)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "white" {} + _IncandescenceMap ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _IncandescenceMapVelocity ("Scroll", Vector) = (0,0,0,0) + _IncandescenceMapUV ("UV Set", Float) = 0 + [Gamma] + _EmissionWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + + // Rim Emission + [Toggle(_RIM_ON)] + _Rim ("'Rim Emission' {Feature:{Color:11}}", Float) = 0 + [HDR] + _RimColor ("'Tint' {}", Color) = (1,1,1) + _RimTex ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _RimTexVelocity ("Scroll", Vector) = (0,0,0,0) + _RimTexUV ("UV Set", Float) = 0 + [Gamma] + _RimWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + [Gamma] + _RimBias ("'Fill' {Min:0, Max:1}", Float) = 0 + _RimPower ("'Falloff' {Min:0.01}", Float) = 4 + + // Dissolve + [Toggle(_DISSOLVE_ON)] + _Dissolve ("'Dissolve' {Feature:{Color:12}}", Float) = 0 + [HDR] + _DissolveGlowColor ("'Glow Tint' {}", Color) = (1,1,1,1) + _DissolveTex ("'Glow Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _DissolveTexUV ("UV Set", Float) = 0 + _DissolveCutoff ("'Cutoff' {Min:0, Max:1}", Float) = 0 + [Gamma] + _DissolveGlowWeight ("'Glow Weight' {Min:0, Max:1}", Float) = 1 + _DissolveEdgeWidth ("'Glow Width' {Min:0, Max:1}", Float) = 0.01 + + // Wetness + [Toggle(_WETNESS_ON)] + _WetnessProperties ("'Wetness' {Feature:{Color:13}}", Float) = 0 + [Toggle(_WETMASKSOURCE_VERTEXCOLORALPHA)] + _WetMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_WetMask}}}", Float) = 0 + _WetMask ("'Mask(A)' {Visualize:{A}}", 2D) = "white" {} + _WetMaskVelocity ("Scroll", Vector) = (0,0,0,0) + _WetMaskUV ("UV Set", Float) = 0 + _WetMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + _WetTint ("'Tint' {}", Color) = (1,1,1,1) + _WetNormalMap ("'Normals' {Visualize:{NRM}}", 2D) = "bump" {} + _WetNormalMapVelocity ("Scroll", Vector) = (0,0,0,0) + _WetNormalMapUV ("UV Set", Float) = 0 + _WetWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _WetRoughness ("'Roughness' {Min:0, Max:1}", Float) = 0.2 + _WetNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _Lightmapping ("'GI' {LightmapEmissionProperty:{}}", Float) = 1 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} + +CGINCLUDE + #define A_TESSELLATION_SHADER +ENDCG + +SubShader { + Tags { + "RenderType" = "Opaque" + "PerformanceChecks" = "False" + //"DisableBatching" = "LODFading" + } + LOD 300 + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + Blend [_SrcBlend] [_DstBlend] + ZWrite [_ZWrite] + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Shaders/Definition/Core.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend [_SrcBlend] One + ZWrite Off + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + + #include "Assets/Alloy/Shaders/Definition/Core.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _DISSOLVE_ON + + #pragma multi_compile_shadowcaster + #pragma multi_compile_instancing + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_SHADOWCASTER + + #include "Assets/Alloy/Shaders/Definition/Core.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } + + Pass { + Name "DEFERRED" + Tags { "LightMode" = "Deferred" } + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_prepassfinal + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + #pragma multi_compile_instancing + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_DEFERRED + + #include "Assets/Alloy/Shaders/Definition/Core.cginc" + #include "Assets/Alloy/Shaders/Forward/Gbuffer.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Shaders/Definition/Core.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +FallBack "Alloy/Core" +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Shaders/4.6/Core/Tessellation Core.shader.meta b/Assets/Alloy/Shaders/4.6/Core/Tessellation Core.shader.meta new file mode 100644 index 0000000..d145089 --- /dev/null +++ b/Assets/Alloy/Shaders/4.6/Core/Tessellation Core.shader.meta @@ -0,0 +1,21 @@ +fileFormatVersion: 2 +guid: 8b56e5b6bca4be748bf05d2133d20b45 +ShaderImporter: + defaultTextures: + - _MainTex: {instanceID: 0} + - _SpecTex: {instanceID: 0} + - _BumpMap: {instanceID: 0} + - _DispTex: {instanceID: 0} + - _DetailMask: {instanceID: 0} + - _DetailAlbedoMap: {instanceID: 0} + - _DetailMaterialMap: {fileID: 2800000, guid: 2b77d5cb601375f4ba50c6194c126e59, + type: 3} + - _DetailNormalMap: {instanceID: 0} + - _TeamColorMaskMap: {instanceID: 0} + - _DecalTex: {instanceID: 0} + - _EmissionMap: {instanceID: 0} + - _IncandescenceMap: {instanceID: 0} + - _RimTex: {instanceID: 0} + - _DissolveTex: {instanceID: 0} + userData: + assetBundleName: diff --git a/Assets/Alloy/Shaders/4.6/Core/Tessellation Prototyping.shader b/Assets/Alloy/Shaders/4.6/Core/Tessellation Prototyping.shader new file mode 100644 index 0000000..2beb9ec --- /dev/null +++ b/Assets/Alloy/Shaders/4.6/Core/Tessellation Prototyping.shader @@ -0,0 +1,369 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Tessellation/Prototyping" { +Properties { + // Global Settings + _Mode ("'Rendering Mode' {RenderingMode:{Opaque:{_Cutoff}, Cutout:{}, Fade:{_Cutoff}, Transparent:{_Cutoff}}}", Float) = 0 + _SrcBlend ("__src", Float) = 0 + _DstBlend ("__dst", Float) = 0 + _ZWrite ("__zw", Float) = 1 + [LM_TransparencyCutOff] + _Cutoff ("'Opacity Cutoff' {Min:0, Max:1}", Float) = 0.5 + [Toggle(EFFECT_BUMP)] + _HasBumpMap ("'Normals Source' {Dropdown:{VertexNormals:{_BumpMap,_BumpScale,_DetailNormalMap,_DetailNormalMapScale,_WetNormalMap,_WetNormalMapScale}, NormalMaps:{}}}", Float) = 1 + + // Prototyping Textures + _MainTextures ("'Prototyping Textures' {Section:{Color:0}}", Float) = 0 + [LM_Albedo] [LM_Transparency] + _Color ("'Tint' {}", Color) = (1,1,1,1) + [LM_MasterTilingOffset] [LM_Albedo] + _MainTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _MainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _MainTexUV ("UV Set", Float) = 0 + [LM_Metallic] + _MetallicMap ("'Metallic(G)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "white" {} + _AoMap ("'Ambient Occlusion(G)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "white" {} + _SpecularityMap ("'Specularity(G)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "white" {} + _RoughnessMap ("'Roughness(G)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "white" {} + [LM_NormalMap] + _BumpMap ("'Normals' {Visualize:{NRM}, Parent:_MainTex}", 2D) = "bump" {} + _BaseColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Prototyping Properties + _MainPhysicalProperties ("'Prototyping Properties' {Section:{Color:1}}", Float) = 0 + [LM_Metallic] + _Metal ("'Metallic' {Min:0, Max:1}", Float) = 1 + _Specularity ("'Specularity' {Min:0, Max:1}", Float) = 1 + _Roughness ("'Roughness' {Min:0, Max:1}", Float) = 1 + _Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _BumpScale ("'Normal Strength' {}", Float) = 1 + + // Tessellation + _TessellationProperties ("'Tessellation' {Section:{Color:5}}", Float) = 0 + [KeywordEnum(Displacement, Phong)] + _TessellationMode ("'Mode' {Dropdown:{Displacement:{_Phong}, Phong:{_DispTex, _Displacement}}}", Float) = 0 + _DispTex ("'Heightmap(G)' {Visualize:{RGB}}", 2D) = "black" {} + _DispTexVelocity ("Scroll", Vector) = (0,0,0,0) + _Displacement ("'Displacement' {Min:0, Max:30}", Float) = 0.3 + _Phong ("'Phong Strength' {Min:0, Max:1}", Float) = 0.5 + _EdgeLength ("'Edge Length' {Min:2, Max:50}", Float) = 15 + + // AO2 + [Toggle(_AO2_ON)] + _AO2 ("'AO2' {Feature:{Color:6}}", Float) = 0 + _Ao2Map ("'AO2(G)' {Visualize:{RGB}}", 2D) = "white" {} + _Ao2MapUV ("UV Set", Float) = 1 + _Ao2Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + + // Detail + [Toggle(_DETAIL_MULX2)] + _DetailT ("'Detail' {Feature:{Color:7}}", Float) = 0 + [Toggle(_NORMALMAP)] + _DetailMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_DetailMask}}}", Float) = 0 + _DetailMask ("'Mask(A)' {Visualize:{A}, Parent:_MainTex}", 2D) = "white" {} + _DetailMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + [Enum(Mul, 0, MulX2, 1)] + _DetailMode ("'Color Mode' {Dropdown:{Mul:{}, MulX2:{}}}", Float) = 0 + _DetailAlbedoMap ("'Color(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _DetailAlbedoMapVelocity ("Scroll", Vector) = (0,0,0,0) + _DetailAlbedoMapUV ("UV Set", Float) = 0 + _DetailNormalMap ("'Normals' {Visualize:{NRM}, Parent:_DetailAlbedoMap}", 2D) = "bump" {} + _DetailWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DetailNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Team Color + [Toggle(_TEAMCOLOR_ON)] + _TeamColor ("'Team Color' {Feature:{Color:8}}", Float) = 0 + [Enum(Masks, 0, Tint, 1)] + _TeamColorMasksAsTint ("'Texture Mode' {Dropdown:{Masks:{}, Tint:{_TeamColorMasks, _TeamColor0, _TeamColor1, _TeamColor2, _TeamColor3}}}", Float) = 0 + _TeamColorMaskMap ("'Masks(RGBA)' {Visualize:{R, G, B, A, RGB}, Parent:_MainTex}", 2D) = "black" {} + _TeamColorMasks ("'Channels' {Vector:Channels}", Vector) = (1,1,1,0) + _TeamColor0 ("'Tint R' {}", Color) = (1,0,0) + _TeamColor1 ("'Tint G' {}", Color) = (0,1,0) + _TeamColor2 ("'Tint B' {}", Color) = (0,0,1) + _TeamColor3 ("'Tint A' {}", Color) = (0.5,0.5,0.5) + + // Decal + [Toggle(_DECAL_ON)] + _Decal ("'Decal' {Feature:{Color:9}}", Float) = 0 + _DecalColor ("'Tint' {}", Color) = (1,1,1,1) + _DecalTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "black" {} + _DecalTexUV ("UV Set", Float) = 0 + _DecalWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DecalSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _DecalAlphaVertexTint ("'Vertex Alpha Tint' {Min:0, Max:1}", Float) = 0 + + // Emission + [Toggle(_EMISSION)] + _Emission ("'Emission' {Feature:{Color:10}}", Float) = 0 + [LM_Emission] + [HDR] + _EmissionColor ("'Tint' {}", Color) = (1,1,1) + [LM_Emission] + _EmissionMap ("'Mask(RGB)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "white" {} + _IncandescenceMap ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _IncandescenceMapVelocity ("Scroll", Vector) = (0,0,0,0) + _IncandescenceMapUV ("UV Set", Float) = 0 + [Gamma] + _EmissionWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + + // Rim Emission + [Toggle(_RIM_ON)] + _Rim ("'Rim Emission' {Feature:{Color:11}}", Float) = 0 + [HDR] + _RimColor ("'Tint' {}", Color) = (1,1,1) + _RimTex ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _RimTexVelocity ("Scroll", Vector) = (0,0,0,0) + _RimTexUV ("UV Set", Float) = 0 + [Gamma] + _RimWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + [Gamma] + _RimBias ("'Fill' {Min:0, Max:1}", Float) = 0 + _RimPower ("'Falloff' {Min:0.01}", Float) = 4 + + // Dissolve + [Toggle(_DISSOLVE_ON)] + _Dissolve ("'Dissolve' {Feature:{Color:12}}", Float) = 0 + [HDR] + _DissolveGlowColor ("'Glow Tint' {}", Color) = (1,1,1,1) + _DissolveTex ("'Glow Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _DissolveTexUV ("UV Set", Float) = 0 + _DissolveCutoff ("'Cutoff' {Min:0, Max:1}", Float) = 0 + [Gamma] + _DissolveGlowWeight ("'Glow Weight' {Min:0, Max:1}", Float) = 1 + _DissolveEdgeWidth ("'Glow Width' {Min:0, Max:1}", Float) = 0.01 + + // Wetness + [Toggle(_WETNESS_ON)] + _WetnessProperties ("'Wetness' {Feature:{Color:13}}", Float) = 0 + [Toggle(_WETMASKSOURCE_VERTEXCOLORALPHA)] + _WetMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_WetMask}}}", Float) = 0 + _WetMask ("'Mask(A)' {Visualize:{A}}", 2D) = "white" {} + _WetMaskVelocity ("Scroll", Vector) = (0,0,0,0) + _WetMaskUV ("UV Set", Float) = 0 + _WetMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + _WetTint ("'Tint' {}", Color) = (1,1,1,1) + _WetNormalMap ("'Normals' {Visualize:{NRM}}", 2D) = "bump" {} + _WetNormalMapVelocity ("Scroll", Vector) = (0,0,0,0) + _WetNormalMapUV ("UV Set", Float) = 0 + _WetWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _WetRoughness ("'Roughness' {Min:0, Max:1}", Float) = 0.2 + _WetNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _Lightmapping ("'GI' {LightmapEmissionProperty:{}}", Float) = 1 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} + +CGINCLUDE + #define A_EXPANDED_MATERIAL_MAPS + #define A_TESSELLATION_SHADER +ENDCG + +SubShader { + Tags { + "RenderType" = "Opaque" + "PerformanceChecks" = "False" + //"DisableBatching" = "LODFading" + } + LOD 300 + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + Blend [_SrcBlend] [_DstBlend] + ZWrite [_ZWrite] + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Shaders/Definition/Core.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend [_SrcBlend] One + ZWrite Off + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + + #include "Assets/Alloy/Shaders/Definition/Core.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _DISSOLVE_ON + + #pragma multi_compile_shadowcaster + #pragma multi_compile_instancing + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_SHADOWCASTER + + #include "Assets/Alloy/Shaders/Definition/Core.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } + + Pass { + Name "DEFERRED" + Tags { "LightMode" = "Deferred" } + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_prepassfinal + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + #pragma multi_compile_instancing + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_DEFERRED + + #include "Assets/Alloy/Shaders/Definition/Core.cginc" + #include "Assets/Alloy/Shaders/Forward/Gbuffer.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Shaders/Definition/Core.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +FallBack "Alloy/Prototyping" +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Shaders/4.6/Core/Tessellation Prototyping.shader.meta b/Assets/Alloy/Shaders/4.6/Core/Tessellation Prototyping.shader.meta new file mode 100644 index 0000000..d83f437 --- /dev/null +++ b/Assets/Alloy/Shaders/4.6/Core/Tessellation Prototyping.shader.meta @@ -0,0 +1,25 @@ +fileFormatVersion: 2 +guid: f86aad65a14a1494c9bd40be2e4f1efa +ShaderImporter: + defaultTextures: + - _MainTex: {instanceID: 0} + - _MetallicMap: {instanceID: 0} + - _AoMap: {instanceID: 0} + - _SpecularityMap: {instanceID: 0} + - _RoughnessMap: {instanceID: 0} + - _BumpMap: {instanceID: 0} + - _ParallaxMap: {instanceID: 0} + - _Ao2Map: {instanceID: 0} + - _DetailMask: {instanceID: 0} + - _DetailAlbedoMap: {instanceID: 0} + - _DetailMaterialMap: {fileID: 2800000, guid: 2b77d5cb601375f4ba50c6194c126e59, + type: 3} + - _DetailNormalMap: {instanceID: 0} + - _TeamColorMaskMap: {instanceID: 0} + - _DecalTex: {instanceID: 0} + - _EmissionMap: {instanceID: 0} + - _IncandescenceMap: {instanceID: 0} + - _RimTex: {instanceID: 0} + - _DissolveTex: {instanceID: 0} + userData: + assetBundleName: diff --git a/Assets/Alloy/Shaders/4.6/Human.meta b/Assets/Alloy/Shaders/4.6/Human.meta new file mode 100644 index 0000000..2ef245c --- /dev/null +++ b/Assets/Alloy/Shaders/4.6/Human.meta @@ -0,0 +1,6 @@ +fileFormatVersion: 2 +guid: 5757af4d4202d4441934a53ec0d39038 +folderAsset: yes +DefaultImporter: + userData: + assetBundleName: diff --git a/Assets/Alloy/Shaders/4.6/Human/Tessellation Eye.shader b/Assets/Alloy/Shaders/4.6/Human/Tessellation Eye.shader new file mode 100644 index 0000000..aa6181c --- /dev/null +++ b/Assets/Alloy/Shaders/4.6/Human/Tessellation Eye.shader @@ -0,0 +1,294 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Tessellation/Human/Eye" { +Properties { + // Eye Textures + _EyeballTextures ("'Eye Textures' {Section:{Color:0}}", Float) = 0 + [LM_Albedo] [LM_Transparency] + _Color ("'Tint' {}", Color) = (1,1,1,1) + [LM_MasterTilingOffset] [LM_Albedo] + _MainTex ("'Base Color(RGB) Iris(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _ParallaxMap ("'Heightmap(G)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "black" {} + [LM_NormalMap] + _BumpMap ("'Normals' {Visualize:{NRM}, Parent:_MainTex}", 2D) = "bump" {} + _BaseColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Cornea Properties + _CorneaProperties ("'Cornea' {Section:{Color:1}}", Float) = 0 + _CorneaColor ("'Tint' {}", Color) = (0.5,0.5,0.5,0) + _CorneaNormalMap ("'Normals' {Visualize:{NRM}, Parent:_MainTex}", 2D) = "bump" {} + _CorneaSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.36 + _CorneaRoughness ("'Roughness' {Min:0, Max:1}", Float) = 0.1 + _CorneaNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Iris Properties + _IrisProperties("'Iris' {Section:{Color:2}}", Float) = 0 + _IrisColor ("'Tint' {}", Color) = (1,1,1) + _Parallax ("'Depth' {Min:0, Max:0.08}", Float) = 0.02 + _IrisPupilSize ("'Pupil Dilation' {Min:0, Max:1}", Float) = 0 + _IrisShadowing ("'Shadowing' {Min:0.01}", Float) = 1.1 + _IrisScatterIntensity ("'Scatter Intensity' {Min:0}", Float) = 2 + _IrisScatterPower ("'Scatter Power' {Min:0.01}", Float) = 2.5 + + // Sclera Properties + _ScleraProperties ("'Sclera' {Section:{Color:3}}", Float) = 0 + _ScleraColor ("'Tint' {}", Color) = (1,1,1) + _ScleraSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.36 + _ScleraRoughness ("'Roughness' {Min:0, Max:1}", Float) = 0.1 + _ScleraNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Tessellation + _TessellationProperties ("'Tessellation' {Section:{Color:5}}", Float) = 0 + [KeywordEnum(Displacement, Phong)] + _TessellationMode ("'Mode' {Dropdown:{Displacement:{_Phong}, Phong:{_DispTex, _Displacement}}}", Float) = 0 + _DispTex ("'Heightmap(G)' {Visualize:{RGB}}", 2D) = "black" {} + _DispTexVelocity ("Scroll", Vector) = (0,0,0,0) + _Displacement ("'Displacement' {Min:0, Max:30}", Float) = 0.3 + _Phong ("'Phong Strength' {Min:0, Max:1}", Float) = 0.5 + _EdgeLength ("'Edge Length' {Min:2, Max:50}", Float) = 15 + + // Detail + [Toggle(_DETAIL_MULX2)] + _DetailT ("'Detail' {Feature:{Color:7}}", Float) = 0 + _DetailNormalMap ("'Normals' {Visualize:{NRM}}", 2D) = "bump" {} + _DetailWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DetailNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Decal + [Toggle(_DECAL_ON)] + _Decal ("'Decal' {Feature:{Color:9}}", Float) = 0 + _DecalColor ("'Tint' {}", Color) = (1,1,1,1) + _DecalTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "black" {} + _DecalTexUV ("UV Set", Float) = 0 + _DecalWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DecalSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _DecalAlphaVertexTint ("'Vertex Alpha Tint' {Min:0, Max:1}", Float) = 0 + + // Emission + [Toggle(_EMISSION)] + _Emission ("'Emission' {Feature:{Color:10}}", Float) = 0 + [LM_Emission] + [HDR] + _EmissionColor ("'Tint' {}", Color) = (1,1,1) + [LM_Emission] + _EmissionMap ("'Mask(RGB)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "white" {} + _IncandescenceMap ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _IncandescenceMapVelocity ("Scroll", Vector) = (0,0,0,0) + _IncandescenceMapUV ("UV Set", Float) = 0 + [Gamma] + _EmissionWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + + // Rim Emission + [Toggle(_RIM_ON)] + _Rim ("'Rim Emission' {Feature:{Color:11}}", Float) = 0 + [HDR] + _RimColor ("'Tint' {}", Color) = (1,1,1) + _RimTex ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _RimTexVelocity ("Scroll", Vector) = (0,0,0,0) + _RimTexUV ("UV Set", Float) = 0 + [Gamma] + _RimWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + [Gamma] + _RimBias ("'Fill' {Min:0, Max:1}", Float) = 0 + _RimPower ("'Falloff' {Min:0.01}", Float) = 4 + + // Dissolve + [Toggle(_DISSOLVE_ON)] + _Dissolve ("'Dissolve' {Feature:{Color:12}}", Float) = 0 + [HDR] + _DissolveGlowColor ("'Glow Tint' {}", Color) = (1,1,1,1) + _DissolveTex ("'Glow Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _DissolveTexUV ("UV Set", Float) = 0 + _DissolveCutoff ("'Cutoff' {Min:0, Max:1}", Float) = 0 + [Gamma] + _DissolveGlowWeight ("'Glow Weight' {Min:0, Max:1}", Float) = 1 + _DissolveEdgeWidth ("'Glow Width' {Min:0, Max:1}", Float) = 0.01 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _Lightmapping ("'GI' {LightmapEmissionProperty:{}}", Float) = 1 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} + +CGINCLUDE + #define A_TESSELLATION_SHADER +ENDCG + +SubShader { + Tags { + "Queue" = "Geometry" + "RenderType" = "Opaque" + //"DisableBatching" = "LODFading" + } + LOD 400 + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Shaders/Definition/Eye.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend One One + ZWrite Off + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _DECAL_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + + #include "Assets/Alloy/Shaders/Definition/Eye.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _DISSOLVE_ON + + #pragma multi_compile_shadowcaster + #pragma multi_compile_instancing + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_SHADOWCASTER + + #include "Assets/Alloy/Shaders/Definition/Eye.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } + + Pass { + Name "DEFERRED" + Tags { "LightMode" = "Deferred" } + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_prepassfinal + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + #pragma multi_compile_instancing + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_DEFERRED + + #include "Assets/Alloy/Shaders/Definition/Eye.cginc" + #include "Assets/Alloy/Shaders/Forward/Gbuffer.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Shaders/Definition/Eye.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +FallBack "Alloy/Human/Eye" +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Shaders/4.6/Human/Tessellation Eye.shader.meta b/Assets/Alloy/Shaders/4.6/Human/Tessellation Eye.shader.meta new file mode 100644 index 0000000..482622f --- /dev/null +++ b/Assets/Alloy/Shaders/4.6/Human/Tessellation Eye.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 10b5b80c5f07f444ba8bcaed9f06b5c7 +timeCreated: 1467935905 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/4.6/Human/Tessellation Hair HighQuality OneSided.shader b/Assets/Alloy/Shaders/4.6/Human/Tessellation Hair HighQuality OneSided.shader new file mode 100644 index 0000000..94027fa --- /dev/null +++ b/Assets/Alloy/Shaders/4.6/Human/Tessellation Hair HighQuality OneSided.shader @@ -0,0 +1,355 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Tessellation/Human/Hair/HighQuality OneSided" { +Properties { + // Global Settings + [LM_TransparencyCutOff] + _Cutoff ("'Opacity Cutoff' {Min:0, Max:1}", Float) = 0.5 + + // Hair Textures + _MainTextures ("'Hair Textures' {Section:{Color:0}}", Float) = 0 + [LM_Albedo] [LM_Transparency] + _Color ("'Tint' {}", Color) = (1,1,1,1) + [LM_MasterTilingOffset] [LM_Albedo] + _MainTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _MainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _MainTexUV ("UV Set", Float) = 0 + [LM_Metallic] + _SpecTex ("'Shift(R) AO(G) Noise(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_MainTex}", 2D) = "white" {} + [LM_NormalMap] + _BumpMap ("'Normals' {Visualize:{NRM}, Parent:_MainTex}", 2D) = "bump" {} + _BaseColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Hair Properties + _HairProperties ("'Hair Properties' {Section:{Color:1}}", Float) = 0 + _HairDiffuseWrapAmount ("'Diffuse Wrap' {Min:0, Max:1}", Float) = 0.25 + _HairSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.59 + _AnisoAngle ("'Highlight Rotation' {Min:0, Max:180}", Float) = 90 + _Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _BumpScale ("'Normal Strength' {}", Float) = 1 + + // Primary Highlight + _PrimaryAnisoProperties ("'Primary Highlight' {Section:{Color:2}}", Float) = 0 + _HighlightTint0 ("'Tint' {}", Color) = (1,1,1) + _HighlightWidth0 ("'Width' {Min:0, Max:1}", Float) = 0.25 + _HighlightShift0 ("'Shift' {}", Float) = 0 + + // Secondary Highlight + _SecondaryAnisoProperties ("'Secondary Highlight' {Section:{Color:3}}", Float) = 0 + _HighlightTint1 ("'Tint' {}", Color) = (1,1,1) + _HighlightWidth1 ("'Width' {Min:0, Max:1}", Float) = 0.25 + _HighlightShift1 ("'Shift' {}", Float) = 0 + + // Tessellation + _TessellationProperties ("'Tessellation' {Section:{Color:5}}", Float) = 0 + [KeywordEnum(Displacement, Phong)] + _TessellationMode ("'Mode' {Dropdown:{Displacement:{_Phong}, Phong:{_DispTex, _Displacement}}}", Float) = 0 + _DispTex ("'Heightmap(G)' {Visualize:{RGB}}", 2D) = "black" {} + _DispTexVelocity ("Scroll", Vector) = (0,0,0,0) + _Displacement ("'Displacement' {Min:0, Max:30}", Float) = 0.3 + _Phong ("'Phong Strength' {Min:0, Max:1}", Float) = 0.5 + _EdgeLength ("'Edge Length' {Min:2, Max:50}", Float) = 15 + + // Decal + [Toggle(_DECAL_ON)] + _Decal ("'Decal' {Feature:{Color:9}}", Float) = 0 + _DecalColor ("'Tint' {}", Color) = (1,1,1,1) + _DecalTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "black" {} + _DecalTexUV ("UV Set", Float) = 0 + _DecalWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DecalSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _DecalAlphaVertexTint ("'Vertex Alpha Tint' {Min:0, Max:1}", Float) = 0 + + // Emission + [Toggle(_EMISSION)] + _Emission ("'Emission' {Feature:{Color:10}}", Float) = 0 + [LM_Emission] + [HDR] + _EmissionColor ("'Tint' {}", Color) = (1,1,1) + [LM_Emission] + _EmissionMap ("'Mask(RGB)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "white" {} + _IncandescenceMap ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _IncandescenceMapVelocity ("Scroll", Vector) = (0,0,0,0) + _IncandescenceMapUV ("UV Set", Float) = 0 + [Gamma] + _EmissionWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + + // Rim Emission + [Toggle(_RIM_ON)] + _Rim ("'Rim Emission' {Feature:{Color:11}}", Float) = 0 + [HDR] + _RimColor ("'Tint' {}", Color) = (1,1,1) + _RimTex ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _RimTexVelocity ("Scroll", Vector) = (0,0,0,0) + _RimTexUV ("UV Set", Float) = 0 + [Gamma] + _RimWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + [Gamma] + _RimBias ("'Fill' {Min:0, Max:1}", Float) = 0 + _RimPower ("'Falloff' {Min:0.01}", Float) = 4 + + // Dissolve + [Toggle(_DISSOLVE_ON)] + _Dissolve ("'Dissolve' {Feature:{Color:12}}", Float) = 0 + [HDR] + _DissolveGlowColor ("'Glow Tint' {}", Color) = (1,1,1,1) + _DissolveTex ("'Glow Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _DissolveTexUV ("UV Set", Float) = 0 + _DissolveCutoff ("'Cutoff' {Min:0, Max:1}", Float) = 0 + [Gamma] + _DissolveGlowWeight ("'Glow Weight' {Min:0, Max:1}", Float) = 1 + _DissolveEdgeWidth ("'Glow Width' {Min:0, Max:1}", Float) = 0.01 + + // Wetness + [Toggle(_WETNESS_ON)] + _WetnessProperties ("'Wetness' {Feature:{Color:13}}", Float) = 0 + [Toggle(_WETMASKSOURCE_VERTEXCOLORALPHA)] + _WetMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_WetMask}}}", Float) = 0 + _WetMask ("'Mask(A)' {Visualize:{A}}", 2D) = "white" {} + _WetMaskVelocity ("Scroll", Vector) = (0,0,0,0) + _WetMaskUV ("UV Set", Float) = 0 + _WetMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + _WetTint ("'Tint' {}", Color) = (1,1,1,1) + _WetWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _WetRoughness ("'Roughness' {Min:0, Max:1}", Float) = 0.2 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _Lightmapping ("'GI' {LightmapEmissionProperty:{}}", Float) = 1 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} + +CGINCLUDE + #define A_TESSELLATION_SHADER +ENDCG + +SubShader { + Tags{ + "Queue" = "AlphaTest+1" + "IgnoreProjector" = "True" + "RenderType" = "TransparentCutout" + //"DisableBatching" = "LODFading" + } + LOD 400 + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + #define _ALPHATEST_ON + + #include "Assets/Alloy/Shaders/Definition/Hair.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend One One + ZWrite Off + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _DECAL_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + #define _ALPHATEST_ON + + #include "Assets/Alloy/Shaders/Definition/Hair.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "TRANSLUCENT_FRONT_FORWARD" + Tags { "LightMode" = "ForwardBase" } + + Blend SrcAlpha OneMinusSrcAlpha + ZWrite Off + ZTest Less + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + #define _ALPHABLEND_ON + + #include "Assets/Alloy/Shaders/Definition/Hair.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "TRANSLUCENT_FRONT_FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend SrcAlpha One + ZWrite Off + ZTest Less + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _DECAL_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + #define _ALPHABLEND_ON + + #include "Assets/Alloy/Shaders/Definition/Hair.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _DISSOLVE_ON + + #pragma multi_compile_shadowcaster + #pragma multi_compile_instancing + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_SHADOWCASTER + #define _ALPHATEST_ON + + #include "Assets/Alloy/Shaders/Definition/Hair.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Shaders/Definition/Hair.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +FallBack "Alloy/Human/Hair/HighQuality OneSided" +CustomEditor "AlloyFieldBasedEditor" +} \ No newline at end of file diff --git a/Assets/Alloy/Shaders/4.6/Human/Tessellation Hair HighQuality OneSided.shader.meta b/Assets/Alloy/Shaders/4.6/Human/Tessellation Hair HighQuality OneSided.shader.meta new file mode 100644 index 0000000..3958939 --- /dev/null +++ b/Assets/Alloy/Shaders/4.6/Human/Tessellation Hair HighQuality OneSided.shader.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 9ad4d5af61af8ed47b28379da10fa222 +ShaderImporter: + defaultTextures: + - _MainTex: {instanceID: 0} + - _SpecTex: {fileID: 2800000, guid: 33a37609d895f134d80ba24c3cf0f503, type: 3} + - _BumpMap: {instanceID: 0} + - _DispTex: {instanceID: 0} + - _DecalTex: {instanceID: 0} + - _EmissionMap: {instanceID: 0} + - _IncandescenceMap: {instanceID: 0} + - _RimTex: {instanceID: 0} + - _DissolveTex: {instanceID: 0} + userData: + assetBundleName: diff --git a/Assets/Alloy/Shaders/4.6/Human/Tessellation Hair HighQuality TwoSided.shader b/Assets/Alloy/Shaders/4.6/Human/Tessellation Hair HighQuality TwoSided.shader new file mode 100644 index 0000000..c98dc52 --- /dev/null +++ b/Assets/Alloy/Shaders/4.6/Human/Tessellation Hair HighQuality TwoSided.shader @@ -0,0 +1,443 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Tessellation/Human/Hair/HighQuality TwoSided" { +Properties { + // Global Settings + [LM_TransparencyCutOff] + _Cutoff ("'Opacity Cutoff' {Min:0, Max:1}", Float) = 0.5 + + // Hair Textures + _MainTextures ("'Hair Textures' {Section:{Color:0}}", Float) = 0 + [LM_Albedo] [LM_Transparency] + _Color ("'Tint' {}", Color) = (1,1,1,1) + [LM_MasterTilingOffset] [LM_Albedo] + _MainTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _MainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _MainTexUV ("UV Set", Float) = 0 + [LM_Metallic] + _SpecTex ("'Shift(R) AO(G) Noise(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_MainTex}", 2D) = "white" {} + [LM_NormalMap] + _BumpMap ("'Normals' {Visualize:{NRM}, Parent:_MainTex}", 2D) = "bump" {} + _BaseColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Hair Properties + _HairProperties ("'Hair Properties' {Section:{Color:1}}", Float) = 0 + _HairDiffuseWrapAmount ("'Diffuse Wrap' {Min:0, Max:1}", Float) = 0.25 + _HairSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.59 + _AnisoAngle ("'Highlight Rotation' {Min:0, Max:180}", Float) = 90 + _Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _BumpScale ("'Normal Strength' {}", Float) = 1 + + // Primary Highlight + _PrimaryAnisoProperties ("'Primary Highlight' {Section:{Color:2}}", Float) = 0 + _HighlightTint0 ("'Tint' {}", Color) = (1,1,1) + _HighlightWidth0 ("'Width' {Min:0, Max:1}", Float) = 0.25 + _HighlightShift0 ("'Shift' {}", Float) = 0 + + // Secondary Highlight + _SecondaryAnisoProperties ("'Secondary Highlight' {Section:{Color:3}}", Float) = 0 + _HighlightTint1 ("'Tint' {}", Color) = (1,1,1) + _HighlightWidth1 ("'Width' {Min:0, Max:1}", Float) = 0.25 + _HighlightShift1 ("'Shift' {}", Float) = 0 + + // Tessellation + _TessellationProperties ("'Tessellation' {Section:{Color:5}}", Float) = 0 + [KeywordEnum(Displacement, Phong)] + _TessellationMode ("'Mode' {Dropdown:{Displacement:{_Phong}, Phong:{_DispTex, _Displacement}}}", Float) = 0 + _DispTex ("'Heightmap(G)' {Visualize:{RGB}}", 2D) = "black" {} + _DispTexVelocity ("Scroll", Vector) = (0,0,0,0) + _Displacement ("'Displacement' {Min:0, Max:30}", Float) = 0.3 + _Phong ("'Phong Strength' {Min:0, Max:1}", Float) = 0.5 + _EdgeLength ("'Edge Length' {Min:2, Max:50}", Float) = 15 + + // Decal + [Toggle(_DECAL_ON)] + _Decal ("'Decal' {Feature:{Color:9}}", Float) = 0 + _DecalColor ("'Tint' {}", Color) = (1,1,1,1) + _DecalTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "black" {} + _DecalTexUV ("UV Set", Float) = 0 + _DecalWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DecalSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _DecalAlphaVertexTint ("'Vertex Alpha Tint' {Min:0, Max:1}", Float) = 0 + + // Emission + [Toggle(_EMISSION)] + _Emission ("'Emission' {Feature:{Color:10}}", Float) = 0 + [LM_Emission] + [HDR] + _EmissionColor ("'Tint' {}", Color) = (1,1,1) + [LM_Emission] + _EmissionMap ("'Mask(RGB)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "white" {} + _IncandescenceMap ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _IncandescenceMapVelocity ("Scroll", Vector) = (0,0,0,0) + _IncandescenceMapUV ("UV Set", Float) = 0 + [Gamma] + _EmissionWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + + // Rim Emission + [Toggle(_RIM_ON)] + _Rim ("'Rim Emission' {Feature:{Color:11}}", Float) = 0 + [HDR] + _RimColor ("'Tint' {}", Color) = (1,1,1) + _RimTex ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _RimTexVelocity ("Scroll", Vector) = (0,0,0,0) + _RimTexUV ("UV Set", Float) = 0 + [Gamma] + _RimWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + [Gamma] + _RimBias ("'Fill' {Min:0, Max:1}", Float) = 0 + _RimPower ("'Falloff' {Min:0.01}", Float) = 4 + + // Dissolve + [Toggle(_DISSOLVE_ON)] + _Dissolve ("'Dissolve' {Feature:{Color:12}}", Float) = 0 + [HDR] + _DissolveGlowColor ("'Glow Tint' {}", Color) = (1,1,1,1) + _DissolveTex ("'Glow Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _DissolveTexUV ("UV Set", Float) = 0 + _DissolveCutoff ("'Cutoff' {Min:0, Max:1}", Float) = 0 + [Gamma] + _DissolveGlowWeight ("'Glow Weight' {Min:0, Max:1}", Float) = 1 + _DissolveEdgeWidth ("'Glow Width' {Min:0, Max:1}", Float) = 0.01 + + // Wetness + [Toggle(_WETNESS_ON)] + _WetnessProperties ("'Wetness' {Feature:{Color:13}}", Float) = 0 + [Toggle(_WETMASKSOURCE_VERTEXCOLORALPHA)] + _WetMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_WetMask}}}", Float) = 0 + _WetMask ("'Mask(A)' {Visualize:{A}}", 2D) = "white" {} + _WetMaskVelocity ("Scroll", Vector) = (0,0,0,0) + _WetMaskUV ("UV Set", Float) = 0 + _WetMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + _WetTint ("'Tint' {}", Color) = (1,1,1,1) + _WetWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _WetRoughness ("'Roughness' {Min:0, Max:1}", Float) = 0.2 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _Lightmapping ("'GI' {LightmapEmissionProperty:{}}", Float) = 1 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} + +CGINCLUDE + #define A_TWO_SIDED_SHADER + #define A_TESSELLATION_SHADER +ENDCG + +SubShader { + Tags{ + "Queue" = "AlphaTest+1" + "IgnoreProjector" = "True" + "RenderType" = "TransparentCutout" + //"DisableBatching" = "LODFading" + } + LOD 400 + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + Cull Off + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + #define _ALPHATEST_ON + + #include "Assets/Alloy/Shaders/Definition/Hair.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend One One + ZWrite Off + Cull Off + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _DECAL_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + #define _ALPHATEST_ON + + #include "Assets/Alloy/Shaders/Definition/Hair.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "TRANSLUCENT_BACK_FORWARD" + Tags { "LightMode" = "ForwardBase" } + + Blend SrcAlpha OneMinusSrcAlpha + ZWrite Off + ZTest Less + Cull Front + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + #define _ALPHABLEND_ON + + #include "Assets/Alloy/Shaders/Definition/Hair.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "TRANSLUCENT_BACK_FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend SrcAlpha One + ZWrite Off + ZTest Less + Cull Front + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _DECAL_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + #define _ALPHABLEND_ON + + #include "Assets/Alloy/Shaders/Definition/Hair.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "TRANSLUCENT_FRONT_FORWARD" + Tags { "LightMode" = "ForwardBase" } + + Blend SrcAlpha OneMinusSrcAlpha + ZWrite Off + ZTest Less + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + #define _ALPHABLEND_ON + + #include "Assets/Alloy/Shaders/Definition/Hair.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "TRANSLUCENT_FRONT_FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend SrcAlpha One + ZWrite Off + ZTest Less + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _DECAL_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + #define _ALPHABLEND_ON + + #include "Assets/Alloy/Shaders/Definition/Hair.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + Cull Off + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _DISSOLVE_ON + + #pragma multi_compile_shadowcaster + #pragma multi_compile_instancing + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_SHADOWCASTER + #define _ALPHATEST_ON + + #include "Assets/Alloy/Shaders/Definition/Hair.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Shaders/Definition/Hair.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +FallBack "Alloy/Human/Hair/HighQuality TwoSided" +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Shaders/4.6/Human/Tessellation Hair HighQuality TwoSided.shader.meta b/Assets/Alloy/Shaders/4.6/Human/Tessellation Hair HighQuality TwoSided.shader.meta new file mode 100644 index 0000000..0e07b74 --- /dev/null +++ b/Assets/Alloy/Shaders/4.6/Human/Tessellation Hair HighQuality TwoSided.shader.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: f29dc37d6e2e32042817ad3c72fa12ee +ShaderImporter: + defaultTextures: + - _MainTex: {instanceID: 0} + - _SpecTex: {fileID: 2800000, guid: 33a37609d895f134d80ba24c3cf0f503, type: 3} + - _BumpMap: {instanceID: 0} + - _DispTex: {instanceID: 0} + - _DecalTex: {instanceID: 0} + - _EmissionMap: {instanceID: 0} + - _IncandescenceMap: {instanceID: 0} + - _RimTex: {instanceID: 0} + - _DissolveTex: {instanceID: 0} + userData: + assetBundleName: diff --git a/Assets/Alloy/Shaders/4.6/Human/Tessellation Hair LowQuality OneSided.shader b/Assets/Alloy/Shaders/4.6/Human/Tessellation Hair LowQuality OneSided.shader new file mode 100644 index 0000000..f54c12a --- /dev/null +++ b/Assets/Alloy/Shaders/4.6/Human/Tessellation Hair LowQuality OneSided.shader @@ -0,0 +1,282 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Tessellation/Human/Hair/LowQuality OneSided" { +Properties { + // Global Settings + _Mode ("'Rendering Mode' {RenderingMode:{Opaque:{_Cutoff}, Cutout:{}, Fade:{_Cutoff}, Transparent:{_Cutoff}}}", Float) = 0 + _SrcBlend ("__src", Float) = 0 + _DstBlend ("__dst", Float) = 0 + _ZWrite ("__zw", Float) = 1 + [LM_TransparencyCutOff] + _Cutoff ("'Opacity Cutoff' {Min:0, Max:1}", Float) = 0.5 + + // Hair Textures + _MainTextures ("'Hair Textures' {Section:{Color:0}}", Float) = 0 + [LM_Albedo] [LM_Transparency] + _Color ("'Tint' {}", Color) = (1,1,1,1) + [LM_MasterTilingOffset] [LM_Albedo] + _MainTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _MainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _MainTexUV ("UV Set", Float) = 0 + [LM_Metallic] + _SpecTex ("'Shift(R) AO(G) Noise(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_MainTex}", 2D) = "white" {} + [LM_NormalMap] + _BumpMap ("'Normals' {Visualize:{NRM}, Parent:_MainTex}", 2D) = "bump" {} + _BaseColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Hair Properties + _HairProperties ("'Hair Properties' {Section:{Color:1}}", Float) = 0 + _HairDiffuseWrapAmount ("'Diffuse Wrap' {Min:0, Max:1}", Float) = 0.25 + _HairSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.59 + _AnisoAngle ("'Highlight Rotation' {Min:0, Max:180}", Float) = 90 + _Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _BumpScale ("'Normal Strength' {}", Float) = 1 + + // Primary Highlight + _PrimaryAnisoProperties ("'Primary Highlight' {Section:{Color:2}}", Float) = 0 + _HighlightTint0 ("'Tint' {}", Color) = (1,1,1) + _HighlightWidth0 ("'Width' {Min:0, Max:1}", Float) = 0.25 + _HighlightShift0 ("'Shift' {}", Float) = 0 + + // Secondary Highlight + _SecondaryAnisoProperties ("'Secondary Highlight' {Section:{Color:3}}", Float) = 0 + _HighlightTint1 ("'Tint' {}", Color) = (1,1,1) + _HighlightWidth1 ("'Width' {Min:0, Max:1}", Float) = 0.25 + _HighlightShift1 ("'Shift' {}", Float) = 0 + + // Tessellation + _TessellationProperties ("'Tessellation' {Section:{Color:5}}", Float) = 0 + [KeywordEnum(Displacement, Phong)] + _TessellationMode ("'Mode' {Dropdown:{Displacement:{_Phong}, Phong:{_DispTex, _Displacement}}}", Float) = 0 + _DispTex ("'Heightmap(G)' {Visualize:{RGB}}", 2D) = "black" {} + _DispTexVelocity ("Scroll", Vector) = (0,0,0,0) + _Displacement ("'Displacement' {Min:0, Max:30}", Float) = 0.3 + _Phong ("'Phong Strength' {Min:0, Max:1}", Float) = 0.5 + _EdgeLength ("'Edge Length' {Min:2, Max:50}", Float) = 15 + + // Decal + [Toggle(_DECAL_ON)] + _Decal ("'Decal' {Feature:{Color:9}}", Float) = 0 + _DecalColor ("'Tint' {}", Color) = (1,1,1,1) + _DecalTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "black" {} + _DecalTexUV ("UV Set", Float) = 0 + + _DecalWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DecalSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _DecalAlphaVertexTint ("'Vertex Alpha Tint' {Min:0, Max:1}", Float) = 0 + + // Emission + [Toggle(_EMISSION)] + _Emission ("'Emission' {Feature:{Color:10}}", Float) = 0 + [LM_Emission] + [HDR] + _EmissionColor ("'Tint' {}", Color) = (1,1,1) + [LM_Emission] + _EmissionMap ("'Mask(RGB)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "white" {} + _IncandescenceMap ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _IncandescenceMapVelocity ("Scroll", Vector) = (0,0,0,0) + _IncandescenceMapUV ("UV Set", Float) = 0 + [Gamma] + _EmissionWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + + // Rim Emission + [Toggle(_RIM_ON)] + _Rim ("'Rim Emission' {Feature:{Color:11}}", Float) = 0 + [HDR] + _RimColor ("'Tint' {}", Color) = (1,1,1) + _RimTex ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _RimTexVelocity ("Scroll", Vector) = (0,0,0,0) + _RimTexUV ("UV Set", Float) = 0 + [Gamma] + _RimWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + [Gamma] + _RimBias ("'Fill' {Min:0, Max:1}", Float) = 0 + _RimPower ("'Falloff' {Min:0.01}", Float) = 4 + + // Dissolve + [Toggle(_DISSOLVE_ON)] + _Dissolve ("'Dissolve' {Feature:{Color:12}}", Float) = 0 + [HDR] + _DissolveGlowColor ("'Glow Tint' {}", Color) = (1,1,1,1) + _DissolveTex ("'Glow Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _DissolveTexUV ("UV Set", Float) = 0 + _DissolveCutoff ("'Cutoff' {Min:0, Max:1}", Float) = 0 + [Gamma] + _DissolveGlowWeight ("'Glow Weight' {Min:0, Max:1}", Float) = 1 + _DissolveEdgeWidth ("'Glow Width' {Min:0, Max:1}", Float) = 0.01 + + // Wetness + [Toggle(_WETNESS_ON)] + _WetnessProperties ("'Wetness' {Feature:{Color:13}}", Float) = 0 + [Toggle(_WETMASKSOURCE_VERTEXCOLORALPHA)] + _WetMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_WetMask}}}", Float) = 0 + _WetMask ("'Mask(A)' {Visualize:{A}}", 2D) = "white" {} + _WetMaskVelocity ("Scroll", Vector) = (0,0,0,0) + _WetMaskUV ("UV Set", Float) = 0 + _WetMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + _WetTint ("'Tint' {}", Color) = (1,1,1,1) + _WetWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _WetRoughness ("'Roughness' {Min:0, Max:1}", Float) = 0.2 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _Lightmapping ("'GI' {LightmapEmissionProperty:{}}", Float) = 1 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} + +CGINCLUDE + #define A_TESSELLATION_SHADER +ENDCG + +SubShader { + Tags { + "RenderType" = "Opaque" + "PerformanceChecks" = "False" + //"DisableBatching" = "LODFading" + } + LOD 300 + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + Blend [_SrcBlend] [_DstBlend] + ZWrite [_ZWrite] + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Shaders/Definition/Hair.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend [_SrcBlend] One + ZWrite Off + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _DECAL_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + + #include "Assets/Alloy/Shaders/Definition/Hair.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _DISSOLVE_ON + + #pragma multi_compile_shadowcaster + #pragma multi_compile_instancing + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_SHADOWCASTER + + #include "Assets/Alloy/Shaders/Definition/Hair.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Shaders/Definition/Hair.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +FallBack "Alloy/Human/Hair/LowQuality OneSided" +CustomEditor "AlloyFieldBasedEditor" +} \ No newline at end of file diff --git a/Assets/Alloy/Shaders/4.6/Human/Tessellation Hair LowQuality OneSided.shader.meta b/Assets/Alloy/Shaders/4.6/Human/Tessellation Hair LowQuality OneSided.shader.meta new file mode 100644 index 0000000..8d4a0a5 --- /dev/null +++ b/Assets/Alloy/Shaders/4.6/Human/Tessellation Hair LowQuality OneSided.shader.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 5be4ad61f69a9164f9c8b2fb02e66028 +ShaderImporter: + defaultTextures: + - _MainTex: {instanceID: 0} + - _SpecTex: {fileID: 2800000, guid: 33a37609d895f134d80ba24c3cf0f503, type: 3} + - _BumpMap: {instanceID: 0} + - _DispTex: {instanceID: 0} + - _DecalTex: {instanceID: 0} + - _EmissionMap: {instanceID: 0} + - _IncandescenceMap: {instanceID: 0} + - _RimTex: {instanceID: 0} + - _DissolveTex: {instanceID: 0} + userData: + assetBundleName: diff --git a/Assets/Alloy/Shaders/4.6/Human/Tessellation Hair LowQuality TwoSided.shader b/Assets/Alloy/Shaders/4.6/Human/Tessellation Hair LowQuality TwoSided.shader new file mode 100644 index 0000000..f0cf32d --- /dev/null +++ b/Assets/Alloy/Shaders/4.6/Human/Tessellation Hair LowQuality TwoSided.shader @@ -0,0 +1,287 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Tessellation/Human/Hair/LowQuality TwoSided" { +Properties { + // Global Settings + _Mode ("'Rendering Mode' {RenderingMode:{Opaque:{_Cutoff}, Cutout:{}, Fade:{_Cutoff}, Transparent:{_Cutoff}}}", Float) = 0 + _SrcBlend ("__src", Float) = 0 + _DstBlend ("__dst", Float) = 0 + _ZWrite ("__zw", Float) = 1 + [LM_TransparencyCutOff] + _Cutoff ("'Opacity Cutoff' {Min:0, Max:1}", Float) = 0.5 + + // Hair Textures + _MainTextures ("'Hair Textures' {Section:{Color:0}}", Float) = 0 + [LM_Albedo] [LM_Transparency] + _Color ("'Tint' {}", Color) = (1,1,1,1) + [LM_MasterTilingOffset] [LM_Albedo] + _MainTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _MainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _MainTexUV ("UV Set", Float) = 0 + [LM_Metallic] + _SpecTex ("'Shift(R) AO(G) Noise(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_MainTex}", 2D) = "white" {} + [LM_NormalMap] + _BumpMap ("'Normals' {Visualize:{NRM}, Parent:_MainTex}", 2D) = "bump" {} + _BaseColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Hair Properties + _HairProperties ("'Hair Properties' {Section:{Color:1}}", Float) = 0 + _HairDiffuseWrapAmount ("'Diffuse Wrap' {Min:0, Max:1}", Float) = 0.25 + _HairSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.59 + _AnisoAngle ("'Highlight Rotation' {Min:0, Max:180}", Float) = 90 + _Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _BumpScale ("'Normal Strength' {}", Float) = 1 + + // Primary Highlight + _PrimaryAnisoProperties ("'Primary Highlight' {Section:{Color:2}}", Float) = 0 + _HighlightTint0 ("'Tint' {}", Color) = (1,1,1) + _HighlightWidth0 ("'Width' {Min:0, Max:1}", Float) = 0.25 + _HighlightShift0 ("'Shift' {}", Float) = 0 + + // Secondary Highlight + _SecondaryAnisoProperties ("'Secondary Highlight' {Section:{Color:3}}", Float) = 0 + _HighlightTint1 ("'Tint' {}", Color) = (1,1,1) + _HighlightWidth1 ("'Width' {Min:0, Max:1}", Float) = 0.25 + _HighlightShift1 ("'Shift' {}", Float) = 0 + + // Tessellation + _TessellationProperties ("'Tessellation' {Section:{Color:5}}", Float) = 0 + [KeywordEnum(Displacement, Phong)] + _TessellationMode ("'Mode' {Dropdown:{Displacement:{_Phong}, Phong:{_DispTex, _Displacement}}}", Float) = 0 + _DispTex ("'Heightmap(G)' {Visualize:{RGB}}", 2D) = "black" {} + _DispTexVelocity ("Scroll", Vector) = (0,0,0,0) + _Displacement ("'Displacement' {Min:0, Max:30}", Float) = 0.3 + _Phong ("'Phong Strength' {Min:0, Max:1}", Float) = 0.5 + _EdgeLength ("'Edge Length' {Min:2, Max:50}", Float) = 15 + + // Decal + [Toggle(_DECAL_ON)] + _Decal ("'Decal' {Feature:{Color:9}}", Float) = 0 + _DecalColor ("'Tint' {}", Color) = (1,1,1,1) + _DecalTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "black" {} + _DecalTexUV ("UV Set", Float) = 0 + + _DecalWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DecalSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _DecalAlphaVertexTint ("'Vertex Alpha Tint' {Min:0, Max:1}", Float) = 0 + + // Emission + [Toggle(_EMISSION)] + _Emission ("'Emission' {Feature:{Color:10}}", Float) = 0 + [LM_Emission] + [HDR] + _EmissionColor ("'Tint' {}", Color) = (1,1,1) + [LM_Emission] + _EmissionMap ("'Mask(RGB)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "white" {} + _IncandescenceMap ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _IncandescenceMapVelocity ("Scroll", Vector) = (0,0,0,0) + _IncandescenceMapUV ("UV Set", Float) = 0 + [Gamma] + _EmissionWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + + // Rim Emission + [Toggle(_RIM_ON)] + _Rim ("'Rim Emission' {Feature:{Color:11}}", Float) = 0 + [HDR] + _RimColor ("'Tint' {}", Color) = (1,1,1) + _RimTex ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _RimTexVelocity ("Scroll", Vector) = (0,0,0,0) + _RimTexUV ("UV Set", Float) = 0 + [Gamma] + _RimWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + [Gamma] + _RimBias ("'Fill' {Min:0, Max:1}", Float) = 0 + _RimPower ("'Falloff' {Min:0.01}", Float) = 4 + + // Dissolve + [Toggle(_DISSOLVE_ON)] + _Dissolve ("'Dissolve' {Feature:{Color:12}}", Float) = 0 + [HDR] + _DissolveGlowColor ("'Glow Tint' {}", Color) = (1,1,1,1) + _DissolveTex ("'Glow Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _DissolveTexUV ("UV Set", Float) = 0 + _DissolveCutoff ("'Cutoff' {Min:0, Max:1}", Float) = 0 + [Gamma] + _DissolveGlowWeight ("'Glow Weight' {Min:0, Max:1}", Float) = 1 + _DissolveEdgeWidth ("'Glow Width' {Min:0, Max:1}", Float) = 0.01 + + // Wetness + [Toggle(_WETNESS_ON)] + _WetnessProperties ("'Wetness' {Feature:{Color:13}}", Float) = 0 + [Toggle(_WETMASKSOURCE_VERTEXCOLORALPHA)] + _WetMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_WetMask}}}", Float) = 0 + _WetMask ("'Mask(A)' {Visualize:{A}}", 2D) = "white" {} + _WetMaskVelocity ("Scroll", Vector) = (0,0,0,0) + _WetMaskUV ("UV Set", Float) = 0 + _WetMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + _WetTint ("'Tint' {}", Color) = (1,1,1,1) + _WetWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _WetRoughness ("'Roughness' {Min:0, Max:1}", Float) = 0.2 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _Lightmapping ("'GI' {LightmapEmissionProperty:{}}", Float) = 1 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} + +CGINCLUDE + #define A_TWO_SIDED_SHADER + #define A_TESSELLATION_SHADER +ENDCG + +SubShader { + Tags { + "RenderType" = "Opaque" + "PerformanceChecks" = "False" + //"DisableBatching" = "LODFading" + } + LOD 300 + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + Blend [_SrcBlend] [_DstBlend] + ZWrite [_ZWrite] + Cull Off + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Shaders/Definition/Hair.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend [_SrcBlend] One + ZWrite Off + Cull Off + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _DECAL_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + + #include "Assets/Alloy/Shaders/Definition/Hair.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + Cull Off + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _DISSOLVE_ON + + #pragma multi_compile_shadowcaster + #pragma multi_compile_instancing + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_SHADOWCASTER + + #include "Assets/Alloy/Shaders/Definition/Hair.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Shaders/Definition/Hair.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +FallBack "Alloy/Human/Hair/LowQuality TwoSided" +CustomEditor "AlloyFieldBasedEditor" +} \ No newline at end of file diff --git a/Assets/Alloy/Shaders/4.6/Human/Tessellation Hair LowQuality TwoSided.shader.meta b/Assets/Alloy/Shaders/4.6/Human/Tessellation Hair LowQuality TwoSided.shader.meta new file mode 100644 index 0000000..e712d81 --- /dev/null +++ b/Assets/Alloy/Shaders/4.6/Human/Tessellation Hair LowQuality TwoSided.shader.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 0e79e637164953e48ada3b0b85a62bc4 +ShaderImporter: + defaultTextures: + - _MainTex: {instanceID: 0} + - _SpecTex: {fileID: 2800000, guid: 33a37609d895f134d80ba24c3cf0f503, type: 3} + - _BumpMap: {instanceID: 0} + - _DispTex: {instanceID: 0} + - _DecalTex: {instanceID: 0} + - _EmissionMap: {instanceID: 0} + - _IncandescenceMap: {instanceID: 0} + - _RimTex: {instanceID: 0} + - _DissolveTex: {instanceID: 0} + userData: + assetBundleName: diff --git a/Assets/Alloy/Shaders/4.6/Human/Tessellation Skin Forward.shader b/Assets/Alloy/Shaders/4.6/Human/Tessellation Skin Forward.shader new file mode 100644 index 0000000..1e43dad --- /dev/null +++ b/Assets/Alloy/Shaders/4.6/Human/Tessellation Skin Forward.shader @@ -0,0 +1,319 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Tessellation/Human/Skin (Forward)" { +Properties { + [Toggle(EFFECT_BUMP)] + _HasBumpMap ("'Normals Source' {Dropdown:{VertexNormals:{_BumpMap,_BumpScale,_SssBumpBlur,_DetailNormalMap,_DetailNormalMapScale,_WetNormalMap,_WetNormalMapScale}, NormalMaps:{}}}", Float) = 1 + + // Skin Textures + _MainTextures ("'Skin Textures' {Section:{Color:0}}", Float) = 0 + [LM_Albedo] [LM_Transparency] + _Color ("'Tint' {}", Color) = (1,1,1,1) + [LM_MasterTilingOffset] [LM_Albedo] + _MainTex ("'Base Color(RGB) SSS(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _MainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _MainTexUV ("UV Set", Float) = 0 + [LM_Metallic] + _SpecTex ("'Metal(R) AO(G) Spec(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_MainTex}", 2D) = "white" {} + [LM_NormalMap] + _BumpMap ("'Normals' {Visualize:{NRM}, Parent:_MainTex}", 2D) = "bump" {} + _BaseColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Skin Properties + _MainPhysicalProperties ("'Skin Properties' {Section:{Color:1}}", Float) = 0 + _Metal ("'Metallic' {Min:0, Max:1}", Float) = 1 + _Specularity ("'Specularity' {Min:0, Max:1}", Float) = 1 + _Roughness ("'Roughness' {Min:0, Max:1}", Float) = 1 + _Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _BumpScale ("'Normal Strength' {}", Float) = 1 + + // Skin Scattering + _SkinScatteringProperties ("'Skin Scattering' {Section:{Color:2}}", Float) = 0 + _SssBrdfTex ("'LUT' {Controls:False}", 2D) = "white" {} + _SssWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _SssMaskCutoff ("'Mask Cutoff' {Min:0.01, Max:1}", Float) = 0.1 + _SssBias ("'Bias' {Min:0, Max:1}", Float) = 0 + _SssScale ("'Scale' {Min:0, Max:1}", Float) = 1 + _SssBumpBlur ("'Bump Blur' {Min:0, Max:1}", Float) = 0.7 + _SssTransmissionAbsorption ("'Absorption' {Vector:3}", Vector) = (-8,-40,-64,0) + _SssColorBleedAoWeights ("'AO Color Bleed' {Vector:3}", Vector) = (0.4,0.15,0.13,0) + + // Transmission + _TransmissionProperties ("'Transmission' {Section:{Color:3}}", Float) = 0 + _TransWeight ("'Weight' {Min:0, Max:1}", Float) = 1.0 + _TransDistortion ("'Bump Distortion' {Min:0, Max:1}", Float) = 0.1 + _TransPower ("'Falloff' {Min:1}", Float) = 1 + + // Tessellation + _TessellationProperties("'Tessellation' {Section:{Color:5}}", Float) = 0 + [KeywordEnum(Displacement, Phong)] + _TessellationMode("'Mode' {Dropdown:{Displacement:{_Phong}, Phong:{_DispTex, _Displacement}}}", Float) = 0 + _DispTex("'Heightmap(G)' {Visualize:{RGB}}", 2D) = "black" {} + _DispTexVelocity("Scroll", Vector) = (0,0,0,0) + _Displacement("'Displacement' {Min:0, Max:30}", Float) = 0.3 + _Phong("'Phong Strength' {Min:0, Max:1}", Float) = 0.5 + _EdgeLength("'Edge Length' {Min:2, Max:50}", Float) = 15 + + // Detail + [Toggle(_DETAIL_MULX2)] + _DetailT ("'Detail' {Feature:{Color:7}}", Float) = 0 + [Toggle(_NORMALMAP)] + _DetailMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_DetailMask}}}", Float) = 0 + _DetailMask ("'Mask(A)' {Visualize:{A}, Parent:_MainTex}", 2D) = "white" {} + _DetailMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + [Enum(Mul, 0, MulX2, 1)] + _DetailMode ("'Color Mode' {Dropdown:{Mul:{}, MulX2:{}}}", Float) = 0 + _DetailAlbedoMap ("'Color(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _DetailAlbedoMapVelocity ("Scroll", Vector) = (0,0,0,0) + _DetailAlbedoMapUV ("UV Set", Float) = 0 + _DetailNormalMap ("'Normals' {Visualize:{NRM}, Parent:_DetailAlbedoMap}", 2D) = "bump" {} + _DetailWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DetailNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Team Color + [Toggle(_TEAMCOLOR_ON)] + _TeamColor ("'Team Color' {Feature:{Color:8}}", Float) = 0 + [Enum(Masks, 0, Tint, 1)] + _TeamColorMasksAsTint ("'Texture Mode' {Dropdown:{Masks:{}, Tint:{_TeamColorMasks, _TeamColor0, _TeamColor1, _TeamColor2, _TeamColor3}}}", Float) = 0 + _TeamColorMaskMap ("'Masks(RGBA)' {Visualize:{R, G, B, A, RGB}, Parent:_MainTex}", 2D) = "black" {} + _TeamColorMasks ("'Channels' {Vector:Channels}", Vector) = (1,1,1,0) + _TeamColor0 ("'Tint R' {}", Color) = (1,0,0) + _TeamColor1 ("'Tint G' {}", Color) = (0,1,0) + _TeamColor2 ("'Tint B' {}", Color) = (0,0,1) + _TeamColor3 ("'Tint A' {}", Color) = (0.5,0.5,0.5) + + // Decal + [Toggle(_DECAL_ON)] + _Decal ("'Decal' {Feature:{Color:9}}", Float) = 0 + _DecalColor ("'Tint' {}", Color) = (1,1,1,1) + _DecalTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "black" {} + _DecalTexUV ("UV Set", Float) = 0 + _DecalWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DecalSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _DecalAlphaVertexTint ("'Vertex Alpha Tint' {Min:0, Max:1}", Float) = 0 + + // Emission + [Toggle(_EMISSION)] + _Emission ("'Emission' {Feature:{Color:10}}", Float) = 0 + [LM_Emission] + [HDR] + _EmissionColor ("'Tint' {}", Color) = (1,1,1) + [LM_Emission] + _EmissionMap ("'Mask(RGB)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "white" {} + _IncandescenceMap ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _IncandescenceMapVelocity ("Scroll", Vector) = (0,0,0,0) + _IncandescenceMapUV ("UV Set", Float) = 0 + [Gamma] + _EmissionWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + + // Rim Emission + [Toggle(_RIM_ON)] + _Rim ("'Rim Emission' {Feature:{Color:11}}", Float) = 0 + [HDR] + _RimColor ("'Tint' {}", Color) = (1,1,1) + _RimTex ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _RimTexVelocity ("Scroll", Vector) = (0,0,0,0) + _RimTexUV ("UV Set", Float) = 0 + [Gamma] + _RimWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + [Gamma] + _RimBias ("'Fill' {Min:0, Max:1}", Float) = 0 + _RimPower ("'Falloff' {Min:0.01}", Float) = 4 + + // Dissolve + [Toggle(_DISSOLVE_ON)] + _Dissolve ("'Dissolve' {Feature:{Color:12}}", Float) = 0 + [HDR] + _DissolveGlowColor ("'Glow Tint' {}", Color) = (1,1,1,1) + _DissolveTex ("'Glow Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _DissolveTexUV ("UV Set", Float) = 0 + _DissolveCutoff ("'Cutoff' {Min:0, Max:1}", Float) = 0 + [Gamma] + _DissolveGlowWeight ("'Glow Weight' {Min:0, Max:1}", Float) = 1 + _DissolveEdgeWidth ("'Glow Width' {Min:0, Max:1}", Float) = 0.01 + + // Wetness + [Toggle(_WETNESS_ON)] + _WetnessProperties ("'Wetness' {Feature:{Color:13}}", Float) = 0 + [Toggle(_WETMASKSOURCE_VERTEXCOLORALPHA)] + _WetMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_WetMask}}}", Float) = 0 + _WetMask ("'Mask(A)' {Visualize:{A}}", 2D) = "white" {} + _WetMaskVelocity ("Scroll", Vector) = (0,0,0,0) + _WetMaskUV ("UV Set", Float) = 0 + _WetMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + _WetTint ("'Tint' {}", Color) = (1,1,1,1) + _WetNormalMap ("'Normals' {Visualize:{NRM}}", 2D) = "bump" {} + _WetNormalMapVelocity ("Scroll", Vector) = (0,0,0,0) + _WetNormalMapUV ("UV Set", Float) = 0 + _WetWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _WetRoughness ("'Roughness' {Min:0, Max:1}", Float) = 0.2 + _WetNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _Lightmapping ("'GI' {LightmapEmissionProperty:{}}", Float) = 1 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} + +CGINCLUDE + #define A_FORWARD_ONLY_SHADER + #define A_TESSELLATION_SHADER +ENDCG + +SubShader { + Tags { + "Queue" = "Geometry" + "RenderType" = "Opaque" + //"DisableBatching" = "LODFading" + } + LOD 400 + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Shaders/Definition/Skin.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend One One + ZWrite Off + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + + #include "Assets/Alloy/Shaders/Definition/Skin.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _DISSOLVE_ON + + #pragma multi_compile_shadowcaster + #pragma multi_compile_instancing + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_SHADOWCASTER + + #include "Assets/Alloy/Shaders/Definition/Skin.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Shaders/Definition/Skin.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +FallBack "Alloy/Human/Skin (Forward)" +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Shaders/4.6/Human/Tessellation Skin Forward.shader.meta b/Assets/Alloy/Shaders/4.6/Human/Tessellation Skin Forward.shader.meta new file mode 100644 index 0000000..1717aaa --- /dev/null +++ b/Assets/Alloy/Shaders/4.6/Human/Tessellation Skin Forward.shader.meta @@ -0,0 +1,25 @@ +fileFormatVersion: 2 +guid: ae120dc2c1e0ac145a058b0769923595 +timeCreated: 1461811064 +licenseType: Pro +ShaderImporter: + defaultTextures: + - _MainTex: {instanceID: 0} + - _SpecTex: {instanceID: 0} + - _BumpMap: {instanceID: 0} + - _SssBrdfTex: {fileID: 2800000, guid: d13510bb2be49aa40a66a0101efb6a36, type: 3} + - _DispTex: {instanceID: 0} + - _DetailMask: {instanceID: 0} + - _DetailAlbedoMap: {instanceID: 0} + - _DetailMaterialMap: {fileID: 2800000, guid: 2b77d5cb601375f4ba50c6194c126e59, + type: 3} + - _DetailNormalMap: {instanceID: 0} + - _TeamColorMaskMap: {instanceID: 0} + - _DecalTex: {instanceID: 0} + - _EmissionMap: {instanceID: 0} + - _IncandescenceMap: {instanceID: 0} + - _RimTex: {instanceID: 0} + - _DissolveTex: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/4.6/Human/Tessellation Skin.shader b/Assets/Alloy/Shaders/4.6/Human/Tessellation Skin.shader new file mode 100644 index 0000000..f139c75 --- /dev/null +++ b/Assets/Alloy/Shaders/4.6/Human/Tessellation Skin.shader @@ -0,0 +1,340 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Tessellation/Human/Skin" { +Properties { + [Toggle(EFFECT_BUMP)] + _HasBumpMap ("'Normals Source' {Dropdown:{VertexNormals:{_BumpMap,_BumpScale,_DetailNormalMap,_DetailNormalMapScale,_WetNormalMap,_WetNormalMapScale}, NormalMaps:{}}}", Float) = 1 + + // Skin Textures + _MainTextures ("'Skin Textures' {Section:{Color:0}}", Float) = 0 + [LM_Albedo] [LM_Transparency] + _Color ("'Tint' {}", Color) = (1,1,1,1) + [LM_MasterTilingOffset] [LM_Albedo] + _MainTex ("'Base Color(RGB) SSS(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _MainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _MainTexUV ("UV Set", Float) = 0 + [LM_Metallic] + _SpecTex ("'Metal(R) AO(G) Spec(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_MainTex}", 2D) = "white" {} + [LM_NormalMap] + _BumpMap ("'Normals' {Visualize:{NRM}, Parent:_MainTex}", 2D) = "bump" {} + _BaseColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Skin Properties + _MainPhysicalProperties ("'Skin Properties' {Section:{Color:1}}", Float) = 0 + _Metal ("'Metallic' {Min:0, Max:1}", Float) = 1 + _Specularity ("'Specularity' {Min:0, Max:1}", Float) = 1 + _Roughness ("'Roughness' {Min:0, Max:1}", Float) = 1 + _Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _BumpScale ("'Normal Strength' {}", Float) = 1 + + // Tessellation + _TessellationProperties("'Tessellation' {Section:{Color:5}}", Float) = 0 + [KeywordEnum(Displacement, Phong)] + _TessellationMode("'Mode' {Dropdown:{Displacement:{_Phong}, Phong:{_DispTex, _Displacement}}}", Float) = 0 + _DispTex("'Heightmap(G)' {Visualize:{RGB}}", 2D) = "black" {} + _DispTexVelocity("Scroll", Vector) = (0,0,0,0) + _Displacement("'Displacement' {Min:0, Max:30}", Float) = 0.3 + _Phong("'Phong Strength' {Min:0, Max:1}", Float) = 0.5 + _EdgeLength("'Edge Length' {Min:2, Max:50}", Float) = 15 + + // Detail + [Toggle(_DETAIL_MULX2)] + _DetailT ("'Detail' {Feature:{Color:7}}", Float) = 0 + [Toggle(_NORMALMAP)] + _DetailMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_DetailMask}}}", Float) = 0 + _DetailMask ("'Mask(A)' {Visualize:{A}, Parent:_MainTex}", 2D) = "white" {} + _DetailMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + [Enum(Mul, 0, MulX2, 1)] + _DetailMode ("'Color Mode' {Dropdown:{Mul:{}, MulX2:{}}}", Float) = 0 + _DetailAlbedoMap ("'Color(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _DetailAlbedoMapVelocity ("Scroll", Vector) = (0,0,0,0) + _DetailAlbedoMapUV ("UV Set", Float) = 0 + _DetailNormalMap ("'Normals' {Visualize:{NRM}, Parent:_DetailAlbedoMap}", 2D) = "bump" {} + _DetailWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DetailNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Team Color + [Toggle(_TEAMCOLOR_ON)] + _TeamColor ("'Team Color' {Feature:{Color:8}}", Float) = 0 + [Enum(Masks, 0, Tint, 1)] + _TeamColorMasksAsTint ("'Texture Mode' {Dropdown:{Masks:{}, Tint:{_TeamColorMasks, _TeamColor0, _TeamColor1, _TeamColor2, _TeamColor3}}}", Float) = 0 + _TeamColorMaskMap ("'Masks(RGBA)' {Visualize:{R, G, B, A, RGB}, Parent:_MainTex}", 2D) = "black" {} + _TeamColorMasks ("'Channels' {Vector:Channels}", Vector) = (1,1,1,0) + _TeamColor0 ("'Tint R' {}", Color) = (1,0,0) + _TeamColor1 ("'Tint G' {}", Color) = (0,1,0) + _TeamColor2 ("'Tint B' {}", Color) = (0,0,1) + _TeamColor3 ("'Tint A' {}", Color) = (0.5,0.5,0.5) + + // Decal + [Toggle(_DECAL_ON)] + _Decal ("'Decal' {Feature:{Color:9}}", Float) = 0 + _DecalColor ("'Tint' {}", Color) = (1,1,1,1) + _DecalTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "black" {} + _DecalTexUV ("UV Set", Float) = 0 + _DecalWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DecalSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _DecalAlphaVertexTint ("'Vertex Alpha Tint' {Min:0, Max:1}", Float) = 0 + + // Emission + [Toggle(_EMISSION)] + _Emission ("'Emission' {Feature:{Color:10}}", Float) = 0 + [LM_Emission] + [HDR] + _EmissionColor ("'Tint' {}", Color) = (1,1,1) + [LM_Emission] + _EmissionMap ("'Mask(RGB)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "white" {} + _IncandescenceMap ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _IncandescenceMapVelocity ("Scroll", Vector) = (0,0,0,0) + _IncandescenceMapUV ("UV Set", Float) = 0 + [Gamma] + _EmissionWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + + // Rim Emission + [Toggle(_RIM_ON)] + _Rim ("'Rim Emission' {Feature:{Color:11}}", Float) = 0 + [HDR] + _RimColor ("'Tint' {}", Color) = (1,1,1) + _RimTex ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _RimTexVelocity ("Scroll", Vector) = (0,0,0,0) + _RimTexUV ("UV Set", Float) = 0 + [Gamma] + _RimWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + [Gamma] + _RimBias ("'Fill' {Min:0, Max:1}", Float) = 0 + _RimPower ("'Falloff' {Min:0.01}", Float) = 4 + + // Dissolve + [Toggle(_DISSOLVE_ON)] + _Dissolve ("'Dissolve' {Feature:{Color:12}}", Float) = 0 + [HDR] + _DissolveGlowColor ("'Glow Tint' {}", Color) = (1,1,1,1) + _DissolveTex ("'Glow Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _DissolveTexUV ("UV Set", Float) = 0 + _DissolveCutoff ("'Cutoff' {Min:0, Max:1}", Float) = 0 + [Gamma] + _DissolveGlowWeight ("'Glow Weight' {Min:0, Max:1}", Float) = 1 + _DissolveEdgeWidth ("'Glow Width' {Min:0, Max:1}", Float) = 0.01 + + // Wetness + [Toggle(_WETNESS_ON)] + _WetnessProperties ("'Wetness' {Feature:{Color:13}}", Float) = 0 + [Toggle(_WETMASKSOURCE_VERTEXCOLORALPHA)] + _WetMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_WetMask}}}", Float) = 0 + _WetMask ("'Mask(A)' {Visualize:{A}}", 2D) = "white" {} + _WetMaskVelocity ("Scroll", Vector) = (0,0,0,0) + _WetMaskUV ("UV Set", Float) = 0 + _WetMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + _WetTint ("'Tint' {}", Color) = (1,1,1,1) + _WetNormalMap ("'Normals' {Visualize:{NRM}}", 2D) = "bump" {} + _WetNormalMapVelocity ("Scroll", Vector) = (0,0,0,0) + _WetNormalMapUV ("UV Set", Float) = 0 + _WetWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _WetRoughness ("'Roughness' {Min:0, Max:1}", Float) = 0.2 + _WetNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _Lightmapping ("'GI' {LightmapEmissionProperty:{}}", Float) = 1 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} + +CGINCLUDE + #define A_TESSELLATION_SHADER +ENDCG + +SubShader { + Tags { + "Queue" = "Geometry" + "RenderType" = "Opaque" + //"DisableBatching" = "LODFading" + } + LOD 400 + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Shaders/Definition/Skin.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend One One + ZWrite Off + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + + #include "Assets/Alloy/Shaders/Definition/Skin.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _DISSOLVE_ON + + #pragma multi_compile_shadowcaster + #pragma multi_compile_instancing + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_SHADOWCASTER + + #include "Assets/Alloy/Shaders/Definition/Skin.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } + + Pass { + Name "DEFERRED" + Tags { "LightMode" = "Deferred" } + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_prepassfinal + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + #pragma multi_compile_instancing + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_DEFERRED + + #include "Assets/Alloy/Shaders/Definition/Skin.cginc" + #include "Assets/Alloy/Shaders/Forward/Gbuffer.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Shaders/Definition/Skin.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +FallBack "Alloy/Human/Skin" +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Shaders/4.6/Human/Tessellation Skin.shader.meta b/Assets/Alloy/Shaders/4.6/Human/Tessellation Skin.shader.meta new file mode 100644 index 0000000..3837a28 --- /dev/null +++ b/Assets/Alloy/Shaders/4.6/Human/Tessellation Skin.shader.meta @@ -0,0 +1,24 @@ +fileFormatVersion: 2 +guid: a3f502ad9d724f64790e4634858ec2fc +timeCreated: 1445805726 +licenseType: Pro +ShaderImporter: + defaultTextures: + - _MainTex: {instanceID: 0} + - _SpecTex: {instanceID: 0} + - _BumpMap: {instanceID: 0} + - _DispTex: {instanceID: 0} + - _DetailMask: {instanceID: 0} + - _DetailAlbedoMap: {instanceID: 0} + - _DetailMaterialMap: {fileID: 2800000, guid: 2b77d5cb601375f4ba50c6194c126e59, + type: 3} + - _DetailNormalMap: {instanceID: 0} + - _TeamColorMaskMap: {instanceID: 0} + - _DecalTex: {instanceID: 0} + - _EmissionMap: {instanceID: 0} + - _IncandescenceMap: {instanceID: 0} + - _RimTex: {instanceID: 0} + - _DissolveTex: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/4.6/Specialist.meta b/Assets/Alloy/Shaders/4.6/Specialist.meta new file mode 100644 index 0000000..d4628b0 --- /dev/null +++ b/Assets/Alloy/Shaders/4.6/Specialist.meta @@ -0,0 +1,6 @@ +fileFormatVersion: 2 +guid: ffc0f031d756c724188846412b3d781c +folderAsset: yes +DefaultImporter: + userData: + assetBundleName: diff --git a/Assets/Alloy/Shaders/4.6/Specialist/Tessellation Car Paint.shader b/Assets/Alloy/Shaders/4.6/Specialist/Tessellation Car Paint.shader new file mode 100644 index 0000000..adcf70f --- /dev/null +++ b/Assets/Alloy/Shaders/4.6/Specialist/Tessellation Car Paint.shader @@ -0,0 +1,383 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Tessellation/Car Paint" { +Properties { + // Global Settings + _Mode ("'Rendering Mode' {RenderingMode:{Opaque:{_Cutoff}, Cutout:{}, Fade:{_Cutoff}, Transparent:{_Cutoff}}}", Float) = 0 + _SrcBlend ("__src", Float) = 0 + _DstBlend ("__dst", Float) = 0 + _ZWrite ("__zw", Float) = 1 + [LM_TransparencyCutOff] + _Cutoff ("'Opacity Cutoff' {Min:0, Max:1}", Float) = 0.5 + [Toggle(EFFECT_BUMP)] + _HasBumpMap ("'Normals Source' {Dropdown:{VertexNormals:{_BumpMap,_BumpScale,_DetailNormalMap,_DetailNormalMapScale,_WetNormalMap,_WetNormalMapScale}, NormalMaps:{}}}", Float) = 1 + + // Car Paint Textures + _MainTextures ("'Car Paint Textures' {Section:{Color:0}}", Float) = 0 + [LM_Albedo] [LM_Transparency] + _Color ("'Tint' {}", Color) = (1,1,1,1) + [LM_MasterTilingOffset] [LM_Albedo] + _MainTex ("'Base Color(RGB) Paint(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _MainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _MainTexUV ("UV Set", Float) = 0 + [LM_Metallic] + _SpecTex ("'Metal(R) AO(G) Spec(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_MainTex}", 2D) = "white" {} + [LM_NormalMap] + _BumpMap ("'Normals' {Visualize:{NRM}, Parent:_MainTex}", 2D) = "bump" {} + _BaseColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Car Paint Properties + _MainPhysicalProperties ("'Car Paint Properties' {Section:{Color:1}}", Float) = 0 + [LM_Metallic] + _Metal ("'Metallic' {Min:0, Max:1}", Float) = 1 + _Specularity ("'Specularity' {Min:0, Max:1}", Float) = 1 + _SpecularTint ("'Specular Tint' {Min:0, Max:1}", Float) = 0 + _Roughness ("'Roughness' {Min:0, Max:1}", Float) = 1 + _Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _BumpScale ("'Normal Strength' {}", Float) = 1 + + // Paint + _PaintProperties ("'Paint' {Section:{Color:2}}", Float) = 0 + _CarPrimaryColor ("'Primary Color' {}", Color) = (1,1,1) + _CarSecondaryColor ("'Secondary Color' {}", Color) = (1,1,1) + _CarSecondaryColorWeight ("'Blend Weight' {Min:0, Max:1}", Float) = 1 + _CarSecondaryColorFalloff ("'Blend Falloff' {Min:0, Max:1}", Float) = 1 + + // Flakes + _FlakeProperties ("'Flakes' {Section:{Color:3}}", Float) = 0 + _CarFlakeColor ("'Tint' {}", Color) = (1,1,1) + _CarFlakeMap ("'Color(RGB) Mask(A)' {Visualize:{RGB,A}}", 2D) = "black" {} + _CarFlakeMapUV ("UV Set", Float) = 0 + _CarFlakeMapFalloff ("'Mask Falloff' {Min:0.01}", Float) = 1 + _CarFlakeWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _CarFlakeSpread ("'Spread' {Min:0, Max:1}", Float) = 0.5 + _CarFlakeHighlightSpread ("'Highlight Spread' {Min:0, Max:1}", Float) = 0.5 + + // Tessellation + _TessellationProperties ("'Tessellation' {Section:{Color:5}}", Float) = 0 + [KeywordEnum(Displacement, Phong)] + _TessellationMode ("'Mode' {Dropdown:{Displacement:{_Phong}, Phong:{_DispTex, _Displacement}}}", Float) = 0 + _DispTex ("'Heightmap(G)' {Visualize:{RGB}}", 2D) = "black" {} + _DispTexVelocity ("Scroll", Vector) = (0,0,0,0) + _Displacement ("'Displacement' {Min:0, Max:30}", Float) = 0.3 + _Phong ("'Phong Strength' {Min:0, Max:1}", Float) = 0.5 + _EdgeLength ("'Edge Length' {Min:2, Max:50}", Float) = 15 + + // AO2 + [Toggle(_AO2_ON)] + _AO2 ("'AO2' {Feature:{Color:6}}", Float) = 0 + _Ao2Map ("'AO2(G)' {Visualize:{RGB}}", 2D) = "white" {} + _Ao2MapUV ("UV Set", Float) = 1 + _Ao2Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + + // Detail + [Toggle(_DETAIL_MULX2)] + _DetailT ("'Detail' {Feature:{Color:7}}", Float) = 0 + [Toggle(_NORMALMAP)] + _DetailMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_DetailMask}}}", Float) = 0 + _DetailMask ("'Mask(A)' {Visualize:{A}, Parent:_MainTex}", 2D) = "white" {} + _DetailMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + [Enum(Mul, 0, MulX2, 1)] + _DetailMode ("'Color Mode' {Dropdown:{Mul:{}, MulX2:{}}}", Float) = 0 + _DetailAlbedoMap ("'Color(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _DetailAlbedoMapVelocity ("Scroll", Vector) = (0,0,0,0) + _DetailAlbedoMapUV ("UV Set", Float) = 0 + _DetailNormalMap ("'Normals' {Visualize:{NRM}, Parent:_DetailAlbedoMap}", 2D) = "bump" {} + _DetailWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DetailNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Team Color + [Toggle(_TEAMCOLOR_ON)] + _TeamColor ("'Team Color' {Feature:{Color:8}}", Float) = 0 + [Enum(Masks, 0, Tint, 1)] + _TeamColorMasksAsTint ("'Texture Mode' {Dropdown:{Masks:{}, Tint:{_TeamColorMasks, _TeamColor0, _TeamColor1, _TeamColor2, _TeamColor3}}}", Float) = 0 + _TeamColorMaskMap ("'Masks(RGBA)' {Visualize:{R, G, B, A, RGB}, Parent:_MainTex}", 2D) = "black" {} + _TeamColorMasks ("'Channels' {Vector:Channels}", Vector) = (1,1,1,0) + _TeamColor0 ("'Tint R' {}", Color) = (1,0,0) + _TeamColor1 ("'Tint G' {}", Color) = (0,1,0) + _TeamColor2 ("'Tint B' {}", Color) = (0,0,1) + _TeamColor3 ("'Tint A' {}", Color) = (0.5,0.5,0.5) + + // Decal + [Toggle(_DECAL_ON)] + _Decal ("'Decal' {Feature:{Color:9}}", Float) = 0 + _DecalColor ("'Tint' {}", Color) = (1,1,1,1) + _DecalTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "black" {} + _DecalTexUV ("UV Set", Float) = 0 + _DecalWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DecalSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _DecalAlphaVertexTint ("'Vertex Alpha Tint' {Min:0, Max:1}", Float) = 0 + + // Emission + [Toggle(_EMISSION)] + _Emission ("'Emission' {Feature:{Color:10}}", Float) = 0 + [LM_Emission] + [HDR] + _EmissionColor ("'Tint' {}", Color) = (1,1,1) + [LM_Emission] + _EmissionMap ("'Mask(RGB)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "white" {} + _IncandescenceMap ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _IncandescenceMapVelocity ("Scroll", Vector) = (0,0,0,0) + _IncandescenceMapUV ("UV Set", Float) = 0 + [Gamma] + _EmissionWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + + // Rim Emission + [Toggle(_RIM_ON)] + _Rim ("'Rim Emission' {Feature:{Color:11}}", Float) = 0 + [HDR] + _RimColor ("'Tint' {}", Color) = (1,1,1) + _RimTex ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _RimTexVelocity ("Scroll", Vector) = (0,0,0,0) + _RimTexUV ("UV Set", Float) = 0 + [Gamma] + _RimWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + [Gamma] + _RimBias ("'Fill' {Min:0, Max:1}", Float) = 0 + _RimPower ("'Falloff' {Min:0.01}", Float) = 4 + + // Dissolve + [Toggle(_DISSOLVE_ON)] + _Dissolve ("'Dissolve' {Feature:{Color:12}}", Float) = 0 + [HDR] + _DissolveGlowColor ("'Glow Tint' {}", Color) = (1,1,1,1) + _DissolveTex ("'Glow Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _DissolveTexUV ("UV Set", Float) = 0 + _DissolveCutoff ("'Cutoff' {Min:0, Max:1}", Float) = 0 + [Gamma] + _DissolveGlowWeight ("'Glow Weight' {Min:0, Max:1}", Float) = 1 + _DissolveEdgeWidth ("'Glow Width' {Min:0, Max:1}", Float) = 0.01 + + // Wetness + [Toggle(_WETNESS_ON)] + _WetnessProperties ("'Wetness' {Feature:{Color:13}}", Float) = 0 + [Toggle(_WETMASKSOURCE_VERTEXCOLORALPHA)] + _WetMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_WetMask}}}", Float) = 0 + _WetMask ("'Mask(A)' {Visualize:{A}}", 2D) = "white" {} + _WetMaskVelocity ("Scroll", Vector) = (0,0,0,0) + _WetMaskUV ("UV Set", Float) = 0 + _WetMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + _WetTint ("'Tint' {}", Color) = (1,1,1,1) + _WetNormalMap ("'Normals' {Visualize:{NRM}}", 2D) = "bump" {} + _WetNormalMapVelocity ("Scroll", Vector) = (0,0,0,0) + _WetNormalMapUV ("UV Set", Float) = 0 + _WetWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _WetRoughness ("'Roughness' {Min:0, Max:1}", Float) = 0.2 + _WetNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _Lightmapping ("'GI' {LightmapEmissionProperty:{}}", Float) = 1 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} + +CGINCLUDE + #define A_TESSELLATION_SHADER +ENDCG + +SubShader { + Tags { + "RenderType" = "Opaque" + "PerformanceChecks" = "False" + //"DisableBatching" = "LODFading" + } + LOD 300 + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + Blend [_SrcBlend] [_DstBlend] + ZWrite [_ZWrite] + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Shaders/Definition/CarPaint.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend [_SrcBlend] One + ZWrite Off + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + + #include "Assets/Alloy/Shaders/Definition/CarPaint.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _DISSOLVE_ON + + #pragma multi_compile_shadowcaster + #pragma multi_compile_instancing + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_SHADOWCASTER + + #include "Assets/Alloy/Shaders/Definition/CarPaint.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } + + Pass { + Name "DEFERRED" + Tags { "LightMode" = "Deferred" } + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_prepassfinal + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + #pragma multi_compile_instancing + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_DEFERRED + + #include "Assets/Alloy/Shaders/Definition/CarPaint.cginc" + #include "Assets/Alloy/Shaders/Forward/Gbuffer.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Shaders/Definition/CarPaint.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +FallBack "Alloy/Car Paint" +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Shaders/4.6/Specialist/Tessellation Car Paint.shader.meta b/Assets/Alloy/Shaders/4.6/Specialist/Tessellation Car Paint.shader.meta new file mode 100644 index 0000000..8088428 --- /dev/null +++ b/Assets/Alloy/Shaders/4.6/Specialist/Tessellation Car Paint.shader.meta @@ -0,0 +1,22 @@ +fileFormatVersion: 2 +guid: 187afb631d8dbe648981add343d252dd +ShaderImporter: + defaultTextures: + - _MainTex: {instanceID: 0} + - _SpecTex: {instanceID: 0} + - _BumpMap: {instanceID: 0} + - _CarFlakeMap: {instanceID: 0} + - _ParallaxMap: {instanceID: 0} + - _DetailMask: {instanceID: 0} + - _DetailAlbedoMap: {instanceID: 0} + - _DetailMaterialMap: {fileID: 2800000, guid: 2b77d5cb601375f4ba50c6194c126e59, + type: 3} + - _DetailNormalMap: {instanceID: 0} + - _TeamColorMaskMap: {instanceID: 0} + - _DecalTex: {instanceID: 0} + - _EmissionMap: {instanceID: 0} + - _IncandescenceMap: {instanceID: 0} + - _RimTex: {instanceID: 0} + - _DissolveTex: {instanceID: 0} + userData: + assetBundleName: diff --git a/Assets/Alloy/Shaders/4.6/Specialist/Tessellation Directional Blend.shader b/Assets/Alloy/Shaders/4.6/Specialist/Tessellation Directional Blend.shader new file mode 100644 index 0000000..4364011 --- /dev/null +++ b/Assets/Alloy/Shaders/4.6/Specialist/Tessellation Directional Blend.shader @@ -0,0 +1,407 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Tessellation/Directional Blend" { +Properties { + // Global Settings + _Mode ("'Rendering Mode' {RenderingMode:{Opaque:{_Cutoff}, Cutout:{}, Fade:{_Cutoff}, Transparent:{_Cutoff}}}", Float) = 0 + _SrcBlend ("__src", Float) = 0 + _DstBlend ("__dst", Float) = 0 + _ZWrite ("__zw", Float) = 1 + [LM_TransparencyCutOff] + _Cutoff ("'Opacity Cutoff' {Min:0, Max:1}", Float) = 0.5 + [Toggle(EFFECT_BUMP)] + _HasBumpMap ("'Normals Source' {Dropdown:{VertexNormals:{_BumpMap,_BumpScale,_DetailNormalMap,_DetailNormalMapScale,_WetNormalMap,_WetNormalMapScale,_BumpMap2,_BumpScale2}, NormalMaps:{}}}", Float) = 1 + [Toggle(_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A)] + _MainRoughnessSource ("'Roughness Source' {Dropdown:{PackedMapAlpha:{}, BaseColorAlpha:{_SpecTex,_Occlusion,_MaterialMap2,_Occlusion2}}}", Float) = 0 + + // Main Textures + _MainTextures ("'Main Textures' {Section:{Color:0}}", Float) = 0 + [LM_Albedo] [LM_Transparency] + _Color ("'Tint' {}", Color) = (1,1,1,1) + [LM_MasterTilingOffset] [LM_Albedo] + _MainTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _MainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _MainTexUV ("UV Set", Float) = 0 + [LM_Metallic] + _SpecTex ("'Metal(R) AO(G) Spec(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_MainTex}", 2D) = "white" {} + [LM_NormalMap] + _BumpMap ("'Normals' {Visualize:{NRM}, Parent:_MainTex}", 2D) = "bump" {} + _BaseColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Main Properties + _MainPhysicalProperties ("'Main Properties' {Section:{Color:1}}", Float) = 0 + [LM_Metallic] + _Metal ("'Metallic' {Min:0, Max:1}", Float) = 1 + _Specularity ("'Specularity' {Min:0, Max:1}", Float) = 1 + _SpecularTint ("'Specular Tint' {Min:0, Max:1}", Float) = 0 + _Roughness ("'Roughness' {Min:0, Max:1}", Float) = 1 + _Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _BumpScale ("'Normal Strength' {}", Float) = 1 + + // Tessellation + _TessellationProperties ("'Tessellation' {Section:{Color:5}}", Float) = 0 + [KeywordEnum(Displacement, Phong)] + _TessellationMode ("'Mode' {Dropdown:{Displacement:{_Phong}, Phong:{_DispTex, _Displacement}}}", Float) = 0 + _DispTex ("'Heightmap(G)' {Visualize:{RGB}}", 2D) = "black" {} + _DispTexVelocity ("Scroll", Vector) = (0,0,0,0) + _Displacement ("'Displacement' {Min:0, Max:30}", Float) = 0.3 + _Phong ("'Phong Strength' {Min:0, Max:1}", Float) = 0.5 + _EdgeLength ("'Edge Length' {Min:2, Max:50}", Float) = 15 + + // AO2 + [Toggle(_AO2_ON)] + _AO2 ("'AO2' {Feature:{Color:6}}", Float) = 0 + _Ao2Map ("'AO2(G)' {Visualize:{RGB}}", 2D) = "white" {} + _Ao2MapUV ("UV Set", Float) = 1 + _Ao2Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + + // Detail + [Toggle(_DETAIL_MULX2)] + _DetailT ("'Detail' {Feature:{Color:7}}", Float) = 0 + [Toggle(_NORMALMAP)] + _DetailMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_DetailMask}}}", Float) = 0 + _DetailMask ("'Mask(A)' {Visualize:{A}, Parent:_MainTex}", 2D) = "white" {} + _DetailMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + [Enum(Mul, 0, MulX2, 1)] + _DetailMode ("'Color Mode' {Dropdown:{Mul:{}, MulX2:{}}}", Float) = 0 + _DetailAlbedoMap ("'Color(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _DetailAlbedoMapVelocity ("Scroll", Vector) = (0,0,0,0) + _DetailAlbedoMapUV ("UV Set", Float) = 0 + _DetailNormalMap ("'Normals' {Visualize:{NRM}, Parent:_DetailAlbedoMap}", 2D) = "bump" {} + _DetailWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DetailNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Team Color + [Toggle(_TEAMCOLOR_ON)] + _TeamColor ("'Team Color' {Feature:{Color:8}}", Float) = 0 + [Enum(Masks, 0, Tint, 1)] + _TeamColorMasksAsTint ("'Texture Mode' {Dropdown:{Masks:{}, Tint:{_TeamColorMasks, _TeamColor0, _TeamColor1, _TeamColor2, _TeamColor3}}}", Float) = 0 + _TeamColorMaskMap ("'Masks(RGBA)' {Visualize:{R, G, B, A, RGB}, Parent:_MainTex}", 2D) = "black" {} + _TeamColorMasks ("'Channels' {Vector:Channels}", Vector) = (1,1,1,0) + _TeamColor0 ("'Tint R' {}", Color) = (1,0,0) + _TeamColor1 ("'Tint G' {}", Color) = (0,1,0) + _TeamColor2 ("'Tint B' {}", Color) = (0,0,1) + _TeamColor3 ("'Tint A' {}", Color) = (0.5,0.5,0.5) + + // Decal + [Toggle(_DECAL_ON)] + _Decal ("'Decal' {Feature:{Color:9}}", Float) = 0 + _DecalColor ("'Tint' {}", Color) = (1,1,1,1) + _DecalTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "black" {} + _DecalTexUV ("UV Set", Float) = 0 + _DecalWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DecalSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _DecalAlphaVertexTint ("'Vertex Alpha Tint' {Min:0, Max:1}", Float) = 0 + + // Emission + [Toggle(_EMISSION)] + _Emission ("'Emission' {Feature:{Color:10}}", Float) = 0 + [LM_Emission] + [HDR] + _EmissionColor ("'Tint' {}", Color) = (1,1,1) + [LM_Emission] + _EmissionMap ("'Mask(RGB)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "white" {} + _IncandescenceMap ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _IncandescenceMapVelocity ("Scroll", Vector) = (0,0,0,0) + _IncandescenceMapUV ("UV Set", Float) = 0 + [Gamma] + _EmissionWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + + // Rim Emission + [Toggle(_RIM_ON)] + _Rim ("'Rim Emission' {Feature:{Color:11}}", Float) = 0 + [HDR] + _RimColor ("'Tint' {}", Color) = (1,1,1) + _RimTex ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _RimTexVelocity ("Scroll", Vector) = (0,0,0,0) + _RimTexUV ("UV Set", Float) = 0 + [Gamma] + _RimWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + [Gamma] + _RimBias ("'Fill' {Min:0, Max:1}", Float) = 0 + _RimPower ("'Falloff' {Min:0.01}", Float) = 4 + + // Dissolve + [Toggle(_DISSOLVE_ON)] + _Dissolve ("'Dissolve' {Feature:{Color:12}}", Float) = 0 + [HDR] + _DissolveGlowColor ("'Glow Tint' {}", Color) = (1,1,1,1) + _DissolveTex ("'Glow Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _DissolveTexUV ("UV Set", Float) = 0 + _DissolveCutoff ("'Cutoff' {Min:0, Max:1}", Float) = 0 + [Gamma] + _DissolveGlowWeight ("'Glow Weight' {Min:0, Max:1}", Float) = 1 + _DissolveEdgeWidth ("'Glow Width' {Min:0, Max:1}", Float) = 0.01 + + // Wetness + [Toggle(_WETNESS_ON)] + _WetnessProperties ("'Wetness' {Feature:{Color:13}}", Float) = 0 + [Toggle(_WETMASKSOURCE_VERTEXCOLORALPHA)] + _WetMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_WetMask}}}", Float) = 0 + _WetMask ("'Mask(A)' {Visualize:{A}}", 2D) = "white" {} + _WetMaskVelocity ("Scroll", Vector) = (0,0,0,0) + _WetMaskUV ("UV Set", Float) = 0 + _WetMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + _WetTint ("'Tint' {}", Color) = (1,1,1,1) + _WetNormalMap ("'Normals' {Visualize:{NRM}}", 2D) = "bump" {} + _WetNormalMapVelocity ("Scroll", Vector) = (0,0,0,0) + _WetNormalMapUV ("UV Set", Float) = 0 + _WetWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _WetRoughness ("'Roughness' {Min:0, Max:1}", Float) = 0.2 + _WetNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Directional Blend + _DirectionalBlendProperties ("'Directional Blend' {Section:{Color:14}}", Float) = 0 + [Toggle(_DIRECTIONALBLENDMODE_WORLD)] + _DirectionalBlendMode ("'Mode' {Dropdown:{Object:{}, World:{}}}", Float) = 1 + _DirectionalBlendDirection ("'Direction' {Vector:Euler}", Vector) = (0,1,0,0) + _DirectionalBlendDirectionEulerUI ("'Rotation' {Vector:3}", Vector) = (0,0,0,0) + _OrientedScale ("'Weight' {Min:0, Max:1}", Float) = 1.0 + _OrientedCutoff ("'Cutoff' {Min:0, Max:1}", Float) = 0.25 + _OrientedBlend ("'Blend' {Min:0.0001, Max:1}", Float) = 0.1 + _DirectionalBlendAlphaVertexTint ("'Vertex Alpha Tint' {Min:0, Max:1}", Float) = 0 + + // Secondary Textures + _SecondaryTextures ("'Secondary Textures' {Section:{Color:15}}", Float) = 0 + _Color2 ("'Tint' {}", Color) = (1,1,1,1) + _MainTex2 ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _MainTex2Velocity ("Scroll", Vector) = (0,0,0,0) + _MainTex2UV ("UV Set", Float) = 0 + _MaterialMap2 ("'Metal(R) AO(G) Spec(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_MainTex2}", 2D) = "white" {} + _BumpMap2 ("'Normals' {Visualize:{NRM}, Parent:_MainTex2}", 2D) = "bump" {} + _BaseColorVertexTint2 ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Secondary Properties + _SecondaryPhysicalProperties ("'Secondary Properties' {Section:{Color:16}}", Float) = 0 + _Metallic2 ("'Metallic' {Min:0, Max:1}", Float) = 1 + _Specularity2 ("'Specularity' {Min:0, Max:1}", Float) = 1 + _SpecularTint2 ("'Specular Tint' {Min:0, Max:1}", Float) = 0 + _Roughness2 ("'Roughness' {Min:0, Max:1}", Float) = 1 + _Occlusion2 ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _BumpScale2 ("'Normal Strength' {}", Float) = 1 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _Lightmapping ("'GI' {LightmapEmissionProperty:{}}", Float) = 1 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} + +CGINCLUDE + #define A_TESSELLATION_SHADER +ENDCG + +SubShader { + Tags { + "RenderType" = "Opaque" + "PerformanceChecks" = "False" + //"DisableBatching" = "LODFading" + } + LOD 300 + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + Blend [_SrcBlend] [_DstBlend] + ZWrite [_ZWrite] + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _DIRECTIONALBLENDMODE_WORLD + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Shaders/Definition/DirectionalBlend.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend [_SrcBlend] One + ZWrite Off + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _DIRECTIONALBLENDMODE_WORLD + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + + #include "Assets/Alloy/Shaders/Definition/DirectionalBlend.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _DISSOLVE_ON + + #pragma multi_compile_shadowcaster + #pragma multi_compile_instancing + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_SHADOWCASTER + + #include "Assets/Alloy/Shaders/Definition/DirectionalBlend.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } + + Pass { + Name "DEFERRED" + Tags { "LightMode" = "Deferred" } + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _DIRECTIONALBLENDMODE_WORLD + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_prepassfinal + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + #pragma multi_compile_instancing + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_DEFERRED + + #include "Assets/Alloy/Shaders/Definition/DirectionalBlend.cginc" + #include "Assets/Alloy/Shaders/Forward/Gbuffer.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _DIRECTIONALBLENDMODE_WORLD + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Shaders/Definition/DirectionalBlend.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +FallBack "Alloy/Directional Blend" +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Shaders/4.6/Specialist/Tessellation Directional Blend.shader.meta b/Assets/Alloy/Shaders/4.6/Specialist/Tessellation Directional Blend.shader.meta new file mode 100644 index 0000000..ecdba1b --- /dev/null +++ b/Assets/Alloy/Shaders/4.6/Specialist/Tessellation Directional Blend.shader.meta @@ -0,0 +1,29 @@ +fileFormatVersion: 2 +guid: 8316c572e004a604c8e86cda3a3cfde5 +timeCreated: 1430076271 +licenseType: Pro +ShaderImporter: + defaultTextures: + - _MainTex: {instanceID: 0} + - _SpecTex: {instanceID: 0} + - _BumpMap: {instanceID: 0} + - _DispTex: {instanceID: 0} + - _ParallaxMap: {instanceID: 0} + - _Ao2Map: {instanceID: 0} + - _DetailMask: {instanceID: 0} + - _DetailAlbedoMap: {instanceID: 0} + - _DetailMaterialMap: {fileID: 2800000, guid: 2b77d5cb601375f4ba50c6194c126e59, + type: 3} + - _DetailNormalMap: {instanceID: 0} + - _TeamColorMaskMap: {instanceID: 0} + - _DecalTex: {instanceID: 0} + - _EmissionMap: {instanceID: 0} + - _IncandescenceMap: {instanceID: 0} + - _RimTex: {instanceID: 0} + - _DissolveTex: {instanceID: 0} + - _OrientedMainTex: {instanceID: 0} + - _OrientedMaterialMap: {instanceID: 0} + - _OrientedBumpMap: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/4.6/Specialist/Tessellation Glass HighQuality.shader b/Assets/Alloy/Shaders/4.6/Specialist/Tessellation Glass HighQuality.shader new file mode 100644 index 0000000..bd50eda --- /dev/null +++ b/Assets/Alloy/Shaders/4.6/Specialist/Tessellation Glass HighQuality.shader @@ -0,0 +1,366 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Tessellation/Glass/HighQuality" { +Properties { + [Toggle(EFFECT_BUMP)] + _HasBumpMap ("'Normals Source' {Dropdown:{VertexNormals:{_BumpMap,_BumpScale,_DetailNormalMap,_DetailNormalMapScale,_WetNormalMap,_WetNormalMapScale}, NormalMaps:{}}}", Float) = 1 + [Toggle(_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A)] + _MainRoughnessSource ("'Roughness Source' {Dropdown:{PackedMapAlpha:{}, BaseColorAlpha:{_SpecTex,_Occlusion}}}", Float) = 0 + + // Main Textures + _MainTextures ("'Main Textures' {Section:{Color:0}}", Float) = 0 + [LM_Albedo] [LM_Transparency] + _Color ("'Tint' {}", Color) = (1,1,1,1) + [LM_MasterTilingOffset] [LM_Albedo] + _MainTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _MainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _MainTexUV ("UV Set", Float) = 0 + [LM_Metallic] + _SpecTex ("'Metal(R) AO(G) Spec(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_MainTex}", 2D) = "white" {} + [LM_NormalMap] + _BumpMap ("'Normals' {Visualize:{NRM}, Parent:_MainTex}", 2D) = "bump" {} + _BaseColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Main Properties + _MainPhysicalProperties ("'Main Properties' {Section:{Color:1}}", Float) = 0 + [LM_Metallic] + _Metal ("'Metallic' {Min:0, Max:1}", Float) = 1 + _Specularity ("'Specularity' {Min:0, Max:1}", Float) = 1 + _SpecularTint ("'Specular Tint' {Min:0, Max:1}", Float) = 0 + _Roughness ("'Roughness' {Min:0, Max:1}", Float) = 1 + _Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _BumpScale ("'Normal Strength' {}", Float) = 1 + + // Distortion Properties + _DistortionProperties ("'Distortion' {Section:{Color:2}}", Float) = 0 + _DistortWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DistortIntensity ("'Intensity' {Min:0, Max:128}", Float) = 10 + _DistortGeoWeight ("'Geometry Influence' {Min:0, Max:1}", Float) = 1 + + // Tessellation + _TessellationProperties ("'Tessellation' {Section:{Color:5}}", Float) = 0 + [KeywordEnum(Displacement, Phong)] + _TessellationMode ("'Mode' {Dropdown:{Displacement:{_Phong}, Phong:{_DispTex, _Displacement}}}", Float) = 0 + _DispTex ("'Heightmap(G)' {Visualize:{RGB}}", 2D) = "black" {} + _DispTexVelocity ("Scroll", Vector) = (0,0,0,0) + _Displacement ("'Displacement' {Min:0, Max:30}", Float) = 0.3 + _Phong ("'Phong Strength' {Min:0, Max:1}", Float) = 0.5 + _EdgeLength ("'Edge Length' {Min:2, Max:50}", Float) = 15 + + // AO2 + [Toggle(_AO2_ON)] + _AO2 ("'AO2' {Feature:{Color:6}}", Float) = 0 + _Ao2Map ("'AO2(G)' {Visualize:{RGB}}", 2D) = "white" {} + _Ao2MapUV ("UV Set", Float) = 1 + _Ao2Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + + // Detail + [Toggle(_DETAIL_MULX2)] + _DetailT ("'Detail' {Feature:{Color:7}}", Float) = 0 + [Toggle(_NORMALMAP)] + _DetailMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_DetailMask}}}", Float) = 0 + _DetailMask ("'Mask(A)' {Visualize:{A}, Parent:_MainTex}", 2D) = "white" {} + _DetailMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + [Enum(Mul, 0, MulX2, 1)] + _DetailMode ("'Color Mode' {Dropdown:{Mul:{}, MulX2:{}}}", Float) = 0 + _DetailAlbedoMap ("'Color(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _DetailAlbedoMapVelocity ("Scroll", Vector) = (0,0,0,0) + _DetailAlbedoMapUV ("UV Set", Float) = 0 + _DetailNormalMap ("'Normals' {Visualize:{NRM}, Parent:_DetailAlbedoMap}", 2D) = "bump" {} + _DetailWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DetailNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Team Color + [Toggle(_TEAMCOLOR_ON)] + _TeamColor ("'Team Color' {Feature:{Color:8}}", Float) = 0 + [Enum(Masks, 0, Tint, 1)] + _TeamColorMasksAsTint ("'Texture Mode' {Dropdown:{Masks:{}, Tint:{_TeamColorMasks, _TeamColor0, _TeamColor1, _TeamColor2, _TeamColor3}}}", Float) = 0 + _TeamColorMaskMap ("'Masks(RGBA)' {Visualize:{R, G, B, A, RGB}, Parent:_MainTex}", 2D) = "black" {} + _TeamColorMasks ("'Channels' {Vector:Channels}", Vector) = (1,1,1,0) + _TeamColor0 ("'Tint R' {}", Color) = (1,0,0) + _TeamColor1 ("'Tint G' {}", Color) = (0,1,0) + _TeamColor2 ("'Tint B' {}", Color) = (0,0,1) + _TeamColor3 ("'Tint A' {}", Color) = (0.5,0.5,0.5) + + // Decal + [Toggle(_DECAL_ON)] + _Decal ("'Decal' {Feature:{Color:9}}", Float) = 0 + _DecalColor ("'Tint' {}", Color) = (1,1,1,1) + _DecalTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "black" {} + _DecalTexUV ("UV Set", Float) = 0 + _DecalWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DecalSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _DecalAlphaVertexTint ("'Vertex Alpha Tint' {Min:0, Max:1}", Float) = 0 + + // Emission + [Toggle(_EMISSION)] + _Emission ("'Emission' {Feature:{Color:10}}", Float) = 0 + [LM_Emission] + [HDR] + _EmissionColor ("'Tint' {}", Color) = (1,1,1) + [LM_Emission] + _EmissionMap ("'Mask(RGB)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "white" {} + _IncandescenceMap ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _IncandescenceMapVelocity ("Scroll", Vector) = (0,0,0,0) + _IncandescenceMapUV ("UV Set", Float) = 0 + [Gamma] + _EmissionWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + + // Rim Emission + [Toggle(_RIM_ON)] + _Rim ("'Rim Emission' {Feature:{Color:11}}", Float) = 0 + [HDR] + _RimColor ("'Tint' {}", Color) = (1,1,1) + _RimTex ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _RimTexVelocity ("Scroll", Vector) = (0,0,0,0) + _RimTexUV ("UV Set", Float) = 0 + [Gamma] + _RimWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + [Gamma] + _RimBias ("'Fill' {Min:0, Max:1}", Float) = 0 + _RimPower ("'Falloff' {Min:0.01}", Float) = 4 + + // Dissolve + [Toggle(_DISSOLVE_ON)] + _Dissolve ("'Dissolve' {Feature:{Color:12}}", Float) = 0 + [HDR] + _DissolveGlowColor ("'Glow Tint' {}", Color) = (1,1,1,1) + _DissolveTex ("'Glow Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _DissolveTexUV ("UV Set", Float) = 0 + _DissolveCutoff ("'Cutoff' {Min:0, Max:1}", Float) = 0 + [Gamma] + _DissolveGlowWeight ("'Glow Weight' {Min:0, Max:1}", Float) = 1 + _DissolveEdgeWidth ("'Glow Width' {Min:0, Max:1}", Float) = 0.01 + + // Wetness + [Toggle(_WETNESS_ON)] + _WetnessProperties ("'Wetness' {Feature:{Color:13}}", Float) = 0 + [Toggle(_WETMASKSOURCE_VERTEXCOLORALPHA)] + _WetMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_WetMask}}}", Float) = 0 + _WetMask ("'Mask(A)' {Visualize:{A}}", 2D) = "white" {} + _WetMaskVelocity ("Scroll", Vector) = (0,0,0,0) + _WetMaskUV ("UV Set", Float) = 0 + _WetMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + _WetTint ("'Tint' {}", Color) = (1,1,1,1) + _WetNormalMap ("'Normals' {Visualize:{NRM}}", 2D) = "bump" {} + _WetNormalMapVelocity ("Scroll", Vector) = (0,0,0,0) + _WetNormalMapUV ("UV Set", Float) = 0 + _WetWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _WetRoughness ("'Roughness' {Min:0, Max:1}", Float) = 0.2 + _WetNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _Lightmapping ("'GI' {LightmapEmissionProperty:{}}", Float) = 1 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} + +CGINCLUDE + #define _ALPHAPREMULTIPLY_ON + #define A_TESSELLATION_SHADER +ENDCG + +SubShader { + // We must be transparent, so other objects are drawn before this one. + Tags { + "Queue" = "Transparent" + "IgnoreProjector" = "True" + "RenderType" = "Opaque" + //"DisableBatching" = "LODFading" + } + LOD 500 + + GrabPass { } + + Pass { + Name "DISTORT" + Tags { "LightMode" = "Always" } + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define A_PASS_DISTORT + + #include "Assets/Alloy/Shaders/Definition/Core.cginc" + #include "Assets/Alloy/Shaders/Forward/Distort.cginc" + ENDCG + } + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + Blend One OneMinusSrcAlpha + ZWrite Off + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Shaders/Definition/Core.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend One One + ZWrite Off + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + + #include "Assets/Alloy/Shaders/Definition/Core.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _DISSOLVE_ON + + #pragma multi_compile_shadowcaster + #pragma multi_compile_instancing + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_SHADOWCASTER + + #include "Assets/Alloy/Shaders/Definition/Core.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Shaders/Definition/Core.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +FallBack "Alloy/Glass/HighQuality" +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Shaders/4.6/Specialist/Tessellation Glass HighQuality.shader.meta b/Assets/Alloy/Shaders/4.6/Specialist/Tessellation Glass HighQuality.shader.meta new file mode 100644 index 0000000..7db922c --- /dev/null +++ b/Assets/Alloy/Shaders/4.6/Specialist/Tessellation Glass HighQuality.shader.meta @@ -0,0 +1,21 @@ +fileFormatVersion: 2 +guid: f34aa928610bd8049abd9e1cdb1bb5bc +ShaderImporter: + defaultTextures: + - _MainTex: {instanceID: 0} + - _SpecTex: {instanceID: 0} + - _BumpMap: {instanceID: 0} + - _ParallaxMap: {instanceID: 0} + - _DetailMask: {instanceID: 0} + - _DetailAlbedoMap: {instanceID: 0} + - _DetailMaterialMap: {fileID: 2800000, guid: 2b77d5cb601375f4ba50c6194c126e59, + type: 3} + - _DetailNormalMap: {instanceID: 0} + - _TeamColorMaskMap: {instanceID: 0} + - _DecalTex: {instanceID: 0} + - _EmissionMap: {instanceID: 0} + - _IncandescenceMap: {instanceID: 0} + - _RimTex: {instanceID: 0} + - _DissolveTex: {instanceID: 0} + userData: + assetBundleName: diff --git a/Assets/Alloy/Shaders/4.6/Specialist/Tessellation Glass LowQuality.shader b/Assets/Alloy/Shaders/4.6/Specialist/Tessellation Glass LowQuality.shader new file mode 100644 index 0000000..e482049 --- /dev/null +++ b/Assets/Alloy/Shaders/4.6/Specialist/Tessellation Glass LowQuality.shader @@ -0,0 +1,369 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Tessellation/Glass/LowQuality" { +Properties { + [Toggle(EFFECT_BUMP)] + _HasBumpMap ("'Normals Source' {Dropdown:{VertexNormals:{_BumpMap,_BumpScale,_DetailNormalMap,_DetailNormalMapScale,_WetNormalMap,_WetNormalMapScale}, NormalMaps:{}}}", Float) = 1 + [Toggle(_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A)] + _MainRoughnessSource ("'Roughness Source' {Dropdown:{PackedMapAlpha:{}, BaseColorAlpha:{_SpecTex,_Occlusion}}}", Float) = 0 + + // Main Textures + _MainTextures ("'Main Textures' {Section:{Color:0}}", Float) = 0 + [LM_Albedo] [LM_Transparency] + _Color ("'Tint' {}", Color) = (1,1,1,1) + [LM_MasterTilingOffset] [LM_Albedo] + _MainTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _MainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _MainTexUV ("UV Set", Float) = 0 + [LM_Metallic] + _SpecTex ("'Metal(R) AO(G) Spec(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_MainTex}", 2D) = "white" {} + [LM_NormalMap] + _BumpMap ("'Normals' {Visualize:{NRM}, Parent:_MainTex}", 2D) = "bump" {} + _BaseColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Main Properties + _MainPhysicalProperties ("'Main Properties' {Section:{Color:1}}", Float) = 0 + [LM_Metallic] + _Metal ("'Metallic' {Min:0, Max:1}", Float) = 1 + _Specularity ("'Specularity' {Min:0, Max:1}", Float) = 1 + _SpecularTint ("'Specular Tint' {Min:0, Max:1}", Float) = 0 + _Roughness ("'Roughness' {Min:0, Max:1}", Float) = 1 + _Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _BumpScale ("'Normal Strength' {}", Float) = 1 + + // Distortion Properties + _DistortionProperties ("'Distortion' {Section:{Color:2}}", Float) = 0 + _DistortWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DistortIntensity ("'Intensity' {Min:0, Max:128}", Float) = 10 + _DistortGeoWeight ("'Geometry Influence' {Min:0, Max:1}", Float) = 1 + + // Tessellation + _TessellationProperties ("'Tessellation' {Section:{Color:5}}", Float) = 0 + [KeywordEnum(Displacement, Phong)] + _TessellationMode ("'Mode' {Dropdown:{Displacement:{_Phong}, Phong:{_DispTex, _Displacement}}}", Float) = 0 + _DispTex ("'Heightmap(G)' {Visualize:{RGB}}", 2D) = "black" {} + _DispTexVelocity ("Scroll", Vector) = (0,0,0,0) + _Displacement ("'Displacement' {Min:0, Max:30}", Float) = 0.3 + _Phong ("'Phong Strength' {Min:0, Max:1}", Float) = 0.5 + _EdgeLength ("'Edge Length' {Min:2, Max:50}", Float) = 15 + + // AO2 + [Toggle(_AO2_ON)] + _AO2 ("'AO2' {Feature:{Color:6}}", Float) = 0 + _Ao2Map ("'AO2(G)' {Visualize:{RGB}}", 2D) = "white" {} + _Ao2MapUV ("UV Set", Float) = 1 + _Ao2Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + + // Detail + [Toggle(_DETAIL_MULX2)] + _DetailT ("'Detail' {Feature:{Color:7}}", Float) = 0 + [Toggle(_NORMALMAP)] + _DetailMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_DetailMask}}}", Float) = 0 + _DetailMask ("'Mask(A)' {Visualize:{A}, Parent:_MainTex}", 2D) = "white" {} + _DetailMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + [Enum(Mul, 0, MulX2, 1)] + _DetailMode ("'Color Mode' {Dropdown:{Mul:{}, MulX2:{}}}", Float) = 0 + _DetailAlbedoMap ("'Color(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _DetailAlbedoMapVelocity ("Scroll", Vector) = (0,0,0,0) + _DetailAlbedoMapUV ("UV Set", Float) = 0 + _DetailNormalMap ("'Normals' {Visualize:{NRM}, Parent:_DetailAlbedoMap}", 2D) = "bump" {} + _DetailWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DetailNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Team Color + [Toggle(_TEAMCOLOR_ON)] + _TeamColor ("'Team Color' {Feature:{Color:8}}", Float) = 0 + [Enum(Masks, 0, Tint, 1)] + _TeamColorMasksAsTint ("'Texture Mode' {Dropdown:{Masks:{}, Tint:{_TeamColorMasks, _TeamColor0, _TeamColor1, _TeamColor2, _TeamColor3}}}", Float) = 0 + _TeamColorMaskMap ("'Masks(RGBA)' {Visualize:{R, G, B, A, RGB}, Parent:_MainTex}", 2D) = "black" {} + _TeamColorMasks ("'Channels' {Vector:Channels}", Vector) = (1,1,1,0) + _TeamColor0 ("'Tint R' {}", Color) = (1,0,0) + _TeamColor1 ("'Tint G' {}", Color) = (0,1,0) + _TeamColor2 ("'Tint B' {}", Color) = (0,0,1) + _TeamColor3 ("'Tint A' {}", Color) = (0.5,0.5,0.5) + + // Decal + [Toggle(_DECAL_ON)] + _Decal ("'Decal' {Feature:{Color:9}}", Float) = 0 + _DecalColor ("'Tint' {}", Color) = (1,1,1,1) + _DecalTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "black" {} + _DecalTexUV ("UV Set", Float) = 0 + _DecalWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DecalSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _DecalAlphaVertexTint ("'Vertex Alpha Tint' {Min:0, Max:1}", Float) = 0 + + // Emission + [Toggle(_EMISSION)] + _Emission ("'Emission' {Feature:{Color:10}}", Float) = 0 + [LM_Emission] + [HDR] + _EmissionColor ("'Tint' {}", Color) = (1,1,1) + [LM_Emission] + _EmissionMap ("'Mask(RGB)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "white" {} + _IncandescenceMap ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _IncandescenceMapVelocity ("Scroll", Vector) = (0,0,0,0) + _IncandescenceMapUV ("UV Set", Float) = 0 + [Gamma] + _EmissionWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + + // Rim Emission + [Toggle(_RIM_ON)] + _Rim ("'Rim Emission' {Feature:{Color:11}}", Float) = 0 + [HDR] + _RimColor ("'Tint' {}", Color) = (1,1,1) + _RimTex ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _RimTexVelocity ("Scroll", Vector) = (0,0,0,0) + _RimTexUV ("UV Set", Float) = 0 + [Gamma] + _RimWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + [Gamma] + _RimBias ("'Fill' {Min:0, Max:1}", Float) = 0 + _RimPower ("'Falloff' {Min:0.01}", Float) = 4 + + // Dissolve + [Toggle(_DISSOLVE_ON)] + _Dissolve ("'Dissolve' {Feature:{Color:12}}", Float) = 0 + [HDR] + _DissolveGlowColor ("'Glow Tint' {}", Color) = (1,1,1,1) + _DissolveTex ("'Glow Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _DissolveTexUV ("UV Set", Float) = 0 + _DissolveCutoff ("'Cutoff' {Min:0, Max:1}", Float) = 0 + [Gamma] + _DissolveGlowWeight ("'Glow Weight' {Min:0, Max:1}", Float) = 1 + _DissolveEdgeWidth ("'Glow Width' {Min:0, Max:1}", Float) = 0.01 + + // Wetness + [Toggle(_WETNESS_ON)] + _WetnessProperties ("'Wetness' {Feature:{Color:13}}", Float) = 0 + [Toggle(_WETMASKSOURCE_VERTEXCOLORALPHA)] + _WetMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_WetMask}}}", Float) = 0 + _WetMask ("'Mask(A)' {Visualize:{A}}", 2D) = "white" {} + _WetMaskVelocity ("Scroll", Vector) = (0,0,0,0) + _WetMaskUV ("UV Set", Float) = 0 + _WetMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + _WetTint ("'Tint' {}", Color) = (1,1,1,1) + _WetNormalMap ("'Normals' {Visualize:{NRM}}", 2D) = "bump" {} + _WetNormalMapVelocity ("Scroll", Vector) = (0,0,0,0) + _WetNormalMapUV ("UV Set", Float) = 0 + _WetWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _WetRoughness ("'Roughness' {Min:0, Max:1}", Float) = 0.2 + _WetNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _Lightmapping ("'GI' {LightmapEmissionProperty:{}}", Float) = 1 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} + +CGINCLUDE + #define _ALPHAPREMULTIPLY_ON + #define A_TESSELLATION_SHADER + + #define A_DISTORT_TEXTURE _AlloyGlassGrabTexture +ENDCG + +SubShader { + // We must be transparent, so other objects are drawn before this one. + Tags { + "Queue" = "Transparent" + "IgnoreProjector" = "True" + "RenderType" = "Opaque" + //"DisableBatching" = "LODFading" + } + LOD 500 + + GrabPass { "_AlloyGlassGrabTexture" } + + Pass { + Name "DISTORT" + Tags { "LightMode" = "Always" } + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define A_PASS_DISTORT + + #include "Assets/Alloy/Shaders/Definition/Core.cginc" + #include "Assets/Alloy/Shaders/Forward/Distort.cginc" + ENDCG + } + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + Blend One OneMinusSrcAlpha + ZWrite Off + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Shaders/Definition/Core.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend One One + ZWrite Off + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + + #include "Assets/Alloy/Shaders/Definition/Core.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _DISSOLVE_ON + + #pragma multi_compile_shadowcaster + #pragma multi_compile_instancing + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_SHADOWCASTER + + #include "Assets/Alloy/Shaders/Definition/Core.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Shaders/Definition/Core.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +FallBack "Alloy/Glass/LowQuality" +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Shaders/4.6/Specialist/Tessellation Glass LowQuality.shader.meta b/Assets/Alloy/Shaders/4.6/Specialist/Tessellation Glass LowQuality.shader.meta new file mode 100644 index 0000000..2ba0636 --- /dev/null +++ b/Assets/Alloy/Shaders/4.6/Specialist/Tessellation Glass LowQuality.shader.meta @@ -0,0 +1,22 @@ +fileFormatVersion: 2 +guid: 0dbdba5bbc6a6d347901c6f93c5a0dbc +ShaderImporter: + defaultTextures: + - _MainTex: {instanceID: 0} + - _SpecTex: {instanceID: 0} + - _BumpMap: {instanceID: 0} + - _DispTex: {instanceID: 0} + - _Ao2Map: {instanceID: 0} + - _DetailMask: {instanceID: 0} + - _DetailAlbedoMap: {instanceID: 0} + - _DetailMaterialMap: {fileID: 2800000, guid: 2b77d5cb601375f4ba50c6194c126e59, + type: 3} + - _DetailNormalMap: {instanceID: 0} + - _TeamColorMaskMap: {instanceID: 0} + - _DecalTex: {instanceID: 0} + - _EmissionMap: {instanceID: 0} + - _IncandescenceMap: {instanceID: 0} + - _RimTex: {instanceID: 0} + - _DissolveTex: {instanceID: 0} + userData: + assetBundleName: diff --git a/Assets/Alloy/Shaders/4.6/Specialist/Tessellation Oriented Blend.shader b/Assets/Alloy/Shaders/4.6/Specialist/Tessellation Oriented Blend.shader new file mode 100644 index 0000000..b3124bb --- /dev/null +++ b/Assets/Alloy/Shaders/4.6/Specialist/Tessellation Oriented Blend.shader @@ -0,0 +1,400 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Tessellation/Oriented/Blend" { +Properties { + // Global Settings + _Mode ("'Rendering Mode' {RenderingMode:{Opaque:{_Cutoff}, Cutout:{}, Fade:{_Cutoff}, Transparent:{_Cutoff}}}", Float) = 0 + _SrcBlend ("__src", Float) = 0 + _DstBlend ("__dst", Float) = 0 + _ZWrite ("__zw", Float) = 1 + [LM_TransparencyCutOff] + _Cutoff ("'Opacity Cutoff' {Min:0, Max:1}", Float) = 0.5 + [Toggle(EFFECT_BUMP)] + _HasBumpMap ("'Normals Source' {Dropdown:{VertexNormals:{_BumpMap,_BumpScale,_DetailNormalMap,_DetailNormalMapScale,_WetNormalMap,_WetNormalMapScale,_OrientedBumpMap,_OrientedNormalMapScale}, NormalMaps:{}}}", Float) = 1 + [Toggle(_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A)] + _MainRoughnessSource ("'Roughness Source' {Dropdown:{PackedMapAlpha:{}, BaseColorAlpha:{_SpecTex,_Occlusion,_OrientedMaterialMap,_OrientedOcclusion}}}", Float) = 0 + + // Main Textures + _MainTextures ("'Main Textures' {Section:{Color:0}}", Float) = 0 + [LM_Albedo] [LM_Transparency] + _Color ("'Tint' {}", Color) = (1,1,1,1) + [LM_MasterTilingOffset] [LM_Albedo] + _MainTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _MainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _MainTexUV ("UV Set", Float) = 0 + [LM_Metallic] + _SpecTex ("'Metal(R) AO(G) Spec(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_MainTex}", 2D) = "white" {} + [LM_NormalMap] + _BumpMap ("'Normals' {Visualize:{NRM}, Parent:_MainTex}", 2D) = "bump" {} + _BaseColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Main Properties + _MainPhysicalProperties ("'Main Properties' {Section:{Color:1}}", Float) = 0 + [LM_Metallic] + _Metal ("'Metallic' {Min:0, Max:1}", Float) = 1 + _Specularity ("'Specularity' {Min:0, Max:1}", Float) = 1 + _SpecularTint ("'Specular Tint' {Min:0, Max:1}", Float) = 0 + _Roughness ("'Roughness' {Min:0, Max:1}", Float) = 1 + _Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _BumpScale ("'Normal Strength' {}", Float) = 1 + + // Tessellation + _TessellationProperties ("'Tessellation' {Section:{Color:5}}", Float) = 0 + [KeywordEnum(Displacement, Phong)] + _TessellationMode ("'Mode' {Dropdown:{Displacement:{_Phong}, Phong:{_DispTex, _Displacement}}}", Float) = 0 + _DispTex ("'Heightmap(G)' {Visualize:{RGB}}", 2D) = "black" {} + _DispTexVelocity ("Scroll", Vector) = (0,0,0,0) + _Displacement ("'Displacement' {Min:0, Max:30}", Float) = 0.3 + _Phong ("'Phong Strength' {Min:0, Max:1}", Float) = 0.5 + _EdgeLength ("'Edge Length' {Min:2, Max:50}", Float) = 15 + + // AO2 + [Toggle(_AO2_ON)] + _AO2 ("'AO2' {Feature:{Color:6}}", Float) = 0 + _Ao2Map ("'AO2(G)' {Visualize:{RGB}}", 2D) = "white" {} + _Ao2MapUV ("UV Set", Float) = 1 + _Ao2Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + + // Detail + [Toggle(_DETAIL_MULX2)] + _DetailT ("'Detail' {Feature:{Color:7}}", Float) = 0 + [Toggle(_NORMALMAP)] + _DetailMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_DetailMask}}}", Float) = 0 + _DetailMask ("'Mask(A)' {Visualize:{A}, Parent:_MainTex}", 2D) = "white" {} + _DetailMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + [Enum(Mul, 0, MulX2, 1)] + _DetailMode ("'Color Mode' {Dropdown:{Mul:{}, MulX2:{}}}", Float) = 0 + _DetailAlbedoMap ("'Color(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _DetailAlbedoMapVelocity ("Scroll", Vector) = (0,0,0,0) + _DetailAlbedoMapUV ("UV Set", Float) = 0 + _DetailNormalMap ("'Normals' {Visualize:{NRM}, Parent:_DetailAlbedoMap}", 2D) = "bump" {} + _DetailWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DetailNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Team Color + [Toggle(_TEAMCOLOR_ON)] + _TeamColor ("'Team Color' {Feature:{Color:8}}", Float) = 0 + [Enum(Masks, 0, Tint, 1)] + _TeamColorMasksAsTint ("'Texture Mode' {Dropdown:{Masks:{}, Tint:{_TeamColorMasks, _TeamColor0, _TeamColor1, _TeamColor2, _TeamColor3}}}", Float) = 0 + _TeamColorMaskMap ("'Masks(RGBA)' {Visualize:{R, G, B, A, RGB}, Parent:_MainTex}", 2D) = "black" {} + _TeamColorMasks ("'Channels' {Vector:Channels}", Vector) = (1,1,1,0) + _TeamColor0 ("'Tint R' {}", Color) = (1,0,0) + _TeamColor1 ("'Tint G' {}", Color) = (0,1,0) + _TeamColor2 ("'Tint B' {}", Color) = (0,0,1) + _TeamColor3 ("'Tint A' {}", Color) = (0.5,0.5,0.5) + + // Decal + [Toggle(_DECAL_ON)] + _Decal ("'Decal' {Feature:{Color:9}}", Float) = 0 + _DecalColor ("'Tint' {}", Color) = (1,1,1,1) + _DecalTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "black" {} + _DecalTexUV ("UV Set", Float) = 0 + _DecalWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DecalSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _DecalAlphaVertexTint ("'Vertex Alpha Tint' {Min:0, Max:1}", Float) = 0 + + // Emission + [Toggle(_EMISSION)] + _Emission ("'Emission' {Feature:{Color:10}}", Float) = 0 + [LM_Emission] + [HDR] + _EmissionColor ("'Tint' {}", Color) = (1,1,1) + [LM_Emission] + _EmissionMap ("'Mask(RGB)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "white" {} + _IncandescenceMap ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _IncandescenceMapVelocity ("Scroll", Vector) = (0,0,0,0) + _IncandescenceMapUV ("UV Set", Float) = 0 + [Gamma] + _EmissionWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + + // Rim Emission + [Toggle(_RIM_ON)] + _Rim ("'Rim Emission' {Feature:{Color:11}}", Float) = 0 + [HDR] + _RimColor ("'Tint' {}", Color) = (1,1,1) + _RimTex ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _RimTexVelocity ("Scroll", Vector) = (0,0,0,0) + _RimTexUV ("UV Set", Float) = 0 + [Gamma] + _RimWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + [Gamma] + _RimBias ("'Fill' {Min:0, Max:1}", Float) = 0 + _RimPower ("'Falloff' {Min:0.01}", Float) = 4 + + // Dissolve + [Toggle(_DISSOLVE_ON)] + _Dissolve ("'Dissolve' {Feature:{Color:12}}", Float) = 0 + [HDR] + _DissolveGlowColor ("'Glow Tint' {}", Color) = (1,1,1,1) + _DissolveTex ("'Glow Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _DissolveTexUV ("UV Set", Float) = 0 + _DissolveCutoff ("'Cutoff' {Min:0, Max:1}", Float) = 0 + [Gamma] + _DissolveGlowWeight ("'Glow Weight' {Min:0, Max:1}", Float) = 1 + _DissolveEdgeWidth ("'Glow Width' {Min:0, Max:1}", Float) = 0.01 + + // Wetness + [Toggle(_WETNESS_ON)] + _WetnessProperties ("'Wetness' {Feature:{Color:13}}", Float) = 0 + [Toggle(_WETMASKSOURCE_VERTEXCOLORALPHA)] + _WetMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_WetMask}}}", Float) = 0 + _WetMask ("'Mask(A)' {Visualize:{A}}", 2D) = "white" {} + _WetMaskVelocity ("Scroll", Vector) = (0,0,0,0) + _WetMaskUV ("UV Set", Float) = 0 + _WetMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + _WetTint ("'Tint' {}", Color) = (1,1,1,1) + _WetNormalMap ("'Normals' {Visualize:{NRM}}", 2D) = "bump" {} + _WetNormalMapVelocity ("Scroll", Vector) = (0,0,0,0) + _WetNormalMapUV ("UV Set", Float) = 0 + _WetWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _WetRoughness ("'Roughness' {Min:0, Max:1}", Float) = 0.2 + _WetNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Directional Blend + _DirectionalBlendProperties ("'Directional Blend' {Section:{Color:14}}", Float) = 0 + _DirectionalBlendDirection ("'Direction' {Vector:Euler}", Vector) = (0,1,0,0) + _DirectionalBlendDirectionEulerUI ("'Rotation' {Vector:3}", Vector) = (0,0,0,0) + _OrientedScale ("'Weight' {Min:0, Max:1}", Float) = 1.0 + _OrientedCutoff ("'Cutoff' {Min:0, Max:1}", Float) = 0.25 + _OrientedBlend ("'Blend' {Min:0.0001, Max:1}", Float) = 0.1 + _DirectionalBlendAlphaVertexTint ("'Vertex Alpha Tint' {Min:0, Max:1}", Float) = 0 + + // Oriented Textures + _OrientedTextures ("'Oriented Textures' {Section:{Color:15}}", Float) = 0 + _OrientedColor ("'Tint' {}", Color) = (1,1,1,1) + _OrientedMainTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _OrientedMainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _OrientedMaterialMap ("'Metal(R) AO(G) Spec(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_OrientedMainTex}", 2D) = "white" {} + _OrientedBumpMap ("'Normals' {Visualize:{NRM}, Parent:_OrientedMainTex}", 2D) = "bump" {} + _OrientedColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Oriented Properties + _OrientedPhysicalProperties ("'Oriented Properties' {Section:{Color:16}}", Float) = 0 + _OrientedMetallic ("'Metallic' {Min:0, Max:1}", Float) = 1 + _OrientedSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 1 + _OrientedSpecularTint ("'Specular Tint' {Min:0, Max:1}", Float) = 0 + _OrientedRoughness ("'Roughness' {Min:0, Max:1}", Float) = 1 + _OrientedOcclusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _OrientedNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _Lightmapping ("'GI' {LightmapEmissionProperty:{}}", Float) = 1 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} + +CGINCLUDE + #define A_TESSELLATION_SHADER +ENDCG + +SubShader { + Tags { + "RenderType" = "Opaque" + "PerformanceChecks" = "False" + //"DisableBatching" = "LODFading" + } + LOD 300 + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + Blend [_SrcBlend] [_DstBlend] + ZWrite [_ZWrite] + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Shaders/Definition/OrientedBlend.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend [_SrcBlend] One + ZWrite Off + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + + #include "Assets/Alloy/Shaders/Definition/OrientedBlend.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _DISSOLVE_ON + + #pragma multi_compile_shadowcaster + #pragma multi_compile_instancing + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_SHADOWCASTER + + #include "Assets/Alloy/Shaders/Definition/OrientedBlend.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } + + Pass { + Name "DEFERRED" + Tags { "LightMode" = "Deferred" } + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_prepassfinal + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + #pragma multi_compile_instancing + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_DEFERRED + + #include "Assets/Alloy/Shaders/Definition/OrientedBlend.cginc" + #include "Assets/Alloy/Shaders/Forward/Gbuffer.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Shaders/Definition/OrientedBlend.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +FallBack "Alloy/Oriented/Blend" +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Shaders/4.6/Specialist/Tessellation Oriented Blend.shader.meta b/Assets/Alloy/Shaders/4.6/Specialist/Tessellation Oriented Blend.shader.meta new file mode 100644 index 0000000..084ec54 --- /dev/null +++ b/Assets/Alloy/Shaders/4.6/Specialist/Tessellation Oriented Blend.shader.meta @@ -0,0 +1,30 @@ +fileFormatVersion: 2 +guid: 56b28f3357f8150439187ac0940d66bd +timeCreated: 1423414485 +licenseType: Pro +ShaderImporter: + defaultTextures: + - _MainTex: {instanceID: 0} + - _SpecTex: {instanceID: 0} + - _BumpMap: {instanceID: 0} + - _DispTex: {instanceID: 0} + - _DetailMask: {instanceID: 0} + - _DetailAlbedoMap: {instanceID: 0} + - _DetailMaterialMap: {fileID: 2800000, guid: 2b77d5cb601375f4ba50c6194c126e59, + type: 3} + - _DetailNormalMap: {instanceID: 0} + - _TeamColorMaskMap: {instanceID: 0} + - _EmissionMap: {instanceID: 0} + - _IncandescenceMap: {instanceID: 0} + - _RimTex: {instanceID: 0} + - _DissolveTex: {instanceID: 0} + - _BlendMap: {instanceID: 0} + - _MainTex2: {instanceID: 0} + - _MaterialMap2: {instanceID: 0} + - _BumpMap2: {instanceID: 0} + - _EmissionMap2: {instanceID: 0} + - _IncandescenceMap2: {instanceID: 0} + - _RimTex2: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/4.6/Specialist/Tessellation Oriented Core.shader b/Assets/Alloy/Shaders/4.6/Specialist/Tessellation Oriented Core.shader new file mode 100644 index 0000000..ce3a3ee --- /dev/null +++ b/Assets/Alloy/Shaders/4.6/Specialist/Tessellation Oriented Core.shader @@ -0,0 +1,230 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Tessellation/Oriented/Core" { +Properties { + // Global Settings + _Mode ("'Rendering Mode' {RenderingMode:{Opaque:{_Cutoff}, Cutout:{}, Fade:{_Cutoff}, Transparent:{_Cutoff}}}", Float) = 0 + _SrcBlend ("__src", Float) = 0 + _DstBlend ("__dst", Float) = 0 + _ZWrite ("__zw", Float) = 1 + [LM_TransparencyCutOff] + _Cutoff ("'Opacity Cutoff' {Min:0, Max:1}", Float) = 0.5 + [Toggle(EFFECT_BUMP)] + _HasBumpMap ("'Normals Source' {Dropdown:{VertexNormals:{_OrientedBumpMap,_OrientedNormalMapScale}, NormalMaps:{}}}", Float) = 1 + [Toggle(_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A)] + _MainRoughnessSource ("'Roughness Source' {Dropdown:{PackedMapAlpha:{}, BaseColorAlpha:{_SpecTex,_Occlusion,_OrientedMaterialMap,_OrientedOcclusion}}}", Float) = 0 + + // Oriented Textures + _OrientedTextures ("'Oriented Textures' {Section:{Color:15}}", Float) = 0 + _OrientedColor ("'Tint' {}", Color) = (1,1,1,1) + _OrientedMainTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _OrientedMainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _OrientedMaterialMap ("'Metal(R) AO(G) Spec(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_OrientedMainTex}", 2D) = "white" {} + _OrientedBumpMap ("'Normals' {Visualize:{NRM}, Parent:_OrientedMainTex}", 2D) = "bump" {} + _OrientedColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Oriented Properties + _OrientedPhysicalProperties ("'Oriented Properties' {Section:{Color:16}}", Float) = 0 + _OrientedMetallic ("'Metallic' {Min:0, Max:1}", Float) = 1 + _OrientedSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 1 + _OrientedSpecularTint ("'Specular Tint' {Min:0, Max:1}", Float) = 0 + _OrientedRoughness ("'Roughness' {Min:0, Max:1}", Float) = 1 + _OrientedOcclusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _OrientedNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Tessellation + _TessellationProperties ("'Tessellation' {Section:{Color:5}}", Float) = 0 + [KeywordEnum(Displacement, Phong)] + _TessellationMode ("'Mode' {Dropdown:{Displacement:{_Phong}, Phong:{_DispTex, _Displacement}}}", Float) = 0 + _DispTex ("'Heightmap(G)' {Visualize:{RGB}}", 2D) = "black" {} + _DispTexVelocity ("Scroll", Vector) = (0,0,0,0) + _Displacement ("'Displacement' {Min:0, Max:30}", Float) = 0.3 + _Phong ("'Phong Strength' {Min:0, Max:1}", Float) = 0.5 + _EdgeLength ("'Edge Length' {Min:2, Max:50}", Float) = 15 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} + +CGINCLUDE + #define A_TESSELLATION_SHADER +ENDCG + +SubShader { + Tags { + "RenderType" = "Opaque" + "PerformanceChecks" = "False" + //"DisableBatching" = "LODFading" + } + LOD 300 + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + Blend [_SrcBlend] [_DstBlend] + ZWrite [_ZWrite] + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Shaders/Definition/OrientedCore.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend [_SrcBlend] One + ZWrite Off + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + + #include "Assets/Alloy/Shaders/Definition/OrientedCore.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + + #pragma multi_compile_shadowcaster + #pragma multi_compile_instancing + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_SHADOWCASTER + + #include "Assets/Alloy/Shaders/Definition/OrientedCore.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } + + Pass { + Name "DEFERRED" + Tags { "LightMode" = "Deferred" } + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_prepassfinal + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + #pragma multi_compile_instancing + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_DEFERRED + + #include "Assets/Alloy/Shaders/Definition/OrientedCore.cginc" + #include "Assets/Alloy/Shaders/Forward/Gbuffer.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Shaders/Definition/OrientedCore.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +FallBack "Alloy/Oriented/Core" +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Shaders/4.6/Specialist/Tessellation Oriented Core.shader.meta b/Assets/Alloy/Shaders/4.6/Specialist/Tessellation Oriented Core.shader.meta new file mode 100644 index 0000000..622fa23 --- /dev/null +++ b/Assets/Alloy/Shaders/4.6/Specialist/Tessellation Oriented Core.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 4cd81e1b932831945a162eb62b6394e4 +timeCreated: 1423414480 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/4.6/Specialist/Tessellation Transmission OneSided Forward.shader b/Assets/Alloy/Shaders/4.6/Specialist/Tessellation Transmission OneSided Forward.shader new file mode 100644 index 0000000..b3a9f53 --- /dev/null +++ b/Assets/Alloy/Shaders/4.6/Specialist/Tessellation Transmission OneSided Forward.shader @@ -0,0 +1,345 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Tessellation/Transmission/OneSided (Forward)" { +Properties { + // Global Settings + _Mode ("'Rendering Mode' {RenderingMode:{Opaque:{_Cutoff}, Cutout:{}, Fade:{_Cutoff}, Transparent:{_Cutoff}}}", Float) = 0 + _SrcBlend ("__src", Float) = 0 + _DstBlend ("__dst", Float) = 0 + _ZWrite ("__zw", Float) = 1 + [LM_TransparencyCutOff] + _Cutoff ("'Opacity Cutoff' {Min:0, Max:1}", Float) = 0.5 + [Toggle(EFFECT_BUMP)] + _HasBumpMap ("'Normals Source' {Dropdown:{VertexNormals:{_BumpMap,_BumpScale,_DetailNormalMap,_DetailNormalMapScale,_WetNormalMap,_WetNormalMapScale}, NormalMaps:{}}}", Float) = 1 + [Toggle(_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A)] + _MainRoughnessSource ("'Roughness Source' {Dropdown:{PackedMapAlpha:{}, BaseColorAlpha:{_SpecTex,_Occlusion}}}", Float) = 0 + [Enum(Front, 1, Back, 2)] + _ShadowCullMode ("'Shadow Cull Mode' {Dropdown:{Off:{}, Front:{}, Back:{}}}", Float) = 2 + + // Main Textures + _MainTextures ("'Main Textures' {Section:{Color:0}}", Float) = 0 + [LM_Albedo] [LM_Transparency] + _Color ("'Tint' {}", Color) = (1,1,1,1) + [LM_MasterTilingOffset] [LM_Albedo] + _MainTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _MainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _MainTexUV ("UV Set", Float) = 0 + [LM_Metallic] + _SpecTex ("'Metal(R) AO(G) Spec(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_MainTex}", 2D) = "white" {} + [LM_NormalMap] + _BumpMap ("'Normals' {Visualize:{NRM}, Parent:_MainTex}", 2D) = "bump" {} + _BaseColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Main Properties + _MainPhysicalProperties ("'Main Properties' {Section:{Color:1}}", Float) = 0 + [LM_Metallic] + _Metal ("'Metallic' {Min:0, Max:1}", Float) = 1 + _Specularity ("'Specularity' {Min:0, Max:1}", Float) = 1 + _SpecularTint ("'Specular Tint' {Min:0, Max:1}", Float) = 0 + _Roughness ("'Roughness' {Min:0, Max:1}", Float) = 1 + _Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _BumpScale ("'Normal Strength' {}", Float) = 1 + + // Transmission + _TransmissionProperties ("'Transmission' {Section:{Color:3}}", Float) = 0 + _TransColor ("'Tint' {}", Color) = (1,1,1) + _TransTex ("'Transmission(RGB)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "white" {} + [Gamma] + _TransScale ("'Weight' {Min:0, Max:1}", Float) = 1 + _TransDistortion ("'Bump Distortion' {Min:0, Max:1}", Float) = 0.05 + _TransPower ("'Falloff' {Min:1}", Float) = 1 + + // Tessellation + _TessellationProperties ("'Tessellation' {Section:{Color:5}}", Float) = 0 + [KeywordEnum(Displacement, Phong)] + _TessellationMode ("'Mode' {Dropdown:{Displacement:{_Phong}, Phong:{_DispTex, _Displacement}}}", Float) = 0 + _DispTex ("'Heightmap(G)' {Visualize:{RGB}}", 2D) = "black" {} + _DispTexVelocity ("Scroll", Vector) = (0,0,0,0) + _Displacement ("'Displacement' {Min:0, Max:30}", Float) = 0.3 + _Phong ("'Phong Strength' {Min:0, Max:1}", Float) = 0.5 + _EdgeLength ("'Edge Length' {Min:2, Max:50}", Float) = 15 + + // AO2 + [Toggle(_AO2_ON)] + _AO2 ("'AO2' {Feature:{Color:6}}", Float) = 0 + _Ao2Map ("'AO2(G)' {Visualize:{RGB}}", 2D) = "white" {} + _Ao2MapUV ("UV Set", Float) = 1 + _Ao2Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + + // Detail + [Toggle(_DETAIL_MULX2)] + _DetailT ("'Detail' {Feature:{Color:7}}", Float) = 0 + [Toggle(_NORMALMAP)] + _DetailMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_DetailMask}}}", Float) = 0 + _DetailMask ("'Mask(A)' {Visualize:{A}, Parent:_MainTex}", 2D) = "white" {} + _DetailMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + [Enum(Mul, 0, MulX2, 1)] + _DetailMode ("'Color Mode' {Dropdown:{Mul:{}, MulX2:{}}}", Float) = 0 + _DetailAlbedoMap ("'Color(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _DetailAlbedoMapVelocity ("Scroll", Vector) = (0,0,0,0) + _DetailAlbedoMapUV ("UV Set", Float) = 0 + _DetailNormalMap ("'Normals' {Visualize:{NRM}, Parent:_DetailAlbedoMap}", 2D) = "bump" {} + _DetailWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DetailNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Team Color + [Toggle(_TEAMCOLOR_ON)] + _TeamColor ("'Team Color' {Feature:{Color:8}}", Float) = 0 + [Enum(Masks, 0, Tint, 1)] + _TeamColorMasksAsTint ("'Texture Mode' {Dropdown:{Masks:{}, Tint:{_TeamColorMasks, _TeamColor0, _TeamColor1, _TeamColor2, _TeamColor3}}}", Float) = 0 + _TeamColorMaskMap ("'Masks(RGBA)' {Visualize:{R, G, B, A, RGB}, Parent:_MainTex}", 2D) = "black" {} + _TeamColorMasks ("'Channels' {Vector:Channels}", Vector) = (1,1,1,0) + _TeamColor0 ("'Tint R' {}", Color) = (1,0,0) + _TeamColor1 ("'Tint G' {}", Color) = (0,1,0) + _TeamColor2 ("'Tint B' {}", Color) = (0,0,1) + _TeamColor3 ("'Tint A' {}", Color) = (0.5,0.5,0.5) + + // Decal + [Toggle(_DECAL_ON)] + _Decal ("'Decal' {Feature:{Color:9}}", Float) = 0 + _DecalColor ("'Tint' {}", Color) = (1,1,1,1) + _DecalTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "black" {} + _DecalTexUV ("UV Set", Float) = 0 + _DecalWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DecalSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _DecalAlphaVertexTint ("'Vertex Alpha Tint' {Min:0, Max:1}", Float) = 0 + + // Emission + [Toggle(_EMISSION)] + _Emission ("'Emission' {Feature:{Color:10}}", Float) = 0 + [LM_Emission] + [HDR] + _EmissionColor ("'Tint' {}", Color) = (1,1,1) + [LM_Emission] + _EmissionMap ("'Mask(RGB)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "white" {} + _IncandescenceMap ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _IncandescenceMapVelocity ("Scroll", Vector) = (0,0,0,0) + _IncandescenceMapUV ("UV Set", Float) = 0 + [Gamma] + _EmissionWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + + // Rim Emission + [Toggle(_RIM_ON)] + _Rim ("'Rim Emission' {Feature:{Color:11}}", Float) = 0 + [HDR] + _RimColor ("'Tint' {}", Color) = (1,1,1) + _RimTex ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _RimTexVelocity ("Scroll", Vector) = (0,0,0,0) + _RimTexUV ("UV Set", Float) = 0 + [Gamma] + _RimWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + [Gamma] + _RimBias ("'Fill' {Min:0, Max:1}", Float) = 0 + _RimPower ("'Falloff' {Min:0.01}", Float) = 4 + + // Dissolve + [Toggle(_DISSOLVE_ON)] + _Dissolve ("'Dissolve' {Feature:{Color:12}}", Float) = 0 + [HDR] + _DissolveGlowColor ("'Glow Tint' {}", Color) = (1,1,1,1) + _DissolveTex ("'Glow Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _DissolveTexUV ("UV Set", Float) = 0 + _DissolveCutoff ("'Cutoff' {Min:0, Max:1}", Float) = 0 + [Gamma] + _DissolveGlowWeight ("'Glow Weight' {Min:0, Max:1}", Float) = 1 + _DissolveEdgeWidth ("'Glow Width' {Min:0, Max:1}", Float) = 0.01 + + // Wetness + [Toggle(_WETNESS_ON)] + _WetnessProperties ("'Wetness' {Feature:{Color:13}}", Float) = 0 + [Toggle(_WETMASKSOURCE_VERTEXCOLORALPHA)] + _WetMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_WetMask}}}", Float) = 0 + _WetMask ("'Mask(A)' {Visualize:{A}}", 2D) = "white" {} + _WetMaskVelocity ("Scroll", Vector) = (0,0,0,0) + _WetMaskUV ("UV Set", Float) = 0 + _WetMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + _WetTint ("'Tint' {}", Color) = (1,1,1,1) + _WetNormalMap ("'Normals' {Visualize:{NRM}}", 2D) = "bump" {} + _WetNormalMapVelocity ("Scroll", Vector) = (0,0,0,0) + _WetNormalMapUV ("UV Set", Float) = 0 + _WetWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _WetRoughness ("'Roughness' {Min:0, Max:1}", Float) = 0.2 + _WetNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _Lightmapping ("'GI' {LightmapEmissionProperty:{}}", Float) = 1 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} + +CGINCLUDE + #define A_FORWARD_ONLY_SHADER + #define A_TESSELLATION_SHADER +ENDCG + +SubShader { + Tags { + "RenderType" = "Opaque" + "PerformanceChecks" = "False" + //"DisableBatching" = "LODFading" + } + LOD 300 + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + Blend [_SrcBlend] [_DstBlend] + ZWrite [_ZWrite] + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Shaders/Definition/Transmission.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend [_SrcBlend] One + ZWrite Off + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + + #include "Assets/Alloy/Shaders/Definition/Transmission.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + Cull [_ShadowCullMode] + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _DISSOLVE_ON + + #pragma multi_compile_shadowcaster + #pragma multi_compile_instancing + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_SHADOWCASTER + + #include "Assets/Alloy/Shaders/Definition/Transmission.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Shaders/Definition/Transmission.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +FallBack "Alloy/Transmission/OneSided (Forward)" +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Shaders/4.6/Specialist/Tessellation Transmission OneSided Forward.shader.meta b/Assets/Alloy/Shaders/4.6/Specialist/Tessellation Transmission OneSided Forward.shader.meta new file mode 100644 index 0000000..9aaf683 --- /dev/null +++ b/Assets/Alloy/Shaders/4.6/Specialist/Tessellation Transmission OneSided Forward.shader.meta @@ -0,0 +1,22 @@ +fileFormatVersion: 2 +guid: 5aef130e2ed61b14589fe8b5434ea038 +ShaderImporter: + defaultTextures: + - _MainTex: {instanceID: 0} + - _SpecTex: {instanceID: 0} + - _BumpMap: {instanceID: 0} + - _TransTex: {instanceID: 0} + - _DispTex: {instanceID: 0} + - _DetailMask: {instanceID: 0} + - _DetailAlbedoMap: {instanceID: 0} + - _DetailMaterialMap: {fileID: 2800000, guid: 2b77d5cb601375f4ba50c6194c126e59, + type: 3} + - _DetailNormalMap: {instanceID: 0} + - _TeamColorMaskMap: {instanceID: 0} + - _DecalTex: {instanceID: 0} + - _EmissionMap: {instanceID: 0} + - _IncandescenceMap: {instanceID: 0} + - _RimTex: {instanceID: 0} + - _DissolveTex: {instanceID: 0} + userData: + assetBundleName: diff --git a/Assets/Alloy/Shaders/4.6/Specialist/Tessellation Transmission OneSided.shader b/Assets/Alloy/Shaders/4.6/Specialist/Tessellation Transmission OneSided.shader new file mode 100644 index 0000000..056369f --- /dev/null +++ b/Assets/Alloy/Shaders/4.6/Specialist/Tessellation Transmission OneSided.shader @@ -0,0 +1,383 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Tessellation/Transmission/OneSided" { +Properties { + // Global Settings + _Mode ("'Rendering Mode' {RenderingMode:{Opaque:{_Cutoff}, Cutout:{}, Fade:{_Cutoff}, Transparent:{_Cutoff}}}", Float) = 0 + _SrcBlend ("__src", Float) = 0 + _DstBlend ("__dst", Float) = 0 + _ZWrite ("__zw", Float) = 1 + [LM_TransparencyCutOff] + _Cutoff ("'Opacity Cutoff' {Min:0, Max:1}", Float) = 0.5 + [Toggle(EFFECT_BUMP)] + _HasBumpMap ("'Normals Source' {Dropdown:{VertexNormals:{_BumpMap,_BumpScale,_DetailNormalMap,_DetailNormalMapScale,_WetNormalMap,_WetNormalMapScale}, NormalMaps:{}}}", Float) = 1 + [Toggle(_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A)] + _MainRoughnessSource ("'Roughness Source' {Dropdown:{PackedMapAlpha:{}, BaseColorAlpha:{_SpecTex,_Occlusion}}}", Float) = 0 + [Enum(Front, 1, Back, 2)] + _ShadowCullMode ("'Shadow Cull Mode' {Dropdown:{Off:{}, Front:{}, Back:{}}}", Float) = 2 + + // Main Textures + _MainTextures ("'Main Textures' {Section:{Color:0}}", Float) = 0 + [LM_Albedo] [LM_Transparency] + _Color ("'Tint' {}", Color) = (1,1,1,1) + [LM_MasterTilingOffset] [LM_Albedo] + _MainTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _MainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _MainTexUV ("UV Set", Float) = 0 + [LM_Metallic] + _SpecTex ("'Metal(R) AO(G) Spec(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_MainTex}", 2D) = "white" {} + [LM_NormalMap] + _BumpMap ("'Normals' {Visualize:{NRM}, Parent:_MainTex}", 2D) = "bump" {} + _BaseColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Main Properties + _MainPhysicalProperties ("'Main Properties' {Section:{Color:1}}", Float) = 0 + [LM_Metallic] + _Metal ("'Metallic' {Min:0, Max:1}", Float) = 1 + _Specularity ("'Specularity' {Min:0, Max:1}", Float) = 1 + _SpecularTint ("'Specular Tint' {Min:0, Max:1}", Float) = 0 + _Roughness ("'Roughness' {Min:0, Max:1}", Float) = 1 + _Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _BumpScale ("'Normal Strength' {}", Float) = 1 + + // Transmission + _TransmissionProperties ("'Transmission' {Section:{Color:3}}", Float) = 0 + _TransTex ("'Transmission(G)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "white" {} + [Gamma] + _TransScale ("'Weight' {Min:0, Max:1}", Float) = 1 + + // Tessellation + _TessellationProperties ("'Tessellation' {Section:{Color:5}}", Float) = 0 + [KeywordEnum(Displacement, Phong)] + _TessellationMode ("'Mode' {Dropdown:{Displacement:{_Phong}, Phong:{_DispTex, _Displacement}}}", Float) = 0 + _DispTex ("'Heightmap(G)' {Visualize:{RGB}}", 2D) = "black" {} + _DispTexVelocity ("Scroll", Vector) = (0,0,0,0) + _Displacement ("'Displacement' {Min:0, Max:30}", Float) = 0.3 + _Phong ("'Phong Strength' {Min:0, Max:1}", Float) = 0.5 + _EdgeLength ("'Edge Length' {Min:2, Max:50}", Float) = 15 + + // AO2 + [Toggle(_AO2_ON)] + _AO2 ("'AO2' {Feature:{Color:6}}", Float) = 0 + _Ao2Map ("'AO2(G)' {Visualize:{RGB}}", 2D) = "white" {} + _Ao2MapUV ("UV Set", Float) = 1 + _Ao2Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + + // Detail + [Toggle(_DETAIL_MULX2)] + _DetailT ("'Detail' {Feature:{Color:7}}", Float) = 0 + [Toggle(_NORMALMAP)] + _DetailMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_DetailMask}}}", Float) = 0 + _DetailMask ("'Mask(A)' {Visualize:{A}, Parent:_MainTex}", 2D) = "white" {} + _DetailMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + [Enum(Mul, 0, MulX2, 1)] + _DetailMode ("'Color Mode' {Dropdown:{Mul:{}, MulX2:{}}}", Float) = 0 + _DetailAlbedoMap ("'Color(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _DetailAlbedoMapVelocity ("Scroll", Vector) = (0,0,0,0) + _DetailAlbedoMapUV ("UV Set", Float) = 0 + _DetailNormalMap ("'Normals' {Visualize:{NRM}, Parent:_DetailAlbedoMap}", 2D) = "bump" {} + _DetailWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DetailNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Team Color + [Toggle(_TEAMCOLOR_ON)] + _TeamColor ("'Team Color' {Feature:{Color:8}}", Float) = 0 + [Enum(Masks, 0, Tint, 1)] + _TeamColorMasksAsTint ("'Texture Mode' {Dropdown:{Masks:{}, Tint:{_TeamColorMasks, _TeamColor0, _TeamColor1, _TeamColor2, _TeamColor3}}}", Float) = 0 + _TeamColorMaskMap ("'Masks(RGBA)' {Visualize:{R, G, B, A, RGB}, Parent:_MainTex}", 2D) = "black" {} + _TeamColorMasks ("'Channels' {Vector:Channels}", Vector) = (1,1,1,0) + _TeamColor0 ("'Tint R' {}", Color) = (1,0,0) + _TeamColor1 ("'Tint G' {}", Color) = (0,1,0) + _TeamColor2 ("'Tint B' {}", Color) = (0,0,1) + _TeamColor3 ("'Tint A' {}", Color) = (0.5,0.5,0.5) + + // Decal + [Toggle(_DECAL_ON)] + _Decal ("'Decal' {Feature:{Color:9}}", Float) = 0 + _DecalColor ("'Tint' {}", Color) = (1,1,1,1) + _DecalTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "black" {} + _DecalTexUV ("UV Set", Float) = 0 + _DecalWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DecalSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _DecalAlphaVertexTint ("'Vertex Alpha Tint' {Min:0, Max:1}", Float) = 0 + + // Emission + [Toggle(_EMISSION)] + _Emission ("'Emission' {Feature:{Color:10}}", Float) = 0 + [LM_Emission] + [HDR] + _EmissionColor ("'Tint' {}", Color) = (1,1,1) + [LM_Emission] + _EmissionMap ("'Mask(RGB)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "white" {} + _IncandescenceMap ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _IncandescenceMapVelocity ("Scroll", Vector) = (0,0,0,0) + _IncandescenceMapUV ("UV Set", Float) = 0 + [Gamma] + _EmissionWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + + // Rim Emission + [Toggle(_RIM_ON)] + _Rim ("'Rim Emission' {Feature:{Color:11}}", Float) = 0 + [HDR] + _RimColor ("'Tint' {}", Color) = (1,1,1) + _RimTex ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _RimTexVelocity ("Scroll", Vector) = (0,0,0,0) + _RimTexUV ("UV Set", Float) = 0 + [Gamma] + _RimWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + [Gamma] + _RimBias ("'Fill' {Min:0, Max:1}", Float) = 0 + _RimPower ("'Falloff' {Min:0.01}", Float) = 4 + + // Dissolve + [Toggle(_DISSOLVE_ON)] + _Dissolve ("'Dissolve' {Feature:{Color:12}}", Float) = 0 + [HDR] + _DissolveGlowColor ("'Glow Tint' {}", Color) = (1,1,1,1) + _DissolveTex ("'Glow Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _DissolveTexUV ("UV Set", Float) = 0 + _DissolveCutoff ("'Cutoff' {Min:0, Max:1}", Float) = 0 + [Gamma] + _DissolveGlowWeight ("'Glow Weight' {Min:0, Max:1}", Float) = 1 + _DissolveEdgeWidth ("'Glow Width' {Min:0, Max:1}", Float) = 0.01 + + // Wetness + [Toggle(_WETNESS_ON)] + _WetnessProperties ("'Wetness' {Feature:{Color:13}}", Float) = 0 + [Toggle(_WETMASKSOURCE_VERTEXCOLORALPHA)] + _WetMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_WetMask}}}", Float) = 0 + _WetMask ("'Mask(A)' {Visualize:{A}}", 2D) = "white" {} + _WetMaskVelocity ("Scroll", Vector) = (0,0,0,0) + _WetMaskUV ("UV Set", Float) = 0 + _WetMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + _WetTint ("'Tint' {}", Color) = (1,1,1,1) + _WetNormalMap ("'Normals' {Visualize:{NRM}}", 2D) = "bump" {} + _WetNormalMapVelocity ("Scroll", Vector) = (0,0,0,0) + _WetNormalMapUV ("UV Set", Float) = 0 + _WetWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _WetRoughness ("'Roughness' {Min:0, Max:1}", Float) = 0.2 + _WetNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _Lightmapping ("'GI' {LightmapEmissionProperty:{}}", Float) = 1 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} + +CGINCLUDE + #define A_TESSELLATION_SHADER +ENDCG + +SubShader { + Tags { + "RenderType" = "Opaque" + "PerformanceChecks" = "False" + //"DisableBatching" = "LODFading" + } + LOD 300 + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + Blend [_SrcBlend] [_DstBlend] + ZWrite [_ZWrite] + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Shaders/Definition/Transmission.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend [_SrcBlend] One + ZWrite Off + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + + #include "Assets/Alloy/Shaders/Definition/Transmission.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + Cull [_ShadowCullMode] + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _DISSOLVE_ON + + #pragma multi_compile_shadowcaster + #pragma multi_compile_instancing + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_SHADOWCASTER + + #include "Assets/Alloy/Shaders/Definition/Transmission.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } + + Pass { + Name "DEFERRED" + Tags { "LightMode" = "Deferred" } + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_prepassfinal + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + #pragma multi_compile_instancing + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_DEFERRED + + #include "Assets/Alloy/Shaders/Definition/Transmission.cginc" + #include "Assets/Alloy/Shaders/Forward/Gbuffer.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Shaders/Definition/Transmission.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +FallBack "Alloy/Transmission/OneSided" +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Shaders/4.6/Specialist/Tessellation Transmission OneSided.shader.meta b/Assets/Alloy/Shaders/4.6/Specialist/Tessellation Transmission OneSided.shader.meta new file mode 100644 index 0000000..923fb9c --- /dev/null +++ b/Assets/Alloy/Shaders/4.6/Specialist/Tessellation Transmission OneSided.shader.meta @@ -0,0 +1,26 @@ +fileFormatVersion: 2 +guid: fda7be2eb0402b049a5d7de96b608b27 +timeCreated: 1461806787 +licenseType: Pro +ShaderImporter: + defaultTextures: + - _MainTex: {instanceID: 0} + - _SpecTex: {instanceID: 0} + - _BumpMap: {instanceID: 0} + - _TransTex: {instanceID: 0} + - _DispTex: {instanceID: 0} + - _Ao2Map: {instanceID: 0} + - _DetailMask: {instanceID: 0} + - _DetailAlbedoMap: {instanceID: 0} + - _DetailMaterialMap: {fileID: 2800000, guid: 2b77d5cb601375f4ba50c6194c126e59, + type: 3} + - _DetailNormalMap: {instanceID: 0} + - _TeamColorMaskMap: {instanceID: 0} + - _DecalTex: {instanceID: 0} + - _EmissionMap: {instanceID: 0} + - _IncandescenceMap: {instanceID: 0} + - _RimTex: {instanceID: 0} + - _DissolveTex: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/4.6/Specialist/Tessellation Transmission TwoSided Forward.shader b/Assets/Alloy/Shaders/4.6/Specialist/Tessellation Transmission TwoSided Forward.shader new file mode 100644 index 0000000..8ad0830 --- /dev/null +++ b/Assets/Alloy/Shaders/4.6/Specialist/Tessellation Transmission TwoSided Forward.shader @@ -0,0 +1,348 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Tessellation/Transmission/TwoSided (Forward)" { +Properties { + // Global Settings + _Mode ("'Rendering Mode' {RenderingMode:{Opaque:{_Cutoff}, Cutout:{}, Fade:{_Cutoff}, Transparent:{_Cutoff}}}", Float) = 0 + _SrcBlend ("__src", Float) = 0 + _DstBlend ("__dst", Float) = 0 + _ZWrite ("__zw", Float) = 1 + [LM_TransparencyCutOff] + _Cutoff ("'Opacity Cutoff' {Min:0, Max:1}", Float) = 0.5 + [Toggle(EFFECT_BUMP)] + _HasBumpMap ("'Normals Source' {Dropdown:{VertexNormals:{_TransInvertBackNormal,_BumpMap,_BumpScale,_DetailNormalMap,_DetailNormalMapScale,_WetNormalMap,_WetNormalMapScale}, NormalMaps:{}}}", Float) = 1 + [Toggle(_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A)] + _MainRoughnessSource ("'Roughness Source' {Dropdown:{PackedMapAlpha:{}, BaseColorAlpha:{_SpecTex,_Occlusion}}}", Float) = 0 + _TransInvertBackNormal ("'Invert Back Normals' {Toggle:{On:{}, Off:{}}}", Float) = 0 + + // Main Textures + _MainTextures ("'Main Textures' {Section:{Color:0}}", Float) = 0 + [LM_Albedo] [LM_Transparency] + _Color ("'Tint' {}", Color) = (1,1,1,1) + [LM_MasterTilingOffset] [LM_Albedo] + _MainTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _MainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _MainTexUV ("UV Set", Float) = 0 + [LM_Metallic] + _SpecTex ("'Metal(R) AO(G) Spec(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_MainTex}", 2D) = "white" {} + [LM_NormalMap] + _BumpMap ("'Normals' {Visualize:{NRM}, Parent:_MainTex}", 2D) = "bump" {} + _BaseColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Main Properties + _MainPhysicalProperties ("'Main Properties' {Section:{Color:1}}", Float) = 0 + [LM_Metallic] + _Metal ("'Metallic' {Min:0, Max:1}", Float) = 1 + _Specularity ("'Specularity' {Min:0, Max:1}", Float) = 1 + _SpecularTint ("'Specular Tint' {Min:0, Max:1}", Float) = 0 + _Roughness ("'Roughness' {Min:0, Max:1}", Float) = 1 + _Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _BumpScale ("'Normal Strength' {}", Float) = 1 + + // Transmission + _TransmissionProperties ("'Transmission' {Section:{Color:3}}", Float) = 0 + _TransColor ("'Tint' {}", Color) = (1,1,1) + _TransTex ("'Transmission(RGB)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "white" {} + [Gamma] + _TransScale ("'Weight' {Min:0, Max:1}", Float) = 1 + _TransShadowWeight ("'Shadow Weight' {Min:0, Max:1}", Float) = 0.5 + _TransDistortion ("'Bump Distortion' {Min:0, Max:1}", Float) = 0.05 + _TransPower ("'Falloff' {Min:1}", Float) = 1 + + // Tessellation + _TessellationProperties ("'Tessellation' {Section:{Color:5}}", Float) = 0 + [KeywordEnum(Displacement, Phong)] + _TessellationMode ("'Mode' {Dropdown:{Displacement:{_Phong}, Phong:{_DispTex, _Displacement}}}", Float) = 0 + _DispTex ("'Heightmap(G)' {Visualize:{RGB}}", 2D) = "black" {} + _DispTexVelocity ("Scroll", Vector) = (0,0,0,0) + _Displacement ("'Displacement' {Min:0, Max:30}", Float) = 0.3 + _Phong ("'Phong Strength' {Min:0, Max:1}", Float) = 0.5 + _EdgeLength ("'Edge Length' {Min:2, Max:50}", Float) = 15 + + // AO2 + [Toggle(_AO2_ON)] + _AO2 ("'AO2' {Feature:{Color:6}}", Float) = 0 + _Ao2Map ("'AO2(G)' {Visualize:{RGB}}", 2D) = "white" {} + _Ao2MapUV ("UV Set", Float) = 1 + _Ao2Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + + // Detail + [Toggle(_DETAIL_MULX2)] + _DetailT ("'Detail' {Feature:{Color:7}}", Float) = 0 + [Toggle(_NORMALMAP)] + _DetailMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_DetailMask}}}", Float) = 0 + _DetailMask ("'Mask(A)' {Visualize:{A}, Parent:_MainTex}", 2D) = "white" {} + _DetailMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + [Enum(Mul, 0, MulX2, 1)] + _DetailMode ("'Color Mode' {Dropdown:{Mul:{}, MulX2:{}}}", Float) = 0 + _DetailAlbedoMap ("'Color(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _DetailAlbedoMapVelocity ("Scroll", Vector) = (0,0,0,0) + _DetailAlbedoMapUV ("UV Set", Float) = 0 + _DetailNormalMap ("'Normals' {Visualize:{NRM}, Parent:_DetailAlbedoMap}", 2D) = "bump" {} + _DetailWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DetailNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Team Color + [Toggle(_TEAMCOLOR_ON)] + _TeamColor ("'Team Color' {Feature:{Color:8}}", Float) = 0 + [Enum(Masks, 0, Tint, 1)] + _TeamColorMasksAsTint ("'Texture Mode' {Dropdown:{Masks:{}, Tint:{_TeamColorMasks, _TeamColor0, _TeamColor1, _TeamColor2, _TeamColor3}}}", Float) = 0 + _TeamColorMaskMap ("'Masks(RGBA)' {Visualize:{R, G, B, A, RGB}, Parent:_MainTex}", 2D) = "black" {} + _TeamColorMasks ("'Channels' {Vector:Channels}", Vector) = (1,1,1,0) + _TeamColor0 ("'Tint R' {}", Color) = (1,0,0) + _TeamColor1 ("'Tint G' {}", Color) = (0,1,0) + _TeamColor2 ("'Tint B' {}", Color) = (0,0,1) + _TeamColor3 ("'Tint A' {}", Color) = (0.5,0.5,0.5) + + // Decal + [Toggle(_DECAL_ON)] + _Decal ("'Decal' {Feature:{Color:9}}", Float) = 0 + _DecalColor ("'Tint' {}", Color) = (1,1,1,1) + _DecalTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "black" {} + _DecalTexUV ("UV Set", Float) = 0 + _DecalWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DecalSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _DecalAlphaVertexTint ("'Vertex Alpha Tint' {Min:0, Max:1}", Float) = 0 + + // Emission + [Toggle(_EMISSION)] + _Emission ("'Emission' {Feature:{Color:10}}", Float) = 0 + [LM_Emission] + [HDR] + _EmissionColor ("'Tint' {}", Color) = (1,1,1) + [LM_Emission] + _EmissionMap ("'Mask(RGB)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "white" {} + _IncandescenceMap ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _IncandescenceMapVelocity ("Scroll", Vector) = (0,0,0,0) + _IncandescenceMapUV ("UV Set", Float) = 0 + [Gamma] + _EmissionWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + + // Rim Emission + [Toggle(_RIM_ON)] + _Rim ("'Rim Emission' {Feature:{Color:11}}", Float) = 0 + [HDR] + _RimColor ("'Tint' {}", Color) = (1,1,1) + _RimTex ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _RimTexVelocity ("Scroll", Vector) = (0,0,0,0) + _RimTexUV ("UV Set", Float) = 0 + [Gamma] + _RimWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + [Gamma] + _RimBias ("'Fill' {Min:0, Max:1}", Float) = 0 + _RimPower ("'Falloff' {Min:0.01}", Float) = 4 + + // Dissolve + [Toggle(_DISSOLVE_ON)] + _Dissolve ("'Dissolve' {Feature:{Color:12}}", Float) = 0 + [HDR] + _DissolveGlowColor ("'Glow Tint' {}", Color) = (1,1,1,1) + _DissolveTex ("'Glow Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _DissolveTexUV ("UV Set", Float) = 0 + _DissolveCutoff ("'Cutoff' {Min:0, Max:1}", Float) = 0 + [Gamma] + _DissolveGlowWeight ("'Glow Weight' {Min:0, Max:1}", Float) = 1 + _DissolveEdgeWidth ("'Glow Width' {Min:0, Max:1}", Float) = 0.01 + + // Wetness + [Toggle(_WETNESS_ON)] + _WetnessProperties ("'Wetness' {Feature:{Color:13}}", Float) = 0 + [Toggle(_WETMASKSOURCE_VERTEXCOLORALPHA)] + _WetMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_WetMask}}}", Float) = 0 + _WetMask ("'Mask(A)' {Visualize:{A}}", 2D) = "white" {} + _WetMaskVelocity ("Scroll", Vector) = (0,0,0,0) + _WetMaskUV ("UV Set", Float) = 0 + _WetMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + _WetTint ("'Tint' {}", Color) = (1,1,1,1) + _WetNormalMap ("'Normals' {Visualize:{NRM}}", 2D) = "bump" {} + _WetNormalMapVelocity ("Scroll", Vector) = (0,0,0,0) + _WetNormalMapUV ("UV Set", Float) = 0 + _WetWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _WetRoughness ("'Roughness' {Min:0, Max:1}", Float) = 0.2 + _WetNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _Lightmapping ("'GI' {LightmapEmissionProperty:{}}", Float) = 1 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} + +CGINCLUDE + #define A_FORWARD_ONLY_SHADER + #define A_TWO_SIDED_SHADER + #define A_TESSELLATION_SHADER +ENDCG + +SubShader { + Tags { + "RenderType" = "Opaque" + "PerformanceChecks" = "False" + //"DisableBatching" = "LODFading" + } + LOD 300 + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + Blend [_SrcBlend] [_DstBlend] + ZWrite [_ZWrite] + Cull Off + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Shaders/Definition/Transmission.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend [_SrcBlend] One + ZWrite Off + Cull Off + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + + #include "Assets/Alloy/Shaders/Definition/Transmission.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + Cull Off + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _DISSOLVE_ON + + #pragma multi_compile_shadowcaster + #pragma multi_compile_instancing + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_SHADOWCASTER + + #include "Assets/Alloy/Shaders/Definition/Transmission.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Shaders/Definition/Transmission.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +FallBack "Alloy/Transmission/TwoSided (Forward)" +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Shaders/4.6/Specialist/Tessellation Transmission TwoSided Forward.shader.meta b/Assets/Alloy/Shaders/4.6/Specialist/Tessellation Transmission TwoSided Forward.shader.meta new file mode 100644 index 0000000..5e37426 --- /dev/null +++ b/Assets/Alloy/Shaders/4.6/Specialist/Tessellation Transmission TwoSided Forward.shader.meta @@ -0,0 +1,22 @@ +fileFormatVersion: 2 +guid: 7efd61d32f943794f871856be45468b9 +ShaderImporter: + defaultTextures: + - _MainTex: {instanceID: 0} + - _SpecTex: {instanceID: 0} + - _BumpMap: {instanceID: 0} + - _TransTex: {instanceID: 0} + - _DispTex: {instanceID: 0} + - _DetailMask: {instanceID: 0} + - _DetailAlbedoMap: {instanceID: 0} + - _DetailMaterialMap: {fileID: 2800000, guid: 2b77d5cb601375f4ba50c6194c126e59, + type: 3} + - _DetailNormalMap: {instanceID: 0} + - _TeamColorMaskMap: {instanceID: 0} + - _DecalTex: {instanceID: 0} + - _EmissionMap: {instanceID: 0} + - _IncandescenceMap: {instanceID: 0} + - _RimTex: {instanceID: 0} + - _DissolveTex: {instanceID: 0} + userData: + assetBundleName: diff --git a/Assets/Alloy/Shaders/4.6/Specialist/Tessellation Transmission TwoSided.shader b/Assets/Alloy/Shaders/4.6/Specialist/Tessellation Transmission TwoSided.shader new file mode 100644 index 0000000..865bfb9 --- /dev/null +++ b/Assets/Alloy/Shaders/4.6/Specialist/Tessellation Transmission TwoSided.shader @@ -0,0 +1,387 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Tessellation/Transmission/TwoSided" { +Properties { + // Global Settings + _Mode ("'Rendering Mode' {RenderingMode:{Opaque:{_Cutoff}, Cutout:{}, Fade:{_Cutoff}, Transparent:{_Cutoff}}}", Float) = 0 + _SrcBlend ("__src", Float) = 0 + _DstBlend ("__dst", Float) = 0 + _ZWrite ("__zw", Float) = 1 + [LM_TransparencyCutOff] + _Cutoff ("'Opacity Cutoff' {Min:0, Max:1}", Float) = 0.5 + [Toggle(EFFECT_BUMP)] + _HasBumpMap ("'Normals Source' {Dropdown:{VertexNormals:{_TransInvertBackNormal,_BumpMap,_BumpScale,_DetailNormalMap,_DetailNormalMapScale,_WetNormalMap,_WetNormalMapScale}, NormalMaps:{}}}", Float) = 1 + [Toggle(_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A)] + _MainRoughnessSource ("'Roughness Source' {Dropdown:{PackedMapAlpha:{}, BaseColorAlpha:{_SpecTex,_Occlusion}}}", Float) = 0 + _TransInvertBackNormal ("'Invert Back Normals' {Toggle:{On:{}, Off:{}}}", Float) = 0 + + // Main Textures + _MainTextures ("'Main Textures' {Section:{Color:0}}", Float) = 0 + [LM_Albedo] [LM_Transparency] + _Color ("'Tint' {}", Color) = (1,1,1,1) + [LM_MasterTilingOffset] [LM_Albedo] + _MainTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _MainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _MainTexUV ("UV Set", Float) = 0 + [LM_Metallic] + _SpecTex ("'Metal(R) AO(G) Spec(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_MainTex}", 2D) = "white" {} + [LM_NormalMap] + _BumpMap ("'Normals' {Visualize:{NRM}, Parent:_MainTex}", 2D) = "bump" {} + _BaseColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Main Properties + _MainPhysicalProperties ("'Main Properties' {Section:{Color:1}}", Float) = 0 + [LM_Metallic] + _Metal ("'Metallic' {Min:0, Max:1}", Float) = 1 + _Specularity ("'Specularity' {Min:0, Max:1}", Float) = 1 + _SpecularTint ("'Specular Tint' {Min:0, Max:1}", Float) = 0 + _Roughness ("'Roughness' {Min:0, Max:1}", Float) = 1 + _Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _BumpScale ("'Normal Strength' {}", Float) = 1 + + // Transmission + _TransmissionProperties ("'Transmission' {Section:{Color:3}}", Float) = 0 + _TransTex ("'Transmission(G)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "white" {} + [Gamma] + _TransScale ("'Weight' {Min:0, Max:1}", Float) = 1 + + // Tessellation + _TessellationProperties ("'Tessellation' {Section:{Color:5}}", Float) = 0 + [KeywordEnum(Displacement, Phong)] + _TessellationMode ("'Mode' {Dropdown:{Displacement:{_Phong}, Phong:{_DispTex, _Displacement}}}", Float) = 0 + _DispTex ("'Heightmap(G)' {Visualize:{RGB}}", 2D) = "black" {} + _DispTexVelocity ("Scroll", Vector) = (0,0,0,0) + _Displacement ("'Displacement' {Min:0, Max:30}", Float) = 0.3 + _Phong ("'Phong Strength' {Min:0, Max:1}", Float) = 0.5 + _EdgeLength ("'Edge Length' {Min:2, Max:50}", Float) = 15 + + // AO2 + [Toggle(_AO2_ON)] + _AO2 ("'AO2' {Feature:{Color:6}}", Float) = 0 + _Ao2Map ("'AO2(G)' {Visualize:{RGB}}", 2D) = "white" {} + _Ao2MapUV ("UV Set", Float) = 1 + _Ao2Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + + // Detail + [Toggle(_DETAIL_MULX2)] + _DetailT ("'Detail' {Feature:{Color:7}}", Float) = 0 + [Toggle(_NORMALMAP)] + _DetailMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_DetailMask}}}", Float) = 0 + _DetailMask ("'Mask(A)' {Visualize:{A}, Parent:_MainTex}", 2D) = "white" {} + _DetailMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + [Enum(Mul, 0, MulX2, 1)] + _DetailMode ("'Color Mode' {Dropdown:{Mul:{}, MulX2:{}}}", Float) = 0 + _DetailAlbedoMap ("'Color(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _DetailAlbedoMapVelocity ("Scroll", Vector) = (0,0,0,0) + _DetailAlbedoMapUV ("UV Set", Float) = 0 + _DetailNormalMap ("'Normals' {Visualize:{NRM}, Parent:_DetailAlbedoMap}", 2D) = "bump" {} + _DetailWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DetailNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Team Color + [Toggle(_TEAMCOLOR_ON)] + _TeamColor ("'Team Color' {Feature:{Color:8}}", Float) = 0 + [Enum(Masks, 0, Tint, 1)] + _TeamColorMasksAsTint ("'Texture Mode' {Dropdown:{Masks:{}, Tint:{_TeamColorMasks, _TeamColor0, _TeamColor1, _TeamColor2, _TeamColor3}}}", Float) = 0 + _TeamColorMaskMap ("'Masks(RGBA)' {Visualize:{R, G, B, A, RGB}, Parent:_MainTex}", 2D) = "black" {} + _TeamColorMasks ("'Channels' {Vector:Channels}", Vector) = (1,1,1,0) + _TeamColor0 ("'Tint R' {}", Color) = (1,0,0) + _TeamColor1 ("'Tint G' {}", Color) = (0,1,0) + _TeamColor2 ("'Tint B' {}", Color) = (0,0,1) + _TeamColor3 ("'Tint A' {}", Color) = (0.5,0.5,0.5) + + // Decal + [Toggle(_DECAL_ON)] + _Decal ("'Decal' {Feature:{Color:9}}", Float) = 0 + _DecalColor ("'Tint' {}", Color) = (1,1,1,1) + _DecalTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "black" {} + _DecalTexUV ("UV Set", Float) = 0 + _DecalWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DecalSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _DecalAlphaVertexTint ("'Vertex Alpha Tint' {Min:0, Max:1}", Float) = 0 + + // Emission + [Toggle(_EMISSION)] + _Emission ("'Emission' {Feature:{Color:10}}", Float) = 0 + [LM_Emission] + [HDR] + _EmissionColor ("'Tint' {}", Color) = (1,1,1) + [LM_Emission] + _EmissionMap ("'Mask(RGB)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "white" {} + _IncandescenceMap ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _IncandescenceMapVelocity ("Scroll", Vector) = (0,0,0,0) + _IncandescenceMapUV ("UV Set", Float) = 0 + [Gamma] + _EmissionWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + + // Rim Emission + [Toggle(_RIM_ON)] + _Rim ("'Rim Emission' {Feature:{Color:11}}", Float) = 0 + [HDR] + _RimColor ("'Tint' {}", Color) = (1,1,1) + _RimTex ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _RimTexVelocity ("Scroll", Vector) = (0,0,0,0) + _RimTexUV ("UV Set", Float) = 0 + [Gamma] + _RimWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + [Gamma] + _RimBias ("'Fill' {Min:0, Max:1}", Float) = 0 + _RimPower ("'Falloff' {Min:0.01}", Float) = 4 + + // Dissolve + [Toggle(_DISSOLVE_ON)] + _Dissolve ("'Dissolve' {Feature:{Color:12}}", Float) = 0 + [HDR] + _DissolveGlowColor ("'Glow Tint' {}", Color) = (1,1,1,1) + _DissolveTex ("'Glow Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _DissolveTexUV ("UV Set", Float) = 0 + _DissolveCutoff ("'Cutoff' {Min:0, Max:1}", Float) = 0 + [Gamma] + _DissolveGlowWeight ("'Glow Weight' {Min:0, Max:1}", Float) = 1 + _DissolveEdgeWidth ("'Glow Width' {Min:0, Max:1}", Float) = 0.01 + + // Wetness + [Toggle(_WETNESS_ON)] + _WetnessProperties ("'Wetness' {Feature:{Color:13}}", Float) = 0 + [Toggle(_WETMASKSOURCE_VERTEXCOLORALPHA)] + _WetMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_WetMask}}}", Float) = 0 + _WetMask ("'Mask(A)' {Visualize:{A}}", 2D) = "white" {} + _WetMaskVelocity ("Scroll", Vector) = (0,0,0,0) + _WetMaskUV ("UV Set", Float) = 0 + _WetMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + _WetTint ("'Tint' {}", Color) = (1,1,1,1) + _WetNormalMap ("'Normals' {Visualize:{NRM}}", 2D) = "bump" {} + _WetNormalMapVelocity ("Scroll", Vector) = (0,0,0,0) + _WetNormalMapUV ("UV Set", Float) = 0 + _WetWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _WetRoughness ("'Roughness' {Min:0, Max:1}", Float) = 0.2 + _WetNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _Lightmapping ("'GI' {LightmapEmissionProperty:{}}", Float) = 1 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} + +CGINCLUDE + #define A_TWO_SIDED_SHADER + #define A_TESSELLATION_SHADER +ENDCG + +SubShader { + Tags { + "RenderType" = "Opaque" + "PerformanceChecks" = "False" + //"DisableBatching" = "LODFading" + } + LOD 300 + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + Blend [_SrcBlend] [_DstBlend] + ZWrite [_ZWrite] + Cull Off + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Shaders/Definition/Transmission.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend [_SrcBlend] One + ZWrite Off + Cull Off + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + + #include "Assets/Alloy/Shaders/Definition/Transmission.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + Cull Off + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _DISSOLVE_ON + + #pragma multi_compile_shadowcaster + #pragma multi_compile_instancing + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_SHADOWCASTER + + #include "Assets/Alloy/Shaders/Definition/Transmission.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } + + Pass { + Name "DEFERRED" + Tags { "LightMode" = "Deferred" } + + Cull Off + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_prepassfinal + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + #pragma multi_compile_instancing + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_DEFERRED + + #include "Assets/Alloy/Shaders/Definition/Transmission.cginc" + #include "Assets/Alloy/Shaders/Forward/Gbuffer.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Shaders/Definition/Transmission.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +FallBack "Alloy/Transmission/TwoSided" +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Shaders/4.6/Specialist/Tessellation Transmission TwoSided.shader.meta b/Assets/Alloy/Shaders/4.6/Specialist/Tessellation Transmission TwoSided.shader.meta new file mode 100644 index 0000000..a3efdc4 --- /dev/null +++ b/Assets/Alloy/Shaders/4.6/Specialist/Tessellation Transmission TwoSided.shader.meta @@ -0,0 +1,25 @@ +fileFormatVersion: 2 +guid: 3dd272ab0e1791347a06e145924d14bf +timeCreated: 1445805745 +licenseType: Pro +ShaderImporter: + defaultTextures: + - _MainTex: {instanceID: 0} + - _SpecTex: {instanceID: 0} + - _BumpMap: {instanceID: 0} + - _TransTex: {instanceID: 0} + - _DispTex: {instanceID: 0} + - _Ao2Map: {fileID: 2800000, guid: 2b77d5cb601375f4ba50c6194c126e59, type: 3} + - _DetailMask: {instanceID: 0} + - _DetailAlbedoMap: {instanceID: 0} + - _DetailMaterialMap: {instanceID: 0} + - _DetailNormalMap: {instanceID: 0} + - _TeamColorMaskMap: {instanceID: 0} + - _DecalTex: {instanceID: 0} + - _EmissionMap: {instanceID: 0} + - _IncandescenceMap: {instanceID: 0} + - _RimTex: {instanceID: 0} + - _DissolveTex: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/4.6/Specialist/Tessellation TriPlanar.shader b/Assets/Alloy/Shaders/4.6/Specialist/Tessellation TriPlanar.shader new file mode 100644 index 0000000..bf0be88 --- /dev/null +++ b/Assets/Alloy/Shaders/4.6/Specialist/Tessellation TriPlanar.shader @@ -0,0 +1,318 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Tessellation/TriPlanar" { +Properties { + // Global Settings + _Mode ("'Rendering Mode' {RenderingMode:{Opaque:{_Cutoff}, Cutout:{}, Fade:{_Cutoff}, Transparent:{_Cutoff}}}", Float) = 0 + _SrcBlend ("__src", Float) = 0 + _DstBlend ("__dst", Float) = 0 + _ZWrite ("__zw", Float) = 1 + [LM_TransparencyCutOff] + _Cutoff ("'Opacity Cutoff' {Min:0, Max:1}", Float) = 0.5 + [Toggle(EFFECT_BUMP)] + _HasBumpMap ("'Normals Source' {Dropdown:{VertexNormals:{_PrimaryBumpMap,_PrimaryBumpScale,_SecondaryBumpMap,_SecondaryBumpScale,_TertiaryBumpMap,_TertiaryBumpScale,_QuaternaryBumpMap,_QuaternaryBumpScale}, NormalMaps:{}}}", Float) = 1 + [Toggle(_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A)] + _MainRoughnessSource ("'Roughness Source' {Dropdown:{PackedMapAlpha:{}, BaseColorAlpha:{_PrimaryMaterialMap,_PrimaryOcclusion,_SecondaryMaterialMap,_SecondaryOcclusion,_TertiaryMaterialMap,_TertiaryOcclusion,_QuaternaryMaterialMap,_QuaternaryOcclusion}}}", Float) = 0 + + // Primary Textures + _PrimaryTextures ("'Primary Textures' {Section:{Color:0}}", Float) = 0 + _PrimaryColor ("'Tint' {}", Color) = (1,1,1,1) + _PrimaryMainTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _PrimaryMainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _PrimaryMaterialMap ("'Metal(R) AO(G) Spec(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_PrimaryMainTex}", 2D) = "white" {} + _PrimaryBumpMap ("'Normals' {Visualize:{NRM}, Parent:_PrimaryMainTex}", 2D) = "bump" {} + _PrimaryColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Primary Properties + _PrimaryPhysicalProperties ("'Primary Properties' {Section:{Color:0}}", Float) = 0 + _PrimaryMetallic ("'Metallic' {Min:0, Max:1}", Float) = 1 + _PrimarySpecularity ("'Specularity' {Min:0, Max:1}", Float) = 1 + _PrimarySpecularTint ("'Specular Tint' {Min:0, Max:1}", Float) = 0 + _PrimaryRoughness ("'Roughness' {Min:0, Max:1}", Float) = 1 + _PrimaryOcclusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _PrimaryBumpScale ("'Normal Strength' {}", Float) = 1 + + // Secondary Textures + [Toggle(_SECONDARY_TRIPLANAR_ON)] + _SecondaryTextures ("'Secondary Textures' {Feature:{Color:1, Hide:{_SecondaryPhysicalProperties}}}", Float) = 0 + _SecondaryColor ("'Tint' {}", Color) = (1,1,1,1) + _SecondaryMainTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _SecondaryMainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _SecondaryMaterialMap ("'Metal(R) AO(G) Spec(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_SecondaryMainTex}", 2D) = "white" {} + _SecondaryBumpMap ("'Normals' {Visualize:{NRM}, Parent:_SecondaryMainTex}", 2D) = "bump" {} + _SecondaryColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Secondary Properties + _SecondaryPhysicalProperties ("'Secondary Properties' {Section:{Color:1}}", Float) = 0 + _SecondaryMetallic ("'Metallic' {Min:0, Max:1}", Float) = 1 + _SecondarySpecularity ("'Specularity' {Min:0, Max:1}", Float) = 1 + _SecondarySpecularTint ("'Specular Tint' {Min:0, Max:1}", Float) = 0 + _SecondaryRoughness ("'Roughness' {Min:0, Max:1}", Float) = 1 + _SecondaryOcclusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _SecondaryBumpScale ("'Normal Strength' {}", Float) = 1 + + // Tertiary Textures + [Toggle(_TERTIARY_TRIPLANAR_ON)] + _TertiaryTextures ("'Tertiary Textures' {Feature:{Color:2, Hide:{_TertiaryPhysicalProperties}}}", Float) = 0 + _TertiaryColor ("'Tint' {}", Color) = (1,1,1,1) + _TertiaryMainTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _TertiaryMainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _TertiaryMaterialMap ("'Metal(R) AO(G) Spec(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_TertiaryMainTex}", 2D) = "white" {} + _TertiaryBumpMap ("'Normals' {Visualize:{NRM}, Parent:_TertiaryMainTex}", 2D) = "bump" {} + _TertiaryColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Tertiary Properties + _TertiaryPhysicalProperties ("'Tertiary Properties' {Section:{Color:2}}", Float) = 0 + _TertiaryMetallic ("'Metallic' {Min:0, Max:1}", Float) = 1 + _TertiarySpecularity ("'Specularity' {Min:0, Max:1}", Float) = 1 + _TertiarySpecularTint ("'Specular Tint' {Min:0, Max:1}", Float) = 0 + _TertiaryRoughness ("'Roughness' {Min:0, Max:1}", Float) = 1 + _TertiaryOcclusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _TertiaryBumpScale ("'Normal Strength' {}", Float) = 1 + + // Quaternary Textures + [Toggle(_QUATERNARY_TRIPLANAR_ON)] + _QuaternaryTextures ("'Quaternary Textures' {Feature:{Color:3, Hide:{_QuaternaryPhysicalProperties}}}", Float) = 0 + _QuaternaryColor ("'Tint' {}", Color) = (1,1,1,1) + _QuaternaryMainTex ("'Base Color(RGB) Rough(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _QuaternaryMainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _QuaternaryMaterialMap ("'Metal(R) AO(G) Spec(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_QuaternaryMainTex}", 2D) = "white" {} + _QuaternaryBumpMap ("'Normals' {Visualize:{NRM}, Parent:_QuaternaryMainTex}", 2D) = "bump" {} + _QuaternaryColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Quaternary Properties + _QuaternaryPhysicalProperties ("'Quaternary Properties' {Section:{Color:3}}", Float) = 0 + _QuaternaryMetallic ("'Metallic' {Min:0, Max:1}", Float) = 0 + _QuaternarySpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _QuaternarySpecularTint ("'Specular Tint' {Min:0, Max:1}", Float) = 0 + _QuaternaryRoughness ("'Roughness' {Min:0, Max:1}", Float) = 1 + _QuaternaryOcclusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _QuaternaryBumpScale ("'Normal Strength' {}", Float) = 1 + + // Triplanar + _TriplanarProperties ("'Triplanar' {Section:{Color:4}}", Float) = 0 + [Toggle(_TRIPLANARMODE_WORLD)] + _TriplanarMode ("'Mode' {Dropdown:{Object:{}, World:{}}}", Float) = 1 + _TriplanarBlendSharpness ("'Sharpness' {Min:1, Max:50}", Float) = 2 + + // Tessellation + _TessellationProperties ("'Tessellation' {Section:{Color:5}}", Float) = 0 + _Phong ("'Phong Strength' {Min:0, Max:1}", Float) = 0.5 + _EdgeLength ("'Edge Length' {Min:2, Max:50}", Float) = 15 + + // Rim Emission + [Toggle(_RIM_ON)] + _Rim ("'Rim Emission' {Feature:{Color:11}}", Float) = 0 + [HDR] + _RimColor ("'Tint' {}", Color) = (1,1,1) + [Gamma] + _RimWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + [Gamma] + _RimBias ("'Fill' {Min:0, Max:1}", Float) = 0 + _RimPower ("'Falloff' {Min:0.01}", Float) = 4 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _Lightmapping ("'GI' {LightmapEmissionProperty:{}}", Float) = 1 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} + +CGINCLUDE + #define A_TESSELLATION_SHADER + #define _TESSELLATIONMODE_PHONG +ENDCG + +SubShader { + Tags { + "Queue" = "Geometry" + "RenderType" = "Opaque" + //"DisableBatching" = "LODFading" + } + LOD 400 + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + Blend [_SrcBlend] [_DstBlend] + ZWrite [_ZWrite] + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _TRIPLANARMODE_WORLD + #pragma shader_feature _SECONDARY_TRIPLANAR_ON + #pragma shader_feature _TERTIARY_TRIPLANAR_ON + #pragma shader_feature _QUATERNARY_TRIPLANAR_ON + #pragma shader_feature _RIM_ON + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Shaders/Definition/TriPlanar.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend [_SrcBlend] One + ZWrite Off + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _TRIPLANARMODE_WORLD + #pragma shader_feature _SECONDARY_TRIPLANAR_ON + #pragma shader_feature _TERTIARY_TRIPLANAR_ON + #pragma shader_feature _QUATERNARY_TRIPLANAR_ON + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + + #include "Assets/Alloy/Shaders/Definition/TriPlanar.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature _TRIPLANARMODE_WORLD + #pragma shader_feature _SECONDARY_TRIPLANAR_ON + #pragma shader_feature _TERTIARY_TRIPLANAR_ON + #pragma shader_feature _QUATERNARY_TRIPLANAR_ON + + #pragma multi_compile_shadowcaster + #pragma multi_compile_instancing + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_SHADOWCASTER + + #include "Assets/Alloy/Shaders/Definition/TriPlanar.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } + + Pass { + Name "DEFERRED" + Tags { "LightMode" = "Deferred" } + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _TRIPLANARMODE_WORLD + #pragma shader_feature _SECONDARY_TRIPLANAR_ON + #pragma shader_feature _TERTIARY_TRIPLANAR_ON + #pragma shader_feature _QUATERNARY_TRIPLANAR_ON + #pragma shader_feature _RIM_ON + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_prepassfinal + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + #pragma multi_compile_instancing + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_DEFERRED + + #include "Assets/Alloy/Shaders/Definition/TriPlanar.cginc" + #include "Assets/Alloy/Shaders/Forward/Gbuffer.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _TRIPLANARMODE_WORLD + #pragma shader_feature _SECONDARY_TRIPLANAR_ON + #pragma shader_feature _TERTIARY_TRIPLANAR_ON + #pragma shader_feature _QUATERNARY_TRIPLANAR_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Shaders/Definition/TriPlanar.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +FallBack "Alloy/TriPlanar/Full" +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Shaders/4.6/Specialist/Tessellation TriPlanar.shader.meta b/Assets/Alloy/Shaders/4.6/Specialist/Tessellation TriPlanar.shader.meta new file mode 100644 index 0000000..5398557 --- /dev/null +++ b/Assets/Alloy/Shaders/4.6/Specialist/Tessellation TriPlanar.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: b01e484ee428884418a270ecac06b244 +timeCreated: 1432474145 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/4.6/Specialist/Tessellation Vertex Blend.shader b/Assets/Alloy/Shaders/4.6/Specialist/Tessellation Vertex Blend.shader new file mode 100644 index 0000000..cec1627 --- /dev/null +++ b/Assets/Alloy/Shaders/4.6/Specialist/Tessellation Vertex Blend.shader @@ -0,0 +1,378 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Tessellation/Vertex Blend" { +Properties { + // Global Settings + _Mode ("'Rendering Mode' {RenderingMode:{Opaque:{_Cutoff}, Cutout:{}, Fade:{_Cutoff}, Transparent:{_Cutoff}}}", Float) = 0 + _SrcBlend ("__src", Float) = 0 + _DstBlend ("__dst", Float) = 0 + _ZWrite ("__zw", Float) = 1 + [LM_TransparencyCutOff] + _Cutoff ("'Opacity Cutoff' {Min:0, Max:1}", Float) = 0.5 + [Toggle(EFFECT_BUMP)] + _HasBumpMap ("'Normals Source' {Dropdown:{VertexNormals:{_Normal0,_SplatBumpScale0,_Normal1,_SplatBumpScale1,_Normal2,_SplatBumpScale2,_Normal3,_SplatBumpScale3,_DetailNormalMap,_DetailNormalMapScale,_WetNormalMap,_WetNormalMapScale}, NormalMaps:{}}}", Float) = 1 + [Toggle(_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A)] + _MainRoughnessSource ("'Roughness Source' {Dropdown:{PackedMapAlpha:{}, BaseColorAlpha:{_MaterialMap0,_SplatOcclusion0,_MaterialMap1,_SplatOcclusion1,_MaterialMap2,_SplatOcclusion2,_MaterialMap3,_SplatOcclusion3}}}", Float) = 0 + + // Red Splat + _Splat0Textures ("'Red Splat' {Section:{Color:{150,0,0}}}", Float) = 0 + _Splat0Tint ("'Tint' {}", Color) = (1,1,1,1) + _Splat0 ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _Splat0Velocity ("Scroll", Vector) = (0,0,0,0) + _Splat0UV ("UV Set", Float) = 0 + _MaterialMap0 ("'Metal(R) AO(G) Spec(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_Splat0}", 2D) = "white" {} + _Normal0 ("'Normals' {Visualize:{NRM}, Parent:_Splat0}", 2D) = "bump" {} + + // Red Splat Properties + _Splat0PhysicalProperties("'Red Splat Properties' {Section:{Color:{150,0,0}}}", Float) = 0 + _Metallic0 ("'Metallic' {Min:0, Max:1}", Float) = 0.0 + _SplatSpecularity0 ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _SplatSpecularTint0 ("'Specular Tint' {Min:0, Max:1}", Float) = 0.0 + _SplatRoughness0 ("'Roughness' {Min:0, Max:1}", Float) = 1.0 + _SplatOcclusion0 ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _SplatBumpScale0 ("'Normal Strength' {}", Float) = 1 + + // Green Splat + _Splat1Textures ("'Green Splat' {Section:{Color:{0,149,0}}}", Float) = 0 + _Splat1Tint ("'Tint' {}", Color) = (1,1,1,1) + _Splat1 ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _Splat1Velocity ("Scroll", Vector) = (0,0,0,0) + _Splat1UV ("UV Set", Float) = 0 + _MaterialMap1 ("'Metal(R) AO(G) Spec(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_Splat1}", 2D) = "white" {} + _Normal1 ("'Normals' {Visualize:{NRM}, Parent:_Splat1}", 2D) = "bump" {} + + // Green Splat Properties + _Splat1PhysicalProperties("'Green Splat Properties' {Section:{Color:{0,149,0}}}", Float) = 0 + _Metallic1 ("'Metallic' {Min:0, Max:1}", Float) = 0.0 + _SplatSpecularity1 ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _SplatSpecularTint1 ("'Specular Tint' {Min:0, Max:1}", Float) = 0.0 + _SplatRoughness1 ("'Roughness' {Min:0, Max:1}", Float) = 1.0 + _SplatOcclusion1 ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _SplatBumpScale1 ("'Normal Strength' {}", Float) = 1 + + // Blue Splat + _Splat2Textures ("'Blue Splat' {Section:{Color:{11,0,148}}}", Float) = 0 + _Splat2Tint ("'Tint' {}", Color) = (1,1,1,1) + _Splat2 ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _Splat2Velocity ("Scroll", Vector) = (0,0,0,0) + _Splat2UV ("UV Set", Float) = 0 + _MaterialMap2 ("'Metal(R) AO(G) Spec(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_Splat2}", 2D) = "white" {} + _Normal2 ("'Normals' {Visualize:{NRM}, Parent:_Splat2}", 2D) = "bump" {} + + // Blue Splat Properties + _Splat2PhysicalProperties("'Blue Splat Properties' {Section:{Color:{11,0,148}}}", Float) = 0 + _Metallic2 ("'Metallic' {Min:0, Max:1}", Float) = 0.0 + _SplatSpecularity2 ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _SplatSpecularTint2 ("'Specular Tint' {Min:0, Max:1}", Float) = 0.0 + _SplatRoughness2 ("'Roughness' {Min:0, Max:1}", Float) = 1.0 + _SplatOcclusion2 ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _SplatBumpScale2 ("'Normal Strength' {}", Float) = 1 + + // Alpha Splat + [Toggle(_SPECGLOSSMAP)] + _Splat3Textures("'Alpha Splat' {Feature:{Color:{0,0,0},Hide:{_Splat3PhysicalProperties}}}", Float) = 0 + _Splat3Tint ("'Tint' {}", Color) = (1,1,1,1) + _Splat3 ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _Splat3Velocity ("Scroll", Vector) = (0,0,0,0) + _Splat3UV ("UV Set", Float) = 0 + _MaterialMap3 ("'Metal(R) AO(G) Spec(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_Splat3}", 2D) = "white" {} + _Normal3 ("'Normals' {Visualize:{NRM}, Parent:_Splat3}", 2D) = "bump" {} + + // Alpha Splat Properties + _Splat3PhysicalProperties("'Alpha Splat Properties' {Section:{Color:{0,0,0}}}", Float) = 0 + _Metallic3 ("'Metallic' {Min:0, Max:1}", Float) = 0.0 + _SplatSpecularity3 ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _SplatSpecularTint3 ("'Specular Tint' {Min:0, Max:1}", Float) = 0.0 + _SplatRoughness3 ("'Roughness' {Min:0, Max:1}", Float) = 1.0 + _SplatOcclusion3 ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _SplatBumpScale3 ("'Normal Strength' {}", Float) = 1 + + // Triplanar + [Toggle(_METALLICGLOSSMAP)] + _TriplanarProperties ("'Triplanar' {Feature:{Color:4}}", Float) = 0 + [Toggle(_TRIPLANARMODE_WORLD)] + _TriplanarMode ("'Mode' {Dropdown:{Object:{}, World:{}}}", Float) = 1 + _TriplanarBlendSharpness ("'Sharpness' {Min:1, Max:50}", Float) = 2 + + // AO2 + [Toggle(_AO2_ON)] + _AO2 ("'AO2' {Feature:{Color:6}}", Float) = 0 + _Ao2Map ("'AO2(G)' {Visualize:{RGB}}", 2D) = "white" {} + _Ao2MapUV ("UV Set", Float) = 1 + _Ao2Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + + // Tessellation + _TessellationProperties ("'Tessellation' {Section:{Color:5}}", Float) = 0 + [KeywordEnum(Displacement, Phong)] + _TessellationMode ("'Mode' {Dropdown:{Displacement:{_Phong}, Phong:{_DispTex, _Displacement}}}", Float) = 0 + _DispTex ("'Heightmap(G)' {Visualize:{RGB}}", 2D) = "black" {} + _DispTexVelocity ("Scroll", Vector) = (0,0,0,0) + _Displacement ("'Displacement' {Min:0, Max:30}", Float) = 0.3 + _Phong ("'Phong Strength' {Min:0, Max:1}", Float) = 0.5 + _EdgeLength ("'Edge Length' {Min:2, Max:50}", Float) = 15 + + // Detail + [Toggle(_DETAIL_MULX2)] + _DetailT ("'Detail' {Feature:{Color:7}}", Float) = 0 + [Toggle(_NORMALMAP)] + _DetailMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_DetailMask}}}", Float) = 0 + _DetailMask ("'Mask(A)' {Visualize:{A}, Parent:_MainTex}", 2D) = "white" {} + _DetailMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + [Enum(Mul, 0, MulX2, 1)] + _DetailMode ("'Color Mode' {Dropdown:{Mul:{}, MulX2:{}}}", Float) = 0 + _DetailAlbedoMap ("'Color(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _DetailAlbedoMapVelocity ("Scroll", Vector) = (0,0,0,0) + _DetailAlbedoMapUV ("UV Set", Float) = 0 + _DetailNormalMap ("'Normals' {Visualize:{NRM}, Parent:_DetailAlbedoMap}", 2D) = "bump" {} + _DetailWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DetailNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Decal + [Toggle(_DECAL_ON)] + _Decal ("'Decal' {Feature:{Color:9}}", Float) = 0 + _DecalColor ("'Tint' {}", Color) = (1,1,1,1) + _DecalTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "black" {} + _DecalTexUV ("UV Set", Float) = 0 + _DecalWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DecalSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _DecalAlphaVertexTint ("'Vertex Alpha Tint' {Min:0, Max:1}", Float) = 0 + + // Wetness + [Toggle(_WETNESS_ON)] + _WetnessProperties ("'Wetness' {Feature:{Color:13}}", Float) = 0 + [Toggle(_WETMASKSOURCE_VERTEXCOLORALPHA)] + _WetMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_WetMask}}}", Float) = 0 + _WetMask ("'Mask(A)' {Visualize:{A}}", 2D) = "white" {} + _WetMaskVelocity ("Scroll", Vector) = (0,0,0,0) + _WetMaskUV ("UV Set", Float) = 0 + _WetMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + _WetTint ("'Tint' {}", Color) = (1,1,1,1) + _WetNormalMap ("'Normals' {Visualize:{NRM}}", 2D) = "bump" {} + _WetNormalMapVelocity ("Scroll", Vector) = (0,0,0,0) + _WetNormalMapUV ("UV Set", Float) = 0 + _WetWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _WetRoughness ("'Roughness' {Min:0, Max:1}", Float) = 0.2 + _WetNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _Lightmapping ("'GI' {LightmapEmissionProperty:{}}", Float) = 1 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} + +CGINCLUDE + #define A_TESSELLATION_SHADER +ENDCG + +SubShader { + Tags { + "RenderType" = "Opaque" + "PerformanceChecks" = "False" + //"DisableBatching" = "LODFading" + } + LOD 300 + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + Blend [_SrcBlend] [_DstBlend] + ZWrite [_ZWrite] + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _SPECGLOSSMAP + #pragma shader_feature _METALLICGLOSSMAP + #pragma shader_feature _TRIPLANARMODE_WORLD + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _DECAL_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Shaders/Definition/VertexBlend.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend [_SrcBlend] One + ZWrite Off + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _SPECGLOSSMAP + #pragma shader_feature _METALLICGLOSSMAP + #pragma shader_feature _TRIPLANARMODE_WORLD + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _DECAL_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + + #include "Assets/Alloy/Shaders/Definition/VertexBlend.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature _SPECGLOSSMAP + #pragma shader_feature _METALLICGLOSSMAP + #pragma shader_feature _TRIPLANARMODE_WORLD + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + + #pragma multi_compile_shadowcaster + #pragma multi_compile_instancing + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_SHADOWCASTER + + #include "Assets/Alloy/Shaders/Definition/VertexBlend.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } + + Pass { + Name "DEFERRED" + Tags { "LightMode" = "Deferred" } + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _SPECGLOSSMAP + #pragma shader_feature _METALLICGLOSSMAP + #pragma shader_feature _TRIPLANARMODE_WORLD + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _DECAL_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_prepassfinal + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + #pragma multi_compile_instancing + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_DEFERRED + + #include "Assets/Alloy/Shaders/Definition/VertexBlend.cginc" + #include "Assets/Alloy/Shaders/Forward/Gbuffer.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _SPECGLOSSMAP + #pragma shader_feature _METALLICGLOSSMAP + #pragma shader_feature _TRIPLANARMODE_WORLD + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _DECAL_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Shaders/Definition/VertexBlend.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +Fallback "Alloy/Vertex Blend" +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Shaders/4.6/Specialist/Tessellation Vertex Blend.shader.meta b/Assets/Alloy/Shaders/4.6/Specialist/Tessellation Vertex Blend.shader.meta new file mode 100644 index 0000000..3bbb00d --- /dev/null +++ b/Assets/Alloy/Shaders/4.6/Specialist/Tessellation Vertex Blend.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 0b60181fe143d9045bc52658eae9e7d6 +timeCreated: 1472697252 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/4.6/Specialist/Tessellation Weighted Blend.shader b/Assets/Alloy/Shaders/4.6/Specialist/Tessellation Weighted Blend.shader new file mode 100644 index 0000000..7ddd29e --- /dev/null +++ b/Assets/Alloy/Shaders/4.6/Specialist/Tessellation Weighted Blend.shader @@ -0,0 +1,416 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Tessellation/Weighted Blend" { +Properties { + // Global Settings + _Mode ("'Rendering Mode' {RenderingMode:{Opaque:{_Cutoff}, Cutout:{}, Fade:{_Cutoff}, Transparent:{_Cutoff}}}", Float) = 0 + _SrcBlend ("__src", Float) = 0 + _DstBlend ("__dst", Float) = 0 + _ZWrite ("__zw", Float) = 1 + [LM_TransparencyCutOff] + _Cutoff ("'Opacity Cutoff' {Min:0, Max:1}", Float) = 0.5 + [Toggle(EFFECT_BUMP)] + _HasBumpMap ("'Normals Source' {Dropdown:{VertexNormals:{_BumpMap,_BumpScale,_DetailNormalMap,_DetailNormalMapScale,_WetNormalMap,_WetNormalMapScale,_BumpMap2,_BumpScale2}, NormalMaps:{}}}", Float) = 1 + [Toggle(_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A)] + _MainRoughnessSource ("'Roughness Source' {Dropdown:{PackedMapAlpha:{}, BaseColorAlpha:{_SpecTex,_Occlusion,_MaterialMap2,_Occlusion2}}}", Float) = 0 + + // Main Textures + _MainTextures ("'Main Textures' {Section:{Color:0}}", Float) = 0 + [LM_Albedo] [LM_Transparency] + _Color ("'Tint' {}", Color) = (1,1,1,1) + [LM_MasterTilingOffset] [LM_Albedo] + _MainTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _MainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _MainTexUV ("UV Set", Float) = 0 + [LM_Metallic] + _SpecTex ("'Metal(R) AO(G) Spec(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_MainTex}", 2D) = "white" {} + [LM_NormalMap] + _BumpMap ("'Normals' {Visualize:{NRM}, Parent:_MainTex}", 2D) = "bump" {} + _BaseColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Main Properties + _MainPhysicalProperties ("'Main Properties' {Section:{Color:1}}", Float) = 0 + [LM_Metallic] + _Metal ("'Metallic' {Min:0, Max:1}", Float) = 1 + _Specularity ("'Specularity' {Min:0, Max:1}", Float) = 1 + _SpecularTint ("'Specular Tint' {Min:0, Max:1}", Float) = 0 + _Roughness ("'Roughness' {Min:0, Max:1}", Float) = 1 + _Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _BumpScale ("'Normal Strength' {}", Float) = 1 + + // Tessellation + _TessellationProperties ("'Tessellation' {Section:{Color:5}}", Float) = 0 + [KeywordEnum(Displacement, Phong)] + _TessellationMode ("'Mode' {Dropdown:{Displacement:{_Phong}, Phong:{_DispTex, _Displacement}}}", Float) = 0 + _DispTex ("'Heightmap(G)' {Visualize:{RGB}}", 2D) = "black" {} + _DispTexVelocity ("Scroll", Vector) = (0,0,0,0) + _Displacement ("'Displacement' {Min:0, Max:30}", Float) = 0.3 + _Phong ("'Phong Strength' {Min:0, Max:1}", Float) = 0.5 + _EdgeLength ("'Edge Length' {Min:2, Max:50}", Float) = 15 + + // AO2 + [Toggle(_AO2_ON)] + _AO2 ("'AO2' {Feature:{Color:6}}", Float) = 0 + _Ao2Map ("'AO2(G)' {Visualize:{RGB}}", 2D) = "white" {} + _Ao2MapUV ("UV Set", Float) = 1 + _Ao2Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + + // Detail + [Toggle(_DETAIL_MULX2)] + _DetailT ("'Detail' {Feature:{Color:7}}", Float) = 0 + [Toggle(_NORMALMAP)] + _DetailMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_DetailMask}}}", Float) = 0 + _DetailMask ("'Mask(A)' {Visualize:{A}, Parent:_MainTex}", 2D) = "white" {} + _DetailMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + [Enum(Mul, 0, MulX2, 1)] + _DetailMode ("'Color Mode' {Dropdown:{Mul:{}, MulX2:{}}}", Float) = 0 + _DetailAlbedoMap ("'Color(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _DetailAlbedoMapVelocity ("Scroll", Vector) = (0,0,0,0) + _DetailAlbedoMapUV ("UV Set", Float) = 0 + _DetailNormalMap ("'Normals' {Visualize:{NRM}, Parent:_DetailAlbedoMap}", 2D) = "bump" {} + _DetailWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DetailNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Team Color + [Toggle(_TEAMCOLOR_ON)] + _TeamColor ("'Team Color' {Feature:{Color:8}}", Float) = 0 + [Enum(Masks, 0, Tint, 1)] + _TeamColorMasksAsTint ("'Texture Mode' {Dropdown:{Masks:{}, Tint:{_TeamColorMasks, _TeamColor0, _TeamColor1, _TeamColor2, _TeamColor3}}}", Float) = 0 + _TeamColorMaskMap ("'Masks(RGBA)' {Visualize:{R, G, B, A, RGB}, Parent:_MainTex}", 2D) = "black" {} + _TeamColorMasks ("'Channels' {Vector:Channels}", Vector) = (1,1,1,0) + _TeamColor0 ("'Tint R' {}", Color) = (1,0,0) + _TeamColor1 ("'Tint G' {}", Color) = (0,1,0) + _TeamColor2 ("'Tint B' {}", Color) = (0,0,1) + _TeamColor3 ("'Tint A' {}", Color) = (0.5,0.5,0.5) + + // Decal + [Toggle(_DECAL_ON)] + _Decal ("'Decal' {Feature:{Color:9}}", Float) = 0 + _DecalColor ("'Tint' {}", Color) = (1,1,1,1) + _DecalTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "black" {} + _DecalTexUV ("UV Set", Float) = 0 + _DecalWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DecalSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _DecalAlphaVertexTint ("'Vertex Alpha Tint' {Min:0, Max:1}", Float) = 0 + + // Emission + [Toggle(_EMISSION)] + _Emission ("'Emission' {Feature:{Color:10}}", Float) = 0 + [LM_Emission] + [HDR] + _EmissionColor ("'Tint' {}", Color) = (1,1,1) + [LM_Emission] + _EmissionMap ("'Mask(RGB)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "white" {} + _IncandescenceMap ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _IncandescenceMapVelocity ("Scroll", Vector) = (0,0,0,0) + _IncandescenceMapUV ("UV Set", Float) = 0 + [Gamma] + _EmissionWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + + // Rim Emission + [Toggle(_RIM_ON)] + _Rim ("'Rim Emission' {Feature:{Color:11}}", Float) = 0 + [HDR] + _RimColor ("'Tint' {}", Color) = (1,1,1) + _RimTex ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _RimTexVelocity ("Scroll", Vector) = (0,0,0,0) + _RimTexUV ("UV Set", Float) = 0 + [Gamma] + _RimWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + [Gamma] + _RimBias ("'Fill' {Min:0, Max:1}", Float) = 0 + _RimPower ("'Falloff' {Min:0.01}", Float) = 4 + + // Dissolve + [Toggle(_DISSOLVE_ON)] + _Dissolve ("'Dissolve' {Feature:{Color:12}}", Float) = 0 + [HDR] + _DissolveGlowColor ("'Glow Tint' {}", Color) = (1,1,1,1) + _DissolveTex ("'Glow Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _DissolveTexUV ("UV Set", Float) = 0 + _DissolveCutoff ("'Cutoff' {Min:0, Max:1}", Float) = 0 + [Gamma] + _DissolveGlowWeight ("'Glow Weight' {Min:0, Max:1}", Float) = 1 + _DissolveEdgeWidth ("'Glow Width' {Min:0, Max:1}", Float) = 0.01 + + // Wetness + [Toggle(_WETNESS_ON)] + _WetnessProperties ("'Wetness' {Feature:{Color:13}}", Float) = 0 + [Toggle(_WETMASKSOURCE_VERTEXCOLORALPHA)] + _WetMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_WetMask}}}", Float) = 0 + _WetMask ("'Mask(A)' {Visualize:{A}}", 2D) = "white" {} + _WetMaskVelocity ("Scroll", Vector) = (0,0,0,0) + _WetMaskUV ("UV Set", Float) = 0 + _WetMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + _WetTint ("'Tint' {}", Color) = (1,1,1,1) + _WetNormalMap ("'Normals' {Visualize:{NRM}}", 2D) = "bump" {} + _WetNormalMapVelocity ("Scroll", Vector) = (0,0,0,0) + _WetNormalMapUV ("UV Set", Float) = 0 + _WetWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _WetRoughness ("'Roughness' {Min:0, Max:1}", Float) = 0.2 + _WetNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Weighted Blend + _WeightedBlendProperties ("'Weighted Blend' {Section:{Color:14}}", Float) = 0 + _BlendMap ("'Heightmap(G)' {Visualize:{RGB}}", 2D) = "white" {} + _BlendMapUV ("UV Set", Float) = 0 + _BlendScale ("'Weight' {Min:0, Max:1}", Float) = 1.0 + _BlendCutoff ("'Cutoff' {Min:0, Max:1}", Float) = 0.25 + _Blend ("'Blend' {Min:0.0001, Max:1}", Float) = 0.1 + _BlendAlphaVertexTint ("'Vertex Alpha Tint' {Min:0, Max:1}", Float) = 0 + + // Secondary Textures + _SecondaryTextures ("'Secondary Textures' {Section:{Color:15}}", Float) = 0 + _Color2 ("'Tint' {}", Color) = (1,1,1,1) + _MainTex2 ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _MainTex2Velocity ("Scroll", Vector) = (0,0,0,0) + _MainTex2UV ("UV Set", Float) = 0 + _MaterialMap2 ("'Metal(R) AO(G) Spec(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_MainTex2}", 2D) = "white" {} + _BumpMap2 ("'Normals' {Visualize:{NRM}, Parent:_MainTex2}", 2D) = "bump" {} + _BaseColorVertexTint2 ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Secondary Properties + _SecondaryPhysicalProperties ("'Secondary Properties' {Section:{Color:16}}", Float) = 0 + _Metallic2 ("'Metallic' {Min:0, Max:1}", Float) = 1 + _Specularity2 ("'Specularity' {Min:0, Max:1}", Float) = 1 + _SpecularTint2 ("'Specular Tint' {Min:0, Max:1}", Float) = 0 + _Roughness2 ("'Roughness' {Min:0, Max:1}", Float) = 1 + _Occlusion2 ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _BumpScale2 ("'Normal Strength' {}", Float) = 1 + + // Secondary Emission + [Toggle(_EMISSION2_ON)] + _Emission2 ("'Secondary Emission' {Feature:{Color:17}}", Float) = 0 + [HDR] + _Emission2Color ("'Tint' {}", Color) = (1,1,1) + _EmissionMap2 ("'Mask(RGB)' {Visualize:{RGB}, Parent:_MainTex2}", 2D) = "white" {} + _IncandescenceMap2 ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _IncandescenceMap2Velocity ("Scroll", Vector) = (0,0,0,0) + _IncandescenceMap2UV ("UV Set", Float) = 0 + [Gamma] + _Emission2Weight ("'Weight' {Min:0, Max:1}", Float) = 1 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _Lightmapping ("'GI' {LightmapEmissionProperty:{}}", Float) = 1 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} + +CGINCLUDE + #define A_TESSELLATION_SHADER +ENDCG + +SubShader { + Tags { + "RenderType" = "Opaque" + "PerformanceChecks" = "False" + //"DisableBatching" = "LODFading" + } + LOD 300 + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + Blend [_SrcBlend] [_DstBlend] + ZWrite [_ZWrite] + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _EMISSION2_ON + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Shaders/Definition/WeightedBlend.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend [_SrcBlend] One + ZWrite Off + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + + #include "Assets/Alloy/Shaders/Definition/WeightedBlend.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _DISSOLVE_ON + + #pragma multi_compile_shadowcaster + #pragma multi_compile_instancing + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_SHADOWCASTER + + #include "Assets/Alloy/Shaders/Definition/WeightedBlend.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } + + Pass { + Name "DEFERRED" + Tags { "LightMode" = "Deferred" } + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _EMISSION2_ON + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_prepassfinal + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + #pragma multi_compile_instancing + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_DEFERRED + + #include "Assets/Alloy/Shaders/Definition/WeightedBlend.cginc" + #include "Assets/Alloy/Shaders/Forward/Gbuffer.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _EMISSION2_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Shaders/Definition/WeightedBlend.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +FallBack "Alloy/Weighted Blend" +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Shaders/4.6/Specialist/Tessellation Weighted Blend.shader.meta b/Assets/Alloy/Shaders/4.6/Specialist/Tessellation Weighted Blend.shader.meta new file mode 100644 index 0000000..af5c975 --- /dev/null +++ b/Assets/Alloy/Shaders/4.6/Specialist/Tessellation Weighted Blend.shader.meta @@ -0,0 +1,27 @@ +fileFormatVersion: 2 +guid: 29d2d64e763eba047ab117696b558732 +ShaderImporter: + defaultTextures: + - _MainTex: {instanceID: 0} + - _SpecTex: {instanceID: 0} + - _BumpMap: {instanceID: 0} + - _DispTex: {instanceID: 0} + - _DetailMask: {instanceID: 0} + - _DetailAlbedoMap: {instanceID: 0} + - _DetailMaterialMap: {fileID: 2800000, guid: 2b77d5cb601375f4ba50c6194c126e59, + type: 3} + - _DetailNormalMap: {instanceID: 0} + - _TeamColorMaskMap: {instanceID: 0} + - _EmissionMap: {instanceID: 0} + - _IncandescenceMap: {instanceID: 0} + - _RimTex: {instanceID: 0} + - _DissolveTex: {instanceID: 0} + - _BlendMap: {instanceID: 0} + - _MainTex2: {instanceID: 0} + - _MaterialMap2: {instanceID: 0} + - _BumpMap2: {instanceID: 0} + - _EmissionMap2: {instanceID: 0} + - _IncandescenceMap2: {instanceID: 0} + - _RimTex2: {instanceID: 0} + userData: + assetBundleName: diff --git a/Assets/Alloy/Shaders/4.6/VisualEffects.meta b/Assets/Alloy/Shaders/4.6/VisualEffects.meta new file mode 100644 index 0000000..dab482a --- /dev/null +++ b/Assets/Alloy/Shaders/4.6/VisualEffects.meta @@ -0,0 +1,6 @@ +fileFormatVersion: 2 +guid: b8c39e5fb354935468c8b7d062d1b466 +folderAsset: yes +DefaultImporter: + userData: + assetBundleName: diff --git a/Assets/Alloy/Shaders/4.6/VisualEffects/Tessellation Transition.shader b/Assets/Alloy/Shaders/4.6/VisualEffects/Tessellation Transition.shader new file mode 100644 index 0000000..13cb65c --- /dev/null +++ b/Assets/Alloy/Shaders/4.6/VisualEffects/Tessellation Transition.shader @@ -0,0 +1,433 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Tessellation/Transition" { +Properties { + // Global Settings + _Mode ("'Rendering Mode' {RenderingMode:{Opaque:{_Cutoff}, Cutout:{}, Fade:{_Cutoff}, Transparent:{_Cutoff}}}", Float) = 0 + _SrcBlend ("__src", Float) = 0 + _DstBlend ("__dst", Float) = 0 + _ZWrite ("__zw", Float) = 1 + [LM_TransparencyCutOff] + _Cutoff ("'Opacity Cutoff' {Min:0, Max:1}", Float) = 0.5 + [Toggle(EFFECT_BUMP)] + _HasBumpMap ("'Normals Source' {Dropdown:{VertexNormals:{_BumpMap,_BumpScale,_DetailNormalMap,_DetailNormalMapScale,_WetNormalMap,_WetNormalMapScale,_BumpMap2,_BumpScale2}, NormalMaps:{}}}", Float) = 1 + [Toggle(_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A)] + _MainRoughnessSource ("'Roughness Source' {Dropdown:{PackedMapAlpha:{}, BaseColorAlpha:{_SpecTex,_Occlusion,_MaterialMap2,_Occlusion2}}}", Float) = 0 + + // Main Textures + _MainTextures ("'Main Textures' {Section:{Color:0}}", Float) = 0 + [LM_Albedo] [LM_Transparency] + _Color ("'Tint' {}", Color) = (1,1,1,1) + [LM_MasterTilingOffset] [LM_Albedo] + _MainTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _MainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _MainTexUV ("UV Set", Float) = 0 + [LM_Metallic] + _SpecTex ("'Metal(R) AO(G) Spec(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_MainTex}", 2D) = "white" {} + [LM_NormalMap] + _BumpMap ("'Normals' {Visualize:{NRM}, Parent:_MainTex}", 2D) = "bump" {} + _BaseColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Main Properties + _MainPhysicalProperties ("'Main Properties' {Section:{Color:1}}", Float) = 0 + [LM_Metallic] + _Metal ("'Metallic' {Min:0, Max:1}", Float) = 1 + _Specularity ("'Specularity' {Min:0, Max:1}", Float) = 1 + _SpecularTint ("'Specular Tint' {Min:0, Max:1}", Float) = 0 + _Roughness ("'Roughness' {Min:0, Max:1}", Float) = 1 + _Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _BumpScale ("'Normal Strength' {}", Float) = 1 + + // Tessellation + _TessellationProperties ("'Tessellation' {Section:{Color:5}}", Float) = 0 + [KeywordEnum(Displacement, Phong)] + _TessellationMode ("'Mode' {Dropdown:{Displacement:{_Phong}, Phong:{_DispTex, _Displacement}}}", Float) = 0 + _DispTex ("'Heightmap(G)' {Visualize:{RGB}}", 2D) = "black" {} + _DispTexVelocity ("Scroll", Vector) = (0,0,0,0) + _Displacement ("'Displacement' {Min:0, Max:30}", Float) = 0.3 + _Phong ("'Phong Strength' {Min:0, Max:1}", Float) = 0.5 + _EdgeLength ("'Edge Length' {Min:2, Max:50}", Float) = 15 + + // AO2 + [Toggle(_AO2_ON)] + _AO2 ("'AO2' {Feature:{Color:6}}", Float) = 0 + _Ao2Map ("'AO2(G)' {Visualize:{RGB}}", 2D) = "white" {} + _Ao2MapUV ("UV Set", Float) = 1 + _Ao2Occlusion ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + + // Detail + [Toggle(_DETAIL_MULX2)] + _DetailT ("'Detail' {Feature:{Color:7}}", Float) = 0 + [Toggle(_NORMALMAP)] + _DetailMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_DetailMask}}}", Float) = 0 + _DetailMask ("'Mask(A)' {Visualize:{A}, Parent:_MainTex}", 2D) = "white" {} + _DetailMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + [Enum(Mul, 0, MulX2, 1)] + _DetailMode ("'Color Mode' {Dropdown:{Mul:{}, MulX2:{}}}", Float) = 0 + _DetailAlbedoMap ("'Color(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _DetailAlbedoMapVelocity ("Scroll", Vector) = (0,0,0,0) + _DetailAlbedoMapUV ("UV Set", Float) = 0 + _DetailNormalMap ("'Normals' {Visualize:{NRM}, Parent:_DetailAlbedoMap}", 2D) = "bump" {} + _DetailWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DetailNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Team Color + [Toggle(_TEAMCOLOR_ON)] + _TeamColor ("'Team Color' {Feature:{Color:8}}", Float) = 0 + [Enum(Masks, 0, Tint, 1)] + _TeamColorMasksAsTint ("'Texture Mode' {Dropdown:{Masks:{}, Tint:{_TeamColorMasks, _TeamColor0, _TeamColor1, _TeamColor2, _TeamColor3}}}", Float) = 0 + _TeamColorMaskMap ("'Masks(RGBA)' {Visualize:{R, G, B, A, RGB}, Parent:_MainTex}", 2D) = "black" {} + _TeamColorMasks ("'Channels' {Vector:Channels}", Vector) = (1,1,1,0) + _TeamColor0 ("'Tint R' {}", Color) = (1,0,0) + _TeamColor1 ("'Tint G' {}", Color) = (0,1,0) + _TeamColor2 ("'Tint B' {}", Color) = (0,0,1) + _TeamColor3 ("'Tint A' {}", Color) = (0.5,0.5,0.5) + + // Decal + [Toggle(_DECAL_ON)] + _Decal ("'Decal' {Feature:{Color:9}}", Float) = 0 + _DecalColor ("'Tint' {}", Color) = (1,1,1,1) + _DecalTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "black" {} + _DecalTexUV ("UV Set", Float) = 0 + _DecalWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DecalSpecularity ("'Specularity' {Min:0, Max:1}", Float) = 0.5 + _DecalAlphaVertexTint ("'Vertex Alpha Tint' {Min:0, Max:1}", Float) = 0 + + // Emission + [Toggle(_EMISSION)] + _Emission ("'Emission' {Feature:{Color:10}}", Float) = 0 + [LM_Emission] + [HDR] + _EmissionColor ("'Tint' {}", Color) = (1,1,1) + [LM_Emission] + _EmissionMap ("'Mask(RGB)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "white" {} + _IncandescenceMap ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _IncandescenceMapVelocity ("Scroll", Vector) = (0,0,0,0) + _IncandescenceMapUV ("UV Set", Float) = 0 + [Gamma] + _EmissionWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + + // Rim Emission + [Toggle(_RIM_ON)] + _Rim ("'Rim Emission' {Feature:{Color:11}}", Float) = 0 + [HDR] + _RimColor ("'Tint' {}", Color) = (1,1,1) + _RimTex ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _RimTexVelocity ("Scroll", Vector) = (0,0,0,0) + _RimTexUV ("UV Set", Float) = 0 + [Gamma] + _RimWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + [Gamma] + _RimBias ("'Fill' {Min:0, Max:1}", Float) = 0 + _RimPower ("'Falloff' {Min:0.01}", Float) = 4 + + // Dissolve + [Toggle(_DISSOLVE_ON)] + _Dissolve ("'Dissolve' {Feature:{Color:12}}", Float) = 0 + [HDR] + _DissolveGlowColor ("'Glow Tint' {}", Color) = (1,1,1,1) + _DissolveTex ("'Glow Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _DissolveTexUV ("UV Set", Float) = 0 + _DissolveCutoff ("'Cutoff' {Min:0, Max:1}", Float) = 0 + [Gamma] + _DissolveGlowWeight ("'Glow Weight' {Min:0, Max:1}", Float) = 1 + _DissolveEdgeWidth ("'Glow Width' {Min:0, Max:1}", Float) = 0.01 + + // Wetness + [Toggle(_WETNESS_ON)] + _WetnessProperties ("'Wetness' {Feature:{Color:13}}", Float) = 0 + [Toggle(_WETMASKSOURCE_VERTEXCOLORALPHA)] + _WetMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_WetMask}}}", Float) = 0 + _WetMask ("'Mask(A)' {Visualize:{A}}", 2D) = "white" {} + _WetMaskVelocity ("Scroll", Vector) = (0,0,0,0) + _WetMaskUV ("UV Set", Float) = 0 + _WetMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + _WetTint ("'Tint' {}", Color) = (1,1,1,1) + _WetNormalMap ("'Normals' {Visualize:{NRM}}", 2D) = "bump" {} + _WetNormalMapVelocity ("Scroll", Vector) = (0,0,0,0) + _WetNormalMapUV ("UV Set", Float) = 0 + _WetWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _WetRoughness ("'Roughness' {Min:0, Max:1}", Float) = 0.2 + _WetNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Transition + _TransitionProperties ("'Transition' {Section:{Color:14}}", Float) = 0 + [HDR] + _TransitionGlowColor ("'Glow Tint' {}", Color) = (1,1,1,1) + _TransitionTex ("'Glow Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _TransitionTexUV ("UV Set", Float) = 0 + _TransitionCutoff ("'Cutoff' {Min:0, Max:1}", Float) = 0 + [Gamma] + _TransitionGlowWeight ("'Glow Weight' {Min:0, Max:1}", Float) = 1 + _TransitionEdgeWidth ("'Glow Width' {Min:0, Max:1}", Float) = 0.01 + + // Secondary Textures + _SecondaryTextures ("'Secondary Textures' {Section:{Color:15}}", Float) = 0 + _Color2 ("'Tint' {}", Color) = (1,1,1,1) + _MainTex2 ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _MainTex2Velocity ("Scroll", Vector) = (0,0,0,0) + _MainTex2UV ("UV Set", Float) = 0 + _MaterialMap2 ("'Metal(R) AO(G) Spec(B) Rough(A)' {Visualize:{R, G, B, A}, Parent:_MainTex2}", 2D) = "white" {} + _BumpMap2 ("'Normals' {Visualize:{NRM}, Parent:_MainTex2}", 2D) = "bump" {} + _BaseColorVertexTint2 ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Secondary Properties + _SecondaryPhysicalProperties ("'Secondary Properties' {Section:{Color:16}}", Float) = 0 + _Metallic2 ("'Metallic' {Min:0, Max:1}", Float) = 1 + _Specularity2 ("'Specularity' {Min:0, Max:1}", Float) = 1 + _SpecularTint2 ("'Specular Tint' {Min:0, Max:1}", Float) = 0 + _Roughness2 ("'Roughness' {Min:0, Max:1}", Float) = 1 + _Occlusion2 ("'Occlusion Strength' {Min:0, Max:1}", Float) = 1 + _BumpScale2 ("'Normal Strength' {}", Float) = 1 + + // Secondary Emission + [Toggle(_EMISSION2_ON)] + _Emission2 ("'Secondary Emission' {Feature:{Color:17}}", Float) = 0 + [HDR] + _Emission2Color ("'Tint' {}", Color) = (1,1,1) + _EmissionMap2 ("'Mask(RGB)' {Visualize:{RGB}, Parent:_MainTex2}", 2D) = "white" {} + _IncandescenceMap2 ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _IncandescenceMap2Velocity ("Scroll", Vector) = (0,0,0,0) + _IncandescenceMap2UV ("UV Set", Float) = 0 + [Gamma] + _Emission2Weight ("'Weight' {Min:0, Max:1}", Float) = 1 + + // Secondary Rim Emission + [Toggle(_RIM2_ON)] + _Rim2 ("'Secondary Rim Emission' {Feature:{Color:18}}", Float) = 0 + [HDR] + _Rim2Color ("'Tint' {}", Color) = (1,1,1) + _RimTex2 ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _RimTex2Velocity ("Scroll", Vector) = (0,0,0,0) + _RimTex2UV ("UV Set", Float) = 0 + [Gamma] + _Rim2Weight ("'Weight' {Min:0, Max:1}", Float) = 1 + [Gamma] + _Rim2Bias ("'Fill' {Min:0, Max:1}", Float) = 0 + _Rim2Power ("'Falloff' {Min:0}", Float) = 4 + + // Forward Rendering Options + _ForwardRenderingOptions ("'Forward Rendering Options' {Section:{Color:19}}", Float) = 0 + [ToggleOff] + _SpecularHighlights ("'Specular Highlights' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + [ToggleOff] + _GlossyReflections ("'Glossy Reflections' {Toggle:{On:{}, Off:{}}}", Float) = 1.0 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _Lightmapping ("'GI' {LightmapEmissionProperty:{}}", Float) = 1 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} + +CGINCLUDE + #define A_TESSELLATION_SHADER +ENDCG + +SubShader { + Tags { + "RenderType" = "Opaque" + "PerformanceChecks" = "False" + //"DisableBatching" = "LODFading" + } + LOD 300 + + Pass { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + Blend [_SrcBlend] [_DstBlend] + ZWrite [_ZWrite] + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _EMISSION2_ON + #pragma shader_feature _RIM2_ON + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Shaders/Definition/Transition.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + + Blend [_SrcBlend] One + ZWrite Off + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + //#pragma multi_compile __ VTRANSPARENCY_ON + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDADD + + #include "Assets/Alloy/Shaders/Definition/Transition.cginc" + #include "Assets/Alloy/Shaders/Forward/Add.cginc" + + ENDCG + } + + Pass { + Name "SHADOWCASTER" + Tags { "LightMode" = "ShadowCaster" } + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _DISSOLVE_ON + + #pragma multi_compile_shadowcaster + #pragma multi_compile_instancing + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_SHADOWCASTER + + #include "Assets/Alloy/Shaders/Definition/Transition.cginc" + #include "Assets/Alloy/Shaders/Forward/Shadow.cginc" + + ENDCG + } + + Pass { + Name "DEFERRED" + Tags { "LightMode" = "Deferred" } + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _AO2_ON + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + #pragma shader_feature _WETNESS_ON + #pragma shader_feature _WETMASKSOURCE_VERTEXCOLORALPHA + #pragma shader_feature _EMISSION2_ON + #pragma shader_feature _RIM2_ON + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_prepassfinal + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + #pragma multi_compile_instancing + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_DEFERRED + + #include "Assets/Alloy/Shaders/Definition/Transition.cginc" + #include "Assets/Alloy/Shaders/Forward/Gbuffer.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _EMISSION2_ON + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Shaders/Definition/Transition.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +FallBack "Alloy/Transition" +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Shaders/4.6/VisualEffects/Tessellation Transition.shader.meta b/Assets/Alloy/Shaders/4.6/VisualEffects/Tessellation Transition.shader.meta new file mode 100644 index 0000000..109571d --- /dev/null +++ b/Assets/Alloy/Shaders/4.6/VisualEffects/Tessellation Transition.shader.meta @@ -0,0 +1,28 @@ +fileFormatVersion: 2 +guid: f6325f2cf0c62c94ca34f7d4dd7107ee +ShaderImporter: + defaultTextures: + - _MainTex: {instanceID: 0} + - _SpecTex: {instanceID: 0} + - _BumpMap: {instanceID: 0} + - _ParallaxMap: {instanceID: 0} + - _DetailMask: {instanceID: 0} + - _DetailAlbedoMap: {instanceID: 0} + - _DetailMaterialMap: {fileID: 2800000, guid: 2b77d5cb601375f4ba50c6194c126e59, + type: 3} + - _DetailNormalMap: {instanceID: 0} + - _TeamColorMaskMap: {instanceID: 0} + - _DecalTex: {instanceID: 0} + - _EmissionMap: {instanceID: 0} + - _IncandescenceMap: {instanceID: 0} + - _RimTex: {instanceID: 0} + - _DissolveTex: {instanceID: 0} + - _TransitionTex: {instanceID: 0} + - _MainTex2: {instanceID: 0} + - _MaterialMap2: {instanceID: 0} + - _BumpMap2: {instanceID: 0} + - _EmissionMap2: {instanceID: 0} + - _IncandescenceMap2: {instanceID: 0} + - _RimTex2: {instanceID: 0} + userData: + assetBundleName: diff --git a/Assets/Alloy/Shaders/4.6/VisualEffects/Tessellation Unlit.shader b/Assets/Alloy/Shaders/4.6/VisualEffects/Tessellation Unlit.shader new file mode 100644 index 0000000..fc73262 --- /dev/null +++ b/Assets/Alloy/Shaders/4.6/VisualEffects/Tessellation Unlit.shader @@ -0,0 +1,246 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +Shader "Alloy/Tessellation/Unlit" { +Properties { + // Global Settings + _Mode ("'Rendering Mode' {RenderingMode:{Opaque:{_Cutoff}, Cutout:{}, Fade:{_Cutoff}, Transparent:{_Cutoff}}}", Float) = 0 + _SrcBlend ("__src", Float) = 0 + _DstBlend ("__dst", Float) = 0 + _ZWrite ("__zw", Float) = 1 + [LM_TransparencyCutOff] + _Cutoff ("'Opacity Cutoff' {Min:0, Max:1}", Float) = 0.5 + [Toggle(EFFECT_BUMP)] + _HasBumpMap ("'Normals Source' {Dropdown:{VertexNormals:{_BumpMap,_BumpScale,_DetailNormalMap,_DetailNormalMapScale,_WetNormalMap,_WetNormalMapScale}, NormalMaps:{}}}", Float) = 1 + [MaterialEnum(Off,0,Front,1,Back,2)] + _Cull ("'Cull Mode' {Dropdown:{Off:{}, Front:{}, Back:{}}}", Int) = 2 + + // Main Textures + _MainTextures ("'Main Textures' {Section:{Color:0}}", Float) = 0 + [HDR][LM_Albedo] [LM_Transparency] + _Color ("'Tint' {}", Color) = (1,1,1,1) + [LM_MasterTilingOffset] [LM_Albedo] + _MainTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _MainTexVelocity ("Scroll", Vector) = (0,0,0,0) + _MainTexUV ("UV Set", Float) = 0 + [LM_NormalMap] + _BumpMap ("'Normals' {Visualize:{NRM}, Parent:_MainTex}", 2D) = "bump" {} + _BaseColorVertexTint ("'Vertex Color Tint' {Min:0, Max:1}", Float) = 0 + + // Main Properties + _MainPhysicalProperties ("'Main Properties' {Section:{Color:1}}", Float) = 0 + _BumpScale ("'Normal Strength' {}", Float) = 1 + + // Tessellation + _TessellationProperties ("'Tessellation' {Section:{Color:5}}", Float) = 0 + [KeywordEnum(Displacement, Phong)] + _TessellationMode ("'Mode' {Dropdown:{Displacement:{_Phong}, Phong:{_DispTex, _Displacement}}}", Float) = 0 + _DispTex ("'Heightmap(G)' {Visualize:{RGB}}", 2D) = "black" {} + _DispTexVelocity ("Scroll", Vector) = (0,0,0,0) + _Displacement ("'Displacement' {Min:0, Max:30}", Float) = 0.3 + _Phong ("'Phong Strength' {Min:0, Max:1}", Float) = 0.5 + _EdgeLength ("'Edge Length' {Min:2, Max:50}", Float) = 15 + + // Detail + [Toggle(_DETAIL_MULX2)] + _DetailT ("'Detail' {Feature:{Color:7}}", Float) = 0 + [Toggle(_NORMALMAP)] + _DetailMaskSource ("'Mask Source' {Dropdown:{TextureAlpha:{}, VertexColorAlpha:{_DetailMask}}}", Float) = 0 + _DetailMask ("'Mask(A)' {Visualize:{A}, Parent:_MainTex}", 2D) = "white" {} + _DetailMaskStrength ("'Mask Strength' {Min:0, Max:1}", Float) = 1 + [Enum(Mul, 0, MulX2, 1)] + _DetailMode ("'Color Mode' {Dropdown:{Mul:{}, MulX2:{}}}", Float) = 0 + _DetailAlbedoMap ("'Color(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _DetailAlbedoMapVelocity ("Scroll", Vector) = (0,0,0,0) + _DetailAlbedoMapUV ("UV Set", Float) = 0 + _DetailNormalMap ("'Normals' {Visualize:{NRM}, Parent:_DetailAlbedoMap}", 2D) = "bump" {} + _DetailWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + _DetailNormalMapScale ("'Normal Strength' {}", Float) = 1 + + // Team Color + [Toggle(_TEAMCOLOR_ON)] + _TeamColor ("'Team Color' {Feature:{Color:8}}", Float) = 0 + [Enum(Masks, 0, Tint, 1)] + _TeamColorMasksAsTint ("'Texture Mode' {Dropdown:{Masks:{}, Tint:{_TeamColorMasks, _TeamColor0, _TeamColor1, _TeamColor2, _TeamColor3}}}", Float) = 0 + _TeamColorMaskMap ("'Masks(RGBA)' {Visualize:{R, G, B, A, RGB}, Parent:_MainTex}", 2D) = "black" {} + _TeamColorMasks ("'Channels' {Vector:Channels}", Vector) = (1,1,1,0) + _TeamColor0 ("'Tint R' {}", Color) = (1,0,0) + _TeamColor1 ("'Tint G' {}", Color) = (0,1,0) + _TeamColor2 ("'Tint B' {}", Color) = (0,0,1) + _TeamColor3 ("'Tint A' {}", Color) = (0.5,0.5,0.5) + + // Decal + [Toggle(_DECAL_ON)] + _Decal ("'Decal' {Feature:{Color:9}}", Float) = 0 + _DecalColor ("'Tint' {}", Color) = (1,1,1,1) + _DecalTex ("'Base Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "black" {} + _DecalTexUV ("UV Set", Float) = 0 + + // Emission + [Toggle(_EMISSION)] + _Emission ("'Emission' {Feature:{Color:10}}", Float) = 0 + [LM_Emission] + [HDR] + _EmissionColor ("'Tint' {}", Color) = (1,1,1) + [LM_Emission] + _EmissionMap ("'Mask(RGB)' {Visualize:{RGB}, Parent:_MainTex}", 2D) = "white" {} + _IncandescenceMap ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _IncandescenceMapVelocity ("Scroll", Vector) = (0,0,0,0) + _IncandescenceMapUV ("UV Set", Float) = 0 + [Gamma] + _EmissionWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + + // Rim Emission + [Toggle(_RIM_ON)] + _Rim ("'Rim Emission' {Feature:{Color:11}}", Float) = 0 + [HDR] + _RimColor ("'Tint' {}", Color) = (1,1,1) + _RimTex ("'Effect(RGB)' {Visualize:{RGB}}", 2D) = "white" {} + _RimTexVelocity ("Scroll", Vector) = (0,0,0,0) + _RimTexUV ("UV Set", Float) = 0 + [Gamma] + _RimWeight ("'Weight' {Min:0, Max:1}", Float) = 1 + [Gamma] + _RimBias ("'Fill' {Min:0, Max:1}", Float) = 0 + _RimPower ("'Falloff' {Min:0.01}", Float) = 4 + + // Dissolve + [Toggle(_DISSOLVE_ON)] + _Dissolve ("'Dissolve' {Feature:{Color:12}}", Float) = 0 + [HDR] + _DissolveGlowColor ("'Glow Tint' {}", Color) = (1,1,1,1) + _DissolveTex ("'Glow Color(RGB) Opacity(A)' {Visualize:{RGB, A}}", 2D) = "white" {} + _DissolveTexUV ("UV Set", Float) = 0 + _DissolveCutoff ("'Cutoff' {Min:0, Max:1}", Float) = 0 + [Gamma] + _DissolveGlowWeight ("'Glow Weight' {Min:0, Max:1}", Float) = 1 + _DissolveEdgeWidth ("'Glow Width' {Min:0, Max:1}", Float) = 0.01 + + // Advanced Options + _AdvancedOptions ("'Advanced Options' {Section:{Color:20}}", Float) = 0 + _Lightmapping ("'GI' {LightmapEmissionProperty:{}}", Float) = 1 + _RenderQueue ("'Render Queue' {RenderQueue:{}}", Float) = 0 + _EnableInstancing ("'Enable Instancing' {EnableInstancing:{}}", Float) = 0 +} + +CGINCLUDE + #define A_TESSELLATION_SHADER +ENDCG + +SubShader { + Tags { + "RenderType" = "Opaque" + "PerformanceChecks" = "False" + "ForceNoShadowCasting" = "True" + //"DisableBatching" = "LODFading" + } + LOD 300 + Cull [_Cull] + + Pass { + Name "BASE" + Tags { "LightMode" = "ForwardBase" } + + Blend [_SrcBlend] [_DstBlend] + ZWrite [_ZWrite] + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile_fog + #pragma multi_compile_instancing + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_FORWARDBASE + + #include "Assets/Alloy/Shaders/Definition/Unlit.cginc" + #include "Assets/Alloy/Shaders/Forward/Base.cginc" + + ENDCG + } + + Pass { + Name "DEFERRED" + Tags { "LightMode" = "Deferred" } + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature EFFECT_BUMP + #pragma shader_feature _TESSELLATIONMODE_DISPLACEMENT _TESSELLATIONMODE_PHONG + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _RIM_ON + #pragma shader_feature _DISSOLVE_ON + + //#pragma multi_compile __ LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE + #pragma multi_compile ___ UNITY_HDR_ON + #pragma multi_compile_instancing + + #pragma hull aMainHullShader + #pragma vertex aMainTessellationVertexShader + #pragma domain aMainDomainShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_DEFERRED + + #include "Assets/Alloy/Shaders/Definition/Unlit.cginc" + #include "Assets/Alloy/Shaders/Forward/Gbuffer.cginc" + + ENDCG + } + + Pass { + Name "Meta" + Tags { "LightMode" = "Meta" } + + Cull Off + + CGPROGRAM + //#pragma target 4.6 + #pragma exclude_renderers nomrt gles + + #pragma shader_feature _DETAIL_MULX2 + #pragma shader_feature _NORMALMAP + #pragma shader_feature _TEAMCOLOR_ON + #pragma shader_feature _DECAL_ON + #pragma shader_feature _EMISSION + + #pragma vertex aMainVertexShader + #pragma fragment aMainFragmentShader + + #define UNITY_PASS_META + + #include "Assets/Alloy/Shaders/Definition/Unlit.cginc" + #include "Assets/Alloy/Shaders/Forward/Meta.cginc" + + ENDCG + } +} + +FallBack "Alloy/Unlit" +CustomEditor "AlloyFieldBasedEditor" +} diff --git a/Assets/Alloy/Shaders/4.6/VisualEffects/Tessellation Unlit.shader.meta b/Assets/Alloy/Shaders/4.6/VisualEffects/Tessellation Unlit.shader.meta new file mode 100644 index 0000000..aa4e66f --- /dev/null +++ b/Assets/Alloy/Shaders/4.6/VisualEffects/Tessellation Unlit.shader.meta @@ -0,0 +1,6 @@ +fileFormatVersion: 2 +guid: dd4c5f0e88e96ab4497be0746b58bc26 +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: diff --git a/Assets/Alloy/Shaders/Config.cginc b/Assets/Alloy/Shaders/Config.cginc new file mode 100644 index 0000000..a5e29c6 --- /dev/null +++ b/Assets/Alloy/Shaders/Config.cginc @@ -0,0 +1,63 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file Config.cginc +/// @brief User configuration options. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_CONFIG_CGINC +#define ALLOY_SHADERS_CONFIG_CGINC + +/// Enables deferred shading material type branching to reduce costs. +#define A_USE_DEFERRED_MATERIAL_TYPE_BRANCHING 1 + +/// Enables clamping of all shader outputs to prevent blending and bloom errors. +#define A_USE_HDR_CLAMP 1 + +/// Max HDR intensity for lighting and emission. +#define A_HDR_CLAMP_MAX_INTENSITY 100.0 + +/// Enables capping tessellation quality via the global _MinEdgeLength property. +#define A_USE_TESSELLATION_MIN_EDGE_LENGTH 0 + +/// Enables tube area lights. Can be disabled to improve sphere light performance. +#define A_USE_TUBE_LIGHTS 1 + +/// Enables the Unity behavior for light cookies. +#define A_USE_UNITY_LIGHT_COOKIES 0 + +/// Enables the Unity behavior for attenuation. +#define A_USE_UNITY_ATTENUATION 0 + +/// Enables feature where black specularity/f0 kills specular lighting per-pixel. +#define A_USE_BLACK_SPECULAR_COLOR_TOGGLE 0 + +/// Packed map metallic channel. +#define A_METALLIC_CHANNEL r + +/// Packed map ao channel. +#define A_AO_CHANNEL g + +/// Packed map spcularity channel. +#define A_SPECULARITY_CHANNEL b + +/// Packed map roughness channel. +#define A_ROUGHNESS_CHANNEL a + + +// ----Hx Volumetric Lighting---- +//#include "Assets/Plugins/HxVolumetricLighting/BuiltIn-Replacement/HxVolumetricCore.cginc" + +// ----Vapor---- +//#include "Assets/Vapor/Shaders/VaporFramework.cginc" + +// ----VertExmotion---- +//#define A_USE_VERTEX_MOTION +//#include "Assets/VertExmotion/Shaders/VertExmotion.cginc" + +// ----Amplify Texture---- +//#include "Assets/AmplifyTexture/Shaders/Shared.cginc" + +#endif // ALLOY_SHADERS_CONFIG_CGINC diff --git a/Assets/Alloy/Shaders/Config.cginc.meta b/Assets/Alloy/Shaders/Config.cginc.meta new file mode 100644 index 0000000..8b82ce3 --- /dev/null +++ b/Assets/Alloy/Shaders/Config.cginc.meta @@ -0,0 +1,6 @@ +fileFormatVersion: 2 +guid: 6764b4ef20a5c1c4cae860a9e4aee89d +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: diff --git a/Assets/Alloy/Shaders/Defaults.meta b/Assets/Alloy/Shaders/Defaults.meta new file mode 100644 index 0000000..25aa7b5 --- /dev/null +++ b/Assets/Alloy/Shaders/Defaults.meta @@ -0,0 +1,6 @@ +fileFormatVersion: 2 +guid: 6c656da8b97d1334f910b38280d53339 +folderAsset: yes +DefaultImporter: + userData: + assetBundleName: diff --git a/Assets/Alloy/Shaders/Defaults/DiffuseScatteringOnRing.png b/Assets/Alloy/Shaders/Defaults/DiffuseScatteringOnRing.png new file mode 100644 index 0000000..8cfa0ba Binary files /dev/null and b/Assets/Alloy/Shaders/Defaults/DiffuseScatteringOnRing.png differ diff --git a/Assets/Alloy/Shaders/Defaults/DiffuseScatteringOnRing.png.meta b/Assets/Alloy/Shaders/Defaults/DiffuseScatteringOnRing.png.meta new file mode 100644 index 0000000..16743d7 --- /dev/null +++ b/Assets/Alloy/Shaders/Defaults/DiffuseScatteringOnRing.png.meta @@ -0,0 +1,62 @@ +fileFormatVersion: 2 +guid: d13510bb2be49aa40a66a0101efb6a36 +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 8 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -3 + maxTextureSize: 1024 + textureSettings: + filterMode: -1 + aniso: 0 + mipBias: -1 + wrapMode: 1 + nPOTScale: 1 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 5 + buildTargetSettings: + - buildTarget: Standalone + maxTextureSize: 1024 + textureFormat: 5 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/Defaults/HairDefault_AlloyPM.asset b/Assets/Alloy/Shaders/Defaults/HairDefault_AlloyPM.asset new file mode 100644 index 0000000..d059c0f --- /dev/null +++ b/Assets/Alloy/Shaders/Defaults/HairDefault_AlloyPM.asset @@ -0,0 +1,30 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3b158258a30cea746ad413697b1d071b, type: 3} + m_Name: HairDefault_AlloyPM + m_EditorClassIdentifier: + ChannelValues: {x: 0.5, y: 1, z: 1, w: 0} + TexturesGUID: + - + - + - + - + NormalGUID: + DoInvert: 00000000 + VarianceBias: 0 + Width: 32 + Height: 32 + DoAutoRegenerate: 1 + SelectedModes: 01000000020000000200000000000000 + MaxResolution: 0 + IsDetailMap: 0 + IsTerrainMap: 0 + m_packMode: {fileID: 11400000, guid: 1d42740116df09f4f9c9e144a4b9885f, type: 2} diff --git a/Assets/Alloy/Shaders/Defaults/HairDefault_AlloyPM.asset.meta b/Assets/Alloy/Shaders/Defaults/HairDefault_AlloyPM.asset.meta new file mode 100644 index 0000000..06b1ad0 --- /dev/null +++ b/Assets/Alloy/Shaders/Defaults/HairDefault_AlloyPM.asset.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: dc21825cc57144d42b91786508e2c229 +NativeFormatImporter: + userData: + assetBundleName: diff --git a/Assets/Alloy/Shaders/Defaults/HairDefault_AlloyPM.png b/Assets/Alloy/Shaders/Defaults/HairDefault_AlloyPM.png new file mode 100644 index 0000000..37aafc0 Binary files /dev/null and b/Assets/Alloy/Shaders/Defaults/HairDefault_AlloyPM.png differ diff --git a/Assets/Alloy/Shaders/Defaults/HairDefault_AlloyPM.png.meta b/Assets/Alloy/Shaders/Defaults/HairDefault_AlloyPM.png.meta new file mode 100644 index 0000000..b7945f8 --- /dev/null +++ b/Assets/Alloy/Shaders/Defaults/HairDefault_AlloyPM.png.meta @@ -0,0 +1,68 @@ +fileFormatVersion: 2 +guid: 33a37609d895f134d80ba24c3cf0f503 +timeCreated: 1633471341 +licenseType: Pro +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 0 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + filterMode: 2 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 32 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/Deferred.meta b/Assets/Alloy/Shaders/Deferred.meta new file mode 100644 index 0000000..bb0ce22 --- /dev/null +++ b/Assets/Alloy/Shaders/Deferred.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: f4450d7ecee5dd648b45b2de7df3bd2f +folderAsset: yes +timeCreated: 1491141800 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/Deferred/Decode.cginc b/Assets/Alloy/Shaders/Deferred/Decode.cginc new file mode 100644 index 0000000..ebc686e --- /dev/null +++ b/Assets/Alloy/Shaders/Deferred/Decode.cginc @@ -0,0 +1,39 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file Decode.cginc +/// @brief Deferred decode light buffer pass vertex & fragment shaders. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_DEFERRED_DECODE_CGINC +#define ALLOY_SHADERS_DEFERRED_DECODE_CGINC + +sampler2D _LightBuffer; + +struct AFragmentInput { + float4 vertex : SV_POSITION; + float2 texcoord : TEXCOORD0; +}; + +AFragmentInput aMainVertexShader( + float4 vertex : POSITION, + float2 texcoord : TEXCOORD0) +{ + AFragmentInput o; + o.vertex = UnityObjectToClipPos(vertex); + o.texcoord = texcoord.xy; +#ifdef UNITY_SINGLE_PASS_STEREO + o.texcoord = TransformStereoScreenSpaceTex(o.texcoord, 1.0f); +#endif + return o; +} + +fixed4 aMainFragmentShader( + AFragmentInput i) : SV_Target +{ + return -log2(tex2D(_LightBuffer, i.texcoord)); +} + +#endif // ALLOY_SHADERS_DEFERRED_DECODE_CGINC diff --git a/Assets/Alloy/Shaders/Deferred/Decode.cginc.meta b/Assets/Alloy/Shaders/Deferred/Decode.cginc.meta new file mode 100644 index 0000000..5a84e85 --- /dev/null +++ b/Assets/Alloy/Shaders/Deferred/Decode.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 5661f4df05e27394b9cd50398246c3fa +timeCreated: 1490736319 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/Deferred/Light.cginc b/Assets/Alloy/Shaders/Deferred/Light.cginc new file mode 100644 index 0000000..bd1f909 --- /dev/null +++ b/Assets/Alloy/Shaders/Deferred/Light.cginc @@ -0,0 +1,94 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file Light.cginc +/// @brief Deferred light pass vertex & fragment shaders. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_DEFERRED_LIGHT_CGINC +#define ALLOY_SHADERS_DEFERRED_LIGHT_CGINC + +#define A_DIRECT_LIGHTING_PASS + +#include "Assets/Alloy/Shaders/Framework/Deferred.cginc" + +unity_v2f_deferred aMainVertexShader( + float4 vertex : POSITION, + float3 normal : NORMAL) +{ + return vert_deferred(vertex, normal); +} + +#ifdef UNITY_HDR_ON +half4 +#else +fixed4 +#endif +aMainFragmentShader( + unity_v2f_deferred i) : SV_Target +{ + ASurface s = aDeferredSurface(i); + ADirect d = aNewDirect(); + float fadeDist = UnityComputeShadowFadeDistance(s.positionWorld, s.viewDepth); + float4 lightCoord = 0.0f; + float3 lightVector = 0.0f; + half3 lightAxis = 0.0h; + half range = 1.0h; + half4 c = 0.0h; + + d.color = _LightColor.rgb; + +#ifndef DIRECTIONAL + lightCoord = mul(unity_WorldToLight, float4(s.positionWorld, 1.0f)); +#endif + +#if defined(USING_DIRECTIONAL_LIGHT) + lightVector = -_LightDir.xyz; + d.shadow = UnityDeferredComputeShadow(s.positionWorld, fadeDist, s.screenUv); + + #if !defined(ALLOY_SUPPORT_REDLIGHTS) && defined(DIRECTIONAL_COOKIE) + aLightCookie(d, tex2Dbias(_LightTexture0, float4(lightCoord.xy, 0, -8))); + #endif +#elif defined(POINT) || defined(POINT_COOKIE) || defined(SPOT) + lightVector = _LightPos.xyz - s.positionWorld; + lightAxis = normalize(unity_WorldToLight[1].xyz); + range = rsqrt(_LightPos.w); // _LightPos.w = 1/r*r + + #if defined(SPOT) + // negative bias because http://aras-p.info/blog/2010/01/07/screenspace-vs-mip-mapping/ + half4 cookie = tex2Dbias(_LightTexture0, float4(lightCoord.xy / lightCoord.w, 0, -8)); + + cookie.a *= (lightCoord.w < 0.0f); + aLightCookie(d, cookie); + d.shadow = UnityDeferredComputeShadow(s.positionWorld, fadeDist, s.screenUv); + #elif defined(POINT) || defined(POINT_COOKIE) + d.shadow = UnityDeferredComputeShadow(-lightVector, fadeDist, s.screenUv); + + #if defined (POINT_COOKIE) + aLightCookie(d, texCUBEbias(_LightTexture0, float4(lightCoord.xyz, -8))); + #endif //POINT_COOKIE + #endif //POINT || POINT_COOKIE + + A_UNITY_ATTENUATION(d, _LightTextureB0, lightVector, _LightPos.w) +#endif + +#if !defined(ALLOY_SUPPORT_REDLIGHTS) || !defined(DIRECTIONAL_COOKIE) + aAreaLight(d, s, _LightColor, lightAxis, lightVector, range); +#else + d.direction = lightVector; + d.color *= redLightFunctionLegacy(_LightTexture0, s.positionWorld, s.normalWorld, s.viewDirWorld, d.direction); + aDirectionalLight(d, s); +#endif + + c.rgb = aHdrClamp(aDirectLighting(d, s)); + +#ifdef UNITY_HDR_ON + return c; +#else + return exp2(-c); +#endif +} + +#endif // ALLOY_SHADERS_DEFERRED_LIGHT_CGINC diff --git a/Assets/Alloy/Shaders/Deferred/Light.cginc.meta b/Assets/Alloy/Shaders/Deferred/Light.cginc.meta new file mode 100644 index 0000000..4b9ad42 --- /dev/null +++ b/Assets/Alloy/Shaders/Deferred/Light.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: d3107cea335f9344382bd082656550fc +timeCreated: 1490737757 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/Deferred/ReflectionAdd.cginc b/Assets/Alloy/Shaders/Deferred/ReflectionAdd.cginc new file mode 100644 index 0000000..e446363 --- /dev/null +++ b/Assets/Alloy/Shaders/Deferred/ReflectionAdd.cginc @@ -0,0 +1,42 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file ReflectionAdd.cginc +/// @brief Deferred reflection buffer add pass vertex & fragment shaders. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_DEFERRED_REFLECTION_ADD_CGINC +#define ALLOY_SHADERS_DEFERRED_REFLECTION_ADD_CGINC + +#include "UnityCG.cginc" + +sampler2D _CameraReflectionsTexture; + +struct AFragmentInput { + float2 uv : TEXCOORD0; + float4 pos : SV_POSITION; +}; + +AFragmentInput aMainVertexShader( + float3 vertex : POSITION) +{ + AFragmentInput o; + o.pos = UnityObjectToClipPos(vertex); + o.uv = ComputeScreenPos(o.pos).xy; + return o; +} + +half4 aMainFragmentShader( + AFragmentInput i) : SV_Target +{ + half4 c = tex2D(_CameraReflectionsTexture, i.uv); +#ifdef UNITY_HDR_ON + return float4(c.rgb, 0.0f); +#else + return float4(exp2(-c.rgb), 0.0f); +#endif +} + +#endif // ALLOY_SHADERS_DEFERRED_REFLECTION_ADD_CGINC diff --git a/Assets/Alloy/Shaders/Deferred/ReflectionAdd.cginc.meta b/Assets/Alloy/Shaders/Deferred/ReflectionAdd.cginc.meta new file mode 100644 index 0000000..18defe0 --- /dev/null +++ b/Assets/Alloy/Shaders/Deferred/ReflectionAdd.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 1e9a104470b80e94a82881d1187f6e5b +timeCreated: 1491142566 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/Deferred/ReflectionProbe.cginc b/Assets/Alloy/Shaders/Deferred/ReflectionProbe.cginc new file mode 100644 index 0000000..ecf8373 --- /dev/null +++ b/Assets/Alloy/Shaders/Deferred/ReflectionProbe.cginc @@ -0,0 +1,58 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file ReflectionProbe.cginc +/// @brief Deferred reflection probe pass vertex & fragment shaders. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_DEFERRED_REFLECTION_PROBE_CGINC +#define ALLOY_SHADERS_DEFERRED_REFLECTION_PROBE_CGINC + +#define A_INDIRECT_LIGHTING_PASS + +#include "Assets/Alloy/Shaders/Framework/Deferred.cginc" + +unity_v2f_deferred aMainVertexShader( + float4 vertex : POSITION, + float3 normal : NORMAL) +{ + return vert_deferred(vertex, normal); +} + +half4 aMainFragmentShader( + unity_v2f_deferred i) : SV_Target +{ + UnityGIInput d; + ASurface s = aDeferredSurface(i); + float blendDistance = unity_SpecCube1_ProbePosition.w; // will be set to blend distance for this probe + + d.worldPos = s.positionWorld; + d.worldViewDir = s.viewDirWorld; // ??? + d.probeHDR[0] = unity_SpecCube0_HDR; + +#ifdef UNITY_SPECCUBE_BOX_PROJECTION + d.probePosition[0] = unity_SpecCube0_ProbePosition; + d.boxMin[0].xyz = unity_SpecCube0_BoxMin - float4(blendDistance,blendDistance,blendDistance,0); + d.boxMin[0].w = 1; // 1 in .w allow to disable blending in UnityGI_IndirectSpecular call + d.boxMax[0].xyz = unity_SpecCube0_BoxMax + float4(blendDistance,blendDistance,blendDistance,0); +#endif + + Unity_GlossyEnvironmentData g; + AIndirect ind = aNewIndirect(); + + g.roughness = s.roughness; + g.reflUVW = s.reflectionVectorWorld; + ind.specular = UnityGI_IndirectSpecular(d, 1.0h, g); + + // Calculate falloff value, so reflections on the edges of the probe would gradually blend to previous reflection. + // Also this ensures that pixels not located in the reflection probe AABB won't + // accidentally pick up reflections from this probe. + half3 distance = aDistanceFromAabb(s.positionWorld, unity_SpecCube0_BoxMin.xyz, unity_SpecCube0_BoxMax.xyz); + half falloff = saturate(1.0 - length(distance) / blendDistance); + + return half4(aIndirectLighting(ind, s), falloff); +} + +#endif // ALLOY_SHADERS_DEFERRED_REFLECTION_PROBE_CGINC diff --git a/Assets/Alloy/Shaders/Deferred/ReflectionProbe.cginc.meta b/Assets/Alloy/Shaders/Deferred/ReflectionProbe.cginc.meta new file mode 100644 index 0000000..78f3a8a --- /dev/null +++ b/Assets/Alloy/Shaders/Deferred/ReflectionProbe.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 3011708aeab7fe148ad3912213be977c +timeCreated: 1491142106 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/Definition.meta b/Assets/Alloy/Shaders/Definition.meta new file mode 100644 index 0000000..d0be393 --- /dev/null +++ b/Assets/Alloy/Shaders/Definition.meta @@ -0,0 +1,6 @@ +fileFormatVersion: 2 +guid: c2b0077ba22ab1044b1bc82be7f89b03 +folderAsset: yes +DefaultImporter: + userData: + assetBundleName: diff --git a/Assets/Alloy/Shaders/Definition/CarPaint.cginc b/Assets/Alloy/Shaders/Definition/CarPaint.cginc new file mode 100644 index 0000000..729b881 --- /dev/null +++ b/Assets/Alloy/Shaders/Definition/CarPaint.cginc @@ -0,0 +1,39 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file CarPaint.cginc +/// @brief Car Paint surface shader definition. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_DEFINITION_CAR_PAINT_CGINC +#define ALLOY_SHADERS_DEFINITION_CAR_PAINT_CGINC + +#define A_MAIN_TEXTURES_ON +#define A_CAR_PAINT_ON + +#include "Assets/Alloy/Shaders/Lighting/Standard.cginc" +#include "Assets/Alloy/Shaders/Type/Standard.cginc" + +void aSurfaceShader( + inout ASurface s) +{ + aParallax(s); + aDissolve(s); + aMainTextures(s); + aDetail(s); + aTeamColor(s); + + s.mask = s.opacity; + aCarPaint(s); + + s.mask = 1.0h; + aAo2(s); + aDecal(s); + aWetness(s); + aEmission(s); + aRim(s); +} + +#endif // ALLOY_SHADERS_DEFINITION_CAR_PAINT_CGINC diff --git a/Assets/Alloy/Shaders/Definition/CarPaint.cginc.meta b/Assets/Alloy/Shaders/Definition/CarPaint.cginc.meta new file mode 100644 index 0000000..5478433 --- /dev/null +++ b/Assets/Alloy/Shaders/Definition/CarPaint.cginc.meta @@ -0,0 +1,6 @@ +fileFormatVersion: 2 +guid: 20da30c737f2cdd4d82e03453e96b4b7 +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: diff --git a/Assets/Alloy/Shaders/Definition/Core.cginc b/Assets/Alloy/Shaders/Definition/Core.cginc new file mode 100644 index 0000000..1a877e6 --- /dev/null +++ b/Assets/Alloy/Shaders/Definition/Core.cginc @@ -0,0 +1,33 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file Core.cginc +/// @brief Core & Glass surface shader definition. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_DEFINITION_CORE_CGINC +#define ALLOY_SHADERS_DEFINITION_CORE_CGINC + +#define A_MAIN_TEXTURES_ON + +#include "Assets/Alloy/Shaders/Lighting/Standard.cginc" +#include "Assets/Alloy/Shaders/Type/Standard.cginc" + +void aSurfaceShader( + inout ASurface s) +{ + aParallax(s); + aDissolve(s); + aMainTextures(s); + aDetail(s); + aTeamColor(s); + aAo2(s); + aDecal(s); + aWetness(s); + aRim(s); + aEmission(s); +} + +#endif // ALLOY_SHADERS_DEFINITION_CORE_CGINC diff --git a/Assets/Alloy/Shaders/Definition/Core.cginc.meta b/Assets/Alloy/Shaders/Definition/Core.cginc.meta new file mode 100644 index 0000000..e0cc277 --- /dev/null +++ b/Assets/Alloy/Shaders/Definition/Core.cginc.meta @@ -0,0 +1,6 @@ +fileFormatVersion: 2 +guid: 2a692b8376e677841acb09e0c6e109e6 +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: diff --git a/Assets/Alloy/Shaders/Definition/DecalAdditive.cginc b/Assets/Alloy/Shaders/Definition/DecalAdditive.cginc new file mode 100644 index 0000000..50a08f6 --- /dev/null +++ b/Assets/Alloy/Shaders/Definition/DecalAdditive.cginc @@ -0,0 +1,35 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file DecalAdditive.cginc +/// @brief Additive deferred decal surface shader definition. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_DEFINITION_DECAL_ADDITIVE_CGINC +#define ALLOY_SHADERS_DEFINITION_DECAL_ADDITIVE_CGINC + +#define A_EMISSIVE_COLOR_ON +#define A_MAIN_TEXTURES_ON +#define A_MAIN_TEXTURES_MATERIAL_MAP_OFF + +#include "Assets/Alloy/Shaders/Lighting/Unlit.cginc" +#include "Assets/Alloy/Shaders/Type/DecalAdditive.cginc" + +void aSurfaceShader( + inout ASurface s) +{ + aParallax(s); + aDissolve(s); + aMainTextures(s); + aDetail(s); + aTeamColor(s); + aDecal(s); + aRim(s); + aEmission(s); + + s.emissiveColor += s.baseColor; +} + +#endif // ALLOY_SHADERS_DEFINITION_DECAL_ADDITIVE_CGINC diff --git a/Assets/Alloy/Shaders/Definition/DecalAdditive.cginc.meta b/Assets/Alloy/Shaders/Definition/DecalAdditive.cginc.meta new file mode 100644 index 0000000..d6a5720 --- /dev/null +++ b/Assets/Alloy/Shaders/Definition/DecalAdditive.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 77d48e1c7545cb4468cfba565980cfb6 +timeCreated: 1449626785 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/Definition/DecalAlpha.cginc b/Assets/Alloy/Shaders/Definition/DecalAlpha.cginc new file mode 100644 index 0000000..f1b9907 --- /dev/null +++ b/Assets/Alloy/Shaders/Definition/DecalAlpha.cginc @@ -0,0 +1,33 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file Alpha.cginc +/// @brief Alpha deferred decal surface shader definition. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_DEFINITION_DECAL_ALPHA_CGINC +#define ALLOY_SHADERS_DEFINITION_DECAL_ALPHA_CGINC + +#define A_MAIN_TEXTURES_ON + +#include "Assets/Alloy/Shaders/Lighting/Standard.cginc" +#include "Assets/Alloy/Shaders/Type/DecalAlpha.cginc" + +void aSurfaceShader( + inout ASurface s) +{ + aParallax(s); + aDissolve(s); + aMainTextures(s); + aDetail(s); + aTeamColor(s); + aAo2(s); + aDecal(s); + aWetness(s); + aRim(s); + aEmission(s); +} + +#endif // ALLOY_SHADERS_DEFINITION_DECAL_ALPHA_CGINC diff --git a/Assets/Alloy/Shaders/Definition/DecalAlpha.cginc.meta b/Assets/Alloy/Shaders/Definition/DecalAlpha.cginc.meta new file mode 100644 index 0000000..a5f8729 --- /dev/null +++ b/Assets/Alloy/Shaders/Definition/DecalAlpha.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 6b9d5465c1cac644aa342d8e65b8099d +timeCreated: 1448683589 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/Definition/DecalAmbient.cginc b/Assets/Alloy/Shaders/Definition/DecalAmbient.cginc new file mode 100644 index 0000000..a813bc1 --- /dev/null +++ b/Assets/Alloy/Shaders/Definition/DecalAmbient.cginc @@ -0,0 +1,25 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file DecalAmbient.cginc +/// @brief Ambient deferred decal surface shader definition. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_DEFINITION_DECAL_AMBIENT_CGINC +#define ALLOY_SHADERS_DEFINITION_DECAL_AMBIENT_CGINC + +#include "Assets/Alloy/Shaders/Lighting/Unlit.cginc" +#include "Assets/Alloy/Shaders/Type/DecalAmbient.cginc" + +void aSurfaceShader( + inout ASurface s) +{ + half4 base = aBase(s); + + s.baseColor = aLerpWhiteTo(base.rgb, base.a); + aTeamColor(s); +} + +#endif // ALLOY_SHADERS_DEFINITION_DECAL_AMBIENT_CGINC diff --git a/Assets/Alloy/Shaders/Definition/DecalAmbient.cginc.meta b/Assets/Alloy/Shaders/Definition/DecalAmbient.cginc.meta new file mode 100644 index 0000000..ace10ac --- /dev/null +++ b/Assets/Alloy/Shaders/Definition/DecalAmbient.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: c8def66d395c0ba4ead144776498bf16 +timeCreated: 1458169179 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/Definition/DecalMultiplicative.cginc b/Assets/Alloy/Shaders/Definition/DecalMultiplicative.cginc new file mode 100644 index 0000000..2f0fd17 --- /dev/null +++ b/Assets/Alloy/Shaders/Definition/DecalMultiplicative.cginc @@ -0,0 +1,25 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file Multiplicative.cginc +/// @brief Multiplicative deferred decal surface shader definition. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_DEFINITION_DECAL_MULTIPLICATIVE_CGINC +#define ALLOY_SHADERS_DEFINITION_DECAL_MULTIPLICATIVE_CGINC + +#include "Assets/Alloy/Shaders/Lighting/Unlit.cginc" +#include "Assets/Alloy/Shaders/Type/DecalMultiplicative.cginc" + +void aSurfaceShader( + inout ASurface s) +{ + half4 base = aBase(s); + + s.baseColor = aLerpWhiteTo(base.rgb, base.a); + aTeamColor(s); +} + +#endif // ALLOY_SHADERS_DEFINITION_DECAL_MULTIPLICATIVE_CGINC diff --git a/Assets/Alloy/Shaders/Definition/DecalMultiplicative.cginc.meta b/Assets/Alloy/Shaders/Definition/DecalMultiplicative.cginc.meta new file mode 100644 index 0000000..070ca3e --- /dev/null +++ b/Assets/Alloy/Shaders/Definition/DecalMultiplicative.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 72bbda01f8e440340933fdafd02b180f +timeCreated: 1448718436 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/Definition/Details0.cginc b/Assets/Alloy/Shaders/Definition/Details0.cginc new file mode 100644 index 0000000..66bffd1 --- /dev/null +++ b/Assets/Alloy/Shaders/Definition/Details0.cginc @@ -0,0 +1,27 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file Details0.cginc +/// @brief Unity Terrain details VertexLit surface shader definition. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_DEFINITION_DETAILS0_CGINC +#define ALLOY_SHADERS_DEFINITION_DETAILS0_CGINC + +#include "Assets/Alloy/Shaders/Lighting/Standard.cginc" +#include "Assets/Alloy/Shaders/Type/Standard.cginc" + +void aSurfaceShader( + inout ASurface s) +{ + half4 base = aSampleBase(s) * s.vertexColor; + + s.baseColor = base.rgb; + s.opacity = base.a; + s.specularity = 0.5h; + s.roughness = 1.0h; +} + +#endif // ALLOY_SHADERS_DEFINITION_DETAILS0_CGINC diff --git a/Assets/Alloy/Shaders/Definition/Details0.cginc.meta b/Assets/Alloy/Shaders/Definition/Details0.cginc.meta new file mode 100644 index 0000000..eabbe04 --- /dev/null +++ b/Assets/Alloy/Shaders/Definition/Details0.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: cab6723fe831ee842914be81e3c960cd +timeCreated: 1477087795 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/Definition/Details1.cginc b/Assets/Alloy/Shaders/Definition/Details1.cginc new file mode 100644 index 0000000..b164f46 --- /dev/null +++ b/Assets/Alloy/Shaders/Definition/Details1.cginc @@ -0,0 +1,29 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file Details1.cginc +/// @brief Unity Terrain details WavingDoublePass surface shader definition. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_DEFINITION_DETAILS1_CGINC +#define ALLOY_SHADERS_DEFINITION_DETAILS1_CGINC + +#include "Assets/Alloy/Shaders/Lighting/Standard.cginc" +#include "Assets/Alloy/Shaders/Type/Details1.cginc" + +void aSurfaceShader( + inout ASurface s) +{ + half4 base = aSampleBase(s) * s.vertexColor; + + s.baseColor = base.rgb; + s.opacity = base.a; + aCutout(s); + s.specularity = 0.5h; + s.roughness = 1.0h; + s.opacity *= s.vertexColor.a; +} + +#endif // ALLOY_SHADERS_DEFINITION_DETAILS1_CGINC diff --git a/Assets/Alloy/Shaders/Definition/Details1.cginc.meta b/Assets/Alloy/Shaders/Definition/Details1.cginc.meta new file mode 100644 index 0000000..45a40c6 --- /dev/null +++ b/Assets/Alloy/Shaders/Definition/Details1.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 529e1d0308a1c7b4c9e0b8b1caf08856 +timeCreated: 1477088910 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/Definition/Details2.cginc b/Assets/Alloy/Shaders/Definition/Details2.cginc new file mode 100644 index 0000000..de144ca --- /dev/null +++ b/Assets/Alloy/Shaders/Definition/Details2.cginc @@ -0,0 +1,29 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file Details2.cginc +/// @brief Unity Terrain BillboardWavingDoublePass surface shader definition. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_DEFINITION_DETAILS2_CGINC +#define ALLOY_SHADERS_DEFINITION_DETAILS2_CGINC + +#include "Assets/Alloy/Shaders/Lighting/Standard.cginc" +#include "Assets/Alloy/Shaders/Type/Details2.cginc" + +void aSurfaceShader( + inout ASurface s) +{ + half4 base = aSampleBase(s) * s.vertexColor; + + s.baseColor = base.rgb; + s.opacity = base.a; + aCutout(s); + s.specularity = 0.5h; + s.roughness = 1.0h; + s.opacity *= s.vertexColor.a; +} + +#endif // ALLOY_SHADERS_DEFINITION_DETAILS2_CGINC diff --git a/Assets/Alloy/Shaders/Definition/Details2.cginc.meta b/Assets/Alloy/Shaders/Definition/Details2.cginc.meta new file mode 100644 index 0000000..da103a5 --- /dev/null +++ b/Assets/Alloy/Shaders/Definition/Details2.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: b704da744f5578840a9cb5c0a130169a +timeCreated: 1477090895 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/Definition/DirectionalBlend.cginc b/Assets/Alloy/Shaders/Definition/DirectionalBlend.cginc new file mode 100644 index 0000000..13d8900 --- /dev/null +++ b/Assets/Alloy/Shaders/Definition/DirectionalBlend.cginc @@ -0,0 +1,41 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file DirectionalBlend.cginc +/// @brief Directional Blend shader definition. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_DEFINITION_DIRECTIONAL_BLEND_CGINC +#define ALLOY_SHADERS_DEFINITION_DIRECTIONAL_BLEND_CGINC + +#define A_MAIN_TEXTURES_ON +#define A_MAIN_TEXTURES_CUTOUT_OFF +#define A_DIRECTIONAL_BLEND_ON +#define A_SECONDARY_TEXTURES_ON + +#include "Assets/Alloy/Shaders/Lighting/Standard.cginc" +#include "Assets/Alloy/Shaders/Type/Standard.cginc" + +void aSurfaceShader( + inout ASurface s) +{ + aParallax(s); + aDissolve(s); + aMainTextures(s); + aDetail(s); + aTeamColor(s); + aDecal(s); + aEmission(s); + aDirectionalBlend(s); + aSecondaryTextures(s); + aCutout(s); + + s.mask = 1.0h; + aAo2(s); + aWetness(s); + aRim(s); +} + +#endif // ALLOY_SHADERS_DEFINITION_DIRECTIONAL_BLEND_CGINC diff --git a/Assets/Alloy/Shaders/Definition/DirectionalBlend.cginc.meta b/Assets/Alloy/Shaders/Definition/DirectionalBlend.cginc.meta new file mode 100644 index 0000000..978918e --- /dev/null +++ b/Assets/Alloy/Shaders/Definition/DirectionalBlend.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: d349a563cd617e249ae265886e517ef4 +timeCreated: 1430052598 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/Definition/Eye.cginc b/Assets/Alloy/Shaders/Definition/Eye.cginc new file mode 100644 index 0000000..e497e3f --- /dev/null +++ b/Assets/Alloy/Shaders/Definition/Eye.cginc @@ -0,0 +1,33 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file Eye.cginc +/// @brief Eye surface shader definition. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_DEFINITION_EYE_CGINC +#define ALLOY_SHADERS_DEFINITION_EYE_CGINC + +#define A_EYE_ON +#define A_DETAIL_MASK_OFF +#define A_DETAIL_COLOR_MAP_OFF + +#include "Assets/Alloy/Shaders/Lighting/Standard.cginc" +#include "Assets/Alloy/Shaders/Type/Standard.cginc" + +void aSurfaceShader( + inout ASurface s) +{ + aEye(s); + aDetail(s); + + s.mask = 1.0h; + aDissolve(s); + aDecal(s); + aEmission(s); + aRim(s); +} + +#endif // ALLOY_SHADERS_DEFINITION_EYE_CGINC diff --git a/Assets/Alloy/Shaders/Definition/Eye.cginc.meta b/Assets/Alloy/Shaders/Definition/Eye.cginc.meta new file mode 100644 index 0000000..efdee0d --- /dev/null +++ b/Assets/Alloy/Shaders/Definition/Eye.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 6369700ca36ab82408493f12c09cdb2d +timeCreated: 1467835738 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/Definition/Hair.cginc b/Assets/Alloy/Shaders/Definition/Hair.cginc new file mode 100644 index 0000000..3779141 --- /dev/null +++ b/Assets/Alloy/Shaders/Definition/Hair.cginc @@ -0,0 +1,56 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file Hair.cginc +/// @brief Hair surface shader definition. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_DEFINITION_HAIR_CGINC +#define ALLOY_SHADERS_DEFINITION_HAIR_CGINC + +#define A_NORMAL_MAPPING_ON +#define A_AMBIENT_OCCLUSION_ON +#define A_WETNESS_POROSITY_OFF +#define A_WETNESS_NORMAL_MAP_OFF + +#include "Assets/Alloy/Shaders/Lighting/Hair.cginc" +#include "Assets/Alloy/Shaders/Type/Standard.cginc" + +void aSurfaceShader( + inout ASurface s) +{ + + aDissolve(s); + + half4 base = aBase(s); + + s.baseColor = base.rgb; + s.opacity = base.a; + aCutout(s); + + half4 material = aSampleMaterial(s); + + // Preshift down so a middle-gray texture can push the highlight up or down! + half shift = material.A_METALLIC_CHANNEL - 0.5h; + s.highlightTint0 = _HighlightTint0 * material.A_SPECULARITY_CHANNEL; // Noise + s.highlightShift0 = _HighlightShift0 + shift; + s.highlightShift1 = _HighlightShift1 + shift; + + s.metallic = 0.0h; + s.ambientOcclusion = aLerpOneTo(material.A_AO_CHANNEL, _Occlusion); + s.specularity = _HairSpecularity; + s.roughness = material.A_ROUGHNESS_CHANNEL; + + half theta = radians(_AnisoAngle); + s.highlightTangent = half3(cos(theta), sin(theta), 0.0h); + s.normalTangent = A_NT(s, aSampleBump(s)); + + aDecal(s); + aWetness(s); + aRim(s); + aEmission(s); +} + +#endif // ALLOY_SHADERS_DEFINITION_HAIR_CGINC diff --git a/Assets/Alloy/Shaders/Definition/Hair.cginc.meta b/Assets/Alloy/Shaders/Definition/Hair.cginc.meta new file mode 100644 index 0000000..ae573ff --- /dev/null +++ b/Assets/Alloy/Shaders/Definition/Hair.cginc.meta @@ -0,0 +1,6 @@ +fileFormatVersion: 2 +guid: 3ff8ea6e6927e76428c89af676339574 +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: diff --git a/Assets/Alloy/Shaders/Definition/OrientedBlend.cginc b/Assets/Alloy/Shaders/Definition/OrientedBlend.cginc new file mode 100644 index 0000000..6a83643 --- /dev/null +++ b/Assets/Alloy/Shaders/Definition/OrientedBlend.cginc @@ -0,0 +1,43 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file OrientedBlend.cginc +/// @brief Oriented Blend shader definition. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_DEFINITION_ORIENTED_BLEND_CGINC +#define ALLOY_SHADERS_DEFINITION_ORIENTED_BLEND_CGINC + +#define A_MAIN_TEXTURES_ON +#define A_MAIN_TEXTURES_CUTOUT_OFF +#define A_DIRECTIONAL_BLEND_ON +#define A_DIRECTIONAL_BLEND_MODE_OFF +#define A_ORIENTED_TEXTURES_ON + +#include "Assets/Alloy/Shaders/Lighting/Standard.cginc" +#include "Assets/Alloy/Shaders/Type/Standard.cginc" + +void aSurfaceShader( + inout ASurface s) +{ + aParallax(s); + aDissolve(s); + aMainTextures(s); + aDetail(s); + aTeamColor(s); + aDecal(s); + aEmission(s); + + aDirectionalBlend(s); + aOrientedTextures(s); + aCutout(s); + + s.mask = 1.0h; + aAo2(s); + aWetness(s); + aRim(s); +} + +#endif // ALLOY_SHADERS_DEFINITION_ORIENTED_BLEND_CGINC diff --git a/Assets/Alloy/Shaders/Definition/OrientedBlend.cginc.meta b/Assets/Alloy/Shaders/Definition/OrientedBlend.cginc.meta new file mode 100644 index 0000000..43e911e --- /dev/null +++ b/Assets/Alloy/Shaders/Definition/OrientedBlend.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: deb10cefc0532514bb76370d0af9c5cf +timeCreated: 1429741126 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/Definition/OrientedCore.cginc b/Assets/Alloy/Shaders/Definition/OrientedCore.cginc new file mode 100644 index 0000000..38f2545 --- /dev/null +++ b/Assets/Alloy/Shaders/Definition/OrientedCore.cginc @@ -0,0 +1,26 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file Oriented.cginc +/// @brief Oriented Blend & Core shader definition. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_DEFINITION_ORIENTED_CGINC +#define ALLOY_SHADERS_DEFINITION_ORIENTED_CGINC + +#define A_ORIENTED_TEXTURES_ON +#define A_ORIENTED_TEXTURES_BLEND_OFF + +#include "Assets/Alloy/Shaders/Lighting/Standard.cginc" +#include "Assets/Alloy/Shaders/Type/Standard.cginc" + +void aSurfaceShader( + inout ASurface s) +{ + aOrientedTextures(s); + aCutout(s); +} + +#endif // ALLOY_SHADERS_DEFINITION_ORIENTED_CGINC diff --git a/Assets/Alloy/Shaders/Definition/OrientedCore.cginc.meta b/Assets/Alloy/Shaders/Definition/OrientedCore.cginc.meta new file mode 100644 index 0000000..3355dad --- /dev/null +++ b/Assets/Alloy/Shaders/Definition/OrientedCore.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: d9b174c87b08d2c4eb9d1766f4d19cd0 +timeCreated: 1429741148 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/Definition/Skin.cginc b/Assets/Alloy/Shaders/Definition/Skin.cginc new file mode 100644 index 0000000..1ea59b0 --- /dev/null +++ b/Assets/Alloy/Shaders/Definition/Skin.cginc @@ -0,0 +1,32 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file Skin.cginc +/// @brief Skin surface shader definition. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_DEFINITION_SKIN_CGINC +#define ALLOY_SHADERS_DEFINITION_SKIN_CGINC + +#define A_SKIN_TEXTURES_ON + +#include "Assets/Alloy/Shaders/Lighting/Standard.cginc" +#include "Assets/Alloy/Shaders/Type/Standard.cginc" + +void aSurfaceShader( + inout ASurface s) +{ + aParallax(s); + aDissolve(s); + aSkinTextures(s); + aDetail(s); + aTeamColor(s); + aDecal(s); + aWetness(s); + aRim(s); + aEmission(s); +} + +#endif // ALLOY_SHADERS_DEFINITION_SKIN_CGINC diff --git a/Assets/Alloy/Shaders/Definition/Skin.cginc.meta b/Assets/Alloy/Shaders/Definition/Skin.cginc.meta new file mode 100644 index 0000000..2fd52e3 --- /dev/null +++ b/Assets/Alloy/Shaders/Definition/Skin.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 48679e9ae940f6a499b0628bc2f2f6ba +timeCreated: 1443976458 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/Definition/SpeedTree.cginc b/Assets/Alloy/Shaders/Definition/SpeedTree.cginc new file mode 100644 index 0000000..ba2680e --- /dev/null +++ b/Assets/Alloy/Shaders/Definition/SpeedTree.cginc @@ -0,0 +1,36 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file SpeedTree.cginc +/// @brief SpeedTree surface shader definition. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_DEFINITION_SPEED_TREE_CGINC +#define ALLOY_SHADERS_DEFINITION_SPEED_TREE_CGINC + +#define A_SPEED_TREE_ON +#define A_SPECULAR_TINT_ON + +#include "Assets/Alloy/Shaders/Lighting/Standard.cginc" +#include "Assets/Alloy/Shaders/Type/SpeedTree.cginc" + +void aSurfaceShader( + inout ASurface s) +{ + aParallax(s); + aDissolve(s); + aSpeedTree(s); + s.specularity = _Specularity; + s.specularTint = _SpecularTint; + s.roughness = _Roughness; + aTeamColor(s); + aDecal(s); + aWetness(s); + aTwoSided(s); + aRim(s); + aEmission(s); +} + +#endif // ALLOY_SHADERS_DEFINITION_SPEED_TREE_CGINC diff --git a/Assets/Alloy/Shaders/Definition/SpeedTree.cginc.meta b/Assets/Alloy/Shaders/Definition/SpeedTree.cginc.meta new file mode 100644 index 0000000..2af50e4 --- /dev/null +++ b/Assets/Alloy/Shaders/Definition/SpeedTree.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 3841d5fdf13af34488d7bf817fb59a44 +timeCreated: 1462058199 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/Definition/SpeedTreeBillboard.cginc b/Assets/Alloy/Shaders/Definition/SpeedTreeBillboard.cginc new file mode 100644 index 0000000..1645069 --- /dev/null +++ b/Assets/Alloy/Shaders/Definition/SpeedTreeBillboard.cginc @@ -0,0 +1,25 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file SpeedTreeBillboard.cginc +/// @brief SpeedTree Billboard surface shader definition. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_DEFINITION_SPEED_TREE_BILLBOARD_CGINC +#define ALLOY_SHADERS_DEFINITION_SPEED_TREE_BILLBOARD_CGINC + +#define A_SPEED_TREE_ON + +#include "Assets/Alloy/Shaders/Lighting/Standard.cginc" +#include "Assets/Alloy/Shaders/Type/SpeedTreeBillboard.cginc" + +void aSurfaceShader( + inout ASurface s) +{ + aSpeedTree(s); + s.roughness = 1.0h; +} + +#endif // ALLOY_SHADERS_DEFINITION_SPEED_TREE_BILLBOARD_CGINC diff --git a/Assets/Alloy/Shaders/Definition/SpeedTreeBillboard.cginc.meta b/Assets/Alloy/Shaders/Definition/SpeedTreeBillboard.cginc.meta new file mode 100644 index 0000000..5063cd5 --- /dev/null +++ b/Assets/Alloy/Shaders/Definition/SpeedTreeBillboard.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 96092d61311e3384e8e7d2635cc224cc +timeCreated: 1462068445 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/Definition/Terrain.cginc b/Assets/Alloy/Shaders/Definition/Terrain.cginc new file mode 100644 index 0000000..9ba7f60 --- /dev/null +++ b/Assets/Alloy/Shaders/Definition/Terrain.cginc @@ -0,0 +1,26 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file Terrain.cginc +/// @brief Terrain surface shader definition. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_DEFINITION_TERRAIN_CGINC +#define ALLOY_SHADERS_DEFINITION_TERRAIN_CGINC + +#define A_TERRAIN_ON +#define A_DETAIL_MASK_OFF + +#include "Assets/Alloy/Shaders/Lighting/Standard.cginc" +#include "Assets/Alloy/Shaders/Type/Terrain.cginc" + +void aSurfaceShader( + inout ASurface s) +{ + aTerrain(s); + aDetail(s); +} + +#endif // ALLOY_SHADERS_DEFINITION_TERRAIN_CGINC diff --git a/Assets/Alloy/Shaders/Definition/Terrain.cginc.meta b/Assets/Alloy/Shaders/Definition/Terrain.cginc.meta new file mode 100644 index 0000000..3a9899d --- /dev/null +++ b/Assets/Alloy/Shaders/Definition/Terrain.cginc.meta @@ -0,0 +1,6 @@ +fileFormatVersion: 2 +guid: 16498dea0fa1e544caa823b1ee8ab3fb +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: diff --git a/Assets/Alloy/Shaders/Definition/Transition.cginc b/Assets/Alloy/Shaders/Definition/Transition.cginc new file mode 100644 index 0000000..2d62dcc --- /dev/null +++ b/Assets/Alloy/Shaders/Definition/Transition.cginc @@ -0,0 +1,48 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file Transition.cginc +/// @brief Transition & Weighted Blend shader definition. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_DEFINITION_TRANSITION_CGINC +#define ALLOY_SHADERS_DEFINITION_TRANSITION_CGINC + +#define A_MAIN_TEXTURES_ON +#define A_MAIN_TEXTURES_CUTOUT_OFF +#define A_TRANSITION_BLEND_ON +#define A_SECONDARY_TEXTURES_ON +#define A_SECONDARY_TEXTURES_ALPHA_BLEND_OFF + +#include "Assets/Alloy/Shaders/Lighting/Standard.cginc" +#include "Assets/Alloy/Shaders/Type/Standard.cginc" + +void aSurfaceShader( + inout ASurface s) +{ + aTransitionBlend(s); + + s.mask = 1.0h - s.mask; + aParallax(s); + aMainTextures(s); + + s.mask = 1.0h - s.mask; + aSecondaryTextures(s); + aCutout(s); + + s.mask = 1.0h - s.mask; + aDetail(s); + aTeamColor(s); + aDecal(s); + aWetness(s); + aEmission(s); + aRim(s); + + s.mask = 1.0h; + aDissolve(s); + aAo2(s); +} + +#endif // ALLOY_SHADERS_DEFINITION_TRANSITION_CGINC diff --git a/Assets/Alloy/Shaders/Definition/Transition.cginc.meta b/Assets/Alloy/Shaders/Definition/Transition.cginc.meta new file mode 100644 index 0000000..8004d2d --- /dev/null +++ b/Assets/Alloy/Shaders/Definition/Transition.cginc.meta @@ -0,0 +1,6 @@ +fileFormatVersion: 2 +guid: 8177b0acf2184464b8d3fc1ab0936f2a +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: diff --git a/Assets/Alloy/Shaders/Definition/Transmission.cginc b/Assets/Alloy/Shaders/Definition/Transmission.cginc new file mode 100644 index 0000000..b889724 --- /dev/null +++ b/Assets/Alloy/Shaders/Definition/Transmission.cginc @@ -0,0 +1,36 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file Transmission.cginc +/// @brief Transmission surface shader definition. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_DEFINITION_TRANSMISSION_CGINC +#define ALLOY_SHADERS_DEFINITION_TRANSMISSION_CGINC + +#define A_MAIN_TEXTURES_ON +#define A_TRANSMISSION_ON + +#include "Assets/Alloy/Shaders/Lighting/Standard.cginc" +#include "Assets/Alloy/Shaders/Type/Standard.cginc" + +void aSurfaceShader( + inout ASurface s) +{ + aParallax(s); + aDissolve(s); + aMainTextures(s); + aTransmission(s); + aDetail(s); + aTeamColor(s); + aAo2(s); + aDecal(s); + aWetness(s); + aTwoSided(s); + aRim(s); + aEmission(s); +} + +#endif // ALLOY_SHADERS_DEFINITION_TRANSMISSION_CGINC diff --git a/Assets/Alloy/Shaders/Definition/Transmission.cginc.meta b/Assets/Alloy/Shaders/Definition/Transmission.cginc.meta new file mode 100644 index 0000000..14a0dc8 --- /dev/null +++ b/Assets/Alloy/Shaders/Definition/Transmission.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: a4613e38c0ea3d14898b548547d78dda +timeCreated: 1441334591 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/Definition/TriPlanar.cginc b/Assets/Alloy/Shaders/Definition/TriPlanar.cginc new file mode 100644 index 0000000..666af5f --- /dev/null +++ b/Assets/Alloy/Shaders/Definition/TriPlanar.cginc @@ -0,0 +1,26 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file TriPlanar.cginc +/// @brief TriPlanar shader definition. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_DEFINITION_TRIPLANAR_CGINC +#define ALLOY_SHADERS_DEFINITION_TRIPLANAR_CGINC + +#define A_TRIPLANAR_ON +#define A_RIM_EFFECTS_MAP_OFF + +#include "Assets/Alloy/Shaders/Lighting/Standard.cginc" +#include "Assets/Alloy/Shaders/Type/Standard.cginc" + +void aSurfaceShader( + inout ASurface s) +{ + aTriPlanar(s); + aRim(s); +} + +#endif // ALLOY_SHADERS_DEFINITION_TRIPLANAR_CGINC diff --git a/Assets/Alloy/Shaders/Definition/TriPlanar.cginc.meta b/Assets/Alloy/Shaders/Definition/TriPlanar.cginc.meta new file mode 100644 index 0000000..c418c74 --- /dev/null +++ b/Assets/Alloy/Shaders/Definition/TriPlanar.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: a630e253b1ea64d468448a714f39a639 +timeCreated: 1431268798 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/Definition/Unlit.cginc b/Assets/Alloy/Shaders/Definition/Unlit.cginc new file mode 100644 index 0000000..79ec421 --- /dev/null +++ b/Assets/Alloy/Shaders/Definition/Unlit.cginc @@ -0,0 +1,35 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file Unlit.cginc +/// @brief Unlit surface shader definition. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_DEFINITION_UNLIT_CGINC +#define ALLOY_SHADERS_DEFINITION_UNLIT_CGINC + +#define A_EMISSIVE_COLOR_ON +#define A_MAIN_TEXTURES_ON +#define A_MAIN_TEXTURES_MATERIAL_MAP_OFF + +#include "Assets/Alloy/Shaders/Lighting/Unlit.cginc" +#include "Assets/Alloy/Shaders/Type/Standard.cginc" + +void aSurfaceShader( + inout ASurface s) +{ + aParallax(s); + aDissolve(s); + aMainTextures(s); + aDetail(s); + aTeamColor(s); + aDecal(s); + aRim(s); + aEmission(s); + + s.emissiveColor += s.baseColor; +} + +#endif // ALLOY_SHADERS_DEFINITION_UNLIT_CGINC diff --git a/Assets/Alloy/Shaders/Definition/Unlit.cginc.meta b/Assets/Alloy/Shaders/Definition/Unlit.cginc.meta new file mode 100644 index 0000000..79fa0d5 --- /dev/null +++ b/Assets/Alloy/Shaders/Definition/Unlit.cginc.meta @@ -0,0 +1,6 @@ +fileFormatVersion: 2 +guid: f7377370081a65e4990ccebb77b41d87 +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: diff --git a/Assets/Alloy/Shaders/Definition/VertexBlend.cginc b/Assets/Alloy/Shaders/Definition/VertexBlend.cginc new file mode 100644 index 0000000..fd68429 --- /dev/null +++ b/Assets/Alloy/Shaders/Definition/VertexBlend.cginc @@ -0,0 +1,28 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file VertexBlend.cginc +/// @brief Vertex Blend shader definition. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_DEFINITION_VERTEX_BLEND_CGINC +#define ALLOY_SHADERS_DEFINITION_VERTEX_BLEND_CGINC + +#define A_VERTEX_BLEND_ON + +#include "Assets/Alloy/Shaders/Lighting/Standard.cginc" +#include "Assets/Alloy/Shaders/Type/Standard.cginc" + +void aSurfaceShader( + inout ASurface s) +{ + aVertexBlend(s); + aDetail(s); + aAo2(s); + aDecal(s); + aWetness(s); +} + +#endif // ALLOY_SHADERS_DEFINITION_VERTEX_BLEND_CGINC diff --git a/Assets/Alloy/Shaders/Definition/VertexBlend.cginc.meta b/Assets/Alloy/Shaders/Definition/VertexBlend.cginc.meta new file mode 100644 index 0000000..20ae11b --- /dev/null +++ b/Assets/Alloy/Shaders/Definition/VertexBlend.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 1047c127a23c9714ea676aa0e8535cd4 +timeCreated: 1472697187 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/Definition/WeightedBlend.cginc b/Assets/Alloy/Shaders/Definition/WeightedBlend.cginc new file mode 100644 index 0000000..1a54d6e --- /dev/null +++ b/Assets/Alloy/Shaders/Definition/WeightedBlend.cginc @@ -0,0 +1,42 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file WeightedBlend.cginc +/// @brief Weighted Blend shader definition. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_DEFINITION_WEIGHTED_BLEND_CGINC +#define ALLOY_SHADERS_DEFINITION_WEIGHTED_BLEND_CGINC + +#define A_MAIN_TEXTURES_ON +#define A_MAIN_TEXTURES_CUTOUT_OFF +#define A_WEIGHTED_BLEND_ON +#define A_SECONDARY_TEXTURES_ON + +#include "Assets/Alloy/Shaders/Lighting/Standard.cginc" +#include "Assets/Alloy/Shaders/Type/Standard.cginc" + +void aSurfaceShader( + inout ASurface s) +{ + aParallax(s); + aDissolve(s); + aMainTextures(s); + aDetail(s); + aTeamColor(s); + aEmission(s); + + aHeightmapBlend(s); + aSecondaryTextures(s); + aCutout(s); + + s.mask = 1.0h; + aAo2(s); + aDecal(s); + aWetness(s); + aRim(s); +} + +#endif // ALLOY_SHADERS_DEFINITION_WEIGHTED_BLEND_CGINC diff --git a/Assets/Alloy/Shaders/Definition/WeightedBlend.cginc.meta b/Assets/Alloy/Shaders/Definition/WeightedBlend.cginc.meta new file mode 100644 index 0000000..8f2d972 --- /dev/null +++ b/Assets/Alloy/Shaders/Definition/WeightedBlend.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 1c020b14e4874b34a9c3fba16b18a476 +timeCreated: 1429839492 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/Feature.meta b/Assets/Alloy/Shaders/Feature.meta new file mode 100644 index 0000000..a90cac5 --- /dev/null +++ b/Assets/Alloy/Shaders/Feature.meta @@ -0,0 +1,6 @@ +fileFormatVersion: 2 +guid: 34225f29be0fb2a408472ffa73164c62 +folderAsset: yes +DefaultImporter: + userData: + assetBundleName: diff --git a/Assets/Alloy/Shaders/Feature/AO2.cginc b/Assets/Alloy/Shaders/Feature/AO2.cginc new file mode 100644 index 0000000..6992024 --- /dev/null +++ b/Assets/Alloy/Shaders/Feature/AO2.cginc @@ -0,0 +1,44 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file AO2.cginc +/// @brief Secondary Ambient Occlusion, possibly on a different UV. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_FEATURE_AO2_CGINC +#define ALLOY_SHADERS_FEATURE_AO2_CGINC + +#if !defined(A_AO2_ON) && defined(_AO2_ON) + #define A_AO2_ON +#endif + +#ifdef A_AO2_ON + #ifndef A_AMBIENT_OCCLUSION_ON + #define A_AMBIENT_OCCLUSION_ON + #endif +#endif + +#include "Assets/Alloy/Shaders/Framework/Feature.cginc" + +#ifdef A_AO2_ON + /// Secondary Ambient Occlusion map. + /// Expects an RGB map with sRGB sampling + A_SAMPLER_2D(_Ao2Map); + + /// Ambient Occlusion strength. + /// Expects values in the range [0,1]. + half _Ao2Occlusion; +#endif + +void aAo2( + inout ASurface s) +{ +#ifdef A_AO2_ON + float2 ao2Uv = A_TEX_TRANSFORM_UV(s, _Ao2Map); + s.ambientOcclusion *= aLerpOneTo(tex2D(_Ao2Map, ao2Uv).g, _Ao2Occlusion * s.mask); +#endif +} + +#endif // ALLOY_SHADERS_FEATURE_AO2_CGINC diff --git a/Assets/Alloy/Shaders/Feature/AO2.cginc.meta b/Assets/Alloy/Shaders/Feature/AO2.cginc.meta new file mode 100644 index 0000000..06bab30 --- /dev/null +++ b/Assets/Alloy/Shaders/Feature/AO2.cginc.meta @@ -0,0 +1,6 @@ +fileFormatVersion: 2 +guid: 26dd662bbb79c0e4a8a2ff89526035a4 +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: diff --git a/Assets/Alloy/Shaders/Feature/CarPaint.cginc b/Assets/Alloy/Shaders/Feature/CarPaint.cginc new file mode 100644 index 0000000..9e570e9 --- /dev/null +++ b/Assets/Alloy/Shaders/Feature/CarPaint.cginc @@ -0,0 +1,104 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file CarPaint.cginc +/// @brief View-dependent secondary color tint and metal flakes layers. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_FEATURE_CAR_PAINT_CGINC +#define ALLOY_SHADERS_FEATURE_CAR_PAINT_CGINC + +#ifdef A_CAR_PAINT_ON + #ifndef A_METALLIC_ON + #define A_METALLIC_ON + #endif + + #ifndef A_NORMAL_WORLD_ON + #define A_NORMAL_WORLD_ON + #endif + + #ifndef A_VIEW_DIR_WORLD_ON + #define A_VIEW_DIR_WORLD_ON + #endif +#endif + +#include "Assets/Alloy/Shaders/Framework/Feature.cginc" + +#ifdef A_CAR_PAINT_ON + /// The primary paint tint color. + /// Expects a linear LDR color. + half3 _CarPrimaryColor; + + /// The secondary paint tint color. + /// Expects a linear LDR color. + half3 _CarSecondaryColor; + + /// The secondary paint tint color weight. + /// Expects values in the range [0,1]. + half _CarSecondaryColorWeight; + + /// Controls the width of the secondary paint tint color rim effect. + /// Expects values in the range [0,1]. + half _CarSecondaryColorFalloff; + + /// The metallic flake tint color. + /// Expects a linear LDR color. + half4 _CarFlakeColor; + + /// Metal flake color in RGB, and weight in A. + /// Expects an RGBA map with sRGB sampling. + A_SAMPLER_2D(_CarFlakeMap); + + /// Gamma applied to the metal flake weight map. + /// Expects values in the range [0.01,n]. + half _CarFlakeMapFalloff; + + /// The metal flake weight. + /// Expects values in the range [0,1]. + half _CarFlakeWeight; + + /// Controls the view-dependent spread of the metal flakes over the surface. + /// Expects values in the range [0,1]. + half _CarFlakeSpread; + + /// Controls the view-dependent spread of highlights over the metal flakes. + /// Expects values in the range [0,1]. + half _CarFlakeHighlightSpread; +#endif + +void aCarPaint( + inout ASurface s) +{ +#ifdef A_CAR_PAINT_ON + // Multi-layer car paint. + // cf http://www.elliottpacel.co.uk/blog/pbr-practice + // cf http://blenderartists.org/forum/showthread.php?250127-Car-Paint-Materials-Iridescent-Layers-Carbon-Fiber-Leather&p=2083499&viewfull=1#post2083499 + + // Two-Tone Paint + half secondaryColorFalloff = 1.0h - pow(s.NdotV, 0.1 + 9.9h * _CarSecondaryColorFalloff); + half secondaryColorWeight = _CarSecondaryColorWeight * secondaryColorFalloff; + half3 paintColor = lerp(_CarPrimaryColor, _CarSecondaryColor, secondaryColorWeight); + + s.baseColor *= aLerpWhiteTo(paintColor, s.mask); + + // Metal Flakes + // NOTE: Metal brightness will overpower clearcoat, hiding roughness difference. + float2 flakeUv = A_TEX_TRANSFORM_UV(s, _CarFlakeMap); + half4 flakes = _CarFlakeColor * tex2D(_CarFlakeMap, flakeUv); + half flakeMask = pow(flakes.a, _CarFlakeMapFalloff); + half flakeSpread = pow(s.NdotV, _CarFlakeSpread * -9.9h + 10.0h); //[10,0] + half flakeWeight = s.mask * flakeMask * flakeSpread * _CarFlakeWeight; + + s.baseColor = lerp(s.baseColor, flakes.rgb, flakeWeight); + s.metallic = lerp(s.metallic, 1.0h, flakeWeight); + s.roughness = lerp(s.roughness, 1.0h, flakeWeight * _CarFlakeHighlightSpread); + + // Clear Coat + // NOTE: Only added to metallic parts, as dielectrics already have it. + s.baseColor += aSpecularityToF0(s.mask * s.specularity * s.metallic); +#endif +} + +#endif // ALLOY_SHADERS_FEATURE_CAR_PAINT_CGINC diff --git a/Assets/Alloy/Shaders/Feature/CarPaint.cginc.meta b/Assets/Alloy/Shaders/Feature/CarPaint.cginc.meta new file mode 100644 index 0000000..e18bf9a --- /dev/null +++ b/Assets/Alloy/Shaders/Feature/CarPaint.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 49bf32b325f0e1f43b4cf4b06c157c38 +timeCreated: 1429971495 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/Feature/Decal.cginc b/Assets/Alloy/Shaders/Feature/Decal.cginc new file mode 100644 index 0000000..655d455 --- /dev/null +++ b/Assets/Alloy/Shaders/Feature/Decal.cginc @@ -0,0 +1,55 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file Decal.cginc +/// @brief Handles vertex-weighted alpha-blended decals. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_FEATURE_DECAL_CGINC +#define ALLOY_SHADERS_FEATURE_DECAL_CGINC + +#if !defined(A_DECAL_ON) && defined(_DECAL_ON) + #define A_DECAL_ON +#endif + +#include "Assets/Alloy/Shaders/Framework/Feature.cginc" + +#ifdef A_DECAL_ON + /// The decal tint color. + /// Expects a linear LDR color with alpha. + half4 _DecalColor; + + /// Decal texture. + /// Expects an RGBA map with sRGB sampling. + A_SAMPLER_2D(_DecalTex); + + /// Weight of the decal effect. + /// Expects values in the range [0,1]. + half _DecalWeight; + + /// The specularity that will be applied over the decal. + /// Expects values in the range [0,1]. + half _DecalSpecularity; + + /// Toggles tinting the decal alpha by the vertex alpha. + /// Expects values in the range [0,1]. + half _DecalAlphaVertexTint; +#endif + +void aDecal( + inout ASurface s) +{ +#ifdef A_DECAL_ON + float2 detailUv = A_TEX_TRANSFORM_UV(s, _DecalTex); + half4 decal = _DecalColor * tex2D(_DecalTex, detailUv); + half weight = s.mask * _DecalWeight * decal.a * aLerpOneTo(s.vertexColor.a, _DecalAlphaVertexTint); + + s.baseColor = lerp(s.baseColor, decal.rgb, weight); + s.metallic *= 1.0h - weight; + s.specularity = lerp(s.specularity, _DecalSpecularity, weight); +#endif +} + +#endif // ALLOY_SHADERS_FEATURE_DECAL_CGINC diff --git a/Assets/Alloy/Shaders/Feature/Decal.cginc.meta b/Assets/Alloy/Shaders/Feature/Decal.cginc.meta new file mode 100644 index 0000000..dded438 --- /dev/null +++ b/Assets/Alloy/Shaders/Feature/Decal.cginc.meta @@ -0,0 +1,6 @@ +fileFormatVersion: 2 +guid: 4656c3259023a1c4aa228ab121733f03 +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: diff --git a/Assets/Alloy/Shaders/Feature/Detail.cginc b/Assets/Alloy/Shaders/Feature/Detail.cginc new file mode 100644 index 0000000..563d3b5 --- /dev/null +++ b/Assets/Alloy/Shaders/Feature/Detail.cginc @@ -0,0 +1,96 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file Detail.cginc +/// @brief Surface detail materials and normals. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_FEATURE_DETAIL_CGINC +#define ALLOY_SHADERS_FEATURE_DETAIL_CGINC + +#if !defined(A_DETAIL_ON) && defined(_DETAIL_MULX2) + #define A_DETAIL_ON +#endif + +#if !defined(A_DETAIL_MASK_VERTEX_COLOR_ALPHA_ON) && defined(_NORMALMAP) + #define A_DETAIL_MASK_VERTEX_COLOR_ALPHA_ON +#endif + +#include "Assets/Alloy/Shaders/Framework/Feature.cginc" + +#ifdef A_DETAIL_ON + #ifndef A_DETAIL_MASK_OFF + /// Mask that controls the detail influence on the base material. + /// Expects an alpha data map. + sampler2D _DetailMask; + #endif + + /// Controls how much the vertex alpha masks the detail maps. + /// Expects values in the range [0,1]. + half _DetailMaskStrength; + + #ifndef A_DETAIL_COLOR_MAP_OFF + /// Detail base color blending mode. + /// Expects either 0 or 1. + float _DetailMode; + + /// Detail base color map. + /// Expects an RGB map with sRGB sampling. + A_SAMPLER_2D(_DetailAlbedoMap); + #endif + + #ifndef A_DETAIL_NORMAL_MAP_OFF + /// Detail normal map. + /// Expects a compressed normal map. + A_SAMPLER_2D(_DetailNormalMap); + #endif + + /// Controls the detail influence on the base material. + /// Expects values in the range [0,1]. + half _DetailWeight; + + #ifndef A_DETAIL_NORMAL_MAP_OFF + /// Normal map XY scale. + half _DetailNormalMapScale; + #endif +#endif + +void aDetail( + inout ASurface s) +{ +#ifdef A_DETAIL_ON + half mask = s.mask * _DetailWeight; + + #ifndef A_DETAIL_MASK_OFF + #ifdef A_DETAIL_MASK_VERTEX_COLOR_ALPHA_ON + half alpha = s.vertexColor.a; + #else + half alpha = tex2D(_DetailMask, s.baseUv).a; + #endif + + mask *= aLerpOneTo(alpha, _DetailMaskStrength); + #endif + + #ifndef A_DETAIL_COLOR_MAP_OFF + float2 detailUv = A_TEX_TRANSFORM_UV_SCROLL(s, _DetailAlbedoMap); + #else + float2 detailUv = A_TEX_TRANSFORM_UV_SCROLL(s, _DetailNormalMap); + #endif + + #ifndef A_DETAIL_COLOR_MAP_OFF + half3 detailAlbedo = tex2D(_DetailAlbedoMap, detailUv).rgb; + half3 colorScale = _DetailMode < 0.5f ? A_WHITE : unity_ColorSpaceDouble.rgb; + + s.baseColor *= aLerpWhiteTo(detailAlbedo * colorScale, mask); + #endif + + #ifndef A_DETAIL_NORMAL_MAP_OFF + half3 detailNormalTangent = UnpackScaleNormal(tex2D(_DetailNormalMap, detailUv), mask * _DetailNormalMapScale); + s.normalTangent = A_NT(s, BlendNormals(s.normalTangent, detailNormalTangent)); + #endif +#endif +} + +#endif // ALLOY_SHADERS_FEATURE_DETAIL_CGINC diff --git a/Assets/Alloy/Shaders/Feature/Detail.cginc.meta b/Assets/Alloy/Shaders/Feature/Detail.cginc.meta new file mode 100644 index 0000000..e1f922f --- /dev/null +++ b/Assets/Alloy/Shaders/Feature/Detail.cginc.meta @@ -0,0 +1,6 @@ +fileFormatVersion: 2 +guid: d8bd66578335a4341bd3117c16a356fd +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: diff --git a/Assets/Alloy/Shaders/Feature/DirectionalBlend.cginc b/Assets/Alloy/Shaders/Feature/DirectionalBlend.cginc new file mode 100644 index 0000000..fc7c365 --- /dev/null +++ b/Assets/Alloy/Shaders/Feature/DirectionalBlend.cginc @@ -0,0 +1,67 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file DirectionalBlend.cginc +/// @brief Allows blending based how much a normal faces a given direction. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_FEATURE_DIRECTIONAL_BLEND_CGINC +#define ALLOY_SHADERS_FEATURE_DIRECTIONAL_BLEND_CGINC + +#ifdef A_DIRECTIONAL_BLEND_ON + #ifndef _DIRECTIONALBLENDMODE_WORLD + #ifdef A_DIRECTIONAL_BLEND_MODE_OFF + #define _DIRECTIONALBLENDMODE_WORLD + #else + #define A_WORLD_TO_OBJECT_ON + #endif + #endif + + #ifndef A_NORMAL_WORLD_ON + #define A_NORMAL_WORLD_ON + #endif +#endif + +#include "Assets/Alloy/Shaders/Framework/Feature.cginc" + +#ifdef A_DIRECTIONAL_BLEND_ON + /// Direction around which the blending occurs. + /// Expects a normalized direction vector. + half3 _DirectionalBlendDirection; + + /// Directional Blend weight. + /// Expects values in the range [0,1]. + half _OrientedScale; + + /// Hemispherical cutoff where blend begins. + /// Expects values in the range [0,1]. + half _OrientedCutoff; + + /// Offset from cutoff where smooth blending occurs. + /// Expects values in the range [0.0001,1]. + half _OrientedBlend; + + /// Controls how much the vertex color alpha influences the cutoff. + /// Expects values in the range [0,1]. + half _DirectionalBlendAlphaVertexTint; +#endif + +void aDirectionalBlend( + inout ASurface s) +{ +#ifdef A_DIRECTIONAL_BLEND_ON + #ifdef _DIRECTIONALBLENDMODE_WORLD + half3 normal = s.normalWorld; + #else + half3 normal = UnityWorldToObjectDir(s.normalWorld); + #endif + + // Convert [-1,1] -> [1,0] to flip direction for free. + half mask = dot(normal, _DirectionalBlendDirection) * -0.5h + 0.5h; + aBlendRangeMask(s, mask, _OrientedScale, _OrientedCutoff, _OrientedBlend, _DirectionalBlendAlphaVertexTint); +#endif +} + +#endif // ALLOY_SHADERS_FEATURE_DIRECTIONAL_BLEND_CGINC diff --git a/Assets/Alloy/Shaders/Feature/DirectionalBlend.cginc.meta b/Assets/Alloy/Shaders/Feature/DirectionalBlend.cginc.meta new file mode 100644 index 0000000..157cf31 --- /dev/null +++ b/Assets/Alloy/Shaders/Feature/DirectionalBlend.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 0214d8d671f8fec40b5918f808135dda +timeCreated: 1429743781 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/Feature/Dissolve.cginc b/Assets/Alloy/Shaders/Feature/Dissolve.cginc new file mode 100644 index 0000000..c7c7e07 --- /dev/null +++ b/Assets/Alloy/Shaders/Feature/Dissolve.cginc @@ -0,0 +1,74 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file Dissolve.cginc +/// @brief Surface dissolve effects. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_FEATURE_DISSOLVE_CGINC +#define ALLOY_SHADERS_FEATURE_DISSOLVE_CGINC + +#if !defined(A_DISSOLVE_ON) && defined(_DISSOLVE_ON) + #define A_DISSOLVE_ON +#endif + +#ifdef A_DISSOLVE_ON + #ifndef A_OPACITY_MASK_ON + #define A_OPACITY_MASK_ON + #endif + + #ifndef A_EMISSIVE_COLOR_ON + #define A_EMISSIVE_COLOR_ON + #endif +#endif + +#include "Assets/Alloy/Shaders/Framework/Feature.cginc" + +#ifdef A_DISSOLVE_ON + /// Dissolve glow tint color. + /// Expects a linear HDR color with alpha. + half4 _DissolveGlowColor; + + /// Dissolve glow color with effect ramp in the alpha. + /// Expects an RGBA map with sRGB sampling. + A_SAMPLER_2D(_DissolveTex); + + /// The cutoff value for the dissolve effect in the ramp map. + /// Expects values in the range [0,1]. + half _DissolveCutoff; + + #ifndef A_DISSOLVE_GLOW_OFF + /// The weight of the dissolve glow effect. + /// Expects linear space value in the range [0,1]. + half _DissolveGlowWeight; + + /// The width of the dissolve glow effect. + /// Expects values in the range [0,1]. + half _DissolveEdgeWidth; + #endif +#endif + +void aDissolve( + inout ASurface s) +{ +#ifdef A_DISSOLVE_ON + float2 dissolveUv = A_TEX_TRANSFORM_UV(s, _DissolveTex); + half4 dissolveBase = _DissolveGlowColor * tex2D(_DissolveTex, dissolveUv); + half dissolveCutoff = s.mask * _DissolveCutoff; + half clipval = dissolveBase.a * 0.99h - dissolveCutoff; + + clip(clipval); // NOTE: Eliminates need for blend edge. + + #ifndef A_DISSOLVE_GLOW_OFF + // Dissolve glow + half3 glow = s.emissiveColor + dissolveBase.rgb * _DissolveGlowWeight; + + glow = clipval >= _DissolveEdgeWidth ? s.emissiveColor : glow; // Outer edge. + s.emissiveColor = dissolveCutoff < A_EPSILON ? s.emissiveColor : glow; // Kill when cutoff is zero. + #endif +#endif +} + +#endif // ALLOY_SHADERS_FEATURE_DISSOLVE_CGINC diff --git a/Assets/Alloy/Shaders/Feature/Dissolve.cginc.meta b/Assets/Alloy/Shaders/Feature/Dissolve.cginc.meta new file mode 100644 index 0000000..96514cc --- /dev/null +++ b/Assets/Alloy/Shaders/Feature/Dissolve.cginc.meta @@ -0,0 +1,6 @@ +fileFormatVersion: 2 +guid: 2d9fe839dda81834a8612d65d3dcdef5 +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: diff --git a/Assets/Alloy/Shaders/Feature/Emission.cginc b/Assets/Alloy/Shaders/Feature/Emission.cginc new file mode 100644 index 0000000..79e937a --- /dev/null +++ b/Assets/Alloy/Shaders/Feature/Emission.cginc @@ -0,0 +1,66 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file Emission.cginc +/// @brief Surface emission effects. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_FEATURE_EMISSION_CGINC +#define ALLOY_SHADERS_FEATURE_EMISSION_CGINC + +#if !defined(A_EMISSION_ON) && defined(_EMISSION) + #define A_EMISSION_ON +#endif + +#ifdef A_EMISSION_ON + #ifndef A_EMISSIVE_COLOR_ON + #define A_EMISSIVE_COLOR_ON + #endif +#endif + +#include "Assets/Alloy/Shaders/Framework/Feature.cginc" + +#ifdef A_EMISSION_ON + /// Emission tint color. + /// Expects a linear LDR color. + half3 _EmissionColor; + + #ifndef A_EMISSION_MASK_MAP_OFF + /// Emission mask texture. + /// Expects an RGB map with sRGB sampling. + sampler2D _EmissionMap; + #endif + + #ifndef A_EMISSION_EFFECTS_MAP_OFF + /// Emission effect texture. + /// Expects an RGB map with sRGB sampling. + A_SAMPLER_2D(_IncandescenceMap); + #endif + + /// The weight of the emission effect. + /// Expects linear space value in the range [0,1]. + half _EmissionWeight; +#endif + +void aEmission( + inout ASurface s) +{ +#ifdef A_EMISSION_ON + half3 emission = _EmissionColor; + + #ifndef A_EMISSION_MASK_MAP_OFF + emission *= tex2D(_EmissionMap, s.baseUv).rgb; + #endif + + #ifndef A_EMISSION_EFFECTS_MAP_OFF + float2 incandescenceUv = A_TEX_TRANSFORM_UV_SCROLL(s, _IncandescenceMap); + emission *= tex2D(_IncandescenceMap, incandescenceUv).rgb; + #endif + + s.emissiveColor += emission * (_EmissionWeight * s.mask); +#endif +} + +#endif // ALLOY_SHADERS_FEATURE_EMISSION_CGINC diff --git a/Assets/Alloy/Shaders/Feature/Emission.cginc.meta b/Assets/Alloy/Shaders/Feature/Emission.cginc.meta new file mode 100644 index 0000000..ea38b11 --- /dev/null +++ b/Assets/Alloy/Shaders/Feature/Emission.cginc.meta @@ -0,0 +1,6 @@ +fileFormatVersion: 2 +guid: 48469a9a682a0b643a5772eabe9dbee1 +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: diff --git a/Assets/Alloy/Shaders/Feature/Emission2.cginc b/Assets/Alloy/Shaders/Feature/Emission2.cginc new file mode 100644 index 0000000..94bde06 --- /dev/null +++ b/Assets/Alloy/Shaders/Feature/Emission2.cginc @@ -0,0 +1,66 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file Emission2.cginc +/// @brief Secondary emission effects. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_FEATURE_EMISSION2_CGINC +#define ALLOY_SHADERS_FEATURE_EMISSION2_CGINC + +#if !defined(A_EMISSION2_ON) && defined(_EMISSION2_ON) + #define A_EMISSION2_ON +#endif + +#ifdef A_EMISSION2_ON + #ifndef A_EMISSIVE_COLOR_ON + #define A_EMISSIVE_COLOR_ON + #endif +#endif + +#include "Assets/Alloy/Shaders/Framework/Feature.cginc" + +#ifdef A_EMISSION2_ON + /// Secondary emission tint color. + /// Expects a linear LDR color. + half3 _Emission2Color; + + #ifndef A_EMISSION2_MASK_MAP_OFF + //// Secondary emission mask texture. + /// Expects an RGB map with sRGB sampling. + sampler2D _EmissionMap2; + #endif + + #ifndef A_EMISSION2_EFFECTS_MAP_OFF + /// Secondary emission effect texture. + /// Expects an RGB map with sRGB sampling. + A_SAMPLER_2D(_IncandescenceMap2); + #endif + + /// The weight of the secondary emission effect. + /// Expects linear space value in the range [0,1]. + half _Emission2Weight; +#endif + +void aEmission2( + inout ASurface s) +{ +#ifdef A_EMISSION2_ON + half3 emission = _Emission2Color; + + #ifndef A_EMISSION2_MASK_MAP_OFF + emission *= tex2D(_EmissionMap2, s.baseUv).rgb; + #endif + + #ifndef A_EMISSION2_EFFECTS_MAP_OFF + float2 incandescenceUv2 = A_TEX_TRANSFORM_UV_SCROLL(s, _IncandescenceMap2); + emission *= tex2D(_IncandescenceMap2, incandescenceUv2).rgb; + #endif + + s.emissiveColor += emission * (_Emission2Weight * s.mask); +#endif +} + +#endif // ALLOY_SHADERS_FEATURE_EMISSION2_CGINC diff --git a/Assets/Alloy/Shaders/Feature/Emission2.cginc.meta b/Assets/Alloy/Shaders/Feature/Emission2.cginc.meta new file mode 100644 index 0000000..5c503b2 --- /dev/null +++ b/Assets/Alloy/Shaders/Feature/Emission2.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 6917272733d53ab408659b331bb657cd +timeCreated: 1429487905 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/Feature/Eye.cginc b/Assets/Alloy/Shaders/Feature/Eye.cginc new file mode 100644 index 0000000..b636804 --- /dev/null +++ b/Assets/Alloy/Shaders/Feature/Eye.cginc @@ -0,0 +1,131 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file Eye.cginc +/// @brief Eye parallax, layer control, etc. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_FEATURE_EYE_CGINC +#define ALLOY_SHADERS_FEATURE_EYE_CGINC + +#ifdef A_EYE_ON + #ifndef A_NORMAL_MAPPING_ON + #define A_NORMAL_MAPPING_ON + #endif + + #ifndef A_VIEW_DIR_TANGENT_ON + #define A_VIEW_DIR_TANGENT_ON + #endif +#endif + +#include "Assets/Alloy/Shaders/Framework/Feature.cginc" + +#ifdef A_EYE_ON + /// Cornea tint color. + /// Expects a linear LDR color. + half4 _CorneaColor; + + /// Cornea normal map. + /// Expects a compressed normal map. + sampler2D _CorneaNormalMap; + + /// Cornea specularity. + /// Expects values in the range [0,1]. + half _CorneaSpecularity; + + /// Cornea roughness. + /// Expects values in the range [0,1]. + half _CorneaRoughness; + + /// Cornea normal map XY scale. + half _CorneaNormalMapScale; + + /// Iris tint color. + /// Expects a linear LDR color. + half3 _IrisColor; + + /// Iris pupil dilation. + /// Expects values in the range [0,1]. + half _IrisPupilSize; + + /// Iris fake shadowing at grazing angles. + /// Expects values in the range [0.01,n]. + half _IrisShadowing; + + /// Iris fake scattering intensity. + /// Expects values in the range [0,n]. + half _IrisScatterIntensity; + + /// Iris fake scattering falloff. + /// Expects values in the range [0.01,n]. + half _IrisScatterPower; + + /// Schlera tint color. + /// Expects a linear LDR color. + half3 _ScleraColor; + + /// Schlera specularity. + /// Expects values in the range [0,1]. + half _ScleraSpecularity; + + /// Schlera roughness. + /// Expects values in the range [0,1]. + half _ScleraRoughness; + + /// Schlera normal map XY scale. + half _ScleraNormalMapScale; +#endif + +void aEye( + inout ASurface s) +{ +#ifdef A_EYE_ON + float2 baseUv = s.baseUv; + float4 uv = s.uv01; + + // Cornea "Refraction". + aParallaxOcclusionMapping(s, 10.0f, 25.0f); + + // Pupil Dilation + // HACK: Use the heightmap as the gradient, since it matches the other maps. + // http://www.polycount.com/forum/showpost.php?p=1511423&postcount=13 + half mask = 1.0h - aSampleHeight(s); + float2 centeredUv = frac(s.baseUv) + float2(-0.5f, -0.5f); + float2 dilationOffset = centeredUv * (mask * _IrisPupilSize); + + aParallaxOffset(s, -dilationOffset); + + // Materials. + half4 base = aSampleBase(s); + half irisMask = base.a; + s.baseColor = base.rgb; + + // Iris. + half3 irisBump = aSampleBumpScale(s, lerp(_ScleraNormalMapScale, 1.0h, irisMask)); + half irisNdotV = irisMask * aDotClamp(irisBump, s.viewDirTangent); + + irisBump = normalize(lerp(irisBump, A_FLAT_NORMAL, irisMask)); + s.baseColor += (_IrisScatterIntensity * pow(aLuminance(base) * irisNdotV, _IrisScatterPower)).rrr; + s.baseColor *= aLerpOneTo(pow(irisNdotV, _IrisShadowing), irisMask); + s.baseColor *= _Color * aBaseVertexColorTint(s) * lerp(_ScleraColor, _IrisColor, irisMask); + + // No Parallax. + s.baseUv = A_BV(s, baseUv); + s.uv01 = uv; + + // Cornea & Sclera. + half3 corneaBump = UnpackScaleNormal(tex2D(_CorneaNormalMap, s.baseUv), _CorneaNormalMapScale); + + s.baseColor = lerp(s.baseColor, _CorneaColor, irisMask * _CorneaColor.a); + s.specularity = lerp(_ScleraSpecularity, _CorneaSpecularity, irisMask); + s.roughness = lerp(_ScleraRoughness, _CorneaRoughness, irisMask); + s.normalTangent = A_NT(s, BlendNormals(irisBump, corneaBump)); + + // Iris mask on outside effects. + s.mask = 1.0h - irisMask; +#endif +} + +#endif // ALLOY_SHADERS_FEATURE_EYE_CGINC diff --git a/Assets/Alloy/Shaders/Feature/Eye.cginc.meta b/Assets/Alloy/Shaders/Feature/Eye.cginc.meta new file mode 100644 index 0000000..d5afec3 --- /dev/null +++ b/Assets/Alloy/Shaders/Feature/Eye.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 93f289c36f5ff0c49a8ec1866fa82592 +timeCreated: 1467936284 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/Feature/MainTextures.cginc b/Assets/Alloy/Shaders/Feature/MainTextures.cginc new file mode 100644 index 0000000..ac8df13 --- /dev/null +++ b/Assets/Alloy/Shaders/Feature/MainTextures.cginc @@ -0,0 +1,71 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file MainTextures.cginc +/// @brief Main set of textures. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_FEATURE_MAIN_TEXTURES_CGINC +#define ALLOY_SHADERS_FEATURE_MAIN_TEXTURES_CGINC + +#ifdef A_MAIN_TEXTURES_ON + #ifndef A_MAIN_TEXTURES_MATERIAL_MAP_OFF + #ifndef A_METALLIC_ON + #define A_METALLIC_ON + #endif + + #ifndef A_SPECULAR_TINT_ON + #define A_SPECULAR_TINT_ON + #endif + + #if !defined(A_AMBIENT_OCCLUSION_ON) && !defined(A_ROUGHNESS_SOURCE_BASE_COLOR_ALPHA) + #define A_AMBIENT_OCCLUSION_ON + #endif + #endif +#endif + +#include "Assets/Alloy/Shaders/Framework/Feature.cginc" + +void aMainTextures( + inout ASurface s) +{ +#ifdef A_MAIN_TEXTURES_ON + half4 tint = aBaseTint(s); + half4 base = aSampleBase(s); + + #ifdef A_ROUGHNESS_SOURCE_BASE_COLOR_ALPHA + s.baseColor = tint.rgb * base.rgb; + s.opacity = tint.a; + + s.metallic = _Metal; + s.ambientOcclusion = 1.0h; + s.specularity = _Specularity; + s.specularTint = _SpecularTint; + s.roughness = _Roughness * base.a; + #else + base *= tint; + s.baseColor = base.rgb; + s.opacity = base.a; + + #ifndef A_MAIN_TEXTURES_CUTOUT_OFF + aCutout(s); + #endif + + #ifndef A_MAIN_TEXTURES_MATERIAL_MAP_OFF + half4 material = aSampleMaterial(s); + + s.metallic = _Metal * material.A_METALLIC_CHANNEL; + s.ambientOcclusion = aLerpOneTo(material.A_AO_CHANNEL, _Occlusion); + s.specularity = _Specularity * material.A_SPECULARITY_CHANNEL; + s.specularTint = _SpecularTint; + s.roughness = _Roughness * material.A_ROUGHNESS_CHANNEL; + #endif + #endif + + s.normalTangent = A_NT(s, aSampleBump(s)); +#endif +} + +#endif // ALLOY_SHADERS_FEATURE_MAIN_TEXTURES_CGINC diff --git a/Assets/Alloy/Shaders/Feature/MainTextures.cginc.meta b/Assets/Alloy/Shaders/Feature/MainTextures.cginc.meta new file mode 100644 index 0000000..2ee4e09 --- /dev/null +++ b/Assets/Alloy/Shaders/Feature/MainTextures.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 443b9ecd2643e9847af7438c6e17824b +timeCreated: 1456687148 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/Feature/OrientedTextures.cginc b/Assets/Alloy/Shaders/Feature/OrientedTextures.cginc new file mode 100644 index 0000000..ca08e03 --- /dev/null +++ b/Assets/Alloy/Shaders/Feature/OrientedTextures.cginc @@ -0,0 +1,111 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file OrientedTextures.cginc +/// @brief Secondary set of textures using world/object position XZ as their UVs. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_FEATURE_ORIENTED_TEXTURES_CGINC +#define ALLOY_SHADERS_FEATURE_ORIENTED_TEXTURES_CGINC + +#ifdef A_ORIENTED_TEXTURES_ON + #ifndef A_TRIPLANAR_MAPPING_ON + #define A_TRIPLANAR_MAPPING_ON + #endif + + #ifndef _TRIPLANARMODE_WORLD + #define _TRIPLANARMODE_WORLD + #endif + + #ifndef A_NORMAL_WORLD_ON + #define A_NORMAL_WORLD_ON + #endif + + #ifndef A_POSITION_WORLD_ON + #define A_POSITION_WORLD_ON + #endif + + #ifndef A_METALLIC_ON + #define A_METALLIC_ON + #endif + + #ifndef A_SPECULAR_TINT_ON + #define A_SPECULAR_TINT_ON + #endif + + #if !defined(A_AMBIENT_OCCLUSION_ON) && !defined(A_ROUGHNESS_SOURCE_BASE_COLOR_ALPHA) + #define A_AMBIENT_OCCLUSION_ON + #endif +#endif + +#include "Assets/Alloy/Shaders/Framework/Feature.cginc" + +#ifdef A_ORIENTED_TEXTURES_ON + /// The world-oriented tint color. + /// Expects a linear LDR color with alpha. + half4 _OrientedColor; + + /// The world-oriented color map. + /// Expects an RGB(A) map with sRGB sampling. + A_SAMPLER_2D(_OrientedMainTex); + + /// The world-oriented packed material map. + /// Expects an RGBA data map. + sampler2D _OrientedMaterialMap; + + /// The world-oriented normal map. + /// Expects a compressed normal map. + sampler2D _OrientedBumpMap; + + /// Toggles tinting the world-oriented color by the vertex color. + /// Expects values in the range [0,1]. + half _OrientedColorVertexTint; + + /// The world-oriented metallic scale. + /// Expects values in the range [0,1]. + half _OrientedMetallic; + + /// The world-oriented specularity scale. + /// Expects values in the range [0,1]. + half _OrientedSpecularity; + + // Amount that f0 is tinted by the base color. + /// Expects values in the range [0,1]. + half _OrientedSpecularTint; + + /// The world-oriented roughness scale. + /// Expects values in the range [0,1]. + half _OrientedRoughness; + + /// Ambient Occlusion strength. + /// Expects values in the range [0,1]. + half _OrientedOcclusion; + + /// Normal map XY scale. + half _OrientedNormalMapScale; +#endif + +void aOrientedTextures( + inout ASurface s) +{ +#ifdef A_ORIENTED_TEXTURES_ON + ASplatContext sc = aNewSplatContext(s, 1.0h, 1.0f); + ASplat sp = aNewSplat(); + + sc.blend = A_ONE; + aTriPlanarY(sp, sc, A_SAMPLER_2D_INPUT(_OrientedMainTex), _OrientedMaterialMap, _OrientedBumpMap, _OrientedOcclusion, _OrientedNormalMapScale); + aSplatMaterial(sp, sc, _OrientedColor, _OrientedColorVertexTint, _OrientedMetallic, _OrientedSpecularity, _OrientedSpecularTint, _OrientedRoughness); + + #ifdef A_ORIENTED_TEXTURES_BLEND_OFF + aApplySplat(s, sp); + #elif defined(A_ORIENTED_TEXTURES_ALPHA_BLEND_OFF) + aBlendSplat(s, sp); + #else + aBlendSplatWithOpacity(s, sp); + #endif +#endif +} + +#endif // ALLOY_SHADERS_FEATURE_ORIENTED_TEXTURES_CGINC diff --git a/Assets/Alloy/Shaders/Feature/OrientedTextures.cginc.meta b/Assets/Alloy/Shaders/Feature/OrientedTextures.cginc.meta new file mode 100644 index 0000000..bec8637 --- /dev/null +++ b/Assets/Alloy/Shaders/Feature/OrientedTextures.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 6036fb82bd94ea74bbe7382e28759d91 +timeCreated: 1429745916 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/Feature/Parallax.cginc b/Assets/Alloy/Shaders/Feature/Parallax.cginc new file mode 100644 index 0000000..e6d90e5 --- /dev/null +++ b/Assets/Alloy/Shaders/Feature/Parallax.cginc @@ -0,0 +1,47 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file Parallax.cginc +/// @brief Surface heightmap-based texcoord modification. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_FEATURE_PARALLAX_CGINC +#define ALLOY_SHADERS_FEATURE_PARALLAX_CGINC + +#if !defined(A_PARALLAX_ON) && defined(_PARALLAXMAP) + #define A_PARALLAX_ON +#endif + +#ifdef A_PARALLAX_ON + #ifndef A_VIEW_DIR_TANGENT_ON + #define A_VIEW_DIR_TANGENT_ON + #endif +#endif + +#include "Assets/Alloy/Shaders/Framework/Feature.cginc" + +#ifdef A_PARALLAX_ON + /// Number of samples used for direct view of POM effect. + /// Expects values in the range [1,n]. + float _MinSamples; + + /// Number of samples used for grazing view of POM effect. + /// Expects values in the range [1,n]. + float _MaxSamples; +#endif + +void aParallax( + inout ASurface s) +{ +#ifdef A_PARALLAX_ON + #ifndef _BUMPMODE_POM + aOffsetBumpMapping(s); + #else + aParallaxOcclusionMapping(s, _MinSamples, _MaxSamples); + #endif +#endif +} + +#endif // ALLOY_SHADERS_FEATURE_PARALLAX_CGINC diff --git a/Assets/Alloy/Shaders/Feature/Parallax.cginc.meta b/Assets/Alloy/Shaders/Feature/Parallax.cginc.meta new file mode 100644 index 0000000..69fd8ed --- /dev/null +++ b/Assets/Alloy/Shaders/Feature/Parallax.cginc.meta @@ -0,0 +1,6 @@ +fileFormatVersion: 2 +guid: 40772d7597163a44895afaec77233382 +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: diff --git a/Assets/Alloy/Shaders/Feature/Puddles.cginc b/Assets/Alloy/Shaders/Feature/Puddles.cginc new file mode 100644 index 0000000..9423f29 --- /dev/null +++ b/Assets/Alloy/Shaders/Feature/Puddles.cginc @@ -0,0 +1,64 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file Puddles.cginc +/// @brief Handles all puddle material effects. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_FEATURE_PUDDLES_CGINC +#define ALLOY_SHADERS_FEATURE_PUDDLES_CGINC + +#if !defined(A_PUDDLES_ON) && defined(_PUDDLES_ON) + #define A_PUDDLES_ON +#endif + +#include "Assets/Alloy/Shaders/Framework/Feature.cginc" + +#ifdef A_PUDDLES_ON + A_SAMPLER_2D(_PuddlesRippleTex); + + // Mask + + half _PuddlesWeight; + + half _PuddlesRippleWeight; + + // Wetness + + // Wet Tint + + // Wet roughness. + + half _PuddlesLevel; + + // Puddle Roughness +#endif + +void aPuddles( + inout ASurface s) +{ +#ifdef A_PUDDLES_ON + half mask = _PuddlesWeight * s.vertexColor.a * s.mask; + + // Physically-based puddles. + // cf https://seblagarde.wordpress.com/2013/01/03/water-drop-2b-dynamic-rain-and-its-effects/ + + // Wetness + + // Unity uses a Left-handed axis, so it requires clumsy remapping. + //const half3x3 yTangentToWorld = half3x3(A_AXIS_X, A_AXIS_Z, s.vertexNormalWorld); + //float2 rippleUv = A_TEX_TRANSFORM_SCROLL(_RippleTex, s.positionWorld.xz); + //half3 ripples = lerp(A_FLAT_NORMAL, tex2D(_RippleTex, rippleUv) * 2.0h - 1.0h, _PuddlesRippleWeight); + + //ripples = mul(ripples, yTangentToWorld); + //ripples = aWorldToTangent(s, ripples); + + //half puddles = _PuddlesLevel * mask; + + //s.normalTangent = A_NT(s, normalize(lerp(s.normalTangent, ripples, puddles))); +#endif +} + +#endif // ALLOY_SHADERS_FEATURE_PUDDLES_CGINC diff --git a/Assets/Alloy/Shaders/Feature/Puddles.cginc.meta b/Assets/Alloy/Shaders/Feature/Puddles.cginc.meta new file mode 100644 index 0000000..3678310 --- /dev/null +++ b/Assets/Alloy/Shaders/Feature/Puddles.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 2284f1b75bd3e0643b4c7fc387b9574a +timeCreated: 1470010611 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/Feature/Rim.cginc b/Assets/Alloy/Shaders/Feature/Rim.cginc new file mode 100644 index 0000000..eb46ac3 --- /dev/null +++ b/Assets/Alloy/Shaders/Feature/Rim.cginc @@ -0,0 +1,72 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file Rim.cginc +/// @brief Rim lighting effects. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_FEATURE_RIM_CGINC +#define ALLOY_SHADERS_FEATURE_RIM_CGINC + +#if !defined(A_RIM_ON) && defined(_RIM_ON) + #define A_RIM_ON +#endif + +#ifdef A_RIM_ON + #ifndef A_NORMAL_WORLD_ON + #define A_NORMAL_WORLD_ON + #endif + + #ifndef A_VIEW_DIR_WORLD_ON + #define A_VIEW_DIR_WORLD_ON + #endif + + #ifndef A_EMISSIVE_COLOR_ON + #define A_EMISSIVE_COLOR_ON + #endif +#endif + +#include "Assets/Alloy/Shaders/Framework/Feature.cginc" + +#ifdef A_RIM_ON + /// Rim lighting tint color. + /// Expects a linear HDR color. + half3 _RimColor; + + #ifndef A_RIM_EFFECTS_MAP_OFF + /// Rim effect texture. + /// Expects an RGB map with sRGB sampling. + A_SAMPLER_2D(_RimTex); + #endif + + /// The weight of the rim lighting effect. + /// Expects linear space value in the range [0,1]. + half _RimWeight; + + /// Fills in the center of the rim lighting effect. + /// Expects linear-space values in the range [0,1]. + half _RimBias; + + /// Controls the falloff of the rim lighting effect. + /// Expects values in the range [0.01,n]. + half _RimPower; +#endif + +void aRim( + inout ASurface s) +{ +#ifdef A_RIM_ON + half3 rim = _RimColor; + + #ifndef A_RIM_EFFECTS_MAP_OFF + float2 rimUv = A_TEX_TRANSFORM_UV_SCROLL(s, _RimTex); + rim *= tex2D(_RimTex, rimUv).rgb; + #endif + + s.emissiveColor += rim * aRimLight(_RimWeight * s.mask, _RimBias, _RimPower, s.NdotV); +#endif +} + +#endif // ALLOY_SHADERS_FEATURE_RIM_CGINC diff --git a/Assets/Alloy/Shaders/Feature/Rim.cginc.meta b/Assets/Alloy/Shaders/Feature/Rim.cginc.meta new file mode 100644 index 0000000..22df611 --- /dev/null +++ b/Assets/Alloy/Shaders/Feature/Rim.cginc.meta @@ -0,0 +1,6 @@ +fileFormatVersion: 2 +guid: bd3768b8012337f44875c64f6d4cf535 +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: diff --git a/Assets/Alloy/Shaders/Feature/Rim2.cginc b/Assets/Alloy/Shaders/Feature/Rim2.cginc new file mode 100644 index 0000000..0a2be29 --- /dev/null +++ b/Assets/Alloy/Shaders/Feature/Rim2.cginc @@ -0,0 +1,72 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file Rim2.cginc +/// @brief Secondary rim lighting effects. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_FEATURE_RIM2_CGINC +#define ALLOY_SHADERS_FEATURE_RIM2_CGINC + +#if !defined(A_RIM2_ON) && defined(_RIM2_ON) + #define A_RIM2_ON +#endif + +#ifdef A_RIM2_ON + #ifndef A_NORMAL_WORLD_ON + #define A_NORMAL_WORLD_ON + #endif + + #ifndef A_VIEW_DIR_WORLD_ON + #define A_VIEW_DIR_WORLD_ON + #endif + + #ifndef A_EMISSIVE_COLOR_ON + #define A_EMISSIVE_COLOR_ON + #endif +#endif + +#include "Assets/Alloy/Shaders/Framework/Feature.cginc" + +#ifdef A_RIM2_ON + /// Secondary rim lighting tint color. + /// Expects a linear HDR color. + half3 _Rim2Color; + + #ifndef A_RIM2_EFFECTS_MAP_OFF + /// Secondary rim effect texture. + /// Expects an RGB map with sRGB sampling. + A_SAMPLER_2D(_RimTex2); + #endif + + /// The weight of the secondary rim lighting effect. + /// Expects linear space value in the range [0,1]. + half _Rim2Weight; + + /// Fills in the center of the secondary rim lighting effect. + /// Expects linear-space values in the range [0,1]. + half _Rim2Bias; + + /// Controls the falloff of the secondary rim lighting effect. + /// Expects values in the range [0.01,n]. + half _Rim2Power; +#endif + +void aRim2( + inout ASurface s) +{ +#ifdef A_RIM2_ON + half3 rim = _Rim2Color; + + #ifndef A_RIM2_EFFECTS_MAP_OFF + float2 rimUv2 = A_TEX_TRANSFORM_UV_SCROLL(s, _RimTex2); + rim *= tex2D(_RimTex2, rimUv2).rgb; + #endif + + s.emissiveColor += rim * aRimLight(_Rim2Weight * s.mask, _Rim2Bias, _Rim2Power, s.NdotV); +#endif +} + +#endif // ALLOY_SHADERS_FEATURE_RIM2_CGINC diff --git a/Assets/Alloy/Shaders/Feature/Rim2.cginc.meta b/Assets/Alloy/Shaders/Feature/Rim2.cginc.meta new file mode 100644 index 0000000..00f8509 --- /dev/null +++ b/Assets/Alloy/Shaders/Feature/Rim2.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 2d9c9b283ffc148428d0b7dcb671d75a +timeCreated: 1429487905 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/Feature/SecondaryTextures.cginc b/Assets/Alloy/Shaders/Feature/SecondaryTextures.cginc new file mode 100644 index 0000000..9cf813c --- /dev/null +++ b/Assets/Alloy/Shaders/Feature/SecondaryTextures.cginc @@ -0,0 +1,97 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file SecondaryTextures.cginc +/// @brief Secondary set of textures. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_FEATURE_SECONDARY_TEXTURES_CGINC +#define ALLOY_SHADERS_FEATURE_SECONDARY_TEXTURES_CGINC + +#ifdef A_SECONDARY_TEXTURES_ON + #ifndef A_METALLIC_ON + #define A_METALLIC_ON + #endif + + #ifndef A_SPECULAR_TINT_ON + #define A_SPECULAR_TINT_ON + #endif + + #if !defined(A_AMBIENT_OCCLUSION_ON) && !defined(A_ROUGHNESS_SOURCE_BASE_COLOR_ALPHA) + #define A_AMBIENT_OCCLUSION_ON + #endif +#endif + +#include "Assets/Alloy/Shaders/Framework/Feature.cginc" + +#ifdef A_SECONDARY_TEXTURES_ON + /// The secondary tint color. + /// Expects a linear LDR color with alpha. + half4 _Color2; + + /// The secondary color map. + /// Expects an RGB(A) map with sRGB sampling. + A_SAMPLER_2D(_MainTex2); + + /// The secondary packed material map. + /// Expects an RGBA data map. + sampler2D _MaterialMap2; + + /// The secondary normal map. + /// Expects a compressed normal map. + sampler2D _BumpMap2; + + /// Toggles tinting the secondary color by the vertex color. + /// Expects values in the range [0,1]. + half _BaseColorVertexTint2; + + /// The secondary metallic scale. + /// Expects values in the range [0,1]. + half _Metallic2; + + /// The secondary specularity scale. + /// Expects values in the range [0,1]. + half _Specularity2; + + // Amount that f0 is tinted by the base color. + /// Expects values in the range [0,1]. + half _SpecularTint2; + + /// The secondary roughness scale. + /// Expects values in the range [0,1]. + half _Roughness2; + + /// Ambient Occlusion strength. + /// Expects values in the range [0,1]. + half _Occlusion2; + + /// Normal map XY scale. + half _BumpScale2; +#endif + +void aSecondaryTextures( + inout ASurface s) +{ +#ifdef A_SECONDARY_TEXTURES_ON + ASplatContext sc = aNewSplatContext(s, 1.0h, 1.0f); + ASplat sp = aNewSplat(sc, A_SAMPLER_2D_INPUT(_MainTex2), _MaterialMap2, _BumpMap2, _Color2, _BaseColorVertexTint2, _Metallic2, _Specularity2, _SpecularTint2, _Roughness2, _Occlusion2, _BumpScale2); + + #ifdef A_SECONDARY_TEXTURES_ALPHA_BLEND_OFF + aBlendSplat(s, sp); + #else + aBlendSplatWithOpacity(s, sp); + #endif + + // NOTE: These are applied in here so we can use baseUv2. + float2 baseUv = s.baseUv; + + s.baseUv = A_BV(s, sp.baseUv); + aEmission2(s); + aRim2(s); + s.baseUv = A_BV(s, baseUv); +#endif +} + +#endif // ALLOY_SHADERS_FEATURE_SECONDARY_TEXTURES_CGINC diff --git a/Assets/Alloy/Shaders/Feature/SecondaryTextures.cginc.meta b/Assets/Alloy/Shaders/Feature/SecondaryTextures.cginc.meta new file mode 100644 index 0000000..782d937 --- /dev/null +++ b/Assets/Alloy/Shaders/Feature/SecondaryTextures.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 07856fd9f4cd69146ab3ecb6ecc7ff7e +timeCreated: 1429755843 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/Feature/SkinTextures.cginc b/Assets/Alloy/Shaders/Feature/SkinTextures.cginc new file mode 100644 index 0000000..25a78b9 --- /dev/null +++ b/Assets/Alloy/Shaders/Feature/SkinTextures.cginc @@ -0,0 +1,58 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file SkinTextures.cginc +/// @brief Main set of textures for Skin shaders. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_FEATURE_SKIN_TEXTURES_CGINC +#define ALLOY_SHADERS_FEATURE_SKIN_TEXTURES_CGINC + +#ifdef A_SKIN_TEXTURES_ON + #ifndef A_METALLIC_ON + #define A_METALLIC_ON + #endif + + #ifndef A_AMBIENT_OCCLUSION_ON + #define A_AMBIENT_OCCLUSION_ON + #endif + + #ifndef A_SUBSURFACE_ON + #define A_SUBSURFACE_ON + #endif + + #ifndef A_SCATTERING_ON + #define A_SCATTERING_ON + #endif +#endif + +#include "Assets/Alloy/Shaders/Framework/Feature.cginc" + +void aSkinTextures( + inout ASurface s) +{ +#ifdef A_SKIN_TEXTURES_ON + half4 base = aBase(s); + + s.baseColor = base.rgb; + s.subsurface = A_SS(s, base.a); + s.opacity = 1.0h - base.a; + aCutout(s); + + half4 material = aSampleMaterial(s); + + s.metallic = _Metal * material.A_METALLIC_CHANNEL; + s.ambientOcclusion = aLerpOneTo(material.A_AO_CHANNEL, _Occlusion); + s.specularity = _Specularity * material.A_SPECULARITY_CHANNEL; + s.roughness = _Roughness * material.A_ROUGHNESS_CHANNEL; + + // Jon Moore recommends a mip bias of 3.0 for blurred skin normals. + // http://www.gamasutra.com/view/news/128934/Indepth_Skin_shading_in_Unity3D.php + s.normalTangent = A_NT(s, aSampleBump(s)); + s.blurredNormalTangent = aSampleBumpBias(s, 3.0f); +#endif +} + +#endif // ALLOY_SHADERS_FEATURE_SKIN_TEXTURES_CGINC diff --git a/Assets/Alloy/Shaders/Feature/SkinTextures.cginc.meta b/Assets/Alloy/Shaders/Feature/SkinTextures.cginc.meta new file mode 100644 index 0000000..2454234 --- /dev/null +++ b/Assets/Alloy/Shaders/Feature/SkinTextures.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 41b715d6578f2634d905d9f57e4571c6 +timeCreated: 1477401865 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/Feature/SpeedTree.cginc b/Assets/Alloy/Shaders/Feature/SpeedTree.cginc new file mode 100644 index 0000000..6bbee78 --- /dev/null +++ b/Assets/Alloy/Shaders/Feature/SpeedTree.cginc @@ -0,0 +1,105 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file SpeedTree.cginc +/// @brief SpeedTree standard material properties. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_FEATURE_SPEED_TREE_CGINC +#define ALLOY_SHADERS_FEATURE_SPEED_TREE_CGINC + +#ifdef A_SPEED_TREE_ON + // NOTE: AO on/off determined by matching SpeedTree(Billboard) Model. + + #if defined(GEOM_TYPE_FROND) || defined(GEOM_TYPE_LEAF) || defined(GEOM_TYPE_FACING_LEAF) + #ifndef _ALPHATEST_ON + #define _ALPHATEST_ON + #endif + + #ifndef A_TWO_SIDED_SHADER + #define A_TWO_SIDED_SHADER + #endif + + #ifndef A_SUBSURFACE_ON + #define A_SUBSURFACE_ON + #endif + #endif +#endif + +#include "Assets/Alloy/Shaders/Framework/Feature.cginc" + +#ifdef A_SPEED_TREE_ON + #ifdef GEOM_TYPE_BRANCH_DETAIL + sampler2D _DetailTex; + + sampler2D _DetailNormalMap; + #endif + + #ifdef EFFECT_HUE_VARIATION + half4 _HueVariation; + #endif + + #ifdef A_SUBSURFACE_ON + /// Transmission tint color. + /// Expects a linear LDR color. + half3 _TransColor; + + /// Transmission color * thickness texture. + /// Expects an RGB map with sRGB sampling. + sampler2D _TransTex; + + /// Weight of the transmission effect. + /// Expects gamma-space values in the range [0,1]. + half _TransScale; + #endif +#endif + +void aSpeedTree( + inout ASurface s) +{ +#ifdef A_SPEED_TREE_ON + half4 base = aSampleBase(s); + + s.baseColor = base.rgb; + s.opacity = _Color.a * base.a; + aCutout(s); + + // AO content depends on matching Model header. + s.ambientOcclusion = s.vertexColor.r; + s.normalTangent = A_NT(s, aSampleBump(s)); + + #ifdef A_SUBSURFACE_ON + s.subsurface = A_SS(s, _TransScale * tex2D(_TransTex, s.baseUv).a); + s.subsurfaceColor *= _TransColor; + #endif + + #ifdef GEOM_TYPE_BRANCH_DETAIL + half4 detailColor = tex2D(_DetailTex, s.uv01.zw); + half weight = s.vertexColor.g < 2.0f ? saturate(s.vertexColor.g) : detailColor.a; + + s.baseColor = lerp(s.baseColor, detailColor.rgb, weight); + + half3 detailNormals = UnpackScaleNormal(tex2D(_DetailNormalMap, s.uv01.zw), weight); + s.normalTangent = A_NT(s, BlendNormals(s.normalTangent, detailNormals)); + #endif + + #ifdef EFFECT_HUE_VARIATION + half3 shiftedColor = lerp(s.baseColor, _HueVariation.rgb, s.vertexColor.b); + half maxBase = max(s.baseColor.r, max(s.baseColor.g, s.baseColor.b)); + half newMaxBase = max(shiftedColor.r, max(shiftedColor.g, shiftedColor.b)); + + maxBase /= newMaxBase; + maxBase = maxBase * 0.5f + 0.5f; + + // preserve vibrance + shiftedColor.rgb *= maxBase; + s.baseColor = saturate(shiftedColor); + #endif + + s.baseColor *= _Color.rgb; +#endif +} + +#endif // ALLOY_SHADERS_FEATURE_SPEED_TREE_CGINC diff --git a/Assets/Alloy/Shaders/Feature/SpeedTree.cginc.meta b/Assets/Alloy/Shaders/Feature/SpeedTree.cginc.meta new file mode 100644 index 0000000..4531568 --- /dev/null +++ b/Assets/Alloy/Shaders/Feature/SpeedTree.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 18ae5991297c6154b9c6ae35e79d210c +timeCreated: 1462649829 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/Feature/TeamColor.cginc b/Assets/Alloy/Shaders/Feature/TeamColor.cginc new file mode 100644 index 0000000..7d261e9 --- /dev/null +++ b/Assets/Alloy/Shaders/Feature/TeamColor.cginc @@ -0,0 +1,71 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file TeamColor.cginc +/// @brief Team Color via texture color component masks and per-mask tint colors. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_FEATURE_TEAMCOLOR_CGINC +#define ALLOY_SHADERS_FEATURE_TEAMCOLOR_CGINC + +#if !defined(A_TEAMCOLOR_ON) && defined(_TEAMCOLOR_ON) + #define A_TEAMCOLOR_ON +#endif + +#include "Assets/Alloy/Shaders/Framework/Feature.cginc" + +#ifdef A_TEAMCOLOR_ON + /// Toggles using the mask texture as a color tint. + /// Expects either 0 or 1. + float _TeamColorMasksAsTint; + + /// Mask map that stores a tint mask in each channel. + /// Expects an RGB(A) data map. + sampler2D _TeamColorMaskMap; + + /// Toggles which channels to use from the masks map. + /// Expects a vector where each component is either 0 or 1; + half4 _TeamColorMasks; + + /// The red channel mask tint color. + /// Expects a linear LDR color. + half3 _TeamColor0; + + /// The green channel mask tint color. + /// Expects a linear LDR color. + half3 _TeamColor1; + + /// The blue channel mask tint color. + /// Expects a linear LDR color. + half3 _TeamColor2; + + /// The alpha channel mask tint color. + /// Expects a linear LDR color. + half3 _TeamColor3; +#endif + +void aTeamColor( + inout ASurface s) +{ +#ifdef A_TEAMCOLOR_ON + half4 masksColor = tex2D(_TeamColorMaskMap, s.baseUv); + half4 masks = s.mask * (_TeamColorMasks * masksColor); + half weight = dot(masks, A_ONE4); + + // Renormalize masks when their combined weight sums to greater than one. + masks /= max(1.0h, weight); + + // Combine colors, then fill to white where weights sum to less than one. + half3 teamColor = _TeamColor0 * masks.r + + _TeamColor1 * masks.g + + _TeamColor2 * masks.b + + _TeamColor3 * masks.a + + saturate(1.0h - weight).rrr; + + s.baseColor *= _TeamColorMasksAsTint < 0.5f ? teamColor : masksColor.rgb; +#endif +} + +#endif // ALLOY_SHADERS_FEATURE_TEAMCOLOR_CGINC diff --git a/Assets/Alloy/Shaders/Feature/TeamColor.cginc.meta b/Assets/Alloy/Shaders/Feature/TeamColor.cginc.meta new file mode 100644 index 0000000..5def8ce --- /dev/null +++ b/Assets/Alloy/Shaders/Feature/TeamColor.cginc.meta @@ -0,0 +1,6 @@ +fileFormatVersion: 2 +guid: 1b62132a7383f004fb2fcc4110d1bf2a +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: diff --git a/Assets/Alloy/Shaders/Feature/Terrain.cginc b/Assets/Alloy/Shaders/Feature/Terrain.cginc new file mode 100644 index 0000000..49bfd18 --- /dev/null +++ b/Assets/Alloy/Shaders/Feature/Terrain.cginc @@ -0,0 +1,129 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file Terrain.cginc +/// @brief Unity terrain mapping. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_FEATURE_TERRAIN_CGINC +#define ALLOY_SHADERS_FEATURE_TERRAIN_CGINC + +#ifdef A_TERRAIN_ON + #ifndef A_ROUGHNESS_SOURCE_BASE_COLOR_ALPHA + #define A_ROUGHNESS_SOURCE_BASE_COLOR_ALPHA + #endif + + #ifndef A_TERRAIN_DISTANT + #ifndef A_VIEW_DEPTH_ON + #define A_VIEW_DEPTH_ON + #endif + #else + // Needed for detail normal map. + #ifndef A_NORMAL_MAPPING_ON + #define A_NORMAL_MAPPING_ON + #endif + #endif + + #ifndef A_METALLIC_ON + #define A_METALLIC_ON + #endif + + #ifndef A_SPECULAR_TINT_ON + #define A_SPECULAR_TINT_ON + #endif +#endif + +#include "Assets/Alloy/Shaders/Framework/Feature.cginc" + +#ifdef A_TERRAIN_ON + #ifdef A_TERRAIN_DISTANT + sampler2D _MetallicTex; + #else + A_SAMPLER_2D(_Control); + half _TriplanarBlendSharpness; + + A_SAMPLER_2D(_Splat0); + sampler2D _Normal0; + half _Metallic0; + half _SplatSpecularity0; + half _SplatSpecularTint0; + + A_SAMPLER_2D(_Splat1); + sampler2D _Normal1; + half _Metallic1; + half _SplatSpecularity1; + half _SplatSpecularTint1; + + A_SAMPLER_2D(_Splat2); + sampler2D _Normal2; + half _Metallic2; + half _SplatSpecularity2; + half _SplatSpecularTint2; + + A_SAMPLER_2D(_Splat3); + sampler2D _Normal3; + half _Metallic3; + half _SplatSpecularity3; + half _SplatSpecularTint3; + + half _FadeDist; + half _FadeRange; + #endif + + half _DistantSpecularity; + half _DistantSpecularTint; + half _DistantRoughness; +#endif + +void aTerrain( + inout ASurface s) +{ +#ifdef A_TERRAIN_ON + #ifdef A_TERRAIN_DISTANT + half4 col = aSampleBase(s); + + s.baseColor = col.rgb; + s.metallic = tex2D (_MetallicTex, s.baseUv).r; + s.specularity = _DistantSpecularity; + s.specularTint = _DistantSpecularTint; + s.roughness = col.a * _DistantRoughness; + #else + // Create a smooth blend between near and distant terrain to hide transition. + // NOTE: Can't kill specular completely since we have to worry about deferred. + half fade = saturate((s.viewDepth - _FadeDist) / _FadeRange); + half4 splatControl = tex2D(_Control, A_TEX_TRANSFORM(s, _Control)); + half weight = dot(splatControl, A_ONE4); + + #if !defined(SHADER_API_MOBILE) && defined(A_TERRAIN_NSPLAT_ADDPASS_SHADER) + clip(weight == 0.0f ? -1 : 1); + #endif + + // NOTE: 0.01 matches tiling of distant terrain combined maps. + ASplatContext sc = aNewSplatContext(s, _TriplanarBlendSharpness, 0.01f); + ASplat sp0 = aNewSplat(sc, A_SAMPLER_2D_INPUT(_Splat0), _Splat0, _Normal0, A_WHITE4, 0.0h, _Metallic0, _SplatSpecularity0, _SplatSpecularTint0, 1.0h, 1.0h, 1.0h); + ASplat sp1 = aNewSplat(sc, A_SAMPLER_2D_INPUT(_Splat1), _Splat1, _Normal1, A_WHITE4, 0.0h, _Metallic1, _SplatSpecularity1, _SplatSpecularTint1, 1.0h, 1.0h, 1.0h); + ASplat sp2 = aNewSplat(sc, A_SAMPLER_2D_INPUT(_Splat2), _Splat2, _Normal2, A_WHITE4, 0.0h, _Metallic2, _SplatSpecularity2, _SplatSpecularTint2, 1.0h, 1.0h, 1.0h); + ASplat sp3 = aNewSplat(sc, A_SAMPLER_2D_INPUT(_Splat3), _Splat3, _Normal3, A_WHITE4, 0.0h, _Metallic3, _SplatSpecularity3, _SplatSpecularTint3, 1.0h, 1.0h, 1.0h); + + splatControl /= (weight + A_EPSILON); + aApplyTerrainSplats(s, splatControl, sp0, sp1, sp2, sp3); + + #ifdef A_TERRAIN_NSPLAT_SHADER + s.specularity = _DistantSpecularity; + s.specularTint = _DistantSpecularTint; + #else + s.specularity = lerp(s.specularity, _DistantSpecularity, fade); + s.specularTint = lerp(s.specularTint, _DistantSpecularTint, fade); + #endif + + s.roughness *= aLerpOneTo(_DistantRoughness, fade); + s.normalTangent = A_NT(s, normalize(lerp(s.normalTangent, A_FLAT_NORMAL, fade))); + + s.opacity = weight; // Last to avoid being overwritten. + #endif +#endif +} + +#endif // ALLOY_SHADERS_FEATURE_TERRAIN_CGINC diff --git a/Assets/Alloy/Shaders/Feature/Terrain.cginc.meta b/Assets/Alloy/Shaders/Feature/Terrain.cginc.meta new file mode 100644 index 0000000..26aa33f --- /dev/null +++ b/Assets/Alloy/Shaders/Feature/Terrain.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 3c796aeac953f7b41b74f1fca8a41e59 +timeCreated: 1468173456 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/Feature/TransitionBlend.cginc b/Assets/Alloy/Shaders/Feature/TransitionBlend.cginc new file mode 100644 index 0000000..8bee84c --- /dev/null +++ b/Assets/Alloy/Shaders/Feature/TransitionBlend.cginc @@ -0,0 +1,65 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file TransitionBlend.cginc +/// @brief Blending using an alpha mask and a cutoff, with a glow effect. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_FEATURE_TRANSITION_BLEND_CGINC +#define ALLOY_SHADERS_FEATURE_TRANSITION_BLEND_CGINC + +#ifdef A_TRANSITION_BLEND_ON + #ifndef A_EMISSIVE_COLOR_ON + #define A_EMISSIVE_COLOR_ON + #endif +#endif + +#include "Assets/Alloy/Shaders/Framework/Feature.cginc" + +#ifdef A_TRANSITION_BLEND_ON + /// Transition glow tint color. + /// Expects a linear HDR color with alpha. + half4 _TransitionGlowColor; + + /// Transition glow color with effect ramp in the alpha. + /// Expects an RGBA map with sRGB sampling. + A_SAMPLER_2D(_TransitionTex); + + /// The cutoff value for the transition effect in the ramp map. + /// Expects values in the range [0,1]. + half _TransitionCutoff; + + #ifndef A_TRANSITION_BLEND_GLOW_OFF + /// The weight of the transition glow effect. + /// Expects linear space value in the range [0,1]. + half _TransitionGlowWeight; + + /// The width of the transition glow effect. + /// Expects values in the range [0,1]. + half _TransitionEdgeWidth; + #endif +#endif + +void aTransitionBlend( + inout ASurface s) +{ +#ifdef A_TRANSITION_BLEND_ON + float2 transitionUv = A_TEX_TRANSFORM_UV(s, _TransitionTex); + half4 transitionBase = _TransitionGlowColor * tex2D(_TransitionTex, transitionUv); + half clipval = transitionBase.a * 0.99h - _TransitionCutoff; + + s.mask = clipval >= 0 ? 0.0h : s.mask; + + #ifndef A_TRANSITION_BLEND_GLOW_OFF + // Transition glow + half3 glow = s.emissiveColor + transitionBase.rgb * _TransitionGlowWeight; + + glow = clipval >= _TransitionEdgeWidth ? s.emissiveColor : glow; // Outer edge. + s.emissiveColor = _TransitionCutoff < A_EPSILON ? s.emissiveColor : glow; // Kill when cutoff is zero. + #endif +#endif +} + +#endif // ALLOY_SHADERS_FEATURE_TRANSITION_BLEND_CGINC diff --git a/Assets/Alloy/Shaders/Feature/TransitionBlend.cginc.meta b/Assets/Alloy/Shaders/Feature/TransitionBlend.cginc.meta new file mode 100644 index 0000000..3f43ebe --- /dev/null +++ b/Assets/Alloy/Shaders/Feature/TransitionBlend.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: c1bf572183fb24d498a29832cce8c0a3 +timeCreated: 1429964722 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/Feature/Transmission.cginc b/Assets/Alloy/Shaders/Feature/Transmission.cginc new file mode 100644 index 0000000..30c125c --- /dev/null +++ b/Assets/Alloy/Shaders/Feature/Transmission.cginc @@ -0,0 +1,44 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file Transmission.cginc +/// @brief Basic transmission, handling render path differences. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_FEATURE_TRANSMISSION_CGINC +#define ALLOY_SHADERS_FEATURE_TRANSMISSION_CGINC + +#ifdef A_TRANSMISSION_ON + #ifndef A_SUBSURFACE_ON + #define A_SUBSURFACE_ON + #endif +#endif + +#include "Assets/Alloy/Shaders/Framework/Feature.cginc" + +#ifdef A_TRANSMISSION_ON + /// Transmission tint color. + /// Expects a linear LDR color. + half3 _TransColor; + + /// Transmission color * thickness texture. + /// Expects an RGB map with sRGB sampling. + sampler2D _TransTex; + + /// Weight of the transmission effect. + /// Expects linear-space values in the range [0,1]. + half _TransScale; +#endif + +void aTransmission( + inout ASurface s) +{ +#ifdef A_TRANSMISSION_ON + s.subsurfaceColor = A_SSC(s, _TransScale * tex2D(_TransTex, s.baseUv).rgb); + s.subsurfaceColor *= _TransColor; +#endif +} + +#endif // ALLOY_SHADERS_FEATURE_TRANSMISSION_CGINC diff --git a/Assets/Alloy/Shaders/Feature/Transmission.cginc.meta b/Assets/Alloy/Shaders/Feature/Transmission.cginc.meta new file mode 100644 index 0000000..92515ce --- /dev/null +++ b/Assets/Alloy/Shaders/Feature/Transmission.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 76933f9f19a25d0499212bf92af13044 +timeCreated: 1468011426 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/Feature/TriPlanar.cginc b/Assets/Alloy/Shaders/Feature/TriPlanar.cginc new file mode 100644 index 0000000..467f6c7 --- /dev/null +++ b/Assets/Alloy/Shaders/Feature/TriPlanar.cginc @@ -0,0 +1,146 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file TriPlanar.cginc +/// @brief TriPlanar mapping. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_FEATURE_TRIPLANAR_CGINC +#define ALLOY_SHADERS_FEATURE_TRIPLANAR_CGINC + +#ifdef A_TRIPLANAR_ON + #ifndef A_TRIPLANAR_MAPPING_ON + #define A_TRIPLANAR_MAPPING_ON + #endif + + #ifndef A_METALLIC_ON + #define A_METALLIC_ON + #endif + + #ifndef A_SPECULAR_TINT_ON + #define A_SPECULAR_TINT_ON + #endif + + #if !defined(A_AMBIENT_OCCLUSION_ON) && !defined(A_ROUGHNESS_SOURCE_BASE_COLOR_ALPHA) + #define A_AMBIENT_OCCLUSION_ON + #endif +#endif + +#include "Assets/Alloy/Shaders/Framework/Feature.cginc" + +#ifdef A_TRIPLANAR_ON + half _TriplanarBlendSharpness; + + half4 _PrimaryColor; + A_SAMPLER_2D(_PrimaryMainTex); + sampler2D _PrimaryMaterialMap; + sampler2D _PrimaryBumpMap; + half _PrimaryColorVertexTint; + half _PrimaryMetallic; + half _PrimarySpecularity; + half _PrimarySpecularTint; + half _PrimaryOcclusion; + half _PrimaryRoughness; + half _PrimaryBumpScale; + + #ifdef _SECONDARY_TRIPLANAR_ON + half4 _SecondaryColor; + A_SAMPLER_2D(_SecondaryMainTex); + sampler2D _SecondaryMaterialMap; + sampler2D _SecondaryBumpMap; + half _SecondaryColorVertexTint; + half _SecondaryMetallic; + half _SecondarySpecularity; + half _SecondarySpecularTint; + half _SecondaryOcclusion; + half _SecondaryRoughness; + half _SecondaryBumpScale; + #endif + + #ifdef _TERTIARY_TRIPLANAR_ON + half4 _TertiaryColor; + A_SAMPLER_2D(_TertiaryMainTex); + sampler2D _TertiaryMaterialMap; + sampler2D _TertiaryBumpMap; + half _TertiaryColorVertexTint; + half _TertiaryMetallic; + half _TertiarySpecularity; + half _TertiarySpecularTint; + half _TertiaryOcclusion; + half _TertiaryRoughness; + half _TertiaryBumpScale; + #endif + + #ifdef _QUATERNARY_TRIPLANAR_ON + half4 _QuaternaryColor; + A_SAMPLER_2D(_QuaternaryMainTex); + sampler2D _QuaternaryMaterialMap; + sampler2D _QuaternaryBumpMap; + half _QuaternaryColorVertexTint; + half _QuaternaryMetallic; + half _QuaternarySpecularity; + half _QuaternarySpecularTint; + half _QuaternaryRoughness; + half _QuaternaryOcclusion; + half _QuaternaryBumpScale; + #endif +#endif + +void aTriPlanar( + inout ASurface s) +{ +#ifdef A_TRIPLANAR_ON + ASplatContext sc = aNewSplatContext(s, _TriplanarBlendSharpness, 1.0h); + ASplat sp0 = aNewSplat(); + + #if 1 // PRIMARY + #if defined(_SECONDARY_TRIPLANAR_ON) || defined(_TERTIARY_TRIPLANAR_ON) + aTriPlanarPositiveY(sp0, sc, A_SAMPLER_2D_INPUT(_PrimaryMainTex), _PrimaryMaterialMap, _PrimaryBumpMap, _PrimaryOcclusion, _PrimaryBumpScale); + #else + aTriPlanarY(sp0, sc, A_SAMPLER_2D_INPUT(_PrimaryMainTex), _PrimaryMaterialMap, _PrimaryBumpMap, _PrimaryOcclusion, _PrimaryBumpScale); + #endif + #ifndef _SECONDARY_TRIPLANAR_ON + aTriPlanarX(sp0, sc, A_SAMPLER_2D_INPUT(_PrimaryMainTex), _PrimaryMaterialMap, _PrimaryBumpMap, _PrimaryOcclusion, _PrimaryBumpScale); + + #ifndef _QUATERNARY_TRIPLANAR_ON + aTriPlanarZ(sp0, sc, A_SAMPLER_2D_INPUT(_PrimaryMainTex), _PrimaryMaterialMap, _PrimaryBumpMap, _PrimaryOcclusion, _PrimaryBumpScale); + #endif + #endif + + aSplatMaterial(sp0, sc, _PrimaryColor, _PrimaryColorVertexTint, _PrimaryMetallic, _PrimarySpecularity, _PrimarySpecularTint, _PrimaryRoughness); + #endif + #ifdef _SECONDARY_TRIPLANAR_ON + ASplat sp1 = aNewSplat(); + aTriPlanarX(sp1, sc, A_SAMPLER_2D_INPUT(_SecondaryMainTex), _SecondaryMaterialMap, _SecondaryBumpMap, _SecondaryOcclusion, _SecondaryBumpScale); + + #ifndef _TERTIARY_TRIPLANAR_ON + aTriPlanarNegativeY(sp1, sc, A_SAMPLER_2D_INPUT(_SecondaryMainTex), _SecondaryMaterialMap, _SecondaryBumpMap, _SecondaryOcclusion, _SecondaryBumpScale); + #endif + #ifndef _QUATERNARY_TRIPLANAR_ON + aTriPlanarZ(sp1, sc, A_SAMPLER_2D_INPUT(_SecondaryMainTex), _SecondaryMaterialMap, _SecondaryBumpMap, _SecondaryOcclusion, _SecondaryBumpScale); + #endif + + aSplatMaterial(sp1, sc, _SecondaryColor, _SecondaryColorVertexTint, _SecondaryMetallic, _SecondarySpecularity, _SecondarySpecularTint, _SecondaryRoughness); + aMergeSplats(sp0, sp1); + #endif + #ifdef _TERTIARY_TRIPLANAR_ON + ASplat sp2 = aNewSplat(); + aTriPlanarNegativeY(sp2, sc, A_SAMPLER_2D_INPUT(_TertiaryMainTex), _TertiaryMaterialMap, _TertiaryBumpMap, _TertiaryOcclusion, _TertiaryBumpScale); + aSplatMaterial(sp2, sc, _TertiaryColor, _TertiaryColorVertexTint, _TertiaryMetallic, _TertiarySpecularity, _TertiarySpecularTint, _TertiaryRoughness); + aMergeSplats(sp0, sp2); + #endif + #ifdef _QUATERNARY_TRIPLANAR_ON + ASplat sp3 = aNewSplat(); + aTriPlanarZ(sp3, sc, A_SAMPLER_2D_INPUT(_QuaternaryMainTex), _QuaternaryMaterialMap, _QuaternaryBumpMap, _QuaternaryOcclusion, _QuaternaryBumpScale); + aSplatMaterial(sp3, sc, _QuaternaryColor, _QuaternaryColorVertexTint, _QuaternaryMetallic, _QuaternarySpecularity, _QuaternarySpecularTint, _QuaternaryRoughness); + aMergeSplats(sp0, sp3); + #endif + + aApplySplat(s, sp0); + aCutout(s); +#endif +} + +#endif // ALLOY_SHADERS_FEATURE_TRIPLANAR_CGINC diff --git a/Assets/Alloy/Shaders/Feature/TriPlanar.cginc.meta b/Assets/Alloy/Shaders/Feature/TriPlanar.cginc.meta new file mode 100644 index 0000000..946adc2 --- /dev/null +++ b/Assets/Alloy/Shaders/Feature/TriPlanar.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: df4fa77c31f768b498ff4092a03d54dd +timeCreated: 1468172538 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/Feature/VertexBlend.cginc b/Assets/Alloy/Shaders/Feature/VertexBlend.cginc new file mode 100644 index 0000000..d373f41 --- /dev/null +++ b/Assets/Alloy/Shaders/Feature/VertexBlend.cginc @@ -0,0 +1,113 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file VertexBlend.cginc +/// @brief 3-4 splat blending with vertex color weights. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_FEATURE_VERTEX_BLEND_CGINC +#define ALLOY_SHADERS_FEATURE_VERTEX_BLEND_CGINC + +#if !defined(A_ALPHA_SPLAT_ON) && defined(_SPECGLOSSMAP) + #define A_ALPHA_SPLAT_ON +#endif + +#ifdef A_VERTEX_BLEND_ON + #ifndef A_VERTEX_COLOR_IS_DATA + #define A_VERTEX_COLOR_IS_DATA + #endif + + #ifndef A_METALLIC_ON + #define A_METALLIC_ON + #endif + + #ifndef A_SPECULAR_TINT_ON + #define A_SPECULAR_TINT_ON + #endif + + #if !defined(A_AMBIENT_OCCLUSION_ON) && !defined(A_ROUGHNESS_SOURCE_BASE_COLOR_ALPHA) + #define A_AMBIENT_OCCLUSION_ON + #endif +#endif + +#include "Assets/Alloy/Shaders/Framework/Feature.cginc" + +#ifdef A_VERTEX_BLEND_ON + half _TriplanarBlendSharpness; + + half4 _Splat0Tint; + A_SAMPLER_2D(_Splat0); + sampler2D _MaterialMap0; + sampler2D _Normal0; + half _Metallic0; + half _SplatSpecularity0; + half _SplatSpecularTint0; + half _SplatRoughness0; + half _SplatOcclusion0; + half _SplatBumpScale0; + + half4 _Splat1Tint; + A_SAMPLER_2D(_Splat1); + sampler2D _MaterialMap1; + sampler2D _Normal1; + half _Metallic1; + half _SplatSpecularity1; + half _SplatSpecularTint1; + half _SplatRoughness1; + half _SplatOcclusion1; + half _SplatBumpScale1; + + half4 _Splat2Tint; + A_SAMPLER_2D(_Splat2); + sampler2D _MaterialMap2; + sampler2D _Normal2; + half _Metallic2; + half _SplatSpecularity2; + half _SplatSpecularTint2; + half _SplatRoughness2; + half _SplatOcclusion2; + half _SplatBumpScale2; + + #ifdef A_ALPHA_SPLAT_ON + half4 _Splat3Tint; + A_SAMPLER_2D(_Splat3); + sampler2D _MaterialMap3; + sampler2D _Normal3; + half _Metallic3; + half _SplatSpecularity3; + half _SplatSpecularTint3; + half _SplatRoughness3; + half _SplatOcclusion3; + half _SplatBumpScale3; + #endif +#endif + +void aVertexBlend( + inout ASurface s) +{ +#ifdef A_VERTEX_BLEND_ON + ASplatContext sc = aNewSplatContext(s, _TriplanarBlendSharpness, 1.0f); + ASplat sp0 = aNewSplat(sc, A_SAMPLER_2D_INPUT(_Splat0), _MaterialMap0, _Normal0, _Splat0Tint, 0.0h, _Metallic0, _SplatSpecularity0, _SplatSpecularTint0, _SplatRoughness0, _SplatOcclusion0, _SplatBumpScale0); + ASplat sp1 = aNewSplat(sc, A_SAMPLER_2D_INPUT(_Splat1), _MaterialMap1, _Normal1, _Splat1Tint, 0.0h, _Metallic1, _SplatSpecularity1, _SplatSpecularTint1, _SplatRoughness1, _SplatOcclusion1, _SplatBumpScale1); + ASplat sp2 = aNewSplat(sc, A_SAMPLER_2D_INPUT(_Splat2), _MaterialMap2, _Normal2, _Splat2Tint, 0.0h, _Metallic2, _SplatSpecularity2, _SplatSpecularTint2, _SplatRoughness2, _SplatOcclusion2, _SplatBumpScale2); + + #ifdef A_ALPHA_SPLAT_ON + half4 splatControl = s.vertexColor; + ASplat sp3 = aNewSplat(sc, A_SAMPLER_2D_INPUT(_Splat3), _MaterialMap3, _Normal3, _Splat3Tint, 0.0h, _Metallic3, _SplatSpecularity3, _SplatSpecularTint3, _SplatRoughness3, _SplatOcclusion3, _SplatBumpScale3); + + splatControl /= (dot(splatControl, A_ONE4) + A_EPSILON); + aApplyTerrainSplats(s, splatControl, sp0, sp1, sp2, sp3); + #else + half3 splatControl = s.vertexColor.xyz; + + splatControl /= (dot(splatControl, A_ONE) + A_EPSILON); + aApplyTerrainSplats(s, splatControl, sp0, sp1, sp2); + #endif + + aCutout(s); +#endif +} + +#endif // ALLOY_SHADERS_FEATURE_VERTEX_BLEND_CGINC diff --git a/Assets/Alloy/Shaders/Feature/VertexBlend.cginc.meta b/Assets/Alloy/Shaders/Feature/VertexBlend.cginc.meta new file mode 100644 index 0000000..88161e9 --- /dev/null +++ b/Assets/Alloy/Shaders/Feature/VertexBlend.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: b8f13d9e421ffde4aa730e71d0646108 +timeCreated: 1473017552 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/Feature/WeightedBlend.cginc b/Assets/Alloy/Shaders/Feature/WeightedBlend.cginc new file mode 100644 index 0000000..8f10bd0 --- /dev/null +++ b/Assets/Alloy/Shaders/Feature/WeightedBlend.cginc @@ -0,0 +1,48 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file WeightedBlend.cginc +/// @brief Blending with a heightmap, a cutoff value, and the vertex color alpha. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_FEATURE_WEIGHTED_BLEND_CGINC +#define ALLOY_SHADERS_FEATURE_WEIGHTED_BLEND_CGINC + +#include "Assets/Alloy/Shaders/Framework/Feature.cginc" + +#ifdef A_WEIGHTED_BLEND_ON + /// Heightmap used for blending. + /// Expects an RGB data map. + A_SAMPLER_2D(_BlendMap); + + /// Heightmap Blend weight. + /// Expects values in the range [0,1]. + half _BlendScale; + + /// Height cutoff where blend begins. + /// Expects values in the range [0,1]. + half _BlendCutoff; + + /// Offset from cutoff where smooth blending occurs. + /// Expects values in the range [0.0001,1]. + half _Blend; + + /// Controls how much the vertex color alpha influences the cutoff. + /// Expects values in the range [0,1]. + half _BlendAlphaVertexTint; +#endif + +void aHeightmapBlend( + inout ASurface s) +{ +#ifdef A_WEIGHTED_BLEND_ON + float2 blendUv = A_TEX_TRANSFORM_UV(s, _BlendMap); + half mask = tex2D(_BlendMap, blendUv).g; + + aBlendRangeMask(s, mask, _BlendScale, _BlendCutoff, _Blend, _BlendAlphaVertexTint); +#endif +} + +#endif // ALLOY_SHADERS_FEATURE_WEIGHTED_BLEND_CGINC diff --git a/Assets/Alloy/Shaders/Feature/WeightedBlend.cginc.meta b/Assets/Alloy/Shaders/Feature/WeightedBlend.cginc.meta new file mode 100644 index 0000000..b17709a --- /dev/null +++ b/Assets/Alloy/Shaders/Feature/WeightedBlend.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 4cb825adbb5a5a640acdf28fb71f9a6e +timeCreated: 1429839207 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/Feature/Wetness.cginc b/Assets/Alloy/Shaders/Feature/Wetness.cginc new file mode 100644 index 0000000..6c6e9ba --- /dev/null +++ b/Assets/Alloy/Shaders/Feature/Wetness.cginc @@ -0,0 +1,89 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file Wetness.cginc +/// @brief Handles all wet material effects. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_FEATURE_WETNESS_CGINC +#define ALLOY_SHADERS_FEATURE_WETNESS_CGINC + +#if !defined(A_WETNESS_ON) && defined(_WETNESS_ON) + #define A_WETNESS_ON +#endif + +#include "Assets/Alloy/Shaders/Framework/Feature.cginc" + +#ifdef A_WETNESS_ON + #ifndef A_WETNESS_MASK_OFF + /// Mask that controls the wetness influence on the base material. + /// Expects an alpha data map. + A_SAMPLER_2D(_WetMask); + #endif + + /// Controls how much the vertex alpha masks the detail maps. + /// Expects values in the range [0,1]. + half _WetMaskStrength; + + /// The tint color for liquid wetting the surface. + /// Expects a linear LDR color. + half3 _WetTint; + + #ifndef A_WETNESS_NORMAL_MAP_OFF + /// Wetness normal map. + /// Expects a compressed normal map. + A_SAMPLER_2D(_WetNormalMap); + #endif + + /// Controls the wetness influence on the base material. + /// Expects values in the range [0,1]. + half _WetWeight; + + /// The roughness for wet porous materials. + /// Expects values in the range [0,1]. + half _WetRoughness; + + #ifndef A_WETNESS_NORMAL_MAP_OFF + /// Normal map XY scale. + half _WetNormalMapScale; + #endif +#endif + +void aWetness( + inout ASurface s) +{ +#ifdef A_WETNESS_ON + half mask = s.mask * _WetWeight; + + #ifndef A_WETNESS_MASK_OFF + #ifdef _WETMASKSOURCE_VERTEXCOLORALPHA + half alpha = s.vertexColor.a; + #else + half alpha = tex2D(_WetMask, A_TEX_TRANSFORM_UV_SCROLL(s, _WetMask)).a; + #endif + + mask *= aLerpOneTo(alpha, _WetMaskStrength); + #endif + + // Physically-based wet surfaces. + // cf https://seblagarde.files.wordpress.com/2013/08/gdce13_lagarde_harduin_light.pdf pg 63 + half porosity = 1.0h; + + #ifndef A_WETNESS_POROSITY_OFF + porosity = (1.0h - s.metallic) * saturate(s.roughness * 2.5h - 1.25h); + #endif + + s.baseColor *= aLerpWhiteTo(_WetTint * aLerpOneTo(0.2h, porosity), mask); + s.roughness *= aLerpOneTo(_WetRoughness, aLerpOneTo(0.2h, 0.5h * porosity) * mask); + + #ifndef A_WETNESS_NORMAL_MAP_OFF + float2 normalUv = A_TEX_TRANSFORM_UV_SCROLL(s, _WetNormalMap); + half3 wetNormals = UnpackScaleNormal(tex2D(_WetNormalMap, normalUv), mask * _WetNormalMapScale); + s.normalTangent = A_NT(s, BlendNormals(s.normalTangent, wetNormals)); + #endif +#endif +} + +#endif // ALLOY_SHADERS_FEATURE_WETNESS_CGINC diff --git a/Assets/Alloy/Shaders/Feature/Wetness.cginc.meta b/Assets/Alloy/Shaders/Feature/Wetness.cginc.meta new file mode 100644 index 0000000..dee949c --- /dev/null +++ b/Assets/Alloy/Shaders/Feature/Wetness.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 206217fa75cf77d4680055f3a67639fd +timeCreated: 1468787829 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/Forward.meta b/Assets/Alloy/Shaders/Forward.meta new file mode 100644 index 0000000..be00b90 --- /dev/null +++ b/Assets/Alloy/Shaders/Forward.meta @@ -0,0 +1,6 @@ +fileFormatVersion: 2 +guid: 3a786917e867bb64598f06144d3b38e1 +folderAsset: yes +DefaultImporter: + userData: + assetBundleName: diff --git a/Assets/Alloy/Shaders/Forward/Add.cginc b/Assets/Alloy/Shaders/Forward/Add.cginc new file mode 100644 index 0000000..fcfdc82 --- /dev/null +++ b/Assets/Alloy/Shaders/Forward/Add.cginc @@ -0,0 +1,37 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file Add.cginc +/// @brief Forward add lighting pass vertex & fragment shaders. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_FORWARD_ADD_CGINC +#define ALLOY_SHADERS_FORWARD_ADD_CGINC + +#define A_TESSELLATION_PASS +#define A_NORMAL_MAPPED_PASS +#define A_PARALLAX_MAPPED_PASS +#define A_DIRECT_LIGHTING_PASS +#define A_VOLUMETRIC_PASS +#define A_ALPHA_BLENDING_PASS + +#include "Assets/Alloy/Shaders/Framework/Forward.cginc" + +void aMainVertexShader( + AVertexInput v, + out AFragmentInput o, + out float4 opos : SV_POSITION) +{ + aForwardVertexShader(v, o, opos); +} + +half4 aMainFragmentShader( + AFragmentInput i + A_FACING_SIGN_PARAM) : SV_Target +{ + return aForwardLitColorShader(i, A_FACING_SIGN); +} + +#endif // ALLOY_SHADERS_FORWARD_ADD_CGINC diff --git a/Assets/Alloy/Shaders/Forward/Add.cginc.meta b/Assets/Alloy/Shaders/Forward/Add.cginc.meta new file mode 100644 index 0000000..ca62301 --- /dev/null +++ b/Assets/Alloy/Shaders/Forward/Add.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 058d3393fb69e6d448c6d7d49a4e12f1 +timeCreated: 1450820201 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/Forward/Base.cginc b/Assets/Alloy/Shaders/Forward/Base.cginc new file mode 100644 index 0000000..76197b2 --- /dev/null +++ b/Assets/Alloy/Shaders/Forward/Base.cginc @@ -0,0 +1,41 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file Base.cginc +/// @brief Forward base lighting pass vertex & fragment shaders. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_FORWARD_BASE_CGINC +#define ALLOY_SHADERS_FORWARD_BASE_CGINC + +#define A_BASE_PASS +#define A_TESSELLATION_PASS +#define A_INSTANCING_PASS +#define A_STEREO_INSTANCING_PASS +#define A_NORMAL_MAPPED_PASS +#define A_PARALLAX_MAPPED_PASS +#define A_DIRECT_LIGHTING_PASS +#define A_INDIRECT_LIGHTING_PASS +#define A_VOLUMETRIC_PASS +#define A_ALPHA_BLENDING_PASS + +#include "Assets/Alloy/Shaders/Framework/Forward.cginc" + +void aMainVertexShader( + AVertexInput v, + out AFragmentInput o, + out float4 opos : SV_POSITION) +{ + aForwardVertexShader(v, o, opos); +} + +half4 aMainFragmentShader( + AFragmentInput i + A_FACING_SIGN_PARAM) : SV_Target +{ + return aForwardLitColorShader(i, A_FACING_SIGN); +} + +#endif // ALLOY_SHADERS_FORWARD_BASE_CGINC diff --git a/Assets/Alloy/Shaders/Forward/Base.cginc.meta b/Assets/Alloy/Shaders/Forward/Base.cginc.meta new file mode 100644 index 0000000..df34711 --- /dev/null +++ b/Assets/Alloy/Shaders/Forward/Base.cginc.meta @@ -0,0 +1,6 @@ +fileFormatVersion: 2 +guid: 8a7c53c728dcbca448292b6df23444f4 +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: diff --git a/Assets/Alloy/Shaders/Forward/Distort.cginc b/Assets/Alloy/Shaders/Forward/Distort.cginc new file mode 100644 index 0000000..638eb4a --- /dev/null +++ b/Assets/Alloy/Shaders/Forward/Distort.cginc @@ -0,0 +1,97 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file Distort.cginc +/// @brief Forward distort pass vertex & fragment shaders. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_FORWARD_DISTORT_CGINC +#define ALLOY_SHADERS_FORWARD_DISTORT_CGINC + +#define A_TEXEL_SIZE(a) a##_TexelSize + +#ifndef A_DISTORT_TEXTURE + #define A_DISTORT_TEXTURE _GrabTexture +#endif + +#define A_DISTORT_TEXTURE_TEXEL_SIZE A_TEXEL_SIZE(A_DISTORT_TEXTURE) + +#define A_BASE_PASS +#define A_TESSELLATION_PASS +#define A_INSTANCING_PASS +#define A_STEREO_INSTANCING_PASS +#define A_NORMAL_MAPPED_PASS +#define A_PARALLAX_MAPPED_PASS +#define A_VOLUMETRIC_PASS + +#define A_FORWARD_TEXCOORD0 float3 normalProjection : TEXCOORD0; +#define A_FORWARD_TEXCOORD1 float4 grabUv : TEXCOORD1; + +#include "Assets/Alloy/Shaders/Framework/Forward.cginc" + +/// Grab texture containing copy of the back buffer. +sampler2D A_DISTORT_TEXTURE; + +/// Grab texture dimension info. +/// (x: 1 / width, y: 1 / height, z: width, w: height). +float4 A_DISTORT_TEXTURE_TEXEL_SIZE; + +/// Weight of the distortion effect. +/// Expects values in the range [0,1]. +float _DistortWeight; + +/// Strength of the distortion effect. +/// Expects values in the range [0,128]. +float _DistortIntensity; + +/// Mesh normals influence on distortion. +/// Expects values in the range [0,1]. +float _DistortGeoWeight; + +void aMainVertexShader( + AVertexInput v, + out AFragmentInput o, + out float4 opos : SV_POSITION) +{ + aForwardVertexShader(v, o, opos); + o.normalProjection = mul((float3x3)UNITY_MATRIX_MVP, v.normal); + + // Until ComputeGrabScreenPos() is fixed, just directly pasted code here. +#if UNITY_UV_STARTS_AT_TOP + float scale = -1.0; +#else + float scale = 1.0; +#endif + o.grabUv.xy = (float2(opos.x, opos.y * scale) + opos.ww) * 0.5; + o.grabUv.zw = opos.zw; +} + +half4 aMainFragmentShader( + AFragmentInput i + A_FACING_SIGN_PARAM) : SV_Target +{ + // Transfer instancing and stereo IDs. + ASurface s = aForwardSurface(i, A_FACING_SIGN); + + // Adjust grab texture UVs and weight. + i.grabUv.z = UNITY_Z_0_FAR_FROM_CLIPSPACE(i.grabUv.z); + +#if UNITY_SINGLE_PASS_STEREO + i.grabUv.xy = TransformStereoScreenSpaceTex(i.grabUv.xy, i.grabUv.w); +#endif + + // Mesh normals distortion. + // cf http://wiki.unity3d.com/index.php?title=Refraction + float3 bump = s.normalTangent + i.normalProjection * abs(i.normalProjection); + float2 offset = A_DISTORT_TEXTURE_TEXEL_SIZE.xy * lerp(s.normalTangent, bump, _DistortGeoWeight).xy; + + i.grabUv.xy += offset * (i.grabUv.z * _DistortWeight * _DistortIntensity); + + // Sample and combine textures. + half3 refr = tex2Dproj(A_DISTORT_TEXTURE, UNITY_PROJ_COORD(i.grabUv)).rgb; + return aForwardColor(s, s.baseColor * refr); +} + +#endif // ALLOY_SHADERS_FORWARD_DISTORT_CGINC diff --git a/Assets/Alloy/Shaders/Forward/Distort.cginc.meta b/Assets/Alloy/Shaders/Forward/Distort.cginc.meta new file mode 100644 index 0000000..6953085 --- /dev/null +++ b/Assets/Alloy/Shaders/Forward/Distort.cginc.meta @@ -0,0 +1,6 @@ +fileFormatVersion: 2 +guid: acbe11d41b7bd5e4cb2521d5fad8840d +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: diff --git a/Assets/Alloy/Shaders/Forward/Gbuffer.cginc b/Assets/Alloy/Shaders/Forward/Gbuffer.cginc new file mode 100644 index 0000000..a967d7e --- /dev/null +++ b/Assets/Alloy/Shaders/Forward/Gbuffer.cginc @@ -0,0 +1,39 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file Gbuffer.cginc +/// @brief Forward g-buffer fill pass vertex & fragment shaders. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_FORWARD_GBUFFER_CGINC +#define ALLOY_SHADERS_FORWARD_GBUFFER_CGINC + +#define A_BASE_PASS +#define A_TESSELLATION_PASS +#define A_INSTANCING_PASS +#define A_STEREO_INSTANCING_PASS +#define A_NORMAL_MAPPED_PASS +#define A_PARALLAX_MAPPED_PASS +#define A_INDIRECT_LIGHTING_PASS +#define A_GBUFFER_PASS + +#include "Assets/Alloy/Shaders/Framework/Forward.cginc" + +void aMainVertexShader( + AVertexInput v, + out AFragmentInput o, + out float4 opos : SV_POSITION) +{ + aForwardVertexShader(v, o, opos); +} + +AGbuffer aMainFragmentShader( + AFragmentInput i + A_FACING_SIGN_PARAM) +{ + return aForwardLitGbufferShader(i, A_FACING_SIGN); +} + +#endif // ALLOY_SHADERS_FORWARD_GBUFFER_CGINC diff --git a/Assets/Alloy/Shaders/Forward/Gbuffer.cginc.meta b/Assets/Alloy/Shaders/Forward/Gbuffer.cginc.meta new file mode 100644 index 0000000..47b12f1 --- /dev/null +++ b/Assets/Alloy/Shaders/Forward/Gbuffer.cginc.meta @@ -0,0 +1,6 @@ +fileFormatVersion: 2 +guid: 1a504ca3a7ab5c143a425e5baf077a21 +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: diff --git a/Assets/Alloy/Shaders/Forward/Meta.cginc b/Assets/Alloy/Shaders/Forward/Meta.cginc new file mode 100644 index 0000000..75c24c8 --- /dev/null +++ b/Assets/Alloy/Shaders/Forward/Meta.cginc @@ -0,0 +1,57 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file Meta.cginc +/// @brief Forward meta pass vertex & fragment shaders. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_FORWARD_META_CGINC +#define ALLOY_SHADERS_FORWARD_META_CGINC + +#ifndef A_UV2_ON + #define A_UV2_ON +#endif + +#define A_BASE_PASS + +#include "Assets/Alloy/Shaders/Framework/Forward.cginc" + +#include "UnityMetaPass.cginc" + +void aMainVertexShader( + AVertexInput v, + out AFragmentInput o, + out float4 opos : SV_POSITION) +{ + aForwardVertexShader(v, o, opos); + opos = UnityMetaVertexPosition(v.vertex, v.uv1.xy, v.uv2.xy, unity_LightmapST, unity_DynamicLightmapST); +} + +float4 aMainFragmentShader( + AFragmentInput i) : SV_Target +{ + UnityMetaInput o; + ASurface s = aForwardSurface(i, 1.0h); + + UNITY_INITIALIZE_OUTPUT(UnityMetaInput, o); + +#if defined(EDITOR_VISUALIZATION) + o.Albedo = s.albedo; +#else + o.Albedo = s.albedo + (s.f0 * (s.beckmannRoughness * 0.5h)); +#endif + + o.SpecularColor = s.f0; + +#ifndef A_EMISSIVE_COLOR_ON + o.Emission = A_BLACK; +#else + o.Emission = aHdrClamp(s.emissiveColor); +#endif + + return UnityMetaFragment(o); +} + +#endif // ALLOY_SHADERS_FORWARD_META_CGINC diff --git a/Assets/Alloy/Shaders/Forward/Meta.cginc.meta b/Assets/Alloy/Shaders/Forward/Meta.cginc.meta new file mode 100644 index 0000000..f46b9d3 --- /dev/null +++ b/Assets/Alloy/Shaders/Forward/Meta.cginc.meta @@ -0,0 +1,6 @@ +fileFormatVersion: 2 +guid: 24101a9f398da70458f5277778ea3eff +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: diff --git a/Assets/Alloy/Shaders/Forward/Shadow.cginc b/Assets/Alloy/Shaders/Forward/Shadow.cginc new file mode 100644 index 0000000..e8c4016 --- /dev/null +++ b/Assets/Alloy/Shaders/Forward/Shadow.cginc @@ -0,0 +1,87 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file Shadow.cginc +/// @brief Forward shadow pass vertex & fragment shaders. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_FORWARD_SHADOW_CGINC +#define ALLOY_SHADERS_FORWARD_SHADOW_CGINC + +// Do dithering for alpha blended shadows on SM3+/desktop; +// on lesser systems do simple alpha-tested shadows +#if defined(A_ALPHA_BLENDING_ON) && defined(UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS) + #define UNITY_STANDARD_USE_DITHER_MASK 1 +#endif + +// Need to output UVs in shadow caster, since we need to sample texture and do clip/dithering based on it +#if !defined(INSTANCING_ON) && !defined(A_OPACITY_MASK_ON) && !defined(_ALPHATEST_ON) && !defined(A_ALPHA_BLENDING_ON) + #define A_SURFACE_SHADER_OFF +#endif + +// Has a non-empty shadow caster output struct (it's an error to have empty structs on some platforms...) +#if defined(V2F_SHADOW_CASTER_NOPOS_IS_EMPTY) && defined(A_SURFACE_SHADER_OFF) + #define A_VERTEX_TO_FRAGMENT_OFF +#endif + +#define A_TESSELLATION_PASS +#define A_INSTANCING_PASS + +#ifdef UNITY_STEREO_INSTANCING_ENABLED + #define A_STEREO_INSTANCING_PASS +#endif + +#define A_FORWARD_TEXCOORD0 V2F_SHADOW_CASTER_NOPOS + +#include "Assets/Alloy/Shaders/Framework/Forward.cginc" + +#ifdef UNITY_STANDARD_USE_DITHER_MASK + sampler3D _DitherMaskLOD; +#endif + +// We have to do these dances of outputting SV_POSITION separately from the vertex shader, +// and inputting VPOS in the pixel shader, since they both map to "POSITION" semantic on +// some platforms, and then things don't go well. + +void aMainVertexShader( + AVertexInput v, +#ifndef A_VERTEX_TO_FRAGMENT_OFF + out AFragmentInput o, +#endif + out float4 opos : SV_POSITION) +{ +#ifndef A_SURFACE_SHADER_OFF + aForwardVertexShader(v, o, opos); +#endif + TRANSFER_SHADOW_CASTER_NOPOS(o, opos) // Implicitly expects 'v' parameter. +} + +half4 aMainFragmentShader( +#ifndef A_VERTEX_TO_FRAGMENT_OFF + AFragmentInput i +#endif +#ifdef UNITY_STANDARD_USE_DITHER_MASK + , UNITY_VPOS_TYPE vpos : VPOS +#endif +#ifndef A_VERTEX_TO_FRAGMENT_OFF + A_FACING_SIGN_PARAM +#endif + ) : SV_Target +{ +#ifndef A_SURFACE_SHADER_OFF + ASurface s = aForwardSurface(i, A_FACING_SIGN); + + #ifdef UNITY_STANDARD_USE_DITHER_MASK + // Use dither mask for alpha blended shadows, based on pixel position xy + // and alpha level. Our dither texture is 4x4x16. + half alphaRef = tex3D(_DitherMaskLOD, float3(vpos.xy * 0.25f, s.opacity * 0.9375f)).a; + clip(alphaRef - 0.01h); + #endif +#endif + + SHADOW_CASTER_FRAGMENT(i) +} + +#endif // ALLOY_SHADERS_FORWARD_SHADOW_CGINC diff --git a/Assets/Alloy/Shaders/Forward/Shadow.cginc.meta b/Assets/Alloy/Shaders/Forward/Shadow.cginc.meta new file mode 100644 index 0000000..7acde62 --- /dev/null +++ b/Assets/Alloy/Shaders/Forward/Shadow.cginc.meta @@ -0,0 +1,6 @@ +fileFormatVersion: 2 +guid: 18b775132d894a64fa8bc3d75d59182b +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: diff --git a/Assets/Alloy/Shaders/Framework.meta b/Assets/Alloy/Shaders/Framework.meta new file mode 100644 index 0000000..abb94e9 --- /dev/null +++ b/Assets/Alloy/Shaders/Framework.meta @@ -0,0 +1,6 @@ +fileFormatVersion: 2 +guid: d4d1b098149adbc47a69087f033a4df0 +folderAsset: yes +DefaultImporter: + userData: + assetBundleName: diff --git a/Assets/Alloy/Shaders/Framework/Deferred.cginc b/Assets/Alloy/Shaders/Framework/Deferred.cginc new file mode 100644 index 0000000..718cfd0 --- /dev/null +++ b/Assets/Alloy/Shaders/Framework/Deferred.cginc @@ -0,0 +1,68 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file Deferred.cginc +/// @brief Deferred passes uber-header. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_FRAMEWORK_DEFERRED_CGINC +#define ALLOY_SHADERS_FRAMEWORK_DEFERRED_CGINC + +#define A_DEFERRED_PASS +#define A_TANGENT_TO_WORLD_ON +#define A_REFLECTION_PROBES_ON + +// Headers both for this file, and for all Definition and Feature modules. +#include "Assets/Alloy/Shaders/Config.cginc" +#include "Assets/Alloy/Shaders/Framework/LightingImpl.cginc" + +#include "UnityCG.cginc" +#include "UnityDeferredLibrary.cginc" +#include "UnityGlobalIllumination.cginc" +#include "UnityImageBasedLighting.cginc" +#include "UnityShaderVariables.cginc" +#include "UnityStandardBRDF.cginc" +#include "UnityStandardUtils.cginc" + +sampler2D _CameraGBufferTexture0; +sampler2D _CameraGBufferTexture1; +sampler2D _CameraGBufferTexture2; + +/// Creates a surface description from a Unity G-Buffer. +/// @param[in,out] i Unity deferred vertex format. +/// @return Material surface data. +ASurface aDeferredSurface( + inout unity_v2f_deferred i) +{ + ASurface s = aNewSurface(); + + // Set vertex data. + i.ray = i.ray * (_ProjectionParams.z / i.ray.z); + s.screenPosition = i.uv; + s.screenUv = s.screenPosition.xy / s.screenPosition.w; + + // Convert G-Buffer to surface. + float depth = Linear01Depth(SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, s.screenUv)); + half4 gbuffer0 = tex2D(_CameraGBufferTexture0, s.screenUv); + half4 gbuffer1 = tex2D(_CameraGBufferTexture1, s.screenUv); + half4 gbuffer2 = tex2D(_CameraGBufferTexture2, s.screenUv); + float4 vpos = float4(i.ray * depth, 1.0f); + + s.viewDepth = vpos.z; + s.positionWorld = mul(unity_CameraToWorld, vpos).xyz; + s.viewDirWorld = normalize(UnityWorldSpaceViewDir(s.positionWorld)); + + s.albedo = gbuffer0.rgb; + s.specularOcclusion = gbuffer0.a; + s.f0 = gbuffer1.rgb; + s.roughness = 1.0h - gbuffer1.a; + s.beckmannRoughness = aLinearToBeckmannRoughness(s.roughness); + s.normalWorld = A_NW(s, normalize(gbuffer2.xyz * 2.0h - 1.0h)); + s.materialType = gbuffer2.w; + aPreLighting(s); + return s; +} + +#endif // ALLOY_SHADERS_FRAMEWORK_DEFERRED_CGINC diff --git a/Assets/Alloy/Shaders/Framework/Deferred.cginc.meta b/Assets/Alloy/Shaders/Framework/Deferred.cginc.meta new file mode 100644 index 0000000..4fd1a56 --- /dev/null +++ b/Assets/Alloy/Shaders/Framework/Deferred.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: f07a38f558ae0be49aa491fd74692918 +timeCreated: 1491528345 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/Framework/Feature.cginc b/Assets/Alloy/Shaders/Framework/Feature.cginc new file mode 100644 index 0000000..29937f8 --- /dev/null +++ b/Assets/Alloy/Shaders/Framework/Feature.cginc @@ -0,0 +1,393 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file Feature.cginc +/// @brief Features uber-header. Holds methods that rely on uniforms. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_FRAMEWORK_FEATURE_CGINC +#define ALLOY_SHADERS_FRAMEWORK_FEATURE_CGINC + +// Headers both for this file, and for all Definition and Feature modules. +#include "Assets/Alloy/Shaders/Config.cginc" +#include "Assets/Alloy/Shaders/Framework/Lighting.cginc" +#include "Assets/Alloy/Shaders/Framework/Utility.cginc" + +#include "UnityCG.cginc" +#include "UnityStandardUtils.cginc" + +/// Picks either UV0 or UV1. +#define A_TEX_UV(s, name) (aPickUv(s, name##UV)) + +/// Applies Unity texture transforms plus UV0. +#define A_TEX_TRANSFORM(s, name) (TRANSFORM_TEX(s.uv01.xy, name)) + +/// Applies Unity texture transforms plus UV-switching effect. +#define A_TEX_TRANSFORM_UV(s, name) (TRANSFORM_TEX(A_TEX_UV(s, name), name)) + +/// Applies Unity texture transforms plus UV-switching and our scrolling effects. +#define A_TEX_TRANSFORM_UV_SCROLL(s, name) (A_TEX_TRANSFORM_SCROLL(name, A_TEX_UV(s, name))) + +/// Base UV assignment and update of associated fields. +#define A_BV(s, UV) UV; aUpdateBaseUv(s) + +/// Contains accumulated splat material data. +struct ASplat { + /// Non-TriPlanar transformed base UVs. + float2 baseUv; + + /// (RGB) Base Color, (A) Opacity. + /// Expects linear-space LDR color values. + half4 material0; + + /// (R) Metallic, (G) AO/Specular Tint, (B) Specularity, (A) Roughness. + /// Expects values in the range [0,1]. + half4 material1; + + /// (RGB) Emission, (A) Specular Tint. + /// Expects linear-space HDR color values. + half4 material2; + + /// World, Object, or Tangent normals. + /// Expects a normalized vector. + half3 normal; +}; + +/// Contains shared state for all splat functions, including TriPlanar data. +struct ASplatContext { + /// Vertex color. + /// Expects linear-space LDR color values. + half4 vertexColor; + + /// The model's UV0 & UV1 texture coordinate data. + /// Be aware that it can have parallax precombined with it. + float4 uv01; + + /// X-axis TriPlanar tangent to world matrix. + half3x3 xTangentToWorld; + + /// Y-axis TriPlanar tangent to world matrix. + half3x3 yTangentToWorld; + + /// Z-axis TriPlanar tangent to world matrix. + half3x3 zTangentToWorld; + + /// Blend weights between the top, middle, and bottom TriPlanar axis. + half3 blend; + + /// Position in either world or object-space. + float3 position; + + /// Binary masks for the positive values in the vertex normals. + half3 axisMasks; +}; + +/// Cutoff value that controls where cutout occurs over opacity. +/// Expects values in the range [0,1]. +half _Cutoff; + +/// Toggles inverting the backface normals. +/// Expects the values 0 or 1. +float _TransInvertBackNormal; + +/// The base tint color. +/// Expects a linear LDR color with alpha. +half4 _Color; + +/// Base color map. +/// Expects an RGB(A) map with sRGB sampling. +A_SAMPLER_2D(_MainTex); + +/// Base packed material map. +/// Expects an RGBA data map. +A_SAMPLER_2D(_SpecTex); + +/// Metallic map. +/// Expects an RGB map with sRGB sampling +sampler2D _MetallicMap; + +/// Ambient Occlusion map. +/// Expects an RGB map with sRGB sampling +sampler2D _AoMap; + +/// Specularity map. +/// Expects an RGB map with sRGB sampling +sampler2D _SpecularityMap; + +/// Roughness map. +/// Expects an RGB map with sRGB sampling +sampler2D _RoughnessMap; + +/// Base normal map. +/// Expects a compressed normal map. +sampler2D _BumpMap; + +/// Height map. +/// Expects an RGBA data map. +sampler2D _ParallaxMap; + +/// Toggles tinting the base color by the vertex color. +/// Expects values in the range [0,1]. +half _BaseColorVertexTint; + +/// The base metallic scale. +/// Expects values in the range [0,1]. +half _Metal; + +/// The base specularity scale. +/// Expects values in the range [0,1]. +half _Specularity; + +// Amount that f0 is tinted by the base color. +/// Expects values in the range [0,1]. +half _SpecularTint; + +/// The base roughness scale. +/// Expects values in the range [0,1]. +half _Roughness; + +/// Ambient Occlusion strength. +/// Expects values in the range [0,1]. +half _Occlusion; + +/// Normal map XY scale. +half _BumpScale; + +/// Height scale of the heightmap. +/// Expects values in the range [0,0.08]. +float _Parallax; + +/// Splat data constructor. +ASplat aNewSplat(); + +/// Uses surface data to make shared splat data. +/// @param s Material surface data. +/// @param sharpness Sharpness of the blend between TriPlanar axis. +/// @param positionScale Scales the position used for TriPlanar UVs. +/// @return Splat context initialized with shared data. +ASplatContext aNewSplatContext(ASurface s, half sharpness, float positionScale); + +/// Converts splat to material data and assigns it to a surface. +/// @param[in,out] s Material surface data. +/// @param[in] sp Combined splat data. +void aApplySplat(inout ASurface s, ASplat sp); + +/// Uses mask to blend a splat into surface. +/// @param[in,out] s Material surface data. +/// @param[in] sp Combined splat data. +void aBlendSplat(inout ASurface s, ASplat sp); + +/// Uses splat opacity and mask to blend a splat into surface. +/// @param[in,out] s Material surface data. +/// @param[in] sp Combined splat data. +void aBlendSplatWithOpacity(inout ASurface s, ASplat sp); + +/// Combines two splats into one, accumulating into first splat. +/// @param[in,out] sp0 Target for combined splat data ouput. +/// @param[in] sp1 Second splat to be combined. +void aMergeSplats(inout ASplat sp0, ASplat sp1); + +/// Applies constant material data to a splat. +/// @param[in,out] sp Splat being modified. +/// @param[in] sc Splat context. +/// @param[in] tint Base color tint. +/// @param[in] vertexTint Base color vertex color tint weight. +/// @param[in] metallic Metallic weight. +/// @param[in] specularity Specularity. +/// @param[in] specularTint Specular tint weight. +/// @param[in] roughness Linear roughness. +void aSplatMaterial(inout ASplat sp, ASplatContext sc, half4 tint, half vertexTint, half metallic, half specularity, half specularTint, half roughness); + +/// TriPlanar axis applied to a splat. +/// @param[in,out] sp Splat being modified. +/// @param[in] mask Masks where the effect is applied. +/// @param[in] tbn Local normal tangent to world matrix. +/// @param[in] uv Texture coordinates. +/// @param[in] occlusion Occlusion map weight. +/// @param[in] bumpScale Normal map XY scale. +/// @param[in] base Base color map. +/// @param[in] material Material map. +/// @param[in] normal Normal map. +void aTriPlanarAxis(inout ASplat sp, half mask, half3x3 tbn, float2 uv, half occlusion, half bumpScale, sampler2D base, sampler2D material, sampler2D normal); + +/// X-axis triplanar material applied to a splat. +/// @param[in,out] sp Splat being modified. +/// @param[in] sc Splat context. +/// @param[in] base Base color map. +/// @param[in] material Material map. +/// @param[in] normal Normal map. +/// @param[in] occlusion Occlusion map weight. +/// @param[in] bumpScale Normal map XY scale. +void aTriPlanarX(inout ASplat sp, ASplatContext sc, A_SAMPLER_PARAM(base), sampler2D material, sampler2D normal, half occlusion, half bumpScale); + +/// Y-axis triplanar material applied to a splat. +/// @param[in,out] sp Splat being modified. +/// @param[in] sc Splat context. +/// @param[in] base Base color map. +/// @param[in] material Material map. +/// @param[in] normal Normal map. +/// @param[in] occlusion Occlusion map weight. +/// @param[in] bumpScale Normal map XY scale. +void aTriPlanarY(inout ASplat sp, ASplatContext sc, A_SAMPLER_PARAM(base), sampler2D material, sampler2D normal, half occlusion, half bumpScale); + +/// Z-axis triplanar material applied to a splat. +/// @param[in,out] sp Splat being modified. +/// @param[in] sc Splat context. +/// @param[in] base Base color map. +/// @param[in] material Material map. +/// @param[in] normal Normal map. +/// @param[in] occlusion Occlusion map weight. +/// @param[in] bumpScale Normal map XY scale. +void aTriPlanarZ(inout ASplat sp, ASplatContext sc, A_SAMPLER_PARAM(base), sampler2D material, sampler2D normal, half occlusion, half bumpScale); + +/// Positive Y-axis triplanar material applied to a splat. +/// @param[in,out] sp Splat being modified. +/// @param[in] sc Splat context. +/// @param[in] base Base color map. +/// @param[in] material Material map. +/// @param[in] normal Normal map. +/// @param[in] occlusion Occlusion map weight. +/// @param[in] bumpScale Normal map XY scale. +void aTriPlanarPositiveY(inout ASplat sp, ASplatContext sc, A_SAMPLER_PARAM(base), sampler2D material, sampler2D normal, half occlusion, half bumpScale); + +/// Negative Y-axis triplanar material applied to a splat. +/// @param[in,out] sp Splat being modified. +/// @param[in] sc Splat context. +/// @param[in] base Base color map. +/// @param[in] material Material map. +/// @param[in] normal Normal map. +/// @param[in] occlusion Occlusion map weight. +/// @param[in] bumpScale Normal map XY scale. +void aTriPlanarNegativeY(inout ASplat sp, ASplatContext sc, A_SAMPLER_PARAM(base), sampler2D material, sampler2D normal, half occlusion, half bumpScale); + +/// Applies constant material data to a splat. +/// @param sc Splat context. +/// @param base Base color map. +/// @param material Material map. +/// @param normal Normal map. +/// @param tint Base color tint. +/// @param vertexTint Base vertex color tint. +/// @param metallic Metallic weight. +/// @param specularity Specularity. +/// @param specularTint Specular tint weight. +/// @param roughness Linear roughness. +/// @param occlusion Occlusion map weight. +/// @param bumpScale Normal map XY scale. +/// @return Splat populated with terrain data. +ASplat aNewSplat(ASplatContext sc, A_SAMPLER_PARAM(base), sampler2D material, sampler2D normal, half4 tint, half vertexTint, half metallic, half specularity, half specularTint, half roughness, half occlusion, half bumpScale); + +/// Combine splats and convert to material data to assign to a surface. +/// @param[in,out] s Material surface data. +/// @param[in] weights Weights masking where splats are combined. +/// @param[in] sp0 Splat data. +/// @param[in] sp1 Splat data. +/// @param[in] sp2 Splat data. +void aApplyTerrainSplats(inout ASurface s, half3 weights, ASplat sp0, ASplat sp1, ASplat sp2); + +/// Combine splats and convert to material data to assign to a surface. +/// @param[in,out] s Material surface data. +/// @param[in] weights Weights masking where splats are combined. +/// @param[in] sp0 Splat data. +/// @param[in] sp1 Splat data. +/// @param[in] sp2 Splat data. +/// @param[in] sp3 Splat data. +void aApplyTerrainSplats(inout ASurface s, half4 weights, ASplat sp0, ASplat sp1, ASplat sp2, ASplat sp3); + +/// Converts AO to linear space and controls the strength of the effect. +/// @param ao Gamma-space LDR AO value. +/// @param weight Strength of the AO effect. +/// @return Weighted, linear-space AO value. +half aOcclusionStrength(half ao, half weight); + +/// Sets up base UV for the first time. +/// @param[in,out] s Material surface data. +void aBaseUvInit(inout ASurface s); + +/// Update values dependent on base UV. +void aUpdateBaseUv(inout ASurface s); + +/// Pick between UV0 & UV1. +float2 aPickUv(ASurface s, float nameUv); + +/// Pick between UV0 & UV1. +float2 aPickUv(ASplatContext sc, float nameUv); + +/// Sets whether backface normals are inverted. +/// @param[in,out] s Material surface data. +void aTwoSided(inout ASurface s); + +/// Applies cutout effect. +/// @param s Material surface data. +void aCutout(ASurface s); + +/// Samples the base color map. +/// @param s Material surface data. +/// @return Base Color with alpha. +half4 aSampleBase(ASurface s); + +/// Samples the base material map. +/// @param s Material surface data. +/// @return Packed material. +half4 aSampleMaterial(ASurface s); + +/// Samples and scales the base bump map. +/// @param s Material surface data. +/// @param scale Normal XY scale factor. +/// @return Normalized tangent-space normal. +half3 aSampleBumpScale(ASurface s, half scale); + +/// Samples the base bump map. +/// @param s Material surface data. +/// @return Normalized tangent-space normal. +half3 aSampleBump(ASurface s); + +/// Samples the base bump map biasing the mipmap level sampled. +/// @param s Material surface data. +/// @param bias Mipmap level bias. +/// @return Normalized tangent-space normal. +half3 aSampleBumpBias(ASurface s, float bias); + +/// Samples the base bump map biasing the mipmap level sampled. +/// @param s Material surface data. +/// @return Normalized tangent-space normal. +half aSampleHeight(ASurface s); + +/// Applies color based on weight parameter. +/// @param s Material surface data. +/// @param strength Amount to blend in vertex color. +/// @return Vertex color tint. +half3 aVertexColorTint(ASurface s, half strength); + +/// Applies base vertex color. +/// @param s Material surface data. +/// @return Vertex color tint. +half3 aBaseVertexColorTint(ASurface s); + +/// Gets combined base color tint from uniform and vertex color. +/// @param s Material surface data. +/// @return Base Color with alpha. +half4 aBaseTint(ASurface s); + +/// Gets combined base color from main channels. +/// @param s Material surface data. +/// @return Base Color with alpha. +half4 aBase(ASurface s); + +/// Applies texture coordinate offsets to surface data. +/// @param[in,out] s Material surface data. +/// @param[in] offset Texture coordinate offset. +void aParallaxOffset(inout ASurface s, float2 offset); + +/// Calculates Offset Bump Mapping texture offsets. +/// @param[in,out] s Material surface data. +void aOffsetBumpMapping(inout ASurface s); + +/// Calculates Parallax Occlusion Mapping texture offsets. +/// @param[in,out] s Material surface data. +/// @param[in] minSamples Minimum number of samples for POM effect [1,n]. +/// @param[in] maxSamples Maximum number of samples for POM effect [1,n]. +void aParallaxOcclusionMapping(inout ASurface s, float minSamples, float maxSamples); + +#endif // ALLOY_SHADERS_FRAMEWORK_FEATURE_CGINC diff --git a/Assets/Alloy/Shaders/Framework/Feature.cginc.meta b/Assets/Alloy/Shaders/Framework/Feature.cginc.meta new file mode 100644 index 0000000..9fa3a0a --- /dev/null +++ b/Assets/Alloy/Shaders/Framework/Feature.cginc.meta @@ -0,0 +1,6 @@ +fileFormatVersion: 2 +guid: aeac9cf700a9bac48bf2bd38f0fcc351 +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: diff --git a/Assets/Alloy/Shaders/Framework/FeatureImpl.cginc b/Assets/Alloy/Shaders/Framework/FeatureImpl.cginc new file mode 100644 index 0000000..d22fc98 --- /dev/null +++ b/Assets/Alloy/Shaders/Framework/FeatureImpl.cginc @@ -0,0 +1,707 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file Feature.cginc +/// @brief Feature method implementations to allow disabling of features. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_FRAMEWORK_FEATURE_IMPL_CGINC +#define ALLOY_SHADERS_FRAMEWORK_FEATURE_IMPL_CGINC + +#if !defined(A_TEX_UV_OFF) && defined(A_PROJECTIVE_DECAL_SHADER) + #define A_TEX_UV_OFF +#endif + +#if !defined(A_TRIPLANAR_MAPPING_ON) && defined(_METALLICGLOSSMAP) + #define A_TRIPLANAR_MAPPING_ON +#endif + +#ifdef A_TRIPLANAR_MAPPING_ON + #ifndef _TRIPLANARMODE_WORLD + #define A_WORLD_TO_OBJECT_ON + #endif + + #ifndef A_NORMAL_WORLD_ON + #define A_NORMAL_WORLD_ON + #endif + + #ifndef A_POSITION_WORLD_ON + #define A_POSITION_WORLD_ON + #endif +#endif + +#include "Assets/Alloy/Shaders/Config.cginc" +#include "Assets/Alloy/Shaders/Framework/Feature.cginc" +#include "Assets/Alloy/Shaders/Framework/LightingImpl.cginc" +#include "Assets/Alloy/Shaders/Framework/Utility.cginc" + +#include "HLSLSupport.cginc" +#include "UnityCG.cginc" +#include "UnityStandardUtils.cginc" + +#define A_BASE_COLOR material0.rgb +#define A_OPACITY material0.a + +#define A_METALLIC material1.A_METALLIC_CHANNEL +#define A_AMBIENT_OCCLUSION material1.A_AO_CHANNEL +#define A_SPECULARITY material1.A_SPECULARITY_CHANNEL +#define A_ROUGHNESS material1.A_ROUGHNESS_CHANNEL + +#ifdef A_AMBIENT_OCCLUSION_ON + #define A_SPECULAR_TINT material2.a +#else + #define A_SPECULAR_TINT material1.g +#endif + +#define A_EMISSIVE_COLOR material2.rgb + +ASplat aNewSplat() +{ + ASplat sp; + + UNITY_INITIALIZE_OUTPUT(ASplat, sp); + sp.material0 = 0.0h; + sp.material1 = 0.0h; + sp.material2 = 0.0h; + sp.normal = 0.0h; + return sp; +} + +ASplatContext aNewSplatContext( + ASurface s, + half sharpness, + float positionScale) +{ + ASplatContext sc; + + UNITY_INITIALIZE_OUTPUT(ASplatContext, sc); + sc.uv01 = s.uv01; + sc.vertexColor = s.vertexColor; + +#ifdef A_TRIPLANAR_MAPPING_ON + // Triplanar mapping + // cf http://www.gamedev.net/blog/979/entry-2250761-triplanar-texturing-and-normal-mapping/ + #ifdef _TRIPLANARMODE_WORLD + half3 geoNormal = s.vertexNormalWorld; + sc.position = s.positionWorld; + #else + half3 geoNormal = UnityWorldToObjectDir(s.vertexNormalWorld); + sc.position = mul(unity_WorldToObject, float4(s.positionWorld, 1.0f)).xyz; + #endif + + // Unity uses a Left-handed axis, so it requires clumsy remapping. + sc.xTangentToWorld = half3x3(A_AXIS_Z, A_AXIS_Y, geoNormal); + sc.yTangentToWorld = half3x3(A_AXIS_X, A_AXIS_Z, geoNormal); + sc.zTangentToWorld = half3x3(A_AXIS_X, A_AXIS_Y, geoNormal); + + half3 blending = abs(geoNormal); + blending = normalize(max(blending, A_EPSILON)); + blending = pow(blending, sharpness); + blending /= dot(blending, A_ONE); + sc.blend = blending; + + sc.axisMasks = step(A_ZERO, geoNormal); + sc.position *= positionScale; +#endif + + return sc; +} + +void aApplySplat( + inout ASurface s, + ASplat sp) +{ + half3 normal = sp.normal; + + s.baseColor = sp.A_BASE_COLOR; + s.opacity = sp.A_OPACITY; + s.metallic = sp.A_METALLIC; + s.specularity = sp.A_SPECULARITY; + s.specularTint = sp.A_SPECULAR_TINT; + s.roughness = sp.A_ROUGHNESS; + +#ifdef A_AMBIENT_OCCLUSION_ON + s.ambientOcclusion = sp.A_AMBIENT_OCCLUSION; +#endif + +#ifdef A_EMISSIVE_COLOR_ON + s.emissiveColor = sp.A_EMISSIVE_COLOR; +#endif + +#ifndef A_TRIPLANAR_MAPPING_ON + s.normalTangent = A_NT(s, normalize(normal)); +#else + #ifdef _TRIPLANARMODE_WORLD + half3 normalWorld = normalize(normal); + #else + half3 normalWorld = UnityObjectToWorldNormal(normal); + #endif + + s.normalWorld = A_NW(s, normalWorld); +#endif +} + +void aBlendSplat( + inout ASurface s, + ASplat sp) +{ + half3 normal = sp.normal; + half weight = s.mask; + + s.baseColor = lerp(s.baseColor, sp.A_BASE_COLOR, weight); + s.opacity = lerp(s.opacity, sp.A_OPACITY, weight); + s.metallic = lerp(s.metallic, sp.A_METALLIC, weight); + s.specularity = lerp(s.specularity, sp.A_SPECULARITY, weight); + s.specularTint = lerp(s.specularTint, sp.A_SPECULAR_TINT, weight); + s.roughness = lerp(s.roughness, sp.A_ROUGHNESS, weight); + +#ifdef A_AMBIENT_OCCLUSION_ON + s.ambientOcclusion = lerp(s.ambientOcclusion, sp.A_AMBIENT_OCCLUSION, weight); +#endif + +#ifdef A_EMISSIVE_COLOR_ON + s.emissiveColor = lerp(s.emissiveColor, sp.A_EMISSIVE_COLOR, weight); +#endif + +#ifndef A_TRIPLANAR_MAPPING_ON + s.normalTangent = A_NT(s, normalize(lerp(s.normalTangent, normal, weight))); +#else + #ifdef _TRIPLANARMODE_WORLD + half3 normalWorld = normalize(normal); + #else + half3 normalWorld = UnityObjectToWorldNormal(normal); + #endif + + s.normalWorld = A_NW(s, normalize(lerp(s.normalWorld, normalWorld, weight))); +#endif +} + +void aBlendSplatWithOpacity( + inout ASurface s, + ASplat sp) +{ + s.mask *= sp.A_OPACITY; + sp.A_OPACITY = 1.0h; + + aBlendSplat(s, sp); +} + +void aMergeSplats( + inout ASplat sp0, + ASplat sp1) +{ + sp0.material0 += sp1.material0; + sp0.material1 += sp1.material1; + sp0.normal += sp1.normal; + sp0.material2 += sp1.material2; +} + +void aSplatMaterial( + inout ASplat sp, + ASplatContext sc, + half4 tint, + half vertexTint, + half metallic, + half specularity, + half specularTint, + half roughness) +{ + sp.material0 *= tint; + +#ifndef A_VERTEX_COLOR_IS_DATA + sp.A_BASE_COLOR *= aLerpWhiteTo(sc.vertexColor.rgb, vertexTint); +#endif + + sp.A_METALLIC *= metallic; + sp.A_SPECULARITY *= specularity; + sp.A_ROUGHNESS *= roughness; + sp.A_SPECULAR_TINT = specularTint; +} + +void aTriPlanarAxis( + inout ASplat sp, + half mask, + half3x3 tbn, + float2 uv, + half occlusion, + half bumpScale, + sampler2D base, + sampler2D material, + sampler2D normal) +{ + ASplat sp0 = aNewSplat(); + + sp0.material0 = tex2D(base, uv); + sp0.normal = mul(UnpackScaleNormal(tex2D(normal, uv), bumpScale), tbn); + +#ifndef A_ROUGHNESS_SOURCE_BASE_COLOR_ALPHA + sp0.material1 = tex2D(material, uv); + sp0.A_AMBIENT_OCCLUSION = aOcclusionStrength(sp0.A_AMBIENT_OCCLUSION, occlusion); +#else + sp0.A_METALLIC = 1.0h; + sp0.A_AMBIENT_OCCLUSION = 1.0h; + sp0.A_SPECULARITY = 1.0h; + sp0.A_ROUGHNESS = sp0.A_OPACITY; + sp0.A_OPACITY = 1.0h; +#endif + + sp.material0 += mask * sp0.material0; + sp.material1 += mask * sp0.material1; + sp.normal += mask * sp0.normal; +} + +void aTriPlanarX( + inout ASplat sp, + ASplatContext sc, + A_SAMPLER_PARAM(base), + sampler2D material, + sampler2D normal, + half occlusion, + half bumpScale) +{ + aTriPlanarAxis(sp, sc.blend.x, sc.xTangentToWorld, A_TEX_TRANSFORM_SCROLL(base, sc.position.zy), occlusion, bumpScale, base, material, normal); +} + +void aTriPlanarY( + inout ASplat sp, + ASplatContext sc, + A_SAMPLER_PARAM(base), + sampler2D material, + sampler2D normal, + half occlusion, + half bumpScale) +{ + aTriPlanarAxis(sp, sc.blend.y, sc.yTangentToWorld, A_TEX_TRANSFORM_SCROLL(base, sc.position.xz), occlusion, bumpScale, base, material, normal); +} + +void aTriPlanarZ( + inout ASplat sp, + ASplatContext sc, + A_SAMPLER_PARAM(base), + sampler2D material, + sampler2D normal, + half occlusion, + half bumpScale) +{ + aTriPlanarAxis(sp, sc.blend.z, sc.zTangentToWorld, A_TEX_TRANSFORM_SCROLL(base, sc.position.xy), occlusion, bumpScale, base, material, normal); +} + +void aTriPlanarPositiveY( + inout ASplat sp, + ASplatContext sc, + A_SAMPLER_PARAM(base), + sampler2D material, + sampler2D normal, + half occlusion, + half bumpScale) +{ + aTriPlanarAxis(sp, sc.axisMasks.y * sc.blend.y, sc.yTangentToWorld, A_TEX_TRANSFORM_SCROLL(base, sc.position.xz), occlusion, bumpScale, base, material, normal); +} + +void aTriPlanarNegativeY( + inout ASplat sp, + ASplatContext sc, + A_SAMPLER_PARAM(base), + sampler2D material, + sampler2D normal, + half occlusion, + half bumpScale) +{ + aTriPlanarAxis(sp, (1.0h - sc.axisMasks.y) * sc.blend.y, sc.yTangentToWorld, A_TEX_TRANSFORM_SCROLL(base, sc.position.xz), occlusion, bumpScale, base, material, normal); +} + +ASplat aNewSplat( + ASplatContext sc, + A_SAMPLER_PARAM(base), + sampler2D material, + sampler2D normal, + half4 tint, + half vertexTint, + half metallic, + half specularity, + half specularTint, + half roughness, + half occlusion, + half bumpScale) +{ + ASplat sp = aNewSplat(); + +#ifdef A_TRIPLANAR_MAPPING_ON + aTriPlanarX(sp, sc, A_SAMPLER_2D_INPUT(base), material, normal, occlusion, bumpScale); + aTriPlanarY(sp, sc, A_SAMPLER_2D_INPUT(base), material, normal, occlusion, bumpScale); + aTriPlanarZ(sp, sc, A_SAMPLER_2D_INPUT(base), material, normal, occlusion, bumpScale); +#else + sp.baseUv = A_TEX_TRANSFORM_UV_SCROLL(sc, base); + sp.material0 = tex2D(base, sp.baseUv); + sp.normal = UnpackScaleNormal(tex2D(normal, sp.baseUv), bumpScale); + + #ifndef A_ROUGHNESS_SOURCE_BASE_COLOR_ALPHA + sp.material1 = tex2D(material, sp.baseUv); + sp.A_AMBIENT_OCCLUSION = aOcclusionStrength(sp.A_AMBIENT_OCCLUSION, occlusion); + #else + sp.A_METALLIC = 1.0h; + sp.A_AMBIENT_OCCLUSION = 1.0h; + sp.A_SPECULARITY = 1.0h; + sp.A_ROUGHNESS = sp.A_OPACITY; + sp.A_OPACITY = 1.0h; + #endif +#endif + + aSplatMaterial(sp, sc, tint, vertexTint, metallic, specularity, specularTint, roughness); + return sp; +} + +void aApplyTerrainSplats( + inout ASurface s, + half3 weights, + ASplat sp0, + ASplat sp1, + ASplat sp2) +{ + ASplat sp = aNewSplat(); + sp.material0 = weights.r * sp0.material0 + weights.g * sp1.material0 + weights.b * sp2.material0; + sp.material1 = weights.r * sp0.material1 + weights.g * sp1.material1 + weights.b * sp2.material1; + sp.material2 = weights.r * sp0.material2 + weights.g * sp1.material2 + weights.b * sp2.material2; + sp.normal = weights.r * sp0.normal + weights.g * sp1.normal + weights.b * sp2.normal; + aApplySplat(s, sp); +} + +void aApplyTerrainSplats( + inout ASurface s, + half4 weights, + ASplat sp0, + ASplat sp1, + ASplat sp2, + ASplat sp3) +{ + ASplat sp = aNewSplat(); + sp.material0 = weights.r * sp0.material0 + weights.g * sp1.material0 + weights.b * sp2.material0 + weights.a * sp3.material0; + sp.material1 = weights.r * sp0.material1 + weights.g * sp1.material1 + weights.b * sp2.material1 + weights.a * sp3.material1; + sp.material2 = weights.r * sp0.material2 + weights.g * sp1.material2 + weights.b * sp2.material2 + weights.a * sp3.material2; + sp.normal = weights.r * sp0.normal + weights.g * sp1.normal + weights.b * sp2.normal + weights.a * sp3.normal; + aApplySplat(s, sp); +} + +half aOcclusionStrength( + half ao, + half weight) +{ + return aLerpOneTo(aGammaToLinear(ao), weight); +} + +void aBaseUvInit( + inout ASurface s) +{ + s.baseUv = A_TEX_TRANSFORM_UV_SCROLL(s, _MainTex); + s.baseTiling = _MainTex_ST.xy; + + // Initialize VirtualCoord here so subsequent calls can be cheaper updates. +#ifdef _VIRTUALTEXTURING_ON + s.baseVirtualCoord = VTComputeVirtualCoord(s.baseUv); +#endif +} + +void aUpdateBaseUv( + inout ASurface s) +{ +#ifdef _VIRTUALTEXTURING_ON + s.baseVirtualCoord = VTUpdateVirtualCoord(s.baseVirtualCoord, s.baseUv); +#endif +} + +float2 aPickUv( + ASurface s, + float nameUv) +{ +#ifdef A_TEX_UV_OFF + return s.uv01.xy; +#else + return nameUv < 0.5f ? s.uv01.xy : s.uv01.zw; +#endif +} + +float2 aPickUv( + ASplatContext sc, + float nameUv) +{ +#ifdef A_TEX_UV_OFF + return sc.uv01.xy; +#else + return nameUv < 0.5f ? sc.uv01.xy : sc.uv01.zw; +#endif +} + +void aTwoSided( + inout ASurface s) +{ +#ifdef A_TWO_SIDED_SHADER + s.normalTangent.xy = A_NT(s, s.facingSign > 0.0h || _TransInvertBackNormal < 0.5f ? s.normalTangent.xy : -s.normalTangent.xy); +#endif +} + +void aCutout( + ASurface s) +{ +#ifdef _ALPHATEST_ON + clip(s.opacity - _Cutoff); +#endif +} + +half4 aSampleBase( + ASurface s) +{ + half4 result = 0.0h; + +#ifdef _VIRTUALTEXTURING_ON + result = VTSampleBase(s.baseVirtualCoord); +#else + result = tex2D(_MainTex, s.baseUv); +#endif + + return result; +} + +half4 aSampleMaterial( + ASurface s) +{ + half4 result = 0.0h; + +#ifndef A_EXPANDED_MATERIAL_MAPS + #ifndef _VIRTUALTEXTURING_ON + result = tex2D(_SpecTex, s.baseUv); + #else + result = VTSampleSpecular(s.baseVirtualCoord); + #endif + + result.A_AO_CHANNEL = aGammaToLinear(result.A_AO_CHANNEL); +#else + half3 channels; + + // Assuming sRGB texture sampling, undo it for all but AO. + channels.x = tex2D(_MetallicMap, s.baseUv).g; + channels.y = tex2D(_SpecularityMap, s.baseUv).g; + channels.z = tex2D(_RoughnessMap, s.baseUv).g; + channels = LinearToGammaSpace(channels); + + result.A_METALLIC_CHANNEL = channels.x; + result.A_AO_CHANNEL = tex2D(_AoMap, s.baseUv).g; + result.A_SPECULARITY_CHANNEL = channels.y; + result.A_ROUGHNESS_CHANNEL = channels.z; +#endif + + return result; +} + +half3 aSampleBumpScale( + ASurface s, + half scale) +{ + half4 result = 0.0h; + +#ifdef _VIRTUALTEXTURING_ON + result = VTSampleNormal(s.baseVirtualCoord); +#else + result = tex2D(_BumpMap, s.baseUv); +#endif + + return UnpackScaleNormal(result, scale); +} + +half3 aSampleBump( + ASurface s) +{ + return aSampleBumpScale(s, _BumpScale); +} + +half3 aSampleBumpBias( + ASurface s, + float bias) +{ + half4 result = 0.0h; + +#ifdef _VIRTUALTEXTURING_ON + result = VTSampleNormal(VTComputeVirtualCoord(s.baseUv, bias)); +#else + result = tex2Dbias(_BumpMap, float4(s.baseUv, 0.0h, bias)); +#endif + + return UnpackScaleNormal(result, _BumpScale); +} + +half aSampleHeight( + ASurface s) +{ + half result = 0.0h; + +#ifdef _VIRTUALTEXTURING_ON + result = VTSampleNormal(s.baseVirtualCoord).b; +#else + result = tex2D(_ParallaxMap, s.baseUv).y; +#endif + + return result; +} + +half3 aVertexColorTint( + ASurface s, + half strength) +{ +#ifdef A_VERTEX_COLOR_IS_DATA + return A_WHITE; +#else + return aLerpWhiteTo(s.vertexColor.rgb, strength); +#endif +} + +half3 aBaseVertexColorTint( + ASurface s) +{ + return aVertexColorTint(s, _BaseColorVertexTint); +} + +half4 aBaseTint( + ASurface s) +{ + half4 result = _Color; + +#ifndef A_VERTEX_COLOR_IS_DATA + result.rgb *= aBaseVertexColorTint(s); +#endif + + return result; +} + +half4 aBase( + ASurface s) +{ + return aBaseTint(s) * aSampleBase(s); +} + +void aParallaxOffset( + inout ASurface s, + float2 offset) +{ +#ifdef A_PARALLAX_MAPPED_PASS + offset *= s.mask; + + // To apply the parallax offset to secondary textures without causing swimming, + // we must normalize it by removing the implicitly multiplied base map tiling. + s.uv01 += (offset / s.baseTiling).xyxy; + s.baseUv += A_BV(s, offset); +#endif +} + +void aOffsetBumpMapping( + inout ASurface s) +{ + // NOTE: Prevents NaN compiler errors in DX9 mode for shadow pass. +#if defined(A_TANGENT_TO_WORLD_ON) && defined(A_VIEW_DIR_TANGENT_ON) + half h = aSampleHeight(s) * _Parallax - _Parallax * 0.5h; + half3 v = s.viewDirTangent; + + v.z += 0.42h; + aParallaxOffset(s, h * (v.xy / v.z)); +#endif +} + +void aParallaxOcclusionMapping( + inout ASurface s, + float minSamples, + float maxSamples) +{ + // NOTE: Prevents NaN compiler errors in DX9 mode for shadow pass. +#if defined(A_TANGENT_TO_WORLD_ON) && defined(A_VIEW_DIR_TANGENT_ON) + // Parallax Occlusion Mapping + // Subject to GameDev.net Open License + // cf http://www.gamedev.net/page/resources/_/technical/graphics-programming-and-theory/a-closer-look-at-parallax-occlusion-mapping-r3262 + float2 offset = float2(0.0f, 0.0f); + + // Calculate the parallax offset vector max length. + // This is equivalent to the tangent of the angle between the + // viewer position and the fragment location. + float parallaxLimit = -length(s.viewDirTangent.xy) / s.viewDirTangent.z; + + // Scale the parallax limit according to heightmap scale. + parallaxLimit *= _Parallax; + + // Calculate the parallax offset vector direction and maximum offset. + float2 offsetDirTangent = normalize(s.viewDirTangent.xy); + float2 maxOffset = offsetDirTangent * parallaxLimit; + + // Calculate how many samples should be taken along the view ray + // to find the surface intersection. This is based on the angle + // between the surface normal and the view vector. + int numSamples = (int)lerp(maxSamples, minSamples, s.NdotV); + int currentSample = 0; + + // Specify the view ray step size. Each sample will shift the current + // view ray by this amount. + float stepSize = 1.0f / (float)numSamples; + + // Initialize the starting view ray height and the texture offsets. + float currentRayHeight = 1.0f; + float2 lastOffset = float2(0.0f, 0.0f); + + float lastSampledHeight = 1.0f; + float currentSampledHeight = 1.0f; + + #ifdef _VIRTUALTEXTURING_ON + VirtualCoord vcoord = s.baseVirtualCoord; + #else + // Calculate the texture coordinate partial derivatives in screen + // space for the tex2Dgrad texture sampling instruction. + float2 dx = ddx(s.baseUv); + float2 dy = ddy(s.baseUv); + #endif + + while (currentSample < numSamples) { + #ifdef _VIRTUALTEXTURING_ON + vcoord = VTUpdateVirtualCoord(vcoord, s.baseUv + offset); + currentSampledHeight = VTSampleNormal(vcoord).b; + #else + // Sample the heightmap at the current texcoord offset. + currentSampledHeight = tex2Dgrad(_ParallaxMap, s.baseUv + offset, dx, dy).y; + #endif + + // Test if the view ray has intersected the surface. + UNITY_BRANCH + if (currentSampledHeight > currentRayHeight) { + // Find the relative height delta before and after the intersection. + // This provides a measure of how close the intersection is to + // the final sample location. + float delta1 = currentSampledHeight - currentRayHeight; + float delta2 = (currentRayHeight + stepSize) - lastSampledHeight; + float ratio = delta1 / (delta1 + delta2); + + // Interpolate between the final two segments to + // find the true intersection point offset. + offset = lerp(offset, lastOffset, ratio); + + // Force the exit of the while loop + currentSample = numSamples + 1; + } + else { + // The intersection was not found. Now set up the loop for the next + // iteration by incrementing the sample count, + currentSample++; + + // take the next view ray height step, + currentRayHeight -= stepSize; + + // save the current texture coordinate offset and increment + // to the next sample location, + lastOffset = offset; + offset += stepSize * maxOffset; + + // and finally save the current heightmap height. + lastSampledHeight = currentSampledHeight; + } + } + + aParallaxOffset(s, offset); +#endif +} + +#endif // ALLOY_SHADERS_FRAMEWORK_FEATURE_IMPL_CGINC diff --git a/Assets/Alloy/Shaders/Framework/FeatureImpl.cginc.meta b/Assets/Alloy/Shaders/Framework/FeatureImpl.cginc.meta new file mode 100644 index 0000000..756a40f --- /dev/null +++ b/Assets/Alloy/Shaders/Framework/FeatureImpl.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 1e933ac91f881374f8971a009670b12c +timeCreated: 1473016974 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/Framework/Forward.cginc b/Assets/Alloy/Shaders/Framework/Forward.cginc new file mode 100644 index 0000000..85a81a8 --- /dev/null +++ b/Assets/Alloy/Shaders/Framework/Forward.cginc @@ -0,0 +1,648 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +/////////////////////////////////////////////////////////////////////////////// +/// @file Forward.cginc +/// @brief Forward passes uber-header. +/////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_FRAMEWORK_FORWARD_CGINC +#define ALLOY_SHADERS_FRAMEWORK_FORWARD_CGINC + +// Headers both for this file, and for all Definition and Feature modules. +#include "Assets/Alloy/Shaders/Framework/FeatureImpl.cginc" +#include "Assets/Alloy/Shaders/Framework/LightingImpl.cginc" +#include "Assets/Alloy/Shaders/Framework/TypeImpl.cginc" +#include "Assets/Alloy/Shaders/Framework/Unity.cginc" +#include "Assets/Alloy/Shaders/Framework/Utility.cginc" + +#include "AutoLight.cginc" +#include "HLSLSupport.cginc" +#include "UnityCG.cginc" +#include "UnityGlobalIllumination.cginc" +#include "UnityImageBasedLighting.cginc" +#include "UnityInstancing.cginc" +#include "UnityLightingCommon.cginc" +#include "UnityShaderUtilities.cginc" +#include "UnityShaderVariables.cginc" +#include "UnityShadowLibrary.cginc" +#include "UnityStandardUtils.cginc" + +// Support for two-sided effects in a single pass. +#ifndef A_TWO_SIDED_SHADER + #define A_FACING_SIGN_PARAM + #define A_FACING_SIGN 1.0h +#else + #define A_FACING_SIGN_PARAM ,half facingSign : VFACE + #define A_FACING_SIGN facingSign +#endif + +// Shadows. +#if defined(SHADOWS_SCREEN) && !defined(UNITY_NO_SCREENSPACE_SHADOWS) + #define A_SCREENSPACE_SHADOWS_ON +#endif + +// Lightmaps. +#if !defined(A_UV2_ON) && defined(DYNAMICLIGHTMAP_ON) && defined(A_INDIRECT_ON) + #define A_UV2_ON +#endif + +#if defined(LIGHTMAP_ON) && defined(LIGHTMAP_SHADOW_MIXING) && !defined(SHADOWS_SHADOWMASK) && defined(SHADOWS_SCREEN) + #define A_LIGHTMAP_SHADOW_MIXING_ON +#endif + +// Lighting vertex data. +#if defined(A_INDIRECT_ON) && defined(A_DIRECT_ON) + #define A_FORWARD_TEXCOORD0 half4 giData : TEXCOORD0; + #define A_FORWARD_TEXCOORD1 UNITY_SHADOW_COORDS(1) +#elif defined(A_INDIRECT_ON) + #define A_FORWARD_TEXCOORD0 half4 giData : TEXCOORD0; + + #ifdef A_SHADOW_MASKS_BUFFER_ON + #define A_FORWARD_TEXCOORD1 UNITY_SHADOW_COORDS(1) + #endif +#elif defined(A_DIRECT_ON) + #define A_FORWARD_TEXCOORD0 UNITY_SHADOW_COORDS(0) + + // Reduce v2f transfer cost for pure directional lights. + #if !defined(DIRECTIONAL) && !defined(A_LIGHTMAP_SHADOW_MIXING_ON) + #define A_FORWARD_TEXCOORD1 unityShadowCoord4 lightCoord : TEXCOORD1; + + #ifndef USING_DIRECTIONAL_LIGHT + #define A_FORWARD_TEXCOORD2 float4 lightVectorRange : TEXCOORD2; + #endif + #endif +#endif + +// Handle dependencies between vertex data. +#if !defined(A_TANGENT_ON) && defined(A_TANGENT_TO_WORLD_ON) + #define A_TANGENT_ON +#endif + +#if !defined(A_NORMAL_WORLD_ON) && (defined(A_TANGENT_TO_WORLD_ON) || defined(A_REFLECTION_VECTOR_WORLD_ON)) + #define A_NORMAL_WORLD_ON +#endif + +#if !defined(A_VIEW_DIR_WORLD_ON) && (defined(A_VIEW_DIR_TANGENT_ON) || defined(A_REFLECTION_VECTOR_WORLD_ON)) + #define A_VIEW_DIR_WORLD_ON +#endif + +#if !defined(A_POSITION_WORLD_ON) && defined(A_VIEW_DIR_WORLD_ON) + #define A_POSITION_WORLD_ON +#endif + +#if !defined(A_SCREEN_UV_ON) && defined(LOD_FADE_CROSSFADE) + #define A_SCREEN_UV_ON +#endif + +// Enable specific packed texcoord channels. +#if !defined(A_POSITION_TEXCOORD_ON) && (defined(A_POSITION_WORLD_ON) || defined(A_VIEW_DEPTH_ON)) + #define A_POSITION_TEXCOORD_ON +#endif + +#if !defined(A_FOG_TEXCOORD_ON) && (defined(A_FOG_ON) || defined(A_SCREEN_UV_ON)) + #define A_FOG_TEXCOORD_ON +#endif + +#if !defined(A_TRANSFER_INSTANCE_ID_ON) && defined(A_WORLD_TO_OBJECT_ON) && defined(A_INSTANCING_PASS) + #define A_TRANSFER_INSTANCE_ID_ON +#endif + +// Split vertex data conditions to reduce combinations. +// UV0-1, TBN, N. +#if defined(A_TANGENT_TO_WORLD_ON) + #define A_INNER_VERTEX_DATA2(A, B, C, D) \ + float4 texcoords : TEXCOORD##A; \ + half3 tangentWorld : TEXCOORD##B; \ + half3 bitangentWorld : TEXCOORD##C; \ + half3 normalWorld : TEXCOORD##D; +#elif defined(A_NORMAL_WORLD_ON) + #define A_INNER_VERTEX_DATA2(A, B, C, D) \ + float4 texcoords : TEXCOORD##A; \ + half3 normalWorld : TEXCOORD##B; +#else + #define A_INNER_VERTEX_DATA2(A, B, C, D) \ + float4 texcoords : TEXCOORD##A; +#endif + +// Vertex Color, Position, View Depth, Fog, and Screen UV. +#if defined(A_POSITION_TEXCOORD_ON) && defined(A_FOG_TEXCOORD_ON) + #define A_INNER_VERTEX_DATA1(A, B, C, D, E, F, G) \ + half4 color : TEXCOORD##A; \ + float4 positionWorldAndViewDepth : TEXCOORD##B; \ + UNITY_FOG_COORDS_PACKED(C, half4) \ + A_INNER_VERTEX_DATA2(D, E, F, G) +#elif defined(A_POSITION_TEXCOORD_ON) + #define A_INNER_VERTEX_DATA1(A, B, C, D, E, F, G) \ + half4 color : TEXCOORD##A; \ + float4 positionWorldAndViewDepth : TEXCOORD##B; \ + A_INNER_VERTEX_DATA2(C, D, E, F) +#elif defined(A_FOG_TEXCOORD_ON) + #define A_INNER_VERTEX_DATA1(A, B, C, D, E, F, G) \ + half4 color : TEXCOORD##A; \ + UNITY_FOG_COORDS_PACKED(C, half4) \ + A_INNER_VERTEX_DATA2(D, E, F, G) +#else + #define A_INNER_VERTEX_DATA1(A, B, C, D, E, F, G) \ + half4 color : TEXCOORD##A; \ + A_INNER_VERTEX_DATA2(B, C, D, E) +#endif + +// Instancing. +#if defined(A_TRANSFER_INSTANCE_ID_ON) && defined(A_STEREO_INSTANCING_PASS) + #define A_INSTANCING_VERTEX_DATA(A, B, C, D, E, F, G) A_INNER_VERTEX_DATA1(A, B, C, D, E, F, G) UNITY_VERTEX_INPUT_INSTANCE_ID UNITY_VERTEX_OUTPUT_STEREO +#elif defined(A_TRANSFER_INSTANCE_ID_ON) + #define A_INSTANCING_VERTEX_DATA(A, B, C, D, E, F, G) A_INNER_VERTEX_DATA1(A, B, C, D, E, F, G) UNITY_VERTEX_INPUT_INSTANCE_ID +#elif defined(A_STEREO_INSTANCING_PASS) + #define A_INSTANCING_VERTEX_DATA(A, B, C, D, E, F, G) A_INNER_VERTEX_DATA1(A, B, C, D, E, F, G) UNITY_VERTEX_OUTPUT_STEREO +#else + #define A_INSTANCING_VERTEX_DATA(A, B, C, D, E, F, G) A_INNER_VERTEX_DATA1(A, B, C, D, E, F, G) +#endif + +// Surface shader off. +#if defined(A_SURFACE_SHADER_OFF) + #define A_VERTEX_DATA(A, B, C, D, E, F, G) +#else + #define A_VERTEX_DATA(A, B, C, D, E, F, G) A_INSTANCING_VERTEX_DATA(A, B, C, D, E, F, G) +#endif + +/// Configurable vertex input data from the application. +struct AVertexInput +{ + float4 vertex : POSITION; + float4 uv0 : TEXCOORD0; + float4 uv1 : TEXCOORD1; + half3 normal : NORMAL; +#ifdef A_UV2_ON + float4 uv2 : TEXCOORD2; +#endif +#ifdef A_UV3_ON + float4 uv3 : TEXCOORD3; +#endif +#ifdef A_TANGENT_ON + half4 tangent : TANGENT; +#endif + half4 color : COLOR; + UNITY_VERTEX_INPUT_INSTANCE_ID +}; + +/// Extensible fragment input data. +struct AFragmentInput { +#if defined(A_FORWARD_TEXCOORD0) && defined(A_FORWARD_TEXCOORD1) && defined(A_FORWARD_TEXCOORD2) + A_FORWARD_TEXCOORD0 + A_FORWARD_TEXCOORD1 + A_FORWARD_TEXCOORD2 + A_VERTEX_DATA(3, 4, 5, 6, 7, 8, 9) +#elif defined(A_FORWARD_TEXCOORD0) && defined(A_FORWARD_TEXCOORD1) + A_FORWARD_TEXCOORD0 + A_FORWARD_TEXCOORD1 + A_VERTEX_DATA(2, 3, 4, 5, 6, 7, 8) +#elif defined(A_FORWARD_TEXCOORD0) + A_FORWARD_TEXCOORD0 + A_VERTEX_DATA(1, 2, 3, 4, 5, 6, 7) +#else + A_VERTEX_DATA(0, 1, 2, 3, 4, 5, 6) +#endif +}; + +// TODO: Find a way to move this dependency! +#include "Assets/Alloy/Shaders/Framework/Tessellation.cginc" + +/// Transfers the per-vertex lightmapping or SH data to the fragment shader. +/// @param[in,out] i Vertex to fragment transfer data. +/// @param[in] v Vertex input data. +void aVertexGi( + inout AFragmentInput i, + AVertexInput v) +{ +#ifdef A_INDIRECT_ON + #ifdef LIGHTMAP_ON + i.giData.xy = v.uv1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + i.giData.zw = 0.0h; + #elif UNITY_SHOULD_SAMPLE_SH + // Add approximated illumination from non-important point lights + half3 normalWorld = i.normalWorld.xyz; + + #ifdef VERTEXLIGHT_ON + i.giData.rgb = aShade4PointLights(i.positionWorldAndViewDepth.xyz, normalWorld); + #endif + + i.giData.rgb = ShadeSHPerVertex(normalWorld, i.giData.rgb); + #endif + + #ifdef DYNAMICLIGHTMAP_ON + i.giData.zw = v.uv2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #endif +#endif +} + +/// Populates a UnityGI descriptor in the fragment shader. +/// @param i Vertex to fragment transfer data. +/// @param s Material surface data. +/// @param shadow Forward Base directional light shadow. +/// @return Initialized UnityGI descriptor. +UnityGI aFragmentGi( + AFragmentInput i, + ASurface s, + half shadow) +{ + UnityGI gi; + UNITY_INITIALIZE_OUTPUT(UnityGI, gi); + +#ifdef A_INDIRECT_ON + UnityGIInput d; + + UNITY_INITIALIZE_OUTPUT(UnityGIInput, d); + d.worldPos = s.positionWorld; + d.worldViewDir = s.viewDirWorld; // ??? + d.atten = shadow; + + #if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON) + d.ambient = 0; + d.lightmapUV = i.giData; + #else + d.ambient = i.giData.rgb; + d.lightmapUV = 0; + #endif + + d.probeHDR[0] = unity_SpecCube0_HDR; + d.probeHDR[1] = unity_SpecCube1_HDR; + + #if defined(UNITY_SPECCUBE_BLENDING) || defined(UNITY_SPECCUBE_BOX_PROJECTION) + d.boxMin[0] = unity_SpecCube0_BoxMin; // .w holds lerp value for blending + #endif + + #ifdef UNITY_SPECCUBE_BOX_PROJECTION + d.boxMax[0] = unity_SpecCube0_BoxMax; + d.probePosition[0] = unity_SpecCube0_ProbePosition; + d.boxMax[1] = unity_SpecCube1_BoxMax; + d.boxMin[1] = unity_SpecCube1_BoxMin; + d.probePosition[1] = unity_SpecCube1_ProbePosition; + #endif + + // So we can extract shadow with baked occlusion. + #ifdef HANDLE_SHADOWS_BLENDING_IN_GI + d.light.color = A_WHITE; + #endif + + // Pass 1.0 for occlusion so we can apply it later in indirect(). + gi = UnityGI_Base(d, 1.0h, s.ambientNormalWorld); + + #ifdef A_REFLECTION_PROBES_ON + Unity_GlossyEnvironmentData g; + + g.reflUVW = s.reflectionVectorWorld; + g.roughness = s.roughness; + gi.indirect.specular = UnityGI_IndirectSpecular(d, 1.0h, s.normalWorld, g); + #endif +#endif + + return gi; +} + +/// Transforms the vertex data before transferring it to the pixel shader. +/// @param[in,out] v Vertex input data. +/// @param[out] o Vertex to fragment transfer data. +/// @param[out] opos Clip space position. +void aForwardVertexShader( + inout AVertexInput v, + out AFragmentInput o, + out float4 opos) +{ +#ifdef A_SURFACE_SHADER_OFF + opos = 0.0h; +#else + UNITY_INITIALIZE_OUTPUT(AFragmentInput, o); + + #ifdef A_INSTANCING_PASS + UNITY_SETUP_INSTANCE_ID(v); + + #ifdef A_TRANSFER_INSTANCE_ID_ON + UNITY_TRANSFER_INSTANCE_ID(v, o); + #endif + + #ifdef A_STEREO_INSTANCING_PASS + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + #endif + #endif + + // Copy vertex data, and let shader type modify it. + AVertex vs = aNewVertex(); + + vs.positionObject = v.vertex; + vs.uv0 = v.uv0; + vs.uv1 = v.uv1; + vs.normalObject = v.normal; + + #ifdef A_UV2_ON + vs.uv2 = v.uv2; + #endif + #ifdef A_UV3_ON + vs.uv3 = v.uv3; + #endif + #ifdef A_TANGENT_ON + vs.tangentObject = v.tangent; + #endif + + vs.color = v.color; + + aVertexShader(vs); + + // Copy data back into original, in case outer shader needs it. + v.vertex = vs.positionObject; + v.uv0 = vs.uv0; + v.uv1 = vs.uv1; + v.normal = vs.normalObject; + + #ifdef A_UV2_ON + v.uv2 = vs.uv2; + #endif + #ifdef A_UV3_ON + v.uv3 = vs.uv3; + #endif + #ifdef A_TANGENT_ON + v.tangent = vs.tangentObject; + #endif + + v.color = vs.color; + + // Fill V2F. + o.color = v.color; // Gamma-space vertex color, unless modified. + o.texcoords.xy = v.uv0.xy; + o.texcoords.zw = v.uv1.xy; + opos = UnityObjectToClipPos(v.vertex.xyz); + + #ifdef A_POSITION_TEXCOORD_ON + #ifdef A_POSITION_WORLD_ON + o.positionWorldAndViewDepth.xyz = mul(unity_ObjectToWorld, v.vertex).xyz; + #endif + + #ifdef A_VIEW_DEPTH_ON + COMPUTE_EYEDEPTH(o.positionWorldAndViewDepth.w); + #endif + #endif + + #ifdef A_NORMAL_WORLD_ON + float3 normalWorld = UnityObjectToWorldNormal(v.normal); + #endif + + #ifndef A_TANGENT_TO_WORLD_ON + #ifdef A_NORMAL_WORLD_ON + o.normalWorld = normalWorld; + #endif + #else + float3 tangentWorld = UnityObjectToWorldDir(v.tangent.xyz); + float3x3 tangentToWorld = CreateTangentToWorldPerVertex(normalWorld, tangentWorld, v.tangent.w); + + o.tangentWorld = tangentToWorld[0]; + o.bitangentWorld = tangentToWorld[1]; + o.normalWorld = tangentToWorld[2]; + #endif + + #if defined(A_SCREEN_UV_ON) || (defined(A_DIRECT_ON) && defined(A_SCREENSPACE_SHADOWS_ON)) + float4 screenPos = ComputeScreenPos(opos); + #endif + + // Fog and Screen UV. + #ifdef A_FOG_TEXCOORD_ON + #ifdef A_SCREEN_UV_ON + o.fogCoord.yzw = screenPos.xyw; + #else + o.fogCoord.yzw = A_AXIS_Z; + #endif + + #ifdef A_FOG_ON + UNITY_TRANSFER_FOG(o, opos); + #endif + #endif + + // Lighting data. + aVertexGi(o, v); + + #ifdef A_DIRECT_ON + // NOTE: Custom macro to skip calculations and remove dependency on o.pos! + #ifdef A_SCREENSPACE_SHADOWS_ON + o._ShadowCoord = screenPos; + #else + UNITY_TRANSFER_SHADOW(o, v.uv1); + #endif + + #if !defined(DIRECTIONAL) && !defined(A_LIGHTMAP_SHADOW_MIXING_ON) + o.lightCoord = mul(unity_WorldToLight, unityShadowCoord4(o.positionWorldAndViewDepth.xyz, 1.0f)); + + #ifndef USING_DIRECTIONAL_LIGHT + o.lightVectorRange = UnityWorldSpaceLightDir(o.positionWorldAndViewDepth.xyz).xyzz; + aLightRange(o.lightVectorRange, o.lightCoord); + #endif + #endif + #endif +#endif +} + +/// Create a surface populated with material data. +/// @param i Vertex to fragment transfer data. +/// @param facingSign Sign of front/back facing direction. +/// @return Initialized surface data object. +ASurface aForwardSurface( + AFragmentInput i, + half facingSign) +{ + ASurface s = aNewSurface(); + +#ifndef A_SURFACE_SHADER_OFF + #ifdef A_TRANSFER_INSTANCE_ID_ON + UNITY_SETUP_INSTANCE_ID(i); + #endif + + s.uv01 = i.texcoords; + s.vertexColor = i.color; + s.facingSign = facingSign; + + #ifdef A_POSITION_TEXCOORD_ON + #ifdef A_POSITION_WORLD_ON + s.positionWorld = i.positionWorldAndViewDepth.xyz; + #endif + + #ifdef A_VIEW_DEPTH_ON + s.viewDepth = i.positionWorldAndViewDepth.w; + #endif + #endif + + #ifdef A_NORMAL_WORLD_ON + #ifdef A_TWO_SIDED_SHADER + i.normalWorld.xyz *= facingSign; + #endif + + // Give these sane defaults in case the surface shader doesn't set them. + s.vertexNormalWorld = normalize(i.normalWorld); + s.normalWorld = s.vertexNormalWorld; + s.ambientNormalWorld = s.vertexNormalWorld; + #endif + + #ifdef A_VIEW_DIR_WORLD_ON + // Cheaper to calculate in PS than to unpack from vertex, while also + // preventing distortion in POM and area light specular highlights. + s.viewDirWorld = normalize(UnityWorldSpaceViewDir(s.positionWorld)); + #endif + + #ifdef A_TANGENT_TO_WORLD_ON + half3 t = i.tangentWorld; + half3 b = i.bitangentWorld; + half3 n = i.normalWorld; + + #if UNITY_TANGENT_ORTHONORMALIZE + n = normalize(n); + + // ortho-normalize Tangent + t = normalize (t - n * dot(t, n)); + + // recalculate Binormal + half3 newB = cross(n, t); + b = newB * sign (dot (newB, b)); + #endif + + s.tangentToWorld = half3x3(t, b, n); + + #if defined(A_VIEW_DIR_WORLD_ON) && defined(A_VIEW_DIR_TANGENT_ON) + s.viewDirTangent = normalize(mul(s.tangentToWorld, s.viewDirWorld)); + #endif + #endif + + #ifdef A_FOG_TEXCOORD_ON + #ifdef A_FOG_ON + s.fogCoord = i.fogCoord; + #endif + + #ifdef A_SCREEN_UV_ON + s.screenPosition.xyw = i.fogCoord.yzw; + s.screenPosition.z = 0.0h; + s.screenUv.xy = s.screenPosition.xy / s.screenPosition.w; + + #ifdef LOD_FADE_CROSSFADE + half2 projUV = s.screenUv.xy * _ScreenParams.xy * 0.25h; + + projUV.y = frac(projUV.y) * 0.0625h /* 1/16 */ + unity_LODFade.y; // quantized lod fade by 16 levels + clip(tex2D(_DitherMaskLOD2D, projUV).a - 0.5f); + #endif + #endif + #endif + + // Runs the shader and lighting type's surface code. + aBaseUvInit(s); + aUpdateViewData(s); + aSurfaceShader(s); + aPreLighting(s); +#endif + + return s; +} + +/// Final processing of the forward color before output. +/// @param s Material surface data. +/// @param color Lighting + Emission + Fog + etc. +/// @return Final HDR output color with alpha opacity. +half4 aForwardColor( + ASurface s, + half3 color) +{ + half4 output; + +#if defined(A_ALPHA_BLENDING_PASS) && defined(A_ALPHA_BLENDING_ON) + output.a = s.opacity; +#else + UNITY_OPAQUE_ALPHA(output.a); +#endif + + output.rgb = color; + aColorShader(output, s); + return aHdrClamp(output); +} + +/// Calculates forward lighting from surface and vertex data. +/// @param i Vertex to fragment transfer data. +/// @param facingSign Sign of front/back facing direction. +/// @return Forward direct and indirect lighting. +half4 aForwardLitColorShader( + AFragmentInput i, + half facingSign) +{ + half3 illum = 0.0h; + ASurface s = aForwardSurface(i, facingSign); + +#ifdef A_LIGHTING_ON + half shadow = UNITY_SHADOW_ATTENUATION(i, s.positionWorld); + + #ifdef A_INDIRECT_ON + UnityGI gi = aFragmentGi(i, s, shadow); + + illum = aUnityIndirectLighting(gi, s); + + // Extract shadow with combined baked occlusion. + #ifdef HANDLE_SHADOWS_BLENDING_IN_GI + shadow = gi.light.color.g; + #endif + #endif + + // Do lightmap shadow mixing guard here, since we need direct vertex data. + #if defined(A_DIRECT_ON) && !defined(A_LIGHTMAP_SHADOW_MIXING_ON) + // Reduce v2f transfer cost for pure directional lights. + #if defined(DIRECTIONAL) + illum += aUnityDirectLighting(s, shadow, _WorldSpaceLightPos0, A_ZERO4); + #elif defined(DIRECTIONAL_COOKIE) + illum += aUnityDirectLighting(s, shadow, _WorldSpaceLightPos0, i.lightCoord); + #else + illum += aUnityDirectLighting(s, shadow, i.lightVectorRange, i.lightCoord); + #endif + #endif +#endif + +#if defined(A_BASE_PASS) && defined(A_EMISSIVE_COLOR_ON) + illum += s.emissiveColor; +#endif + + return aForwardColor(s, illum); +} + +/// Creates a G-Buffer from the provided surface data. +/// @param i Vertex to fragment transfer data. +/// @param facingSign Sign of front/back facing direction. +/// @return G-buffer with surface data and ambient illumination. +AGbuffer aForwardLitGbufferShader( + AFragmentInput i, + half facingSign) +{ + half3 illum = 0.0h; + AGbuffer gb = aNewGbuffer(); + ASurface s = aForwardSurface(i, facingSign); + +#ifdef A_INDIRECT_ON + illum += aUnityIndirectLighting(aFragmentGi(i, s, 1.0h), s); + + // Baked direct lighting occlusion if any. + #ifdef A_SHADOW_MASKS_BUFFER_ON + gb.shadowMasks = UnityGetRawBakedOcclusions(i.giData.xy, s.positionWorld); + #endif +#endif + +#ifdef A_EMISSIVE_COLOR_ON + illum += s.emissiveColor; +#endif + +#if defined(A_INDIRECT_ON) || defined(A_EMISSIVE_COLOR_ON) + illum = aHdrClamp(illum); +#endif + +#ifndef UNITY_HDR_ON + illum = exp2(-illum); +#endif + + gb.diffuseOcclusion = half4(s.albedo, s.specularOcclusion); + gb.specularSmoothness = half4(s.f0, 1.0h - s.roughness); + gb.normalType = half4(s.normalWorld * 0.5h + 0.5h, s.materialType); + gb.emissionSubsurface = half4(illum, s.subsurface); + aGbufferShader(gb, s); + return gb; +} + +#endif // ALLOY_SHADERS_FRAMEWORK_FORWARD_CGINC diff --git a/Assets/Alloy/Shaders/Framework/Forward.cginc.meta b/Assets/Alloy/Shaders/Framework/Forward.cginc.meta new file mode 100644 index 0000000..8e518e5 --- /dev/null +++ b/Assets/Alloy/Shaders/Framework/Forward.cginc.meta @@ -0,0 +1,6 @@ +fileFormatVersion: 2 +guid: d38ced127b82dbc4ba0d177f21160d88 +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: diff --git a/Assets/Alloy/Shaders/Framework/Lighting.cginc b/Assets/Alloy/Shaders/Framework/Lighting.cginc new file mode 100644 index 0000000..5d79f57 --- /dev/null +++ b/Assets/Alloy/Shaders/Framework/Lighting.cginc @@ -0,0 +1,531 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file Lighting.cginc +/// @brief Lighting uber-header. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_FRAMEWORK_LIGHTING_CGINC +#define ALLOY_SHADERS_FRAMEWORK_LIGHTING_CGINC + +// Headers both for this file, and for all Definition and Feature modules. +#include "Assets/Alloy/Shaders/Framework/Utility.cginc" + +#include "UnityLightingCommon.cginc" + +#ifndef A_SURFACE_CUSTOM_FIELDS + #define A_SURFACE_CUSTOM_FIELDS +#endif + +/// Tangent-space normal assignment and update of associated fields. +#define A_NT(s, n) n; aUpdateNormalTangent(s) + +/// World-space normal assignment and update of associated fields. +#define A_NW(s, n) n; aUpdateNormalWorld(s) + +/// Subsurface assignment and update of associated fields. +#define A_SS(s, ss) ss; aUpdateSubsurface(s) + +/// Subsurface color assignment and update of associated fields. +#define A_SSC(s, ssc) ssc; aUpdateSubsurfaceColor(s) + +// Use Unity's struct directly to avoid copying since the fields are the same. +#define AIndirect UnityIndirect + +/// Collection of direct illumination data. +struct ADirect { + ///////////////////////////////////////////////////////////////////////////// + // Material lighting. + ///////////////////////////////////////////////////////////////////////////// + + /// Light color, attenuation, and cookies. + /// Expects linear-space HDR color values. + half3 color; + + /// Shadowing. + /// Expects values in the range [0,1]. + half shadow; + + /// Specular highlight intensity. + /// Expects values in the range [0,n]. + half specularIntensity; + + /// Light direction in world-space. + /// Expects normalized vectors. + half3 direction; + + /// Direction halfway between the light and view vectors in world space. + /// Expects normalized vectors. + half3 halfAngleWorld; + + /// Clamped L.H. + /// Expects values in the range [0,1]. + half LdotH; + + /// Clamped N.H. + /// Expects values in the range [0,1]. + half NdotH; + + /// Clamped N.L. + /// Expects values in the range [0,1]. + half NdotL; + + /// Unclamped N.L. + /// Expects values in the range [0,1]. + half NdotLm; + + + ///////////////////////////////////////////////////////////////////////////// + // Internal. + ///////////////////////////////////////////////////////////////////////////// + + /// Diffuse area light vector. + /// Expects a non-normalized vector. + float3 Ldiff; + + /// Specular area light vector. + /// Expects a non-normalized vector. + float3 Lspec; + + /// One over the distance to the center of the light volume. + /// Expects values in the range [0,n). + half centerDistInverse; +}; + +/// Contains ALL data and state for rendering a surface. +/// Can set state to control how features are combined into the surface data. +struct ASurface { + ///////////////////////////////////////////////////////////////////////////// + // Vertex inputs. + ///////////////////////////////////////////////////////////////////////////// + + /// Screen-space position. + float4 screenPosition; + + /// Screen-space texture coordinates. + float2 screenUv; + + /// Position in world space. + float3 positionWorld; + + /// View direction in world space. + /// Expects a normalized vector. + half3 viewDirWorld; + + /// Distance from the camera to the given fragement. + /// Expects values in the range [0,n]. + half viewDepth; + + /// Unity's fog data. + float fogCoord; + + /// Tangent space to World space rotation matrix. + half3x3 tangentToWorld; + + /// View direction in tangent space. + /// Expects a normalized vector. + half3 viewDirTangent; + + /// Vertex color. + /// Expects linear-space LDR color values. + half4 vertexColor; + + /// Vertex normal in world space. + /// Expects normalized vectors. + half3 vertexNormalWorld; + + /// Indicates via sign whether a triangle is front or back facing. + /// Positive is front-facing, negative is back-facing. + half facingSign; + + + ///////////////////////////////////////////////////////////////////////////// + // Feature layering inputs. + ///////////////////////////////////////////////////////////////////////////// + + /// Masks where the next feature layer will be applied. + /// Expects values in the range [0,1]. + half mask; + + /// The base map's texture transform tiling amount. + float2 baseTiling; + + /// Transformed texture coordinates for the base map. + float2 baseUv; + +#ifdef _VIRTUALTEXTURING_ON + /// Transformed texture coordinates for the virtual base map. + VirtualCoord baseVirtualCoord; +#endif + + /// The model's UV0 & UV1 texture coordinate data. + /// Be aware that it can have parallax precombined with it. + float4 uv01; + + + ///////////////////////////////////////////////////////////////////////////// + // Surface inputs. + ///////////////////////////////////////////////////////////////////////////// + + /// Albedo and/or Metallic f0 based on settings. Used by Enlighten. + /// Expects linear-space LDR color values. + half3 baseColor; + + /// Controls opacity or cutout regions. + /// Expects values in the range [0,1]. + half opacity; + + /// Interpolates material from dielectric to metal. + /// Expects values in the range [0,1]. + half metallic; + + /// Diffuse ambient occlusion. + /// Expects values in the range [0,1]. + half ambientOcclusion; + + /// Linear control of dielectric f0 from [0.00,0.08]. + /// Expects values in the range [0,1]. + half specularity; + + /// Tints the dielectric specularity by the base color chromaticity. + /// Expects values in the range [0,1]. + half specularTint; + + /// Linear roughness value, where zero is smooth and one is rough. + /// Expects values in the range [0,1]. + half roughness; + + /// Light emission by the material. + /// Expects linear-space HDR color values. + half3 emissiveColor; + + /// Color tint for transmission effect. + /// Expects linear-space LDR color values. + half3 subsurfaceColor; + + /// Monochrome transmission thickness. + /// Expects gamma-space LDR values. + half subsurface; + + /// Strength of clearcoat layer, used to apply masks. + /// Expects values in the range [0,1]. + half clearCoat; + + /// Roughness of clearcoat layer. + /// Expects values in the range [0,1]. + half clearCoatRoughness; + + /// Normal in world space. + /// Expects a normalized vector. + half3 normalWorld; + + /// Normal in tangent space. + /// Expects a normalized vector. + half3 normalTangent; + + /// Blurred normal in tangent space. + /// Expects a normalized vector. + half3 blurredNormalTangent; + + + ///////////////////////////////////////////////////////////////////////////// + // BRDF inputs. + ///////////////////////////////////////////////////////////////////////////// + + /// Diffuse albedo. + /// Expects linear-space LDR color values. + half3 albedo; + + /// Fresnel reflectance at incidence zero. + /// Expects linear-space LDR color values. + half3 f0; + + /// Beckmann roughness. + /// Expects values in the range [0,1]. + half beckmannRoughness; + + /// Specular occlusion. + /// Expects values in the range [0,1]. + half specularOcclusion; + + /// Ambient diffuse normal in world space. + /// Expects normalized vectors. + half3 ambientNormalWorld; + + /// View reflection vector in world space. + /// Expects a non-normalized vector. + half3 reflectionVectorWorld; + + /// Clamped N.V. + /// Expects values in the range [0,1]. + half NdotV; + + /// Fresnel weight of N.V. + /// Expects values in the range [0,1]. + half FV; + + /// Deferred material lighting type. + /// Expects the values 0, 1/3, 2/3, or 1. + half materialType; + + A_SURFACE_CUSTOM_FIELDS + + half _skinScatteringMask; + half _skinScattering; + half _subsurfaceShadowWeight; +}; + +/// Maximum linear-space non-metal specular reflectivity. +static const half A_MAX_DIELECTRIC_F0 = 0.08h; + +/// Minimum roughness that won't cause specular artifacts. +static const half A_MIN_AREA_ROUGHNESS = 0.05h; + +/// Front-faces cull mode. +static const half A_CULL_MODE_FRONT = 1.0h; + +/// Opaque shading type. +static const half A_MATERIAL_TYPE_OPAQUE = 1.0h; + +/// Shadowed subsurface transmission shading type. +static const half A_MATERIAL_TYPE_SHADOWED_SUBSURFACE = 2.0h / 3.0h; + +/// Unshadowed subsurface transmission shading type. +static const half A_MATERIAL_TYPE_UNSHADOWED_SUBSURFACE = 1.0h / 3.0h; + +/// Subsurface scattering shading type. +static const half A_MATERIAL_TYPE_SUBSURFACE_SCATTERING = 0.0h; + +#ifdef A_DEFERRED_PASS + /// RGB=Blurred normals, A=Subsurface thickness. + /// Expects value in the buffer alpha. + sampler2D _DeferredPlusBuffer; +#endif + +#ifdef A_FORWARD_ONLY_SHADER + /// Pre-Integrated scattering LUT. + sampler2D _SssBrdfTex; + + /// Weight of the scattering effect. + /// Expects values in the range [0,1]. + half _SssWeight; + + /// Cutoff value used to convert tranmission data to scattering mask. + /// Expects values in the range [0.01,1]. + half _SssMaskCutoff; + + /// Biases the thickness value used to look up in the skin LUT. + /// Expects values in the range [0,1]. + half _SssBias; + + /// Scales the thickness value used to look up in the skin LUT. + /// Expects values in the range [0,1]. + half _SssScale; + + /// Increases the bluriness of the normal map for diffuse lighting. + /// Expects values in the range [0,1]. + half _SssBumpBlur; + + /// Per-channel weights for thickness-based subsurface color absorption. + half3 _SssTransmissionAbsorption; + + /// Per-channel RGB gamma weights for colored AO. + /// Expects a vector of non-zero values. + half3 _SssColorBleedAoWeights; + + /// Weight of the subsurface effect. + /// Expects linear-space values in the range [0,1]. + half _TransWeight; +#else + /// Pre-Integrated scattering LUT. + sampler2D _DeferredSkinLut; + + /// X=Scattering Weight, Y=1/Mask Cutoff, Z=Blur Weight. + /// Expects a vector of non-zero values. + half3 _DeferredSkinParams; + + /// Per-channel weights for thickness-based subsurface color absorption. + /// LUT Bias in alpha. + half4 _DeferredSkinTransmissionAbsorption; + + /// Per-channel RGB gamma weights for colored AO. LUT Scale in alpha. + /// Expects a vector of non-zero values. + half4 _DeferredSkinColorBleedAoWeights; +#endif + +/// The current culling mode for transmission shadows. +float _ShadowCullMode; + +#ifdef A_FORWARD_ONLY_SHADER + /// Shadow influence on the subsurface effect. + /// Expects values in the range [0,1]. + half _TransShadowWeight; + + /// Amount that the subsurface is distorted by surface normals. + /// Expects values in the range [0,1]. + half _TransDistortion; + + /// Falloff of the subsurface effect. + /// Expects values in the range [1,n). + half _TransPower; +#else + /// X=Linear Weight, Y=Falloff, Z=Bump Distortion, W=Shadow Weight. + /// Expects a vector of non-zero values. + half4 _DeferredTransmissionParams; +#endif + +/// Abstract declaration for user-defined pre-lighting callback. +void aPreLighting(inout ASurface s); + +/// Abstract declaration for user-defined direct lighting callback. +half3 aDirectLighting(ADirect d, ASurface s); + +/// Abstract declaration for user-defined indirect lighting callback. +half3 aIndirectLighting(AIndirect i, ASurface s); + +/// Indirect lighting data constructor. +AIndirect aNewIndirect(); + +/// Direct lighting data constructor. +ADirect aNewDirect(); + +/// Applies light cookie to description. +/// @param[in,out] d Direct lighting data. +/// @param[in] cookie Cookie map sample. +void aLightCookie(inout ADirect d, half4 cookie); + +/// Light range limit falloff. +/// @param[in,out] d Direct lighting data. +/// @param[in] range Light volume radius. +void aSetLightRangeLimit(inout ADirect d, half range); + +/// Populates light with brdf dot products, except N.L. +/// @param[in,out] d Direct lighting data. +/// @param[in] s Material surface data. +void aUpdateLightingInputs(inout ADirect d, ASurface s); + +/// Populates specular lighting data for an area light. +/// @param[in,out] d Direct lighting data. +/// @param[in] s Material surface data. +/// @param[in] radius Area light radius. +void aSetAreaSpecularInputs(inout ADirect d, ASurface s, half radius); + +/// Populates material lighting data for an area light. +/// @param[in,out] d Direct lighting data. +/// @param[in] s Material surface data. +/// @param[in] radius Area light radius. +/// @return One over area diffuse light vector length. +half aSetAreaLightingInputs(inout ADirect d, ASurface s, half radius); + +/// Populates data for a directional light. +/// @param[in,out] d Direct lighting data. +/// @param[in] s Material surface data. +void aDirectionalLight(inout ADirect d, ASurface s); + +/// Populates data for a directional light. +/// @param[in,out] d Direct lighting data. +/// @param[in] s Material surface data. +/// @param[in] direction Light normalized direction. +/// @param[in] radius Disc light radius. +void aDirectionalDiscLight(inout ADirect d, ASurface s, half3 direction, half radius); + +/// Populates data for a sphere area light. +/// @param[in,out] d Direct lighting data. +/// @param[in] s Material surface data. +/// @param[in] L Vector to light center. +/// @param[in] radius Sphere light radius. +void aSphereLight(inout ADirect d, ASurface s, float3 L, half radius); + +/// Populates data for a sphere area light. +/// @param[in,out] d Direct lighting data. +/// @param[in] s Material surface data. +/// @param[in] L Vector to light center. +/// @param[in] axis Tube light normalized axis direction. +/// @param[in] radius Tube light radius. +/// @param[in] halfLength Half the length of the tube light. +void aTubeLight(inout ADirect d, ASurface s, float3 L, half3 axis, half radius, half halfLength); + +/// Populates data for an area light. +/// @param[in,out] d Direct lighting data. +/// @param[in] s Material surface data. +/// @param[in] color Light color, size weight in alpha. +/- sign. +/// @param[in] axis Tube light normalized axis direction. +/// @param[in] L Vector to light center. +/// @param[in] range Light bounding volume range. +void aAreaLight(inout ADirect d, ASurface s, half4 color, half3 axis, float3 L, half range); + +/// Surface data constructor. +ASurface aNewSurface(); + +/// Sets the feature mask by using a gradient input mask. +/// @param[in,out] s Material surface data. +/// @param[in] mask Gradient where effect goes from black to white. +/// @param[in] weight Weight of the effect. +/// @param[in] cutoff Value below which the gradient becomes a mask. +/// @param[in] blendRange Range of smooth blend above cutoff. +/// @param[in] vertexTint Weight of vertex color alpha cutoff override. +void aBlendRangeMask(inout ASurface s, half mask, half weight, half cutoff, half blendRange, half vertexTint); + +/// Transforms a normal from tangent-space to world-space. +half3 aTangentToWorld(ASurface s, half3 normalTangent); + +/// Transforms a normal from world-space to tangent-space. +half3 aWorldToTangent(ASurface s, half3 normalWorld); + +/// Calculates and sets normal and view-dependent data. +void aUpdateViewData(inout ASurface s); + +/// Update values dependent on tangent-space normal. +void aUpdateNormalTangent(inout ASurface s); + +/// Update values dependent on world-space normal. +void aUpdateNormalWorld(inout ASurface s); + +/// Update values dependent on subsurface. +void aUpdateSubsurface(inout ASurface s); + +/// Update values dependent on subsurface color. +void aUpdateSubsurfaceColor(inout ASurface s); + +/// Calculates the fresnel at incidence zero from a normalized specularity. +/// @param specularity Normalized specularity [0,1]. +/// @return F0 [0,0.08]. +half3 aSpecularityToF0(half specularity); + +/// Convert linear roughness to Beckmann roughness. +/// @param roughness Linear roughness [0,1]. +/// @return Beckmann Roughness. +half aLinearToBeckmannRoughness(half roughness); + +/// Blend weight portion of Schlick fresnel equation. +/// @param w Clamped dot product of two normalized vectors. +/// @return Fresnel blend weight. +half aFresnel(half w); + +/// Switches off specular lighting per-pixel where surface f0 is black. +half3 aSpecularLightingToggle(ASurface s, half3 specular); + +/// Calculates specular occlusion. +/// @param ao Linear ambient occlusion. +/// @param NdotV Normal and eye vector dot product [0,1]. +/// @return Specular occlusion. +half aSpecularOcclusion(half ao, half NdotV); + +/// Pre-calculate material data shared between direct & indirect lighting. +void aStandardPreLighting(inout ASurface s); + +/// Calculate direct illumination from a light and a surface. +/// @param d Direct lighting data. +/// @param s Material surface data. +/// @return Direct illumination. +half3 aStandardDirectLighting(ADirect d, ASurface s); + +/// Calculate indirect illumination from a light and a surface. +/// @param i Indirect lighting data. +/// @param s Material surface data. +/// @return Indirect illumination. +half3 aStandardIndirectLighting(AIndirect i, ASurface s); + +#endif // ALLOY_SHADERS_FRAMEWORK_LIGHTING_CGINC diff --git a/Assets/Alloy/Shaders/Framework/Lighting.cginc.meta b/Assets/Alloy/Shaders/Framework/Lighting.cginc.meta new file mode 100644 index 0000000..5798cff --- /dev/null +++ b/Assets/Alloy/Shaders/Framework/Lighting.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 315a77a44673cd540ad1ecad6d2f47be +timeCreated: 1437938893 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/Framework/LightingImpl.cginc b/Assets/Alloy/Shaders/Framework/LightingImpl.cginc new file mode 100644 index 0000000..a2191a6 --- /dev/null +++ b/Assets/Alloy/Shaders/Framework/LightingImpl.cginc @@ -0,0 +1,761 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file LightingImpl.cginc +/// @brief Lighting method implementations to allow disabling of features. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_FRAMEWORK_LIGHTING_IMPL_CGINC +#define ALLOY_SHADERS_FRAMEWORK_LIGHTING_IMPL_CGINC + +// Headers both for this file, and for all Definition and Feature modules. +#include "Assets/Alloy/Shaders/Config.cginc" +#include "Assets/Alloy/Shaders/Framework/Lighting.cginc" +#include "Assets/Alloy/Shaders/Framework/Utility.cginc" + +#include "HLSLSupport.cginc" +#include "UnityCG.cginc" +#include "UnityShaderVariables.cginc" + +#if !A_USE_UNITY_ATTENUATION || defined(USING_DIRECTIONAL_LIGHT) + #define A_UNITY_ATTENUATION(d, tex, lightCoord, scale) +#else + #define A_UNITY_ATTENUATION(d, tex, lightCoord, scale) d.color *= tex2D(tex, (dot(lightCoord, lightCoord) * scale).rr).UNITY_ATTEN_CHANNEL; +#endif + +#if !defined(A_REFLECTION_PROBES_ON) && (!defined(A_GBUFFER_PASS) || !UNITY_ENABLE_REFLECTION_BUFFERS) + #define A_REFLECTION_PROBES_ON +#endif + +// Lighting required vertex data flags. +#ifndef A_UNLIT_MODE + #ifdef A_DIRECT_LIGHTING_PASS + #define A_DIRECT_ON + #endif + + #ifdef A_INDIRECT_LIGHTING_PASS + #define A_INDIRECT_ON + #endif + + #if defined(A_DIRECT_ON) || defined(A_INDIRECT_ON) + #define A_LIGHTING_ON + #endif +#endif + +#ifndef A_LIGHTING_ON + #if !defined(A_NORMAL_WORLD_ON) && defined(A_GBUFFER_PASS) + #define A_NORMAL_WORLD_ON + #endif +#else + #ifndef A_NORMAL_WORLD_ON + #define A_NORMAL_WORLD_ON + #endif + + #ifndef A_VIEW_DIR_WORLD_ON + #define A_VIEW_DIR_WORLD_ON + #endif + + #ifndef A_POSITION_WORLD_ON + #define A_POSITION_WORLD_ON + #endif + + #if !defined(A_REFLECTION_VECTOR_WORLD_ON) && (defined(A_DIRECT_ON) || defined(A_REFLECTION_PROBES_ON)) + #define A_REFLECTION_VECTOR_WORLD_ON + #endif +#endif + +#if !defined(A_TANGENT_TO_WORLD_ON) && defined(A_NORMAL_MAPPED_PASS) && (defined(A_VIEW_DIR_TANGENT_ON) || defined(A_NORMAL_MAPPING_ON)) + #define A_TANGENT_TO_WORLD_ON +#endif + +#ifndef A_SCATTERING_ON + #define A_SKIN_SUBSURFACE_WEIGHT 1.0h +#else + #define A_SKIN_SUBSURFACE_WEIGHT _TransWeight + + #ifdef A_FORWARD_ONLY_SHADER + #define A_SCATTERING_LUT _SssBrdfTex + #define A_SCATTERING_WEIGHT _SssWeight + #define A_SCATTERING_INV_MASK_CUTOFF 1.0h / _SssMaskCutoff + #define A_SCATTERING_BIAS _SssBias + #define A_SCATTERING_SCALE _SssScale + #define A_SCATTERING_NORMAL_BLUR _SssBumpBlur + #define A_SCATTERING_ABSORPTION _SssTransmissionAbsorption + #define A_SCATTERING_AO_COLOR_BLEED _SssColorBleedAoWeights + #else + #define A_SCATTERING_LUT _DeferredSkinLut + #define A_SCATTERING_WEIGHT _DeferredSkinParams.x + #define A_SCATTERING_INV_MASK_CUTOFF _DeferredSkinParams.y + #define A_SCATTERING_BIAS _DeferredSkinTransmissionAbsorption.w + #define A_SCATTERING_SCALE _DeferredSkinColorBleedAoWeights.w + #define A_SCATTERING_NORMAL_BLUR _DeferredSkinParams.z + #define A_SCATTERING_ABSORPTION _DeferredSkinTransmissionAbsorption.xyz + #define A_SCATTERING_AO_COLOR_BLEED _DeferredSkinColorBleedAoWeights.xyz + #endif +#endif + +#ifdef A_SUBSURFACE_ON + #ifdef A_FORWARD_ONLY_SHADER + #define A_SUBSURFACE_WEIGHT A_SKIN_SUBSURFACE_WEIGHT + #define A_SUBSURFACE_FALLOFF _TransPower + #define A_SUBSURFACE_DISTORTION _TransDistortion + #define A_SUBSURFACE_SHADOW _TransShadowWeight + #else + #define A_SUBSURFACE_WEIGHT _DeferredTransmissionParams.x + #define A_SUBSURFACE_FALLOFF _DeferredTransmissionParams.y + #define A_SUBSURFACE_DISTORTION _DeferredTransmissionParams.z + #define A_SUBSURFACE_SHADOW _DeferredTransmissionParams.w + #endif +#endif + +#if !A_USE_DEFERRED_MATERIAL_TYPE_BRANCHING || !defined(A_DEFERRED_PASS) + #define A_DEFERRED_BRANCH(CONDITION) +#else + #define A_DEFERRED_BRANCH(CONDITION) \ + UNITY_BRANCH \ + if (CONDITION) +#endif + +AIndirect aNewIndirect() { + AIndirect i; + + UNITY_INITIALIZE_OUTPUT(AIndirect, i); + i.diffuse = 0.0h; + i.specular = 0.0h; + + return i; +} + +ADirect aNewDirect() +{ + ADirect d; + + UNITY_INITIALIZE_OUTPUT(ADirect, d); + d.color = 0.0h; + d.shadow = 1.0h; + d.specularIntensity = 1.0h; + d.direction = A_AXIS_Y; + + return d; +} + +void aLightCookie( + inout ADirect d, + half4 cookie) +{ +#if defined(UNITY_PASS_FORWARDBASE) || A_USE_UNITY_LIGHT_COOKIES + d.color *= cookie.a; +#else + d.color *= cookie.rgb * cookie.a; +#endif +} + +void aSetLightRangeLimit( + inout ADirect d, + half range) +{ +#if !A_USE_UNITY_ATTENUATION + // Light Range Limit Falloff. + // cf http://blog.selfshadow.com/publications/s2013-shading-course/karis/s2013_pbs_epic_notes_v2.pdf p12-13 + half ratio = 1.0h / (range * d.centerDistInverse); + half ratio2 = ratio * ratio; + half num = saturate(1.0h - (ratio2 * ratio2)); + + d.color *= num * num; +#endif +} + +void aUpdateLightingInputs( + inout ADirect d, + ASurface s) +{ + d.halfAngleWorld = normalize(d.direction + s.viewDirWorld); + d.LdotH = aDotClamp(d.direction, d.halfAngleWorld); + d.NdotH = aDotClamp(s.normalWorld, d.halfAngleWorld); +} + +void aSetAreaSpecularInputs( + inout ADirect d, + ASurface s, + half radius) +{ + // Representative Point Area Lights. + // cf http://blog.selfshadow.com/publications/s2013-shading-course/karis/s2013_pbs_epic_notes_v2.pdf p14-16 +#ifdef A_AREA_SPECULAR_OFF + d.direction = d.Ldiff; +#else + float3 R = s.reflectionVectorWorld; + float3 centerToRay = dot(d.Lspec, R) * R - d.Lspec; + float3 closestPoint = d.Lspec + centerToRay * saturate(radius * rsqrt(dot(centerToRay, centerToRay))); + half LspecLengthInverse = rsqrt(dot(closestPoint, closestPoint)); + half a = s.beckmannRoughness; + half normalizationFactor = a / saturate(a + (radius * 0.5h * LspecLengthInverse)); + + d.direction = closestPoint * LspecLengthInverse; + d.specularIntensity = normalizationFactor * normalizationFactor; +#endif + + aUpdateLightingInputs(d, s); +} + +half aSetAreaLightingInputs( + inout ADirect d, + ASurface s, + half radius) +{ + // Specular. + aSetAreaSpecularInputs(d, s, radius); + + // Diffuse. + // Set diffuse light direction last to fix transmission & hair. + half LdiffLengthSquared = dot(d.Ldiff, d.Ldiff); + half LdiffLengthInverse = rsqrt(LdiffLengthSquared); + + d.direction = d.Ldiff * LdiffLengthInverse; + d.NdotLm = dot(s.normalWorld, d.direction); + d.NdotL = saturate(d.NdotLm); + +#if !A_USE_UNITY_ATTENUATION + d.color /= (LdiffLengthSquared + 1.0h); // Attenuation. +#endif + + return LdiffLengthInverse; +} + +void aDirectionalLight( + inout ADirect d, + ASurface s) +{ + d.NdotLm = dot(s.normalWorld, d.direction); + d.NdotL = saturate(d.NdotLm); + aUpdateLightingInputs(d, s); +} + +void aDirectionalDiscLight( + inout ADirect d, + ASurface s, + half3 direction, + half radius) +{ + d.Ldiff = direction; + d.Lspec = direction; + + // Specular. + aSetAreaSpecularInputs(d, s, radius); + + // Diffuse. + // Set diffuse light direction last to fix transmission & hair. + d.direction = d.Ldiff; + d.NdotLm = dot(s.normalWorld, d.direction); + d.NdotL = saturate(d.NdotLm); +} + +void aSphereLight( + inout ADirect d, + ASurface s, + float3 L, + half radius) +{ + // Sphere Area Light. + // cf http://blog.selfshadow.com/publications/s2013-shading-course/karis/s2013_pbs_epic_notes_v2.pdf p15-16 + d.Ldiff = L; + d.Lspec = L; + d.centerDistInverse = aSetAreaLightingInputs(d, s, radius); +} + +void aTubeLight( + inout ADirect d, + ASurface s, + float3 L, + half3 axis, + half radius, + half halfLength) +{ + // Tube Area Light. + // cf http://blog.selfshadow.com/publications/s2013-shading-course/karis/s2013_pbs_epic_notes_v2.pdf p16-18 + float3 R = s.reflectionVectorWorld; + float3 tubeLightDir = axis * halfLength; + float3 L0 = L + tubeLightDir; + float3 L1 = L - tubeLightDir; + float3 Ld = tubeLightDir * -2.0f; + float RdotL0 = dot(R, L0); + float RdotLd = dot(R, Ld); + float L0dotLd = dot(L0, Ld); + float t = (RdotL0 * RdotLd - L0dotLd) / (dot(Ld, Ld) - RdotLd * RdotLd); + + // Modified diffuse term for true tube diffuse lighting. + d.Ldiff = L - clamp(dot(L, axis), -halfLength, halfLength) * axis; + d.Lspec = L0 + Ld * saturate(t); + d.centerDistInverse = rsqrt(dot(L, L)); + + // Attentuation normalization. + d.color /= 1.0h + (0.25h * halfLength * aSetAreaLightingInputs(d, s, radius)); +} + +void aAreaLight( + inout ADirect d, + ASurface s, + half4 color, + half3 axis, + float3 L, + half range) +{ + // Packed float light configuration. + // +/- llll.rrrr: l=length, r=radius, and sign as specular toggle. + // Radius externally clamped to .999 max to simplify math. + half lightParams = abs(color.a); + +#ifdef USING_DIRECTIONAL_LIGHT + // 0.1 needed to make material inspector look okay. + aDirectionalDiscLight(d, s, L, lightParams * 0.1h); +#else + #if !defined(SPOT) && A_USE_TUBE_LIGHTS + // Enable when length is non-zero, and specular is enabled. + UNITY_BRANCH + if (color.a >= 1) { + half dec = frac(lightParams); + half radius = dec * range; + half halfLength = (lightParams - dec) * 0.001f * range; + + aTubeLight(d, s, L, axis, radius, halfLength); + } + else + #endif + { + aSphereLight(d, s, L, lightParams * range); + } + + aSetLightRangeLimit(d, range); +#endif + + // Specular highlight toggle. + d.specularIntensity = color.a > 0.0h ? d.specularIntensity : 0.0h; +} + +ASurface aNewSurface() { + ASurface s; + + UNITY_INITIALIZE_OUTPUT(ASurface, s); + s.vertexNormalWorld = A_FLAT_NORMAL; + s.normalWorld = A_FLAT_NORMAL; + s.viewDirWorld = A_AXIS_X; + s.viewDirTangent = A_AXIS_X; + s.reflectionVectorWorld = A_AXIS_X; + s.tangentToWorld = 0.0h; + s.normalTangent = A_FLAT_NORMAL; + s.blurredNormalTangent = A_FLAT_NORMAL; + s.facingSign = 1.0h; + s.fogCoord = 0.0f; + s.NdotV = 0.0h; + s.FV = 0.0h; + s.materialType = 1.0h; + s.mask = 1.0h; + + s.baseColor = 0.0h; + s.opacity = 1.0h; + s.metallic = 0.0h; + s.ambientOcclusion = 1.0h; + s.specularity = 0.5h; + s.specularTint = 0.0h; + s.roughness = 0.0h; + s.emissiveColor = 0.0h; + s.subsurfaceColor = 0.0h; + s.subsurface = 0.0h; + s.clearCoat = 0.0h; + s.clearCoatRoughness = 0.0h; + + return s; +} + +void aBlendRangeMask( + inout ASurface s, + half mask, + half weight, + half cutoff, + half blendRange, + half vertexTint) +{ + cutoff = lerp(cutoff, 1.0h, s.vertexColor.a * vertexTint); + mask = 1.0h - saturate((mask - cutoff) / blendRange); + s.mask *= weight * mask; +} + +half3 aTangentToWorld( + ASurface s, + half3 normalTangent) +{ +#ifndef A_TANGENT_TO_WORLD_ON + return s.vertexNormalWorld; +#else + return normalize(mul(normalTangent, s.tangentToWorld)); +#endif +} + +half3 aWorldToTangent( + ASurface s, + half3 normalWorld) +{ +#ifndef A_TANGENT_TO_WORLD_ON + return A_FLAT_NORMAL; +#else + return normalize(mul(s.tangentToWorld, normalWorld)); +#endif +} + +void aUpdateViewData( + inout ASurface s) +{ +#if defined(A_NORMAL_WORLD_ON) && defined(A_VIEW_DIR_WORLD_ON) + // Area lights need this to be per-pixel. + #ifdef A_REFLECTION_VECTOR_WORLD_ON + s.reflectionVectorWorld = reflect(-s.viewDirWorld, s.normalWorld); + #endif + + // Skip re-calculating world normals in some cases. + #ifndef A_VIEW_DIR_TANGENT_ON + s.NdotV = aDotClamp(s.normalWorld, s.viewDirWorld); + #else + s.NdotV = aDotClamp(s.normalTangent, s.viewDirTangent); + #endif + + s.FV = aFresnel(s.NdotV); +#endif +} + +void aUpdateNormalTangent( + inout ASurface s) +{ +#ifndef A_TANGENT_TO_WORLD_ON + s.normalTangent = A_FLAT_NORMAL; +#else + s.normalWorld = aTangentToWorld(s, s.normalTangent); + s.ambientNormalWorld = s.normalWorld; + aUpdateViewData(s); +#endif +} + +void aUpdateNormalWorld( + inout ASurface s) +{ +#ifndef A_TANGENT_TO_WORLD_ON + s.normalWorld = s.vertexNormalWorld; +#else + s.normalTangent = aWorldToTangent(s, s.normalWorld); + s.ambientNormalWorld = s.normalWorld; + aUpdateViewData(s); +#endif +} + +void aUpdateSubsurface( + inout ASurface s) +{ + s.subsurfaceColor = aGammaToLinear(s.subsurface).rrr; +} + +void aUpdateSubsurfaceColor( + inout ASurface s) +{ + s.subsurface = LinearToGammaSpace(s.subsurfaceColor).g; +} + +half3 aSpecularityToF0( + half specularity) +{ + return (specularity * A_MAX_DIELECTRIC_F0).rrr; +} + +half aLinearToBeckmannRoughness( + half roughness) +{ + // Remap roughness to prevent specular artifacts. + roughness = lerp(A_MIN_AREA_ROUGHNESS, 1.0h, roughness); + return roughness * roughness; +} + +half aFresnel( + half w) +{ + // Sebastien Lagarde's spherical gaussian approximation of Schlick fresnel. + // cf http://seblagarde.wordpress.com/2011/08/17/hello-world/ + return exp2((-5.55473h * w - 6.98316h) * w); +} + +half3 aSpecularLightingToggle( + ASurface s, + half3 specular) +{ +#if !A_USE_BLACK_SPECULAR_COLOR_TOGGLE + return specular; +#else + return any(s.f0) ? specular : A_BLACK; +#endif +} + +half aSpecularOcclusion( + half ao, + half NdotV) +{ + // Yoshiharu Gotanda's specular occlusion approximation: + // cf http://research.tri-ace.com/Data/cedec2011_RealtimePBR_Implementation_e.pptx pg59 + half d = NdotV + ao; + return saturate((d * d) - 1.0h + ao); +} + +void aStandardPreLighting( + inout ASurface s) +{ + // In Forward mode, set material type. +#ifndef A_DEFERRED_PASS + s.baseColor = saturate(s.baseColor); + s.albedo = s.baseColor; + s.f0 = aSpecularityToF0(s.specularity); + + #ifndef A_SPECULAR_TINT_ON + s.specularTint = 0.0h; + #else + s.f0 *= aLerpWhiteTo(aChromaticity(s.baseColor), s.specularTint); + #endif + + #ifndef A_METALLIC_ON + s.metallic = 0.0h; + #else + half metallicInv = 1.0h - s.metallic; + + s.albedo *= metallicInv; // Affects transmission through albedo. + s.f0 = lerp(s.f0, s.baseColor, s.metallic); + + #ifdef _ALPHAPREMULTIPLY_ON + // Interpolate from a translucent dielectric to an opaque metal. + s.opacity = s.metallic + metallicInv * s.opacity; + #endif + #endif + + #ifndef A_CLEARCOAT_ON + s.clearCoat = 0.0h; + s.clearCoatRoughness = 0.0h; + #else + // f0 of 0.04 gives us a polyurethane-like coating. + half clearCoat = s.clearCoat * lerp(0.04h, 1.0h, s.FV); + + s.albedo *= aLerpOneTo(0.0h, clearCoat); + s.f0 = lerp(s.f0, A_WHITE, clearCoat); + s.roughness = lerp(s.roughness, s.clearCoatRoughness, clearCoat); + #endif + + #ifdef _ALPHAPREMULTIPLY_ON + // Premultiply opacity with albedo for translucent shaders. + s.albedo *= s.opacity; + #endif + + s.beckmannRoughness = aLinearToBeckmannRoughness(s.roughness); + + #ifndef A_AMBIENT_OCCLUSION_ON + s.ambientOcclusion = 1.0h; + s.specularOcclusion = 1.0h; + #else + s.specularOcclusion = aSpecularOcclusion(s.ambientOcclusion, s.NdotV); + #endif + + #if defined(A_SCATTERING_ON) + s.materialType = A_MATERIAL_TYPE_SUBSURFACE_SCATTERING; + s._subsurfaceShadowWeight = 0.0h; + s._skinScatteringMask = 1.0h; + s.ambientNormalWorld = aTangentToWorld(s, s.blurredNormalTangent); + #elif defined(A_SUBSURFACE_ON) + #ifdef A_TWO_SIDED_SHADER + s.materialType = A_MATERIAL_TYPE_SHADOWED_SUBSURFACE; + s._subsurfaceShadowWeight = A_SUBSURFACE_SHADOW; + #else + s.materialType = _ShadowCullMode == A_CULL_MODE_FRONT ? A_MATERIAL_TYPE_SHADOWED_SUBSURFACE : A_MATERIAL_TYPE_UNSHADOWED_SUBSURFACE; + s._subsurfaceShadowWeight = _ShadowCullMode == A_CULL_MODE_FRONT ? A_SUBSURFACE_SHADOW : 0.0h; + #endif + #else + s.materialType = A_MATERIAL_TYPE_OPAQUE; + #endif +#endif + +#if defined(A_SCATTERING_ON) || defined(A_SUBSURFACE_ON) + A_DEFERRED_BRANCH(s.materialType != A_MATERIAL_TYPE_OPAQUE) + { + // In Deferred mode, determine material type and sample extra G-buffer data. + #if defined(A_DEFERRED_PASS) + half4 buffer = tex2Dlod(_DeferredPlusBuffer, float4(s.screenUv, 0.0f, 0.0f)); + + s.subsurface = buffer.a; + s._subsurfaceShadowWeight = s.materialType == A_MATERIAL_TYPE_SHADOWED_SUBSURFACE ? A_SUBSURFACE_SHADOW : 0.0h; + + #if defined(A_SCATTERING_ON) + s._skinScatteringMask = s.materialType == A_MATERIAL_TYPE_SUBSURFACE_SCATTERING ? 1.0h : 0.0h; + s.ambientNormalWorld = normalize(buffer.xyz * 2.0h - 1.0h); + #endif + #endif + + // Subsurface color calculation. + #ifdef A_SUBSURFACE_ON + #ifdef A_FORWARD_ONLY_SHADER + s.subsurfaceColor *= s.albedo; + #else + s.subsurfaceColor = s.albedo * aGammaToLinear(s.subsurface); + #endif + #endif + + // Scattering input data. + #ifdef A_SCATTERING_ON + A_DEFERRED_BRANCH(s.materialType == A_MATERIAL_TYPE_SUBSURFACE_SCATTERING) + { + // Scattering mask. + s._skinScatteringMask *= A_SCATTERING_WEIGHT * saturate(A_SCATTERING_INV_MASK_CUTOFF * s.subsurface); + s._skinScattering = saturate(s.subsurface * A_SCATTERING_SCALE + A_SCATTERING_BIAS); + + // Skin subsurface depth absorption tint. + // cf http://www.crytek.com/download/2014_03_25_CRYENGINE_GDC_Schultz.pdf pg 35 + half3 absorption = exp((1.0h - s.subsurface) * A_SCATTERING_ABSORPTION); + + // Albedo scale for absorption assumes ~0.5 luminance for Caucasian skin. + absorption *= saturate(s.albedo * unity_ColorSpaceDouble.rgb); + s.subsurfaceColor = lerp(s.subsurfaceColor, absorption, s._skinScatteringMask); + + // Blurred normals for indirect diffuse and direct scattering. + s.ambientNormalWorld = normalize(lerp(s.normalWorld, s.ambientNormalWorld, A_SCATTERING_NORMAL_BLUR * s._skinScatteringMask)); + } + #endif + + // Subsurface color weight. + #ifdef A_SUBSURFACE_ON + s.subsurfaceColor *= A_SUBSURFACE_WEIGHT; + #endif + } +#endif +} + +half3 aStandardDirectLighting( + ADirect d, + ASurface s) +{ + half3 illum = A_BLACK; + half3 specular = A_BLACK; + +#if defined(A_SCATTERING_ON) || defined(A_SUBSURFACE_ON) + A_DEFERRED_BRANCH(s.materialType != A_MATERIAL_TYPE_OPAQUE) + { + #ifdef A_SUBSURFACE_ON + // Subsurface transmission. + // cf http://www.farfarer.com/blog/2012/09/11/translucent-shader-unity3d/ + half3 transLightDir = d.direction + s.normalWorld * A_SUBSURFACE_DISTORTION; + half transLight = pow(aDotClamp(s.viewDirWorld, -transLightDir), A_SUBSURFACE_FALLOFF); + half shadow = aLerpOneTo(d.shadow, s._subsurfaceShadowWeight); + + illum += s.subsurfaceColor * (shadow * transLight); + #endif + + #ifdef A_SCATTERING_ON + A_DEFERRED_BRANCH(s.materialType == A_MATERIAL_TYPE_SUBSURFACE_SCATTERING) + { + // Pre-Integrated Skin Shading. + // cf http://www.farfarer.com/blog/2013/02/11/pre-integrated-skin-shader-unity-3d/ + float ndlBlur = dot(s.ambientNormalWorld, d.direction) * 0.5h + 0.5h; + float4 sssLookupUv = float4(ndlBlur, s._skinScattering * aLuminance(d.color), 0.0f, 0.0f); + half3 sss = (s._skinScatteringMask * d.shadow) * tex2Dlod(A_SCATTERING_LUT, sssLookupUv).rgb; + + illum += s.albedo * sss; + s.albedo *= 1.0h - s._skinScatteringMask; + } + #endif + } +#endif + + // Cook-Torrance microfacet model. + // cf http://graphicrants.blogspot.com/2013/08/specular-brdf-reference.html + half LdotH2 = d.LdotH * d.LdotH; + + // Brent Burley diffuse BRDF. + // cf https://disney-animation.s3.amazonaws.com/library/s2012_pbs_disney_brdf_notes_v2.pdf pg14 + half FL = aFresnel(d.NdotL); + half Fd90 = 0.5h + (2.0h * LdotH2 * s.roughness); + half Fd = aLerpOneTo(Fd90, FL) * aLerpOneTo(Fd90, s.FV); + half3 diffuse = s.albedo * Fd; + +#ifndef _SPECULARHIGHLIGHTS_OFF + // Schlick's Fresnel approximation. + half3 F = lerp(s.f0, A_WHITE, aFresnel(d.LdotH)); + + // John Hable's Visibility function. + // cf http://www.filmicworlds.com/2014/04/21/optimizing-ggx-shaders-with-dotlh/ + half a2 = s.beckmannRoughness * s.beckmannRoughness; + half k2 = a2 * 0.25h; // k = a/2; k*k = (a*a)/(2*2) = (a^2)/4. + half invV = lerp(k2, 1.0h, LdotH2); + + // GGX (Trowbridge-Reitz) NDF. + // cf http://graphicrants.blogspot.com/2013/08/specular-brdf-reference.html + half denom = aLerpOneTo(a2, d.NdotH * d.NdotH); + half mDV = k2 / (invV * denom * denom); // k2 is GGX a^2 and microfacet 1/4. + + specular = aSpecularLightingToggle(s, F * (mDV * s.specularOcclusion * d.specularIntensity)); +#endif + + // Punctual lighting equation. + // cf http://seblagarde.wordpress.com/2012/01/08/pi-or-not-to-pi-in-game-lighting-equation/ + illum += (d.shadow * d.NdotL) * (diffuse + specular); + + return d.color * illum; +} + +half3 aStandardIndirectLighting( + AIndirect i, + ASurface s) +{ + half3 illum = A_BLACK; + +#if defined(A_DEFERRED_PASS) || defined(A_REFLECTION_PROBES_ON) + // Brian Karis' modification of Dimitar Lazarov's Environment BRDF. + // cf https://www.unrealengine.com/blog/physically-based-shading-on-mobile + const half4 c0 = half4(-1.0h, -0.0275h, -0.572h, 0.022h); + const half4 c1 = half4(1.0h, 0.0425h, 1.04h, -0.04h); + half4 r = s.roughness * c0 + c1; + half a004 = min(r.x * r.x, exp2(-9.28h * s.NdotV)) * r.x + r.y; + half2 AB = half2(-1.04h, 1.04h) * a004 + r.zw; + half3 specular = i.specular * (s.f0 * AB.x + AB.yyy); +#endif + +#ifdef A_DEFERRED_PASS + illum = aSpecularLightingToggle(s, specular * s.specularOcclusion); +#else + #ifndef A_AMBIENT_OCCLUSION_ON + half3 diffuse = s.albedo * i.diffuse; + + #ifndef A_REFLECTION_PROBES_ON + illum = diffuse; + #else + illum = diffuse + aSpecularLightingToggle(s, specular); + #endif + #else + #ifndef A_SCATTERING_ON + half ao = s.ambientOcclusion; + #else + // Color Bleed AO. + // cf http://www.iryoku.com/downloads/Next-Generation-Character-Rendering-v6.pptx pg113 + half3 ao = pow(s.ambientOcclusion.rrr, A_ONE - (A_SCATTERING_AO_COLOR_BLEED * s._skinScatteringMask)); + #endif + + // Yoshiharu Gotanda's fake interreflection for specular occlusion. + // Modified to better account for surface f0. + // cf http://research.tri-ace.com/Data/cedec2011_RealtimePBR_Implementation_e.pptx pg65 + half3 ambient = i.diffuse * ao; + + #ifndef A_REFLECTION_PROBES_ON + // Diffuse and fake interreflection only. + illum = ambient * (s.albedo + aSpecularLightingToggle(s, s.f0 * (1.0h - s.specularOcclusion))); + #else + // Full equation. + illum = ambient * s.albedo + + aSpecularLightingToggle(s, lerp(ambient * s.f0, specular, s.specularOcclusion)); + #endif + #endif +#endif + + return illum; +} + +#endif // ALLOY_SHADERS_FRAMEWORK_LIGHTING_IMPL_CGINC diff --git a/Assets/Alloy/Shaders/Framework/LightingImpl.cginc.meta b/Assets/Alloy/Shaders/Framework/LightingImpl.cginc.meta new file mode 100644 index 0000000..319eee4 --- /dev/null +++ b/Assets/Alloy/Shaders/Framework/LightingImpl.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 793f250168f085a4a8ff1459943a8cca +timeCreated: 1492114566 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/Framework/Particle.cginc b/Assets/Alloy/Shaders/Framework/Particle.cginc new file mode 100644 index 0000000..6c7f749 --- /dev/null +++ b/Assets/Alloy/Shaders/Framework/Particle.cginc @@ -0,0 +1,247 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file Particle.cginc +/// @brief Particles uber-header. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_FRAMEWORK_PARTICLE_CGINC +#define ALLOY_SHADERS_FRAMEWORK_PARTICLE_CGINC + +#include "Assets/Alloy/Shaders/Config.cginc" +#include "Assets/Alloy/Shaders/Framework/Utility.cginc" + +#include "HLSLSupport.cginc" +#include "UnityCG.cginc" +#include "UnityInstancing.cginc" +#include "UnityLightingCommon.cginc" +#include "UnityStandardUtils.cginc" +#include "UnityShaderVariables.cginc" + +struct AVertexInput { + float4 vertex : POSITION; + float4 color : COLOR; + float4 texcoords : TEXCOORD0; +#ifdef A_PARTICLE_TEXTURE_BLEND_ON + float texcoordBlend : TEXCOORD1; +#endif +#if defined(_RIM_FADE_ON) || defined(A_PARTICLE_LIGHTING_ON) + half3 normal : NORMAL; +#endif + UNITY_VERTEX_INPUT_INSTANCE_ID +}; + +struct AFragmentInput { + float4 vertex : SV_POSITION; + float4 color : COLOR; + float4 texcoords : TEXCOORD0; +#ifdef _PARTICLE_EFFECTS_ON + float2 uv_ParticleEffectMask1 : TEXCOORD1; + float2 uv_ParticleEffectMask2 : TEXCOORD2; +#endif + UNITY_FOG_COORDS(3) +#if defined(SOFTPARTICLES_ON) || defined(_DISTANCE_FADE_ON) || defined(VTRANSPARENCY_ON) + float4 projPos : TEXCOORD4; +#endif +#if defined(_RIM_FADE_ON) || defined(A_PARTICLE_LIGHTING_ON) + half3 normalWorld : TEXCOORD5; + half4 viewDirWorld : TEXCOORD6; +#endif +#if defined(A_PARTICLE_LIGHTING_ON) || defined(VAPOR_TRANSLUCENT_FOG_ON) + float4 positionWorld : TEXCOORD7; +#endif +#if defined(A_PARTICLE_LIGHTING_ON) + half3 ambient : TEXCOORD8; +#endif +#ifdef A_PARTICLE_TEXTURE_BLEND_ON + float blend : TEXCOORD9; +#endif + UNITY_VERTEX_INPUT_INSTANCE_ID +}; + +UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + +half4 _TintColor; +A_SAMPLER_2D(_MainTex); +half _TintWeight; +float _InvFade; + +#ifdef _PARTICLE_EFFECTS_ON + A_SAMPLER_2D(_ParticleEffectMask1); + A_SAMPLER_2D(_ParticleEffectMask2); +#endif + +#ifdef _RIM_FADE_ON + half _RimFadeWeight; // Expects linear-space values + half _RimFadePower; +#endif + +float _DistanceFadeNearFadeCutoff; +float _DistanceFadeRange; + +AFragmentInput aMainVertexShader( + AVertexInput v) +{ + AFragmentInput o; + UNITY_INITIALIZE_OUTPUT(AFragmentInput, o); + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + + o.vertex = UnityObjectToClipPos(v.vertex.xyz); + +#if defined(SOFTPARTICLES_ON) || defined(_DISTANCE_FADE_ON) || defined(VTRANSPARENCY_ON) + o.projPos = ComputeScreenPos (o.vertex); + COMPUTE_EYEDEPTH(o.projPos.z); +#endif + + o.color = v.color; + +#ifndef A_VERTEX_COLOR_DEGAMMA_OFF + o.color.rgb = aGammaToLinear(o.color.rgb); +#endif + + o.texcoords.xy = A_TEX_TRANSFORM_SCROLL_SPIN(_MainTex, v.texcoords.xy); + +#ifdef _PARTICLE_EFFECTS_ON + o.uv_ParticleEffectMask1 = A_TEX_TRANSFORM_SCROLL_SPIN(_ParticleEffectMask1, v.texcoords.xy); + o.uv_ParticleEffectMask2 = A_TEX_TRANSFORM_SCROLL_SPIN(_ParticleEffectMask2, v.texcoords.xy); +#endif + +#if defined(_RIM_FADE_ON) || defined(A_PARTICLE_LIGHTING_ON) || defined(VAPOR_TRANSLUCENT_FOG_ON) + float4 positionWorld = mul(unity_ObjectToWorld, v.vertex); +#endif + +#if defined(_RIM_FADE_ON) || defined(A_PARTICLE_LIGHTING_ON) + o.normalWorld = UnityObjectToWorldNormal(v.normal); + o.viewDirWorld.xyz = UnityWorldSpaceViewDir(positionWorld.xyz); +#endif + +#if defined(A_PARTICLE_LIGHTING_ON) || defined(VAPOR_TRANSLUCENT_FOG_ON) + o.positionWorld = positionWorld; +#endif +#ifdef A_PARTICLE_LIGHTING_ON + // 1 Directional, 4 Point lights, and Light probes. + o.ambient = _LightColor0.rgb * aDotClamp(_WorldSpaceLightPos0.xyz, o.normalWorld); + o.ambient += aShade4PointLights(o.positionWorld.xyz, o.normalWorld); + o.ambient += ShadeSHPerVertex(o.normalWorld, o.ambient); +#endif + +#ifdef A_PARTICLE_TEXTURE_BLEND_ON + o.texcoords.zw = A_TEX_TRANSFORM_SCROLL_SPIN(_MainTex, v.texcoords.zw); + o.blend = v.texcoordBlend; +#endif + + UNITY_TRANSFER_FOG(o,o.vertex); + return o; +} + +/// Controls how the particle is faded out based on scene intersection, rim, +/// and camera distance. +half aFadeParticle( + AFragmentInput i) +{ + half fade = 1.0h; + + UNITY_SETUP_INSTANCE_ID(i); + +#ifdef SOFTPARTICLES_ON + float sceneZ = DECODE_EYEDEPTH(SAMPLE_DEPTH_TEXTURE_PROJ(_CameraDepthTexture, UNITY_PROJ_COORD(i.projPos))); + float partZ = i.projPos.z; + + fade = saturate(_InvFade * (sceneZ - partZ)); +#endif + +#ifdef _DISTANCE_FADE_ON + // Alpha clip. + // cf http://wiki.unity3d.com/index.php?title=AlphaClipsafe + fade *= saturate((i.projPos.z - _DistanceFadeNearFadeCutoff) / _DistanceFadeRange); +#endif + +#ifdef _RIM_FADE_ON + half3 normal = normalize(i.normalWorld); + half3 viewDir = normalize(i.viewDirWorld.xyz); + half NdotV = abs(dot(normal, viewDir)); + half bias = 1.0h - _RimFadeWeight; + + fade = aRimLight(fade, bias, _RimFadePower, 1.0h - NdotV); +#endif + + return fade; +} + +/// Applies transforming effects mask textures to the particle. +half4 aParticleEffects( + AFragmentInput i) +{ + half4 color = tex2D(_MainTex, i.texcoords.xy); + +#ifdef A_PARTICLE_TEXTURE_BLEND_ON + half4 color2 = tex2D(_MainTex, i.texcoords.zw); + color = lerp(color, color2, i.blend); +#endif + + color.rgb *= _TintWeight; + +#ifdef _PARTICLE_EFFECTS_ON + color *= tex2D(_ParticleEffectMask1, i.uv_ParticleEffectMask1); + color *= tex2D(_ParticleEffectMask2, i.uv_ParticleEffectMask2); +#endif + +#ifdef A_PARTICLE_LIGHTING_ON + color.rgb *= ShadeSHPerPixel(i.normalWorld, i.ambient, i.positionWorld); +#endif + + return color; +} + +half4 aParticleOutputBase( + AFragmentInput i, + half4 color) +{ + UNITY_APPLY_FOG_COLOR(i.fogCoord, color, unity_FogColor); + +#if defined(VAPOR_TRANSLUCENT_FOG_ON) + color = VaporApplyFog(i.positionWorld, color); +#elif defined(VTRANSPARENCY_ON) + color = VolumetricTransparencyBase(color, i.projPos); +#endif + + color.rgb = aHdrClamp(color.rgb); + return color; +} + +half4 aParticleOutputAdd( + AFragmentInput i, + half4 color) +{ + UNITY_APPLY_FOG_COLOR(i.fogCoord, color, A_BLACK4); + +#if defined(VAPOR_TRANSLUCENT_FOG_ON) + color = VaporApplyFogAdd(i.positionWorld, color); +#elif defined(VTRANSPARENCY_ON) + color = VolumetricTransparencyAdd(color, i.projPos); +#endif + + color.rgb = aHdrClamp(color.rgb); + return color; +} + +half4 aParticleOutputMultiply( + AFragmentInput i, + half4 color) +{ + UNITY_APPLY_FOG_COLOR(i.fogCoord, color, A_WHITE4); + +#if defined(VAPOR_TRANSLUCENT_FOG_ON) + color = VaporApplyFogFade(i.positionWorld, color, A_WHITE); +#elif defined(VTRANSPARENCY_ON) +// color = VolumetricTransparencyAdd(color, i.projPos); +#endif + + color.rgb = aHdrClamp(color.rgb); + return color; +} + +#endif // ALLOY_SHADERS_FRAMEWORK_PARTICLE_CGINC diff --git a/Assets/Alloy/Shaders/Framework/Particle.cginc.meta b/Assets/Alloy/Shaders/Framework/Particle.cginc.meta new file mode 100644 index 0000000..a202342 --- /dev/null +++ b/Assets/Alloy/Shaders/Framework/Particle.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: c51b783c68589c242820eed366e80062 +timeCreated: 1424470451 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/Framework/Tessellation.cginc b/Assets/Alloy/Shaders/Framework/Tessellation.cginc new file mode 100644 index 0000000..4a4214d --- /dev/null +++ b/Assets/Alloy/Shaders/Framework/Tessellation.cginc @@ -0,0 +1,256 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +/////////////////////////////////////////////////////////////////////////////// +/// @file Tessellation.cginc +/// @brief Callbacks and data structures for tessellation. +/////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_FRAMEWORK_TESSELLATION_CGINC +#define ALLOY_SHADERS_FRAMEWORK_TESSELLATION_CGINC + +#include "Assets/Alloy/Shaders/Config.cginc" + +#include "HLSLSupport.cginc" +//#include "Lighting.cginc" +//#include "Tessellation.cginc" +#include "UnityCG.cginc" + +#if defined(A_TESSELLATION_SHADER) && defined(A_TESSELLATION_PASS) && defined(UNITY_CAN_COMPILE_TESSELLATION) + struct UnityTessellationFactors { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + #include "UnityShaderVariables.cginc" + + float UnityCalcEdgeTessFactor(float3 wpos0, float3 wpos1, float edgeLen) + { + // distance to edge center + float dist = distance(0.5 * (wpos0 + wpos1), _WorldSpaceCameraPos); + // length of the edge + float len = distance(wpos0, wpos1); + // edgeLen is approximate desired size in pixels + float f = max(len * _ScreenParams.y / (edgeLen * dist), 1.0); + return f; + } + + float UnityDistanceFromPlane(float3 pos, float4 plane) + { + float d = dot(float4(pos, 1.0f), plane); + return d; + } + + // Returns true if triangle with given 3 world positions is outside of camera's view frustum. + // cullEps is distance outside of frustum that is still considered to be inside (i.e. max displacement) + bool UnityWorldViewFrustumCull(float3 wpos0, float3 wpos1, float3 wpos2, float cullEps) + { + float4 planeTest; + + // left + planeTest.x = ((UnityDistanceFromPlane(wpos0, unity_CameraWorldClipPlanes[0]) > -cullEps) ? 1.0f : 0.0f) + + ((UnityDistanceFromPlane(wpos1, unity_CameraWorldClipPlanes[0]) > -cullEps) ? 1.0f : 0.0f) + + ((UnityDistanceFromPlane(wpos2, unity_CameraWorldClipPlanes[0]) > -cullEps) ? 1.0f : 0.0f); + // right + planeTest.y = ((UnityDistanceFromPlane(wpos0, unity_CameraWorldClipPlanes[1]) > -cullEps) ? 1.0f : 0.0f) + + ((UnityDistanceFromPlane(wpos1, unity_CameraWorldClipPlanes[1]) > -cullEps) ? 1.0f : 0.0f) + + ((UnityDistanceFromPlane(wpos2, unity_CameraWorldClipPlanes[1]) > -cullEps) ? 1.0f : 0.0f); + // top + planeTest.z = ((UnityDistanceFromPlane(wpos0, unity_CameraWorldClipPlanes[2]) > -cullEps) ? 1.0f : 0.0f) + + ((UnityDistanceFromPlane(wpos1, unity_CameraWorldClipPlanes[2]) > -cullEps) ? 1.0f : 0.0f) + + ((UnityDistanceFromPlane(wpos2, unity_CameraWorldClipPlanes[2]) > -cullEps) ? 1.0f : 0.0f); + // bottom + planeTest.w = ((UnityDistanceFromPlane(wpos0, unity_CameraWorldClipPlanes[3]) > -cullEps) ? 1.0f : 0.0f) + + ((UnityDistanceFromPlane(wpos1, unity_CameraWorldClipPlanes[3]) > -cullEps) ? 1.0f : 0.0f) + + ((UnityDistanceFromPlane(wpos2, unity_CameraWorldClipPlanes[3]) > -cullEps) ? 1.0f : 0.0f); + + // has to pass all 4 plane tests to be visible + return !all(planeTest); + } + + // Same as UnityEdgeLengthBasedTess, but also does patch frustum culling: + // patches outside of camera's view are culled before GPU tessellation. Saves some wasted work. + float4 UnityEdgeLengthBasedTessCull(float4 v0, float4 v1, float4 v2, float edgeLength, float maxDisplacement) + { + float3 pos0 = mul(unity_ObjectToWorld, v0).xyz; + float3 pos1 = mul(unity_ObjectToWorld, v1).xyz; + float3 pos2 = mul(unity_ObjectToWorld, v2).xyz; + float4 tess; + + if (UnityWorldViewFrustumCull(pos0, pos1, pos2, maxDisplacement)) + { + tess = 0.0f; + } + else + { + tess.x = UnityCalcEdgeTessFactor(pos1, pos2, edgeLength); + tess.y = UnityCalcEdgeTessFactor(pos2, pos0, edgeLength); + tess.z = UnityCalcEdgeTessFactor(pos0, pos1, edgeLength); + tess.w = (tess.x + tess.y + tess.z) / 3.0f; + } + return tess; + } + + + + + struct ATessellationInput { + float4 vertex : INTERNALTESSPOS; + half3 normal : NORMAL; + float4 uv0 : TEXCOORD0; + float4 uv1 : TEXCOORD1; + #ifdef A_UV2_ON + float4 uv2 : TEXCOORD2; + #endif + #ifdef A_TANGENT_ON + half4 tangent : TANGENT; + #endif + half4 color : COLOR; + }; + + float _EdgeLength; + + #if A_USE_TESSELLATION_MIN_EDGE_LENGTH + float _MinEdgeLength; + #endif + + #ifdef _TESSELLATIONMODE_DISPLACEMENT + A_SAMPLER_2D(_DispTex); + float _Displacement; + #endif + #ifdef _TESSELLATIONMODE_PHONG + float _Phong; + #endif + + // NOTE: Forward-declared here so we can share Domain shader. + void aMainVertexShader(AVertexInput v, + #ifndef A_VERTEX_TO_FRAGMENT_OFF + out AFragmentInput o, + #endif + out float4 opos : SV_POSITION); + + // tessellation hull constant shader + UnityTessellationFactors aHullConstantTessellation( + InputPatch v) + { + float4 tf = 0.0f; + float maxDisplacement = 0.0f; + UnityTessellationFactors o; + + #ifdef _TESSELLATIONMODE_DISPLACEMENT + maxDisplacement = 1.5f * _Displacement; + #endif + + float edgeLength = _EdgeLength; + + #if A_USE_TESSELLATION_MIN_EDGE_LENGTH + edgeLength = max(_MinEdgeLength, edgeLength); + #endif + + tf = UnityEdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, maxDisplacement); + + o.edge[0] = tf.x; + o.edge[1] = tf.y; + o.edge[2] = tf.z; + o.inside = tf.w; + return o; + } + + ATessellationInput aMainTessellationVertexShader( + AVertexInput v) + { + ATessellationInput o; + + UNITY_INITIALIZE_OUTPUT(ATessellationInput, o); + o.vertex = v.vertex; + o.normal = v.normal; + o.uv0 = v.uv0; + o.uv1 = v.uv1; + + #ifdef A_UV2_ON + o.uv2 = v.uv2; + #endif + #ifdef A_TANGENT_ON + o.tangent = v.tangent; + #endif + o.color = v.color; + + return o; + } + + // tessellation hull shader + [UNITY_domain("tri")] + [UNITY_partitioning("fractional_odd")] + [UNITY_outputtopology("triangle_cw")] + [UNITY_patchconstantfunc("aHullConstantTessellation")] + [UNITY_outputcontrolpoints(3)] + ATessellationInput aMainHullShader( + InputPatch v, + uint id : SV_OutputControlPointID) + { + return v[id]; + } + + [UNITY_domain("tri")] + void aMainDomainShader( + UnityTessellationFactors tessFactors, + const OutputPatch vi, + float3 bary : SV_DomainLocation, + #ifndef A_VERTEX_TO_FRAGMENT_OFF + out AFragmentInput o, + #endif + out float4 opos : SV_POSITION) + { + AVertexInput v; + UNITY_INITIALIZE_OUTPUT(AVertexInput, v); + + v.vertex = vi[0].vertex * bary.x + vi[1].vertex * bary.y + vi[2].vertex * bary.z; + v.normal = vi[0].normal * bary.x + vi[1].normal * bary.y + vi[2].normal * bary.z; + v.uv0 = vi[0].uv0 * bary.x + vi[1].uv0 * bary.y + vi[2].uv0 * bary.z; + v.uv1 = vi[0].uv1 * bary.x + vi[1].uv1 * bary.y + vi[2].uv1 * bary.z; + + #ifdef A_UV2_ON + v.uv2 = vi[0].uv2 * bary.x + vi[1].uv2 * bary.y + vi[2].uv2 * bary.z; + #endif + #ifdef A_TANGENT_ON + v.tangent = vi[0].tangent * bary.x + vi[1].tangent * bary.y + vi[2].tangent * bary.z; + #endif + v.color = vi[0].color * bary.x + vi[1].color * bary.y + vi[2].color * bary.z; + + #ifdef _TESSELLATIONMODE_PHONG + float3 pp[3]; + + for (int i = 0; i < 3; ++i) + pp[i] = v.vertex.xyz - vi[i].normal * (dot(v.vertex.xyz, vi[i].normal) - dot(vi[i].vertex.xyz, vi[i].normal)); + + float3 displacedPosition = pp[0] * bary.x + pp[1] * bary.y + pp[2] * bary.z; + v.vertex.xyz = lerp(v.vertex.xyz, displacedPosition, _Phong); + #endif + + // NOTE: This has to come second, since the Phong mode references the + // unmodified vertices in order to work! + #ifdef _TESSELLATIONMODE_DISPLACEMENT + float d = _Displacement; + float oscillation = _Time.y; + float2 tessUv = TRANSFORM_TEX(v.uv0.xy, _DispTex) + (_DispTexVelocity * oscillation); + + #ifdef _VIRTUALTEXTURING_ON + d *= VTVertexSampleDisplacement(tessUv); + #else + d *= tex2Dlod(_DispTex, float4(tessUv, 0.0f, 0.0f)).g; + #endif + + v.vertex.xyz += v.normal * d; + #endif + + aMainVertexShader( + v, + #ifndef A_VERTEX_TO_FRAGMENT_OFF + o, + #endif + opos); + } +#endif + +#endif // ALLOY_SHADERS_FRAMEWORK_TESSELLATION_CGINC diff --git a/Assets/Alloy/Shaders/Framework/Tessellation.cginc.meta b/Assets/Alloy/Shaders/Framework/Tessellation.cginc.meta new file mode 100644 index 0000000..c342c75 --- /dev/null +++ b/Assets/Alloy/Shaders/Framework/Tessellation.cginc.meta @@ -0,0 +1,6 @@ +fileFormatVersion: 2 +guid: a789d7820ee8bd8468cb19d1a820a515 +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: diff --git a/Assets/Alloy/Shaders/Framework/Type.cginc b/Assets/Alloy/Shaders/Framework/Type.cginc new file mode 100644 index 0000000..26fa0cc --- /dev/null +++ b/Assets/Alloy/Shaders/Framework/Type.cginc @@ -0,0 +1,147 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +/////////////////////////////////////////////////////////////////////////////// +/// @file Type.cginc +/// @brief Shader type uber-header. +/////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_FRAMEWORK_TYPE_CGINC +#define ALLOY_SHADERS_FRAMEWORK_TYPE_CGINC + +#define A_VOLUMETRIC_DATA ASurface + +// Headers both for this file, and for all Definition and Feature modules. +#include "Assets/Alloy/Shaders/Config.cginc" +#include "Assets/Alloy/Shaders/Framework/Feature.cginc" +#include "Assets/Alloy/Shaders/Framework/Lighting.cginc" +#include "Assets/Alloy/Shaders/Framework/Utility.cginc" +#include "Assets/Alloy/Shaders/Framework/Volumetric.cginc" + +#include "UnityCG.cginc" +#include "UnityInstancing.cginc" + +#if !defined(A_VERTEX_COLOR_IS_DATA) && defined(A_PROJECTIVE_DECAL_SHADER) + #define A_VERTEX_COLOR_IS_DATA +#endif + +#if !defined(A_SHADOW_MASKS_BUFFER_ON) && (defined(SHADOWS_SHADOWMASK) && (UNITY_ALLOWED_MRT_COUNT > 4)) + #define A_SHADOW_MASKS_BUFFER_ON +#endif + +#if !defined(A_ALPHA_BLENDING_ON) && (defined(_ALPHABLEND_ON) || defined(_ALPHAPREMULTIPLY_ON)) + #define A_ALPHA_BLENDING_ON +#endif + +#if !defined(A_ROUGHNESS_SOURCE_BASE_COLOR_ALPHA) && defined(_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A) + #define A_ROUGHNESS_SOURCE_BASE_COLOR_ALPHA +#endif + +#if !defined(A_NORMAL_MAPPING_ON) && (defined(EFFECT_BUMP) || defined(_TERRAIN_NORMAL_MAP)) + #define A_NORMAL_MAPPING_ON +#endif + +// Features +#include "Assets/Alloy/Shaders/Feature/AO2.cginc" +#include "Assets/Alloy/Shaders/Feature/CarPaint.cginc" +#include "Assets/Alloy/Shaders/Feature/Decal.cginc" +#include "Assets/Alloy/Shaders/Feature/Detail.cginc" +#include "Assets/Alloy/Shaders/Feature/DirectionalBlend.cginc" +#include "Assets/Alloy/Shaders/Feature/Dissolve.cginc" +#include "Assets/Alloy/Shaders/Feature/Emission.cginc" +#include "Assets/Alloy/Shaders/Feature/Emission2.cginc" +#include "Assets/Alloy/Shaders/Feature/Eye.cginc" +#include "Assets/Alloy/Shaders/Feature/MainTextures.cginc" +#include "Assets/Alloy/Shaders/Feature/OrientedTextures.cginc" +#include "Assets/Alloy/Shaders/Feature/Parallax.cginc" +#include "Assets/Alloy/Shaders/Feature/Puddles.cginc" +#include "Assets/Alloy/Shaders/Feature/Rim.cginc" +#include "Assets/Alloy/Shaders/Feature/Rim2.cginc" +#include "Assets/Alloy/Shaders/Feature/SecondaryTextures.cginc" +#include "Assets/Alloy/Shaders/Feature/SkinTextures.cginc" +#include "Assets/Alloy/Shaders/Feature/SpeedTree.cginc" +#include "Assets/Alloy/Shaders/Feature/TeamColor.cginc" +#include "Assets/Alloy/Shaders/Feature/Terrain.cginc" +#include "Assets/Alloy/Shaders/Feature/TransitionBlend.cginc" +#include "Assets/Alloy/Shaders/Feature/Transmission.cginc" +#include "Assets/Alloy/Shaders/Feature/TriPlanar.cginc" +#include "Assets/Alloy/Shaders/Feature/VertexBlend.cginc" +#include "Assets/Alloy/Shaders/Feature/WeightedBlend.cginc" +#include "Assets/Alloy/Shaders/Feature/Wetness.cginc" + +/// Vertex data to be modified for specific shader type. +struct AVertex { + /// Vertex position in object space. + float4 positionObject; + + /// Vertex normal in object space. + /// Expects normalized vectors. + half3 normalObject; + + /// Vertex tangent in object space and bitangent sign. + /// XYZ: Normalized tangent, W: Bitangent sign. + half4 tangentObject; + + /// UV0 texture coordinates. + float4 uv0; + + /// UV1 texture coordinates. + float4 uv1; + + /// UV2 texture coordinates. + float4 uv2; + + /// UV3 texture coordinates. + float4 uv3; + + /// Vertex color. + /// Expects linear-space LDR color values. + half4 color; +}; + +/// Deferred geometry buffer representation of surface data. +struct AGbuffer { + /// RGB: Albedo, A: Specular occlusion. + half4 diffuseOcclusion : SV_Target0; + + /// RGB: f0, A: 1-Roughness. + half4 specularSmoothness : SV_Target1; + + /// RGB: Packed world-space normal, A: Material type. + half4 normalType : SV_Target2; + + /// RGB: Emission, A: 1-Subsurface. + half4 emissionSubsurface : SV_Target3; + +#ifdef A_SHADOW_MASKS_BUFFER_ON + /// RGBA: Shadow Masks. + half4 shadowMasks : SV_Target4; +#endif +}; + +/// Abstract declaration for user-defined vertex shader. +void aVertexShader(inout AVertex v); + +/// Abstract declaration for user-defined color shader. +void aColorShader(inout half4 color, ASurface s); + +/// Abstract declaration for user-defined G-Buffer shader. +void aGbufferShader(inout AGbuffer gb, ASurface s); + +/// Abstract declaration for user-defined surface shader. +void aSurfaceShader(inout ASurface s); + +/// Vertex output data constructor. +AVertex aNewVertex(); + +/// Gbuffer output data constructor. +AGbuffer aNewGbuffer(); + +/// Applies standard vertex transformations. +void aStandardVertexShader(inout AVertex v); + +/// Applies standard color transformations. +void aStandardColorShader(inout half4 color, ASurface s); + +#endif // ALLOY_SHADERS_FRAMEWORK_TYPE_CGINC diff --git a/Assets/Alloy/Shaders/Framework/Type.cginc.meta b/Assets/Alloy/Shaders/Framework/Type.cginc.meta new file mode 100644 index 0000000..1766cb7 --- /dev/null +++ b/Assets/Alloy/Shaders/Framework/Type.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: d0bcdda46674d1746bdd3bee79fa475a +timeCreated: 1437771795 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/Framework/TypeImpl.cginc b/Assets/Alloy/Shaders/Framework/TypeImpl.cginc new file mode 100644 index 0000000..893d12c --- /dev/null +++ b/Assets/Alloy/Shaders/Framework/TypeImpl.cginc @@ -0,0 +1,63 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +/////////////////////////////////////////////////////////////////////////////// +/// @file Type.cginc +/// @brief Shader type method implementations to allow disabling of features. +/////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_FRAMEWORK_TYPE_IMPL_CGINC +#define ALLOY_SHADERS_FRAMEWORK_TYPE_IMPL_CGINC + +#if !defined(A_VERTEX_COLOR_IS_DATA) && defined(A_USE_VERTEX_MOTION) + #define A_VERTEX_COLOR_IS_DATA +#endif + +#include "Assets/Alloy/Shaders/Config.cginc" +#include "Assets/Alloy/Shaders/Framework/LightingImpl.cginc" +#include "Assets/Alloy/Shaders/Framework/Type.cginc" +#include "Assets/Alloy/Shaders/Framework/Utility.cginc" +#include "Assets/Alloy/Shaders/Framework/VolumetricImpl.cginc" + +AVertex aNewVertex() { + AVertex v; + + UNITY_INITIALIZE_OUTPUT(AVertex, v); + return v; +} + +AGbuffer aNewGbuffer() { + AGbuffer gb; + + UNITY_INITIALIZE_OUTPUT(AGbuffer, gb); + +#ifdef A_SHADOW_MASKS_BUFFER_ON + gb.shadowMasks = A_ZERO4; +#endif + return gb; +} + +void aStandardVertexShader( + inout AVertex v) +{ +#ifdef A_USE_VERTEX_MOTION + v.positionObject = VertExmotion(v.positionObject, v.color); +#elif !defined(A_VERTEX_COLOR_IS_DATA) + /// Convert in vertex shader to interpolate in linear space. + v.color.rgb = aGammaToLinear(v.color.rgb); +#endif +} + +void aStandardColorShader( + inout half4 color, + ASurface s) +{ +#ifdef A_BASE_PASS + aVolumetricBase(color, s); +#else + aVolumetricAdd(color, s); +#endif +} + +#endif // ALLOY_SHADERS_FRAMEWORK_TYPE_IMPL_CGINC diff --git a/Assets/Alloy/Shaders/Framework/TypeImpl.cginc.meta b/Assets/Alloy/Shaders/Framework/TypeImpl.cginc.meta new file mode 100644 index 0000000..e3d9d98 --- /dev/null +++ b/Assets/Alloy/Shaders/Framework/TypeImpl.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 240c6e998db732a4899614464dcba05a +timeCreated: 1473016735 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/Framework/Unity.cginc b/Assets/Alloy/Shaders/Framework/Unity.cginc new file mode 100644 index 0000000..79092ed --- /dev/null +++ b/Assets/Alloy/Shaders/Framework/Unity.cginc @@ -0,0 +1,193 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +/////////////////////////////////////////////////////////////////////////////// +/// @file Unity.cginc +/// @brief Code shared between Alloy shaders and Unity override headers. +/////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_FRAMEWORK_UNITY_CGINC +#define ALLOY_SHADERS_FRAMEWORK_UNITY_CGINC + +// Headers both for this file, and for all Definition and Feature modules. +#include "Assets/Alloy/Shaders/Config.cginc" +#include "Assets/Alloy/Shaders/Framework/LightingImpl.cginc" +#include "Assets/Alloy/Shaders/Framework/Utility.cginc" + +#include "AutoLight.cginc" +#include "UnityCG.cginc" +#include "UnityGlobalIllumination.cginc" +#include "UnityLightingCommon.cginc" +#include "UnityShaderVariables.cginc" + +/// Sets light range in light vector range ".w" component. +/// @param[in,out] lightVectorRange XYZ: Vector to light center, W: Light volume range. +/// @param[out] lightCoord Projection coordinates in light space. +void aLightRange( + inout float4 lightVectorRange, + unityShadowCoord4 lightCoord) +{ + // Light range = |light-space light vector| / |world-space light vector| + // This works because the light vector's length is the same in both world + // and light space, but it's scaled by the light range in light space. + // cf http://forum.unity3d.com/threads/get-the-range-of-a-point-light-in-forward-add-mode.213430/#post-1433291 + lightVectorRange.w = length(lightVectorRange.xyz) * rsqrt(dot(lightCoord.xyz, lightCoord.xyz)); +} + +/// Calculates forward indirect illumination. +/// @param gi UnityGI populated with data. +/// @param s Material surface data. +/// @return Indirect illumination. +half3 aUnityIndirectLighting( + UnityGI gi, + ASurface s) +{ + return aIndirectLighting(gi.indirect, s); +} + +/// Calculates forward direct illumination. +/// @param s Material surface data. +/// @param shadow Shadow attenuation. +/// @param lightVectorRange XYZ: Vector to light center, W: Light volume range. +/// @param lightCoord Light projection texture coordinates. +/// @return Direct illumination. +half3 aUnityDirectLighting( + ASurface s, + half shadow, + float4 lightVectorRange, + unityShadowCoord4 lightCoord) +{ + half3 lightAxis = A_ZERO; + ADirect d = aNewDirect(); + + d.color = _LightColor0.rgb; + d.shadow = shadow; + +#if !defined(ALLOY_SUPPORT_REDLIGHTS) && defined(DIRECTIONAL_COOKIE) + aLightCookie(d, tex2D(_LightTexture0, lightCoord.xy)); +#elif defined(POINT) || defined(POINT_COOKIE) || defined(SPOT) + lightAxis = normalize(unity_WorldToLight[1].xyz); + + #if defined(POINT) + A_UNITY_ATTENUATION(d, _LightTexture0, lightCoord.xyz, 1.0f) + #elif defined(POINT_COOKIE) + aLightCookie(d, texCUBE(_LightTexture0, lightCoord.xyz)); + A_UNITY_ATTENUATION(d, _LightTextureB0, lightCoord.xyz, 1.0f) + #elif defined(SPOT) + half4 cookie = tex2D(_LightTexture0, lightCoord.xy / lightCoord.w + 0.5); + + cookie.a *= (lightCoord.z > 0); + aLightCookie(d, cookie); + A_UNITY_ATTENUATION(d, _LightTextureB0, lightCoord.xyz, 1.0f) + #endif +#endif + +#if !defined(ALLOY_SUPPORT_REDLIGHTS) || !defined(DIRECTIONAL_COOKIE) + aAreaLight(d, s, _LightColor0, lightAxis, lightVectorRange.xyz, lightVectorRange.w); +#else + d.direction = lightVectorRange.xyz; + d.color *= redLightCalculateForward(_LightTexture0, s.positionWorld, s.normalWorld, s.viewDirWorld, d.direction); + aDirectionalLight(d, s); +#endif + + return aDirectLighting(d, s); +} + +/// Post-processing of Unity surface data into correct format. +/// @param[in,out] s Material surface data. +void aUnitySurface( + inout ASurface s) +{ + s.beckmannRoughness = aLinearToBeckmannRoughness(s.roughness); + s.specularOcclusion = aSpecularOcclusion(s.ambientOcclusion, s.NdotV); +} + +/// Forward illumination with Unity inputs. +/// @param s Material surface data. +/// @param gi Unity GI descriptor. +/// @param shadow Shadow for the given direct light. +/// @return Combined lighting, emission, etc. +half4 aUnityLighting( + ASurface s, + UnityGI gi, + half shadow) +{ + half4 c = 0.0h; + unityShadowCoord4 lightCoord = 0.0f; + float4 lightVectorRange = UnityWorldSpaceLightDir(s.positionWorld).xyzz; + +#ifdef DIRECTIONAL + lightCoord = 0.0h; +#else + lightCoord = mul(unity_WorldToLight, unityShadowCoord4(s.positionWorld, 1.0f)); + + #ifndef USING_DIRECTIONAL_LIGHT + aLightRange(lightVectorRange, lightCoord); + #endif +#endif + +#ifdef UNITY_PASS_FORWARDBASE + c.rgb = aUnityIndirectLighting(gi, s); + + // Extract shadow with combined baked occlusion. + #ifdef HANDLE_SHADOWS_BLENDING_IN_GI + shadow = gi.light.color.g; + #endif +#endif + + c.rgb += aUnityDirectLighting(s, shadow, lightVectorRange, lightCoord); + c.rgb = aHdrClamp(c.rgb); + c.a = s.opacity; + return c; +} + +/// Fills the G-buffer with Unity-compatible material data. +/// @param[in] s Material surface data. +/// @param[in] gi Unity GI descriptor. +/// @param[out] outGBuffer0 RGB: albedo, A: specular occlusion. +/// @param[out] outGBuffer1 RGB: f0, A: 1-roughness. +/// @param[out] outGBuffer2 RGB: packed normal, A: 1-scattering mask. +/// @return RGB: emission, A: 1-transmission. +half4 aUnityLightingDeferred( + ASurface s, + UnityGI gi, + out half4 outGBuffer0, + out half4 outGBuffer1, + out half4 outGBuffer2) +{ + half3 illum = aHdrClamp(s.emissiveColor + aUnityIndirectLighting(gi, s)); + outGBuffer0 = half4(s.albedo, s.specularOcclusion); + outGBuffer1 = half4(s.f0, 1.0h - s.roughness); + outGBuffer2 = half4(s.normalWorld * 0.5h + 0.5h, s.materialType); + return half4(illum, s.subsurface); +} + +/// Forward global illumination with Unity inputs. +/// @param[in,out] gi Unity GI descriptor. +/// @param[in] data GI input data. +/// @param[in] normals World-space normals. +/// @param[in] smoothness Surface smoothness. +/// @param[in] specular Surface f0. +void aUnityLightingGi( + inout UnityGI gi, + UnityGIInput data, + half3 normals, + half smoothness, + half3 specular) +{ + // So we can extract shadow with baked occlusion. +#if defined(UNITY_PASS_FORWARDBASE) && defined(HANDLE_SHADOWS_BLENDING_IN_GI) + data.light.color = A_WHITE; +#endif + + // Pass 1 for occlusion so we can manage that later. +#if defined(UNITY_PASS_DEFERRED) && UNITY_ENABLE_REFLECTION_BUFFERS + gi = UnityGlobalIllumination(data, 1.0h, normals); +#else + Unity_GlossyEnvironmentData g = UnityGlossyEnvironmentSetup(smoothness, data.worldViewDir, normals, specular); + gi = UnityGlobalIllumination(data, 1.0h, normals, g); +#endif +} + +#endif // ALLOY_SHADERS_FRAMEWORK_UNITY_CGINC diff --git a/Assets/Alloy/Shaders/Framework/Unity.cginc.meta b/Assets/Alloy/Shaders/Framework/Unity.cginc.meta new file mode 100644 index 0000000..1bc85cf --- /dev/null +++ b/Assets/Alloy/Shaders/Framework/Unity.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 1bd87f4acb9d203409163c16855b14ae +timeCreated: 1448830649 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/Framework/Utility.cginc b/Assets/Alloy/Shaders/Framework/Utility.cginc new file mode 100644 index 0000000..b9a336d --- /dev/null +++ b/Assets/Alloy/Shaders/Framework/Utility.cginc @@ -0,0 +1,348 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +///////////////////////////////////////////////////////////////////////////////// +/// @file Utility.cginc +/// @brief Minimum functions and constants common to surfaces and particles. +///////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_FRAMEWORK_UTILITY_CGINC +#define ALLOY_SHADERS_FRAMEWORK_UTILITY_CGINC + +#include "Assets/Alloy/Shaders/Config.cginc" + +#include "UnityShaderVariables.cginc" + +/// Defines all texture transform uniform variables, inlcuding additional transforms. +/// Spin is in radians. +#define A_SAMPLER_2D(name) \ + sampler2D name; \ + float4 name##_ST; \ + float2 name##Velocity; \ + float name##Spin; \ + float name##UV; + +/// Allows passing all of a texture's transform uniforms into a function. +#define A_SAMPLER_2D_INPUT(name) name, name##_ST, name##Velocity, name##UV + +/// Allows accessing all of a texture's transform uniforms inside a function. +#define A_SAMPLER_PARAM(name) sampler2D name, float4 name##_ST, float2 name##Velocity, float name##UV + +// NOTE: To make it rotate around a "center" point, the order of operations +// needs to be offset, rotate, scale. So that means that we have to apply +// offset & scroll first divided by tiling. Then when we apply tiling later +// it will cancel. + +/// Applies our scrolling effect. +#ifdef A_TEX_SCROLL_OFF + #define A_TEX_SCROLL(name, tex) (tex) +#else + #define A_TEX_SCROLL(name, tex) (tex + ((name##Velocity * _Time.y + name##_ST.zw) / name##_ST.xy)) +#endif + +/// Applies our spinning effect. +#define A_TEX_SPIN(name, tex) (aRotateTextureCoordinates(name##Spin * _Time.y, tex.xy)) + +/// Applies Unity texture transforms plus our spinning effect. +#define A_TEX_TRANSFORM_SPIN(name, tex) (A_TEX_SPIN(name, tex + (name##_ST.zw / name##_ST.xy)) * name##_ST.xy) + +/// Applies Unity texture transforms plus our spinning and scrolling effects. +#define A_TEX_TRANSFORM_SCROLL(name, tex) (A_TEX_SCROLL(name, tex) * name##_ST.xy) + +/// Applies Unity texture transforms plus our spinning and scrolling effects. +#define A_TEX_TRANSFORM_SCROLL_SPIN(name, tex) (A_TEX_SPIN(name, A_TEX_SCROLL(name, tex)) * name##_ST.xy) + +/// A value close to zero. +/// This is used for preventing NaNs in cases where you can divide by zero. +static const float A_EPSILON = 1e-6f; + +/// Multi-component zero. +static const half3 A_ZERO = half3(0.0h, 0.0h, 0.0h); + +/// Multi-component zero. +static const half4 A_ZERO4 = half4(0.0h, 0.0h, 0.0h, 0.0h); + +/// Multi-component one. +static const half3 A_ONE = half3(1.0h, 1.0h, 1.0h); + +/// Multi-component one. +static const half4 A_ONE4 = half4(1.0h, 1.0h, 1.0h, 1.0h); + +/// Color Black. +static const half3 A_BLACK = A_ZERO; + +/// Multi-component zero. +static const half4 A_BLACK4 = A_ZERO4; + +/// Color White. +static const half3 A_WHITE = A_ONE; + +/// Multi-component one. +static const half4 A_WHITE4 = A_ONE4; + +/// X-Axis normal. +static const half3 A_AXIS_X = half3(1.0h, 0.0h, 0.0h); + +/// Y-Axis normal. +static const half3 A_AXIS_Y = half3(0.0h, 1.0h, 0.0h); + +/// Z-Axis normal. +static const half3 A_AXIS_Z = half3(0.0h, 0.0h, 1.0h); + +/// Flat normal in tangent space. +static const half3 A_FLAT_NORMAL = A_AXIS_Z; + +/// Applies 2D texture rotation around the point (0.5,0.5) in UV-space. +/// @param rotation Rotation in radians. +/// @param texcoords Texture coordinates to be rotated. +/// @return Rotated texture coordinates. +float2 aRotateTextureCoordinates( + float rotation, + float2 texcoords) +{ + // Texture Rotation + // cf http://forum.unity3d.com/threads/rotation-of-texture-uvs-directly-from-a-shader.150482/#post-1031763 + float2 centerOffset = float2(0.5f, 0.5f); + float sinTheta = sin(rotation); + float cosTheta = cos(rotation); + float2x2 rotationMatrix = float2x2(cosTheta, -sinTheta, sinTheta, cosTheta); + return mul(texcoords - centerOffset, rotationMatrix) + centerOffset; +} + +/// Dot product of two vectors, clamped to range [0,1]. +half aDotClamp( + half2 x, + half2 y) +{ + return saturate(dot(x, y)); +} + +/// Dot product of two vectors, clamped to range [0,1]. +half aDotClamp( + half3 x, + half3 y) +{ + return saturate(dot(x, y)); +} + +/// Dot product of two vectors, clamped to range [0,1]. +half aDotClamp( + half4 x, + half4 y) +{ + return saturate(dot(x, y)); +} + +/// Screen Blends two colors. +half3 aScreenBlend( + half3 a, + half3 b) +{ + return A_ONE - ((A_ONE - a) * (A_ONE - b)); +} + +/// Converts an LDR color from gamma-space to linear-space. +half3 aGammaToLinear( + half3 sRGB) +{ + // sRGB curve approximation. + // cf http://chilliant.blogspot.com.au/2012/08/srgb-approximations-for-hlsl.html?m=1 + return sRGB * (sRGB * (sRGB * 0.305306011h + 0.682171111h) + 0.012522878h); +} + +/// Converts an LDR value from gamma-space to linear-space. +half aGammaToLinear( + half sRGB) +{ + return aGammaToLinear(sRGB.rrr).r; +} + +/// Interpolate from one to another value. +half aLerpOneTo( + half b, + half alpha) +{ + // Use lerp intrinsic for better optimization. + return lerp(1.0h, b, alpha); +} + +/// Interpolate from the color white to another color. +half3 aLerpWhiteTo( + half3 b, + half alpha) +{ + // Use lerp intrinsic for better optimization. + return lerp(A_WHITE, b, alpha); +} + +/// Calculates a linear color's luminance. +/// @param color Linear LDR color. +/// @return Color's chromaticity. +half aLuminance( + half3 color) +{ + // Linear-space luminance coefficients. + // cf https://en.wikipedia.org/wiki/Luma_(video) + return dot(color, half3(0.2126h, 0.7152h, 0.0722h)); +} + +/// Calculates a linear color's chromaticity. +/// @param color Linear LDR color. +/// @return Color's chromaticity. +half3 aChromaticity( + half3 color) +{ + return color / max(aLuminance(color), A_EPSILON).rrr; +} + +/// Clamp HDR output to avoid excess bloom and blending errors. +/// @param value Linear HDR value. +/// @return Range-limited HDR color [0,32]. +half aHdrClamp( + half value) +{ +#if A_USE_HDR_CLAMP + value = min(value, A_HDR_CLAMP_MAX_INTENSITY); +#endif + return value; +} + +/// Clamp HDR output to avoid excess bloom and blending errors. +/// @param color Linear HDR color. +/// @return Range-limited HDR color [0,32]. +half3 aHdrClamp( + half3 color) +{ +#if A_USE_HDR_CLAMP + color = min(color, (A_HDR_CLAMP_MAX_INTENSITY).rrr); +#endif + return color; +} + +/// Clamp HDR output to avoid excess bloom and blending errors. +/// @param color Linear HDR color. +/// @return Range-limited HDR color [0,32]. +half4 aHdrClamp( + half4 color) +{ +#if A_USE_HDR_CLAMP + color = min(color, (A_HDR_CLAMP_MAX_INTENSITY).rrrr); +#endif + return color; +} + +/// Used to calculate a rim light effect. +/// @param weight Scales the intensity of the effect. +/// @param bias Bias rim towards constant emission. +/// @param power Rim falloff. +/// @param NdotV Normal and view vector dot product. +/// @return Rim lighting. +half aRimLight( + half weight, + half bias, + half power, + half NdotV) +{ + return weight * lerp(bias, 1.0h, pow(1.0h - NdotV, power)); +} + +/// Gets distance from a point to an Axis-Aligned Bounding Box. +/// @param p Starting point. +/// @param aabbMin AABB min extents. +/// @param aabbMax AABB max extents. +/// @return Per-axis distance from AABB extents. +half3 aDistanceFromAabb( + half3 p, + half3 aabbMin, + half3 aabbMax) +{ + return max(max(p - aabbMax, aabbMin - p), half3(0.0h, 0.0h, 0.0h)); +} + +/// Applies four closest lights per-vertex using Alloy's attenuation. +/// @param lightPosX Four lights' position X in world-space. +/// @param lightPosY Four lights' position Y in world-space. +/// @param lightPosZ Four lights' position Z in world-space. +/// @param lightColor0 First light color. +/// @param lightColor1 Second light color. +/// @param lightColor2 Third light color. +/// @param lightColor3 Fourth light color. +/// @param lightAttenSq Four lights' Unity attenuation. +/// @param positionWorld Position in world-space. +/// @param normalWorld Normal in world-space. +/// @return Per-vertex direct lighting. +float3 aShade4PointLights( + float4 lightPosX, + float4 lightPosY, + float4 lightPosZ, + float3 lightColor0, + float3 lightColor1, + float3 lightColor2, + float3 lightColor3, + float4 lightAttenSq, + float3 positionWorld, + float3 normalWorld) +{ + // to light vectors + float4 toLightX = lightPosX - positionWorld.x; + float4 toLightY = lightPosY - positionWorld.y; + float4 toLightZ = lightPosZ - positionWorld.z; + + // squared lengths + float4 lengthSq = 0; + lengthSq += toLightX * toLightX; + lengthSq += toLightY * toLightY; + lengthSq += toLightZ * toLightZ; + + // NdotL + float4 ndotl = 0; + ndotl += toLightX * normalWorld.x; + ndotl += toLightY * normalWorld.y; + ndotl += toLightZ * normalWorld.z; + + // correct NdotL + float4 corr = rsqrt(lengthSq); + ndotl = max (float4(0.0f, 0.0f, 0.0f, 0.0f), ndotl * corr); + + // attenuation +#if A_USE_UNITY_ATTENUATION + float4 atten = 1.0 / (1.0 + lengthSq * lightAttenSq); +#else + // NOTE: Get something close to Alloy attenuation by undoing Unity's calculations. + // http://forum.unity3d.com/threads/easiest-way-to-change-point-light-attenuation-with-deferred-path.254337/#post-1681835 + float4 invRangeSqr = lightAttenSq / 25.0f; + + // Inverse Square attenuation, with light range falloff. + // cf http://blog.selfshadow.com/publications/s2013-shading-course/karis/s2013_pbs_epic_notes_v2.pdf p12 + float4 ratio2 = lengthSq * invRangeSqr; + float4 num = saturate(float4(1.0f, 1.0f, 1.0f, 1.0f) - (ratio2 * ratio2)); + float4 atten = (num * num) / (lengthSq + float4(1.0f, 1.0f, 1.0f, 1.0f)); +#endif + + float4 diff = ndotl * atten; + + // final color + float3 col = 0; + col += lightColor0 * diff.x; + col += lightColor1 * diff.y; + col += lightColor2 * diff.z; + col += lightColor3 * diff.w; + return col; +} + +/// Applies four closest lights per-vertex using Alloy's attenuation. +/// @param positionWorld Position in world-space. +/// @param normalWorld Normal in world-space. +/// @return Per-vertex direct lighting. +float3 aShade4PointLights( + float3 positionWorld, + float3 normalWorld) +{ + return aShade4PointLights( + unity_4LightPosX0, unity_4LightPosY0, unity_4LightPosZ0, + unity_LightColor[0].rgb, unity_LightColor[1].rgb, unity_LightColor[2].rgb, unity_LightColor[3].rgb, + unity_4LightAtten0, positionWorld, normalWorld); +} + +#endif // ALLOY_SHADERS_FRAMEWORK_UTILITY_CGINC diff --git a/Assets/Alloy/Shaders/Framework/Utility.cginc.meta b/Assets/Alloy/Shaders/Framework/Utility.cginc.meta new file mode 100644 index 0000000..61667bc --- /dev/null +++ b/Assets/Alloy/Shaders/Framework/Utility.cginc.meta @@ -0,0 +1,6 @@ +fileFormatVersion: 2 +guid: 9bb275497f031324c95a6fd416e6d726 +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: diff --git a/Assets/Alloy/Shaders/Framework/Volumetric.cginc b/Assets/Alloy/Shaders/Framework/Volumetric.cginc new file mode 100644 index 0000000..312c66c --- /dev/null +++ b/Assets/Alloy/Shaders/Framework/Volumetric.cginc @@ -0,0 +1,22 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +/////////////////////////////////////////////////////////////////////////////// +/// @file Volumetric.cginc +/// @brief Volumetric fog, light shafts, etc interfaces. +/////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_FRAMEWORK_VOLUMETRIC_CGINC +#define ALLOY_SHADERS_FRAMEWORK_VOLUMETRIC_CGINC + +/// Volumetric effects for base passes. +void aVolumetricBase(inout half4 color, ASurface s); + +/// Volumetric effects for additive passes. +void aVolumetricAdd(inout half4 color, ASurface s); + +/// Volumetric effects for multiplicative passes. +void aVolumetricMultiply(inout half4 color, ASurface s); + +#endif // ALLOY_SHADERS_FRAMEWORK_VOLUMETRIC_CGINC diff --git a/Assets/Alloy/Shaders/Framework/Volumetric.cginc.meta b/Assets/Alloy/Shaders/Framework/Volumetric.cginc.meta new file mode 100644 index 0000000..6d936a1 --- /dev/null +++ b/Assets/Alloy/Shaders/Framework/Volumetric.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 0a3f6e1010e5ea94b9c9d8852f08fd1f +timeCreated: 1496489792 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/Framework/VolumetricImpl.cginc b/Assets/Alloy/Shaders/Framework/VolumetricImpl.cginc new file mode 100644 index 0000000..55c870c --- /dev/null +++ b/Assets/Alloy/Shaders/Framework/VolumetricImpl.cginc @@ -0,0 +1,92 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +/////////////////////////////////////////////////////////////////////////////// +/// @file Volumetric.cginc +/// @brief Volumetric fog, light shafts, etc implementations. +/////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_FRAMEWORK_VOLUMETRIC_IMPL_CGINC +#define ALLOY_SHADERS_FRAMEWORK_VOLUMETRIC_IMPL_CGINC + +#include "Assets/Alloy/Shaders/Config.cginc" +#include "Assets/Alloy/Shaders/Framework/Volumetric.cginc" + +#include "UnityShaderVariables.cginc" + +#ifdef A_VOLUMETRIC_PASS + #if defined(VAPOR_TRANSLUCENT_FOG_ON) + #ifndef A_POSITION_WORLD_ON + #define A_POSITION_WORLD_ON + #endif + #elif defined(VTRANSPARENCY_ON) + #ifndef A_SCREEN_UV_ON + #define A_SCREEN_UV_ON + #endif + + #ifndef A_VIEW_DEPTH_ON + #define A_VIEW_DEPTH_ON + #endif + #endif + + #if !defined(A_FOG_ON) && (defined(FOG_LINEAR) || defined(FOG_EXP) || defined(FOG_EXP2)) + #define A_FOG_ON + #endif +#endif + +void aVolumetricBase( + inout half4 color, + ASurface s) +{ +#ifdef A_VOLUMETRIC_PASS + UNITY_APPLY_FOG_COLOR(s.fogCoord, color, unity_FogColor); + + #if defined(VAPOR_TRANSLUCENT_FOG_ON) + color = VaporApplyFog(s.positionWorld, color); + #elif defined(VTRANSPARENCY_ON) + float4 data = s.screenPosition; + + data.z = s.viewDepth; + color = VolumetricTransparencyBase(color, data); + #endif +#endif +} + +void aVolumetricAdd( + inout half4 color, + ASurface s) +{ +#ifdef A_VOLUMETRIC_PASS + UNITY_APPLY_FOG_COLOR(s.fogCoord, color, A_BLACK4); + + #if defined(VAPOR_TRANSLUCENT_FOG_ON) + color = VaporApplyFogAdd(s.positionWorld, color); + #elif defined(VTRANSPARENCY_ON) + float4 data = s.screenPosition; + + data.z = s.viewDepth; + color = VolumetricTransparencyAdd(color, data); + #endif +#endif +} + +void aVolumetricMultiply( + inout half4 color, + ASurface s) +{ +#ifdef A_VOLUMETRIC_PASS + UNITY_APPLY_FOG_COLOR(s.fogCoord, color, A_WHITE4); + + #if defined(VAPOR_TRANSLUCENT_FOG_ON) + color = VaporApplyFogFade(s.positionWorld, color, A_WHITE); + #elif defined(VTRANSPARENCY_ON) +// float4 data = s.screenPosition; +// +// data.z = s.viewDepth; +// color = VolumetricTransparencyAdd(color, data); + #endif +#endif +} + +#endif // ALLOY_SHADERS_FRAMEWORK_VOLUMETRIC_IMPL_CGINC diff --git a/Assets/Alloy/Shaders/Framework/VolumetricImpl.cginc.meta b/Assets/Alloy/Shaders/Framework/VolumetricImpl.cginc.meta new file mode 100644 index 0000000..e7e9dc3 --- /dev/null +++ b/Assets/Alloy/Shaders/Framework/VolumetricImpl.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 185744146fc75a8458c2dc17f105132c +timeCreated: 1496490406 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/Lighting.meta b/Assets/Alloy/Shaders/Lighting.meta new file mode 100644 index 0000000..4505b0c --- /dev/null +++ b/Assets/Alloy/Shaders/Lighting.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 3f6d5020f3b15004e9955466e3d7e194 +folderAsset: yes +timeCreated: 1429575567 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/Lighting/Hair.cginc b/Assets/Alloy/Shaders/Lighting/Hair.cginc new file mode 100644 index 0000000..da892e4 --- /dev/null +++ b/Assets/Alloy/Shaders/Lighting/Hair.cginc @@ -0,0 +1,157 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +/////////////////////////////////////////////////////////////////////////////// +/// @file Hair.cginc +/// @brief Hair lighting model. Forward-only. +/////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_LIGHTING_HAIR_CGINC +#define ALLOY_SHADERS_LIGHTING_HAIR_CGINC + +#ifndef A_AREA_SPECULAR_OFF + #define A_AREA_SPECULAR_OFF +#endif + +#define A_SURFACE_CUSTOM_FIELDS \ + half3 highlightTint0; \ + half highlightShift0; \ + half3 highlightTint1; \ + half highlightShift1; \ + half3 highlightTangent; \ + half3 highlightTangentWorld; \ + half3 specularColor0; \ + half roughness0; \ + half3 specularColor1; \ + half roughness1; + +#include "Assets/Alloy/Shaders/Framework/Lighting.cginc" + +/// Amount that diffuse lighting should wrap around. +/// Expects values in the range [0,1]. +half _HairDiffuseWrapAmount; + +/// Overall hair specularity. +/// Expects values in the range [0,1]. +half _HairSpecularity; + +/// Rotation of the hair highlight +/// Expects rotation values in degrees. +half _AnisoAngle; + +/// Primary highlight tint color. +/// Expects a linear LDR color. +half3 _HighlightTint0; + +/// Primary highlight position shift along normal. +/// Expects values in the range [-n,n]. +half _HighlightShift0; + +/// Primary highlight width. +/// Expects values in the range [0,1]. +half _HighlightWidth0; + +/// Secondary highlight tint color. +/// Expects a linear LDR color. +half3 _HighlightTint1; + +/// Secondary highlight position shift along normal. +/// Expects values in the range [-n,n]. +half _HighlightShift1; + +/// Secondary highlight width. +/// Expects values in the range [0,1]. +half _HighlightWidth1; + +/// Kajiya-Kay anisotropic specular. +/// @param d Direct lighting data. +/// @param s Material surface data. +/// @param f0 Fresnel reflectance at incidence zero, LDR color. +/// @param roughness Linear roughness [0,1]. +/// @param shift Amount to shift the highlight along the normal [0,1]. +/// @return Kajiya-Kay specular. +half3 aKajiyaKay( + ADirect d, + ASurface s, + half3 f0, + half roughness, + half shift) +{ + // Convert Beckmann roughness to Blinn Phong specular power. + // cf http://graphicrants.blogspot.com/2013/08/specular-brdf-reference.html + half a = aLinearToBeckmannRoughness(roughness); + half sp = (2.0h / (a * a)) - 2.0h; + + // Modified Kajiya-kay. + // cf http://developer.amd.com/wordpress/media/2012/10/Scheuermann_HairRendering.pdf + half tdhm = dot(normalize(s.highlightTangentWorld + s.normalWorld * shift), d.halfAngleWorld); + + // HACK: Treat like Normalized Blinn Phong NDF, with 1/4 precombined. + // Semi-physical, and looks more consistent with the IBL. + half spec = (sp * 0.125h + 0.25h) * pow(sqrt(1.0h - tdhm * tdhm), sp); + + /// Only use spec color since fresnel makes wide highlights white at edges. + return f0 * spec; +} + +void aPreLighting( + inout ASurface s) +{ + aStandardPreLighting(s); + + // Tangent + s.highlightTangentWorld = aTangentToWorld(s, s.highlightTangent); + + // Hair data. + s.specularColor0 = s.f0 * s.highlightTint0; + s.roughness0 = lerp(s.roughness, 1.0h, _HighlightWidth0); + + s.specularColor1 = s.f0 * _HighlightTint1; + s.roughness1 = lerp(s.roughness, 1.0h, _HighlightWidth1); + + // Average values from the two highlights for IBL. + s.f0 = (s.specularColor0 + s.specularColor1) * 0.5h; + s.roughness = (s.roughness0 + s.roughness1) * 0.5h; +} + +half3 aDirectLighting( + ADirect d, + ASurface s) +{ + half3 specular = 0.0h; + + // Energy-conserving wrap lighting. + // cf http://seblagarde.wordpress.com/2012/01/08/pi-or-not-to-pi-in-game-lighting-equation/ + half denom = (1.0h + _HairDiffuseWrapAmount); + half3 diffuse = s.albedo * saturate((d.NdotLm + _HairDiffuseWrapAmount) / (denom * denom)); + +#ifndef _SPECULARHIGHLIGHTS_OFF + // Scheuermann hair lighting + // Anisotropy and area light approximation don't play well together, so recalculate H. + // cf http://www.shaderwrangler.com/publications/hairsketch/hairsketch.pdf + half3 d0 = aKajiyaKay(d, s, s.specularColor0, s.roughness0, s.highlightShift0); + half3 d1 = aKajiyaKay(d, s, s.specularColor1, s.roughness1, s.highlightShift1); + + specular = aSpecularLightingToggle(s, (s.specularOcclusion * d.specularIntensity * d.NdotL) * max(d0, d1)); +#endif + + // max() for energy conservation where the specular highlights overlap. + return d.color * d.shadow * (diffuse + specular); +} + +half3 aIndirectLighting( + AIndirect i, + ASurface s) +{ + // Yoshiharu Gotanda's fake interreflection for specular occlusion. + // Modified to better account for surface f0. + // cf http://research.tri-ace.com/Data/cedec2011_RealtimePBR_Implementation_e.pptx pg65 + half3 ambient = i.diffuse * s.ambientOcclusion; + + // No environment BRDF, as it makes the hair look greasy. + return s.albedo * ambient + + aSpecularLightingToggle(s, s.f0 * lerp(ambient, i.specular, s.specularOcclusion)); +} + +#endif // ALLOY_SHADERS_LIGHTING_HAIR_CGINC diff --git a/Assets/Alloy/Shaders/Lighting/Hair.cginc.meta b/Assets/Alloy/Shaders/Lighting/Hair.cginc.meta new file mode 100644 index 0000000..ecc79b5 --- /dev/null +++ b/Assets/Alloy/Shaders/Lighting/Hair.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 5545029613f70b74c9dcc05d223982b3 +timeCreated: 1429586250 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/Lighting/Standard.cginc b/Assets/Alloy/Shaders/Lighting/Standard.cginc new file mode 100644 index 0000000..88e9d43 --- /dev/null +++ b/Assets/Alloy/Shaders/Lighting/Standard.cginc @@ -0,0 +1,35 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +/////////////////////////////////////////////////////////////////////////////// +/// @file Standard.cginc +/// @brief Physical BRDF with optional SSS effects. Forward+Deferred. +/////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_LIGHTING_STANDARD_CGINC +#define ALLOY_SHADERS_LIGHTING_STANDARD_CGINC + +#include "Assets/Alloy/Shaders/Framework/Lighting.cginc" + +void aPreLighting( + inout ASurface s) +{ + aStandardPreLighting(s); +} + +half3 aDirectLighting( + ADirect d, + ASurface s) +{ + return aStandardDirectLighting(d, s); +} + +half3 aIndirectLighting( + AIndirect i, + ASurface s) +{ + return aStandardIndirectLighting(i, s); +} + +#endif // ALLOY_SHADERS_LIGHTING_STANDARD_CGINC diff --git a/Assets/Alloy/Shaders/Lighting/Standard.cginc.meta b/Assets/Alloy/Shaders/Lighting/Standard.cginc.meta new file mode 100644 index 0000000..729aa93 --- /dev/null +++ b/Assets/Alloy/Shaders/Lighting/Standard.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 23dfc12b0ae27904895bff164efc9210 +timeCreated: 1429647929 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/Lighting/Unlit.cginc b/Assets/Alloy/Shaders/Lighting/Unlit.cginc new file mode 100644 index 0000000..87ea1d3 --- /dev/null +++ b/Assets/Alloy/Shaders/Lighting/Unlit.cginc @@ -0,0 +1,43 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +/////////////////////////////////////////////////////////////////////////////// +/// @file Unlit.cginc +/// @brief Unlit lighting model. Forward+Deferred. +/////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_LIGHTING_UNLIT_CGINC +#define ALLOY_SHADERS_LIGHTING_UNLIT_CGINC + +#define A_UNLIT_MODE + +#include "Assets/Alloy/Shaders/Framework/Lighting.cginc" + +void aPreLighting( + inout ASurface s) +{ + // Preserve normals and emission. Kill everything else. + s.albedo = A_BLACK; + s.specularOcclusion = 0.0h; + s.f0 = A_BLACK; + s.roughness = 1.0h; + s.materialType = A_MATERIAL_TYPE_OPAQUE; + s.subsurface = 0.0h; +} + +half3 aDirectLighting( + ADirect d, + ASurface s) +{ + return A_BLACK; +} + +half3 aIndirectLighting( + AIndirect i, + ASurface s) +{ + return A_BLACK; +} + +#endif // ALLOY_SHADERS_LIGHTING_UNLIT_CGINC diff --git a/Assets/Alloy/Shaders/Lighting/Unlit.cginc.meta b/Assets/Alloy/Shaders/Lighting/Unlit.cginc.meta new file mode 100644 index 0000000..9bd40cc --- /dev/null +++ b/Assets/Alloy/Shaders/Lighting/Unlit.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: a4cb82efe5f7d784a8e50445592c9925 +timeCreated: 1492103810 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/Type.meta b/Assets/Alloy/Shaders/Type.meta new file mode 100644 index 0000000..bead3db --- /dev/null +++ b/Assets/Alloy/Shaders/Type.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 256af8260f62bf14ead9e15f87161b46 +folderAsset: yes +timeCreated: 1462626963 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/Type/DecalAdditive.cginc b/Assets/Alloy/Shaders/Type/DecalAdditive.cginc new file mode 100644 index 0000000..fa9dbfd --- /dev/null +++ b/Assets/Alloy/Shaders/Type/DecalAdditive.cginc @@ -0,0 +1,42 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +/////////////////////////////////////////////////////////////////////////////// +/// @file DecalAdditive.cginc +/// @brief Additive decal shader type callbacks. +/////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_TYPE_DECAL_ADDITIVE_CGINC +#define ALLOY_SHADERS_TYPE_DECAL_ADDITIVE_CGINC + +#include "Assets/Alloy/Shaders/Framework/Type.cginc" + +void aVertexShader( + inout AVertex v) +{ + aStandardVertexShader(v); +} + +void aColorShader( + inout half4 color, + ASurface s) +{ + aVolumetricAdd(color, s); +} + +void aGbufferShader( + inout AGbuffer gb, + ASurface s) +{ + gb.diffuseOcclusion = A_BLACK4; + gb.specularSmoothness = A_BLACK4; + gb.normalType = A_ZERO4; + gb.emissionSubsurface.w = 0.0h; + +#ifdef A_SHADOW_MASKS_BUFFER_ON + gb.shadowMasks = A_ZERO4; +#endif +} + +#endif // ALLOY_SHADERS_TYPE_DECAL_ADDITIVE_CGINC diff --git a/Assets/Alloy/Shaders/Type/DecalAdditive.cginc.meta b/Assets/Alloy/Shaders/Type/DecalAdditive.cginc.meta new file mode 100644 index 0000000..9137143 --- /dev/null +++ b/Assets/Alloy/Shaders/Type/DecalAdditive.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 21a6a48d07f65d74d999315f5e9115b4 +timeCreated: 1462630018 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/Type/DecalAlpha.cginc b/Assets/Alloy/Shaders/Type/DecalAlpha.cginc new file mode 100644 index 0000000..d940aeb --- /dev/null +++ b/Assets/Alloy/Shaders/Type/DecalAlpha.cginc @@ -0,0 +1,55 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +/////////////////////////////////////////////////////////////////////////////// +/// @file DecalAlpha.cginc +/// @brief Alpha decal shader type callbacks. +/////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_TYPE_DECAL_ALPHA_CGINC +#define ALLOY_SHADERS_TYPE_DECAL_ALPHA_CGINC + +#include "Assets/Alloy/Shaders/Framework/Type.cginc" + +void aVertexShader( + inout AVertex v) +{ + aStandardVertexShader(v); +} + +void aColorShader( + inout half4 color, + ASurface s) +{ + aStandardColorShader(color, s); +} + +void aGbufferShader( + inout AGbuffer gb, + ASurface s) +{ + // Deferred alpha decal two-pass solution. + // cf http://forum.unity3d.com/threads/how-do-i-write-a-normal-decal-shader-using-a-newly-added-unity-5-2-finalgbuffer-modifier.356644/page-2 +#ifdef A_DECAL_ALPHA_FIRSTPASS_SHADER + gb.diffuseOcclusion.a = s.opacity; + gb.specularSmoothness.a = s.opacity; + gb.normalType.a = s.opacity; + gb.emissionSubsurface.a = s.opacity; + + #ifdef A_SHADOW_MASKS_BUFFER_ON + gb.shadowMasks.a = s.opacity; + #endif +#else + gb.diffuseOcclusion.a *= s.opacity; + gb.specularSmoothness.a *= s.opacity; + gb.normalType.a *= s.opacity; + gb.emissionSubsurface.a *= s.opacity; + + #ifdef A_SHADOW_MASKS_BUFFER_ON + gb.shadowMasks.a *= s.opacity; + #endif +#endif +} + +#endif // ALLOY_SHADERS_TYPE_DECAL_ALPHA_CGINC diff --git a/Assets/Alloy/Shaders/Type/DecalAlpha.cginc.meta b/Assets/Alloy/Shaders/Type/DecalAlpha.cginc.meta new file mode 100644 index 0000000..4747448 --- /dev/null +++ b/Assets/Alloy/Shaders/Type/DecalAlpha.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 7e3d903f20404a3498bca5775e51048c +timeCreated: 1462629651 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/Type/DecalAmbient.cginc b/Assets/Alloy/Shaders/Type/DecalAmbient.cginc new file mode 100644 index 0000000..8ed7b45 --- /dev/null +++ b/Assets/Alloy/Shaders/Type/DecalAmbient.cginc @@ -0,0 +1,46 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +/////////////////////////////////////////////////////////////////////////////// +/// @file DecalAmbient.cginc +/// @brief Ambient-only decal shader type callbacks. +/////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_TYPE_DECAL_AMBIENT_CGINC +#define ALLOY_SHADERS_TYPE_DECAL_AMBIENT_CGINC + +#include "Assets/Alloy/Shaders/Framework/Type.cginc" + +void aVertexShader( + inout AVertex v) +{ + aStandardVertexShader(v); +} + +void aColorShader( + inout half4 color, + ASurface s) +{ + color.rgb = s.baseColor.rgb; + color.a = 1.0h; + aVolumetricMultiply(color, s); +} + +void aGbufferShader( + inout AGbuffer gb, + ASurface s) +{ + gb.diffuseOcclusion.rgb = A_WHITE; + gb.diffuseOcclusion.a = aLuminance(s.baseColor); // Deferred reflections. + gb.specularSmoothness = A_WHITE4; + gb.normalType = A_ONE4; + gb.emissionSubsurface.rgb = s.baseColor; + gb.emissionSubsurface.a = 1.0h; + +#ifdef A_SHADOW_MASKS_BUFFER_ON + gb.shadowMasks = A_ONE4; +#endif +} + +#endif // ALLOY_SHADERS_TYPE_DECAL_AMBIENT_CGINC diff --git a/Assets/Alloy/Shaders/Type/DecalAmbient.cginc.meta b/Assets/Alloy/Shaders/Type/DecalAmbient.cginc.meta new file mode 100644 index 0000000..f2c3a84 --- /dev/null +++ b/Assets/Alloy/Shaders/Type/DecalAmbient.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: ca0f852ccb8161f4fa5a9f045411c150 +timeCreated: 1467668619 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/Type/DecalMultiplicative.cginc b/Assets/Alloy/Shaders/Type/DecalMultiplicative.cginc new file mode 100644 index 0000000..5731b12 --- /dev/null +++ b/Assets/Alloy/Shaders/Type/DecalMultiplicative.cginc @@ -0,0 +1,45 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +/////////////////////////////////////////////////////////////////////////////// +/// @file DecalMultiplicative.cginc +/// @brief Multiplicative decal shader type callbacks. +/////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_TYPE_DECAL_MULTIPLICATIVE_CGINC +#define ALLOY_SHADERS_TYPE_DECAL_MULTIPLICATIVE_CGINC + +#include "Assets/Alloy/Shaders/Framework/Type.cginc" + +void aVertexShader( + inout AVertex v) +{ + aStandardVertexShader(v); +} + +void aColorShader( + inout half4 color, + ASurface s) +{ + color.rgb = s.baseColor.rgb; + color.a = 1.0h; + aVolumetricMultiply(color, s); +} + +void aGbufferShader( + inout AGbuffer gb, + ASurface s) +{ + gb.diffuseOcclusion.rgb = s.baseColor; + gb.diffuseOcclusion.a = 1.0h; + gb.specularSmoothness = gb.diffuseOcclusion; + gb.normalType = A_ONE4; + gb.emissionSubsurface = gb.diffuseOcclusion; + +#ifdef A_SHADOW_MASKS_BUFFER_ON + gb.shadowMasks = A_ONE4; +#endif +} + +#endif // ALLOY_SHADERS_TYPE_DECAL_MULTIPLICATIVE_CGINC diff --git a/Assets/Alloy/Shaders/Type/DecalMultiplicative.cginc.meta b/Assets/Alloy/Shaders/Type/DecalMultiplicative.cginc.meta new file mode 100644 index 0000000..87e0420 --- /dev/null +++ b/Assets/Alloy/Shaders/Type/DecalMultiplicative.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 10ee07b10fa2ef2428ca8822b1727ee4 +timeCreated: 1462630018 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/Type/Details1.cginc b/Assets/Alloy/Shaders/Type/Details1.cginc new file mode 100644 index 0000000..21b9173 --- /dev/null +++ b/Assets/Alloy/Shaders/Type/Details1.cginc @@ -0,0 +1,60 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +/////////////////////////////////////////////////////////////////////////////// +/// @file Details1.cginc +/// @brief Unity Details1 shader type callbacks. +/////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_TYPE_DETAILS1_CGINC +#define ALLOY_SHADERS_TYPE_DETAILS1_CGINC + +#ifndef A_TEX_UV_OFF + #define A_TEX_UV_OFF +#endif + +#ifndef A_TEX_SCROLL_OFF + #define A_TEX_SCROLL_OFF +#endif + +#ifndef A_OPACITY_MASK_ON + #define A_OPACITY_MASK_ON +#endif + +#include "Assets/Alloy/Shaders/Framework/Type.cginc" + +#include "TerrainEngine.cginc" + +void aVertexShader( + inout AVertex v) +{ + aStandardVertexShader(v); + + // Adapt vertex data so we can reuse wind code. + appdata_full IN; + + UNITY_INITIALIZE_OUTPUT(appdata_full, IN); + IN.vertex = v.positionObject; + IN.color = v.color; + + WavingGrassVert(IN); + v.positionObject = IN.vertex; + v.color = IN.color; +} + +void aColorShader( + inout half4 color, + ASurface s) +{ + aStandardColorShader(color, s); +} + +void aGbufferShader( + inout AGbuffer gb, + ASurface s) +{ + +} + +#endif // ALLOY_SHADERS_TYPE_DETAILS1_CGINC diff --git a/Assets/Alloy/Shaders/Type/Details1.cginc.meta b/Assets/Alloy/Shaders/Type/Details1.cginc.meta new file mode 100644 index 0000000..b1c575a --- /dev/null +++ b/Assets/Alloy/Shaders/Type/Details1.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: af911b2f2cd29a640a0061da2daece1d +timeCreated: 1477700689 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/Type/Details2.cginc b/Assets/Alloy/Shaders/Type/Details2.cginc new file mode 100644 index 0000000..8f796e6 --- /dev/null +++ b/Assets/Alloy/Shaders/Type/Details2.cginc @@ -0,0 +1,65 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +/////////////////////////////////////////////////////////////////////////////// +/// @file Details2.cginc +/// @brief Unity Details2 shader type callbacks. +/////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_TYPE_DETAILS2_CGINC +#define ALLOY_SHADERS_TYPE_DETAILS2_CGINC + +#ifndef A_TEX_UV_OFF + #define A_TEX_UV_OFF +#endif + +#ifndef A_TEX_SCROLL_OFF + #define A_TEX_SCROLL_OFF +#endif + +#ifndef A_TANGENT_ON + #define A_TANGENT_ON +#endif + +#ifndef A_OPACITY_MASK_ON + #define A_OPACITY_MASK_ON +#endif + +#include "Assets/Alloy/Shaders/Framework/Type.cginc" + +#include "TerrainEngine.cginc" + +void aVertexShader( + inout AVertex v) +{ + aStandardVertexShader(v); + + // Adapt vertex data so we can reuse wind code. + appdata_full IN; + + UNITY_INITIALIZE_OUTPUT(appdata_full, IN); + IN.vertex = v.positionObject; + IN.tangent = v.tangentObject; + IN.color = v.color; + + WavingGrassBillboardVert(IN); + v.positionObject = IN.vertex; + v.color = IN.color; +} + +void aColorShader( + inout half4 color, + ASurface s) +{ + aStandardColorShader(color, s); +} + +void aGbufferShader( + inout AGbuffer gb, + ASurface s) +{ + +} + +#endif // ALLOY_SHADERS_TYPE_DETAILS2_CGINC diff --git a/Assets/Alloy/Shaders/Type/Details2.cginc.meta b/Assets/Alloy/Shaders/Type/Details2.cginc.meta new file mode 100644 index 0000000..485f4f1 --- /dev/null +++ b/Assets/Alloy/Shaders/Type/Details2.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 26b63f18ce32ad641901db056d035180 +timeCreated: 1477700841 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/Type/SpeedTree.cginc b/Assets/Alloy/Shaders/Type/SpeedTree.cginc new file mode 100644 index 0000000..c0afe73 --- /dev/null +++ b/Assets/Alloy/Shaders/Type/SpeedTree.cginc @@ -0,0 +1,95 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +/////////////////////////////////////////////////////////////////////////////// +/// @file SpeedTree.cginc +/// @brief SpeedTree shader type callbacks. +/////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_TYPE_SPEED_TREE_CGINC +#define ALLOY_SHADERS_TYPE_SPEED_TREE_CGINC + +#ifndef A_TEX_UV_OFF + #define A_TEX_UV_OFF +#endif + +#ifndef A_UV2_ON + #define A_UV2_ON +#endif + +#ifndef A_UV3_ON + #define A_UV3_ON +#endif + +#ifndef A_VERTEX_COLOR_IS_DATA + #define A_VERTEX_COLOR_IS_DATA +#endif + +#ifndef A_AMBIENT_OCCLUSION_ON + #define A_AMBIENT_OCCLUSION_ON +#endif + +#ifndef A_OPACITY_MASK_ON + #define A_OPACITY_MASK_ON +#endif + +#define ENABLE_WIND +#define SPEEDTREE_Y_UP + +#ifdef GEOM_TYPE_BRANCH_DETAIL + #define GEOM_TYPE_BRANCH +#endif + +#include "Assets/Alloy/Shaders/Framework/Type.cginc" + +#include "SpeedTreeVertex.cginc" + +void aVertexShader( + inout AVertex v) +{ + v.color.r = aOcclusionStrength(v.color.r, _Occlusion); + +#ifdef EFFECT_HUE_VARIATION + float hueVariationAmount = frac(unity_ObjectToWorld[0].w + unity_ObjectToWorld[1].w + unity_ObjectToWorld[2].w); + hueVariationAmount += frac(v.positionObject.x + v.normalObject.y + v.normalObject.x) * 0.5f - 0.3f; + v.color.b = saturate(hueVariationAmount * _HueVariation.a); +#endif + + // Adapt vertex data so we can reuse wind code. + SpeedTreeVB IN; + + UNITY_INITIALIZE_OUTPUT(SpeedTreeVB, IN); + IN.vertex = v.positionObject; + IN.normal = v.normalObject; + IN.texcoord = v.uv0; + IN.texcoord1 = v.uv1; + IN.texcoord2 = v.uv2; + IN.texcoord3 = v.uv3; + IN.color = v.color; + + OffsetSpeedTreeVertex(IN, unity_LODFade.x); + v.positionObject = IN.vertex; + + // NOTE: Down here since it hijacks uv1 to pass uv2. +#ifdef GEOM_TYPE_BRANCH_DETAIL + v.uv1.xy = v.uv2.xy; + v.color.g = v.color.a == 0 ? v.uv2.z : 2.5f; +#endif +} + +void aColorShader( + inout half4 color, + ASurface s) +{ + aStandardColorShader(color, s); +} + +void aGbufferShader( + inout AGbuffer gb, + ASurface s) +{ + +} + +#endif // ALLOY_SHADERS_TYPE_SPEED_TREE_CGINC diff --git a/Assets/Alloy/Shaders/Type/SpeedTree.cginc.meta b/Assets/Alloy/Shaders/Type/SpeedTree.cginc.meta new file mode 100644 index 0000000..bf1bbf2 --- /dev/null +++ b/Assets/Alloy/Shaders/Type/SpeedTree.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 581a94919fc5b3b419e5a53dbd64dcbe +timeCreated: 1462643414 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/Type/SpeedTreeBillboard.cginc b/Assets/Alloy/Shaders/Type/SpeedTreeBillboard.cginc new file mode 100644 index 0000000..eba49a5 --- /dev/null +++ b/Assets/Alloy/Shaders/Type/SpeedTreeBillboard.cginc @@ -0,0 +1,130 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +/////////////////////////////////////////////////////////////////////////////// +/// @file SpeedTreeBillboard.cginc +/// @brief SpeedTree Billboard shader type callbacks. +/////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_TYPE_SPEED_TREE_BILLBOARD_CGINC +#define ALLOY_SHADERS_TYPE_SPEED_TREE_BILLBOARD_CGINC + +#ifndef A_TEX_UV_OFF + #define A_TEX_UV_OFF +#endif + +#ifndef A_UV2_ON + #define A_UV2_ON +#endif + +#ifndef A_VERTEX_COLOR_IS_DATA + #define A_VERTEX_COLOR_IS_DATA +#endif + +#ifndef A_OPACITY_MASK_ON + #define A_OPACITY_MASK_ON +#endif + +#define _ALPHATEST_ON +#define ENABLE_WIND +#define SPEEDTREE_Y_UP + +#ifdef GEOM_TYPE_BRANCH_DETAIL + #define GEOM_TYPE_BRANCH +#endif + +#include "Assets/Alloy/Shaders/Framework/Type.cginc" + +#include "SpeedTreeVertex.cginc" +#include "SpeedTreeWind.cginc" + +CBUFFER_START(UnityBillboardPerCamera) + uniform float3 unity_BillboardNormal; + uniform float3 unity_BillboardTangent; + uniform float4 unity_BillboardCameraParams; + #define unity_BillboardCameraPosition (unity_BillboardCameraParams.xyz) + #define unity_BillboardCameraXZAngle (unity_BillboardCameraParams.w) +CBUFFER_END + +CBUFFER_START(UnityBillboardPerBatch) + uniform float4 unity_BillboardInfo; // x: num of billboard slices; y: 1.0f / (delta angle between slices) + uniform float4 unity_BillboardSize; // x: width; y: height; z: bottom + uniform float4 unity_BillboardImageTexCoords[16]; +CBUFFER_END + +void aVertexShader( + inout AVertex v) +{ + // assume no scaling & rotation + float4x4 o2w = unity_ObjectToWorld; + float3 worldPos = v.positionObject.xyz + float3(o2w[0].w, o2w[1].w, o2w[2].w); + +#ifdef BILLBOARD_FACE_CAMERA_POS + float3 eyeVec = normalize(unity_BillboardCameraPosition - worldPos); + float3 billboardTangent = normalize(float3(-eyeVec.z, 0, eyeVec.x)); // cross(eyeVec, {0,1,0}) + float3 billboardNormal = float3(billboardTangent.z, 0, -billboardTangent.x); // cross({0,1,0},billboardTangent) + float3 angle = atan2(billboardNormal.z, billboardNormal.x); // signed angle between billboardNormal to {0,0,1} + angle += angle < 0 ? 2 * UNITY_PI : 0; +#else + float3 billboardTangent = unity_BillboardTangent; + float3 billboardNormal = unity_BillboardNormal; + float angle = unity_BillboardCameraXZAngle; +#endif + + float widthScale = v.uv1.x; + float heightScale = v.uv1.y; + float rotation = v.uv1.z; + + float2 percent = v.uv0.xy; + float3 billboardPos = (percent.x - 0.5f) * unity_BillboardSize.x * widthScale * billboardTangent; + billboardPos.y += (percent.y * unity_BillboardSize.y + unity_BillboardSize.z) * heightScale; + +#ifdef ENABLE_WIND + if (_WindQuality * _WindEnabled > 0) + billboardPos = GlobalWind(billboardPos, worldPos, true, _ST_WindVector.xyz, v.uv1.w); +#endif + + v.positionObject.xyz += billboardPos; + v.positionObject.w = 1.0f; + v.normalObject = billboardNormal.xyz; + v.tangentObject = float4(billboardTangent.xyz, -1); + + float slices = unity_BillboardInfo.x; + float invDelta = unity_BillboardInfo.y; + angle += rotation; + + float imageIndex = fmod(floor(angle * invDelta + 0.5f), slices); + float4 imageTexCoords = unity_BillboardImageTexCoords[imageIndex]; + + if (imageTexCoords.w < 0) { + v.uv0.xy = imageTexCoords.xy - imageTexCoords.zw * percent.yx; + } + else { + v.uv0.xy = imageTexCoords.xy + imageTexCoords.zw * percent; + } + +#ifdef EFFECT_HUE_VARIATION + float hueVariationAmount = frac(worldPos.x + worldPos.y + worldPos.z); + v.color.b = saturate(hueVariationAmount * _HueVariation.a); +#endif + + // AO isn't used by this shader type, but give it a default. + v.color.r = 1.0h; +} + +void aColorShader( + inout half4 color, + ASurface s) +{ + aStandardColorShader(color, s); +} + +void aGbufferShader( + inout AGbuffer gb, + ASurface s) +{ + +} + +#endif // ALLOY_SHADERS_TYPE_SPEED_TREE_BILLBOARD_CGINC diff --git a/Assets/Alloy/Shaders/Type/SpeedTreeBillboard.cginc.meta b/Assets/Alloy/Shaders/Type/SpeedTreeBillboard.cginc.meta new file mode 100644 index 0000000..4ea28dc --- /dev/null +++ b/Assets/Alloy/Shaders/Type/SpeedTreeBillboard.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 82c5cefe0fbdc134aad72ec7e8ab3f26 +timeCreated: 1462650692 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/Type/Standard.cginc b/Assets/Alloy/Shaders/Type/Standard.cginc new file mode 100644 index 0000000..2b3e24c --- /dev/null +++ b/Assets/Alloy/Shaders/Type/Standard.cginc @@ -0,0 +1,35 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +/////////////////////////////////////////////////////////////////////////////// +/// @file Standard.cginc +/// @brief Standard shader type callbacks. +/////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_TYPE_STANDARD_CGINC +#define ALLOY_SHADERS_TYPE_STANDARD_CGINC + +#include "Assets/Alloy/Shaders/Framework/Type.cginc" + +void aVertexShader( + inout AVertex v) +{ + aStandardVertexShader(v); +} + +void aColorShader( + inout half4 color, + ASurface s) +{ + aStandardColorShader(color, s); +} + +void aGbufferShader( + inout AGbuffer gb, + ASurface s) +{ + +} + +#endif // ALLOY_SHADERS_TYPE_STANDARD_CGINC diff --git a/Assets/Alloy/Shaders/Type/Standard.cginc.meta b/Assets/Alloy/Shaders/Type/Standard.cginc.meta new file mode 100644 index 0000000..c2760ff --- /dev/null +++ b/Assets/Alloy/Shaders/Type/Standard.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 79c54eb9a7b61f0409a9ec90abd9e9ed +timeCreated: 1462627013 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/Type/Terrain.cginc b/Assets/Alloy/Shaders/Type/Terrain.cginc new file mode 100644 index 0000000..cd28187 --- /dev/null +++ b/Assets/Alloy/Shaders/Type/Terrain.cginc @@ -0,0 +1,67 @@ +// Alloy Physical Shader Framework +// Copyright 2013-2017 RUST LLC. +// http://www.alloy.rustltd.com/ + +/////////////////////////////////////////////////////////////////////////////// +/// @file Terrain.cginc +/// @brief Terrain shader type callbacks. +/////////////////////////////////////////////////////////////////////////////// + +#ifndef ALLOY_SHADERS_TYPE_TERRAIN_CGINC +#define ALLOY_SHADERS_TYPE_TERRAIN_CGINC + +#ifndef A_TEX_UV_OFF + #define A_TEX_UV_OFF +#endif + +#ifndef A_TEX_SCROLL_OFF + #define A_TEX_SCROLL_OFF +#endif + +#ifndef A_VERTEX_COLOR_IS_DATA + #define A_VERTEX_COLOR_IS_DATA +#endif + +#include "Assets/Alloy/Shaders/Framework/Type.cginc" + +void aVertexShader( + inout AVertex v) +{ + v.tangentObject.xyz = cross(v.normalObject, A_AXIS_Z); + v.tangentObject.w = -1.0f; +} + +void aColorShader( + inout half4 color, + ASurface s) +{ +#ifndef A_TERRAIN_NSPLAT_SHADER + aStandardColorShader(color, s); +#else + color *= s.opacity; + + #ifndef A_TERRAIN_NSPLAT_ADDPASS_SHADER + aStandardColorShader(color, s); + #else + aVolumetricAdd(color, s); + #endif +#endif +} + +void aGbufferShader( + inout AGbuffer gb, + ASurface s) +{ +#ifdef A_TERRAIN_NSPLAT_SHADER + gb.diffuseOcclusion *= s.opacity; + gb.specularSmoothness *= s.opacity; + gb.normalType *= s.opacity; + gb.emissionSubsurface *= s.opacity; + + #ifdef A_SHADOW_MASKS_BUFFER_ON + gb.shadowMasks *= s.opacity; + #endif +#endif +} + +#endif // ALLOY_SHADERS_TYPE_TERRAIN_CGINC diff --git a/Assets/Alloy/Shaders/Type/Terrain.cginc.meta b/Assets/Alloy/Shaders/Type/Terrain.cginc.meta new file mode 100644 index 0000000..0eb3ac4 --- /dev/null +++ b/Assets/Alloy/Shaders/Type/Terrain.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 0cd644aefd669454b9fabdb19036d21b +timeCreated: 1462630710 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/Unity.meta b/Assets/Alloy/Shaders/Unity.meta new file mode 100644 index 0000000..9477c85 --- /dev/null +++ b/Assets/Alloy/Shaders/Unity.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: cff767cf9dde16044a8d15744cca5517 +folderAsset: yes +timeCreated: 1434398775 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/Unity/AutoLight.cginc b/Assets/Alloy/Shaders/Unity/AutoLight.cginc new file mode 100644 index 0000000..629db4b --- /dev/null +++ b/Assets/Alloy/Shaders/Unity/AutoLight.cginc @@ -0,0 +1,244 @@ +// Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt) + +#ifndef AUTOLIGHT_INCLUDED +#define AUTOLIGHT_INCLUDED + +#include "HLSLSupport.cginc" +#include "UnityShadowLibrary.cginc" + +#define unityShadowCoord float +#define unityShadowCoord2 float2 +#define unityShadowCoord3 float3 +#define unityShadowCoord4 float4 +#define unityShadowCoord4x4 float4x4 + +// ---------------- +// Shadow helpers +// ---------------- + +// If none of the keywords are defined, assume directional? +#if !defined(POINT) && !defined(SPOT) && !defined(DIRECTIONAL) && !defined(POINT_COOKIE) && !defined(DIRECTIONAL_COOKIE) + #define DIRECTIONAL +#endif + +// ---- Screen space direction light shadows helpers (any version) +#if defined (SHADOWS_SCREEN) + + #if defined(UNITY_NO_SCREENSPACE_SHADOWS) + UNITY_DECLARE_SHADOWMAP(_ShadowMapTexture); + #define TRANSFER_SHADOW(a) a._ShadowCoord = mul( unity_WorldToShadow[0], mul( unity_ObjectToWorld, v.vertex ) ); + inline fixed unitySampleShadow (unityShadowCoord4 shadowCoord) + { + #if defined(SHADOWS_NATIVE) + fixed shadow = UNITY_SAMPLE_SHADOW(_ShadowMapTexture, shadowCoord.xyz); + shadow = _LightShadowData.r + shadow * (1-_LightShadowData.r); + return shadow; + #else + unityShadowCoord dist = SAMPLE_DEPTH_TEXTURE(_ShadowMapTexture, shadowCoord.xy); + // tegra is confused if we use_LightShadowData.x directly + // with "ambiguous overloaded function reference max(mediump float, float)" + unityShadowCoord lightShadowDataX = _LightShadowData.x; + unityShadowCoord threshold = shadowCoord.z; + return max(dist > threshold, lightShadowDataX); + #endif + } + + #else // UNITY_NO_SCREENSPACE_SHADOWS + UNITY_DECLARE_SCREENSPACE_SHADOWMAP(_ShadowMapTexture); + #define TRANSFER_SHADOW(a) a._ShadowCoord = ComputeScreenPos(a.pos); + inline fixed unitySampleShadow (unityShadowCoord4 shadowCoord) + { + fixed shadow = UNITY_SAMPLE_SCREEN_SHADOW(_ShadowMapTexture, shadowCoord); + return shadow; + } + + #endif + + #define SHADOW_COORDS(idx1) unityShadowCoord4 _ShadowCoord : TEXCOORD##idx1; + #define SHADOW_ATTENUATION(a) unitySampleShadow(a._ShadowCoord) +#endif + +// ----------------------------- +// Shadow helpers (5.6+ version) +// ----------------------------- +// This version depends on having worldPos available in the fragment shader and using that to compute light coordinates. +// if also supports ShadowMask (separately baked shadows for lightmapped objects) + +half UnityComputeForwardShadows(float2 lightmapUV, float3 worldPos, float4 screenPos) +{ + //fade value + float zDist = dot(_WorldSpaceCameraPos - worldPos, UNITY_MATRIX_V[2].xyz); + float fadeDist = UnityComputeShadowFadeDistance(worldPos, zDist); + half realtimeToBakedShadowFade = UnityComputeShadowFade(fadeDist); + + //baked occlusion if any + half shadowMaskAttenuation = UnitySampleBakedOcclusion(lightmapUV, worldPos); + + half realtimeShadowAttenuation = 1.0f; + //directional realtime shadow + #if defined (SHADOWS_SCREEN) + #if defined(UNITY_NO_SCREENSPACE_SHADOWS) + realtimeShadowAttenuation = unitySampleShadow(mul(unity_WorldToShadow[0], unityShadowCoord4(worldPos, 1))); + #else + //Only reached when LIGHTMAP_ON is NOT defined (and thus we use interpolator for screenPos rather than lightmap UVs). See HANDLE_SHADOWS_BLENDING_IN_GI below. + realtimeShadowAttenuation = unitySampleShadow(screenPos); + #endif + #endif + + #if defined(UNITY_FAST_COHERENT_DYNAMIC_BRANCHING) && defined(SHADOWS_SOFT) && !defined(LIGHTMAP_SHADOW_MIXING) + //avoid expensive shadows fetches in the distance where coherency will be good + UNITY_BRANCH + if (realtimeToBakedShadowFade < (1.0f - 1e-2f)) + { + #endif + + //spot realtime shadow + #if (defined (SHADOWS_DEPTH) && defined (SPOT)) + unityShadowCoord4 spotShadowCoord = mul(unity_WorldToShadow[0], unityShadowCoord4(worldPos, 1)); + realtimeShadowAttenuation = UnitySampleShadowmap(spotShadowCoord); + #endif + + //point realtime shadow + #if defined (SHADOWS_CUBE) + realtimeShadowAttenuation = UnitySampleShadowmap(worldPos - _LightPositionRange.xyz); + #endif + + #if defined(UNITY_FAST_COHERENT_DYNAMIC_BRANCHING) && defined(SHADOWS_SOFT) && !defined(LIGHTMAP_SHADOW_MIXING) + } + #endif + + return UnityMixRealtimeAndBakedShadows(realtimeShadowAttenuation, shadowMaskAttenuation, realtimeToBakedShadowFade); +} + +#if defined(HANDLE_SHADOWS_BLENDING_IN_GI) // handles shadows in the depths of the GI function for performance reasons +# define UNITY_SHADOW_COORDS(idx1) SHADOW_COORDS(idx1) +# define UNITY_TRANSFER_SHADOW(a, coord) TRANSFER_SHADOW(a) +# define UNITY_SHADOW_ATTENUATION(a, worldPos) SHADOW_ATTENUATION(a) +#elif defined(SHADOWS_SCREEN) && !defined(LIGHTMAP_ON) && !defined(UNITY_NO_SCREENSPACE_SHADOWS) // no lightmap uv thus store screenPos instead +# define UNITY_SHADOW_COORDS(idx1) SHADOW_COORDS(idx1) +# define UNITY_TRANSFER_SHADOW(a, coord) TRANSFER_SHADOW(a) +# define UNITY_SHADOW_ATTENUATION(a, worldPos) UnityComputeForwardShadows(0, worldPos, a._ShadowCoord) +#else +# define UNITY_SHADOW_COORDS(idx1) unityShadowCoord2 _ShadowCoord : TEXCOORD##idx1; +# if defined(SHADOWS_SHADOWMASK) +# define UNITY_TRANSFER_SHADOW(a, coord) a._ShadowCoord = coord * unity_LightmapST.xy + unity_LightmapST.zw; +# if (defined(SHADOWS_DEPTH) || defined(SHADOWS_SCREEN) || defined(SHADOWS_CUBE) || UNITY_LIGHT_PROBE_PROXY_VOLUME) +# define UNITY_SHADOW_ATTENUATION(a, worldPos) UnityComputeForwardShadows(a._ShadowCoord, worldPos, 0) +# else +# define UNITY_SHADOW_ATTENUATION(a, worldPos) UnityComputeForwardShadows(a._ShadowCoord, 0, 0) +# endif +# else +# define UNITY_TRANSFER_SHADOW(a, coord) +# if (defined(SHADOWS_DEPTH) || defined(SHADOWS_SCREEN) || defined(SHADOWS_CUBE)) +# define UNITY_SHADOW_ATTENUATION(a, worldPos) UnityComputeForwardShadows(0, worldPos, 0) +# else + #if UNITY_LIGHT_PROBE_PROXY_VOLUME +# define UNITY_SHADOW_ATTENUATION(a, worldPos) UnityComputeForwardShadows(0, worldPos, 0) + #else +# define UNITY_SHADOW_ATTENUATION(a, worldPos) UnityComputeForwardShadows(0, 0, 0) + #endif +# endif +# endif +#endif + +// Alloy +// NOTE: Output shadow for forward base pass SHADOWS_SCREEN lightmaps. +#define A_LIGHT_ATTENUATION(destName, input, worldPos) fixed destName = UNITY_SHADOW_ATTENUATION(input, worldPos); o.PositionWorld = worldPos; o.Shadow = destName; + +#ifdef POINT +sampler2D _LightTexture0; +unityShadowCoord4x4 unity_WorldToLight; +#define UNITY_LIGHT_ATTENUATION(destName, input, worldPos) A_LIGHT_ATTENUATION(destName, input, worldPos) +#endif + +#ifdef SPOT +sampler2D _LightTexture0; +unityShadowCoord4x4 unity_WorldToLight; +sampler2D _LightTextureB0; +inline fixed UnitySpotCookie(unityShadowCoord4 LightCoord) +{ + return tex2D(_LightTexture0, LightCoord.xy / LightCoord.w + 0.5).w; +} +inline fixed UnitySpotAttenuate(unityShadowCoord3 LightCoord) +{ + return tex2D(_LightTextureB0, dot(LightCoord, LightCoord).xx).UNITY_ATTEN_CHANNEL; +} +#define UNITY_LIGHT_ATTENUATION(destName, input, worldPos) A_LIGHT_ATTENUATION(destName, input, worldPos) +#endif + +#ifdef DIRECTIONAL + #define UNITY_LIGHT_ATTENUATION(destName, input, worldPos) A_LIGHT_ATTENUATION(destName, input, worldPos) +#endif + +#ifdef POINT_COOKIE +samplerCUBE _LightTexture0; +unityShadowCoord4x4 unity_WorldToLight; +sampler2D _LightTextureB0; +#define UNITY_LIGHT_ATTENUATION(destName, input, worldPos) A_LIGHT_ATTENUATION(destName, input, worldPos) +#endif + +#ifdef DIRECTIONAL_COOKIE +sampler2D _LightTexture0; +unityShadowCoord4x4 unity_WorldToLight; +#define UNITY_LIGHT_ATTENUATION(destName, input, worldPos) A_LIGHT_ATTENUATION(destName, input, worldPos) +#endif + + +// ----------------------------- +// Light/Shadow helpers (4.x version) +// ----------------------------- +// This version computes light coordinates in the vertex shader and passes them to the fragment shader. + +// ---- Spot light shadows +#if defined (SHADOWS_DEPTH) && defined (SPOT) +#define SHADOW_COORDS(idx1) unityShadowCoord4 _ShadowCoord : TEXCOORD##idx1; +#define TRANSFER_SHADOW(a) a._ShadowCoord = mul (unity_WorldToShadow[0], mul(unity_ObjectToWorld,v.vertex)); +#define SHADOW_ATTENUATION(a) UnitySampleShadowmap(a._ShadowCoord) +#endif + +// ---- Point light shadows +#if defined (SHADOWS_CUBE) +#define SHADOW_COORDS(idx1) unityShadowCoord3 _ShadowCoord : TEXCOORD##idx1; +#define TRANSFER_SHADOW(a) a._ShadowCoord = mul(unity_ObjectToWorld, v.vertex).xyz - _LightPositionRange.xyz; +#define SHADOW_ATTENUATION(a) UnitySampleShadowmap(a._ShadowCoord) +#endif + +// ---- Shadows off +#if !defined (SHADOWS_SCREEN) && !defined (SHADOWS_DEPTH) && !defined (SHADOWS_CUBE) +#define SHADOW_COORDS(idx1) +#define TRANSFER_SHADOW(a) +#define SHADOW_ATTENUATION(a) 1.0 +#endif + +#ifdef POINT +#define LIGHTING_COORDS(idx1,idx2) unityShadowCoord3 _LightCoord : TEXCOORD##idx1; SHADOW_COORDS(idx2) +#define TRANSFER_VERTEX_TO_FRAGMENT(a) a._LightCoord = mul(unity_WorldToLight, mul(unity_ObjectToWorld, v.vertex)).xyz; TRANSFER_SHADOW(a) +#define LIGHT_ATTENUATION(a) (tex2D(_LightTexture0, dot(a._LightCoord,a._LightCoord).rr).UNITY_ATTEN_CHANNEL * SHADOW_ATTENUATION(a)) +#endif + +#ifdef SPOT +#define LIGHTING_COORDS(idx1,idx2) unityShadowCoord4 _LightCoord : TEXCOORD##idx1; SHADOW_COORDS(idx2) +#define TRANSFER_VERTEX_TO_FRAGMENT(a) a._LightCoord = mul(unity_WorldToLight, mul(unity_ObjectToWorld, v.vertex)); TRANSFER_SHADOW(a) +#define LIGHT_ATTENUATION(a) ( (a._LightCoord.z > 0) * UnitySpotCookie(a._LightCoord) * UnitySpotAttenuate(a._LightCoord.xyz) * SHADOW_ATTENUATION(a) ) +#endif + +#ifdef DIRECTIONAL + #define LIGHTING_COORDS(idx1,idx2) SHADOW_COORDS(idx1) + #define TRANSFER_VERTEX_TO_FRAGMENT(a) TRANSFER_SHADOW(a) + #define LIGHT_ATTENUATION(a) SHADOW_ATTENUATION(a) +#endif + +#ifdef POINT_COOKIE +#define LIGHTING_COORDS(idx1,idx2) unityShadowCoord3 _LightCoord : TEXCOORD##idx1; SHADOW_COORDS(idx2) +#define TRANSFER_VERTEX_TO_FRAGMENT(a) a._LightCoord = mul(unity_WorldToLight, mul(unity_ObjectToWorld, v.vertex)).xyz; TRANSFER_SHADOW(a) +#define LIGHT_ATTENUATION(a) (tex2D(_LightTextureB0, dot(a._LightCoord,a._LightCoord).rr).UNITY_ATTEN_CHANNEL * texCUBE(_LightTexture0, a._LightCoord).w * SHADOW_ATTENUATION(a)) +#endif + +#ifdef DIRECTIONAL_COOKIE +#define LIGHTING_COORDS(idx1,idx2) unityShadowCoord2 _LightCoord : TEXCOORD##idx1; SHADOW_COORDS(idx2) +#define TRANSFER_VERTEX_TO_FRAGMENT(a) a._LightCoord = mul(unity_WorldToLight, mul(unity_ObjectToWorld, v.vertex)).xy; TRANSFER_SHADOW(a) +#define LIGHT_ATTENUATION(a) (tex2D(_LightTexture0, a._LightCoord).w * SHADOW_ATTENUATION(a)) +#endif + + +#endif diff --git a/Assets/Alloy/Shaders/Unity/AutoLight.cginc.meta b/Assets/Alloy/Shaders/Unity/AutoLight.cginc.meta new file mode 100644 index 0000000..0c8beab --- /dev/null +++ b/Assets/Alloy/Shaders/Unity/AutoLight.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 7c3796affbfb7ee4ba5801737958249b +timeCreated: 1433979826 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/Unity/UnityCG.cginc b/Assets/Alloy/Shaders/Unity/UnityCG.cginc new file mode 100644 index 0000000..e867d4a --- /dev/null +++ b/Assets/Alloy/Shaders/Unity/UnityCG.cginc @@ -0,0 +1,1071 @@ +// Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt) + +#ifndef UNITY_CG_INCLUDED +#define UNITY_CG_INCLUDED + +#define UNITY_PI 3.14159265359f +#define UNITY_TWO_PI 6.28318530718f +#define UNITY_FOUR_PI 12.56637061436f +#define UNITY_INV_PI 0.31830988618f +#define UNITY_INV_TWO_PI 0.15915494309f +#define UNITY_INV_FOUR_PI 0.07957747155f +#define UNITY_HALF_PI 1.57079632679f +#define UNITY_INV_HALF_PI 0.636619772367f + +#include "Assets/Alloy/Shaders/Framework/Utility.cginc" + +#include "UnityShaderVariables.cginc" +#include "UnityShaderUtilities.cginc" +#include "UnityInstancing.cginc" + +#ifdef UNITY_COLORSPACE_GAMMA +#define unity_ColorSpaceGrey fixed4(0.5, 0.5, 0.5, 0.5) +#define unity_ColorSpaceDouble fixed4(2.0, 2.0, 2.0, 2.0) +#define unity_ColorSpaceDielectricSpec half4(0.220916301, 0.220916301, 0.220916301, 1.0 - 0.220916301) +#define unity_ColorSpaceLuminance half4(0.22, 0.707, 0.071, 0.0) // Legacy: alpha is set to 0.0 to specify gamma mode +#else // Linear values +#define unity_ColorSpaceGrey fixed4(0.214041144, 0.214041144, 0.214041144, 0.5) +#define unity_ColorSpaceDouble fixed4(4.59479380, 4.59479380, 4.59479380, 2.0) +#define unity_ColorSpaceDielectricSpec half4(0.04, 0.04, 0.04, 1.0 - 0.04) // standard dielectric reflectivity coef at incident angle (= 4%) +#define unity_ColorSpaceLuminance half4(0.0396819152, 0.458021790, 0.00609653955, 1.0) // Legacy: alpha is set to 1.0 to specify linear mode +#endif + +// ------------------------------------------------------------------- +// helper functions and macros used in many standard shaders + + +#if defined (DIRECTIONAL) || defined (DIRECTIONAL_COOKIE) || defined (POINT) || defined (SPOT) || defined (POINT_NOATT) || defined (POINT_COOKIE) +#define USING_LIGHT_MULTI_COMPILE +#endif + +#define SCALED_NORMAL v.normal + + +// These constants must be kept in sync with RGBMRanges.h +#define LIGHTMAP_RGBM_SCALE 5.0 +#define EMISSIVE_RGBM_SCALE 97.0 + +// Should SH (light probe / ambient) calculations be performed? +// - Presence of *either* of static or dynamic lightmaps means that diffuse indirect ambient is already in them, so no need for SH. +// - Passes that don't do ambient (additive, shadowcaster etc.) should not do SH either. +#define UNITY_SHOULD_SAMPLE_SH (!defined(LIGHTMAP_ON) && !defined(DYNAMICLIGHTMAP_ON) && !defined(UNITY_PASS_FORWARDADD) && !defined(UNITY_PASS_PREPASSBASE) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(UNITY_PASS_META)) + +struct appdata_base { + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 texcoord : TEXCOORD0; + UNITY_VERTEX_INPUT_INSTANCE_ID +}; + +struct appdata_tan { + float4 vertex : POSITION; + float4 tangent : TANGENT; + float3 normal : NORMAL; + float4 texcoord : TEXCOORD0; + UNITY_VERTEX_INPUT_INSTANCE_ID +}; + +struct appdata_full { + float4 vertex : POSITION; + float4 tangent : TANGENT; + float3 normal : NORMAL; + float4 texcoord : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + float4 texcoord3 : TEXCOORD3; + fixed4 color : COLOR; + UNITY_VERTEX_INPUT_INSTANCE_ID +}; + +// Legacy for compatibility with existing shaders +inline bool IsGammaSpace() +{ + #ifdef UNITY_COLORSPACE_GAMMA + return true; + #else + return false; + #endif +} + +inline float GammaToLinearSpaceExact (float value) +{ + if (value <= 0.04045F) + return value / 12.92F; + else if (value < 1.0F) + return pow((value + 0.055F)/1.055F, 2.4F); + else + return pow(value, 2.2F); +} + +inline half3 GammaToLinearSpace (half3 sRGB) +{ + // Approximate version from http://chilliant.blogspot.com.au/2012/08/srgb-approximations-for-hlsl.html?m=1 + return sRGB * (sRGB * (sRGB * 0.305306011h + 0.682171111h) + 0.012522878h); + + // Precise version, useful for debugging. + //return half3(GammaToLinearSpaceExact(sRGB.r), GammaToLinearSpaceExact(sRGB.g), GammaToLinearSpaceExact(sRGB.b)); +} + +inline float LinearToGammaSpaceExact (float value) +{ + if (value <= 0.0F) + return 0.0F; + else if (value <= 0.0031308F) + return 12.92F * value; + else if (value < 1.0F) + return 1.055F * pow(value, 0.4166667F) - 0.055F; + else + return pow(value, 0.45454545F); +} + +inline half3 LinearToGammaSpace (half3 linRGB) +{ + linRGB = max(linRGB, half3(0.h, 0.h, 0.h)); + // An almost-perfect approximation from http://chilliant.blogspot.com.au/2012/08/srgb-approximations-for-hlsl.html?m=1 + return max(1.055h * pow(linRGB, 0.416666667h) - 0.055h, 0.h); + + // Exact version, useful for debugging. + //return half3(LinearToGammaSpaceExact(linRGB.r), LinearToGammaSpaceExact(linRGB.g), LinearToGammaSpaceExact(linRGB.b)); +} + +// Tranforms position from world to homogenous space +inline float4 UnityWorldToClipPos( in float3 pos ) +{ + return mul(UNITY_MATRIX_VP, float4(pos, 1.0)); +} + +// Tranforms position from view to homogenous space +inline float4 UnityViewToClipPos( in float3 pos ) +{ + return mul(UNITY_MATRIX_P, float4(pos, 1.0)); +} + +// Tranforms position from object to camera space +inline float3 UnityObjectToViewPos( in float3 pos ) +{ + return mul(UNITY_MATRIX_V, mul(unity_ObjectToWorld, float4(pos, 1.0))).xyz; +} +inline float3 UnityObjectToViewPos(float4 pos) // overload for float4; avoids "implicit truncation" warning for existing shaders +{ + return UnityObjectToViewPos(pos.xyz); +} + +// Tranforms position from world to camera space +inline float3 UnityWorldToViewPos( in float3 pos ) +{ + return mul(UNITY_MATRIX_V, float4(pos, 1.0)).xyz; +} + +// Transforms direction from object to world space +inline float3 UnityObjectToWorldDir( in float3 dir ) +{ + return normalize(mul((float3x3)unity_ObjectToWorld, dir)); +} + +// Transforms direction from world to object space +inline float3 UnityWorldToObjectDir( in float3 dir ) +{ + return normalize(mul((float3x3)unity_WorldToObject, dir)); +} + +// Transforms normal from object to world space +inline float3 UnityObjectToWorldNormal( in float3 norm ) +{ +#ifdef UNITY_ASSUME_UNIFORM_SCALING + return UnityObjectToWorldDir(norm); +#else + // mul(IT_M, norm) => mul(norm, I_M) => {dot(norm, I_M.col0), dot(norm, I_M.col1), dot(norm, I_M.col2)} + return normalize(mul(norm, (float3x3)unity_WorldToObject)); +#endif +} + +// Computes world space light direction, from world space position +inline float3 UnityWorldSpaceLightDir( in float3 worldPos ) +{ + #ifndef USING_LIGHT_MULTI_COMPILE + return _WorldSpaceLightPos0.xyz - worldPos * _WorldSpaceLightPos0.w; + #else + #ifndef USING_DIRECTIONAL_LIGHT + return _WorldSpaceLightPos0.xyz - worldPos; + #else + return _WorldSpaceLightPos0.xyz; + #endif + #endif +} + +// Computes world space light direction, from object space position +// *Legacy* Please use UnityWorldSpaceLightDir instead +inline float3 WorldSpaceLightDir( in float4 localPos ) +{ + float3 worldPos = mul(unity_ObjectToWorld, localPos).xyz; + return UnityWorldSpaceLightDir(worldPos); +} + +// Computes object space light direction +inline float3 ObjSpaceLightDir( in float4 v ) +{ + float3 objSpaceLightPos = mul(unity_WorldToObject, _WorldSpaceLightPos0).xyz; + #ifndef USING_LIGHT_MULTI_COMPILE + return objSpaceLightPos.xyz - v.xyz * _WorldSpaceLightPos0.w; + #else + #ifndef USING_DIRECTIONAL_LIGHT + return objSpaceLightPos.xyz - v.xyz; + #else + return objSpaceLightPos.xyz; + #endif + #endif +} + +// Computes world space view direction, from object space position +inline float3 UnityWorldSpaceViewDir( in float3 worldPos ) +{ + return _WorldSpaceCameraPos.xyz - worldPos; +} + +// Computes world space view direction, from object space position +// *Legacy* Please use UnityWorldSpaceViewDir instead +inline float3 WorldSpaceViewDir( in float4 localPos ) +{ + float3 worldPos = mul(unity_ObjectToWorld, localPos).xyz; + return UnityWorldSpaceViewDir(worldPos); +} + +// Computes object space view direction +inline float3 ObjSpaceViewDir( in float4 v ) +{ + float3 objSpaceCameraPos = mul(unity_WorldToObject, float4(_WorldSpaceCameraPos.xyz, 1)).xyz; + return objSpaceCameraPos - v.xyz; +} + +// Declares 3x3 matrix 'rotation', filled with tangent space basis +#define TANGENT_SPACE_ROTATION \ + float3 binormal = cross( normalize(v.normal), normalize(v.tangent.xyz) ) * v.tangent.w; \ + float3x3 rotation = float3x3( v.tangent.xyz, binormal, v.normal ) + + + +// Used in ForwardBase pass: Calculates diffuse lighting from 4 point lights, with data packed in a special way. +float3 Shade4PointLights ( + float4 lightPosX, float4 lightPosY, float4 lightPosZ, + float3 lightColor0, float3 lightColor1, float3 lightColor2, float3 lightColor3, + float4 lightAttenSq, + float3 pos, float3 normal) +{ + // Alloy. + return aShade4PointLights( + lightPosX, lightPosY, lightPosZ, + lightColor0, lightColor1, lightColor2, lightColor3, + lightAttenSq, + pos, normal); +} + +// Used in Vertex pass: Calculates diffuse lighting from lightCount lights. Specifying true to spotLight is more expensive +// to calculate but lights are treated as spot lights otherwise they are treated as point lights. +float3 ShadeVertexLightsFull (float4 vertex, float3 normal, int lightCount, bool spotLight) +{ + float3 viewpos = UnityObjectToViewPos (vertex); + float3 viewN = normalize (mul ((float3x3)UNITY_MATRIX_IT_MV, normal)); + + float3 lightColor = UNITY_LIGHTMODEL_AMBIENT.xyz; + for (int i = 0; i < lightCount; i++) { + float3 toLight = unity_LightPosition[i].xyz - viewpos.xyz * unity_LightPosition[i].w; + float lengthSq = dot(toLight, toLight); + + // don't produce NaNs if some vertex position overlaps with the light + lengthSq = max(lengthSq, 0.000001); + + toLight *= rsqrt(lengthSq); + + float atten = 1.0 / (1.0 + lengthSq * unity_LightAtten[i].z); + if (spotLight) + { + float rho = max (0, dot(toLight, unity_SpotDirection[i].xyz)); + float spotAtt = (rho - unity_LightAtten[i].x) * unity_LightAtten[i].y; + atten *= saturate(spotAtt); + } + + float diff = max (0, dot (viewN, toLight)); + lightColor += unity_LightColor[i].rgb * (diff * atten); + } + return lightColor; +} + +float3 ShadeVertexLights (float4 vertex, float3 normal) +{ + return ShadeVertexLightsFull (vertex, normal, 4, false); +} + +// normal should be normalized, w=1.0 +half3 SHEvalLinearL0L1 (half4 normal) +{ + half3 x; + + // Linear (L1) + constant (L0) polynomial terms + x.r = dot(unity_SHAr,normal); + x.g = dot(unity_SHAg,normal); + x.b = dot(unity_SHAb,normal); + + return x; +} + +// normal should be normalized, w=1.0 +half3 SHEvalLinearL2 (half4 normal) +{ + half3 x1, x2; + // 4 of the quadratic (L2) polynomials + half4 vB = normal.xyzz * normal.yzzx; + x1.r = dot(unity_SHBr,vB); + x1.g = dot(unity_SHBg,vB); + x1.b = dot(unity_SHBb,vB); + + // Final (5th) quadratic (L2) polynomial + half vC = normal.x*normal.x - normal.y*normal.y; + x2 = unity_SHC.rgb * vC; + + return x1 + x2; +} + +// normal should be normalized, w=1.0 +// output in active color space +half3 ShadeSH9 (half4 normal) +{ + // Linear + constant polynomial terms + half3 res = SHEvalLinearL0L1 (normal); + + // Quadratic polynomials + res += SHEvalLinearL2 (normal); + +# ifdef UNITY_COLORSPACE_GAMMA + res = LinearToGammaSpace (res); +# endif + + return res; +} + +// OBSOLETE: for backwards compatibility with 5.0 +half3 ShadeSH3Order(half4 normal) +{ + // Quadratic polynomials + half3 res = SHEvalLinearL2 (normal); + +# ifdef UNITY_COLORSPACE_GAMMA + res = LinearToGammaSpace (res); +# endif + + return res; +} + +#if UNITY_LIGHT_PROBE_PROXY_VOLUME + +// normal should be normalized, w=1.0 +half3 SHEvalLinearL0L1_SampleProbeVolume (half4 normal, float3 worldPos) +{ + const float transformToLocal = unity_ProbeVolumeParams.y; + const float texelSizeX = unity_ProbeVolumeParams.z; + + //The SH coefficients textures and probe occlusion are packed into 1 atlas. + //------------------------- + //| ShR | ShG | ShB | Occ | + //------------------------- + + float3 position = (transformToLocal == 1.0f) ? mul(unity_ProbeVolumeWorldToObject, float4(worldPos, 1.0)).xyz : worldPos; + float3 texCoord = (position - unity_ProbeVolumeMin.xyz) * unity_ProbeVolumeSizeInv.xyz; + texCoord.x = texCoord.x * 0.25f; + + // We need to compute proper X coordinate to sample. + // Clamp the coordinate otherwize we'll have leaking between RGB coefficients + float texCoordX = clamp(texCoord.x, 0.5f * texelSizeX, 0.25f - 0.5f * texelSizeX); + + // sampler state comes from SHr (all SH textures share the same sampler) + texCoord.x = texCoordX; + half4 SHAr = UNITY_SAMPLE_TEX3D_SAMPLER(unity_ProbeVolumeSH, unity_ProbeVolumeSH, texCoord); + + texCoord.x = texCoordX + 0.25f; + half4 SHAg = UNITY_SAMPLE_TEX3D_SAMPLER(unity_ProbeVolumeSH, unity_ProbeVolumeSH, texCoord); + + texCoord.x = texCoordX + 0.5f; + half4 SHAb = UNITY_SAMPLE_TEX3D_SAMPLER(unity_ProbeVolumeSH, unity_ProbeVolumeSH, texCoord); + + // Linear + constant polynomial terms + half3 x1; + x1.r = dot(SHAr, normal); + x1.g = dot(SHAg, normal); + x1.b = dot(SHAb, normal); + + return x1; +} +#endif + +// normal should be normalized, w=1.0 +half3 ShadeSH12Order (half4 normal) +{ + // Linear + constant polynomial terms + half3 res = SHEvalLinearL0L1 (normal); + +# ifdef UNITY_COLORSPACE_GAMMA + res = LinearToGammaSpace (res); +# endif + + return res; +} + +// Transforms 2D UV by scale/bias property +#define TRANSFORM_TEX(tex,name) (tex.xy * name##_ST.xy + name##_ST.zw) + +// Deprecated. Used to transform 4D UV by a fixed function texture matrix. Now just returns the passed UV. +#define TRANSFORM_UV(idx) v.texcoord.xy + + + +struct v2f_vertex_lit { + float2 uv : TEXCOORD0; + fixed4 diff : COLOR0; + fixed4 spec : COLOR1; +}; + +inline fixed4 VertexLight( v2f_vertex_lit i, sampler2D mainTex ) +{ + fixed4 texcol = tex2D( mainTex, i.uv ); + fixed4 c; + c.xyz = ( texcol.xyz * i.diff.xyz + i.spec.xyz * texcol.a ); + c.w = texcol.w * i.diff.w; + return c; +} + + +// Calculates UV offset for parallax bump mapping +inline float2 ParallaxOffset( half h, half height, half3 viewDir ) +{ + h = h * height - height/2.0; + float3 v = normalize(viewDir); + v.z += 0.42; + return h * (v.xy / v.z); +} + +// Converts color to luminance (grayscale) +inline half Luminance(half3 rgb) +{ + return dot(rgb, unity_ColorSpaceLuminance.rgb); +} + +// Convert rgb to luminance +// with rgb in linear space with sRGB primaries and D65 white point +half LinearRgbToLuminance(half3 linearRgb) +{ + return dot(linearRgb, half3(0.2126729f, 0.7151522f, 0.0721750f)); +} + +half4 UnityEncodeRGBM (half3 color, float maxRGBM) +{ + float kOneOverRGBMMaxRange = 1.0 / maxRGBM; + const float kMinMultiplier = 2.0 * 1e-2; + + float3 rgb = color * kOneOverRGBMMaxRange; + float alpha = max(max(rgb.r, rgb.g), max(rgb.b, kMinMultiplier)); + alpha = ceil(alpha * 255.0) / 255.0; + + // Division-by-zero warning from d3d9, so make compiler happy. + alpha = max(alpha, kMinMultiplier); + + return half4(rgb / alpha, alpha); +} + +// Decodes HDR textures +// handles dLDR, RGBM formats +inline half3 DecodeHDR (half4 data, half4 decodeInstructions) +{ + // Take into account texture alpha if decodeInstructions.w is true(the alpha value affects the RGB channels) + half alpha = decodeInstructions.w * (data.a - 1.0) + 1.0; + + // If Linear mode is not supported we can skip exponent part + #if defined(UNITY_COLORSPACE_GAMMA) + return (decodeInstructions.x * alpha) * data.rgb; + #else + # if defined(UNITY_USE_NATIVE_HDR) + return decodeInstructions.x * data.rgb; // Multiplier for future HDRI relative to absolute conversion. + # else + return (decodeInstructions.x * pow(alpha, decodeInstructions.y)) * data.rgb; + # endif + #endif +} + +// Decodes HDR textures +// handles dLDR, RGBM formats +// Called by DecodeLightmap when UNITY_NO_RGBM is not defined. +inline half3 DecodeLightmapRGBM (half4 data, half4 decodeInstructions) +{ + // If Linear mode is not supported we can skip exponent part + #if defined(UNITY_COLORSPACE_GAMMA) + # if defined(UNITY_FORCE_LINEAR_READ_FOR_RGBM) + return (decodeInstructions.x * data.a) * sqrt(data.rgb); + # else + return (decodeInstructions.x * data.a) * data.rgb; + # endif + #else + return (decodeInstructions.x * pow(data.a, decodeInstructions.y)) * data.rgb; + #endif +} + +// Decodes doubleLDR encoded lightmaps. +inline half3 DecodeLightmapDoubleLDR( fixed4 color ) +{ + return 2.0 * color.rgb; +} + +inline half3 DecodeLightmap( fixed4 color, half4 decodeInstructions) +{ +#if defined(UNITY_NO_RGBM) + return DecodeLightmapDoubleLDR( color ); +#else + return DecodeLightmapRGBM( color, decodeInstructions ); +#endif +} + +half4 unity_Lightmap_HDR; + +inline half3 DecodeLightmap( fixed4 color ) +{ + return DecodeLightmap( color, unity_Lightmap_HDR ); +} + +half4 unity_DynamicLightmap_HDR; + +// Decodes Enlighten RGBM encoded lightmaps +// NOTE: Enlighten dynamic texture RGBM format is _different_ from standard Unity HDR textures +// (such as Baked Lightmaps, Reflection Probes and IBL images) +// Instead Enlighten provides RGBM texture in _Linear_ color space with _different_ exponent. +// WARNING: 3 pow operations, might be very expensive for mobiles! +inline half3 DecodeRealtimeLightmap( fixed4 color ) +{ + //@TODO: Temporary until Geomerics gives us an API to convert lightmaps to RGBM in gamma space on the enlighten thread before we upload the textures. +#if defined(UNITY_FORCE_LINEAR_READ_FOR_RGBM) + return pow ((unity_DynamicLightmap_HDR.x * color.a) * sqrt(color.rgb), unity_DynamicLightmap_HDR.y); +#else + return pow ((unity_DynamicLightmap_HDR.x * color.a) * color.rgb, unity_DynamicLightmap_HDR.y); +#endif +} + +inline half3 DecodeDirectionalLightmap (half3 color, fixed4 dirTex, half3 normalWorld) +{ + // In directional (non-specular) mode Enlighten bakes dominant light direction + // in a way, that using it for half Lambert and then dividing by a "rebalancing coefficient" + // gives a result close to plain diffuse response lightmaps, but normalmapped. + + // Note that dir is not unit length on purpose. Its length is "directionality", like + // for the directional specular lightmaps. + + half halfLambert = dot(normalWorld, dirTex.xyz - 0.5) + 0.5; + + return color * halfLambert / max(1e-4h, dirTex.w); +} + +// Encoding/decoding [0..1) floats into 8 bit/channel RGBA. Note that 1.0 will not be encoded properly. +inline float4 EncodeFloatRGBA( float v ) +{ + float4 kEncodeMul = float4(1.0, 255.0, 65025.0, 16581375.0); + float kEncodeBit = 1.0/255.0; + float4 enc = kEncodeMul * v; + enc = frac (enc); + enc -= enc.yzww * kEncodeBit; + return enc; +} +inline float DecodeFloatRGBA( float4 enc ) +{ + float4 kDecodeDot = float4(1.0, 1/255.0, 1/65025.0, 1/16581375.0); + return dot( enc, kDecodeDot ); +} + +// Encoding/decoding [0..1) floats into 8 bit/channel RG. Note that 1.0 will not be encoded properly. +inline float2 EncodeFloatRG( float v ) +{ + float2 kEncodeMul = float2(1.0, 255.0); + float kEncodeBit = 1.0/255.0; + float2 enc = kEncodeMul * v; + enc = frac (enc); + enc.x -= enc.y * kEncodeBit; + return enc; +} +inline float DecodeFloatRG( float2 enc ) +{ + float2 kDecodeDot = float2(1.0, 1/255.0); + return dot( enc, kDecodeDot ); +} + + +// Encoding/decoding view space normals into 2D 0..1 vector +inline float2 EncodeViewNormalStereo( float3 n ) +{ + float kScale = 1.7777; + float2 enc; + enc = n.xy / (n.z+1); + enc /= kScale; + enc = enc*0.5+0.5; + return enc; +} +inline float3 DecodeViewNormalStereo( float4 enc4 ) +{ + float kScale = 1.7777; + float3 nn = enc4.xyz*float3(2*kScale,2*kScale,0) + float3(-kScale,-kScale,1); + float g = 2.0 / dot(nn.xyz,nn.xyz); + float3 n; + n.xy = g*nn.xy; + n.z = g-1; + return n; +} + +inline float4 EncodeDepthNormal( float depth, float3 normal ) +{ + float4 enc; + enc.xy = EncodeViewNormalStereo (normal); + enc.zw = EncodeFloatRG (depth); + return enc; +} + +inline void DecodeDepthNormal( float4 enc, out float depth, out float3 normal ) +{ + depth = DecodeFloatRG (enc.zw); + normal = DecodeViewNormalStereo (enc); +} + +inline fixed3 UnpackNormalDXT5nm (fixed4 packednormal) +{ + fixed3 normal; + normal.xy = packednormal.wy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; +} + +inline fixed3 UnpackNormal(fixed4 packednormal) +{ +#if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; +#else + return UnpackNormalDXT5nm(packednormal); +#endif +} + + +// Z buffer to linear 0..1 depth +inline float Linear01Depth( float z ) +{ + return 1.0 / (_ZBufferParams.x * z + _ZBufferParams.y); +} +// Z buffer to linear depth +inline float LinearEyeDepth( float z ) +{ + return 1.0 / (_ZBufferParams.z * z + _ZBufferParams.w); +} + + +inline float2 UnityStereoScreenSpaceUVAdjustInternal(float2 uv, float4 scaleAndOffset) +{ + return uv.xy * scaleAndOffset.xy + scaleAndOffset.zw; +} + +inline float4 UnityStereoScreenSpaceUVAdjustInternal(float4 uv, float4 scaleAndOffset) +{ + return float4(UnityStereoScreenSpaceUVAdjustInternal(uv.xy, scaleAndOffset), UnityStereoScreenSpaceUVAdjustInternal(uv.zw, scaleAndOffset)); +} + +#define UnityStereoScreenSpaceUVAdjust(x, y) UnityStereoScreenSpaceUVAdjustInternal(x, y) + +#if defined(UNITY_SINGLE_PASS_STEREO) +float2 TransformStereoScreenSpaceTex(float2 uv, float w) +{ + float4 scaleOffset = unity_StereoScaleOffset[unity_StereoEyeIndex]; + return uv.xy * scaleOffset.xy + scaleOffset.zw * w; +} + +inline float2 UnityStereoTransformScreenSpaceTex(float2 uv) +{ + return TransformStereoScreenSpaceTex(saturate(uv), 1.0); +} + +inline float4 UnityStereoTransformScreenSpaceTex(float4 uv) +{ + return float4(UnityStereoTransformScreenSpaceTex(uv.xy), UnityStereoTransformScreenSpaceTex(uv.zw)); +} +#else +#define TransformStereoScreenSpaceTex(uv, w) uv +#define UnityStereoTransformScreenSpaceTex(uv) uv +#endif + +// Depth render texture helpers +#define DECODE_EYEDEPTH(i) LinearEyeDepth(i) +#define COMPUTE_EYEDEPTH(o) o = -UnityObjectToViewPos( v.vertex ).z +#define COMPUTE_DEPTH_01 -(UnityObjectToViewPos( v.vertex ).z * _ProjectionParams.w) +#define COMPUTE_VIEW_NORMAL normalize(mul((float3x3)UNITY_MATRIX_IT_MV, v.normal)) + +// Helpers used in image effects. Most image effects use the same +// minimal vertex shader (vert_img). + +struct appdata_img +{ + float4 vertex : POSITION; + half2 texcoord : TEXCOORD0; +}; + +struct v2f_img +{ + float4 pos : SV_POSITION; + half2 uv : TEXCOORD0; +}; + +float2 MultiplyUV (float4x4 mat, float2 inUV) { + float4 temp = float4 (inUV.x, inUV.y, 0, 0); + temp = mul (mat, temp); + return temp.xy; +} + +v2f_img vert_img( appdata_img v ) +{ + v2f_img o; + o.pos = UnityObjectToClipPos (v.vertex); + o.uv = v.texcoord; + return o; +} + +// Projected screen position helpers +#define V2F_SCREEN_TYPE float4 + +inline float4 ComputeNonStereoScreenPos(float4 pos) { + float4 o = pos * 0.5f; + o.xy = float2(o.x, o.y*_ProjectionParams.x) + o.w; + o.zw = pos.zw; + return o; +} + +inline float4 ComputeScreenPos(float4 pos) { + float4 o = ComputeNonStereoScreenPos(pos); +#if defined(UNITY_SINGLE_PASS_STEREO) + o.xy = TransformStereoScreenSpaceTex(o.xy, pos.w); +#endif + return o; +} + +inline float4 ComputeGrabScreenPos (float4 pos) { + #if UNITY_UV_STARTS_AT_TOP + float scale = -1.0; + #else + float scale = 1.0; + #endif + float4 o = pos * 0.5f; + o.xy = float2(o.x, o.y*scale) + o.w; +#ifdef UNITY_SINGLE_PASS_STEREO + o.xy = TransformStereoScreenSpaceTex(o.xy, pos.w); +#endif + o.zw = pos.zw; + return o; +} + +// snaps post-transformed position to screen pixels +inline float4 UnityPixelSnap (float4 pos) +{ + float2 hpc = _ScreenParams.xy * 0.5f; + float2 pixelPos = round ((pos.xy / pos.w) * hpc); + pos.xy = pixelPos / hpc * pos.w; + return pos; +} + +inline float2 TransformViewToProjection (float2 v) { + return mul((float2x2)UNITY_MATRIX_P, v); +} + +inline float3 TransformViewToProjection (float3 v) { + return mul((float3x3)UNITY_MATRIX_P, v); +} + +// Shadow caster pass helpers + +float4 UnityEncodeCubeShadowDepth (float z) +{ + #ifdef UNITY_USE_RGBA_FOR_POINT_SHADOWS + return EncodeFloatRGBA (min(z, 0.999)); + #else + return z; + #endif +} + +float UnityDecodeCubeShadowDepth (float4 vals) +{ + #ifdef UNITY_USE_RGBA_FOR_POINT_SHADOWS + return DecodeFloatRGBA (vals); + #else + return vals.r; + #endif +} + + +float4 UnityClipSpaceShadowCasterPos(float4 vertex, float3 normal) +{ + float4 wPos = mul(unity_ObjectToWorld, vertex); + + if (unity_LightShadowBias.z != 0.0) + { + float3 wNormal = UnityObjectToWorldNormal(normal); + float3 wLight = normalize(UnityWorldSpaceLightDir(wPos.xyz)); + + // apply normal offset bias (inset position along the normal) + // bias needs to be scaled by sine between normal and light direction + // (http://the-witness.net/news/2013/09/shadow-mapping-summary-part-1/) + // + // unity_LightShadowBias.z contains user-specified normal offset amount + // scaled by world space texel size. + + float shadowCos = dot(wNormal, wLight); + float shadowSine = sqrt(1-shadowCos*shadowCos); + float normalBias = unity_LightShadowBias.z * shadowSine; + + wPos.xyz -= wNormal * normalBias; + } + + return mul(UNITY_MATRIX_VP, wPos); +} +// Legacy, not used anymore; kept around to not break existing user shaders +float4 UnityClipSpaceShadowCasterPos(float3 vertex, float3 normal) +{ + return UnityClipSpaceShadowCasterPos(float4(vertex, 1), normal); +} + + +float4 UnityApplyLinearShadowBias(float4 clipPos) +{ +#if defined(UNITY_REVERSED_Z) + // We use max/min instead of clamp to ensure proper handling of the rare case + // where both numerator and denominator are zero and the fraction becomes NaN. + clipPos.z += max(-1, min(unity_LightShadowBias.x / clipPos.w, 0)); + float clamped = min(clipPos.z, clipPos.w*UNITY_NEAR_CLIP_VALUE); +#else + clipPos.z += saturate(unity_LightShadowBias.x/clipPos.w); + float clamped = max(clipPos.z, clipPos.w*UNITY_NEAR_CLIP_VALUE); +#endif + clipPos.z = lerp(clipPos.z, clamped, unity_LightShadowBias.y); + return clipPos; +} + + +#ifdef SHADOWS_CUBE + // Rendering into point light (cubemap) shadows + #define V2F_SHADOW_CASTER_NOPOS float3 vec : TEXCOORD0; + #define TRANSFER_SHADOW_CASTER_NOPOS_LEGACY(o,opos) o.vec = mul(unity_ObjectToWorld, v.vertex).xyz - _LightPositionRange.xyz; opos = UnityObjectToClipPos(v.vertex); + #define TRANSFER_SHADOW_CASTER_NOPOS(o,opos) o.vec = mul(unity_ObjectToWorld, v.vertex).xyz - _LightPositionRange.xyz; opos = UnityObjectToClipPos(v.vertex); + #define SHADOW_CASTER_FRAGMENT(i) return UnityEncodeCubeShadowDepth ((length(i.vec) + unity_LightShadowBias.x) * _LightPositionRange.w); +#else + // Rendering into directional or spot light shadows + #define V2F_SHADOW_CASTER_NOPOS + // Let embedding code know that V2F_SHADOW_CASTER_NOPOS is empty; so that it can workaround + // empty structs that could possibly be produced. + #define V2F_SHADOW_CASTER_NOPOS_IS_EMPTY + #define TRANSFER_SHADOW_CASTER_NOPOS_LEGACY(o,opos) \ + opos = UnityObjectToClipPos(v.vertex.xyz); \ + opos = UnityApplyLinearShadowBias(opos); + #define TRANSFER_SHADOW_CASTER_NOPOS(o,opos) \ + opos = UnityClipSpaceShadowCasterPos(v.vertex, v.normal); \ + opos = UnityApplyLinearShadowBias(opos); + #define SHADOW_CASTER_FRAGMENT(i) return 0; +#endif + +// Declare all data needed for shadow caster pass output (any shadow directions/depths/distances as needed), +// plus clip space position. +#define V2F_SHADOW_CASTER V2F_SHADOW_CASTER_NOPOS float4 pos : SV_POSITION + +// Vertex shader part, with support for normal offset shadows. Requires +// position and normal to be present in the vertex input. +#define TRANSFER_SHADOW_CASTER_NORMALOFFSET(o) TRANSFER_SHADOW_CASTER_NOPOS(o,o.pos) + +// Vertex shader part, legacy. No support for normal offset shadows - because +// that would require vertex normals, which might not be present in user-written shaders. +#define TRANSFER_SHADOW_CASTER(o) TRANSFER_SHADOW_CASTER_NOPOS_LEGACY(o,o.pos) + + +// ------------------------------------------------------------------ +// Alpha helper + +#define UNITY_OPAQUE_ALPHA(outputAlpha) outputAlpha = 1.0 + + +// ------------------------------------------------------------------ +// Fog helpers +// +// multi_compile_fog Will compile fog variants. +// UNITY_FOG_COORDS(texcoordindex) Declares the fog data interpolator. +// UNITY_TRANSFER_FOG(outputStruct,clipspacePos) Outputs fog data from the vertex shader. +// UNITY_APPLY_FOG(fogData,col) Applies fog to color "col". Automatically applies black fog when in forward-additive pass. +// Can also use UNITY_APPLY_FOG_COLOR to supply your own fog color. + +// In case someone by accident tries to compile fog code in one of the g-buffer or shadow passes: +// treat it as fog is off. +#if defined(UNITY_PASS_PREPASSBASE) || defined(UNITY_PASS_DEFERRED) || defined(UNITY_PASS_SHADOWCASTER) +#undef FOG_LINEAR +#undef FOG_EXP +#undef FOG_EXP2 +#endif + +#if defined(UNITY_REVERSED_Z) + //D3d with reversed Z => z clip range is [near, 0] -> remapping to [0, far] + //max is required to protect ourselves from near plane not being correct/meaningfull in case of oblique matrices. + #define UNITY_Z_0_FAR_FROM_CLIPSPACE(coord) max(((1.0-(coord)/_ProjectionParams.y)*_ProjectionParams.z),0) +#elif UNITY_UV_STARTS_AT_TOP + //D3d without reversed z => z clip range is [0, far] -> nothing to do + #define UNITY_Z_0_FAR_FROM_CLIPSPACE(coord) (coord) +#else + //Opengl => z clip range is [-near, far] -> should remap in theory but dont do it in practice to save some perf (range is close enought) + #define UNITY_Z_0_FAR_FROM_CLIPSPACE(coord) (coord) +#endif + +#if defined(FOG_LINEAR) + // factor = (end-z)/(end-start) = z * (-1/(end-start)) + (end/(end-start)) + #define UNITY_CALC_FOG_FACTOR_RAW(coord) float unityFogFactor = (coord) * unity_FogParams.z + unity_FogParams.w +#elif defined(FOG_EXP) + // factor = exp(-density*z) + #define UNITY_CALC_FOG_FACTOR_RAW(coord) float unityFogFactor = unity_FogParams.y * (coord); unityFogFactor = exp2(-unityFogFactor) +#elif defined(FOG_EXP2) + // factor = exp(-(density*z)^2) + #define UNITY_CALC_FOG_FACTOR_RAW(coord) float unityFogFactor = unity_FogParams.x * (coord); unityFogFactor = exp2(-unityFogFactor*unityFogFactor) +#else + #define UNITY_CALC_FOG_FACTOR_RAW(coord) float unityFogFactor = 0.0 +#endif + +#define UNITY_CALC_FOG_FACTOR(coord) UNITY_CALC_FOG_FACTOR_RAW(UNITY_Z_0_FAR_FROM_CLIPSPACE(coord)) + +#define UNITY_FOG_COORDS_PACKED(idx, vectype) vectype fogCoord : TEXCOORD##idx; + +#if defined(FOG_LINEAR) || defined(FOG_EXP) || defined(FOG_EXP2) + #define UNITY_FOG_COORDS(idx) UNITY_FOG_COORDS_PACKED(idx, float1) + + #if (SHADER_TARGET < 30) || defined(SHADER_API_MOBILE) + // mobile or SM2.0: calculate fog factor per-vertex + #define UNITY_TRANSFER_FOG(o,outpos) UNITY_CALC_FOG_FACTOR((outpos).z); o.fogCoord.x = unityFogFactor + #else + // SM3.0 and PC/console: calculate fog distance per-vertex, and fog factor per-pixel + #define UNITY_TRANSFER_FOG(o,outpos) o.fogCoord.x = (outpos).z + #endif +#else + #define UNITY_FOG_COORDS(idx) + #define UNITY_TRANSFER_FOG(o,outpos) +#endif + +#define UNITY_FOG_LERP_COLOR(col,fogCol,fogFac) col.rgb = lerp((fogCol).rgb, (col).rgb, saturate(fogFac)) + + +#if defined(FOG_LINEAR) || defined(FOG_EXP) || defined(FOG_EXP2) + #if (SHADER_TARGET < 30) || defined(SHADER_API_MOBILE) + // mobile or SM2.0: fog factor was already calculated per-vertex, so just lerp the color + #define UNITY_APPLY_FOG_COLOR(coord,col,fogCol) UNITY_FOG_LERP_COLOR(col,fogCol,(coord).x) + #else + // SM3.0 and PC/console: calculate fog factor and lerp fog color + #define UNITY_APPLY_FOG_COLOR(coord,col,fogCol) UNITY_CALC_FOG_FACTOR((coord).x); UNITY_FOG_LERP_COLOR(col,fogCol,unityFogFactor) + #endif +#else + #define UNITY_APPLY_FOG_COLOR(coord,col,fogCol) +#endif + +#ifdef UNITY_PASS_FORWARDADD + #define UNITY_APPLY_FOG(coord,col) UNITY_APPLY_FOG_COLOR(coord,col,fixed4(0,0,0,0)) +#else + #define UNITY_APPLY_FOG(coord,col) UNITY_APPLY_FOG_COLOR(coord,col,unity_FogColor) +#endif + + +// ------------------------------------------------------------------ +// LOD cross fade helpers +#ifdef LOD_FADE_CROSSFADE + #define UNITY_DITHER_CROSSFADE_COORDS half3 ditherScreenPos; + #define UNITY_DITHER_CROSSFADE_COORDS_IDX(idx) half3 ditherScreenPos : TEXCOORD##idx; + #define UNITY_TRANSFER_DITHER_CROSSFADE(o,v) o.ditherScreenPos = ComputeDitherScreenPos(UnityObjectToClipPos(v)); + #define UNITY_TRANSFER_DITHER_CROSSFADE_HPOS(o,hpos) o.ditherScreenPos = ComputeDitherScreenPos(hpos); + half3 ComputeDitherScreenPos(float4 hPos) + { + half3 screenPos = ComputeScreenPos(hPos).xyw; + screenPos.xy *= _ScreenParams.xy * 0.25; + return screenPos; + } + #define UNITY_APPLY_DITHER_CROSSFADE(i) ApplyDitherCrossFade(i.ditherScreenPos); + sampler2D _DitherMaskLOD2D; + void ApplyDitherCrossFade(half3 ditherScreenPos) + { + half2 projUV = ditherScreenPos.xy / ditherScreenPos.z; + projUV.y = frac(projUV.y) * 0.0625 /* 1/16 */ + unity_LODFade.y; // quantized lod fade by 16 levels + clip(tex2D(_DitherMaskLOD2D, projUV).a - 0.5); + } +#else + #define UNITY_DITHER_CROSSFADE_COORDS + #define UNITY_DITHER_CROSSFADE_COORDS_IDX(idx) + #define UNITY_TRANSFER_DITHER_CROSSFADE(o,v) + #define UNITY_TRANSFER_DITHER_CROSSFADE_HPOS(o,hpos) + #define UNITY_APPLY_DITHER_CROSSFADE(i) +#endif + + +// ------------------------------------------------------------------ +// Deprecated things: these aren't used; kept here +// just so that various existing shaders still compile, more or less. + + +// Note: deprecated shadow collector pass helpers +#ifdef SHADOW_COLLECTOR_PASS + +#if !defined(SHADOWMAPSAMPLER_DEFINED) +UNITY_DECLARE_SHADOWMAP(_ShadowMapTexture); +#endif + +// Note: V2F_SHADOW_COLLECTOR and TRANSFER_SHADOW_COLLECTOR are deprecated +#define V2F_SHADOW_COLLECTOR float4 pos : SV_POSITION; float3 _ShadowCoord0 : TEXCOORD0; float3 _ShadowCoord1 : TEXCOORD1; float3 _ShadowCoord2 : TEXCOORD2; float3 _ShadowCoord3 : TEXCOORD3; float4 _WorldPosViewZ : TEXCOORD4 +#define TRANSFER_SHADOW_COLLECTOR(o) \ + o.pos = UnityObjectToClipPos(v.vertex); \ + float4 wpos = mul(unity_ObjectToWorld, v.vertex); \ + o._WorldPosViewZ.xyz = wpos; \ + o._WorldPosViewZ.w = -UnityObjectToViewPos(v.vertex).z; \ + o._ShadowCoord0 = mul(unity_WorldToShadow[0], wpos).xyz; \ + o._ShadowCoord1 = mul(unity_WorldToShadow[1], wpos).xyz; \ + o._ShadowCoord2 = mul(unity_WorldToShadow[2], wpos).xyz; \ + o._ShadowCoord3 = mul(unity_WorldToShadow[3], wpos).xyz; + +// Note: SAMPLE_SHADOW_COLLECTOR_SHADOW is deprecated +#define SAMPLE_SHADOW_COLLECTOR_SHADOW(coord) \ + half shadow = UNITY_SAMPLE_SHADOW(_ShadowMapTexture,coord); \ + shadow = _LightShadowData.r + shadow * (1-_LightShadowData.r); + +// Note: COMPUTE_SHADOW_COLLECTOR_SHADOW is deprecated +#define COMPUTE_SHADOW_COLLECTOR_SHADOW(i, weights, shadowFade) \ + float4 coord = float4(i._ShadowCoord0 * weights[0] + i._ShadowCoord1 * weights[1] + i._ShadowCoord2 * weights[2] + i._ShadowCoord3 * weights[3], 1); \ + SAMPLE_SHADOW_COLLECTOR_SHADOW(coord) \ + float4 res; \ + res.x = saturate(shadow + shadowFade); \ + res.y = 1.0; \ + res.zw = EncodeFloatRG (1 - i._WorldPosViewZ.w * _ProjectionParams.w); \ + return res; + +// Note: deprecated +#if defined (SHADOWS_SPLIT_SPHERES) +#define SHADOW_COLLECTOR_FRAGMENT(i) \ + float3 fromCenter0 = i._WorldPosViewZ.xyz - unity_ShadowSplitSpheres[0].xyz; \ + float3 fromCenter1 = i._WorldPosViewZ.xyz - unity_ShadowSplitSpheres[1].xyz; \ + float3 fromCenter2 = i._WorldPosViewZ.xyz - unity_ShadowSplitSpheres[2].xyz; \ + float3 fromCenter3 = i._WorldPosViewZ.xyz - unity_ShadowSplitSpheres[3].xyz; \ + float4 distances2 = float4(dot(fromCenter0,fromCenter0), dot(fromCenter1,fromCenter1), dot(fromCenter2,fromCenter2), dot(fromCenter3,fromCenter3)); \ + float4 cascadeWeights = float4(distances2 < unity_ShadowSplitSqRadii); \ + cascadeWeights.yzw = saturate(cascadeWeights.yzw - cascadeWeights.xyz); \ + float sphereDist = distance(i._WorldPosViewZ.xyz, unity_ShadowFadeCenterAndType.xyz); \ + float shadowFade = saturate(sphereDist * _LightShadowData.z + _LightShadowData.w); \ + COMPUTE_SHADOW_COLLECTOR_SHADOW(i, cascadeWeights, shadowFade) +#else +#define SHADOW_COLLECTOR_FRAGMENT(i) \ + float4 viewZ = i._WorldPosViewZ.w; \ + float4 zNear = float4( viewZ >= _LightSplitsNear ); \ + float4 zFar = float4( viewZ < _LightSplitsFar ); \ + float4 cascadeWeights = zNear * zFar; \ + float shadowFade = saturate(i._WorldPosViewZ.w * _LightShadowData.z + _LightShadowData.w); \ + COMPUTE_SHADOW_COLLECTOR_SHADOW(i, cascadeWeights, shadowFade) +#endif + +#endif // #ifdef SHADOW_COLLECTOR_PASS + + +// Legacy; used to do something on platforms that had to emulate depth textures manually. Now all platforms have native depth textures. +#define UNITY_TRANSFER_DEPTH(oo) +// Legacy; used to do something on platforms that had to emulate depth textures manually. Now all platforms have native depth textures. +#define UNITY_OUTPUT_DEPTH(i) return 0 + + +#endif // UNITY_CG_INCLUDED diff --git a/Assets/Alloy/Shaders/Unity/UnityCG.cginc.meta b/Assets/Alloy/Shaders/Unity/UnityCG.cginc.meta new file mode 100644 index 0000000..452a3c7 --- /dev/null +++ b/Assets/Alloy/Shaders/Unity/UnityCG.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 45bde337d21826b4a90e633a4d6b2346 +timeCreated: 1437435754 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Alloy/Shaders/Unity/UnityPBSLighting.cginc b/Assets/Alloy/Shaders/Unity/UnityPBSLighting.cginc new file mode 100644 index 0000000..ea08baf --- /dev/null +++ b/Assets/Alloy/Shaders/Unity/UnityPBSLighting.cginc @@ -0,0 +1,209 @@ +// Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt) + +#ifndef UNITY_PBS_LIGHTING_INCLUDED +#define UNITY_PBS_LIGHTING_INCLUDED + +// Alloy. +#define A_TANGENT_TO_WORLD_ON + +#if defined(UNITY_PASS_FORWARDBASE) || defined(UNITY_PASS_FORWARDADD) || defined(UNITY_PASS_DEFERRED) + #define A_AMBIENT_OCCLUSION_ON +#endif + +#if defined(UNITY_PASS_FORWARDBASE) || defined(UNITY_PASS_DEFERRED) || defined(UNITY_PASS_META) + #define A_EMISSIVE_COLOR_ON +#endif + +#if defined(UNITY_PASS_FORWARDBASE) || defined(UNITY_PASS_FORWARDADD) + #define A_DIRECT_LIGHTING_PASS +#endif + +#if defined(UNITY_PASS_FORWARDBASE) || defined(UNITY_PASS_DEFERRED) + #define A_INDIRECT_LIGHTING_PASS +#endif + +#if defined(UNITY_PASS_DEFERRED) + #define A_GBUFFER_PASS +#endif + +#include "Assets/Alloy/Shaders/Lighting/Standard.cginc" +#include "Assets/Alloy/Shaders/Framework/Unity.cginc" + +#include "UnityShaderVariables.cginc" +#include "UnityStandardConfig.cginc" +#include "UnityLightingCommon.cginc" +#include "UnityGBuffer.cginc" +#include "UnityGlobalIllumination.cginc" + +//------------------------------------------------------------------------------------- +// Default BRDF to use: +#if !defined (UNITY_BRDF_PBS) // allow to explicitly override BRDF in custom shader + // still add safe net for low shader models, otherwise we might end up with shaders failing to compile + #if SHADER_TARGET < 30 + #define UNITY_BRDF_PBS BRDF3_Unity_PBS + #elif defined(UNITY_PBS_USE_BRDF3) + #define UNITY_BRDF_PBS BRDF3_Unity_PBS + #elif defined(UNITY_PBS_USE_BRDF2) + #define UNITY_BRDF_PBS BRDF2_Unity_PBS + #elif defined(UNITY_PBS_USE_BRDF1) + #define UNITY_BRDF_PBS BRDF1_Unity_PBS + #elif defined(SHADER_TARGET_SURFACE_ANALYSIS) + // we do preprocess pass during shader analysis and we dont actually care about brdf as we need only inputs/outputs + #define UNITY_BRDF_PBS BRDF1_Unity_PBS + #else + #error something broke in auto-choosing BRDF + #endif +#endif + +//------------------------------------------------------------------------------------- +// little helpers for GI calculation +// CAUTION: This is deprecated and not use in Untiy shader code, but some asset store plugin still use it, so let here for compatibility + +#if !defined (UNITY_BRDF_GI) + #define UNITY_BRDF_GI BRDF_Unity_Indirect +#endif + +inline half3 BRDF_Unity_Indirect (half3 baseColor, half3 specColor, half oneMinusReflectivity, half smoothness, half3 normal, half3 viewDir, half occlusion, UnityGI gi) +{ + return half3(0,0,0); +} + +#define UNITY_GLOSSY_ENV_FROM_SURFACE(x, s, data) \ + Unity_GlossyEnvironmentData g; \ + g.roughness /* perceptualRoughness */ = SmoothnessToPerceptualRoughness(s.Smoothness); \ + g.reflUVW = reflect(-data.worldViewDir, s.Normal); \ + + +#if defined(UNITY_PASS_DEFERRED) && UNITY_ENABLE_REFLECTION_BUFFERS + #define UNITY_GI(x, s, data) x = UnityGlobalIllumination (data, s.Occlusion, s.Normal); +#else + #define UNITY_GI(x, s, data) \ + UNITY_GLOSSY_ENV_FROM_SURFACE(g, s, data); \ + x = UnityGlobalIllumination (data, s.Occlusion, s.Normal, g); +#endif + +// Surface shader output structure to be used with physically +// based shading model. + +//------------------------------------------------------------------------------------- +// Metallic workflow + +struct SurfaceOutputStandard +{ + fixed3 Albedo; // base (diffuse or specular) color + fixed3 Normal; // tangent space normal, if written + half3 Emission; + half Metallic; // 0=non-metal, 1=metal + // Smoothness is the user facing name, it should be perceptual smoothness but user should not have to deal with it. + // Everywhere in the code you meet smoothness it is perceptual smoothness + half Smoothness; // 0=rough, 1=smooth + half Occlusion; // occlusion (default 1) + fixed Alpha; // alpha for transparencies + float3 PositionWorld; // Alloy + half Shadow; // Alloy +}; + +ASurface aStandardSurface( + SurfaceOutputStandard si, + half3 viewDir) +{ + half oneMinusReflectivity; + ASurface s = aNewSurface(); + + s.albedo = DiffuseAndSpecularFromMetallic(si.Albedo, si.Metallic, /*out*/ s.f0, /*out*/ oneMinusReflectivity); + +#ifndef UNITY_PASS_DEFERRED + s.albedo = PreMultiplyAlpha(s.albedo, si.Alpha, oneMinusReflectivity, /*out*/ s.opacity); +#endif + + s.viewDirWorld = viewDir; + s.positionWorld = si.PositionWorld; + s.normalWorld = A_NW(s, normalize(si.Normal)); + s.roughness = 1.0h - si.Smoothness; + s.ambientOcclusion = si.Occlusion; + s.emissiveColor = si.Emission; + aUnitySurface(s); + return s; +} + +inline half4 LightingStandard (SurfaceOutputStandard si, half3 viewDir, UnityGI gi) +{ + ASurface s = aStandardSurface(si, viewDir); + return aUnityLighting(s, gi, si.Shadow); +} + +inline half4 LightingStandard_Deferred (SurfaceOutputStandard si, half3 viewDir, UnityGI gi, out half4 outGBuffer0, out half4 outGBuffer1, out half4 outGBuffer2) +{ + ASurface s = aStandardSurface(si, viewDir); + return aUnityLightingDeferred(s, gi, outGBuffer0, outGBuffer1, outGBuffer2); +} + +inline void LightingStandard_GI ( + SurfaceOutputStandard s, + UnityGIInput data, + inout UnityGI gi) +{ + aUnityLightingGi(gi, data, s.Normal, s.Smoothness, lerp(unity_ColorSpaceDielectricSpec.rgb, s.Albedo, s.Metallic)); +} + +//------------------------------------------------------------------------------------- +// Specular workflow + +struct SurfaceOutputStandardSpecular +{ + fixed3 Albedo; // diffuse color + fixed3 Specular; // specular color + fixed3 Normal; // tangent space normal, if written + half3 Emission; + half Smoothness; // 0=rough, 1=smooth + half Occlusion; // occlusion (default 1) + fixed Alpha; // alpha for transparencies + float3 PositionWorld; // Alloy + half Shadow; // Alloy +}; + +ASurface aStandardSpecularSurface( + SurfaceOutputStandardSpecular si, + half3 viewDir) +{ + half oneMinusReflectivity; + ASurface s = aNewSurface(); + + s.albedo = EnergyConservationBetweenDiffuseAndSpecular(si.Albedo, si.Specular, /*out*/ oneMinusReflectivity); + s.f0 = si.Specular; + +#ifndef UNITY_PASS_DEFERRED + s.albedo = PreMultiplyAlpha(s.albedo, si.Alpha, oneMinusReflectivity, /*out*/ s.opacity); +#endif + + s.viewDirWorld = viewDir; + s.positionWorld = si.PositionWorld; + s.normalWorld = A_NW(s, normalize(si.Normal)); + s.roughness = 1.0h - si.Smoothness; + s.ambientOcclusion = si.Occlusion; + s.emissiveColor = si.Emission; + aUnitySurface(s); + return s; +} + +inline half4 LightingStandardSpecular (SurfaceOutputStandardSpecular si, half3 viewDir, UnityGI gi) +{ + ASurface s = aStandardSpecularSurface(si, viewDir); + return aUnityLighting(s, gi, si.Shadow); +} + +inline half4 LightingStandardSpecular_Deferred (SurfaceOutputStandardSpecular si, half3 viewDir, UnityGI gi, out half4 outGBuffer0, out half4 outGBuffer1, out half4 outGBuffer2) +{ + ASurface s = aStandardSpecularSurface(si, viewDir); + return aUnityLightingDeferred(s, gi, outGBuffer0, outGBuffer1, outGBuffer2); +} + +inline void LightingStandardSpecular_GI ( + SurfaceOutputStandardSpecular s, + UnityGIInput data, + inout UnityGI gi) +{ + aUnityLightingGi(gi, data, s.Normal, s.Smoothness, s.Specular); +} + +#endif // UNITY_PBS_LIGHTING_INCLUDED diff --git a/Assets/Alloy/Shaders/Unity/UnityPBSLighting.cginc.meta b/Assets/Alloy/Shaders/Unity/UnityPBSLighting.cginc.meta new file mode 100644 index 0000000..d9fe782 --- /dev/null +++ b/Assets/Alloy/Shaders/Unity/UnityPBSLighting.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: b87791ddd81b476429c53e287d249e41 +timeCreated: 1434755007 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MeatKit.meta b/Assets/MeatKit.meta new file mode 100644 index 0000000..50c4de7 --- /dev/null +++ b/Assets/MeatKit.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: fff2a8b12fe707c479c01501746fb965 +folderAsset: yes +timeCreated: 1617325066 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MeatKit/BuildProfile.asset b/Assets/MeatKit/BuildProfile.asset new file mode 100644 index 0000000..dbb9a8d --- /dev/null +++ b/Assets/MeatKit/BuildProfile.asset @@ -0,0 +1,30 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: afed54a239594b8abd631a8047a54987, type: 3} + m_Name: BuildProfile + m_EditorClassIdentifier: + PackageName: TNH_Quality_of_Life_Improvements + Author: muskit + Version: 1.0.0 + Icon: {fileID: 2800000, guid: f999bddab1821b94691466e97cc6891f, type: 3} + ReadMe: {fileID: 102900000, guid: ab1d6dea017447a48ac348db588a6f35, type: 3} + WebsiteURL: + Description: Quality of life improvements to the Take and Hold experience. + AdditionalDependencies: + - BepInEx-BepInExPack_H3VR-5.4.1700 + StripNamespaces: 1 + AdditionalNamespaces: + - TNHQoLImprovements + BuildItems: + - {fileID: 11400000, guid: ccaff18373cd99848b344316974e6d46, type: 2} + BundleCompressionType: 2 + BuildAction: 2 + OutputProfile: diff --git a/Assets/MeatKit/BuildProfile.asset.meta b/Assets/MeatKit/BuildProfile.asset.meta new file mode 100644 index 0000000..5f1be0a --- /dev/null +++ b/Assets/MeatKit/BuildProfile.asset.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: b545caf63c55b0143bd5c4ce2e5eef7c +timeCreated: 1642332594 +licenseType: Free +NativeFormatImporter: + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MeatKit/Editor.meta b/Assets/MeatKit/Editor.meta new file mode 100644 index 0000000..6d7e1ef --- /dev/null +++ b/Assets/MeatKit/Editor.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 875f8d04396f408f8bd11e474bb41f3a +timeCreated: 1617325310 \ No newline at end of file diff --git a/Assets/MeatKit/Editor/AssemblyExporter.cs b/Assets/MeatKit/Editor/AssemblyExporter.cs new file mode 100644 index 0000000..fe084f0 --- /dev/null +++ b/Assets/MeatKit/Editor/AssemblyExporter.cs @@ -0,0 +1,126 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using Mono.Cecil; +using Mono.Cecil.Cil; + +namespace MeatKit +{ + public static partial class MeatKit + { + private const string EditorAssemblyPath = "Library/ScriptAssemblies/"; + public const string BundleOutputPath = "AssetBundles/"; + + private static void ExportEditorAssembly(string folder) + { + if (!File.Exists(EditorAssemblyPath + AssemblyName + ".dll")) return; + + // Delete the old file + var settings = BuildWindow.SelectedProfile; + var exportPath = folder + settings.PackageName + ".dll"; + if (File.Exists(exportPath)) File.Delete(exportPath); + + var rParams = new ReaderParameters + { + AssemblyResolver = + new RedirectedAssemblyResolver(Path.GetDirectoryName(typeof(UnityEngine.Object).Assembly.Location)) + }; + + // Get the MeatKitPlugin class and rename it + string tempFile = Path.GetTempFileName(); + File.Copy(EditorAssemblyPath + AssemblyName + ".dll", tempFile, true); + using (var asm = AssemblyDefinition.ReadAssembly(tempFile, rParams)) + { + var plugin = asm.MainModule.GetType("MeatKitPlugin"); + plugin.Name = settings.PackageName + "Plugin"; + + // This is some quantum bullshit. + // If you don't enumerate the constructor arguments for attributes their values aren't updated correctly. + foreach (var x in GetAllCustomAttributes(asm).SelectMany(a => a.ConstructorArguments)) + { + } + + // Get the BepInPlugin attribute and replace the values in it with our own + var str = asm.MainModule.TypeSystem.String; + var guid = settings.Author + "." + settings.PackageName; + var pluginAttribute = plugin.CustomAttributes.First(a => a.AttributeType.Name == "BepInPlugin"); + pluginAttribute.ConstructorArguments[0] = new CustomAttributeArgument(str, guid); + pluginAttribute.ConstructorArguments[1] = new CustomAttributeArgument(str, settings.PackageName); + pluginAttribute.ConstructorArguments[2] = new CustomAttributeArgument(str, settings.Version); + + // Get the LoadAssets method and make a new body for it + var loadAssetsMethod = plugin.Methods.First(m => m.Name == "LoadAssets"); + loadAssetsMethod.Body = new MethodBody(loadAssetsMethod); + var il = loadAssetsMethod.Body.GetILProcessor(); + + // Let any build items insert their own code in here + foreach (var item in settings.BuildItems) + item.GenerateLoadAssets(plugin, il); + + // Insert a ret at the end so it's valid + il.Emit(OpCodes.Ret); + + // Module name needs to be changed away from Assembly-CSharp.dll because it is a reserved name. + asm.Name = new AssemblyNameDefinition(settings.PackageName, asm.Name.Version); + asm.MainModule.Name = settings.PackageName + ".dll"; + + // References to renamed unity code must be swapped out. + foreach (var ii in asm.MainModule.AssemblyReferences) + switch (ii.Name) + { + case AssemblyRename: + ii.Name = AssemblyName; + break; + case AssemblyFirstpassRename: + ii.Name = AssemblyFirstpassName; + break; + } + + if (BuildWindow.SelectedProfile.StripNamespaces) + { + // Remove types not in an allowed namespace or the global namespace + string[] allowedNamespaces = BuildWindow.SelectedProfile.GetAllAllowedNamespaces(); + List typesToRemove = new List(); + foreach (var type in asm.MainModule.Types) + { + if (type.Namespace == "" || allowedNamespaces.Any(x => type.Namespace.Contains(x))) + continue; + typesToRemove.Add(type); + } + + foreach (var type in typesToRemove) asm.MainModule.Types.Remove(type); + } + + // Remove the same types we didn't want to import. This cannot be skipped. + foreach (var type in StripAssemblyTypes + .Select(x => asm.MainModule.GetType(x)) + .Where(x => x != null)) + asm.MainModule.Types.Remove(type); + + try + { + // Save it + asm.Write(exportPath); + } + catch (ArgumentException e) + { + throw new MeatKitBuildException("Unable to write exported scripts file. This is likely due to namespace stripping being enabled and a required namespace is not whitelisted.", e); + } + } + + // Delete temp file now that we're done. + File.Delete(tempFile); + } + + private static IEnumerable GetAllCustomAttributes(AssemblyDefinition asm) + { + foreach (var type in asm.MainModule.Types) + { + foreach (var attrib in type.CustomAttributes) yield return attrib; + foreach (CustomAttribute attrib in type.Methods.SelectMany(method => method.CustomAttributes)) + yield return attrib; + } + } + } +} \ No newline at end of file diff --git a/Assets/MeatKit/Editor/AssemblyExporter.cs.meta b/Assets/MeatKit/Editor/AssemblyExporter.cs.meta new file mode 100644 index 0000000..2fe2e70 --- /dev/null +++ b/Assets/MeatKit/Editor/AssemblyExporter.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 0c6f57f9c2dd40b8a7eabb4f85e2e283 +timeCreated: 1617344435 \ No newline at end of file diff --git a/Assets/MeatKit/Editor/AssemblyImporter.cs b/Assets/MeatKit/Editor/AssemblyImporter.cs new file mode 100644 index 0000000..380a35b --- /dev/null +++ b/Assets/MeatKit/Editor/AssemblyImporter.cs @@ -0,0 +1,260 @@ +using System.IO; +using System.Linq; +using System.Security.Cryptography; +using System.Text; +using System.Text.RegularExpressions; +using Mono.Cecil; +using NStrip; +using UnityEditor; +using UnityEngine; + +namespace MeatKit +{ + /// + /// Assembly importer class to get the managed assemblies from the game into the Unity editor without + /// the editor wanting to crash itself. Original implementation by Nolenz. + /// https://github.com/WurstModders/WurstMod-Reloaded/blob/2e33e83284b3a9f39c8df210ad907925d1d7d9d8/WMRWorkbench/Assets/Editor/Manglers/AssemblyMangler.cs + /// + public static partial class MeatKit + { + private const string AssemblyName = "Assembly-CSharp"; + private const string AssemblyRename = "H3VRCode-CSharp"; + private const string AssemblyFirstpassName = "Assembly-CSharp-firstpass"; + private const string AssemblyFirstpassRename = "H3VRCode-CSharp-passfirst"; + + // Types we want to strip from the main Unity assembly + private static readonly string[] StripAssemblyTypes = + { + // Alloy classes + "MaterialMapChannelPackerDefinition", + "Alloy.PackedMapDefinition", + "Alloy.BaseTextureChannelMapping", + "Alloy.MapChannel", + "Alloy.TextureValueChannelMode", + "Alloy.NormalMapChannelTextureChannelMapping", + "Alloy.TextureImportConfig", + "Alloy.MapTextureChannelMapping", + "AlloyUtils", + "Alloy.EnumExtension", + "MinValueAttribute", + "MaxValueAttribute", + "AlloyEffectsManager", + "Alloy.EnumFlagsAttribute", + + // Bakery MonoBehaviours + "BakeryAlwaysRender", + "BakeryDirectLight", + "BakeryLightmapGroup", + "BakeryLightmapGroupSelector", + "BakeryLightmappedPrefab", + "BakeryLightMesh", + "BakeryPointLight", + "BakerySkyLight", + "BakeryVolume", + "BakeryVolumeReceiver", + "BakeryVolumeTrigger", + "BakeryProjectSettings", + "VolumeTestScene2", + "BakeryPackAsSingleSquare", + "BakerySector", + "BakerySectorCapture", + "ftGlobalStorage", + "ftLightmaps", + "ftLightmapsStorage", + "ftLocalStorage", + + // Bakery supporting types + "ftUniqueIDRegistry", + "BakeryLightmapGroupPlain", + + //Editor Tool Scripts + "IconCamera" + }; + + // Array of the extra assemblies that need to come with the main Unity assemblies + private static readonly string[] ExtraAssemblies = + { + "DinoFracture.dll", + "ES2.dll" + }; + + + private static void ImportAssemblies(string assembliesDirectory, string destinationDirectory) + { + // Remove whatever was there before and make the folder again + if (!Directory.Exists(destinationDirectory)) Directory.CreateDirectory(destinationDirectory); + + // Load all of our modifiers + var editors = Extensions.GetAllInstances(); + foreach (var editor in editors) editor.Applied = false; + + // We need a custom assembly resolver that sometimes points to different directories. + var rParams = new ReaderParameters + { + AssemblyResolver = new RedirectedAssemblyResolver(assembliesDirectory, destinationDirectory) + }; + + // Rename the game's firstpass assembly + { + var firstpassAssembly = + AssemblyDefinition.ReadAssembly(Path.Combine(assembliesDirectory, AssemblyFirstpassName + ".dll")); + firstpassAssembly.Name = + new AssemblyNameDefinition(AssemblyFirstpassRename, firstpassAssembly.Name.Version); + firstpassAssembly.MainModule.Name = AssemblyFirstpassRename + ".dll"; + + // Apply modifications + foreach (var editor in editors) editor.ApplyModification(firstpassAssembly); + + // Publicize Assembly + AssemblyStripper.MakePublic(firstpassAssembly, new string[0], false, false); + + firstpassAssembly.Write(Path.Combine(destinationDirectory, AssemblyFirstpassRename + ".dll")); + firstpassAssembly.Dispose(); + } + + // Main assembly + { + // Rename the main assembly + var mainAssembly = + AssemblyDefinition.ReadAssembly(Path.Combine(assembliesDirectory, AssemblyName + ".dll"), rParams); + mainAssembly.Name = new AssemblyNameDefinition(AssemblyRename, mainAssembly.Name.Version); + mainAssembly.MainModule.Name = AssemblyRename + ".dll"; + + // Change the firstpass reference in this assembly + mainAssembly.MainModule.AssemblyReferences + .First(x => x.Name == AssemblyFirstpassName) + .Name = AssemblyFirstpassRename; + + // Strip some types from the assembly to prevent doubles in the editor + foreach (var typename in StripAssemblyTypes) + { + var type = mainAssembly.MainModule.GetType(typename); + if (type != null) mainAssembly.MainModule.Types.Remove(type); + else Debug.LogWarning("Type " + typename + " was not found in assembly."); + } + + // Apply modifications + foreach (var editor in editors) editor.ApplyModification(mainAssembly); + + // Publicize assembly + AssemblyStripper.MakePublic(mainAssembly, new string[0], false, false); + + // Write the main assembly out into the destination folder and dispose it + mainAssembly.Write(Path.Combine(destinationDirectory, AssemblyRename + ".dll")); + } + + // Then lastly copy the other assemblies to the destination folder + foreach (var file in ExtraAssemblies) + { + var path = Path.Combine(assembliesDirectory, file); + if (File.Exists(path)) + ImportSingleAssembly(path, destinationDirectory); + } + + // Check if anything didn't apply + foreach (var editor in editors) + if (!editor.Applied) + Debug.LogWarning(editor.name + " was not applied while importing.", editor); + + // When we're done importing assemblies, let Unity refresh the asset database + PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.Standalone, "H3VR_IMPORTED"); + NormalizeMetaFileGUIDs(); + } + + private static void ImportSingleAssembly(string assemblyPath, string destinationDirectory) + { + var rParams = new ReaderParameters + { + AssemblyResolver = + new RedirectedAssemblyResolver(Path.GetDirectoryName(assemblyPath), destinationDirectory) + }; + + // We just want to rename the references to the game's assemblies here + var asm = AssemblyDefinition.ReadAssembly(assemblyPath, rParams); + foreach (var reference in asm.MainModule.AssemblyReferences) + switch (reference.Name) + { + case AssemblyName: + reference.Name = AssemblyRename; + break; + case AssemblyFirstpassName: + reference.Name = AssemblyFirstpassRename; + break; + } + + asm.Write(Path.Combine(destinationDirectory, Path.GetFileName(assemblyPath))); + NormalizeMetaFileGUIDs(); + } + + private static void NormalizeMetaFileGUIDs() + { + // This is a really important step. We need to make sure that the meta files for the assemblies are generated + // WITH THE SAME GUIDs each time. Otherwise, if you lose one and didn't have a backup, all your scripts will be missing + // and that is of course no bueno. Unity expects 32 hexadecimal digits for the guid so we'll use md5. + + // We need every meta file to exist already. + AssetDatabase.Refresh(); + + var hashFunction = MD5.Create(); + var replaceWith = new Regex(@"^guid: [0-9a-f]{32}$", RegexOptions.Multiline); + + foreach (var metaFile in Directory.GetFiles(ManagedDirectory, "*.meta")) + { + // First we get the hash + var assemblyName = Path.GetFileName(metaFile.Substring(0, metaFile.Length - 5)); + var hash = hashFunction.ComputeHash(Encoding.UTF8.GetBytes(assemblyName)); + var hexHash = Extensions.ByteArrayToString(hash).ToLower(); + + // Then we need to replace the hash in the meta file with it. + var metaText = File.ReadAllText(metaFile); + metaText = replaceWith.Replace(metaText, "guid: " + hexHash); + File.WriteAllText(metaFile, metaText); + } + + // If anything was changed we need Unity to apply it immediately. + AssetDatabase.Refresh(); + } + + /// + /// Assembly resolver that redirects references to another path if not found. + /// + private class RedirectedAssemblyResolver : BaseAssemblyResolver + { + private readonly DefaultAssemblyResolver _defaultResolver = new DefaultAssemblyResolver(); + private readonly string[] _redirectPaths; + + public RedirectedAssemblyResolver(params string[] redirectPath) + { + _redirectPaths = redirectPath; + } + + public override AssemblyDefinition Resolve(AssemblyNameReference name) + { + AssemblyDefinition asm = null; + try + { + asm = _defaultResolver.Resolve(name); + } + catch (AssemblyResolutionException) + { + foreach (var path in _redirectPaths) + try + { + var asmPath = Path.Combine(path, name.Name + ".dll"); + Debug.Log("Assembly path: " + asmPath); + if (File.Exists(asmPath)) + asm = AssemblyDefinition.ReadAssembly(asmPath, + new ReaderParameters {AssemblyResolver = this}); + } + catch (AssemblyResolutionException) + { + // Ignored + } + } + + if (asm != null) return asm; + throw new AssemblyResolutionException(name); + } + } + } +} diff --git a/Assets/MeatKit/Editor/AssemblyImporter.cs.meta b/Assets/MeatKit/Editor/AssemblyImporter.cs.meta new file mode 100644 index 0000000..0c50591 --- /dev/null +++ b/Assets/MeatKit/Editor/AssemblyImporter.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 4d2f661647864f0689e2c38c7c687c99 +timeCreated: 1617325184 \ No newline at end of file diff --git a/Assets/MeatKit/Editor/AssemblyModifiers.meta b/Assets/MeatKit/Editor/AssemblyModifiers.meta new file mode 100644 index 0000000..d2057ca --- /dev/null +++ b/Assets/MeatKit/Editor/AssemblyModifiers.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 49df45b608024e5eb33594ddd1200d89 +timeCreated: 1628213725 \ No newline at end of file diff --git a/Assets/MeatKit/Editor/AssemblyModifiers/AssemblyModifier.cs b/Assets/MeatKit/Editor/AssemblyModifiers/AssemblyModifier.cs new file mode 100644 index 0000000..66a422a --- /dev/null +++ b/Assets/MeatKit/Editor/AssemblyModifiers/AssemblyModifier.cs @@ -0,0 +1,14 @@ +using System; +using Mono.Cecil; +using UnityEngine; + +namespace MeatKit +{ + public abstract class AssemblyModifier : ScriptableObject + { + [NonSerialized] + public bool Applied = false; + + public abstract void ApplyModification(AssemblyDefinition assembly); + } +} diff --git a/Assets/MeatKit/Editor/AssemblyModifiers/AssemblyModifier.cs.meta b/Assets/MeatKit/Editor/AssemblyModifiers/AssemblyModifier.cs.meta new file mode 100644 index 0000000..aef1683 --- /dev/null +++ b/Assets/MeatKit/Editor/AssemblyModifiers/AssemblyModifier.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: c7e21420a1d84ca5947b2fd9eb9db6d8 +timeCreated: 1628213934 \ No newline at end of file diff --git a/Assets/MeatKit/Editor/AssemblyModifiers/EnumModifier.cs b/Assets/MeatKit/Editor/AssemblyModifiers/EnumModifier.cs new file mode 100644 index 0000000..2d11fdc --- /dev/null +++ b/Assets/MeatKit/Editor/AssemblyModifiers/EnumModifier.cs @@ -0,0 +1,50 @@ +using System; +using Mono.Cecil; +using UnityEngine; + +namespace MeatKit +{ + [CreateAssetMenu(menuName = "MeatKit/Assembly Editors/Enum", fileName = "New Enum Editor")] + public class EnumModifier : AssemblyModifier + { + private const FieldAttributes Attributes = + FieldAttributes.Static | FieldAttributes.Literal | FieldAttributes.Public | FieldAttributes.HasDefault; + + [Tooltip("Specify the FULL NAME of the enum you want to change. e.g. Sub.Namespace.Type")] + public string EnumName = "FistVR.FireArmRoundType"; + + [Tooltip("The new values you want to add to this enum")] + public EnumValue[] AddedValues = new EnumValue[0]; + + public override void ApplyModification(AssemblyDefinition assembly) + { + // Try to get this type from the assembly. If it doesn't exist, we can just skip. + TypeReference type = assembly.MainModule.GetType(EnumName); + if (type == null) return; + + var definition = type.Resolve(); + if (!definition.IsEnum) + { + Debug.LogError(EnumName + " is not an enum type!", this); + Applied = true; + return; + } + + // Add the new enum value to the type + foreach (var value in AddedValues) + definition.Fields.Add(new FieldDefinition(value.Name, Attributes, definition) {Constant = value.Value}); + + Applied = true; + } + + [Serializable] + public struct EnumValue + { + [Tooltip("The name of the new enum value")] + public string Name; + + [Tooltip("The new enum value")] + public int Value; + } + } +} diff --git a/Assets/MeatKit/Editor/AssemblyModifiers/EnumModifier.cs.meta b/Assets/MeatKit/Editor/AssemblyModifiers/EnumModifier.cs.meta new file mode 100644 index 0000000..4f52af5 --- /dev/null +++ b/Assets/MeatKit/Editor/AssemblyModifiers/EnumModifier.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 486e27304e8449efb6c6136482952c4d +timeCreated: 1628213734 \ No newline at end of file diff --git a/Assets/MeatKit/Editor/AssemblyModifiers/EnumModifierEditor.cs b/Assets/MeatKit/Editor/AssemblyModifiers/EnumModifierEditor.cs new file mode 100644 index 0000000..211c98d --- /dev/null +++ b/Assets/MeatKit/Editor/AssemblyModifiers/EnumModifierEditor.cs @@ -0,0 +1,62 @@ +using System; +using System.Linq; +using UnityEditor; + +namespace MeatKit +{ + [CustomEditor(typeof(EnumModifier))] + public class EnumModifierEditor : Editor + { + private static readonly string[] CommonTypes = + { + "FistVR.FireArmRoundType", + "FistVR.FireArmRoundClass", + "FistVR.FireArmMagazineType", + "FistVR.ItemSpawnerObjectDefinition.ItemSpawnerCategory", + "FistVR.SosigEnemyID" + }; + + private SerializedProperty _addedValues; + private EnumModifier _enumModifier; + private bool _isCustomType; + private int _selectedType; + + // Called when an object of this type is selected + private void OnEnable() + { + // Get our properties and check if this is a common type + _addedValues = serializedObject.FindProperty("AddedValues"); + _enumModifier = (EnumModifier) target; + _selectedType = Array.IndexOf(CommonTypes, _enumModifier.EnumName); + _isCustomType = _selectedType == -1 || string.IsNullOrEmpty(_enumModifier.EnumName); + } + + // Called to draw the inspector GUI + public override void OnInspectorGUI() + { + // I'll be real I have no idea what this does but the Unity docs had it so I'm not gonna mess with it + serializedObject.Update(); + + // Use a toggle (checkbox) to determine if we're using a custom type or a commonly used one from the array + _isCustomType = EditorGUILayout.Toggle("Custom type", _isCustomType); + if (_isCustomType) + _enumModifier.EnumName = EditorGUILayout.TextField("Enum name", _enumModifier.EnumName); + else + { + if (_selectedType < 0 || _selectedType >= CommonTypes.Length) _selectedType = 0; + _selectedType = EditorGUILayout.Popup("Type", _selectedType, CommonTypes); + _enumModifier.EnumName = CommonTypes[_selectedType]; + } + + // Draw the values field and then save the object + EditorGUILayout.PropertyField(_addedValues, true); + serializedObject.ApplyModifiedProperties(); + + // Suggest to the user that all added enums should be negative + if (_enumModifier.AddedValues.Any(x => x.Value >= 0)) + EditorGUILayout.HelpBox( + "Your added enum values should be negative to avoid conflicts with vanilla items.", + MessageType.Warning); + } + } +} \ No newline at end of file diff --git a/Assets/MeatKit/Editor/AssemblyModifiers/EnumModifierEditor.cs.meta b/Assets/MeatKit/Editor/AssemblyModifiers/EnumModifierEditor.cs.meta new file mode 100644 index 0000000..278aa9d --- /dev/null +++ b/Assets/MeatKit/Editor/AssemblyModifiers/EnumModifierEditor.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 4980597d341c4eed913ae30680f3f9f3 +timeCreated: 1628218472 \ No newline at end of file diff --git a/Assets/MeatKit/Editor/Build.cs b/Assets/MeatKit/Editor/Build.cs new file mode 100644 index 0000000..5be2129 --- /dev/null +++ b/Assets/MeatKit/Editor/Build.cs @@ -0,0 +1,138 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Linq; +using Ionic.Zip; +using UnityEditor; +using UnityEngine; +using Debug = UnityEngine.Debug; + +namespace MeatKit +{ + public partial class MeatKit + { + public static void DoBuild() + { + try + { + DoBuildInternal(); + } + catch (MeatKitBuildException e) + { + string message = e.Message; + if (e.InnerException != null) message += "\n\n" + e.InnerException.Message; + EditorUtility.DisplayDialog("Build failed", message, "Ok."); + } + catch (Exception e) + { + EditorUtility.DisplayDialog("Build failed with unknown error", + "Error message: " + e.Message + "\n\nCheck console for full exception text.", "Ok."); + Debug.LogException(e); + } + } + + private static void DoBuildInternal() + { + // Make sure the scripts are imported. + if (ShowErrorIfH3VRNotImported()) return; + + // Get our profile and make sure it isn't null + BuildProfile profile = BuildWindow.SelectedProfile; + if (!profile) return; + + // Start a stopwatch to time the build + Stopwatch sw = Stopwatch.StartNew(); + + // If there's anything invalid in the settings don't continue + if (!profile.EnsureValidForEditor()) return; + + // Clean the output folder + CleanBuild(); + + // And export the assembly to the folder + ExportEditorAssembly(BundleOutputPath); + + // Then get their asset bundle configurations + var bundles = profile.BuildItems.SelectMany(x => x.ConfigureBuild()).ToArray(); + + BuildPipeline.BuildAssetBundles(BundleOutputPath, bundles, BuildAssetBundleOptions.None, + BuildTarget.StandaloneWindows64); + + // Cleanup the unused files created with building the bundles + foreach (var file in Directory.GetFiles(BundleOutputPath, "*.manifest")) + File.Delete(file); + File.Delete(Path.Combine(BundleOutputPath, "AssetBundles")); + + // With the bundles done building we can process them + var replaceMap = new Dictionary + { + {"Assembly-CSharp.dll", profile.PackageName + ".dll"}, + {"Assembly-CSharp-firstpass.dll", profile.PackageName + "-firstpass.dll"}, + {"H3VRCode-CSharp.dll", "Assembly-CSharp.dll"}, + {"H3VRCode-CSharp-firstpass.dll", "Assembly-CSharp-firstpass.dll"} + }; + + foreach (var bundle in bundles) + { + var path = Path.Combine(BundleOutputPath, bundle.assetBundleName); + ProcessBundle(path, path, replaceMap, profile.BundleCompressionType); + } + + // Now we can write the Thunderstore stuff to the folder + profile.WriteThunderstoreManifest(BundleOutputPath + "manifest.json"); + + // Check if the icon is already 256x256 + Texture2D icon = profile.Icon; + + // Make sure our icon is marked as readable + var importSettings = (TextureImporter) AssetImporter.GetAtPath(AssetDatabase.GetAssetPath(profile.Icon)); + if (!importSettings.isReadable || + importSettings.textureCompression != TextureImporterCompression.Uncompressed) + { + importSettings.isReadable = true; + importSettings.textureCompression = TextureImporterCompression.Uncompressed; + importSettings.SaveAndReimport(); + } + + if (profile.Icon.width != 256 || profile.Icon.height != 256) + { + // Resize it for the build + icon = icon.ScaleTexture(256, 256); + } + + // Write the texture to file + File.WriteAllBytes(BundleOutputPath + "icon.png", icon.EncodeToPNG()); + + // Copy the readme + File.Copy(AssetDatabase.GetAssetPath(profile.ReadMe), BundleOutputPath + "README.md"); + + string packageName = profile.Author + "-" + profile.PackageName; + if (profile.BuildAction == BuildAction.CopyToProfile) + { + string pluginFolder = Path.Combine(profile.OutputProfile, "BepInEx/plugins/" + packageName); + if (Directory.Exists(pluginFolder)) Directory.Delete(pluginFolder, true); + Directory.CreateDirectory(pluginFolder); + Extensions.CopyFilesRecursively(BundleOutputPath, pluginFolder); + } + else if (profile.BuildAction == BuildAction.CreateThunderstorePackage) + { + using (var zip = new ZipFile()) + { + zip.AddDirectory(BundleOutputPath, ""); + zip.Save(Path.Combine(BundleOutputPath, packageName + ".zip")); + } + } + + // End the stopwatch and save the time + MeatKitCache.LastBuildDuration = sw.Elapsed; + MeatKitCache.LastBuildTime = DateTime.Now; + } + + public static void CleanBuild() + { + if (Directory.Exists(BundleOutputPath)) Directory.Delete(BundleOutputPath, true); + Directory.CreateDirectory(BundleOutputPath); + } + } +} \ No newline at end of file diff --git a/Assets/MeatKit/Editor/Build.cs.meta b/Assets/MeatKit/Editor/Build.cs.meta new file mode 100644 index 0000000..e83e2af --- /dev/null +++ b/Assets/MeatKit/Editor/Build.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 918df2720ddc4655b198835c566d115a +timeCreated: 1639093595 \ No newline at end of file diff --git a/Assets/MeatKit/Editor/BuildPipeline.meta b/Assets/MeatKit/Editor/BuildPipeline.meta new file mode 100644 index 0000000..9e6b26e --- /dev/null +++ b/Assets/MeatKit/Editor/BuildPipeline.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 70638cf8eda1487ba7a232bb4377a23c +folderAsset: yes +timeCreated: 1635003658 +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MeatKit/Editor/BuildPipeline/BuildItem.cs b/Assets/MeatKit/Editor/BuildPipeline/BuildItem.cs new file mode 100644 index 0000000..ebfadac --- /dev/null +++ b/Assets/MeatKit/Editor/BuildPipeline/BuildItem.cs @@ -0,0 +1,51 @@ +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using BepInEx; +using Mono.Cecil; +using Mono.Cecil.Cil; +using UnityEditor; +using UnityEngine; + +namespace MeatKit +{ + public abstract class BuildItem : ScriptableObject, IValidatable + { + public abstract IEnumerable RequiredDependencies { get; } + + public virtual Dictionary Validate() + { + return new Dictionary(); + } + + public virtual List ConfigureBuild() + { + return null; + } + + public virtual void GenerateLoadAssets(TypeDefinition plugin, ILProcessor il) + { + } + + protected void EnsurePluginDependsOn(TypeDefinition plugin, string pluginGuid, string pluginVersion) + { + // Check if the plugin already has this dependency + var alreadyDependsOn = plugin.CustomAttributes + .Where(a => a.AttributeType.Name == "BepInDependency") + .Any(attribute => (string) attribute.ConstructorArguments[0].Value == pluginGuid); + + // If it doesn't we need to add it. + if (!alreadyDependsOn) + { + MethodBase constructor = + typeof(BepInDependency).GetConstructor(new[] {typeof(string), typeof(string)}); + var attribute = new CustomAttribute(plugin.Module.ImportReference(constructor)); + plugin.CustomAttributes.Add(attribute); + + var str = plugin.Module.TypeSystem.String; + attribute.ConstructorArguments.Add(new CustomAttributeArgument(str, pluginGuid)); + attribute.ConstructorArguments.Add(new CustomAttributeArgument(str, pluginVersion)); + } + } + } +} diff --git a/Assets/MeatKit/Editor/BuildPipeline/BuildItem.cs.meta b/Assets/MeatKit/Editor/BuildPipeline/BuildItem.cs.meta new file mode 100644 index 0000000..52d5072 --- /dev/null +++ b/Assets/MeatKit/Editor/BuildPipeline/BuildItem.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 32dfb407962b465197e145b9cf760fcf +timeCreated: 1635010462 \ No newline at end of file diff --git a/Assets/MeatKit/Editor/BuildPipeline/BuildItemEditor.cs b/Assets/MeatKit/Editor/BuildPipeline/BuildItemEditor.cs new file mode 100644 index 0000000..53a5d1f --- /dev/null +++ b/Assets/MeatKit/Editor/BuildPipeline/BuildItemEditor.cs @@ -0,0 +1,70 @@ +using System.Collections.Generic; +using UnityEditor; +using UnityEngine; + +namespace MeatKit +{ + [CustomEditor(typeof(BuildItem), true)] + public class BuildItemEditor : Editor + { + protected Dictionary ValidationMessages; + + public override void OnInspectorGUI() + { + // Apply any changes and validate them + ValidationMessages = ((IValidatable) target).Validate(); + + // Draw the property fields and their message boxes, if any. + var property = serializedObject.GetIterator(); + if (!property.NextVisible(true)) return; + do DrawProperty(property); + while (property.NextVisible(false)); + serializedObject.ApplyModifiedProperties(); + } + + protected virtual void DrawProperty(SerializedProperty property) + { + // Don't draw the script name window. + if (property.name == "m_Script") return; + + EditorGUILayout.PropertyField(property, true); + DrawMessageIfExists(property.name); + } + + protected void DrawMessageIfExists(string propertyName) + { + BuildMessage message; + if (ValidationMessages.TryGetValue(propertyName, out message)) + EditorGUILayout.HelpBox(message.Message, message.Type); + } + + protected void DrawListWithRequiredElements(string[] required, SerializedProperty additional) + { + EditorGUI.indentLevel++; + + // Draw the size field + var size = EditorGUILayout.DelayedIntField("Size", required.Length + additional.arraySize); + size = Mathf.Max(required.Length, size); + + // Resize the array if necessary + var newSize = size - required.Length; + + if (newSize != additional.arraySize) additional.arraySize = newSize; + + // Draw the required dependencies. These are disabled. + EditorGUI.BeginDisabledGroup(true); + foreach (var dep in required) + EditorGUILayout.TextField(dep); + EditorGUI.EndDisabledGroup(); + + // Draw the additional dependencies + for (var i = 0; i < additional.arraySize; i++) + { + var value = additional.GetArrayElementAtIndex(i); + value.stringValue = EditorGUILayout.TextField(value.stringValue); + } + + EditorGUI.indentLevel--; + } + } +} \ No newline at end of file diff --git a/Assets/MeatKit/Editor/BuildPipeline/BuildItemEditor.cs.meta b/Assets/MeatKit/Editor/BuildPipeline/BuildItemEditor.cs.meta new file mode 100644 index 0000000..0703868 --- /dev/null +++ b/Assets/MeatKit/Editor/BuildPipeline/BuildItemEditor.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: ebaaff1430114c54b502477e745a02c2 +timeCreated: 1635011555 \ No newline at end of file diff --git a/Assets/MeatKit/Editor/BuildPipeline/BuildItems.meta b/Assets/MeatKit/Editor/BuildPipeline/BuildItems.meta new file mode 100644 index 0000000..8d163cb --- /dev/null +++ b/Assets/MeatKit/Editor/BuildPipeline/BuildItems.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 131929050e124316a330bb2af8cf8f94 +timeCreated: 1637507648 \ No newline at end of file diff --git a/Assets/MeatKit/Editor/BuildPipeline/BuildItems/PreloadAssetsBuildItem.cs b/Assets/MeatKit/Editor/BuildPipeline/BuildItems/PreloadAssetsBuildItem.cs new file mode 100644 index 0000000..6a24008 --- /dev/null +++ b/Assets/MeatKit/Editor/BuildPipeline/BuildItems/PreloadAssetsBuildItem.cs @@ -0,0 +1,56 @@ +using System.Collections.Generic; +using System.IO; +using UnityEditor; +using UnityEngine; +using System.Linq; +using System.Reflection; +using Mono.Cecil; +using Mono.Cecil.Cil; +using Sodalite; +using Sodalite.Api; + +namespace MeatKit +{ + [CreateAssetMenu(menuName = "MeatKit/Build Items/Preload Assets", fileName = "New build item")] + public class PreloadAssetsBuildItem : BuildItem + { + public Object[] Items; + + public override IEnumerable RequiredDependencies + { + get { return new[] {"nrgill28-Sodalite-1.2.0"}; } + } + + public override List ConfigureBuild() + { + List bundles = new List(); + + bundles.Add(new AssetBundleBuild + { + assetBundleName = BuildWindow.SelectedProfile.PackageName.ToLower() + "_preload", + assetNames = Items.Select(AssetDatabase.GetAssetPath).ToArray() + }); + + return bundles; + } + + public override void GenerateLoadAssets(TypeDefinition plugin, ILProcessor il) + { +#if H3VR_IMPORTED + EnsurePluginDependsOn(plugin, SodaliteConstants.Guid, SodaliteConstants.Version); + + // Get some references + const BindingFlags publicStatic = BindingFlags.Public | BindingFlags.Static; + FieldReference basePath = plugin.Fields.First(f => f.Name == "BasePath"); + MethodInfo pathCombine = typeof(Path).GetMethod("Combine", publicStatic); + MethodInfo sodalitePreloadAllAssets = typeof(GameAPI).GetMethod("PreloadAllAssets", publicStatic); + + // Emit our opcodes + il.Emit(OpCodes.Ldsfld, basePath); + il.Emit(OpCodes.Ldstr, BuildWindow.SelectedProfile.PackageName.ToLower() + "_preload"); + il.Emit(OpCodes.Call, plugin.Module.ImportReference(pathCombine)); + il.Emit(OpCodes.Call, plugin.Module.ImportReference(sodalitePreloadAllAssets)); +#endif + } + } +} \ No newline at end of file diff --git a/Assets/MeatKit/Editor/BuildPipeline/BuildItems/PreloadAssetsBuildItem.cs.meta b/Assets/MeatKit/Editor/BuildPipeline/BuildItems/PreloadAssetsBuildItem.cs.meta new file mode 100644 index 0000000..801a684 --- /dev/null +++ b/Assets/MeatKit/Editor/BuildPipeline/BuildItems/PreloadAssetsBuildItem.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: d18106ea7c52411db45cabd362f21f16 +timeCreated: 1640061580 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: 151c1f5398ee70041a49c417b23f1846, type: 3} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MeatKit/Editor/BuildPipeline/BuildItems/StoreFilesBuildItem.cs b/Assets/MeatKit/Editor/BuildPipeline/BuildItems/StoreFilesBuildItem.cs new file mode 100644 index 0000000..3c80ac7 --- /dev/null +++ b/Assets/MeatKit/Editor/BuildPipeline/BuildItems/StoreFilesBuildItem.cs @@ -0,0 +1,42 @@ +using System.Collections.Generic; +using System.Linq; +using UnityEditor; +using UnityEngine; + +namespace MeatKit +{ + [CreateAssetMenu(menuName = "MeatKit/Build Items/Store Files", fileName = "New build item")] + public class StoreFilesBuildItem : BuildItem + { + public string BundleName; + public Object[] Items; + + public override IEnumerable RequiredDependencies + { + get { return new string[0]; } + } + + public override Dictionary Validate() + { + var messages = base.Validate(); + + if (BundleName != Extensions.MakeValidFileName(BundleName)) + messages["BundleName"] = BuildMessage.Error("Bundle name contains invalid characters."); + + return messages; + } + + public override List ConfigureBuild() + { + List bundles = new List(); + + bundles.Add(new AssetBundleBuild + { + assetBundleName = BundleName, + assetNames = Items.Select(AssetDatabase.GetAssetPath).ToArray() + }); + + return bundles; + } + } +} diff --git a/Assets/MeatKit/Editor/BuildPipeline/BuildItems/StoreFilesBuildItem.cs.meta b/Assets/MeatKit/Editor/BuildPipeline/BuildItems/StoreFilesBuildItem.cs.meta new file mode 100644 index 0000000..57e4eb9 --- /dev/null +++ b/Assets/MeatKit/Editor/BuildPipeline/BuildItems/StoreFilesBuildItem.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: f6d6db4144b34551885c304840edfb62 +timeCreated: 1640061353 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: 6fae6dfd178cd184180013acef55632c, type: 3} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MeatKit/Editor/BuildPipeline/BuildMessage.cs b/Assets/MeatKit/Editor/BuildPipeline/BuildMessage.cs new file mode 100644 index 0000000..bc5bdbc --- /dev/null +++ b/Assets/MeatKit/Editor/BuildPipeline/BuildMessage.cs @@ -0,0 +1,31 @@ +using UnityEditor; + +namespace MeatKit +{ + public class BuildMessage + { + private BuildMessage(MessageType type, string message) + { + Type = type; + Message = message; + } + + public MessageType Type { get; private set; } + public string Message { get; private set; } + + public static BuildMessage Info(string message) + { + return new BuildMessage(MessageType.Info, message); + } + + public static BuildMessage Warning(string message) + { + return new BuildMessage(MessageType.Warning, message); + } + + public static BuildMessage Error(string message) + { + return new BuildMessage(MessageType.Error, message); + } + } +} diff --git a/Assets/MeatKit/Editor/BuildPipeline/BuildMessage.cs.meta b/Assets/MeatKit/Editor/BuildPipeline/BuildMessage.cs.meta new file mode 100644 index 0000000..48cb784 --- /dev/null +++ b/Assets/MeatKit/Editor/BuildPipeline/BuildMessage.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 4bad4598a9f145a3b5163239bb6c7536 +timeCreated: 1635009317 \ No newline at end of file diff --git a/Assets/MeatKit/Editor/BuildPipeline/BuildProfile.cs b/Assets/MeatKit/Editor/BuildPipeline/BuildProfile.cs new file mode 100644 index 0000000..edfe8cc --- /dev/null +++ b/Assets/MeatKit/Editor/BuildPipeline/BuildProfile.cs @@ -0,0 +1,201 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text.RegularExpressions; +using AssetsTools.NET; +using UnityEditor; +using UnityEngine; +using Object = UnityEngine.Object; +#if H3VR_IMPORTED +using Valve.Newtonsoft.Json; +using Valve.Newtonsoft.Json.Linq; +#endif + + +namespace MeatKit +{ + [CreateAssetMenu(menuName = "MeatKit/Build Profile")] + public class BuildProfile : ScriptableObject, IValidatable + { + [Header("Thunderstore Metadata")] + public string PackageName = ""; + public string Author = ""; + public string Version = ""; + public Texture2D Icon; + public Object ReadMe; + public string WebsiteURL = ""; + public string Description = ""; + public string[] AdditionalDependencies = new string[0]; + + [Header("Script Options")] + public bool StripNamespaces = true; + public string[] AdditionalNamespaces = new string[0]; + + [Header("Export Options")] + public BuildItem[] BuildItems = new BuildItem[0]; + public AssetBundleCompressionType BundleCompressionType = AssetBundleCompressionType.LZ4; + public BuildAction BuildAction = BuildAction.JustBuildFiles; + + [HideInInspector] + public string OutputProfile = ""; + + public Dictionary Validate() + { + var messages = new Dictionary(); + + // Package name needs to match regex + if (!Regex.IsMatch(PackageName, @"^[a-zA-Z_0-9]+$")) + messages["PackageName"] = + BuildMessage.Error("Package name can only contain letters, numbers, and underscores."); + + // Make sure the version number is a valid x.x.x + if (!Regex.IsMatch(Version, @"^\d+\.\d+\.\d+$")) + messages["Version"] = BuildMessage.Error("Version number must be in format 'x.x.x'."); + + // Description must be no longer than 250 chars + if (Description.Length > 250) + messages["Description"] = BuildMessage.Error("Description cannot be longer than 250 characters."); + + // Icon must exist and be 256 x 256 + if (!Icon) + messages["Icon"] = BuildMessage.Error("Missing icon."); + else if (Icon.width != 256 || Icon.height != 256) + messages["Icon"] = BuildMessage.Info("Icon will be resized to 256x256."); + + if (!ReadMe) + messages["ReadMe"] = BuildMessage.Error("Missing readme."); + + switch (BundleCompressionType) + { + case AssetBundleCompressionType.NONE: + messages["BundleCompressionType"] = BuildMessage.Warning( + "Uncompressed bundles are not recommended for publication. They can and will be very large."); + break; + case AssetBundleCompressionType.LZMA: + messages["BundleCompressionType"] = BuildMessage.Info( + "LZMA can take longer to compress than LZ4, however it will result in smaller file sizes usually."); + break; + } + + switch (BuildAction) + { + case BuildAction.JustBuildFiles: + messages["BuildAction"] = + BuildMessage.Info( + "This will just create the files for a Thunderstore package in your AssetBundles folder."); + break; + case BuildAction.CopyToProfile: + messages["BuildAction"] = + BuildMessage.Info( + "This will copy the built files into the plugins folder of the selected profile."); + if (string.IsNullOrEmpty(OutputProfile)) + messages["OutputProfile"] = BuildMessage.Error("Please set the output profile."); + else if (!Directory.Exists(OutputProfile)) + messages["OutputProfile"] = BuildMessage.Error("Selected profile no longer exists."); + else if (!File.Exists(Path.Combine(OutputProfile, "mods.yml"))) + messages["OutputProfile"] = BuildMessage.Error( + "Selected folder is not a r2mm profile. Please select the folder which contains the plugins folder."); + break; + case BuildAction.CreateThunderstorePackage: + messages["BuildAction"] = + BuildMessage.Info( + "This will zip up the built files as a final build for importing into r2mm / uploading to Thunderstore."); + break; + } + + return messages; + } + + public bool EnsureValidForEditor() + { + // Go over each build item + bool hasErrors = false, hasWarnings = false; + foreach (var item in BuildItems) + // Check if it has any validation messages + foreach (var message in item.Validate().Values) + // Log them + switch (message.Type) + { + case MessageType.Error: + Debug.LogError(AssetDatabase.GetAssetPath(item) + ": " + message.Message); + hasErrors = true; + break; + case MessageType.Warning: + Debug.LogWarning(AssetDatabase.GetAssetPath(item) + ": " + message.Message); + hasWarnings = true; + break; + case MessageType.Info: + Debug.Log(AssetDatabase.GetAssetPath(item) + ": " + message.Message); + break; + default: + throw new ArgumentOutOfRangeException(); + } + + // If there's errors don't let anything continue + if (hasErrors) + { + EditorUtility.DisplayDialog("Build errors", + "There were errors validating your build items. Please check the console for more info.", "Ok."); + return false; + } + + // If there's only warnings, let the user decide if they want to continue + if (hasWarnings) + return EditorUtility.DisplayDialog("Build warnings", + "Some build items validated with warnings. Continue with build anyway?", "Yes", "No"); + + // Otherwise continue + return true; + } + + public string[] GetRequiredDependencies() + { + return BuildItems + .Where(x => x != null) + .SelectMany(x => x.RequiredDependencies).ToArray(); + } + + public string MainNamespace + { + get + { + return Author + "." + PackageName; + } + } + + public string[] GetRequiredNamespaces() + { + return new[] {MainNamespace}; + } + + public string[] GetAllAllowedNamespaces() + { + return GetRequiredNamespaces().Concat(AdditionalNamespaces).ToArray(); + } + + public void WriteThunderstoreManifest(string location) + { +#if H3VR_IMPORTED + var obj = new JObject(); + obj["name"] = PackageName; + obj["author"] = Author; + obj["version_number"] = Version; + obj["description"] = Description; + obj["website_url"] = string.IsNullOrEmpty(WebsiteURL) ? "" : WebsiteURL; + + // ReSharper disable once CoVariantArrayConversion + obj["dependencies"] = new JArray(GetRequiredDependencies().Concat(AdditionalDependencies).ToArray()); + + File.WriteAllText(location, JsonConvert.SerializeObject(obj)); +#endif + } + } + + public enum BuildAction + { + JustBuildFiles, + CopyToProfile, + CreateThunderstorePackage + } +} \ No newline at end of file diff --git a/Assets/MeatKit/Editor/BuildPipeline/BuildProfile.cs.meta b/Assets/MeatKit/Editor/BuildPipeline/BuildProfile.cs.meta new file mode 100644 index 0000000..e697a2e --- /dev/null +++ b/Assets/MeatKit/Editor/BuildPipeline/BuildProfile.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: afed54a239594b8abd631a8047a54987 +timeCreated: 1635004125 \ No newline at end of file diff --git a/Assets/MeatKit/Editor/BuildPipeline/BuildProfileEditor.cs b/Assets/MeatKit/Editor/BuildPipeline/BuildProfileEditor.cs new file mode 100644 index 0000000..5c8dcae --- /dev/null +++ b/Assets/MeatKit/Editor/BuildPipeline/BuildProfileEditor.cs @@ -0,0 +1,63 @@ +using System; +using System.IO; +using UnityEditor; +using UnityEngine; + +namespace MeatKit +{ + [CustomEditor(typeof(BuildProfile))] + public class BuildProfileEditor : BuildItemEditor + { + private bool _folded1, _folded2; + private BuildProfile _profile; + + private void OnEnable() + { + _profile = (BuildProfile) target; + } + + protected override void DrawProperty(SerializedProperty property) + { + if (property.name == "AdditionalDependencies") + { + _folded1 = EditorGUILayout.Foldout(_folded1, "Dependencies"); + if (_folded1) DrawListWithRequiredElements(_profile.GetRequiredDependencies(), property); + } + else if (property.name == "AdditionalNamespaces") + { + if (!_profile.StripNamespaces) return; + + _folded2 = EditorGUILayout.Foldout(_folded2, "Allowed Namespaces"); + if (_folded2) + { + DrawListWithRequiredElements(_profile.GetRequiredNamespaces(), property); + EditorGUI.indentLevel++; + EditorGUILayout.HelpBox("Namespaces relate to custom scripts in your project. Any code in a namespace not included here will not be included in your final build. Note this only applies to .cs files directly in your project. Scripts coming from .dll files are not affected by this setting.", MessageType.Info); + EditorGUI.indentLevel--; + } + } + else if (property.name == "BuildAction") + { + base.DrawProperty(property); + + // Draw the build action stuff + if (_profile.BuildAction == BuildAction.CopyToProfile) + { + // Tell the user which profile it will be output to + string profileName = Path.GetFileName(_profile.OutputProfile); + GUILayout.Label("Selected profile: " + (string.IsNullOrEmpty(profileName) ? "None" : profileName)); + + // Give a button to change the output folder + if (GUILayout.Button("Select profile folder")) + _profile.OutputProfile = EditorUtility.OpenFolderPanel("Select your r2mm profile folder", @"%APPDATA%\Roaming\r2modmanPlus-local\H3VR\profiles", ""); + + // Draw any errors that come from the BuildAction property, as those won't get displayed otherwise. + DrawMessageIfExists("OutputProfile"); + } + } + else base.DrawProperty(property); + } + + + } +} \ No newline at end of file diff --git a/Assets/MeatKit/Editor/BuildPipeline/BuildProfileEditor.cs.meta b/Assets/MeatKit/Editor/BuildPipeline/BuildProfileEditor.cs.meta new file mode 100644 index 0000000..262917a --- /dev/null +++ b/Assets/MeatKit/Editor/BuildPipeline/BuildProfileEditor.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: b94a892488a449798f8fd227d82d86fc +timeCreated: 1635006063 \ No newline at end of file diff --git a/Assets/MeatKit/Editor/BuildPipeline/BuildWindow.cs b/Assets/MeatKit/Editor/BuildPipeline/BuildWindow.cs new file mode 100644 index 0000000..02132fe --- /dev/null +++ b/Assets/MeatKit/Editor/BuildPipeline/BuildWindow.cs @@ -0,0 +1,76 @@ +using System; +using UnityEditor; +using UnityEngine; + +namespace MeatKit +{ + public class BuildWindow : EditorWindow + { + private static BuildProfile _selectedProfileInternal; + private static BuildProfileEditor _editor; + + public static BuildProfile SelectedProfile + { + get + { + if (!_selectedProfileInternal) + _selectedProfileInternal = MeatKitCache.LastSelectedProfile; + return _selectedProfileInternal; + } + private set + { + if (_selectedProfileInternal != value) + _editor = null; + _selectedProfileInternal = value; + } + } + + private static BuildProfileEditor EditorInstance + { + get + { + if (!_editor && SelectedProfile) + _editor = (BuildProfileEditor) Editor.CreateEditor(SelectedProfile, typeof(BuildProfileEditor)); + return _editor; + } + } + + [MenuItem("MeatKit/Build Window")] + public static void Open() + { + GetWindow("MeatKit Build").Show(); + } + + private void OnGUI() + { + EditorGUILayout.LabelField("Selected Build Profile", EditorStyles.boldLabel); + + EditorGUI.BeginChangeCheck(); + SelectedProfile = EditorGUILayout.ObjectField(SelectedProfile, typeof(BuildProfile), false) as BuildProfile; + if (EditorGUI.EndChangeCheck()) + { + MeatKitCache.LastSelectedProfile = SelectedProfile; + } + + if (!SelectedProfile) + { + GUILayout.Label("Please select a profile"); + return; + } + + EditorGUILayout.Space(); + + EditorInstance.OnInspectorGUI(); + + GUILayout.FlexibleSpace(); + + if (GUILayout.Button("Build!", GUILayout.Height(50))) + MeatKit.DoBuild(); + + if (MeatKitCache.LastBuildTime != default(DateTime)) + GUILayout.Label("Last build: " + MeatKitCache.LastBuildTime + " (" + + MeatKitCache.LastBuildDuration.GetReadableTimespan() + ")"); + else GUILayout.Label("Last build: Never"); + } + } +} \ No newline at end of file diff --git a/Assets/MeatKit/Editor/BuildPipeline/BuildWindow.cs.meta b/Assets/MeatKit/Editor/BuildPipeline/BuildWindow.cs.meta new file mode 100644 index 0000000..4082398 --- /dev/null +++ b/Assets/MeatKit/Editor/BuildPipeline/BuildWindow.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 0a4b91e470df48f8be84b62e7c91d4a7 +timeCreated: 1639092690 \ No newline at end of file diff --git a/Assets/MeatKit/Editor/BuildPipeline/IValidatable.cs b/Assets/MeatKit/Editor/BuildPipeline/IValidatable.cs new file mode 100644 index 0000000..bb551b4 --- /dev/null +++ b/Assets/MeatKit/Editor/BuildPipeline/IValidatable.cs @@ -0,0 +1,9 @@ +using System.Collections.Generic; + +namespace MeatKit +{ + public interface IValidatable + { + Dictionary Validate(); + } +} diff --git a/Assets/MeatKit/Editor/BuildPipeline/IValidatable.cs.meta b/Assets/MeatKit/Editor/BuildPipeline/IValidatable.cs.meta new file mode 100644 index 0000000..d8066e3 --- /dev/null +++ b/Assets/MeatKit/Editor/BuildPipeline/IValidatable.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: f1c893eea8264e16a0b37abe9c2d6861 +timeCreated: 1636270330 \ No newline at end of file diff --git a/Assets/MeatKit/Editor/BuildPipeline/MeatKitBuildException.cs b/Assets/MeatKit/Editor/BuildPipeline/MeatKitBuildException.cs new file mode 100644 index 0000000..4994ea8 --- /dev/null +++ b/Assets/MeatKit/Editor/BuildPipeline/MeatKitBuildException.cs @@ -0,0 +1,12 @@ +using System; + +namespace MeatKit +{ + public class MeatKitBuildException : Exception + { + public MeatKitBuildException(string message, Exception innerException) : base(message, innerException) + { + + } + } +} \ No newline at end of file diff --git a/Assets/MeatKit/Editor/BuildPipeline/MeatKitBuildException.cs.meta b/Assets/MeatKit/Editor/BuildPipeline/MeatKitBuildException.cs.meta new file mode 100644 index 0000000..4203adf --- /dev/null +++ b/Assets/MeatKit/Editor/BuildPipeline/MeatKitBuildException.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 9dd595cdd27a46049e3d8005658214de +timeCreated: 1641928037 \ No newline at end of file diff --git a/Assets/MeatKit/Editor/BundleExporter.cs b/Assets/MeatKit/Editor/BundleExporter.cs new file mode 100644 index 0000000..ed22b4f --- /dev/null +++ b/Assets/MeatKit/Editor/BundleExporter.cs @@ -0,0 +1,85 @@ +using System; +using System.Collections.Generic; +using System.IO; +using AssetsTools.NET; +using AssetsTools.NET.Extra; +using UnityEditor; + +namespace MeatKit +{ + public static partial class MeatKit + { + private static void ProcessBundle(string source, string destination, IDictionary replaceMap, + AssetBundleCompressionType recompressAs) + { + try + { + // Step 1: Load the asset bundle. + EditorUtility.DisplayProgressBar("Processing bundle", "Loading asset bundle...", 0f); + var am = new AssetsManager(); + var bundle = am.LoadBundleFile(source); + var assets = am.LoadAssetsFileFromBundle(bundle, 0); + + // Step 2: For each MonoScript asset, alter it's assembly name + EditorUtility.DisplayProgressBar("Processing bundle", "Modifying assets...", 0.33f); + var modifications = new List(); + foreach (AssetFileInfoEx assetInfo in assets.table.assetFileInfo) + { + // We only want MonoScripts (type 115) + if (assetInfo.curFileType != 115) continue; + + // Get the field for this asset + var field = am.GetTypeInstance(assets, assetInfo).GetBaseField(); + var assemblyNameValue = field["m_AssemblyName"].GetValue(); + + // Check if we want to replace this name + var asmName = assemblyNameValue.AsString(); + if (replaceMap.ContainsKey(asmName)) + { + // Modify it's assembly name + assemblyNameValue.Set(replaceMap[asmName]); + + // Write the modifications to the list + var newBytes = field.WriteToByteArray(); + modifications.Add(new AssetsReplacerFromMemory(0, assetInfo.index, (int) assetInfo.curFileType, + 0xFFFF, newBytes)); + } + } + + // Step 3: Write the modified assets back into an uncompressed bundle + EditorUtility.DisplayProgressBar("Processing bundle", "Saving changes...", 0.66f); + using (var fileStream = new FileStream(destination + ".uncompressed", FileMode.Create)) + { + var bunRepl = new BundleReplacerFromAssets(assets.name, assets.name, assets.file, modifications); + var bunWriter = new AssetsFileWriter(fileStream); + bundle.file.Write(bunWriter, new List {bunRepl}); + } + + // Unload the existing bundle + am.UnloadAll(); + + // Step 4: Re-compress the bundle if requested + EditorUtility.DisplayProgressBar("Processing bundle", "Recompressing bundle...", 1f); + if (recompressAs != AssetBundleCompressionType.NONE) + { + var compressedBundle = am.LoadBundleFile(destination + ".uncompressed"); + using (var fs = File.OpenWrite(destination)) + using (var writer = new AssetsFileWriter(fs)) + { + compressedBundle.file.Pack(compressedBundle.file.reader, writer, recompressAs); + } + + am.UnloadAll(); + File.Delete(destination + ".uncompressed"); + } + else File.Move(destination + ".uncompressed", destination); + + } + finally + { + EditorUtility.ClearProgressBar(); + GC.Collect(); + } + } + } +} \ No newline at end of file diff --git a/Assets/MeatKit/Editor/BundleExporter.cs.meta b/Assets/MeatKit/Editor/BundleExporter.cs.meta new file mode 100644 index 0000000..24eacc5 --- /dev/null +++ b/Assets/MeatKit/Editor/BundleExporter.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 69efae90f6bb4c3eadcd9e7c4af6ec67 +timeCreated: 1617337071 \ No newline at end of file diff --git a/Assets/MeatKit/Editor/Extensions.cs b/Assets/MeatKit/Editor/Extensions.cs new file mode 100644 index 0000000..dbfd503 --- /dev/null +++ b/Assets/MeatKit/Editor/Extensions.cs @@ -0,0 +1,192 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Text; +using UnityEditor; +using UnityEngine; +using Object = UnityEngine.Object; + +namespace MeatKit +{ + public static class Extensions + { + public static Type[] GetTypesSafe(this Assembly assembly) + { + try + { + return assembly.GetTypes(); + } + catch (ReflectionTypeLoadException e) + { + return e.Types.Where(t => t != null).ToArray(); + } + } + + public static string ByteArrayToString(byte[] ba) + { + var hex = new StringBuilder(ba.Length * 2); + foreach (var b in ba) + hex.AppendFormat("{0:x2}", b); + return hex.ToString(); + } + + // Modified version of http://answers.unity.com/answers/1425776/view.html + public static T[] GetAllInstances() where T : ScriptableObject + { + return AssetDatabase.FindAssets("t:" + typeof(T).FullName) + .Select(AssetDatabase.GUIDToAssetPath) + .Select(AssetDatabase.LoadAssetAtPath) + .ToArray(); + } + + public static Object[] GetAllInstances(Type t) + { + return AssetDatabase.FindAssets("t:" + t.FullName) + .Select(AssetDatabase.GUIDToAssetPath) + .Select(p => AssetDatabase.LoadAssetAtPath(p, t)) + .ToArray(); + } + + // https://stackoverflow.com/a/25223884 + public static string MakeValidFileName(string text, char? replacement = '_') + { + if (string.IsNullOrEmpty(text)) return ""; + + var invalids = Path.GetInvalidFileNameChars(); + var sb = new StringBuilder(text.Length); + var changed = false; + for (var i = 0; i < text.Length; i++) + { + var c = text[i]; + if (invalids.Contains(c)) + { + changed = true; + var repl = replacement ?? '\0'; + if (repl != '\0') + sb.Append(repl); + } + else + sb.Append(c); + } + + if (sb.Length == 0) + return "_"; + return changed ? sb.ToString() : text; + } + + // https://answers.unity.com/questions/150942/texture-scale.html + public static Texture2D ScaleTexture(this Texture2D source, int targetWidth, int targetHeight) + { + Texture2D result = new Texture2D(targetWidth, targetHeight, TextureFormat.ARGB32, false); + for (int i = 0; i < result.height; ++i) + { + for (int j = 0; j < result.width; ++j) + { + Color newColor = source.GetPixelBilinear(j / (float) result.width, i / (float) result.height); + result.SetPixel(j, i, newColor); + } + } + + result.Apply(); + return result; + } + + public static void CopyFilesRecursively(DirectoryInfo source, DirectoryInfo target) { + foreach (DirectoryInfo dir in source.GetDirectories()) + CopyFilesRecursively(dir, target.CreateSubdirectory(dir.Name)); + foreach (FileInfo file in source.GetFiles()) + file.CopyTo(Path.Combine(target.FullName, file.Name)); + } + + public static void CopyFilesRecursively(string source, string target) + { + CopyFilesRecursively(new DirectoryInfo(source), new DirectoryInfo(target)); + } + + #region TimeSpan formatting https://stackoverflow.com/a/21649465/8809017 + + public static string GetReadableTimespan(this TimeSpan ts) + { + // formats and its cutoffs based on totalseconds + var cutoff = new SortedList + { + {59, "{3:S}"}, + {60, "{2:M}"}, + {60 * 60 - 1, "{2:M}, {3:S}"}, + {60 * 60, "{1:H}"}, + {24 * 60 * 60 - 1, "{1:H}, {2:M}"}, + {24 * 60 * 60, "{0:D}"}, + {long.MaxValue, "{0:D}, {1:H}"} + }; + + // find nearest best match + var find = cutoff.Keys.ToList() + .BinarySearch((long) ts.TotalSeconds); + // negative values indicate a nearest match + var near = find < 0 ? Math.Abs(find) - 1 : find; + // use custom formatter to get the string + return String.Format( + new HMSFormatter(), + cutoff[cutoff.Keys[near]], + ts.Days, + ts.Hours, + ts.Minutes, + ts.Seconds); + } + + // formatter for forms of + // seconds/hours/day + private class HMSFormatter : ICustomFormatter, IFormatProvider + { + // list of Formats, with a P customformat for pluralization + static Dictionary timeformats = new Dictionary + { + {"S", "{0:P:s:s}"}, + {"M", "{0:P:m:m}"}, + {"H", "{0:P:h:h}"}, + {"D", "{0:P:d:d}"} + }; + + public string Format(string format, object arg, IFormatProvider formatProvider) + { + return String.Format(new PluralFormatter(), timeformats[format], arg); + } + + public object GetFormat(Type formatType) + { + return formatType == typeof(ICustomFormatter) ? this : null; + } + } + + // formats a numeric value based on a format P:Plural:Singular + private class PluralFormatter : ICustomFormatter, IFormatProvider + { + public string Format(string format, object arg, IFormatProvider formatProvider) + { + if (arg != null) + { + var parts = format.Split(':'); // ["P", "Plural", "Singular"] + + if (parts[0] == "P") // correct format? + { + // which index postion to use + int partIndex = (arg.ToString() == "1") ? 2 : 1; + // pick string (safe guard for array bounds) and format + return String.Format("{0}{1}", arg, (parts.Length > partIndex ? parts[partIndex] : "")); + } + } + + return String.Format(format, arg); + } + + public object GetFormat(Type formatType) + { + return formatType == typeof(ICustomFormatter) ? this : null; + } + } + + #endregion + } +} \ No newline at end of file diff --git a/Assets/MeatKit/Editor/Extensions.cs.meta b/Assets/MeatKit/Editor/Extensions.cs.meta new file mode 100644 index 0000000..c050da5 --- /dev/null +++ b/Assets/MeatKit/Editor/Extensions.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: d928d818e3c24bce8c1c938e971da916 +timeCreated: 1628577239 \ No newline at end of file diff --git a/Assets/MeatKit/Editor/MeatKit.cs b/Assets/MeatKit/Editor/MeatKit.cs new file mode 100644 index 0000000..b29b186 --- /dev/null +++ b/Assets/MeatKit/Editor/MeatKit.cs @@ -0,0 +1,113 @@ +using System.Collections.Generic; +using System.IO; +using AssetsTools.NET; +using UnityEditor; +using UnityEngine; +using Debug = UnityEngine.Debug; + +namespace MeatKit +{ + public static partial class MeatKit + { + private static readonly string ManagedDirectory = Path.Combine(Application.dataPath, "MeatKit/Managed/"); + + private static bool ShowErrorIfH3VRNotImported() + { +#if (H3VR_IMPORTED == false) + EditorUtility.DisplayDialog("Cannot continue.", "You don't have the H3 scripts imported. Please do that before trying to export anything.", "Ok"); + return true; +#endif + return false; + } + + + [MenuItem("MeatKit/Scripts/Import Game", priority = 0)] + public static void ImportAssemblies() + { + // If the path has never been set, or no longer exists, prompt the user to find it again + var gameManagedLocation = MeatKitCache.GameManagedLocation; + if (string.IsNullOrEmpty(gameManagedLocation) || !Directory.Exists(gameManagedLocation)) + { + gameManagedLocation = EditorUtility.OpenFolderPanel("Select H3VR Managed directory", string.Empty, "Managed"); + MeatKitCache.GameManagedLocation = gameManagedLocation; + } + + // If it's _still_ empty, the user must have cancelled. + if (string.IsNullOrEmpty(gameManagedLocation)) return; + ImportAssemblies(gameManagedLocation, ManagedDirectory); + } + + [MenuItem("MeatKit/Scripts/Import Single", priority = 0)] + public static void ImportSingleAssembly() + { + var assemblyLocation = + EditorUtility.OpenFilePanel("Select assembly", null, "dll"); + if (string.IsNullOrEmpty(assemblyLocation)) return; + MeatKitCache.LastImportedAssembly = assemblyLocation; + ImportSingleAssembly(assemblyLocation, ManagedDirectory); + Debug.Log("Finished importing " + assemblyLocation); + } + + [MenuItem("MeatKit/Scripts/Re-Import Last", priority = 0)] + public static void ReimportLast() + { + if (string.IsNullOrEmpty(MeatKitCache.LastImportedAssembly)) + { + Debug.Log("Nothing to re-import."); + return; + } + + ImportSingleAssembly(MeatKitCache.LastImportedAssembly, ManagedDirectory); + Debug.Log("Re-imported " + MeatKitCache.LastImportedAssembly); + } + + [MenuItem("MeatKit/Scripts/Export", priority = 0)] + public static void ExportEditorScripts() + { + // Make sure the scripts are imported and there are no errors before exporting + if (ShowErrorIfH3VRNotImported()) return; + if (!BuildWindow.SelectedProfile.EnsureValidForEditor()) return; + ExportEditorAssembly(BundleOutputPath); + } + + + [MenuItem("MeatKit/Asset Bundle/Export", priority = 1)] + public static void ExportBundle() + { + var assetBundlePath = EditorUtility.OpenFilePanel("Select asset bundle", Application.dataPath, ""); + var settings = BuildWindow.SelectedProfile; + var replaceMap = new Dictionary + { + {"Assembly-CSharp.dll", settings.PackageName + ".dll"}, + {"Assembly-CSharp-firstpass.dll", settings.PackageName + "-firstpass.dll"}, + {"H3VRCode-CSharp.dll", "Assembly-CSharp.dll"}, + {"H3VRCode-CSharp-firstpass.dll", "Assembly-CSharp-firstpass.dll"} + }; + + ProcessBundle(assetBundlePath, assetBundlePath, replaceMap, AssetBundleCompressionType.LZ4); + } + + [MenuItem("MeatKit/Asset Bundle/Import", priority = 1)] + public static void ImportBundle() + { + var assetBundlePath = EditorUtility.OpenFilePanel("Select asset bundle", Application.dataPath, ""); + var replaceMap = new Dictionary + { + {"Assembly-CSharp.dll", "H3VRCode-CSharp.dll"}, + {"Assembly-CSharp-firstpass.dll", "H3VRCode-CSharp-firstpass.dll"} + }; + + ProcessBundle(assetBundlePath, assetBundlePath + "-imported", replaceMap, AssetBundleCompressionType.NONE); + } + + public static void ClearCache() + { + AssetDatabase.SaveAssets(); + + if (Directory.Exists(ManagedDirectory)) + Directory.Delete(ManagedDirectory, true); + PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.Standalone, ""); + AssetDatabase.Refresh(); + } + } +} \ No newline at end of file diff --git a/Assets/MeatKit/Editor/MeatKit.cs.meta b/Assets/MeatKit/Editor/MeatKit.cs.meta new file mode 100644 index 0000000..06c48b9 --- /dev/null +++ b/Assets/MeatKit/Editor/MeatKit.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: dc821cd525214a745a8b5ee5624f98c6 +timeCreated: 1617325095 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MeatKit/Editor/MeatKitCache.cs b/Assets/MeatKit/Editor/MeatKitCache.cs new file mode 100644 index 0000000..c6729ab --- /dev/null +++ b/Assets/MeatKit/Editor/MeatKitCache.cs @@ -0,0 +1,112 @@ +using System; +using System.Globalization; +using System.IO; +using UnityEditor; +using UnityEngine; + +namespace MeatKit +{ + [Serializable] + public class MeatKitCache + { + private const string CacheFileName = "meatkit.json"; + + [SerializeField] + private string _lastBuildTime = default(DateTime).ToString(CultureInfo.InvariantCulture); + + [SerializeField] + private string _lastBuildDuration = default(TimeSpan).ToString(); + + [SerializeField] + private string _gameManagedLocation; + + [SerializeField] + private string _lastImportedAssembly; + + [SerializeField] + private string _lastSelectedProfileGuid; + + private static string CacheFilePath + { + get { return Path.Combine(Path.GetDirectoryName(Application.dataPath), CacheFileName); } + } + + private static MeatKitCache _instance; + private static MeatKitCache Instance + { + get + { + if (_instance != null) return _instance; + + if (!File.Exists(CacheFilePath)) + { + _instance = new MeatKitCache(); + WriteCache(); + } + else _instance = JsonUtility.FromJson(File.ReadAllText(CacheFileName)); + return _instance; + } + } + + private static void WriteCache() + { + File.WriteAllText(CacheFilePath, JsonUtility.ToJson(_instance)); + } + + public static DateTime LastBuildTime + { + get { return DateTime.Parse(Instance._lastBuildTime); } + set + { + Instance._lastBuildTime = value.ToString(CultureInfo.InvariantCulture); + WriteCache(); + } + } + + public static TimeSpan LastBuildDuration + { + get { return TimeSpan.Parse(Instance._lastBuildDuration); } + set + { + Instance._lastBuildDuration = value.ToString(); + WriteCache(); + } + } + + public static string GameManagedLocation + { + get { return Instance._gameManagedLocation; } + set + { + Instance._gameManagedLocation = value; + WriteCache(); + } + } + + public static string LastImportedAssembly + { + get { return Instance._lastImportedAssembly; } + set + { + Instance._lastImportedAssembly = value; + WriteCache(); + } + } + + public static BuildProfile LastSelectedProfile + { + get + { + if (string.IsNullOrEmpty(Instance._lastSelectedProfileGuid)) return null; + var path = AssetDatabase.GUIDToAssetPath(Instance._lastSelectedProfileGuid); + return string.IsNullOrEmpty(path) ? null : AssetDatabase.LoadAssetAtPath(path); + } + set + { + if (value == null) Instance._lastSelectedProfileGuid = ""; + Instance._lastSelectedProfileGuid = AssetDatabase.AssetPathToGUID(AssetDatabase.GetAssetPath(value)); + WriteCache(); + } + } + } +} \ No newline at end of file diff --git a/Assets/MeatKit/Editor/MeatKitCache.cs.meta b/Assets/MeatKit/Editor/MeatKitCache.cs.meta new file mode 100644 index 0000000..a5f2964 --- /dev/null +++ b/Assets/MeatKit/Editor/MeatKitCache.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 0dd6818cfc454c2a881d31442b37269e +timeCreated: 1638838073 \ No newline at end of file diff --git a/Assets/MeatKit/Icons.meta b/Assets/MeatKit/Icons.meta new file mode 100644 index 0000000..053262a --- /dev/null +++ b/Assets/MeatKit/Icons.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: c302b95892ac1244bbc2d7eb2a4584a2 +folderAsset: yes +timeCreated: 1640060210 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MeatKit/Icons/AtlasSceneBuildItem.png b/Assets/MeatKit/Icons/AtlasSceneBuildItem.png new file mode 100644 index 0000000..521f137 Binary files /dev/null and b/Assets/MeatKit/Icons/AtlasSceneBuildItem.png differ diff --git a/Assets/MeatKit/Icons/AtlasSceneBuildItem.png.meta b/Assets/MeatKit/Icons/AtlasSceneBuildItem.png.meta new file mode 100644 index 0000000..2433e75 --- /dev/null +++ b/Assets/MeatKit/Icons/AtlasSceneBuildItem.png.meta @@ -0,0 +1,76 @@ +fileFormatVersion: 2 +guid: f999bddab1821b94691466e97cc6891f +timeCreated: 1642657287 +licenseType: Free +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 0 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 1 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + filterMode: 2 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MeatKit/Icons/PreloadAssetsBuildItem.png b/Assets/MeatKit/Icons/PreloadAssetsBuildItem.png new file mode 100644 index 0000000..2f2c61c Binary files /dev/null and b/Assets/MeatKit/Icons/PreloadAssetsBuildItem.png differ diff --git a/Assets/MeatKit/Icons/PreloadAssetsBuildItem.png.meta b/Assets/MeatKit/Icons/PreloadAssetsBuildItem.png.meta new file mode 100644 index 0000000..7a54a44 --- /dev/null +++ b/Assets/MeatKit/Icons/PreloadAssetsBuildItem.png.meta @@ -0,0 +1,76 @@ +fileFormatVersion: 2 +guid: 151c1f5398ee70041a49c417b23f1846 +timeCreated: 1640061561 +licenseType: Pro +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 0 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + filterMode: 2 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MeatKit/Icons/StoreFilesBuildItem.png b/Assets/MeatKit/Icons/StoreFilesBuildItem.png new file mode 100644 index 0000000..d538714 Binary files /dev/null and b/Assets/MeatKit/Icons/StoreFilesBuildItem.png differ diff --git a/Assets/MeatKit/Icons/StoreFilesBuildItem.png.meta b/Assets/MeatKit/Icons/StoreFilesBuildItem.png.meta new file mode 100644 index 0000000..1684aad --- /dev/null +++ b/Assets/MeatKit/Icons/StoreFilesBuildItem.png.meta @@ -0,0 +1,76 @@ +fileFormatVersion: 2 +guid: 6fae6dfd178cd184180013acef55632c +timeCreated: 1640061322 +licenseType: Pro +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 0 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + filterMode: 2 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MeatKit/Managed.meta b/Assets/MeatKit/Managed.meta new file mode 100644 index 0000000..95971b0 --- /dev/null +++ b/Assets/MeatKit/Managed.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: c7a0d66f64ea9324e9fcfe43a9f69c4e +folderAsset: yes +timeCreated: 1638903534 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MeatKit/Managed/0Harmony.dll b/Assets/MeatKit/Managed/0Harmony.dll new file mode 100644 index 0000000..0452e6a Binary files /dev/null and b/Assets/MeatKit/Managed/0Harmony.dll differ diff --git a/Assets/MeatKit/Managed/0Harmony.dll.meta b/Assets/MeatKit/Managed/0Harmony.dll.meta new file mode 100644 index 0000000..314f0cd --- /dev/null +++ b/Assets/MeatKit/Managed/0Harmony.dll.meta @@ -0,0 +1,34 @@ +fileFormatVersion: 2 +guid: cfc6c4032c0e78f7c0480d3c1c93001e +timeCreated: 1637991225 +licenseType: Pro +PluginImporter: + serializedVersion: 2 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + isOverridable: 0 + platformData: + data: + first: + Any: + second: + enabled: 1 + settings: {} + data: + first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + data: + first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MeatKit/Managed/BepInEx.dll b/Assets/MeatKit/Managed/BepInEx.dll new file mode 100644 index 0000000..abe70fd Binary files /dev/null and b/Assets/MeatKit/Managed/BepInEx.dll differ diff --git a/Assets/MeatKit/Managed/BepInEx.dll.meta b/Assets/MeatKit/Managed/BepInEx.dll.meta new file mode 100644 index 0000000..5bd15f2 --- /dev/null +++ b/Assets/MeatKit/Managed/BepInEx.dll.meta @@ -0,0 +1,34 @@ +fileFormatVersion: 2 +guid: f0ebcb063f9204b9162f28fbb60fc29c +timeCreated: 1634082208 +licenseType: Pro +PluginImporter: + serializedVersion: 2 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + isOverridable: 0 + platformData: + data: + first: + Any: + second: + enabled: 1 + settings: {} + data: + first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + data: + first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MeatKit/Managed/DotNetZip.dll b/Assets/MeatKit/Managed/DotNetZip.dll new file mode 100644 index 0000000..f4e16eb Binary files /dev/null and b/Assets/MeatKit/Managed/DotNetZip.dll differ diff --git a/Assets/MeatKit/Managed/DotNetZip.dll.meta b/Assets/MeatKit/Managed/DotNetZip.dll.meta new file mode 100644 index 0000000..85719dd --- /dev/null +++ b/Assets/MeatKit/Managed/DotNetZip.dll.meta @@ -0,0 +1,34 @@ +fileFormatVersion: 2 +guid: 435f5990a4548dbc0126c23e6081aa8d +timeCreated: 1638843984 +licenseType: Pro +PluginImporter: + serializedVersion: 2 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + isOverridable: 0 + platformData: + data: + first: + Any: + second: + enabled: 1 + settings: {} + data: + first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + data: + first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MeatKit/Managed/MonoMod.Utils.dll b/Assets/MeatKit/Managed/MonoMod.Utils.dll new file mode 100644 index 0000000..0bfd861 Binary files /dev/null and b/Assets/MeatKit/Managed/MonoMod.Utils.dll differ diff --git a/Assets/MeatKit/Managed/MonoMod.Utils.dll.meta b/Assets/MeatKit/Managed/MonoMod.Utils.dll.meta new file mode 100644 index 0000000..516cf64 --- /dev/null +++ b/Assets/MeatKit/Managed/MonoMod.Utils.dll.meta @@ -0,0 +1,34 @@ +fileFormatVersion: 2 +guid: 7399badb939ce1137fff9ef0738fd1aa +timeCreated: 1637991225 +licenseType: Pro +PluginImporter: + serializedVersion: 2 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + isOverridable: 0 + platformData: + data: + first: + Any: + second: + enabled: 1 + settings: {} + data: + first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + data: + first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MeatKit/Managed/Sodalite.dll b/Assets/MeatKit/Managed/Sodalite.dll new file mode 100644 index 0000000..8a698e8 Binary files /dev/null and b/Assets/MeatKit/Managed/Sodalite.dll differ diff --git a/Assets/MeatKit/Managed/Sodalite.dll.meta b/Assets/MeatKit/Managed/Sodalite.dll.meta new file mode 100644 index 0000000..4b11987 --- /dev/null +++ b/Assets/MeatKit/Managed/Sodalite.dll.meta @@ -0,0 +1,34 @@ +fileFormatVersion: 2 +guid: 35077c065319ab23c8ea7477fa04223d +timeCreated: 1635021478 +licenseType: Pro +PluginImporter: + serializedVersion: 2 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + isOverridable: 0 + platformData: + data: + first: + Any: + second: + enabled: 1 + settings: {} + data: + first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + data: + first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MeatKit/Managed/Valve.Newtonsoft.Json.dll b/Assets/MeatKit/Managed/Valve.Newtonsoft.Json.dll new file mode 100644 index 0000000..dd434dc Binary files /dev/null and b/Assets/MeatKit/Managed/Valve.Newtonsoft.Json.dll differ diff --git a/Assets/MeatKit/Managed/Valve.Newtonsoft.Json.dll.meta b/Assets/MeatKit/Managed/Valve.Newtonsoft.Json.dll.meta new file mode 100644 index 0000000..6a56c72 --- /dev/null +++ b/Assets/MeatKit/Managed/Valve.Newtonsoft.Json.dll.meta @@ -0,0 +1,34 @@ +fileFormatVersion: 2 +guid: 99b8fb0fa0c1bbbbacd9654ef1e25df4 +timeCreated: 1636265531 +licenseType: Pro +PluginImporter: + serializedVersion: 2 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + isOverridable: 0 + platformData: + data: + first: + Any: + second: + enabled: 1 + settings: {} + data: + first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + data: + first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MeatKit/MeatKitPlugin.cs b/Assets/MeatKit/MeatKitPlugin.cs new file mode 100644 index 0000000..0cdd2d1 --- /dev/null +++ b/Assets/MeatKit/MeatKitPlugin.cs @@ -0,0 +1,89 @@ +#if H3VR_IMPORTED +using System.IO; +using System.Reflection; +using BepInEx; +using BepInEx.Configuration; +using UnityEngine; +using UnityEngine.SceneManagement; + +using TNHQoLImprovements; + +/* + * SUPER LARGE WARNING ABOUT THIS CLASS + * This class can be used to add custom behaviour to your generated BepInEx plugin. + * Please note, however, that all of the things in here already are REQUIRED and CANNOT BE CHANGED. + * There are LARGE TEXT WARNINGS above such items so you don't forget. + * You may add to this class so long as you do not modify anything with those notices (lest you want build errors) + * + * The class name and BepInPlugin attribute are modified at build-time to reflect your build settings. + * BepInDependency attributes will automatically be generated if they're required by a build item, otherwise + * may add it yourself here. + */ + +// DO NOT REMOVE OR CHANGE ANY OF THESE ATTRIBUTES +[BepInPlugin("MeatKit", "MeatKit Plugin", "1.0.0")] +[BepInProcess("h3vr.exe")] + +// DO NOT CHANGE THE NAME OF THIS CLASS. +public class MeatKitPlugin : BaseUnityPlugin +{ + // DO NOT CHANGE OR REMOVE THIS FIELD. +#pragma warning disable 414 + private static readonly string BasePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); +#pragma warning restore 414 + + public static AssetBundle bundle; + + public static ConfigEntry showHPBackground; + public static ConfigEntry hpBackgroundOpacity; + public static ConfigEntry showTokens; + public static ConfigEntry showHolds; + + private static InPlay instance; + private LeaderboardPlayerCountPatch lpc; + + private void SceneChanged(Scene from, Scene to) + { + //Logger.LogInfo(string.Format("scene chg: {0} --> {1}", from.name, to.name)); + if(GameObject.Find("_NewTAHReticle") != null) + { + instance = new GameObject().AddComponent(); + } + else + { + Destroy(instance); + } + } + + private void Awake() + { + // load asset bundle + bundle = AssetBundle.LoadFromFile(Path.Combine(BasePath, "tnh_qol_improvements")); + SceneManager.activeSceneChanged += SceneChanged; + LoadAssets(); + + // setup configuration + showHPBackground = Config.Bind("Health Counter", + "Background enabled", + true, + "Apply a background to the health text."); + hpBackgroundOpacity = Config.Bind("Health Counter", + "Background opacity", + 0.74f, + "Set opacity of health text's background (if enabled)."); + showTokens = Config.Bind("Game Info", + "Show Tokens", + true, + "Shows how many tokens the player has by their radar hand."); + showHolds = Config.Bind("Game Info", + "Show Holds", + true, + "Shows how many holds the player has completed by their radar hand."); + + // patch the leaderboard + lpc = new LeaderboardPlayerCountPatch(); + } + // DO NOT EDIT. + private void LoadAssets() {} +} +#endif \ No newline at end of file diff --git a/Assets/MeatKit/MeatKitPlugin.cs.meta b/Assets/MeatKit/MeatKitPlugin.cs.meta new file mode 100644 index 0000000..ca60980 --- /dev/null +++ b/Assets/MeatKit/MeatKitPlugin.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 22911b70b8624c13bc815f600dc9d5b4 +timeCreated: 1629440186 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MeatKit/OtherLoaderLoadingTest.unitypackage b/Assets/MeatKit/OtherLoaderLoadingTest.unitypackage new file mode 100644 index 0000000..1a2f313 Binary files /dev/null and b/Assets/MeatKit/OtherLoaderLoadingTest.unitypackage differ diff --git a/Assets/MeatKit/OtherLoaderLoadingTest.unitypackage.meta b/Assets/MeatKit/OtherLoaderLoadingTest.unitypackage.meta new file mode 100644 index 0000000..fb4b362 --- /dev/null +++ b/Assets/MeatKit/OtherLoaderLoadingTest.unitypackage.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f69811f758fe69d4a8db916798dae1d0 +timeCreated: 1641677517 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MeatKit/Tools.meta b/Assets/MeatKit/Tools.meta new file mode 100644 index 0000000..d3ba413 --- /dev/null +++ b/Assets/MeatKit/Tools.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7a617135c1b441e09689a962f3a634c8 +folderAsset: yes +timeCreated: 1617388092 +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MeatKit/Tools/Editor.meta b/Assets/MeatKit/Tools/Editor.meta new file mode 100644 index 0000000..0ad09bd --- /dev/null +++ b/Assets/MeatKit/Tools/Editor.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 909a2b7b1c734764287b9acd96752fc7 +folderAsset: yes +timeCreated: 1640643655 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MeatKit/Tools/Editor/EnumPicker.cs b/Assets/MeatKit/Tools/Editor/EnumPicker.cs new file mode 100644 index 0000000..283ec6d --- /dev/null +++ b/Assets/MeatKit/Tools/Editor/EnumPicker.cs @@ -0,0 +1,181 @@ +// Adapted from https://gist.github.com/kalineh/ad5135946f2009c36f755eea0a880998 + +using System; +using System.Collections.Generic; +using System.Linq; +#if H3VR_IMPORTED +using FistVR; +#endif +using UnityEditor; +using UnityEngine; + +public class EnumPickerWindow : EditorWindow +{ + private static GUIStyle _regularStyle; + private static GUIStyle _selectedStyle; + + private string _enumName; + private string _filter; + + private Action _onSelectCallback; + + private EditorWindow _parent; + private Vector2 _scroll; + private List _valuesFiltered; + private List _valuesRaw; + + private void OnGUI() + { + GUILayout.Label(string.Format("Enum Type: {0}", _enumName)); + + GUI.SetNextControlName("filter"); + var filterUpdate = GUILayout.TextField(_filter); + if (filterUpdate != _filter) + FilterValues(filterUpdate); + + // always focused + GUI.FocusControl("filter"); + + _scroll = GUILayout.BeginScrollView(_scroll); + + for (var i = 0; i < _valuesFiltered.Count; ++i) + { + var value = _valuesFiltered[i]; + var style = i == 0 ? _selectedStyle : _regularStyle; + var rect = GUILayoutUtility.GetRect(new GUIContent(value), style); + + var clicked = GUI.Button(rect, value); + if (clicked) + { + GUILayout.EndScrollView(); + + _onSelectCallback(value); + Close(); + _parent.Repaint(); + _parent.Focus(); + + return; + } + } + + GUILayout.EndScrollView(); + + if (Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Return) + { + if (_valuesFiltered.Count > 0) + _onSelectCallback(_valuesFiltered[0]); + + Close(); + _parent.Repaint(); + _parent.Focus(); + } + + if (Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Escape) + { + Close(); + _parent.Repaint(); + _parent.Focus(); + } + } + + public void OnLostFocus() + { + Close(); + } + + public void ShowCustom(string enumName, List values, Rect rect, Action onSelect) + { + _regularStyle = new GUIStyle(EditorStyles.label); + _regularStyle.active = _regularStyle.normal; + + _selectedStyle = new GUIStyle(EditorStyles.label); + _selectedStyle.normal = _selectedStyle.focused; + _selectedStyle.active = _selectedStyle.focused; + + _enumName = enumName; + _valuesRaw = new List(values); + _valuesFiltered = new List(values); + _filter = ""; + _onSelectCallback = onSelect; + + _parent = focusedWindow; + + var screenRect = rect; + var screenSize = new Vector2(400, 400); + + screenRect.position = GUIUtility.GUIToScreenPoint(screenRect.position); + + ShowAsDropDown(screenRect, screenSize); + Focus(); + + GUI.FocusControl("filter"); + } + + private void FilterValues(string filterUpdate) + { + _filter = filterUpdate; + var filterLower = _filter.ToLower(); + _valuesFiltered.Clear(); + foreach (var value in from value in _valuesRaw + let lower = value.ToLower() + where lower.Contains(filterLower) + select value) + _valuesFiltered.Add(value); + } +} + +public class EnumPicker : PropertyDrawer +{ + private EnumPickerWindow _window; + + public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) + { + Array valuesRaw = null; + Type enumType = fieldInfo.FieldType; + if (enumType.IsArray) enumType = enumType.GetElementType(); //this turns the enum array into just the enum to prevent issues with arrays of enums + + valuesRaw = Enum.GetValues(enumType); + if (valuesRaw.Length <= 0) + return; + var valuesStr = new List(); + for (var i = 0; i < valuesRaw.Length; ++i) + { + object raw = valuesRaw.GetValue(i); + var str = raw.ToString(); + valuesStr.Add(str); + } + string enumName = enumType.Name; + string currentName = Enum.GetName(enumType, property.intValue); + EditorGUI.PrefixLabel(position, label); + GUI.SetNextControlName(property.propertyPath); + var fieldRect = new Rect(position.x + EditorGUIUtility.labelWidth, position.y, + position.width - EditorGUIUtility.labelWidth, position.height); + if (GUI.Button(fieldRect, currentName, EditorStyles.popup)) + { + _window = EditorWindow.GetWindow(); + Action callback = str => + { + var index = (int) Convert.ChangeType(Enum.Parse(enumType, str), enumType); + property.serializedObject.Update(); + property.intValue = index; + property.serializedObject.ApplyModifiedProperties(); + }; + _window.ShowCustom(enumName, valuesStr, fieldRect, callback); + _window.Focus(); + } + } +} + +#if H3VR_IMPORTED +[CustomPropertyDrawer(typeof(FireArmMagazineType))] +[CustomPropertyDrawer(typeof(FireArmClipType))] +[CustomPropertyDrawer(typeof(FireArmRoundClass))] +[CustomPropertyDrawer(typeof(ItemSpawnerObjectDefinition.ItemSpawnerCategory))] +[CustomPropertyDrawer(typeof(ItemSpawnerID.EItemCategory))] +[CustomPropertyDrawer(typeof(ItemSpawnerID.ESubCategory))] +[CustomPropertyDrawer(typeof(FireArmRoundType))] +[CustomPropertyDrawer(typeof(SosigEnemyID))] +public class EnumDrawers : EnumPicker +{ +} +#endif diff --git a/Assets/MeatKit/Tools/Editor/EnumPicker.cs.meta b/Assets/MeatKit/Tools/Editor/EnumPicker.cs.meta new file mode 100644 index 0000000..6514bb1 --- /dev/null +++ b/Assets/MeatKit/Tools/Editor/EnumPicker.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 27e4b73d795c232439cf3aee1d6ed3ba +timeCreated: 1628222780 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MeatKit/Tools/Editor/IconCameraEditor.cs b/Assets/MeatKit/Tools/Editor/IconCameraEditor.cs new file mode 100644 index 0000000..217a0cf --- /dev/null +++ b/Assets/MeatKit/Tools/Editor/IconCameraEditor.cs @@ -0,0 +1,70 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEditor; +using UnityEngine; + +[CustomEditor(typeof(IconCamera))] +[CanEditMultipleObjects] +public class IconCameraEditor : Editor { + + + Texture2D previewTexture = null; + + public override void OnInspectorGUI() + { + serializedObject.Update(); + + var property = serializedObject.GetIterator(); + if (!property.NextVisible(true)) return; + do EditorGUILayout.PropertyField(property, true); + while (property.NextVisible(false)); + + serializedObject.ApplyModifiedProperties(); + + IconCamera iconCamera = serializedObject.targetObject as IconCamera; + iconCamera.thisCamera.depthTextureMode = iconCamera.CameraDepthMode; + + if (previewTexture != null) + { + GUILayout.BeginVertical("Box"); + + GUIStyle style = new GUIStyle(); + style.alignment = TextAnchor.UpperCenter; + style.fixedWidth = Screen.width - 50; + style.fixedHeight = Screen.width - 50; + GUILayout.Label(previewTexture, style); + + GUILayout.EndVertical(); + } + + + + if (GUILayout.Button("Update Preview")) + { + if (iconCamera.renderTexture != null) + { + RenderTexture temp = RenderTexture.active; + RenderTexture.active = iconCamera.renderTexture; + Texture2D texture = new Texture2D(iconCamera.renderTexture.width, iconCamera.renderTexture.height); + texture.ReadPixels(new Rect(0, 0, iconCamera.renderTexture.width, iconCamera.renderTexture.height), 0, 0); + texture.Apply(); + RenderTexture.active = temp; + + texture = iconCamera.FlipTexture(texture); + + if (iconCamera.background != null) + { + texture = iconCamera.AddBackground(texture, iconCamera.background); + } + + previewTexture = texture; + } + } + + + if (GUILayout.Button("Take Picture")) + { + Selection.activeGameObject.GetComponent().Capture(); + } + } +} diff --git a/Assets/MeatKit/Tools/Editor/IconCameraEditor.cs.meta b/Assets/MeatKit/Tools/Editor/IconCameraEditor.cs.meta new file mode 100644 index 0000000..bde636b --- /dev/null +++ b/Assets/MeatKit/Tools/Editor/IconCameraEditor.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: b4607bcf07fdb67428d41b6bd2f9b2fb +timeCreated: 1640645560 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MeatKit/Tools/Editor/PrefabLoader.cs b/Assets/MeatKit/Tools/Editor/PrefabLoader.cs new file mode 100644 index 0000000..8582b43 --- /dev/null +++ b/Assets/MeatKit/Tools/Editor/PrefabLoader.cs @@ -0,0 +1,37 @@ +using System; +using UnityEditor; +using UnityEngine; + +public class PrefabLoader : EditorWindow +{ + private AssetBundle _bundle; + private string[] _assets = new string[0]; + private int _selectedAsset = 0; + + [MenuItem("MeatKit/Asset Bundle/Prefab Loader")] + private static void Init() + { + GetWindow().Show(); + } + + private void OnGUI() + { + if (GUILayout.Button("Select Asset Bundle")) + { + // If there's already a bundle loaded, unload it. + if (_bundle) _bundle.Unload(false); + + // Ask for the new bundle, load it, and get its assets + string assetBundlePath = EditorUtility.OpenFilePanel("Select Asset Bundle", string.Empty, string.Empty); + _bundle = AssetBundle.LoadFromFile(assetBundlePath); + _assets = _bundle.GetAllAssetNames(); + _selectedAsset = 0; + } + + if (_assets.Length > 0) + { + _selectedAsset = EditorGUILayout.Popup(_selectedAsset, _assets); + if (GUILayout.Button("Spawn")) Instantiate(_bundle.LoadAsset(_assets[_selectedAsset])); + } + } +} \ No newline at end of file diff --git a/Assets/MeatKit/Tools/Editor/PrefabLoader.cs.meta b/Assets/MeatKit/Tools/Editor/PrefabLoader.cs.meta new file mode 100644 index 0000000..fd54164 --- /dev/null +++ b/Assets/MeatKit/Tools/Editor/PrefabLoader.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 4d4b78186f45453aa4abc82dc1364363 +timeCreated: 1637988640 \ No newline at end of file diff --git a/Assets/MeatKit/Tools/GunRipper.meta b/Assets/MeatKit/Tools/GunRipper.meta new file mode 100644 index 0000000..33487ab --- /dev/null +++ b/Assets/MeatKit/Tools/GunRipper.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: bf9dd0c01456ee745baa552ed8b66182 +folderAsset: yes +timeCreated: 1641758894 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MeatKit/Tools/GunRipper/Editor.meta b/Assets/MeatKit/Tools/GunRipper/Editor.meta new file mode 100644 index 0000000..c3d7f35 --- /dev/null +++ b/Assets/MeatKit/Tools/GunRipper/Editor.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: b2cc9af527c35194481307c551f26f04 +folderAsset: yes +timeCreated: 1641758894 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MeatKit/Tools/GunRipper/Editor/GunRipperWindow.cs b/Assets/MeatKit/Tools/GunRipper/Editor/GunRipperWindow.cs new file mode 100644 index 0000000..c3aed0f --- /dev/null +++ b/Assets/MeatKit/Tools/GunRipper/Editor/GunRipperWindow.cs @@ -0,0 +1,230 @@ +#if H3VR_IMPORTED +using FistVR; +#endif +using MeatKit; +using System; +using System.Collections; +using System.Collections.Generic; +using System.IO; +using System.Reflection; +using UnityEditor; +using UnityEngine; + +public class GunRipperWindow : EditorWindow +{ + + public GameObject SelectedGameObject; + public string ExportPath = "Meatkit/Tools/GunRipper/Export"; + + + [MenuItem("Tools/Gun Ripper")] + public static void Open() + { + GetWindow("Gun Ripper").Show(); + } + + #if H3VR_IMPORTED + + private void OnGUI() + { + EditorGUILayout.LabelField("Selected GameObject", EditorStyles.boldLabel); + + EditorGUI.BeginChangeCheck(); + SelectedGameObject = EditorGUILayout.ObjectField(SelectedGameObject, typeof(GameObject), true) as GameObject; + + if (string.IsNullOrEmpty(ExportPath)) ExportPath = "Meatkit/Tools/GunRipper/Export"; + ExportPath = EditorGUILayout.TextField(ExportPath); + + if (!SelectedGameObject) + { + GUILayout.Label("Please select a game object"); + return; + } + + EditorGUILayout.Space(); + + FVRFireArm firearmComp = SelectedGameObject.GetComponent(); + FVRFireArmMagazine magazineComp = SelectedGameObject.GetComponent(); + FVRFireArmAttachment attachment = SelectedGameObject.GetComponent(); + + if (firearmComp != null && firearmComp.AudioClipSet != null && GUILayout.Button("Rip Firearm Audio")) + { + Debug.Log("Ripping Audio!"); + RipAudio(firearmComp.AudioClipSet, "AudioSet"); + } + + if (magazineComp != null && magazineComp.Profile != null && GUILayout.Button("Rip Magazine Audio")) + { + Debug.Log("Ripping Audio!"); + RipAudio(magazineComp.Profile, "AudioSet"); + } + + if(attachment != null && (attachment.AudClipAttach != null || attachment.AudClipDettach != null) && GUILayout.Button("Rip Attachment Audio")) + { + if(attachment.AudClipAttach != null) + { + Debug.Log("Ripping Audio!"); + RipAudio(attachment.AudClipAttach, "AudioAttach"); + } + + if (attachment.AudClipDettach != null) + { + Debug.Log("Ripping Audio!"); + RipAudio(attachment.AudClipDettach, "AudioDettach"); + } + } + + if (firearmComp != null && (firearmComp.RecoilProfile != null || firearmComp.RecoilProfileStocked != null) && GUILayout.Button("Rip Firearm Recoil")) + { + if(firearmComp.RecoilProfile != null) + { + Debug.Log("Ripping Stockless Recoil!"); + RipRecoil(firearmComp.RecoilProfile, "Recoil"); + } + + if(firearmComp.RecoilProfileStocked != null) + { + Debug.Log("Ripping Stocked Recoil!"); + RipRecoil(firearmComp.RecoilProfileStocked, "RecoilStocked"); + } + } + + + } + + + + private void RipAudio(AudioEvent audioEvent, string suffix) + { + string exportFolderPath = "Assets/" + ExportPath.Trim('/'); + string destinationFolderName = SelectedGameObject.name + "_Rip"; + string destinationFolderPath = exportFolderPath + "/" + destinationFolderName; + + if (!AssetDatabase.IsValidFolder(destinationFolderPath)) + { + AssetDatabase.CreateFolder(exportFolderPath, destinationFolderName); + } + + RipAudioClips(audioEvent, destinationFolderPath); + } + + + private void RipAudio(FVRFirearmAudioSet audioSet, string suffix) + { + string exportFolderPath = "Assets/" + ExportPath.Trim('/'); + string destinationFolderName = SelectedGameObject.name + "_Rip"; + string destinationFolderPath = exportFolderPath + "/" + destinationFolderName; + string audioPath = destinationFolderPath + "/" + SelectedGameObject.name + "_" + suffix + ".asset"; + + if (!AssetDatabase.IsValidFolder(destinationFolderPath)) + { + AssetDatabase.CreateFolder(exportFolderPath, destinationFolderName); + } + + FVRFirearmAudioSet audioCopy = CreateInstance(); + CopyFields(audioCopy, audioSet); + RipAudioClips(audioCopy, destinationFolderPath); + + AssetDatabase.DeleteAsset(audioPath); + AssetDatabase.CreateAsset(audioCopy, audioPath); + AssetDatabase.SaveAssets(); + } + + private void RipRecoil(FVRFireArmRecoilProfile recoil, string suffix) + { + string exportFolderPath = "Assets/" + ExportPath.Trim('/'); + string destinationFolderName = SelectedGameObject.name + "_Rip"; + string destinationFolderPath = exportFolderPath + "/" + destinationFolderName; + string recoilPath = destinationFolderPath + "/" + SelectedGameObject.name + "_" + suffix + ".asset"; + + if (!AssetDatabase.IsValidFolder(destinationFolderPath)) + { + AssetDatabase.CreateFolder(exportFolderPath, destinationFolderName); + } + + FVRFireArmRecoilProfile recoilCopy = CreateInstance(); + CopyFields(recoilCopy, recoil); + + AssetDatabase.DeleteAsset(recoilPath); + AssetDatabase.CreateAsset(recoilCopy, recoilPath); + AssetDatabase.SaveAssets(); + } + + + + + private void CopyFields(UnityEngine.Object copyAsset, UnityEngine.Object origAsset, bool allowMismatch = false) + { + Type type = origAsset.GetType(); + if (!allowMismatch && type != copyAsset.GetType()) + { + return; + } + + BindingFlags flags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Default; + PropertyInfo[] pinfos = type.GetProperties(flags); + foreach (var pinfo in pinfos) + { + + if (pinfo.CanWrite) + { + try + { + pinfo.SetValue(copyAsset, pinfo.GetValue(origAsset, null), null); + } + catch + { + + } + } + } + FieldInfo[] finfos = type.GetFields(flags); + foreach (var finfo in finfos) + { + finfo.SetValue(copyAsset, finfo.GetValue(origAsset)); + } + } + + + private void RipAudioClips(System.Object asset, string exportPath) + { + Type type = asset.GetType(); + BindingFlags flags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Default; + + FieldInfo[] finfos = type.GetFields(flags); + foreach (var finfo in finfos) + { + Debug.Log("Field: " + finfo.Name + ", Type: " + finfo.FieldType); + + if(finfo.GetValue(asset) is List) + { + Debug.Log("List!"); + + List audioList = finfo.GetValue(asset) as List; + + for (int i = 0; i < audioList.Count; i++) + { + AudioClip clip = audioList[i]; + if(clip != null) + { + Debug.Log("Audio Clip! " + clip.name); + audioList[i] = SavWav.Save(exportPath, clip); + } + } + } + + if(finfo.FieldType == typeof(AudioEvent)) + { + Debug.Log("Audio Event!"); + RipAudioClips(finfo.GetValue(asset), exportPath); + } + } + } + +#endif +} + + + + + diff --git a/Assets/MeatKit/Tools/GunRipper/Editor/GunRipperWindow.cs.meta b/Assets/MeatKit/Tools/GunRipper/Editor/GunRipperWindow.cs.meta new file mode 100644 index 0000000..c840147 --- /dev/null +++ b/Assets/MeatKit/Tools/GunRipper/Editor/GunRipperWindow.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 80429e2d9786fda44b01ab04cadd4b75 +timeCreated: 1641758895 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MeatKit/Tools/GunRipper/Editor/SavWav.cs b/Assets/MeatKit/Tools/GunRipper/Editor/SavWav.cs new file mode 100644 index 0000000..8680646 --- /dev/null +++ b/Assets/MeatKit/Tools/GunRipper/Editor/SavWav.cs @@ -0,0 +1,190 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.IO; +using UnityEditor; +using UnityEngine; + +/// +/// Allows for saving audio clips to wav file. +/// Code found here: https://gist.github.com/darktable/2317063 +/// +public static class SavWav +{ + + const int HEADER_SIZE = 44; + struct ClipData + { + + public int samples; + public int channels; + public float[] samplesData; + + } + + public static AudioClip Save(string path, AudioClip clip) + { + var assetPath = path.Trim('/') + "/" + clip.name + ".wav"; + var filepath = Directory.GetParent(Application.dataPath) + "/" + path.Trim('/') + "/" + clip.name + ".wav"; + + Debug.Log(filepath); + Debug.Log(assetPath); + + AssetDatabase.DeleteAsset(assetPath); + + // Make sure directory exists if user is saving to sub dir. + ClipData clipdata = new ClipData(); + clipdata.samples = clip.samples; + clipdata.channels = clip.channels; + float[] dataFloat = new float[clip.samples * clip.channels]; + clip.GetData(dataFloat, 0); + clipdata.samplesData = dataFloat; + + using (var fileStream = CreateEmpty(filepath)) + { + MemoryStream memstrm = new MemoryStream(); + ConvertAndWrite(memstrm, clipdata); + memstrm.WriteTo(fileStream); + WriteHeader(fileStream, clip); + } + + AssetDatabase.ImportAsset(assetPath, ImportAssetOptions.ForceUpdate); + AssetDatabase.Refresh(); + + return (AudioClip)AssetDatabase.LoadAssetAtPath(assetPath, typeof(AudioClip)); + } + + public static AudioClip TrimSilence(AudioClip clip, float min) + { + var samples = new float[clip.samples]; + + clip.GetData(samples, 0); + + return TrimSilence(new List(samples), min, clip.channels, clip.frequency); + } + + public static AudioClip TrimSilence(List samples, float min, int channels, int hz) + { + return TrimSilence(samples, min, channels, hz, false, false); + } + + public static AudioClip TrimSilence(List samples, float min, int channels, int hz, bool _3D, bool stream) + { + int i; + + for (i = 0; i < samples.Count; i++) + { + if (Mathf.Abs(samples[i]) > min) + { + break; + } + } + + samples.RemoveRange(0, i); + + for (i = samples.Count - 1; i > 0; i--) + { + if (Mathf.Abs(samples[i]) > min) + { + break; + } + } + + samples.RemoveRange(i, samples.Count - i); + + var clip = AudioClip.Create("TempClip", samples.Count, channels, hz, _3D, stream); + + clip.SetData(samples.ToArray(), 0); + + return clip; + } + + static FileStream CreateEmpty(string filepath) + { + var fileStream = new FileStream(filepath, FileMode.Create); + byte emptyByte = new byte(); + + for (int i = 0; i < HEADER_SIZE; i++) //preparing the header + { + fileStream.WriteByte(emptyByte); + } + + return fileStream; + } + + static void ConvertAndWrite(MemoryStream memStream, ClipData clipData) + { + float[] samples = new float[clipData.samples * clipData.channels]; + + samples = clipData.samplesData; + + Int16[] intData = new Int16[samples.Length]; + + Byte[] bytesData = new Byte[samples.Length * 2]; + + const float rescaleFactor = 32767; //to convert float to Int16 + + for (int i = 0; i < samples.Length; i++) + { + intData[i] = (short)(samples[i] * rescaleFactor); + //Debug.Log (samples [i]); + } + Buffer.BlockCopy(intData, 0, bytesData, 0, bytesData.Length); + memStream.Write(bytesData, 0, bytesData.Length); + } + + static void WriteHeader(FileStream fileStream, AudioClip clip) + { + + var hz = clip.frequency; + var channels = clip.channels; + var samples = clip.samples; + + fileStream.Seek(0, SeekOrigin.Begin); + + Byte[] riff = System.Text.Encoding.UTF8.GetBytes("RIFF"); + fileStream.Write(riff, 0, 4); + + Byte[] chunkSize = BitConverter.GetBytes(fileStream.Length - 8); + fileStream.Write(chunkSize, 0, 4); + + Byte[] wave = System.Text.Encoding.UTF8.GetBytes("WAVE"); + fileStream.Write(wave, 0, 4); + + Byte[] fmt = System.Text.Encoding.UTF8.GetBytes("fmt "); + fileStream.Write(fmt, 0, 4); + + Byte[] subChunk1 = BitConverter.GetBytes(16); + fileStream.Write(subChunk1, 0, 4); + + UInt16 two = 2; + UInt16 one = 1; + + Byte[] audioFormat = BitConverter.GetBytes(one); + fileStream.Write(audioFormat, 0, 2); + + Byte[] numChannels = BitConverter.GetBytes(channels); + fileStream.Write(numChannels, 0, 2); + + Byte[] sampleRate = BitConverter.GetBytes(hz); + fileStream.Write(sampleRate, 0, 4); + + Byte[] byteRate = BitConverter.GetBytes(hz * channels * 2); // sampleRate * bytesPerSample*number of channels, here 44100*2*2 + fileStream.Write(byteRate, 0, 4); + + UInt16 blockAlign = (ushort)(channels * 2); + fileStream.Write(BitConverter.GetBytes(blockAlign), 0, 2); + + UInt16 bps = 16; + Byte[] bitsPerSample = BitConverter.GetBytes(bps); + fileStream.Write(bitsPerSample, 0, 2); + + Byte[] datastring = System.Text.Encoding.UTF8.GetBytes("data"); + fileStream.Write(datastring, 0, 4); + + Byte[] subChunk2 = BitConverter.GetBytes(samples * channels * 2); + fileStream.Write(subChunk2, 0, 4); + + // fileStream.Close(); + } +} diff --git a/Assets/MeatKit/Tools/GunRipper/Editor/SavWav.cs.meta b/Assets/MeatKit/Tools/GunRipper/Editor/SavWav.cs.meta new file mode 100644 index 0000000..bb73ef1 --- /dev/null +++ b/Assets/MeatKit/Tools/GunRipper/Editor/SavWav.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 16f4f028d3b75704fbc40b3122b0c568 +timeCreated: 1641758895 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MeatKit/Tools/IconAssets.meta b/Assets/MeatKit/Tools/IconAssets.meta new file mode 100644 index 0000000..7910a30 --- /dev/null +++ b/Assets/MeatKit/Tools/IconAssets.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 67b0d6a5c1b85824bbcb13aefd6b9879 +folderAsset: yes +timeCreated: 1640644671 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MeatKit/Tools/IconAssets/Backgrounds.meta b/Assets/MeatKit/Tools/IconAssets/Backgrounds.meta new file mode 100644 index 0000000..f71b5c4 --- /dev/null +++ b/Assets/MeatKit/Tools/IconAssets/Backgrounds.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 7390fd4499410bb4da9b31d5f5773db7 +folderAsset: yes +timeCreated: 1640720511 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MeatKit/Tools/IconAssets/Backgrounds/IconBackground 1.png b/Assets/MeatKit/Tools/IconAssets/Backgrounds/IconBackground 1.png new file mode 100644 index 0000000..0f162c9 Binary files /dev/null and b/Assets/MeatKit/Tools/IconAssets/Backgrounds/IconBackground 1.png differ diff --git a/Assets/MeatKit/Tools/IconAssets/Backgrounds/IconBackground 1.png.meta b/Assets/MeatKit/Tools/IconAssets/Backgrounds/IconBackground 1.png.meta new file mode 100644 index 0000000..84e7315 --- /dev/null +++ b/Assets/MeatKit/Tools/IconAssets/Backgrounds/IconBackground 1.png.meta @@ -0,0 +1,76 @@ +fileFormatVersion: 2 +guid: 95d557f2518a98942b8b75fb4c572df2 +timeCreated: 1640801294 +licenseType: Free +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 1 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MeatKit/Tools/IconAssets/Materials.meta b/Assets/MeatKit/Tools/IconAssets/Materials.meta new file mode 100644 index 0000000..86ae946 --- /dev/null +++ b/Assets/MeatKit/Tools/IconAssets/Materials.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: e2c6465d11669fe48a03a5e0a4858961 +folderAsset: yes +timeCreated: 1640644677 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MeatKit/Tools/IconAssets/Materials/BlackWhiteEffect.mat b/Assets/MeatKit/Tools/IconAssets/Materials/BlackWhiteEffect.mat new file mode 100644 index 0000000..d88f8ee --- /dev/null +++ b/Assets/MeatKit/Tools/IconAssets/Materials/BlackWhiteEffect.mat @@ -0,0 +1,86 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: BlackWhiteEffect + m_Shader: {fileID: 4800000, guid: ca1ad64f6fe2663418174309f73c9ec5, type: 3} + m_ShaderKeywords: + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _BumpScale: 1 + - _ClipDistance: 10 + - _ColorBands: 2 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 1 + - _LightToNormalFactor: 0.366 + - _MaxBrightness: 9.34 + - _Metallic: 0 + - _MinBrightness: -1.57 + - _Mode: 0 + - _NormalCutoff: 0.548 + - _NormalMultiplier: 11.1 + - _NormalPower: 4.08 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _UVSec: 0 + - _ZWrite: 1 + m_Colors: + - _BrightColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _DarkColor: {r: 0, g: 0, b: 0, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} diff --git a/Assets/MeatKit/Tools/IconAssets/Materials/BlackWhiteEffect.mat.meta b/Assets/MeatKit/Tools/IconAssets/Materials/BlackWhiteEffect.mat.meta new file mode 100644 index 0000000..5131d26 --- /dev/null +++ b/Assets/MeatKit/Tools/IconAssets/Materials/BlackWhiteEffect.mat.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 95bd255dc1046994d88a5333bd4df105 +timeCreated: 1640641178 +licenseType: Free +NativeFormatImporter: + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MeatKit/Tools/IconAssets/Shaders.meta b/Assets/MeatKit/Tools/IconAssets/Shaders.meta new file mode 100644 index 0000000..1bc468d --- /dev/null +++ b/Assets/MeatKit/Tools/IconAssets/Shaders.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 3d764943143e36d439f718a1ba9ad47c +folderAsset: yes +timeCreated: 1640644682 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MeatKit/Tools/IconAssets/Shaders/BlackWhiteEffect.shader b/Assets/MeatKit/Tools/IconAssets/Shaders/BlackWhiteEffect.shader new file mode 100644 index 0000000..5933b32 --- /dev/null +++ b/Assets/MeatKit/Tools/IconAssets/Shaders/BlackWhiteEffect.shader @@ -0,0 +1,83 @@ +Shader "Image/BlackWhiteEffect" +{ + Properties + { + _MainTex ("Texture", 2D) = "white" {} + _MinBrightness("Min Brightness", Float) = 0 + _MaxBrightness("Max Brightness", Float) = 1 + _ColorBands("Color Bands", Float) = 1000 + _DarkColor("Dark Color", Color) = (0, 0, 0, 1) + _BrightColor("Bright Color", Color) = (1, 1, 1, 1) + _LightToNormalFactor("Light To Normal Factor", Range(0, 1)) = 1 + } + SubShader + { + // No culling or depth + Cull Off ZWrite Off ZTest Always + + Pass + { + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + + #include "UnityCG.cginc" + + struct appdata + { + float4 vertex : POSITION; + float2 uv : TEXCOORD0; + }; + + struct v2f + { + float2 uv : TEXCOORD0; + float4 vertex : SV_POSITION; + }; + + float remap(float value, float from1, float to1, float from2, float to2) { + return (value - from1) / (to1 - from1) * (to2 - from2) + from2; + } + + + v2f vert (appdata v) + { + v2f o; + o.vertex = UnityObjectToClipPos(v.vertex); + o.uv = v.uv; + return o; + } + + sampler2D _MainTex, _CameraDepthNormalsTexture; + float _MinBrightness, _MaxBrightness, _ColorBands, _LightToNormalFactor; + fixed4 _DarkColor, _BrightColor; + + fixed4 frag (v2f i) : SV_Target + { + float4 depthnormal = tex2D(_CameraDepthNormalsTexture, i.uv); + fixed4 col = tex2D(_MainTex, i.uv); + + //decode depthnormal + float3 normal; + float depth; + DecodeDepthNormal(depthnormal, depth, normal); + + //Get the luminance and process it + fixed normalLuminance = Luminance(fixed3(normal.b, normal.b, normal.b)); + fixed lightLuminance = Luminance(fixed3(col.r, col.g, col.b)); + + fixed luminance = lerp(normalLuminance, lightLuminance, _LightToNormalFactor); + + luminance = remap(luminance, 0, 1, _MinBrightness, _MaxBrightness); + luminance = floor(luminance * _ColorBands) / _ColorBands; + + float depthFactor = 1 - step(1, depth); + fixed4 output = lerp(_DarkColor, _BrightColor, luminance); + output = fixed4(output.r, output.g, output.b, depthFactor); + + return output; + } + ENDCG + } + } +} diff --git a/Assets/MeatKit/Tools/IconAssets/Shaders/BlackWhiteEffect.shader.meta b/Assets/MeatKit/Tools/IconAssets/Shaders/BlackWhiteEffect.shader.meta new file mode 100644 index 0000000..4a72a2c --- /dev/null +++ b/Assets/MeatKit/Tools/IconAssets/Shaders/BlackWhiteEffect.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: ca1ad64f6fe2663418174309f73c9ec5 +timeCreated: 1640641164 +licenseType: Free +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MeatKit/Tools/IconCamera.cs b/Assets/MeatKit/Tools/IconCamera.cs new file mode 100644 index 0000000..41a7eea --- /dev/null +++ b/Assets/MeatKit/Tools/IconCamera.cs @@ -0,0 +1,204 @@ + +#if UNITY_EDITOR +using System.IO; +using UnityEngine; +using UnityEditor; + +[ExecuteInEditMode] +public class IconCamera : MonoBehaviour +{ + [Header("Hover over variables to show additional tooltips.")] + [Tooltip("Use this to trigger the capture of an icon IN PLAYMODE ONLY!")] + public KeyCode iconCaptureKey; + + [Tooltip("Use this checkbox like a button to trigger the capture of an icon (Editor or Playmode).")] + public bool iconCaptureButton; + + [Tooltip("Path to icons folder (without \"Assets\" in the beginning).")] + public string path = "Icons"; + + [Tooltip("Name of the generated Icon without a file extension (no \".png\" required).")] + public string iconName = "ExampleIcon"; + + [Tooltip("The depth texture mode of the camera. Some effects will require either DepthNormals or Depth to work correctly")] + public DepthTextureMode CameraDepthMode = DepthTextureMode.DepthNormals; + + [Tooltip("Material that determines the post effect of the image")] + public Material effectMaterial; + + [Tooltip("The background image that will be applied in areas with full transparency")] + public Texture2D background; + + [HideInInspector] + public RenderTexture renderTexture; + + + public Camera thisCamera + { + get + { + if (!_camera) + { + _camera = this.gameObject.GetComponent(); + } + + return _camera; + } + } + private Camera _camera; + + + private void Update() + { + if (Input.GetKeyDown(iconCaptureKey)) + { + Capture(); + } + } + + + void OnRenderImage(RenderTexture source, RenderTexture destination) + { + if(renderTexture != null) + { + RenderTexture.ReleaseTemporary(renderTexture); + } + + if (effectMaterial != null) + { + Graphics.Blit(source, destination, effectMaterial); + } + else + { + Graphics.Blit(source, destination); + } + + renderTexture = RenderTexture.GetTemporary(source.width, source.height); + Graphics.Blit(destination, renderTexture); + } + + public void Capture() + { + Debug.Log("Say Cheese!"); + + //Manually calling render on the camera caused editor lockup with larger resolutions + //thisCamera.Render(); + + RenderTexture.active = renderTexture; + Texture2D texture = new Texture2D(renderTexture.width, renderTexture.height); + texture.ReadPixels(new Rect(0, 0, renderTexture.width, renderTexture.height), 0, 0); + texture.Apply(); + + texture = FlipTexture(texture); + + if(background != null) + { + texture = AddBackground(texture, background); + } + + + byte[] bytes = texture.EncodeToPNG(); + + string imagePath = Application.dataPath + "/" + path + "/" + iconName + ".png"; + string assetPath = "Assets" + "/" + path + "/" + iconName + ".png"; + File.WriteAllBytes(imagePath, bytes); + + AssetDatabase.ImportAsset(assetPath, ImportAssetOptions.ForceUpdate); + + + TextureImporter importer = (TextureImporter)TextureImporter.GetAtPath(assetPath); + + importer.isReadable = true; + importer.textureType = TextureImporterType.Sprite; + importer.spriteImportMode = SpriteImportMode.Single; + importer.alphaSource = TextureImporterAlphaSource.FromInput; + importer.alphaIsTransparency = true; + importer.mipmapEnabled = false; + importer.wrapMode = TextureWrapMode.Clamp; + + EditorUtility.SetDirty(importer); + importer.SaveAndReimport(); + + AssetDatabase.Refresh(); + } + + + + /// + /// Returns a flipped copy of the given texture + /// Taken from this forum: https://forum.unity.com/threads/flipping-texture2d-image-within-unity.35974/ + /// + /// + /// + public Texture2D FlipTexture(Texture2D original) + { + Texture2D flipped = new Texture2D(original.width, original.height); + + int origWidth = original.width; + int origHeight = original.height; + + for (int x = 0; x < origWidth; x++) + { + for (int y = 0; y < origHeight; y++) + { + flipped.SetPixel(x, origHeight - y - 1, original.GetPixel(x, y)); + } + } + flipped.Apply(); + + return flipped; + } + + + public Texture2D AddBackground(Texture2D original, Texture2D background) + { + Texture2D result = new Texture2D(original.width, original.height); + + int origWidth = original.width; + int origHeight = original.height; + int backWidth = background.width; + int backHeight = background.height; + + for (int x = 0; x < origWidth; x++) + { + for (int y = 0; y < origHeight; y++) + { + Color originalPixel = original.GetPixel(x, y); + + if(originalPixel.a == 0) + { + int backX = (int)Remap(x, 0, origWidth, 0, backWidth); + int backY = (int)Remap(y, 0, origHeight, 0, backHeight); + result.SetPixel(x, y, background.GetPixel(backX, backY)); + } + else + { + result.SetPixel(x, y, originalPixel); + } + } + } + + result.Apply(); + + return result; + } + + /// + /// Maps a given value from one range to another + /// Taken from this forum: https://forum.unity.com/threads/re-map-a-number-from-one-range-to-another.119437/ + /// + /// + /// + /// + /// + /// + /// + public float Remap(float value, float from1, float to1, float from2, float to2) + { + return (value - from1) / (to1 - from1) * (to2 - from2) + from2; + } + + +} + +#endif \ No newline at end of file diff --git a/Assets/MeatKit/Tools/IconCamera.cs.meta b/Assets/MeatKit/Tools/IconCamera.cs.meta new file mode 100644 index 0000000..b83d3d2 --- /dev/null +++ b/Assets/MeatKit/Tools/IconCamera.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: dcb72b0d9a9ea3b43a48a22b952f43c5 +timeCreated: 1637536229 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins.meta b/Assets/Plugins.meta new file mode 100644 index 0000000..2c6b38f --- /dev/null +++ b/Assets/Plugins.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 22d59494e378ae94689f270e528c3066 +folderAsset: yes +timeCreated: 1617326059 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AssetBundles-Browser.meta b/Assets/Plugins/AssetBundles-Browser.meta new file mode 100644 index 0000000..84fd02e --- /dev/null +++ b/Assets/Plugins/AssetBundles-Browser.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 2a7416319c4fe624c9f4a9167c4ab09c +folderAsset: yes +timeCreated: 1617332848 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AssetBundles-Browser/.gitignore b/Assets/Plugins/AssetBundles-Browser/.gitignore new file mode 100644 index 0000000..a0142e7 --- /dev/null +++ b/Assets/Plugins/AssetBundles-Browser/.gitignore @@ -0,0 +1,5 @@ +artifacts/** +build/** +Documentation/ApiDocs/** +.DS_Store +.npmrc diff --git a/Assets/Plugins/AssetBundles-Browser/.npmignore b/Assets/Plugins/AssetBundles-Browser/.npmignore new file mode 100644 index 0000000..facf810 --- /dev/null +++ b/Assets/Plugins/AssetBundles-Browser/.npmignore @@ -0,0 +1,8 @@ +artifacts/** +build/** +Documentation/ApiDocs/** +.npmrc +.npmignore +.gitignore +QAReport.md +QAReport.md.meta \ No newline at end of file diff --git a/Assets/Plugins/AssetBundles-Browser/CHANGELOG.md b/Assets/Plugins/AssetBundles-Browser/CHANGELOG.md new file mode 100644 index 0000000..bb48547 --- /dev/null +++ b/Assets/Plugins/AssetBundles-Browser/CHANGELOG.md @@ -0,0 +1,36 @@ +# Changelog +All notable changes to this package will be documented in this file. + +The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). + +## [1.8.0] - 2018-XX-XX +- Added more details to bundle detail view. +- fix for folder containing only non-asset items. + +## [1.7.0] - 2018-07-23 +- Sorting dependencies for easier identification. +- fix to windows file sharing violation error. +- minor bug fixes. + +## [1.6.0] - 2018-04-25 +- Stopped altering global styles. + +## [1.5.0] - 2018-02-28 +- Code static analysis cleanup. +- Documentation updates. +- fix to missing bundle-icon bug. + +## [1.4.0] - 2018-02-23 +- Added a search bar to the main tab. Searches based on asset name. + +## [1.3.0] - 2018-01-08 +- serialization fix for inspect tab (was causing entire window to potentially be blank). +- documentation fix + +## [1.2.0] - 2017-12-08 +- Added asmdef to keep browser in its own assembly +- minor null check fixes + +## [1.1.4] - 2017-11-09 +- Initial submission for package distribution diff --git a/Assets/Plugins/AssetBundles-Browser/CHANGELOG.md.meta b/Assets/Plugins/AssetBundles-Browser/CHANGELOG.md.meta new file mode 100644 index 0000000..7bb0060 --- /dev/null +++ b/Assets/Plugins/AssetBundles-Browser/CHANGELOG.md.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: eae989b9583e0794592d5e9b747bc280 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AssetBundles-Browser/Documentation.meta b/Assets/Plugins/AssetBundles-Browser/Documentation.meta new file mode 100644 index 0000000..16f0900 --- /dev/null +++ b/Assets/Plugins/AssetBundles-Browser/Documentation.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4fd76bb12fd5fae48a3e952d8020bef4 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AssetBundles-Browser/Documentation/com.unity.assetbundlebrowser.md b/Assets/Plugins/AssetBundles-Browser/Documentation/com.unity.assetbundlebrowser.md new file mode 100644 index 0000000..33a05b3 --- /dev/null +++ b/Assets/Plugins/AssetBundles-Browser/Documentation/com.unity.assetbundlebrowser.md @@ -0,0 +1,173 @@ +# Unity Asset Bundle Browser tool + +This tool enables the user to view and edit the configuration of asset bundles for their Unity project. It will block editing that would create invalid bundles, and inform you of any issues with existing bundles. It also provides basic build functionality. + +Use this tool as an alternative to selecting assets and setting their asset bundle manually in the inspector. It can be dropped into any Unity project with a version of 5.6 or greater. It will create a new menu item in __Window__ > __AssetBundle Browser__. The bundle configuration, build functionality, and build-bundle inspection are split into three tabs within the new window. + +![BrowserHeader](images/browser_header.png) + +### Requires Unity 5.6+ + +# Usage - Configure + +This window provides an explorer like interface to managing and modifying asset bundles in your project. When first opened, the tool will parse all bundle data in the background, slowly marking warnings or errors it detects. It does what it can to stay in sync with the project, but cannot always be aware of activity outside the tool. To force a quick pass at error detection, or to update the tool with changes made externally, hit the Refresh button in the upper left. + +The window is broken into four sections: Bundle List, Bundle Details, Asset List, and Asset Details. +![BrowserConfigure](images/browser_configure2.png) + +### Bundle List + +Left hand pane showing a list of all bundles in the project. Available functionality: + +* Select a bundle or set of bundles to see a list of the assets that will be in the bundle in the Asset List pane. + +* Bundles with variants are a darker grey and can be expanded to show the list of variants. + +* Right-click or slow-double-click to rename bundle or bundle folder. + +* If a bundle has any error, warning, or info message, an icon will appear on the right side. Mouse over the icon for more information. + +* If a bundle has at least one scene in it (making it a scene bundle) and non-scene assets explicitly included, it will be marked as having an error. This bundle will not build until fixed. + +* Bundles with duplicated assets will be marked with a warning (more information on duplication in Asset List section below) + +* Empty bundles will be marked with an info message. For a number of reasons, empty bundles are not very stable and can disappear from this list at times. + +* Folders of bundles will be marked with the highest message from the contained bundles. + +* To fix the duplicated inclusion of assets in bundles, you can: + + * Right click on a single bundle to move all assets determined to be duplicates into a new bundle. + + * Right click on multiple bundles to either move the assets from all selected bundles that are duplicates into a new bundle, or only those that are shared within the selection. + + * You can also drag duplicate assets out of the Asset List pane into the Bundle List to explicitly include them in a bundle. More info on this in the Asset List feature set below. + +* Right click or hit DEL to delete bundles. + +* Drag bundles around to move them into and out of folders, or merge them. + +* Drag assets from the Project Explorer onto bundles to add them. + +* Drag assets onto empty space to create a new bundle. + +* Right click to create new bundles or bundle folders. + +* Right click to "Convert to Variant" + + * This will add a variant (initially called "newvariant") to the selected bundle. + + * All assets currently in selected bundle will be moved into the new variant + + * ComingSoon: Mismatch detection between variants. + +Icons indicate if the bundle is a standard or a scene bundle. + +![Icon for standard bundle](images/ABundleBrowserIconY1756Basic.png) + +![Icon for scene bundle](images/ABundleBrowserIconY1756Scene.png) + +### Bundle Details + +Lower left hand pane showing details of the bundles(s) selected in the Bundle List pane. This pane will show the following information if it is available: + +* Total bundle size. This is a sum of the on-disk size of all assets. + +* Bundles that the current bundle depends on. + + * Assets in that bundle referenced from the current bundle. + + * Assets in the current bundle referencing the asset in the dependency bundle. + +* Any messages (error/warning/info) associated with the current bundle. + +* Select bundles or assets to select assets in the Asset List that are dependent on the selection. + +### Asset List + +Upper right hand pane providing a list of assets contained in whichever bundles are selected in the Bundle List. The search field above this list will match with assets in any bundle. The Asset List will only display matching assets, and the Bundle List will only display bundles that contain matching assets. Available functionality: + +* View all assets anticipated to be included in bundle. Sort asset list by any column header. + +* View assets explicitly included in bundle. These are assets that have been assigned a bundle explicitly. The inspector will reflect the bundle inclusion, and in this view they will say the bundle name next to the asset name. + +* View assets implicitly included in bundle. These assets will say *auto* as the name of the bundle next to the asset name. If looking at these assets in the inspector they will say *None* as the assigned bundle. + + * These assets have been added to the selected bundle(s) due to a dependency on another included asset. Only assets that are not explicitly assigned to a bundle will be implicitly included in any bundles. + + * Note that this list of implicit includes can be incomplete. There are known issues with materials and textures not always showing up correctly. + + * As multiple assets can share dependencies, it is common for a given asset to be implicitly included in multiple bundles. If the tool detects this case, it will mark both the bundle and the asset in question with a warning icon. + + * To fix the duplicate-inclusion warnings, you can manually move assets into a new bundle or right click the bundle and selecting one of the "Move duplicate" options. + +* Drag assets from the Project Explorer into this view to add them to the selected bundle. This is only valid if only one bundle is selected, and the asset type is compatible (scenes onto scene bundles, etc.) + +* Drag assets (explicit or implicit) from the Asset List into the Bundle List (to add them to different bundles, or a newly created bundle). + +* Right click or hit DEL to remove assets from bundles (does not remove assets from project). + +* Select or double-click assets to reveal them in the Project Explorer. + +A note on including folders in bundles. It is possible to assign an asset folder (from the Project Explorer) to a bundle. When viewing this in the browser, the folder itself will be listed as explicit and the contents implicit. This reflects the priority system used to assign assets to bundles. For example, say your game had five prefabs in Assets/Prefabs, and you marked the folder "Prefabs" as being in one bundle, and one of the actual prefabs ("PrefabA") as being in another. Once built, "PrefabA" would be in one bundle, and the other four prefabs would be in the other. + +### Asset Details + +Lower right hand pane showing details of the asset(s) selected in the Asset List pane. This pane cannot be interacted with, but will show the following information if it is available: + +* Full path of asset + +* Reason for implicit inclusion in bundles if it is implicit. + +* Reason for warning if any. + +* Reason for error if any. + +### Troubleshooting + +* *Can't rename or delete a specific bundle.* This is occasionally caused when first adding this tool to an existing project. Please force a reimport of your assets through the Unity menu system to refresh the data. + +### External Tool Integration +Other tools that generate asset bundle data can choose to integrate with the browser. Currently the primary example is the [Asset Bundle Graph Tool](https://bitbucket.org/Unity-Technologies/assetbundlegraphtool). If integrations are detected, then a selection bar will appear near the top of the browser. It will allow you to select the Default data source (Unity's AssetDatabase) or an integrated tool. If none are detected, the selector is not present, though you can add it by right-clicking on the tab header and selecting "Custom Sources". + +# Usage - Build + +The Build tab provides basic build functionality to get you started using asset bundles. In most professional scenarios, users will end up needing a more advanced build setup. All are welcome to use the build code in this tool as a starting point for writing their own once this no longer meets their needs. For the most part, the options here are directly tied to the options the engine expects in [BuildAssetBundleOptions](https://docs.unity3d.com/ScriptReference/BuildAssetBundleOptions.html). Interface: + +* *Build Target* - Platform the bundles will be built for + +* *Output Path* - Path for saving built bundles. By default this is AssetBundles/. You can edit the path manually, or by selecting "Browse". To return to the default naming convention, hit "Reset". + +* *Clear Folders* - This will delete all data from the build path folder prior to building. + +* *Copy to StreamingAssets* - After the build is complete, this will copy the results to Assets/StreamingAssets. This can be useful for testing, but would not be used in production. + +* *Advanced Settings* + + * *Compression* - Choose between no compression, standard LZMA, or chunk-based LZ4 compression. + + * *Exclude Type Information* - Do not include type information within the asset bundle + + * *Force Rebuild* - Rebuild bundles needing to be built. This is different than "Clear Folders" as this option will not delete bundles that no longer exist. + + * *Ignore Type Tree Changes* - Ignore the type tree changes when doing the incremental build check. + + * *Append Hash* - Append the hash to the asset bundle name. + + * *Strict Mode* - Do not allow the build to succeed if any errors are reporting during it. + + * *Dry Run Build* - Do a dry run build. + +* *Build* - Executes build. + +# Usage - Inspect +This tab enables you to inspect the contents of bundles that have already been built. +### Usage +* If you use the Browser to build, then the path you built to will automatically be added here. +* Click "Add File" or "Add Folder" to add bundles to inspect. +* Click the "-" next to each row to remove that file or folder. Note, you cannot remove individual files that were added by adding a folder. +* Select any bundle listed to see details: + * Name + * Size on disk + * Source Asset Paths - the assets explicitly added to this bundle. Note this list is incomplete for scene bundles. + * Advanced Data - includes information on the Preload Table, Container (explicit assets) and Dependencies. diff --git a/Assets/Plugins/AssetBundles-Browser/Documentation/com.unity.assetbundlebrowser.md.meta b/Assets/Plugins/AssetBundles-Browser/Documentation/com.unity.assetbundlebrowser.md.meta new file mode 100644 index 0000000..a01d1be --- /dev/null +++ b/Assets/Plugins/AssetBundles-Browser/Documentation/com.unity.assetbundlebrowser.md.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 04fe18d2a84db4c46ad123537efe6941 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AssetBundles-Browser/Documentation/images.meta b/Assets/Plugins/AssetBundles-Browser/Documentation/images.meta new file mode 100644 index 0000000..45550b0 --- /dev/null +++ b/Assets/Plugins/AssetBundles-Browser/Documentation/images.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f6ee6573a237b7e46adb95566c600038 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AssetBundles-Browser/Documentation/images/ABundleBrowserIconY1756Basic.png b/Assets/Plugins/AssetBundles-Browser/Documentation/images/ABundleBrowserIconY1756Basic.png new file mode 100644 index 0000000..de1091a Binary files /dev/null and b/Assets/Plugins/AssetBundles-Browser/Documentation/images/ABundleBrowserIconY1756Basic.png differ diff --git a/Assets/Plugins/AssetBundles-Browser/Documentation/images/ABundleBrowserIconY1756Basic.png.meta b/Assets/Plugins/AssetBundles-Browser/Documentation/images/ABundleBrowserIconY1756Basic.png.meta new file mode 100644 index 0000000..77bb242 --- /dev/null +++ b/Assets/Plugins/AssetBundles-Browser/Documentation/images/ABundleBrowserIconY1756Basic.png.meta @@ -0,0 +1,83 @@ +fileFormatVersion: 2 +guid: 521ac7d05d42f41408ec95eaedef87cd +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 5 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapU: -1 + wrapV: -1 + wrapW: -1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AssetBundles-Browser/Documentation/images/ABundleBrowserIconY1756Scene.png b/Assets/Plugins/AssetBundles-Browser/Documentation/images/ABundleBrowserIconY1756Scene.png new file mode 100644 index 0000000..26cecc9 Binary files /dev/null and b/Assets/Plugins/AssetBundles-Browser/Documentation/images/ABundleBrowserIconY1756Scene.png differ diff --git a/Assets/Plugins/AssetBundles-Browser/Documentation/images/ABundleBrowserIconY1756Scene.png.meta b/Assets/Plugins/AssetBundles-Browser/Documentation/images/ABundleBrowserIconY1756Scene.png.meta new file mode 100644 index 0000000..d480d23 --- /dev/null +++ b/Assets/Plugins/AssetBundles-Browser/Documentation/images/ABundleBrowserIconY1756Scene.png.meta @@ -0,0 +1,83 @@ +fileFormatVersion: 2 +guid: 63255dcf53aebf34a8b1162ee502ebe1 +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 5 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapU: -1 + wrapV: -1 + wrapW: -1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AssetBundles-Browser/Documentation/images/browser_configure2.png b/Assets/Plugins/AssetBundles-Browser/Documentation/images/browser_configure2.png new file mode 100644 index 0000000..58dea7c Binary files /dev/null and b/Assets/Plugins/AssetBundles-Browser/Documentation/images/browser_configure2.png differ diff --git a/Assets/Plugins/AssetBundles-Browser/Documentation/images/browser_configure2.png.meta b/Assets/Plugins/AssetBundles-Browser/Documentation/images/browser_configure2.png.meta new file mode 100644 index 0000000..a66cba7 --- /dev/null +++ b/Assets/Plugins/AssetBundles-Browser/Documentation/images/browser_configure2.png.meta @@ -0,0 +1,77 @@ +fileFormatVersion: 2 +guid: e3aa429e1ebaddb41ad13211560ea5e8 +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 5 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapU: -1 + wrapV: -1 + wrapW: -1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AssetBundles-Browser/Documentation/images/browser_header.png b/Assets/Plugins/AssetBundles-Browser/Documentation/images/browser_header.png new file mode 100644 index 0000000..4621bee Binary files /dev/null and b/Assets/Plugins/AssetBundles-Browser/Documentation/images/browser_header.png differ diff --git a/Assets/Plugins/AssetBundles-Browser/Documentation/images/browser_header.png.meta b/Assets/Plugins/AssetBundles-Browser/Documentation/images/browser_header.png.meta new file mode 100644 index 0000000..29a376d --- /dev/null +++ b/Assets/Plugins/AssetBundles-Browser/Documentation/images/browser_header.png.meta @@ -0,0 +1,77 @@ +fileFormatVersion: 2 +guid: 18223d49715730347b997e6682fe49e5 +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 5 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapU: -1 + wrapV: -1 + wrapW: -1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AssetBundles-Browser/Editor.meta b/Assets/Plugins/AssetBundles-Browser/Editor.meta new file mode 100644 index 0000000..f6ce389 --- /dev/null +++ b/Assets/Plugins/AssetBundles-Browser/Editor.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 946ae3b25c7026b49b4fc66e969e5475 +folderAsset: yes +timeCreated: 1507818222 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleBrowserMain.cs b/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleBrowserMain.cs new file mode 100644 index 0000000..4a56455 --- /dev/null +++ b/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleBrowserMain.cs @@ -0,0 +1,246 @@ +using System; +using System.Collections.Generic; +using AssetBundleBrowser.AssetBundleDataSource; +using UnityEditor; +using UnityEngine; + +[assembly: System.Runtime.CompilerServices.InternalsVisibleToAttribute("Unity.AssetBundleBrowser.Editor.Tests")] + +namespace AssetBundleBrowser +{ + public class AssetBundleBrowserMain : EditorWindow, IHasCustomMenu, ISerializationCallbackReceiver + { + private static AssetBundleBrowserMain s_instance = null; + + internal static AssetBundleBrowserMain instance + { + get + { + if (s_instance == null) + s_instance = GetWindow(); + return s_instance; + } + } + + internal const float kButtonWidth = 150; + + private enum Mode + { + Browser, + Builder, + Inspect + } + + [SerializeField] private Mode m_Mode; + + [SerializeField] private int m_DataSourceIndex; + + [SerializeField] internal AssetBundleManageTab m_ManageTab; + + [SerializeField] internal AssetBundleBuildTab m_BuildTab; + + [SerializeField] internal AssetBundleInspectTab m_InspectTab; + + private Texture2D m_RefreshTexture; + + private const float k_ToolbarPadding = 15; + private const float k_MenubarPadding = 32; + + [MenuItem("Window/AssetBundle Browser", priority = 2050)] + private static void ShowWindow() + { + s_instance = null; + instance.titleContent = new GUIContent("AssetBundles"); + instance.Show(); + } + + [SerializeField] internal bool multiDataSource = false; + + private List m_DataSourceList = null; + + public virtual void AddItemsToMenu(GenericMenu menu) + { + if (menu != null) + menu.AddItem(new GUIContent("Custom Sources"), multiDataSource, FlipDataSource); + } + + internal void FlipDataSource() + { + multiDataSource = !multiDataSource; + } + + private void OnEnable() + { + Rect subPos = GetSubWindowArea(); + if (m_ManageTab == null) + m_ManageTab = new AssetBundleManageTab(); + m_ManageTab.OnEnable(subPos, this); + if (m_BuildTab == null) + m_BuildTab = new AssetBundleBuildTab(); + m_BuildTab.OnEnable(this); + if (m_InspectTab == null) + m_InspectTab = new AssetBundleInspectTab(); + m_InspectTab.OnEnable(subPos); + + m_RefreshTexture = EditorGUIUtility.FindTexture("Refresh"); + + InitDataSources(); + } + + private void InitDataSources() + { + //determine if we are "multi source" or not... + multiDataSource = false; + m_DataSourceList = new List(); + foreach (Type info in AssetBundleDataSource.ABDataSourceProviderUtility.CustomABDataSourceTypes) m_DataSourceList.AddRange(info.GetMethod("CreateDataSources").Invoke(null, null) as List); + + if (m_DataSourceList.Count > 1) + { + multiDataSource = true; + if (m_DataSourceIndex >= m_DataSourceList.Count) + m_DataSourceIndex = 0; + AssetBundleModel.Model.DataSource = m_DataSourceList[m_DataSourceIndex]; + } + } + + private void OnDisable() + { + if (m_BuildTab != null) + m_BuildTab.OnDisable(); + if (m_InspectTab != null) + m_InspectTab.OnDisable(); + } + + public void OnBeforeSerialize() + { + } + + public void OnAfterDeserialize() + { + } + + private Rect GetSubWindowArea() + { + float padding = k_MenubarPadding; + if (multiDataSource) + padding += k_MenubarPadding * 0.5f; + Rect subPos = new Rect(0, padding, position.width, position.height - padding); + return subPos; + } + + private void Update() + { + switch (m_Mode) + { + case Mode.Builder: + break; + case Mode.Inspect: + break; + case Mode.Browser: + default: + m_ManageTab.Update(); + break; + } + } + + private void OnGUI() + { + ModeToggle(); + + switch (m_Mode) + { + case Mode.Builder: + m_BuildTab.OnGUI(); + break; + case Mode.Inspect: + m_InspectTab.OnGUI(GetSubWindowArea()); + break; + case Mode.Browser: + default: + m_ManageTab.OnGUI(GetSubWindowArea()); + break; + } + } + + private void ModeToggle() + { + GUILayout.BeginHorizontal(); + GUILayout.Space(k_ToolbarPadding); + bool clicked = false; + switch (m_Mode) + { + case Mode.Browser: + clicked = GUILayout.Button(m_RefreshTexture); + if (clicked) + m_ManageTab.ForceReloadData(); + break; + case Mode.Builder: + GUILayout.Space(m_RefreshTexture.width + k_ToolbarPadding); + break; + case Mode.Inspect: + clicked = GUILayout.Button(m_RefreshTexture); + if (clicked) + m_InspectTab.RefreshBundles(); + break; + } + + float toolbarWidth = position.width - k_ToolbarPadding * 4 - m_RefreshTexture.width; + //string[] labels = new string[2] { "Configure", "Build"}; + string[] labels = new string[3] {"Configure", "Build", "Inspect"}; + m_Mode = (Mode) GUILayout.Toolbar((int) m_Mode, labels, "LargeButton", GUILayout.Width(toolbarWidth)); + GUILayout.FlexibleSpace(); + GUILayout.EndHorizontal(); + if (multiDataSource) + { + //GUILayout.BeginArea(r); + GUILayout.BeginHorizontal(); + + using (new EditorGUILayout.HorizontalScope(EditorStyles.toolbar)) + { + GUILayout.Label("Bundle Data Source:"); + GUILayout.FlexibleSpace(); + GUIContent c = new GUIContent(string.Format("{0} ({1})", AssetBundleModel.Model.DataSource.Name, AssetBundleModel.Model.DataSource.ProviderName), "Select Asset Bundle Set"); + if (GUILayout.Button(c, EditorStyles.toolbarPopup)) + { + GenericMenu menu = new GenericMenu(); + + for (int index = 0; index < m_DataSourceList.Count; index++) + { + ABDataSource ds = m_DataSourceList[index]; + if (ds == null) + continue; + + if (index > 0) + menu.AddSeparator(""); + + int counter = index; + menu.AddItem(new GUIContent(string.Format("{0} ({1})", ds.Name, ds.ProviderName)), false, + () => + { + m_DataSourceIndex = counter; + ABDataSource thisDataSource = ds; + AssetBundleModel.Model.DataSource = thisDataSource; + m_ManageTab.ForceReloadData(); + } + ); + } + + menu.ShowAsContext(); + } + + GUILayout.FlexibleSpace(); + if (AssetBundleModel.Model.DataSource.IsReadOnly()) + { + GUIStyle tbLabel = new GUIStyle(EditorStyles.toolbar); + tbLabel.alignment = TextAnchor.MiddleRight; + + GUILayout.Label("Read Only", tbLabel); + } + } + + GUILayout.EndHorizontal(); + //GUILayout.EndArea(); + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleBrowserMain.cs.meta b/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleBrowserMain.cs.meta new file mode 100644 index 0000000..15abab4 --- /dev/null +++ b/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleBrowserMain.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 15478322cbd3d2f4a862552f839978da +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleBuildTab.cs b/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleBuildTab.cs new file mode 100644 index 0000000..7521d72 --- /dev/null +++ b/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleBuildTab.cs @@ -0,0 +1,451 @@ +using UnityEditor; +using UnityEngine; +using System.Collections.Generic; +using System.IO; +using System.Runtime.Serialization.Formatters.Binary; +using AssetBundleBrowser.AssetBundleDataSource; + +namespace AssetBundleBrowser +{ + [System.Serializable] + internal class AssetBundleBuildTab + { + private const string k_BuildPrefPrefix = "ABBBuild:"; + + private string m_streamingPath = "Assets/StreamingAssets"; + + [SerializeField] private bool m_AdvancedSettings; + + [SerializeField] private Vector2 m_ScrollPosition; + + + private class ToggleData + { + internal ToggleData(bool s, + string title, + string tooltip, + List onToggles, + BuildAssetBundleOptions opt = BuildAssetBundleOptions.None) + { + if (onToggles.Contains(title)) + state = true; + else + state = s; + content = new GUIContent(title, tooltip); + option = opt; + } + + //internal string prefsKey + //{ get { return k_BuildPrefPrefix + content.text; } } + internal bool state; + internal GUIContent content; + internal BuildAssetBundleOptions option; + } + + private AssetBundleInspectTab m_InspectTab; + + [SerializeField] private BuildTabData m_UserData; + + private List m_ToggleData; + private ToggleData m_ForceRebuild; + private ToggleData m_CopyToStreaming; + private GUIContent m_TargetContent; + private GUIContent m_CompressionContent; + + internal enum CompressOptions + { + Uncompressed = 0, + StandardCompression, + ChunkBasedCompression + } + + private GUIContent[] m_CompressionOptions = + { + new GUIContent("No Compression"), + new GUIContent("Standard Compression (LZMA)"), + new GUIContent("Chunk Based Compression (LZ4)") + }; + + private int[] m_CompressionValues = {0, 1, 2}; + + + internal AssetBundleBuildTab() + { + m_AdvancedSettings = false; + m_UserData = new BuildTabData(); + m_UserData.m_OnToggles = new List(); + m_UserData.m_UseDefaultPath = true; + } + + internal void OnDisable() + { + string dataPath = Path.GetFullPath("."); + dataPath = dataPath.Replace("\\", "/"); + dataPath += "/Library/AssetBundleBrowserBuild.dat"; + + BinaryFormatter bf = new BinaryFormatter(); + FileStream file = File.Create(dataPath); + + bf.Serialize(file, m_UserData); + file.Close(); + } + + internal void OnEnable(EditorWindow parent) + { + m_InspectTab = (parent as AssetBundleBrowserMain).m_InspectTab; + + //LoadData... + string dataPath = Path.GetFullPath("."); + dataPath = dataPath.Replace("\\", "/"); + dataPath += "/Library/AssetBundleBrowserBuild.dat"; + + if (File.Exists(dataPath)) + { + BinaryFormatter bf = new BinaryFormatter(); + FileStream file = File.Open(dataPath, FileMode.Open); + BuildTabData data = bf.Deserialize(file) as BuildTabData; + if (data != null) + m_UserData = data; + file.Close(); + } + + m_ToggleData = new List(); + m_ToggleData.Add(new ToggleData( + false, + "Exclude Type Information", + "Do not include type information within the asset bundle (don't write type tree).", + m_UserData.m_OnToggles, + BuildAssetBundleOptions.DisableWriteTypeTree)); + m_ToggleData.Add(new ToggleData( + false, + "Force Rebuild", + "Force rebuild the asset bundles", + m_UserData.m_OnToggles, + BuildAssetBundleOptions.ForceRebuildAssetBundle)); + m_ToggleData.Add(new ToggleData( + false, + "Ignore Type Tree Changes", + "Ignore the type tree changes when doing the incremental build check.", + m_UserData.m_OnToggles, + BuildAssetBundleOptions.IgnoreTypeTreeChanges)); + m_ToggleData.Add(new ToggleData( + false, + "Append Hash", + "Append the hash to the assetBundle name.", + m_UserData.m_OnToggles, + BuildAssetBundleOptions.AppendHashToAssetBundleName)); + m_ToggleData.Add(new ToggleData( + false, + "Strict Mode", + "Do not allow the build to succeed if any errors are reporting during it.", + m_UserData.m_OnToggles, + BuildAssetBundleOptions.StrictMode)); + m_ToggleData.Add(new ToggleData( + false, + "Dry Run Build", + "Do a dry run build.", + m_UserData.m_OnToggles, + BuildAssetBundleOptions.DryRunBuild)); + + + m_ForceRebuild = new ToggleData( + false, + "Clear Folders", + "Will wipe out all contents of build directory as well as StreamingAssets/AssetBundles if you are choosing to copy build there.", + m_UserData.m_OnToggles); + m_CopyToStreaming = new ToggleData( + false, + "Copy to StreamingAssets", + "After build completes, will copy all build content to " + m_streamingPath + " for use in stand-alone player.", + m_UserData.m_OnToggles); + + m_TargetContent = new GUIContent("Build Target", "Choose target platform to build for."); + m_CompressionContent = new GUIContent("Compression", "Choose no compress, standard (LZMA), or chunk based (LZ4)"); + + if (m_UserData.m_UseDefaultPath) ResetPathToDefault(); + } + + internal void OnGUI() + { + m_ScrollPosition = EditorGUILayout.BeginScrollView(m_ScrollPosition); + bool newState = false; + GUIStyle centeredStyle = new GUIStyle(GUI.skin.GetStyle("Label")); + centeredStyle.alignment = TextAnchor.UpperCenter; + GUILayout.Label(new GUIContent("Example build setup"), centeredStyle); + //basic options + EditorGUILayout.Space(); + GUILayout.BeginVertical(); + + // build target + using (new EditorGUI.DisabledScope(!AssetBundleModel.Model.DataSource.CanSpecifyBuildTarget)) + { + ValidBuildTarget tgt = (ValidBuildTarget) EditorGUILayout.EnumPopup(m_TargetContent, m_UserData.m_BuildTarget); + if (tgt != m_UserData.m_BuildTarget) + { + m_UserData.m_BuildTarget = tgt; + if (m_UserData.m_UseDefaultPath) + { + m_UserData.m_OutputPath = "AssetBundles/"; + m_UserData.m_OutputPath += m_UserData.m_BuildTarget.ToString(); + //EditorUserBuildSettings.SetPlatformSettings(EditorUserBuildSettings.activeBuildTarget.ToString(), "AssetBundleOutputPath", m_OutputPath); + } + } + } + + + ////output path + using (new EditorGUI.DisabledScope(!AssetBundleModel.Model.DataSource.CanSpecifyBuildOutputDirectory)) + { + EditorGUILayout.Space(); + GUILayout.BeginHorizontal(); + string newPath = EditorGUILayout.TextField("Output Path", m_UserData.m_OutputPath); + if (!string.IsNullOrEmpty(newPath) && newPath != m_UserData.m_OutputPath) + { + m_UserData.m_UseDefaultPath = false; + m_UserData.m_OutputPath = newPath; + //EditorUserBuildSettings.SetPlatformSettings(EditorUserBuildSettings.activeBuildTarget.ToString(), "AssetBundleOutputPath", m_OutputPath); + } + + GUILayout.EndHorizontal(); + GUILayout.BeginHorizontal(); + GUILayout.FlexibleSpace(); + if (GUILayout.Button("Browse", GUILayout.MaxWidth(75f))) + BrowseForFolder(); + if (GUILayout.Button("Reset", GUILayout.MaxWidth(75f))) + ResetPathToDefault(); + //if (string.IsNullOrEmpty(m_OutputPath)) + // m_OutputPath = EditorUserBuildSettings.GetPlatformSettings(EditorUserBuildSettings.activeBuildTarget.ToString(), "AssetBundleOutputPath"); + GUILayout.EndHorizontal(); + EditorGUILayout.Space(); + + newState = GUILayout.Toggle( + m_ForceRebuild.state, + m_ForceRebuild.content); + if (newState != m_ForceRebuild.state) + { + if (newState) + m_UserData.m_OnToggles.Add(m_ForceRebuild.content.text); + else + m_UserData.m_OnToggles.Remove(m_ForceRebuild.content.text); + m_ForceRebuild.state = newState; + } + + newState = GUILayout.Toggle( + m_CopyToStreaming.state, + m_CopyToStreaming.content); + if (newState != m_CopyToStreaming.state) + { + if (newState) + m_UserData.m_OnToggles.Add(m_CopyToStreaming.content.text); + else + m_UserData.m_OnToggles.Remove(m_CopyToStreaming.content.text); + m_CopyToStreaming.state = newState; + } + } + + // advanced options + using (new EditorGUI.DisabledScope(!AssetBundleModel.Model.DataSource.CanSpecifyBuildOptions)) + { + EditorGUILayout.Space(); + m_AdvancedSettings = EditorGUILayout.Foldout(m_AdvancedSettings, "Advanced Settings"); + if (m_AdvancedSettings) + { + int indent = EditorGUI.indentLevel; + EditorGUI.indentLevel = 1; + CompressOptions cmp = (CompressOptions) EditorGUILayout.IntPopup( + m_CompressionContent, + (int) m_UserData.m_Compression, + m_CompressionOptions, + m_CompressionValues); + + if (cmp != m_UserData.m_Compression) m_UserData.m_Compression = cmp; + foreach (ToggleData tog in m_ToggleData) + { + newState = EditorGUILayout.ToggleLeft( + tog.content, + tog.state); + if (newState != tog.state) + { + if (newState) + m_UserData.m_OnToggles.Add(tog.content.text); + else + m_UserData.m_OnToggles.Remove(tog.content.text); + tog.state = newState; + } + } + + EditorGUILayout.Space(); + EditorGUI.indentLevel = indent; + } + } + + // build. + EditorGUILayout.Space(); + if (GUILayout.Button("Build")) EditorApplication.delayCall += ExecuteBuild; + GUILayout.EndVertical(); + EditorGUILayout.EndScrollView(); + } + + private void ExecuteBuild() + { + if (AssetBundleModel.Model.DataSource.CanSpecifyBuildOutputDirectory) + { + if (string.IsNullOrEmpty(m_UserData.m_OutputPath)) + BrowseForFolder(); + + if (string.IsNullOrEmpty(m_UserData.m_OutputPath)) //in case they hit "cancel" on the open browser + { + Debug.LogError("AssetBundle Build: No valid output path for build."); + return; + } + + if (m_ForceRebuild.state) + { + string message = "Do you want to delete all files in the directory " + m_UserData.m_OutputPath; + if (m_CopyToStreaming.state) + message += " and " + m_streamingPath; + message += "?"; + if (EditorUtility.DisplayDialog("File delete confirmation", message, "Yes", "No")) + try + { + if (Directory.Exists(m_UserData.m_OutputPath)) + Directory.Delete(m_UserData.m_OutputPath, true); + + if (m_CopyToStreaming.state) + if (Directory.Exists(m_streamingPath)) + Directory.Delete(m_streamingPath, true); + } + catch (System.Exception e) + { + Debug.LogException(e); + } + } + + if (!Directory.Exists(m_UserData.m_OutputPath)) + Directory.CreateDirectory(m_UserData.m_OutputPath); + } + + BuildAssetBundleOptions opt = BuildAssetBundleOptions.None; + + if (AssetBundleModel.Model.DataSource.CanSpecifyBuildOptions) + { + if (m_UserData.m_Compression == CompressOptions.Uncompressed) + opt |= BuildAssetBundleOptions.UncompressedAssetBundle; + else if (m_UserData.m_Compression == CompressOptions.ChunkBasedCompression) + opt |= BuildAssetBundleOptions.ChunkBasedCompression; + foreach (ToggleData tog in m_ToggleData) + if (tog.state) + opt |= tog.option; + } + + ABBuildInfo buildInfo = new ABBuildInfo(); + + buildInfo.outputDirectory = m_UserData.m_OutputPath; + buildInfo.options = opt; + buildInfo.buildTarget = (BuildTarget) m_UserData.m_BuildTarget; + buildInfo.onBuild = (assetBundleName) => + { + if (m_InspectTab == null) + return; + m_InspectTab.AddBundleFolder(buildInfo.outputDirectory); + m_InspectTab.RefreshBundles(); + }; + + AssetBundleModel.Model.DataSource.BuildAssetBundles(buildInfo); + + AssetDatabase.Refresh(ImportAssetOptions.ForceUpdate); + + if (m_CopyToStreaming.state) + DirectoryCopy(m_UserData.m_OutputPath, m_streamingPath); + } + + private static void DirectoryCopy(string sourceDirName, string destDirName) + { + // If the destination directory doesn't exist, create it. + if (!Directory.Exists(destDirName)) Directory.CreateDirectory(destDirName); + + foreach (string folderPath in Directory.GetDirectories(sourceDirName, "*", SearchOption.AllDirectories)) + if (!Directory.Exists(folderPath.Replace(sourceDirName, destDirName))) + Directory.CreateDirectory(folderPath.Replace(sourceDirName, destDirName)); + + foreach (string filePath in Directory.GetFiles(sourceDirName, "*.*", SearchOption.AllDirectories)) + { + string fileDirName = Path.GetDirectoryName(filePath).Replace("\\", "/"); + string fileName = Path.GetFileName(filePath); + string newFilePath = Path.Combine(fileDirName.Replace(sourceDirName, destDirName), fileName); + + File.Copy(filePath, newFilePath, true); + } + } + + private void BrowseForFolder() + { + m_UserData.m_UseDefaultPath = false; + string newPath = EditorUtility.OpenFolderPanel("Bundle Folder", m_UserData.m_OutputPath, string.Empty); + if (!string.IsNullOrEmpty(newPath)) + { + string gamePath = Path.GetFullPath("."); + gamePath = gamePath.Replace("\\", "/"); + if (newPath.StartsWith(gamePath) && newPath.Length > gamePath.Length) + newPath = newPath.Remove(0, gamePath.Length + 1); + m_UserData.m_OutputPath = newPath; + //EditorUserBuildSettings.SetPlatformSettings(EditorUserBuildSettings.activeBuildTarget.ToString(), "AssetBundleOutputPath", m_OutputPath); + } + } + + private void ResetPathToDefault() + { + m_UserData.m_UseDefaultPath = true; + m_UserData.m_OutputPath = "AssetBundles/"; + m_UserData.m_OutputPath += m_UserData.m_BuildTarget.ToString(); + //EditorUserBuildSettings.SetPlatformSettings(EditorUserBuildSettings.activeBuildTarget.ToString(), "AssetBundleOutputPath", m_OutputPath); + } + + //Note: this is the provided BuildTarget enum with some entries removed as they are invalid in the dropdown + internal enum ValidBuildTarget + { + //NoTarget = -2, --doesn't make sense + //iPhone = -1, --deprecated + //BB10 = -1, --deprecated + //MetroPlayer = -1, --deprecated + StandaloneOSXUniversal = 2, + StandaloneOSXIntel = 4, + StandaloneWindows = 5, + WebPlayer = 6, + WebPlayerStreamed = 7, + iOS = 9, + PS3 = 10, + XBOX360 = 11, + Android = 13, + StandaloneLinux = 17, + StandaloneWindows64 = 19, + WebGL = 20, + WSAPlayer = 21, + StandaloneLinux64 = 24, + StandaloneLinuxUniversal = 25, + WP8Player = 26, + StandaloneOSXIntel64 = 27, + BlackBerry = 28, + Tizen = 29, + PSP2 = 30, + PS4 = 31, + PSM = 32, + XboxOne = 33, + SamsungTV = 34, + N3DS = 35, + WiiU = 36, + tvOS = 37, + Switch = 38 + } + + [System.Serializable] + internal class BuildTabData + { + internal List m_OnToggles; + internal ValidBuildTarget m_BuildTarget = ValidBuildTarget.StandaloneWindows; + internal CompressOptions m_Compression = CompressOptions.StandardCompression; + internal string m_OutputPath = string.Empty; + internal bool m_UseDefaultPath = true; + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleBuildTab.cs.meta b/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleBuildTab.cs.meta new file mode 100644 index 0000000..7bcbb58 --- /dev/null +++ b/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleBuildTab.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 10d204eff91c2e844b26a7dee989f978 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleDataSource.meta b/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleDataSource.meta new file mode 100644 index 0000000..4db6b41 --- /dev/null +++ b/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleDataSource.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 37cf1ee934b7c254e92e69eb6f19f186 +folderAsset: yes +timeCreated: 1497630438 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleDataSource/ABDataSource.cs b/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleDataSource/ABDataSource.cs new file mode 100644 index 0000000..677959f --- /dev/null +++ b/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleDataSource/ABDataSource.cs @@ -0,0 +1,141 @@ +using UnityEditor; +using System; + +namespace AssetBundleBrowser.AssetBundleDataSource +{ + /// + /// Build Info struct used by ABDataSource to pass needed build data around. + /// + public partial class ABBuildInfo + { + /// + /// Directory to place build result + /// + public string outputDirectory + { + get { return m_outputDirectory; } + set { m_outputDirectory = value; } + } + + private string m_outputDirectory; + + /// + /// Standard asset bundle build options. + /// + public BuildAssetBundleOptions options + { + get { return m_options; } + set { m_options = value; } + } + + private BuildAssetBundleOptions m_options; + + /// + /// Target platform for build. + /// + public BuildTarget buildTarget + { + get { return m_buildTarget; } + set { m_buildTarget = value; } + } + + private BuildTarget m_buildTarget; + + /// + /// Callback for build event. + /// + public Action onBuild + { + get { return m_onBuild; } + set { m_onBuild = value; } + } + + private Action m_onBuild; + } + + /// + /// Interface class used by browser. It is expected to contain all information needed to display predicted bundle layout. + /// Any class deriving from this interface AND implementing CreateDataSources() will be picked up by the browser automatically + /// and displayed in an in-tool dropdown. By default, that dropdown is hidden if the browser detects no external data sources. + /// To turn it on, right click on tab header "AssetBundles" and enable "Custom Sources" + /// + /// Must implement CreateDataSources() to be picked up by the browser. + /// public static List CreateDataSources(); + /// + /// + public partial interface ABDataSource + { + //// all derived classes must implement the following interface in order to be picked up by the browser. + //public static List CreateDataSources(); + + /// + /// Name of DataSource. Displayed in menu as "Name (ProvidorName)" + /// + string Name { get; } + + /// + /// Name of provider for DataSource. Displayed in menu as "Name (ProvidorName)" + /// + string ProviderName { get; } + + /// + /// Array of paths in bundle. + /// + string[] GetAssetPathsFromAssetBundle(string assetBundleName); + + /// + /// Name of bundle explicitly associated with asset at path. + /// + string GetAssetBundleName(string assetPath); + + /// + /// Name of bundle associated with asset at path. + /// The difference between this and GetAssetBundleName() is for assets unassigned to a bundle, but + /// residing inside a folder that is assigned to a bundle. Those assets will implicitly associate + /// with the bundle associated with the parent folder. + /// + string GetImplicitAssetBundleName(string assetPath); + + /// + /// Array of asset bundle names in project + /// + string[] GetAllAssetBundleNames(); + + /// + /// If this data source is read only. + /// If this returns true, much of the Browsers's interface will be disabled (drag&drop, etc.) + /// + bool IsReadOnly(); + + /// + /// Sets the asset bundle name (and variant) on a given asset + /// + void SetAssetBundleNameAndVariant(string assetPath, string bundleName, string variantName); + + /// + /// Clears out any asset bundle names that do not have assets associated with them. + /// + void RemoveUnusedAssetBundleNames(); + + /// + /// Signals if this data source can have build target set by tool + /// + bool CanSpecifyBuildTarget { get; } + + /// + /// Signals if this data source can have output directory set by tool + /// + bool CanSpecifyBuildOutputDirectory { get; } + + /// + /// Signals if this data source can have build options set by tool + /// + bool CanSpecifyBuildOptions { get; } + + /// + /// Executes data source's implementation of asset bundle building. + /// Called by "build" button in build tab of tool. + /// + bool BuildAssetBundles(ABBuildInfo info); + } +} \ No newline at end of file diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleDataSource/ABDataSource.cs.meta b/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleDataSource/ABDataSource.cs.meta new file mode 100644 index 0000000..0ed262d --- /dev/null +++ b/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleDataSource/ABDataSource.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 919244bce66418940b1be40b992ffb7c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleDataSource/ABDataSourceProvider.cs b/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleDataSource/ABDataSourceProvider.cs new file mode 100644 index 0000000..b212bed --- /dev/null +++ b/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleDataSource/ABDataSourceProvider.cs @@ -0,0 +1,51 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; + +namespace AssetBundleBrowser.AssetBundleDataSource +{ + internal class ABDataSourceProviderUtility + { + private static List s_customNodes; + + internal static List CustomABDataSourceTypes + { + get + { + if (s_customNodes == null) s_customNodes = BuildCustomABDataSourceList(); + return s_customNodes; + } + } + + private static List BuildCustomABDataSourceList() + { + List properList = new List(); + properList.Add(null); //empty spot for "default" + Assembly[] x = AppDomain.CurrentDomain.GetAssemblies(); + foreach (Assembly assembly in x) + try + { + List list = new List( + assembly + .GetTypes() + .Where(t => t != typeof(ABDataSource)) + .Where(t => typeof(ABDataSource).IsAssignableFrom(t))); + + + for (int count = 0; count < list.Count; count++) + if (list[count].Name == "AssetDatabaseABDataSource") + properList[0] = list[count]; + else if (list[count] != null) + properList.Add(list[count]); + } + catch (Exception) + { + //assembly which raises exception on the GetTypes() call - ignore it + } + + + return properList; + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleDataSource/ABDataSourceProvider.cs.meta b/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleDataSource/ABDataSourceProvider.cs.meta new file mode 100644 index 0000000..4aa110f --- /dev/null +++ b/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleDataSource/ABDataSourceProvider.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d8b537f111d73db4dac7f6a47a53b8d8 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleDataSource/AssetDatabaseABDataSource.cs b/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleDataSource/AssetDatabaseABDataSource.cs new file mode 100644 index 0000000..dc7cb56 --- /dev/null +++ b/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleDataSource/AssetDatabaseABDataSource.cs @@ -0,0 +1,106 @@ +using System; +using UnityEngine; +using UnityEditor; +using UnityEngine.Assertions; +using System.Collections.Generic; +using System.Linq; +using UnityEditor.IMGUI.Controls; + +namespace AssetBundleBrowser.AssetBundleDataSource +{ + internal class AssetDatabaseABDataSource : ABDataSource + { + public static List CreateDataSources() + { + AssetDatabaseABDataSource op = new AssetDatabaseABDataSource(); + List retList = new List(); + retList.Add(op); + return retList; + } + + public string Name + { + get { return "Default"; } + } + + public string ProviderName + { + get { return "Built-in"; } + } + + public string[] GetAssetPathsFromAssetBundle(string assetBundleName) + { + return AssetDatabase.GetAssetPathsFromAssetBundle(assetBundleName); + } + + public string GetAssetBundleName(string assetPath) + { + AssetImporter importer = AssetImporter.GetAtPath(assetPath); + if (importer == null) return string.Empty; + string bundleName = importer.assetBundleName; + if (importer.assetBundleVariant.Length > 0) bundleName = bundleName + "." + importer.assetBundleVariant; + return bundleName; + } + + public string GetImplicitAssetBundleName(string assetPath) + { + return AssetDatabase.GetImplicitAssetBundleName(assetPath); + } + + public string[] GetAllAssetBundleNames() + { + return AssetDatabase.GetAllAssetBundleNames(); + } + + public bool IsReadOnly() + { + return false; + } + + public void SetAssetBundleNameAndVariant(string assetPath, string bundleName, string variantName) + { + AssetImporter.GetAtPath(assetPath).SetAssetBundleNameAndVariant(bundleName, variantName); + } + + public void RemoveUnusedAssetBundleNames() + { + AssetDatabase.RemoveUnusedAssetBundleNames(); + } + + public bool CanSpecifyBuildTarget + { + get { return true; } + } + + public bool CanSpecifyBuildOutputDirectory + { + get { return true; } + } + + public bool CanSpecifyBuildOptions + { + get { return true; } + } + + public bool BuildAssetBundles(ABBuildInfo info) + { + if (info == null) + { + Debug.Log("Error in build"); + return false; + } + + AssetBundleManifest buildManifest = BuildPipeline.BuildAssetBundles(info.outputDirectory, info.options, info.buildTarget); + if (buildManifest == null) + { + Debug.Log("Error in build"); + return false; + } + + foreach (string assetBundleName in buildManifest.GetAllAssetBundles()) + if (info.onBuild != null) + info.onBuild(assetBundleName); + return true; + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleDataSource/AssetDatabaseABDataSource.cs.meta b/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleDataSource/AssetDatabaseABDataSource.cs.meta new file mode 100644 index 0000000..21c93b3 --- /dev/null +++ b/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleDataSource/AssetDatabaseABDataSource.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 22084e56372f59e47a3fcd9c3b291923 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleManageTab.cs b/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleManageTab.cs new file mode 100644 index 0000000..ed0be08 --- /dev/null +++ b/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleManageTab.cs @@ -0,0 +1,265 @@ +using UnityEditor; +using UnityEditor.IMGUI.Controls; +using UnityEngine; +using System.Collections.Generic; + + +namespace AssetBundleBrowser +{ + [System.Serializable] + internal class AssetBundleManageTab + { + [SerializeField] private TreeViewState m_BundleTreeState; + [SerializeField] private TreeViewState m_AssetListState; + [SerializeField] private MultiColumnHeaderState m_AssetListMCHState; + [SerializeField] private TreeViewState m_BundleDetailState; + + private Rect m_Position; + + private AssetBundleTree m_BundleTree; + private AssetListTree m_AssetList; + private MessageList m_MessageList; + private BundleDetailList m_DetailsList; + private bool m_ResizingHorizontalSplitter = false; + private bool m_ResizingVerticalSplitterRight = false; + private bool m_ResizingVerticalSplitterLeft = false; + private Rect m_HorizontalSplitterRect, m_VerticalSplitterRectRight, m_VerticalSplitterRectLeft; + [SerializeField] private float m_HorizontalSplitterPercent; + [SerializeField] private float m_VerticalSplitterPercentRight; + [SerializeField] private float m_VerticalSplitterPercentLeft; + private const float k_SplitterWidth = 3f; + private static float s_UpdateDelay = 0f; + + private SearchField m_searchField; + + private EditorWindow m_Parent = null; + + internal AssetBundleManageTab() + { + m_HorizontalSplitterPercent = 0.4f; + m_VerticalSplitterPercentRight = 0.7f; + m_VerticalSplitterPercentLeft = 0.85f; + } + + internal void OnEnable(Rect pos, EditorWindow parent) + { + m_Parent = parent; + m_Position = pos; + m_HorizontalSplitterRect = new Rect( + (int) (m_Position.x + m_Position.width * m_HorizontalSplitterPercent), + m_Position.y, + k_SplitterWidth, + m_Position.height); + m_VerticalSplitterRectRight = new Rect( + m_HorizontalSplitterRect.x, + (int) (m_Position.y + m_HorizontalSplitterRect.height * m_VerticalSplitterPercentRight), + m_Position.width - m_HorizontalSplitterRect.width - k_SplitterWidth, + k_SplitterWidth); + m_VerticalSplitterRectLeft = new Rect( + m_Position.x, + (int) (m_Position.y + m_HorizontalSplitterRect.height * m_VerticalSplitterPercentLeft), + m_HorizontalSplitterRect.width - k_SplitterWidth, + k_SplitterWidth); + + m_searchField = new SearchField(); + } + + + internal void Update() + { + float t = Time.realtimeSinceStartup; + if (t - s_UpdateDelay > 0.1f || + s_UpdateDelay > t) //something went strangely wrong if this second check is true. + { + s_UpdateDelay = t - 0.001f; + + if (AssetBundleModel.Model.Update()) m_Parent.Repaint(); + + if (m_DetailsList != null) + m_DetailsList.Update(); + + if (m_AssetList != null) + m_AssetList.Update(); + } + } + + internal void ForceReloadData() + { + UpdateSelectedBundles(new List()); + SetSelectedItems(new List()); + m_BundleTree.SetSelection(new int[0]); + AssetBundleModel.Model.ForceReloadData(m_BundleTree); + m_Parent.Repaint(); + } + + internal void OnGUI(Rect pos) + { + m_Position = pos; + + if (m_BundleTree == null) + { + if (m_AssetListState == null) + m_AssetListState = new TreeViewState(); + + MultiColumnHeaderState headerState = AssetListTree.CreateDefaultMultiColumnHeaderState(); // multiColumnTreeViewRect.width); + if (MultiColumnHeaderState.CanOverwriteSerializedFields(m_AssetListMCHState, headerState)) + MultiColumnHeaderState.OverwriteSerializedFields(m_AssetListMCHState, headerState); + m_AssetListMCHState = headerState; + + + m_AssetList = new AssetListTree(m_AssetListState, m_AssetListMCHState, this); + m_AssetList.Reload(); + m_MessageList = new MessageList(); + + if (m_BundleDetailState == null) + m_BundleDetailState = new TreeViewState(); + m_DetailsList = new BundleDetailList(m_BundleDetailState); + m_DetailsList.Reload(); + + if (m_BundleTreeState == null) + m_BundleTreeState = new TreeViewState(); + m_BundleTree = new AssetBundleTree(m_BundleTreeState, this); + m_BundleTree.Refresh(); + m_Parent.Repaint(); + } + + HandleHorizontalResize(); + HandleVerticalResize(); + + + if (AssetBundleModel.Model.BundleListIsEmpty()) + { + m_BundleTree.OnGUI(m_Position); + GUIStyle style = new GUIStyle(GUI.skin.label); + style.alignment = TextAnchor.MiddleCenter; + style.wordWrap = true; + GUI.Label( + new Rect(m_Position.x + 1f, m_Position.y + 1f, m_Position.width - 2f, m_Position.height - 2f), + new GUIContent(AssetBundleModel.Model.GetEmptyMessage()), + style); + } + else + { + //Left half + Rect bundleTreeRect = new Rect( + m_Position.x, + m_Position.y, + m_HorizontalSplitterRect.x, + m_VerticalSplitterRectLeft.y - m_Position.y); + + m_BundleTree.OnGUI(bundleTreeRect); + m_DetailsList.OnGUI(new Rect( + bundleTreeRect.x, + bundleTreeRect.y + bundleTreeRect.height + k_SplitterWidth, + bundleTreeRect.width, + m_Position.height - bundleTreeRect.height - k_SplitterWidth * 2)); + + //Right half. + float panelLeft = m_HorizontalSplitterRect.x + k_SplitterWidth; + float panelWidth = m_VerticalSplitterRectRight.width - k_SplitterWidth * 2; + float searchHeight = 20f; + float panelTop = m_Position.y + searchHeight; + float panelHeight = m_VerticalSplitterRectRight.y - panelTop; + OnGUISearchBar(new Rect(panelLeft, m_Position.y, panelWidth, searchHeight)); + m_AssetList.OnGUI(new Rect( + panelLeft, + panelTop, + panelWidth, + panelHeight)); + m_MessageList.OnGUI(new Rect( + panelLeft, + panelTop + panelHeight + k_SplitterWidth, + panelWidth, + m_Position.height - panelHeight - k_SplitterWidth * 2)); + + if (m_ResizingHorizontalSplitter || m_ResizingVerticalSplitterRight || m_ResizingVerticalSplitterLeft) + m_Parent.Repaint(); + } + } + + private void OnGUISearchBar(Rect rect) + { + m_BundleTree.searchString = m_searchField.OnGUI(rect, m_BundleTree.searchString); + m_AssetList.searchString = m_BundleTree.searchString; + } + + public bool hasSearch + { + get { return m_BundleTree.hasSearch; } + } + + private void HandleHorizontalResize() + { + m_HorizontalSplitterRect.x = (int) (m_Position.width * m_HorizontalSplitterPercent); + m_HorizontalSplitterRect.height = m_Position.height; + + EditorGUIUtility.AddCursorRect(m_HorizontalSplitterRect, MouseCursor.ResizeHorizontal); + if (Event.current.type == EventType.MouseDown && m_HorizontalSplitterRect.Contains(Event.current.mousePosition)) + m_ResizingHorizontalSplitter = true; + + if (m_ResizingHorizontalSplitter) + { + m_HorizontalSplitterPercent = Mathf.Clamp(Event.current.mousePosition.x / m_Position.width, 0.1f, 0.9f); + m_HorizontalSplitterRect.x = (int) (m_Position.width * m_HorizontalSplitterPercent); + } + + if (Event.current.type == EventType.MouseUp) + m_ResizingHorizontalSplitter = false; + } + + private void HandleVerticalResize() + { + m_VerticalSplitterRectRight.x = m_HorizontalSplitterRect.x; + m_VerticalSplitterRectRight.y = (int) (m_HorizontalSplitterRect.height * m_VerticalSplitterPercentRight); + m_VerticalSplitterRectRight.width = m_Position.width - m_HorizontalSplitterRect.x; + m_VerticalSplitterRectLeft.y = (int) (m_HorizontalSplitterRect.height * m_VerticalSplitterPercentLeft); + m_VerticalSplitterRectLeft.width = m_VerticalSplitterRectRight.width; + + + EditorGUIUtility.AddCursorRect(m_VerticalSplitterRectRight, MouseCursor.ResizeVertical); + if (Event.current.type == EventType.MouseDown && m_VerticalSplitterRectRight.Contains(Event.current.mousePosition)) + m_ResizingVerticalSplitterRight = true; + + EditorGUIUtility.AddCursorRect(m_VerticalSplitterRectLeft, MouseCursor.ResizeVertical); + if (Event.current.type == EventType.MouseDown && m_VerticalSplitterRectLeft.Contains(Event.current.mousePosition)) + m_ResizingVerticalSplitterLeft = true; + + + if (m_ResizingVerticalSplitterRight) + { + m_VerticalSplitterPercentRight = Mathf.Clamp(Event.current.mousePosition.y / m_HorizontalSplitterRect.height, 0.2f, 0.98f); + m_VerticalSplitterRectRight.y = (int) (m_HorizontalSplitterRect.height * m_VerticalSplitterPercentRight); + } + else if (m_ResizingVerticalSplitterLeft) + { + m_VerticalSplitterPercentLeft = Mathf.Clamp(Event.current.mousePosition.y / m_HorizontalSplitterRect.height, 0.25f, 0.98f); + m_VerticalSplitterRectLeft.y = (int) (m_HorizontalSplitterRect.height * m_VerticalSplitterPercentLeft); + } + + + if (Event.current.type == EventType.MouseUp) + { + m_ResizingVerticalSplitterRight = false; + m_ResizingVerticalSplitterLeft = false; + } + } + + internal void UpdateSelectedBundles(IEnumerable bundles) + { + AssetBundleModel.Model.AddBundlesToUpdate(bundles); + m_AssetList.SetSelectedBundles(bundles); + m_DetailsList.SetItems(bundles); + m_MessageList.SetItems(null); + } + + internal void SetSelectedItems(IEnumerable items) + { + m_MessageList.SetItems(items); + } + + internal void SetAssetListSelection(List assets) + { + m_AssetList.SetSelection(assets); + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleManageTab.cs.meta b/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleManageTab.cs.meta new file mode 100644 index 0000000..680fa38 --- /dev/null +++ b/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleManageTab.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4f53b921dc74d344a98b8624b7b95a8b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleModel.meta b/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleModel.meta new file mode 100644 index 0000000..873e199 --- /dev/null +++ b/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleModel.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: b59abcdb3531bd64ab43572babec263e +folderAsset: yes +timeCreated: 1488835755 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleModel/ABModel.cs b/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleModel/ABModel.cs new file mode 100644 index 0000000..5e3518d --- /dev/null +++ b/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleModel/ABModel.cs @@ -0,0 +1,766 @@ +using System; +using UnityEngine; +using UnityEditor; +using UnityEngine.Assertions; +using System.Collections.Generic; +using System.Linq; +using UnityEditor.IMGUI.Controls; +using AssetBundleBrowser.AssetBundleDataSource; + +namespace AssetBundleBrowser.AssetBundleModel +{ + /// + /// Static class holding model data for Asset Bundle Browser tool. Data in Model is read from DataSource, but is not pushed. + /// + /// If not using a custom DataSource, then the data comes from the AssetDatabase. If you wish to alter the data from code, + /// you should just push changes to the AssetDatabase then tell the Model to Rebuild(). If needed, you can also loop over + /// Update() until it returns true to force all sub-items to refresh. + /// + /// + public static class Model + { + private const string k_NewBundleBaseName = "newbundle"; + private const string k_NewVariantBaseName = "newvariant"; + internal static /*const*/ Color k_LightGrey = Color.grey * 1.5f; + + private static ABDataSource s_DataSource; + private static BundleFolderConcreteInfo s_RootLevelBundles = new BundleFolderConcreteInfo("", null); + private static List s_MoveData = new List(); + private static List s_BundlesToUpdate = new List(); + private static Dictionary s_GlobalAssetList = new Dictionary(); + private static Dictionary> s_DependencyTracker = new Dictionary>(); + + private static bool s_InErrorState = false; + private const string k_DefaultEmptyMessage = "Drag assets here or right-click to begin creating bundles."; + private const string k_ProblemEmptyMessage = "There was a problem parsing the list of bundles. See console."; + private static string s_EmptyMessageString; + + private static Texture2D s_folderIcon = null; + private static Texture2D s_bundleIcon = null; + private static Texture2D s_sceneIcon = null; + + /// + /// If using a custom source of asset bundles, you can implement your own ABDataSource and set it here as the active + /// DataSource. This will allow you to use the Browser with data that you provide. + /// + /// If no custom DataSource is provided, then the Browser will create one that feeds off of and into the + /// AssetDatabase. + /// + /// + public static ABDataSource DataSource + { + get + { + if (s_DataSource == null) s_DataSource = new AssetDatabaseABDataSource(); + return s_DataSource; + } + set { s_DataSource = value; } + } + + /// + /// Update will loop over bundles that need updating and update them. It will only update one bundle + /// per frame and will continue on the same bundle next frame until that bundle is marked as doneUpdating. + /// By default, this will cause a very slow collection of dependency data as it will only update one bundle per + /// + public static bool Update() + { + bool shouldRepaint = false; + ExecuteAssetMove(false); //this should never do anything. just a safety check. + + //TODO - look into EditorApplication callback functions. + + int size = s_BundlesToUpdate.Count; + if (size > 0) + { + s_BundlesToUpdate[size - 1].Update(); + s_BundlesToUpdate.RemoveAll(item => item.doneUpdating == true); + if (s_BundlesToUpdate.Count == 0) + { + shouldRepaint = true; + foreach (BundleInfo bundle in s_RootLevelBundles.GetChildList()) bundle.RefreshDupeAssetWarning(); + } + } + + return shouldRepaint; + } + + internal static void ForceReloadData(TreeView tree) + { + s_InErrorState = false; + Rebuild(); + tree.Reload(); + bool doneUpdating = s_BundlesToUpdate.Count == 0; + + EditorUtility.DisplayProgressBar("Updating Bundles", "", 0); + int fullBundleCount = s_BundlesToUpdate.Count; + while (!doneUpdating && !s_InErrorState) + { + int currCount = s_BundlesToUpdate.Count; + EditorUtility.DisplayProgressBar("Updating Bundles", s_BundlesToUpdate[currCount - 1].displayName, (float) (fullBundleCount - currCount) / (float) fullBundleCount); + doneUpdating = Update(); + } + + EditorUtility.ClearProgressBar(); + } + + /// + /// Clears and rebuilds model data. + /// + public static void Rebuild() + { + s_RootLevelBundles = new BundleFolderConcreteInfo("", null); + s_MoveData = new List(); + s_BundlesToUpdate = new List(); + s_GlobalAssetList = new Dictionary(); + Refresh(); + } + + internal static void AddBundlesToUpdate(IEnumerable bundles) + { + foreach (BundleInfo bundle in bundles) + { + bundle.ForceNeedUpdate(); + s_BundlesToUpdate.Add(bundle); + } + } + + internal static void Refresh() + { + s_EmptyMessageString = k_ProblemEmptyMessage; + if (s_InErrorState) + return; + + string[] bundleList = ValidateBundleList(); + if (bundleList != null) + { + s_EmptyMessageString = k_DefaultEmptyMessage; + foreach (string bundleName in bundleList) AddBundleToModel(bundleName); + AddBundlesToUpdate(s_RootLevelBundles.GetChildList()); + } + + if (s_InErrorState) + { + s_RootLevelBundles = new BundleFolderConcreteInfo("", null); + s_EmptyMessageString = k_ProblemEmptyMessage; + } + } + + internal static string[] ValidateBundleList() + { + string[] bundleList = DataSource.GetAllAssetBundleNames(); + bool valid = true; + HashSet bundleSet = new HashSet(); + int index = 0; + bool attemptedBundleReset = false; + while (index < bundleList.Length) + { + string name = bundleList[index]; + if (!bundleSet.Add(name)) + { + LogError("Two bundles share the same name: " + name); + valid = false; + } + + int lastDot = name.LastIndexOf('.'); + if (lastDot > -1) + { + string bunName = name.Substring(0, lastDot); + int extraDot = bunName.LastIndexOf('.'); + if (extraDot > -1) + { + if (attemptedBundleReset) + { + string message = "Bundle name '" + bunName + "' contains a period."; + message += " Internally Unity keeps 'bundleName' and 'variantName' separate, but externally treat them as 'bundleName.variantName'."; + message += " If a bundleName contains a period, the build will (probably) succeed, but this tool cannot tell which portion is bundle and which portion is variant."; + LogError(message); + valid = false; + } + else + { + if (!DataSource.IsReadOnly()) DataSource.RemoveUnusedAssetBundleNames(); + index = 0; + bundleSet.Clear(); + bundleList = DataSource.GetAllAssetBundleNames(); + attemptedBundleReset = true; + continue; + } + } + + + if (bundleList.Contains(bunName)) + { + //there is a bundle.none and a bundle.variant coexisting. Need to fix that or return an error. + if (attemptedBundleReset) + { + valid = false; + string message = "Bundle name '" + bunName + "' exists without a variant as well as with variant '" + name.Substring(lastDot + 1) + "'."; + message += " That is an illegal state that will not build and must be cleaned up."; + LogError(message); + } + else + { + if (!DataSource.IsReadOnly()) DataSource.RemoveUnusedAssetBundleNames(); + index = 0; + bundleSet.Clear(); + bundleList = DataSource.GetAllAssetBundleNames(); + attemptedBundleReset = true; + continue; + } + } + } + + index++; + } + + if (valid) + return bundleList; + else + return null; + } + + internal static bool BundleListIsEmpty() + { + return s_RootLevelBundles.GetChildList().Count() == 0; + } + + internal static string GetEmptyMessage() + { + return s_EmptyMessageString; + } + + internal static BundleInfo CreateEmptyBundle(BundleFolderInfo folder = null, string newName = null) + { + if (folder as BundleVariantFolderInfo != null) + return CreateEmptyVariant(folder as BundleVariantFolderInfo); + + folder = folder == null ? s_RootLevelBundles : folder; + string name = GetUniqueName(folder, newName); + BundleNameData nameData; + nameData = new BundleNameData(folder.m_Name.bundleName, name); + return AddBundleToFolder(folder, nameData); + } + + internal static BundleInfo CreateEmptyVariant(BundleVariantFolderInfo folder) + { + string name = GetUniqueName(folder, k_NewVariantBaseName); + string variantName = folder.m_Name.bundleName + "." + name; + BundleNameData nameData = new BundleNameData(variantName); + return AddBundleToFolder(folder.parent, nameData); + } + + internal static BundleFolderInfo CreateEmptyBundleFolder(BundleFolderConcreteInfo folder = null) + { + folder = folder == null ? s_RootLevelBundles : folder; + string name = GetUniqueName(folder) + "/dummy"; + BundleNameData nameData = new BundleNameData(folder.m_Name.bundleName, name); + return AddFoldersToBundle(s_RootLevelBundles, nameData); + } + + private static BundleInfo AddBundleToModel(string name) + { + if (name == null) + return null; + + BundleNameData nameData = new BundleNameData(name); + + BundleFolderInfo folder = AddFoldersToBundle(s_RootLevelBundles, nameData); + BundleInfo currInfo = AddBundleToFolder(folder, nameData); + + return currInfo; + } + + private static BundleFolderConcreteInfo AddFoldersToBundle(BundleFolderInfo root, BundleNameData nameData) + { + BundleInfo currInfo = root; + BundleFolderConcreteInfo folder = currInfo as BundleFolderConcreteInfo; + int size = nameData.pathTokens.Count; + for (int index = 0; index < size; index++) + if (folder != null) + { + currInfo = folder.GetChild(nameData.pathTokens[index]); + if (currInfo == null) + { + currInfo = new BundleFolderConcreteInfo(nameData.pathTokens, index + 1, folder); + folder.AddChild(currInfo); + } + + folder = currInfo as BundleFolderConcreteInfo; + if (folder == null) + { + s_InErrorState = true; + LogFolderAndBundleNameConflict(currInfo.m_Name.fullNativeName); + break; + } + } + + return currInfo as BundleFolderConcreteInfo; + } + + private static void LogFolderAndBundleNameConflict(string name) + { + string message = "Bundle '"; + message += name; + message += "' has a name conflict with a bundle-folder."; + message += "Display of bundle data and building of bundles will not work."; + message += "\nDetails: If you name a bundle 'x/y', then the result of your build will be a bundle named 'y' in a folder named 'x'. You thus cannot also have a bundle named 'x' at the same level as the folder named 'x'."; + LogError(message); + } + + private static BundleInfo AddBundleToFolder(BundleFolderInfo root, BundleNameData nameData) + { + BundleInfo currInfo = root.GetChild(nameData.shortName); + if (!string.IsNullOrEmpty(nameData.variant)) + { + if (currInfo == null) + { + currInfo = new BundleVariantFolderInfo(nameData.bundleName, root); + root.AddChild(currInfo); + } + + BundleVariantFolderInfo folder = currInfo as BundleVariantFolderInfo; + if (folder == null) + { + string message = "Bundle named " + nameData.shortName; + message += " exists both as a standard bundle, and a bundle with variants. "; + message += "This message is not supported for display or actual bundle building. "; + message += "You must manually fix bundle naming in the inspector."; + + LogError(message); + return null; + } + + + currInfo = folder.GetChild(nameData.variant); + if (currInfo == null) + { + currInfo = new BundleVariantDataInfo(nameData.fullNativeName, folder); + folder.AddChild(currInfo); + } + } + else + { + if (currInfo == null) + { + currInfo = new BundleDataInfo(nameData.fullNativeName, root); + root.AddChild(currInfo); + } + else + { + BundleDataInfo dataInfo = currInfo as BundleDataInfo; + if (dataInfo == null) + { + s_InErrorState = true; + LogFolderAndBundleNameConflict(nameData.fullNativeName); + } + } + } + + return currInfo; + } + + private static string GetUniqueName(BundleFolderInfo folder, string suggestedName = null) + { + suggestedName = suggestedName == null ? k_NewBundleBaseName : suggestedName; + string name = suggestedName; + int index = 1; + bool foundExisting = folder.GetChild(name) != null; + while (foundExisting) + { + name = suggestedName + index; + index++; + foundExisting = folder.GetChild(name) != null; + } + + return name; + } + + internal static BundleTreeItem CreateBundleTreeView() + { + return s_RootLevelBundles.CreateTreeView(-1); + } + + internal static AssetTreeItem CreateAssetListTreeView(IEnumerable selectedBundles) + { + AssetTreeItem root = new AssetTreeItem(); + if (selectedBundles != null) + foreach (BundleInfo bundle in selectedBundles) + bundle.AddAssetsToNode(root); + return root; + } + + internal static bool HandleBundleRename(BundleTreeItem item, string newName) + { + BundleNameData originalName = new BundleNameData(item.bundle.m_Name.fullNativeName); + + int findDot = newName.LastIndexOf('.'); + int findSlash = newName.LastIndexOf('/'); + int findBSlash = newName.LastIndexOf('\\'); + if (findDot == 0 || findSlash == 0 || findBSlash == 0) + return false; //can't start a bundle with a / or . + + bool result = item.bundle.HandleRename(newName, 0); + + if (findDot > 0 || findSlash > 0 || findBSlash > 0) item.bundle.parent.HandleChildRename(newName, string.Empty); + + ExecuteAssetMove(); + + BundleInfo node = FindBundle(originalName); + if (node != null) + { + string message = "Failed to rename bundle named: "; + message += originalName.fullNativeName; + message += ". Most likely this is due to the bundle being assigned to a folder in your Assets directory, AND that folder is either empty or only contains assets that are explicitly assigned elsewhere."; + Debug.LogError(message); + } + + return result; + } + + internal static void HandleBundleReparent(IEnumerable bundles, BundleFolderInfo parent) + { + parent = parent == null ? s_RootLevelBundles : parent; + foreach (BundleInfo bundle in bundles) bundle.HandleReparent(parent.m_Name.bundleName, parent); + ExecuteAssetMove(); + } + + internal static void HandleBundleMerge(IEnumerable bundles, BundleDataInfo target) + { + foreach (BundleInfo bundle in bundles) bundle.HandleDelete(true, target.m_Name.bundleName, target.m_Name.variant); + ExecuteAssetMove(); + } + + internal static void HandleBundleDelete(IEnumerable bundles) + { + List nameList = new List(); + foreach (BundleInfo bundle in bundles) + { + nameList.Add(bundle.m_Name); + bundle.HandleDelete(true); + } + + ExecuteAssetMove(); + + //check to see if any bundles are still there... + foreach (BundleNameData name in nameList) + { + BundleInfo node = FindBundle(name); + if (node != null) + { + string message = "Failed to delete bundle named: "; + message += name.fullNativeName; + message += ". Most likely this is due to the bundle being assigned to a folder in your Assets directory, AND that folder is either empty or only contains assets that are explicitly assigned elsewhere."; + Debug.LogError(message); + } + } + } + + internal static BundleInfo FindBundle(BundleNameData name) + { + BundleInfo currNode = s_RootLevelBundles; + foreach (string token in name.pathTokens) + if (currNode is BundleFolderInfo) + { + currNode = (currNode as BundleFolderInfo).GetChild(token); + if (currNode == null) + return null; + } + else + { + return null; + } + + if (currNode is BundleFolderInfo) + { + currNode = (currNode as BundleFolderInfo).GetChild(name.shortName); + if (currNode is BundleVariantFolderInfo) currNode = (currNode as BundleVariantFolderInfo).GetChild(name.variant); + return currNode; + } + else + { + return null; + } + } + + internal static BundleInfo HandleDedupeBundles(IEnumerable bundles, bool onlyOverlappedAssets) + { + BundleInfo newBundle = CreateEmptyBundle(); + HashSet dupeAssets = new HashSet(); + HashSet fullAssetList = new HashSet(); + + //if they were just selected, then they may still be updating. + bool doneUpdating = s_BundlesToUpdate.Count == 0; + while (!doneUpdating) + doneUpdating = Update(); + + foreach (BundleInfo bundle in bundles) + foreach (AssetInfo asset in bundle.GetDependencies()) + if (onlyOverlappedAssets) + { + if (!fullAssetList.Add(asset.fullAssetName)) + dupeAssets.Add(asset.fullAssetName); + } + else + { + if (asset.IsMessageSet(MessageSystem.MessageFlag.AssetsDuplicatedInMultBundles)) + dupeAssets.Add(asset.fullAssetName); + } + + if (dupeAssets.Count == 0) + return null; + + MoveAssetToBundle(dupeAssets, newBundle.m_Name.bundleName, string.Empty); + ExecuteAssetMove(); + return newBundle; + } + + internal static BundleInfo HandleConvertToVariant(BundleDataInfo bundle) + { + bundle.HandleDelete(true, bundle.m_Name.bundleName, k_NewVariantBaseName); + ExecuteAssetMove(); + BundleVariantFolderInfo root = bundle.parent.GetChild(bundle.m_Name.shortName) as BundleVariantFolderInfo; + + if (root != null) + { + return root.GetChild(k_NewVariantBaseName); + } + else + { + //we got here because the converted bundle was empty. + BundleVariantFolderInfo vfolder = new BundleVariantFolderInfo(bundle.m_Name.bundleName, bundle.parent); + BundleVariantDataInfo vdata = new BundleVariantDataInfo(bundle.m_Name.bundleName + "." + k_NewVariantBaseName, vfolder); + bundle.parent.AddChild(vfolder); + vfolder.AddChild(vdata); + return vdata; + } + } + + internal class ABMoveData + { + internal string assetName; + internal string bundleName; + internal string variantName; + + internal ABMoveData(string asset, string bundle, string variant) + { + assetName = asset; + bundleName = bundle; + variantName = variant; + } + + internal void Apply() + { + if (!DataSource.IsReadOnly()) DataSource.SetAssetBundleNameAndVariant(assetName, bundleName, variantName); + } + } + + internal static void MoveAssetToBundle(AssetInfo asset, string bundleName, string variant) + { + s_MoveData.Add(new ABMoveData(asset.fullAssetName, bundleName, variant)); + } + + internal static void MoveAssetToBundle(string assetName, string bundleName, string variant) + { + s_MoveData.Add(new ABMoveData(assetName, bundleName, variant)); + } + + internal static void MoveAssetToBundle(IEnumerable assets, string bundleName, string variant) + { + foreach (AssetInfo asset in assets) + MoveAssetToBundle(asset, bundleName, variant); + } + + internal static void MoveAssetToBundle(IEnumerable assetNames, string bundleName, string variant) + { + foreach (string assetName in assetNames) + MoveAssetToBundle(assetName, bundleName, variant); + } + + internal static void ExecuteAssetMove(bool forceAct = true) + { + int size = s_MoveData.Count; + if (forceAct) + { + if (size > 0) + { + bool autoRefresh = EditorPrefs.GetBool("kAutoRefresh"); + EditorPrefs.SetBool("kAutoRefresh", false); + AssetDatabase.StartAssetEditing(); + EditorUtility.DisplayProgressBar("Moving assets to bundles", "", 0); + for (int i = 0; i < size; i++) + { + EditorUtility.DisplayProgressBar("Moving assets to bundle " + s_MoveData[i].bundleName, System.IO.Path.GetFileNameWithoutExtension(s_MoveData[i].assetName), (float) i / (float) size); + s_MoveData[i].Apply(); + } + + EditorUtility.ClearProgressBar(); + AssetDatabase.StopAssetEditing(); + EditorPrefs.SetBool("kAutoRefresh", autoRefresh); + s_MoveData.Clear(); + } + + if (!DataSource.IsReadOnly()) DataSource.RemoveUnusedAssetBundleNames(); + Refresh(); + } + } + + //this version of CreateAsset is only used for dependent assets. + internal static AssetInfo CreateAsset(string name, AssetInfo parent) + { + if (ValidateAsset(name)) + { + string bundleName = GetBundleName(name); + return CreateAsset(name, bundleName, parent); + } + + return null; + } + + internal static AssetInfo CreateAsset(string name, string bundleName) + { + if (ValidateAsset(name)) return CreateAsset(name, bundleName, null); + return null; + } + + private static AssetInfo CreateAsset(string name, string bundleName, AssetInfo parent) + { + if (!string.IsNullOrEmpty(bundleName)) + { + return new AssetInfo(name, bundleName); + } + else + { + AssetInfo info = null; + if (!s_GlobalAssetList.TryGetValue(name, out info)) + { + info = new AssetInfo(name, string.Empty); + s_GlobalAssetList.Add(name, info); + } + + info.AddParent(parent.displayName); + return info; + } + } + + internal static bool ValidateAsset(string name) + { + if (!name.StartsWith("Assets/")) + return false; + string ext = System.IO.Path.GetExtension(name); + if (ext == ".dll" || ext == ".cs" || ext == ".meta" || ext == ".js" || ext == ".boo") + return false; + + return true; + } + + internal static string GetBundleName(string asset) + { + return DataSource.GetAssetBundleName(asset); + } + + internal static int RegisterAsset(AssetInfo asset, string bundle) + { + if (s_DependencyTracker.ContainsKey(asset.fullAssetName)) + { + s_DependencyTracker[asset.fullAssetName].Add(bundle); + int count = s_DependencyTracker[asset.fullAssetName].Count; + if (count > 1) + asset.SetMessageFlag(MessageSystem.MessageFlag.AssetsDuplicatedInMultBundles, true); + return count; + } + + HashSet bundles = new HashSet(); + bundles.Add(bundle); + s_DependencyTracker.Add(asset.fullAssetName, bundles); + return 1; + } + + internal static void UnRegisterAsset(AssetInfo asset, string bundle) + { + if (s_DependencyTracker == null || asset == null) + return; + + if (s_DependencyTracker.ContainsKey(asset.fullAssetName)) + { + s_DependencyTracker[asset.fullAssetName].Remove(bundle); + int count = s_DependencyTracker[asset.fullAssetName].Count; + switch (count) + { + case 0: + s_DependencyTracker.Remove(asset.fullAssetName); + break; + case 1: + asset.SetMessageFlag(MessageSystem.MessageFlag.AssetsDuplicatedInMultBundles, false); + break; + default: + break; + } + } + } + + internal static IEnumerable CheckDependencyTracker(AssetInfo asset) + { + if (s_DependencyTracker.ContainsKey(asset.fullAssetName)) return s_DependencyTracker[asset.fullAssetName]; + return new HashSet(); + } + + //TODO - switch local cache server on and utilize this method to stay up to date. + //static List m_importedAssets = new List(); + //static List m_deletedAssets = new List(); + //static List> m_movedAssets = new List>(); + //class AssetBundleChangeListener : AssetPostprocessor + //{ + // static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths) + // { + // m_importedAssets.AddRange(importedAssets); + // m_deletedAssets.AddRange(deletedAssets); + // for (int i = 0; i < movedAssets.Length; i++) + // m_movedAssets.Add(new KeyValuePair(movedFromAssetPaths[i], movedAssets[i])); + // //m_dirty = true; + // } + //} + + internal static void LogError(string message) + { + Debug.LogError("AssetBundleBrowser: " + message); + } + + internal static void LogWarning(string message) + { + Debug.LogWarning("AssetBundleBrowser: " + message); + } + + internal static Texture2D GetFolderIcon() + { + if (s_folderIcon == null) + FindBundleIcons(); + return s_folderIcon; + } + + internal static Texture2D GetBundleIcon() + { + if (s_bundleIcon == null) + FindBundleIcons(); + return s_bundleIcon; + } + + internal static Texture2D GetSceneIcon() + { + if (s_sceneIcon == null) + FindBundleIcons(); + return s_sceneIcon; + } + + private static void FindBundleIcons() + { + s_folderIcon = EditorGUIUtility.FindTexture("Folder Icon"); + + string packagePath = System.IO.Path.GetFullPath("Packages/com.unity.assetbundlebrowser"); + if (System.IO.Directory.Exists(packagePath)) + { + s_bundleIcon = (Texture2D) AssetDatabase.LoadAssetAtPath("Packages/com.unity.assetbundlebrowser/Editor/Icons/ABundleBrowserIconY1756Basic.png", typeof(Texture2D)); + s_sceneIcon = (Texture2D) AssetDatabase.LoadAssetAtPath("Packages/com.unity.assetbundlebrowser/Editor/Icons/ABundleBrowserIconY1756Scene.png", typeof(Texture2D)); + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleModel/ABModel.cs.meta b/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleModel/ABModel.cs.meta new file mode 100644 index 0000000..eecd723 --- /dev/null +++ b/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleModel/ABModel.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8f45129f30a7a9b4caf06fa3cbb90882 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleModel/ABModelAssetInfo.cs b/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleModel/ABModelAssetInfo.cs new file mode 100644 index 0000000..b788896 --- /dev/null +++ b/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleModel/ABModelAssetInfo.cs @@ -0,0 +1,248 @@ +using UnityEngine; +using UnityEditor; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using UnityEditor.IMGUI.Controls; + +namespace AssetBundleBrowser.AssetBundleModel +{ + internal sealed class AssetTreeItem : TreeViewItem + { + private AssetInfo m_asset; + + internal AssetInfo asset + { + get { return m_asset; } + } + + internal AssetTreeItem() : base(-1, -1) + { + } + + internal AssetTreeItem(AssetInfo a) : base(a != null ? a.fullAssetName.GetHashCode() : Random.Range(int.MinValue, int.MaxValue), 0, a != null ? a.displayName : "failed") + { + m_asset = a; + if (a != null) + icon = AssetDatabase.GetCachedIcon(a.fullAssetName) as Texture2D; + } + + private Color m_color = new Color(0, 0, 0, 0); + + internal Color itemColor + { + get + { + if (m_color.a == 0.0f && m_asset != null) m_color = m_asset.GetColor(); + return m_color; + } + set { m_color = value; } + } + + internal Texture2D MessageIcon() + { + return MessageSystem.GetIcon(HighestMessageLevel()); + } + + internal MessageType HighestMessageLevel() + { + return m_asset != null ? m_asset.HighestMessageLevel() : MessageType.Error; + } + + internal bool ContainsChild(AssetInfo asset) + { + bool contains = false; + if (children == null) + return contains; + + if (asset == null) + return false; + foreach (TreeViewItem child in children) + { + AssetTreeItem c = child as AssetTreeItem; + if (c != null && c.asset != null && c.asset.fullAssetName == asset.fullAssetName) + { + contains = true; + break; + } + } + + return contains; + } + } + + internal class AssetInfo + { + internal bool isScene { get; set; } + internal bool isFolder { get; set; } + internal long fileSize; + + private HashSet m_Parents; + private string m_AssetName; + private string m_DisplayName; + private string m_BundleName; + private MessageSystem.MessageState m_AssetMessages = new MessageSystem.MessageState(); + + internal AssetInfo(string inName, string bundleName = "") + { + fullAssetName = inName; + m_BundleName = bundleName; + m_Parents = new HashSet(); + isScene = false; + isFolder = false; + } + + internal string fullAssetName + { + get { return m_AssetName; } + set + { + m_AssetName = value; + m_DisplayName = System.IO.Path.GetFileNameWithoutExtension(m_AssetName); + + //TODO - maybe there's a way to ask the AssetDatabase for this size info. + FileInfo fileInfo = new System.IO.FileInfo(m_AssetName); + if (fileInfo.Exists) + fileSize = fileInfo.Length; + else + fileSize = 0; + } + } + + internal string displayName + { + get { return m_DisplayName; } + } + + internal string bundleName + { + get { return string.IsNullOrEmpty(m_BundleName) ? "auto" : m_BundleName; } + } + + internal Color GetColor() + { + if (string.IsNullOrEmpty(m_BundleName)) + return Model.k_LightGrey; + else + return Color.white; + } + + internal bool IsMessageSet(MessageSystem.MessageFlag flag) + { + return m_AssetMessages.IsSet(flag); + } + + internal void SetMessageFlag(MessageSystem.MessageFlag flag, bool on) + { + m_AssetMessages.SetFlag(flag, on); + } + + internal MessageType HighestMessageLevel() + { + return m_AssetMessages.HighestMessageLevel(); + } + + internal IEnumerable GetMessages() + { + List messages = new List(); + if (IsMessageSet(MessageSystem.MessageFlag.SceneBundleConflict)) + { + string message = displayName + "\n"; + if (isScene) + message += "Is a scene that is in a bundle with non-scene assets. Scene bundles must have only one or more scene assets."; + else + message += "Is included in a bundle with a scene. Scene bundles must have only one or more scene assets."; + messages.Add(new MessageSystem.Message(message, MessageType.Error)); + } + + if (IsMessageSet(MessageSystem.MessageFlag.DependencySceneConflict)) + { + string message = displayName + "\n"; + message += MessageSystem.GetMessage(MessageSystem.MessageFlag.DependencySceneConflict).message; + messages.Add(new MessageSystem.Message(message, MessageType.Error)); + } + + if (IsMessageSet(MessageSystem.MessageFlag.AssetsDuplicatedInMultBundles)) + { + IEnumerable bundleNames = Model.CheckDependencyTracker(this); + string message = displayName + "\n" + "Is auto-included in multiple bundles:\n"; + foreach (string bundleName in bundleNames) message += bundleName + ", "; + message = message.Substring(0, message.Length - 2); //remove trailing comma. + messages.Add(new MessageSystem.Message(message, MessageType.Warning)); + } + + if (string.IsNullOrEmpty(m_BundleName) && m_Parents.Count > 0) + { + //TODO - refine the parent list to only include those in the current asset list + string message = displayName + "\n" + "Is auto included in bundle(s) due to parent(s): \n"; + foreach (string parent in m_Parents) message += parent + ", "; + message = message.Substring(0, message.Length - 2); //remove trailing comma. + messages.Add(new MessageSystem.Message(message, MessageType.Info)); + } + + if (m_dependencies != null && m_dependencies.Count > 0) + { + string message = string.Empty; + IOrderedEnumerable sortedDependencies = m_dependencies.OrderBy(d => d.bundleName); + foreach (AssetInfo dependent in sortedDependencies) + if (dependent.bundleName != bundleName) + message += dependent.bundleName + " : " + dependent.displayName + "\n"; + if (string.IsNullOrEmpty(message) == false) + { + message = message.Insert(0, displayName + "\n" + "Is dependent on other bundle's asset(s) or auto included asset(s): \n"); + message = message.Substring(0, message.Length - 1); //remove trailing line break. + messages.Add(new MessageSystem.Message(message, MessageType.Info)); + } + } + + messages.Add(new MessageSystem.Message(displayName + "\n" + "Path: " + fullAssetName, MessageType.Info)); + + return messages; + } + + internal void AddParent(string name) + { + m_Parents.Add(name); + } + + internal void RemoveParent(string name) + { + m_Parents.Remove(name); + } + + internal string GetSizeString() + { + if (fileSize == 0) + return "--"; + return EditorUtility.FormatBytes(fileSize); + } + + private List m_dependencies = null; + + internal List GetDependencies() + { + //TODO - not sure this refreshes enough. need to build tests around that. + if (m_dependencies == null) + { + m_dependencies = new List(); + if (AssetDatabase.IsValidFolder(m_AssetName)) + { + //if we have a folder, its dependencies were already pulled in through alternate means. no need to GatherFoldersAndFiles + //GatherFoldersAndFiles(); + } + else + { + foreach (string dep in AssetDatabase.GetDependencies(m_AssetName, true)) + if (dep != m_AssetName) + { + AssetInfo asset = Model.CreateAsset(dep, this); + if (asset != null) + m_dependencies.Add(asset); + } + } + } + + return m_dependencies; + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleModel/ABModelAssetInfo.cs.meta b/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleModel/ABModelAssetInfo.cs.meta new file mode 100644 index 0000000..de3d371 --- /dev/null +++ b/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleModel/ABModelAssetInfo.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9f5923f93f7306f4182aecb2dd06ef8d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleModel/ABModelBundleInfo.cs b/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleModel/ABModelBundleInfo.cs new file mode 100644 index 0000000..d26333b --- /dev/null +++ b/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleModel/ABModelBundleInfo.cs @@ -0,0 +1,1027 @@ +using System; +using UnityEngine; +using UnityEditor; +using System.Collections.Generic; +using System.Linq; +using UnityEditor.IMGUI.Controls; + +namespace AssetBundleBrowser.AssetBundleModel +{ + internal sealed class BundleTreeItem : TreeViewItem + { + private BundleInfo m_Bundle; + + internal BundleInfo bundle + { + get { return m_Bundle; } + } + + internal BundleTreeItem(BundleInfo b, int depth, Texture2D iconTexture) : base(b.nameHashCode, depth, b.displayName) + { + m_Bundle = b; + icon = iconTexture; + children = new List(); + } + + internal MessageSystem.Message BundleMessage() + { + return m_Bundle.HighestMessage(); + } + + public override string displayName + { + get { return AssetBundleBrowserMain.instance.m_ManageTab.hasSearch ? m_Bundle.m_Name.fullNativeName : m_Bundle.displayName; } + } + } + + internal class BundleNameData + { + private List m_PathTokens; + private string m_FullBundleName; + private string m_ShortName; + private string m_VariantName; + private string m_FullNativeName; + + //input (received from native) is a string of format: + // /folder0/.../folderN/name.variant + //it's broken into: + // /m_pathTokens[0]/.../m_pathTokens[n]/m_shortName.m_variantName + // and... + // m_fullBundleName = /m_pathTokens[0]/.../m_pathTokens[n]/m_shortName + // and... + // m_fullNativeName = m_fullBundleName.m_variantName which is the same as the initial input. + internal BundleNameData(string name) + { + SetName(name); + } + + internal BundleNameData(string path, string name) + { + string finalName = string.IsNullOrEmpty(path) ? "" : path + '/'; + finalName += name; + SetName(finalName); + } + + public override int GetHashCode() + { + return fullNativeName.GetHashCode(); + } + + internal string fullNativeName + { + get { return m_FullNativeName; } + } + + internal void SetBundleName(string bundleName, string variantName) + { + string name = bundleName; + name += string.IsNullOrEmpty(variantName) ? "" : "." + variantName; + SetName(name); + } + + internal string bundleName + { + get { return m_FullBundleName; } + //set { SetName(value); } + } + + internal string shortName + { + get { return m_ShortName; } + } + + internal string variant + { + get { return m_VariantName; } + set + { + m_VariantName = value; + m_FullNativeName = m_FullBundleName; + m_FullNativeName += string.IsNullOrEmpty(m_VariantName) ? "" : "." + m_VariantName; + } + } + + internal List pathTokens + { + get { return m_PathTokens; } + set + { + m_PathTokens = value.GetRange(0, value.Count - 1); + SetShortName(value.Last()); + GenerateFullName(); + } + } + + private void SetName(string name) + { + if (m_PathTokens == null) + m_PathTokens = new List(); + else + m_PathTokens.Clear(); + + int indexOfSlash = name.IndexOf('/'); + int previousIndex = 0; + while (indexOfSlash != -1) + { + m_PathTokens.Add(name.Substring(previousIndex, indexOfSlash - previousIndex)); + previousIndex = indexOfSlash + 1; + indexOfSlash = name.IndexOf('/', previousIndex); + } + + SetShortName(name.Substring(previousIndex)); + GenerateFullName(); + } + + private void SetShortName(string inputName) + { + m_ShortName = inputName; + int indexOfDot = m_ShortName.LastIndexOf('.'); + if (indexOfDot > -1) + { + m_VariantName = m_ShortName.Substring(indexOfDot + 1); + m_ShortName = m_ShortName.Substring(0, indexOfDot); + } + else + { + m_VariantName = string.Empty; + } + } + + internal void PartialNameChange(string newToken, int indexFromBack) + { + if (indexFromBack == 0) + SetShortName(newToken); + else if (indexFromBack - 1 < m_PathTokens.Count) m_PathTokens[m_PathTokens.Count - indexFromBack] = newToken; + GenerateFullName(); + } + + private void GenerateFullName() + { + m_FullBundleName = string.Empty; + for (int i = 0; i < m_PathTokens.Count; i++) + { + m_FullBundleName += m_PathTokens[i]; + m_FullBundleName += '/'; + } + + m_FullBundleName += m_ShortName; + m_FullNativeName = m_FullBundleName; + m_FullNativeName += string.IsNullOrEmpty(m_VariantName) ? "" : "." + m_VariantName; + } + } + + internal abstract class BundleInfo + { + protected BundleFolderInfo m_Parent; + protected bool m_DoneUpdating; + protected bool m_Dirty; + internal BundleNameData m_Name; + protected MessageSystem.MessageState m_BundleMessages = new MessageSystem.MessageState(); + protected MessageSystem.Message m_CachedHighMessage = null; + + internal BundleInfo(string name, BundleFolderInfo parent) + { + m_Name = new BundleNameData(name); + m_Parent = parent; + } + + internal BundleFolderInfo parent + { + get { return m_Parent; } + } + + internal virtual string displayName + { + get { return m_Name.shortName; } + } + + internal virtual int nameHashCode + { + get { return m_Name.GetHashCode(); } + } + + internal abstract BundleTreeItem CreateTreeView(int depth); + + protected virtual void RefreshMessages() + { + RefreshEmptyStatus(); + RefreshDupeAssetWarning(); + MessageSystem.MessageFlag flag = m_BundleMessages.HighestMessageFlag(); + m_CachedHighMessage = MessageSystem.GetMessage(flag); + } + + internal abstract bool RefreshEmptyStatus(); + internal abstract bool RefreshDupeAssetWarning(); + + internal virtual MessageSystem.Message HighestMessage() + { + if (m_CachedHighMessage == null) + RefreshMessages(); + return m_CachedHighMessage; + } + + internal bool IsMessageSet(MessageSystem.MessageFlag flag) + { + return m_BundleMessages.IsSet(flag); + } + + internal void SetMessageFlag(MessageSystem.MessageFlag flag, bool on) + { + m_BundleMessages.SetFlag(flag, on); + } + + internal List GetMessages() + { + return m_BundleMessages.GetMessages(); + } + + internal bool HasMessages() + { + return m_BundleMessages.HasMessages(); + } + + internal virtual bool HandleRename(string newName, int reverseDepth) + { + if (reverseDepth == 0) + if (!m_Parent.HandleChildRename(m_Name.shortName, newName)) + return false; + m_Name.PartialNameChange(newName, reverseDepth); + return true; + } + + internal virtual void HandleDelete(bool isRootOfDelete, string forcedNewName = "", string forcedNewVariant = "") + { + if (isRootOfDelete) m_Parent.HandleChildRename(m_Name.shortName, string.Empty); + } + + internal abstract void RefreshAssetList(); + internal abstract void AddAssetsToNode(AssetTreeItem node); + internal abstract void Update(); + + internal virtual bool doneUpdating + { + get { return m_DoneUpdating; } + } + + internal virtual bool dirty + { + get { return m_Dirty; } + } + + internal void ForceNeedUpdate() + { + m_DoneUpdating = false; + m_Dirty = true; + } + + internal abstract void HandleReparent(string parentName, BundleFolderInfo newParent = null); + internal abstract List GetDependencies(); + + internal abstract bool DoesItemMatchSearch(string search); + } + + internal class BundleDependencyInfo + { + public string m_BundleName; + public List m_FromAssets; + public List m_ToAssets; + + public BundleDependencyInfo(string bundleName, AssetInfo fromAsset, AssetInfo toAsset) + { + m_BundleName = bundleName; + m_FromAssets = new List(); + m_FromAssets.Add(fromAsset); + m_ToAssets = new List(); + m_ToAssets.Add(toAsset); + } + } + + internal class BundleDataInfo : BundleInfo + { + protected List m_ConcreteAssets; + protected List m_DependentAssets; + protected List m_BundleDependencies; + protected int m_ConcreteCounter; + protected int m_DependentCounter; + protected bool m_IsSceneBundle; + protected long m_TotalSize; + + internal BundleDataInfo(string name, BundleFolderInfo parent) : base(name, parent) + { + m_ConcreteAssets = new List(); + m_DependentAssets = new List(); + m_BundleDependencies = new List(); + m_ConcreteCounter = 0; + m_DependentCounter = 0; + } + + ~BundleDataInfo() + { + foreach (AssetInfo asset in m_DependentAssets) Model.UnRegisterAsset(asset, m_Name.fullNativeName); + } + + internal override bool HandleRename(string newName, int reverseDepth) + { + RefreshAssetList(); + if (!base.HandleRename(newName, reverseDepth)) + return false; + Model.MoveAssetToBundle(m_ConcreteAssets, m_Name.bundleName, m_Name.variant); + return true; + } + + internal override void HandleDelete(bool isRootOfDelete, string forcedNewName = "", string forcedNewVariant = "") + { + RefreshAssetList(); + base.HandleDelete(isRootOfDelete); + Model.MoveAssetToBundle(m_ConcreteAssets, forcedNewName, forcedNewVariant); + } + + internal string TotalSize() + { + if (m_TotalSize == 0) + return "--"; + return EditorUtility.FormatBytes(m_TotalSize); + } + + internal override void RefreshAssetList() + { + m_BundleMessages.SetFlag(MessageSystem.MessageFlag.AssetsDuplicatedInMultBundles, false); + m_BundleMessages.SetFlag(MessageSystem.MessageFlag.SceneBundleConflict, false); + m_BundleMessages.SetFlag(MessageSystem.MessageFlag.DependencySceneConflict, false); + + m_ConcreteAssets.Clear(); + m_TotalSize = 0; + m_IsSceneBundle = false; + + foreach (AssetInfo asset in m_DependentAssets) Model.UnRegisterAsset(asset, m_Name.fullNativeName); + m_DependentAssets.Clear(); + m_BundleDependencies.Clear(); + + bool assetInBundle = false; + bool sceneError = false; + string[] assets = Model.DataSource.GetAssetPathsFromAssetBundle(m_Name.fullNativeName); + foreach (string assetName in assets) + { + if (AssetDatabase.GetMainAssetTypeAtPath(assetName) == typeof(SceneAsset)) + { + m_IsSceneBundle = true; + if (assetInBundle) + sceneError = true; + } + else + { + assetInBundle = true; + if (m_IsSceneBundle) + sceneError = true; + } + + string bundleName = Model.GetBundleName(assetName); + if (string.IsNullOrEmpty(bundleName)) + { + ///we get here if the current asset is only added due to being in an explicitly added folder + + + string partialPath = assetName; + while ( + !string.IsNullOrEmpty(partialPath) && + partialPath != "Assets" && + string.IsNullOrEmpty(bundleName)) + { + partialPath = partialPath.Substring(0, partialPath.LastIndexOf('/')); + bundleName = Model.GetBundleName(partialPath); + } + + if (!string.IsNullOrEmpty(bundleName)) + { + AssetInfo folderAsset = Model.CreateAsset(partialPath, bundleName); + folderAsset.isFolder = true; + if (m_ConcreteAssets.FindIndex(a => a.displayName == folderAsset.displayName) == -1) m_ConcreteAssets.Add(folderAsset); + + AssetInfo newAsset = Model.CreateAsset(assetName, folderAsset); + if (newAsset != null) + { + m_DependentAssets.Add(newAsset); + if (m_DependentAssets != null && m_DependentAssets.Count > 0) + { + AssetInfo last = m_DependentAssets.Last(); + if (last != null) + m_TotalSize += last.fileSize; + } + } + } + } + else + { + AssetInfo newAsset = Model.CreateAsset(assetName, m_Name.fullNativeName); + if (newAsset != null) + { + m_ConcreteAssets.Add(newAsset); + m_TotalSize += m_ConcreteAssets.Last().fileSize; + if (AssetDatabase.GetMainAssetTypeAtPath(assetName) == typeof(SceneAsset)) + { + m_IsSceneBundle = true; + m_ConcreteAssets.Last().isScene = true; + } + } + } + } + + if (sceneError) + foreach (AssetInfo asset in m_ConcreteAssets) + if (asset.isFolder) + { + asset.SetMessageFlag(MessageSystem.MessageFlag.DependencySceneConflict, true); + m_BundleMessages.SetFlag(MessageSystem.MessageFlag.DependencySceneConflict, true); + } + else + { + asset.SetMessageFlag(MessageSystem.MessageFlag.SceneBundleConflict, true); + m_BundleMessages.SetFlag(MessageSystem.MessageFlag.SceneBundleConflict, true); + } + + + m_ConcreteCounter = 0; + m_DependentCounter = 0; + m_Dirty = true; + } + + internal override void AddAssetsToNode(AssetTreeItem node) + { + foreach (AssetInfo asset in m_ConcreteAssets) + node.AddChild(new AssetTreeItem(asset)); + + foreach (AssetInfo asset in m_DependentAssets) + if (!node.ContainsChild(asset)) + node.AddChild(new AssetTreeItem(asset)); + + m_Dirty = false; + } + + internal List GetBundleDependencies() + { + return m_BundleDependencies; + } + + internal override void Update() + { + int dependents = m_DependentAssets.Count; + int bundleDep = m_BundleDependencies.Count; + if (m_ConcreteCounter < m_ConcreteAssets.Count) + { + GatherDependencies(m_ConcreteAssets[m_ConcreteCounter]); + m_ConcreteCounter++; + m_DoneUpdating = false; + } + else if (m_DependentCounter < m_DependentAssets.Count) + { + GatherDependencies(m_DependentAssets[m_DependentCounter], m_Name.fullNativeName); + m_DependentCounter++; + m_DoneUpdating = false; + } + else + { + m_DoneUpdating = true; + } + + m_Dirty = dependents != m_DependentAssets.Count || bundleDep != m_BundleDependencies.Count; + if (m_Dirty || m_DoneUpdating) + RefreshMessages(); + } + + private void GatherDependencies(AssetInfo asset, string parentBundle = "") + { + if (string.IsNullOrEmpty(parentBundle)) + parentBundle = asset.bundleName; + + if (asset == null) + return; + + List deps = asset.GetDependencies(); + if (deps == null) + return; + + foreach (AssetInfo ai in deps) + { + if (ai == asset || m_ConcreteAssets.Contains(ai) || m_DependentAssets.Contains(ai)) + continue; + + string bundleName = Model.DataSource.GetImplicitAssetBundleName(ai.fullAssetName); + if (string.IsNullOrEmpty(bundleName)) + { + m_DependentAssets.Add(ai); + m_TotalSize += ai.fileSize; + if (Model.RegisterAsset(ai, parentBundle) > 1) SetDuplicateWarning(); + } + else if (bundleName != m_Name.fullNativeName) + { + BundleDependencyInfo dependencyInfo = m_BundleDependencies.Find(m => m.m_BundleName == bundleName); + + if (dependencyInfo == null) + { + dependencyInfo = new BundleDependencyInfo(bundleName, asset, ai); + m_BundleDependencies.Add(dependencyInfo); + } + else + { + dependencyInfo.m_FromAssets.Add(asset); + dependencyInfo.m_ToAssets.Add(ai); + } + } + } + } + + internal override bool RefreshDupeAssetWarning() + { + foreach (AssetInfo asset in m_DependentAssets) + if (asset != null && asset.IsMessageSet(MessageSystem.MessageFlag.AssetsDuplicatedInMultBundles)) + { + SetDuplicateWarning(); + return true; + } + + return false; + } + + internal bool IsEmpty() + { + return m_ConcreteAssets.Count == 0; + } + + internal override bool RefreshEmptyStatus() + { + bool empty = IsEmpty(); + m_BundleMessages.SetFlag(MessageSystem.MessageFlag.EmptyBundle, empty); + return empty; + } + + protected void SetDuplicateWarning() + { + m_BundleMessages.SetFlag(MessageSystem.MessageFlag.AssetsDuplicatedInMultBundles, true); + m_Dirty = true; + } + + internal bool isSceneBundle + { + get { return m_IsSceneBundle; } + } + + internal override BundleTreeItem CreateTreeView(int depth) + { + RefreshAssetList(); + RefreshMessages(); + if (isSceneBundle) + return new BundleTreeItem(this, depth, Model.GetSceneIcon()); + else + return new BundleTreeItem(this, depth, Model.GetBundleIcon()); + } + + internal override void HandleReparent(string parentName, BundleFolderInfo newParent = null) + { + RefreshAssetList(); + string newName = string.IsNullOrEmpty(parentName) ? "" : parentName + '/'; + newName += m_Name.shortName; + if (newName == m_Name.bundleName) + return; + + if (newParent != null && newParent.GetChild(newName) != null) + { + Model.LogWarning("An item named '" + newName + "' already exists at this level in hierarchy. If your desire is to merge bundles, drag one on top of the other."); + return; + } + + foreach (AssetInfo asset in m_ConcreteAssets) Model.MoveAssetToBundle(asset, newName, m_Name.variant); + + if (newParent != null) + { + m_Parent.HandleChildRename(m_Name.shortName, string.Empty); + m_Parent = newParent; + m_Parent.AddChild(this); + } + + m_Name.SetBundleName(newName, m_Name.variant); + } + + internal override List GetDependencies() + { + return m_DependentAssets; + } + + internal override bool DoesItemMatchSearch(string search) + { + foreach (AssetInfo asset in m_ConcreteAssets) + if (asset.displayName.IndexOf(search, StringComparison.OrdinalIgnoreCase) >= 0) + return true; + foreach (AssetInfo asset in m_DependentAssets) + if (asset.displayName.IndexOf(search, StringComparison.OrdinalIgnoreCase) >= 0) + return true; + return false; + } + } + + internal class BundleVariantDataInfo : BundleDataInfo + { + protected List m_FolderIncludeAssets = new List(); + + internal BundleVariantDataInfo(string name, BundleFolderInfo parent) : base(name, parent) + { + } + + internal override string displayName + { + get { return m_Name.variant; } + } + + internal override void Update() + { + base.Update(); + (m_Parent as BundleVariantFolderInfo).ValidateVariants(); + } + + internal override void RefreshAssetList() + { + m_FolderIncludeAssets.Clear(); + base.RefreshAssetList(); + if (m_DependentAssets.Count > 0) + m_FolderIncludeAssets = new List(m_DependentAssets); + } + + internal bool IsSceneVariant() + { + RefreshAssetList(); + return isSceneBundle; + } + + internal override bool HandleRename(string newName, int reverseDepth) + { + if (reverseDepth == 0) + { + RefreshAssetList(); + if (!m_Parent.HandleChildRename(m_Name.variant, newName)) + return false; + m_Name.variant = newName; + Model.MoveAssetToBundle(m_ConcreteAssets, m_Name.bundleName, m_Name.variant); + } + else if (reverseDepth == 1) + { + RefreshAssetList(); + m_Name.PartialNameChange(newName + "." + m_Name.variant, 0); + Model.MoveAssetToBundle(m_ConcreteAssets, m_Name.bundleName, m_Name.variant); + } + else + { + return base.HandleRename(newName, reverseDepth - 1); + } + + return true; + } + + internal override void HandleDelete(bool isRootOfDelete, string forcedNewName = "", string forcedNewVariant = "") + { + RefreshAssetList(); + if (isRootOfDelete) m_Parent.HandleChildRename(m_Name.variant, string.Empty); + Model.MoveAssetToBundle(m_ConcreteAssets, forcedNewName, forcedNewVariant); + } + + internal bool FindContentMismatch(BundleVariantDataInfo other) + { + bool result = false; + + if (m_FolderIncludeAssets.Count != 0 || other.m_FolderIncludeAssets.Count != 0) + { + HashSet myUniqueAssets = new HashSet(); + HashSet otherUniqueAssets = new HashSet(other.m_FolderIncludeAssets.Select(x => x.displayName)); + + foreach (AssetInfo asset in m_FolderIncludeAssets) + if (!otherUniqueAssets.Remove(asset.displayName)) + myUniqueAssets.Add(asset.displayName); + + if (myUniqueAssets.Count > 0) + { + m_BundleMessages.SetFlag(MessageSystem.MessageFlag.VariantBundleMismatch, true); + result = true; + } + + if (otherUniqueAssets.Count > 0) + { + other.m_BundleMessages.SetFlag(MessageSystem.MessageFlag.VariantBundleMismatch, true); + result = true; + } + } + else //this doesn't cover the super weird case of including a folder and some explicit assets. TODO - fix that. + { + HashSet myUniqueAssets = new HashSet(); + HashSet otherUniqueAssets = new HashSet(other.m_ConcreteAssets.Select(x => x.displayName)); + + foreach (AssetInfo asset in m_ConcreteAssets) + if (!otherUniqueAssets.Remove(asset.displayName)) + myUniqueAssets.Add(asset.displayName); + + if (myUniqueAssets.Count > 0) + { + m_BundleMessages.SetFlag(MessageSystem.MessageFlag.VariantBundleMismatch, true); + result = true; + } + + if (otherUniqueAssets.Count > 0) + { + other.m_BundleMessages.SetFlag(MessageSystem.MessageFlag.VariantBundleMismatch, true); + result = true; + } + } + + return result; + } + } + + + internal abstract class BundleFolderInfo : BundleInfo + { + protected Dictionary m_Children; + + internal BundleFolderInfo(string name, BundleFolderInfo parent) : base(name, parent) + { + m_Children = new Dictionary(); + } + + internal BundleFolderInfo(List path, int depth, BundleFolderInfo parent) : base("", parent) + { + m_Children = new Dictionary(); + m_Name = new BundleNameData(""); + m_Name.pathTokens = path.GetRange(0, depth); + } + + internal BundleInfo GetChild(string name) + { + if (name == null) + return null; + + BundleInfo info = null; + if (m_Children.TryGetValue(name, out info)) + return info; + return null; + } + + internal Dictionary.ValueCollection GetChildList() + { + return m_Children.Values; + } + + internal abstract void AddChild(BundleInfo info); + + internal override bool HandleRename(string newName, int reverseDepth) + { + if (!base.HandleRename(newName, reverseDepth)) + return false; + + foreach (KeyValuePair child in m_Children) child.Value.HandleRename(newName, reverseDepth + 1); + return true; + } + + internal override void HandleDelete(bool isRootOfDelete, string forcedNewName = "", string forcedNewVariant = "") + { + base.HandleDelete(isRootOfDelete); + foreach (KeyValuePair child in m_Children) child.Value.HandleDelete(false, forcedNewName, forcedNewVariant); + m_Children.Clear(); + } + + internal override bool DoesItemMatchSearch(string search) + { + return false; //folders don't ever match. + } + + protected override void RefreshMessages() + { + m_BundleMessages.SetFlag(MessageSystem.MessageFlag.ErrorInChildren, false); + foreach (KeyValuePair child in m_Children) + if (child.Value.IsMessageSet(MessageSystem.MessageFlag.Error)) + { + m_BundleMessages.SetFlag(MessageSystem.MessageFlag.ErrorInChildren, true); + break; + } + + base.RefreshMessages(); + } + + internal override bool RefreshEmptyStatus() + { + bool empty = m_Children.Count == 0; + foreach (KeyValuePair child in m_Children) empty |= child.Value.RefreshEmptyStatus(); + m_BundleMessages.SetFlag(MessageSystem.MessageFlag.EmptyFolder, empty); + return empty; + } + + internal override void RefreshAssetList() + { + foreach (KeyValuePair child in m_Children) child.Value.RefreshAssetList(); + } + + internal override bool RefreshDupeAssetWarning() + { + bool dupeWarning = false; + foreach (KeyValuePair child in m_Children) dupeWarning |= child.Value.RefreshDupeAssetWarning(); + m_BundleMessages.SetFlag(MessageSystem.MessageFlag.WarningInChildren, dupeWarning); + return dupeWarning; + } + + internal override void AddAssetsToNode(AssetTreeItem node) + { + foreach (KeyValuePair child in m_Children) child.Value.AddAssetsToNode(node); + m_Dirty = false; + } + + internal virtual bool HandleChildRename(string oldName, string newName) + { + if (!string.IsNullOrEmpty(newName) && m_Children.ContainsKey(newName)) + { + Model.LogWarning("Attempting to name an item '" + newName + "' which matches existing name at this level in hierarchy. If your desire is to merge bundles, drag one on top of the other."); + return false; + } + + BundleInfo info = null; + if (m_Children.TryGetValue(oldName, out info)) + { + m_Children.Remove(oldName); + if (!string.IsNullOrEmpty(newName)) + m_Children.Add(newName, info); + } + + return true; + } + + internal override void Update() + { + m_Dirty = false; + m_DoneUpdating = true; + foreach (KeyValuePair child in m_Children) + { + child.Value.Update(); + m_Dirty |= child.Value.dirty; + m_DoneUpdating &= child.Value.doneUpdating; + } + + if (m_Dirty || m_DoneUpdating) + RefreshMessages(); + } + + internal override bool doneUpdating + { + get + { + foreach (KeyValuePair child in m_Children) m_DoneUpdating &= child.Value.doneUpdating; + return base.doneUpdating; + } + } + + + internal override List GetDependencies() + { + List assets = new List(); + foreach (KeyValuePair child in m_Children) assets.AddRange(child.Value.GetDependencies()); + return assets; + } + } + + internal class BundleFolderConcreteInfo : BundleFolderInfo + { + internal BundleFolderConcreteInfo(string name, BundleFolderInfo parent) : base(name, parent) + { + } + + internal BundleFolderConcreteInfo(List path, int depth, BundleFolderInfo parent) : base(path, depth, parent) + { + } + + internal override void AddChild(BundleInfo info) + { + m_Children.Add(info.displayName, info); + } + + internal override BundleTreeItem CreateTreeView(int depth) + { + RefreshMessages(); + BundleTreeItem result = new BundleTreeItem(this, depth, Model.GetFolderIcon()); + foreach (KeyValuePair child in m_Children) result.AddChild(child.Value.CreateTreeView(depth + 1)); + return result; + } + + internal override void HandleReparent(string parentName, BundleFolderInfo newParent = null) + { + string newName = string.IsNullOrEmpty(parentName) ? "" : parentName + '/'; + newName += displayName; + if (newName == m_Name.bundleName) + return; + + if (newParent != null && newParent.GetChild(newName) != null) + { + Model.LogWarning("An item named '" + newName + "' already exists at this level in hierarchy. If your desire is to merge bundles, drag one on top of the other."); + return; + } + + foreach (KeyValuePair child in m_Children) child.Value.HandleReparent(newName); + + if (newParent != null) + { + m_Parent.HandleChildRename(m_Name.shortName, string.Empty); + m_Parent = newParent; + m_Parent.AddChild(this); + } + + m_Name.SetBundleName(newName, m_Name.variant); + } + } + + + internal class BundleVariantFolderInfo : BundleFolderInfo + { + internal BundleVariantFolderInfo(string name, BundleFolderInfo parent) : base(name, parent) + { + } + + internal override void AddChild(BundleInfo info) + { + m_Children.Add(info.m_Name.variant, info); + } + + private bool m_validated; + + internal override void Update() + { + m_validated = false; + base.Update(); + if (!m_validated) + ValidateVariants(); + } + + internal void ValidateVariants() + { + m_validated = true; + bool childMismatch = false; + if (m_Children.Count > 1) + { + BundleVariantDataInfo goldChild = null; + foreach (KeyValuePair c in m_Children) + { + BundleVariantDataInfo child = c.Value as BundleVariantDataInfo; + child.SetMessageFlag(MessageSystem.MessageFlag.VariantBundleMismatch, false); + if (goldChild == null) + { + goldChild = child; + continue; + } + + childMismatch |= goldChild.FindContentMismatch(child); + } + } + + m_BundleMessages.SetFlag(MessageSystem.MessageFlag.VariantBundleMismatch, childMismatch); + } + + internal override BundleTreeItem CreateTreeView(int depth) + { + RefreshMessages(); + Texture2D icon = null; + if (m_Children.Count > 0 && + (m_Children.First().Value as BundleVariantDataInfo).IsSceneVariant()) + icon = Model.GetSceneIcon(); + else + icon = Model.GetBundleIcon(); + + BundleTreeItem result = new BundleTreeItem(this, depth, icon); + foreach (KeyValuePair child in m_Children) result.AddChild(child.Value.CreateTreeView(depth + 1)); + return result; + } + + internal override void HandleReparent(string parentName, BundleFolderInfo newParent = null) + { + string newName = string.IsNullOrEmpty(parentName) ? "" : parentName + '/'; + newName += displayName; + if (newName == m_Name.bundleName) + return; + + if (newParent != null && newParent.GetChild(newName) != null) + { + Model.LogWarning("An item named '" + newName + "' already exists at this level in hierarchy. If your desire is to merge bundles, drag one on top of the other."); + return; + } + + foreach (KeyValuePair child in m_Children) child.Value.HandleReparent(parentName); + + if (newParent != null) + { + m_Parent.HandleChildRename(m_Name.shortName, string.Empty); + m_Parent = newParent; + m_Parent.AddChild(this); + } + + m_Name.SetBundleName(newName, string.Empty); + } + + internal override bool HandleChildRename(string oldName, string newName) + { + bool result = base.HandleChildRename(oldName, newName); + if (m_Children.Count == 0) + HandleDelete(true); + return result; + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleModel/ABModelBundleInfo.cs.meta b/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleModel/ABModelBundleInfo.cs.meta new file mode 100644 index 0000000..75d82f4 --- /dev/null +++ b/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleModel/ABModelBundleInfo.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0909f7af70db1114abcc90714f37acb2 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleTree.cs b/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleTree.cs new file mode 100644 index 0000000..fc6ebc0 --- /dev/null +++ b/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleTree.cs @@ -0,0 +1,630 @@ +using UnityEditor; +using UnityEngine; +using System.Collections.Generic; +using UnityEditor.IMGUI.Controls; +using System.Linq; +using System; +using AssetBundleBrowser.AssetBundleModel; + + +namespace AssetBundleBrowser +{ + internal class AssetBundleTree : TreeView + { + private AssetBundleManageTab m_Controller; + private bool m_ContextOnItem = false; + private List m_EmptyObjectList = new List(); + + internal AssetBundleTree(TreeViewState state, AssetBundleManageTab ctrl) : base(state) + { + AssetBundleModel.Model.Rebuild(); + m_Controller = ctrl; + showBorder = true; + } + + protected override bool CanMultiSelect(TreeViewItem item) + { + return true; + } + + protected override bool CanRename(TreeViewItem item) + { + return item != null && item.displayName.Length > 0; + } + + protected override bool DoesItemMatchSearch(TreeViewItem item, string search) + { + BundleTreeItem bundleItem = item as AssetBundleModel.BundleTreeItem; + return bundleItem.bundle.DoesItemMatchSearch(search); + } + + protected override void RowGUI(RowGUIArgs args) + { + BundleTreeItem bundleItem = args.item as AssetBundleModel.BundleTreeItem; + if (args.item.icon == null) + extraSpaceBeforeIconAndLabel = 16f; + else + extraSpaceBeforeIconAndLabel = 0f; + + Color old = GUI.color; + if (bundleItem.bundle as AssetBundleModel.BundleVariantFolderInfo != null) + GUI.color = AssetBundleModel.Model.k_LightGrey; //new Color(0.3f, 0.5f, 0.85f); + base.RowGUI(args); + GUI.color = old; + + MessageSystem.Message message = bundleItem.BundleMessage(); + if (message.severity != MessageType.None) + { + float size = args.rowRect.height; + float right = args.rowRect.xMax; + Rect messageRect = new Rect(right - size, args.rowRect.yMin, size, size); + GUI.Label(messageRect, new GUIContent(message.icon, message.message)); + } + } + + protected override void RenameEnded(RenameEndedArgs args) + { + base.RenameEnded(args); + if (args.newName.Length > 0 && args.newName != args.originalName) + { + args.newName = args.newName.ToLower(); + args.acceptedRename = true; + + BundleTreeItem renamedItem = FindItem(args.itemID, rootItem) as AssetBundleModel.BundleTreeItem; + args.acceptedRename = AssetBundleModel.Model.HandleBundleRename(renamedItem, args.newName); + ReloadAndSelect(renamedItem.bundle.nameHashCode, false); + } + else + { + args.acceptedRename = false; + } + } + + protected override TreeViewItem BuildRoot() + { + AssetBundleModel.Model.Refresh(); + BundleTreeItem root = AssetBundleModel.Model.CreateBundleTreeView(); + return root; + } + + protected override void SelectionChanged(IList selectedIds) + { + List selectedBundles = new List(); + if (selectedIds != null) + foreach (int id in selectedIds) + { + BundleTreeItem item = FindItem(id, rootItem) as AssetBundleModel.BundleTreeItem; + if (item != null && item.bundle != null) + { + item.bundle.RefreshAssetList(); + selectedBundles.Add(item.bundle); + } + } + + m_Controller.UpdateSelectedBundles(selectedBundles); + } + + public override void OnGUI(Rect rect) + { + base.OnGUI(rect); + if (Event.current.type == EventType.MouseDown && Event.current.button == 0 && rect.Contains(Event.current.mousePosition)) SetSelection(new int[0], TreeViewSelectionOptions.FireSelectionChanged); + } + + + protected override void ContextClicked() + { + if (m_ContextOnItem) + { + m_ContextOnItem = false; + return; + } + + List selectedNodes = new List(); + GenericMenu menu = new GenericMenu(); + + if (!AssetBundleModel.Model.DataSource.IsReadOnly()) + { + menu.AddItem(new GUIContent("Add new bundle"), false, CreateNewBundle, selectedNodes); + menu.AddItem(new GUIContent("Add new folder"), false, CreateFolder, selectedNodes); + } + + menu.AddItem(new GUIContent("Reload all data"), false, ForceReloadData, selectedNodes); + menu.ShowAsContext(); + } + + protected override void ContextClickedItem(int id) + { + if (AssetBundleModel.Model.DataSource.IsReadOnly()) return; + + m_ContextOnItem = true; + List selectedNodes = new List(); + foreach (int nodeID in GetSelection()) selectedNodes.Add(FindItem(nodeID, rootItem) as AssetBundleModel.BundleTreeItem); + + GenericMenu menu = new GenericMenu(); + + if (selectedNodes.Count == 1) + { + if (selectedNodes[0].bundle as AssetBundleModel.BundleFolderConcreteInfo != null) + { + menu.AddItem(new GUIContent("Add Child/New Bundle"), false, CreateNewBundle, selectedNodes); + menu.AddItem(new GUIContent("Add Child/New Folder"), false, CreateFolder, selectedNodes); + menu.AddItem(new GUIContent("Add Sibling/New Bundle"), false, CreateNewSiblingBundle, selectedNodes); + menu.AddItem(new GUIContent("Add Sibling/New Folder"), false, CreateNewSiblingFolder, selectedNodes); + } + else if (selectedNodes[0].bundle as AssetBundleModel.BundleVariantFolderInfo != null) + { + menu.AddItem(new GUIContent("Add Child/New Variant"), false, CreateNewVariant, selectedNodes); + menu.AddItem(new GUIContent("Add Sibling/New Bundle"), false, CreateNewSiblingBundle, selectedNodes); + menu.AddItem(new GUIContent("Add Sibling/New Folder"), false, CreateNewSiblingFolder, selectedNodes); + } + else + { + BundleVariantDataInfo variant = selectedNodes[0].bundle as AssetBundleModel.BundleVariantDataInfo; + if (variant == null) + { + menu.AddItem(new GUIContent("Add Sibling/New Bundle"), false, CreateNewSiblingBundle, selectedNodes); + menu.AddItem(new GUIContent("Add Sibling/New Folder"), false, CreateNewSiblingFolder, selectedNodes); + menu.AddItem(new GUIContent("Convert to variant"), false, ConvertToVariant, selectedNodes); + } + else + { + menu.AddItem(new GUIContent("Add Sibling/New Variant"), false, CreateNewSiblingVariant, selectedNodes); + } + } + + if (selectedNodes[0].bundle.IsMessageSet(MessageSystem.MessageFlag.AssetsDuplicatedInMultBundles)) + menu.AddItem(new GUIContent("Move duplicates to new bundle"), false, DedupeAllBundles, selectedNodes); + menu.AddItem(new GUIContent("Rename"), false, RenameBundle, selectedNodes); + menu.AddItem(new GUIContent("Delete " + selectedNodes[0].displayName), false, DeleteBundles, selectedNodes); + } + else if (selectedNodes.Count > 1) + { + menu.AddItem(new GUIContent("Move duplicates shared by selected"), false, DedupeOverlappedBundles, selectedNodes); + menu.AddItem(new GUIContent("Move duplicates existing in any selected"), false, DedupeAllBundles, selectedNodes); + menu.AddItem(new GUIContent("Delete " + selectedNodes.Count + " selected bundles"), false, DeleteBundles, selectedNodes); + } + + menu.ShowAsContext(); + } + + private void ForceReloadData(object context) + { + AssetBundleModel.Model.ForceReloadData(this); + } + + private void CreateNewSiblingFolder(object context) + { + List selectedNodes = context as List; + if (selectedNodes != null && selectedNodes.Count > 0) + { + AssetBundleModel.BundleFolderConcreteInfo folder = null; + folder = selectedNodes[0].bundle.parent as AssetBundleModel.BundleFolderConcreteInfo; + CreateFolderUnderParent(folder); + } + else + { + Debug.LogError("could not add 'sibling' with no bundles selected"); + } + } + + private void CreateFolder(object context) + { + AssetBundleModel.BundleFolderConcreteInfo folder = null; + List selectedNodes = context as List; + if (selectedNodes != null && selectedNodes.Count > 0) folder = selectedNodes[0].bundle as AssetBundleModel.BundleFolderConcreteInfo; + CreateFolderUnderParent(folder); + } + + private void CreateFolderUnderParent(AssetBundleModel.BundleFolderConcreteInfo folder) + { + BundleFolderInfo newBundle = AssetBundleModel.Model.CreateEmptyBundleFolder(folder); + ReloadAndSelect(newBundle.nameHashCode, true); + } + + private void RenameBundle(object context) + { + List selectedNodes = context as List; + if (selectedNodes != null && selectedNodes.Count > 0) BeginRename(FindItem(selectedNodes[0].bundle.nameHashCode, rootItem)); + } + + private void CreateNewSiblingBundle(object context) + { + List selectedNodes = context as List; + if (selectedNodes != null && selectedNodes.Count > 0) + { + AssetBundleModel.BundleFolderConcreteInfo folder = null; + folder = selectedNodes[0].bundle.parent as AssetBundleModel.BundleFolderConcreteInfo; + CreateBundleUnderParent(folder); + } + else + { + Debug.LogError("could not add 'sibling' with no bundles selected"); + } + } + + private void CreateNewBundle(object context) + { + AssetBundleModel.BundleFolderConcreteInfo folder = null; + List selectedNodes = context as List; + if (selectedNodes != null && selectedNodes.Count > 0) folder = selectedNodes[0].bundle as AssetBundleModel.BundleFolderConcreteInfo; + CreateBundleUnderParent(folder); + } + + private void CreateBundleUnderParent(AssetBundleModel.BundleFolderInfo folder) + { + BundleInfo newBundle = AssetBundleModel.Model.CreateEmptyBundle(folder); + ReloadAndSelect(newBundle.nameHashCode, true); + } + + + private void CreateNewSiblingVariant(object context) + { + List selectedNodes = context as List; + if (selectedNodes != null && selectedNodes.Count > 0) + { + AssetBundleModel.BundleVariantFolderInfo folder = null; + folder = selectedNodes[0].bundle.parent as AssetBundleModel.BundleVariantFolderInfo; + CreateVariantUnderParent(folder); + } + else + { + Debug.LogError("could not add 'sibling' with no bundles selected"); + } + } + + private void CreateNewVariant(object context) + { + AssetBundleModel.BundleVariantFolderInfo folder = null; + List selectedNodes = context as List; + if (selectedNodes != null && selectedNodes.Count == 1) + { + folder = selectedNodes[0].bundle as AssetBundleModel.BundleVariantFolderInfo; + CreateVariantUnderParent(folder); + } + } + + private void CreateVariantUnderParent(AssetBundleModel.BundleVariantFolderInfo folder) + { + if (folder != null) + { + BundleInfo newBundle = AssetBundleModel.Model.CreateEmptyVariant(folder); + ReloadAndSelect(newBundle.nameHashCode, true); + } + } + + private void ConvertToVariant(object context) + { + List selectedNodes = context as List; + if (selectedNodes.Count == 1) + { + BundleDataInfo bundle = selectedNodes[0].bundle as AssetBundleModel.BundleDataInfo; + BundleInfo newBundle = AssetBundleModel.Model.HandleConvertToVariant(bundle); + int hash = 0; + if (newBundle != null) + hash = newBundle.nameHashCode; + ReloadAndSelect(hash, true); + } + } + + private void DedupeOverlappedBundles(object context) + { + DedupeBundles(context, true); + } + + private void DedupeAllBundles(object context) + { + DedupeBundles(context, false); + } + + private void DedupeBundles(object context, bool onlyOverlappedAssets) + { + List selectedNodes = context as List; + BundleInfo newBundle = AssetBundleModel.Model.HandleDedupeBundles(selectedNodes.Select(item => item.bundle), onlyOverlappedAssets); + if (newBundle != null) + { + List selection = new List(); + selection.Add(newBundle.nameHashCode); + ReloadAndSelect(selection); + } + else + { + if (onlyOverlappedAssets) + Debug.LogWarning("There were no duplicated assets that existed across all selected bundles."); + else + Debug.LogWarning("No duplicate assets found after refreshing bundle contents."); + } + } + + private void DeleteBundles(object b) + { + List selectedNodes = b as List; + AssetBundleModel.Model.HandleBundleDelete(selectedNodes.Select(item => item.bundle)); + ReloadAndSelect(new List()); + } + + protected override void KeyEvent() + { + if (Event.current.keyCode == KeyCode.Delete && GetSelection().Count > 0) + { + List selectedNodes = new List(); + foreach (int nodeID in GetSelection()) selectedNodes.Add(FindItem(nodeID, rootItem) as AssetBundleModel.BundleTreeItem); + DeleteBundles(selectedNodes); + } + } + + private class DragAndDropData + { + internal bool hasBundleFolder = false; + internal bool hasScene = false; + internal bool hasNonScene = false; + internal bool hasVariantChild = false; + internal List draggedNodes; + internal AssetBundleModel.BundleTreeItem targetNode; + internal DragAndDropArgs args; + internal string[] paths; + + internal DragAndDropData(DragAndDropArgs a) + { + args = a; + draggedNodes = DragAndDrop.GetGenericData("AssetBundleModel.BundleInfo") as List; + targetNode = args.parentItem as AssetBundleModel.BundleTreeItem; + paths = DragAndDrop.paths; + + if (draggedNodes != null) + foreach (BundleInfo bundle in draggedNodes) + if (bundle as AssetBundleModel.BundleFolderInfo != null) + { + hasBundleFolder = true; + } + else + { + BundleDataInfo dataBundle = bundle as AssetBundleModel.BundleDataInfo; + if (dataBundle != null) + { + if (dataBundle.isSceneBundle) + hasScene = true; + else + hasNonScene = true; + + if (dataBundle as AssetBundleModel.BundleVariantDataInfo != null) + hasVariantChild = true; + } + } + else if (DragAndDrop.paths != null) + foreach (string assetPath in DragAndDrop.paths) + if (AssetDatabase.GetMainAssetTypeAtPath(assetPath) == typeof(SceneAsset)) + hasScene = true; + else + hasNonScene = true; + } + } + + protected override DragAndDropVisualMode HandleDragAndDrop(DragAndDropArgs args) + { + DragAndDropVisualMode visualMode = DragAndDropVisualMode.None; + DragAndDropData data = new DragAndDropData(args); + + if (AssetBundleModel.Model.DataSource.IsReadOnly()) return DragAndDropVisualMode.Rejected; + + if (data.hasScene && data.hasNonScene || + data.hasVariantChild) + return DragAndDropVisualMode.Rejected; + + switch (args.dragAndDropPosition) + { + case DragAndDropPosition.UponItem: + visualMode = HandleDragDropUpon(data); + break; + case DragAndDropPosition.BetweenItems: + visualMode = HandleDragDropBetween(data); + break; + case DragAndDropPosition.OutsideItems: + if (data.draggedNodes != null) + { + visualMode = DragAndDropVisualMode.Copy; + if (data.args.performDrop) + { + AssetBundleModel.Model.HandleBundleReparent(data.draggedNodes, null); + Reload(); + } + } + else if (data.paths != null) + { + visualMode = DragAndDropVisualMode.Copy; + if (data.args.performDrop) DragPathsToNewSpace(data.paths, null); + } + + break; + } + + return visualMode; + } + + private DragAndDropVisualMode HandleDragDropUpon(DragAndDropData data) + { + DragAndDropVisualMode visualMode = DragAndDropVisualMode.Copy; //Move; + BundleDataInfo targetDataBundle = data.targetNode.bundle as AssetBundleModel.BundleDataInfo; + if (targetDataBundle != null) + { + if (targetDataBundle.isSceneBundle) + { + if (data.hasNonScene) + return DragAndDropVisualMode.Rejected; + } + else + { + if (data.hasBundleFolder) + return DragAndDropVisualMode.Rejected; + else if (data.hasScene && !targetDataBundle.IsEmpty()) return DragAndDropVisualMode.Rejected; + } + + + if (data.args.performDrop) + { + if (data.draggedNodes != null) + { + AssetBundleModel.Model.HandleBundleMerge(data.draggedNodes, targetDataBundle); + ReloadAndSelect(targetDataBundle.nameHashCode, false); + } + else if (data.paths != null) + { + AssetBundleModel.Model.MoveAssetToBundle(data.paths, targetDataBundle.m_Name.bundleName, targetDataBundle.m_Name.variant); + AssetBundleModel.Model.ExecuteAssetMove(); + ReloadAndSelect(targetDataBundle.nameHashCode, false); + } + } + } + else + { + BundleFolderInfo folder = data.targetNode.bundle as AssetBundleModel.BundleFolderInfo; + if (folder != null) + { + if (data.args.performDrop) + { + if (data.draggedNodes != null) + { + AssetBundleModel.Model.HandleBundleReparent(data.draggedNodes, folder); + Reload(); + } + else if (data.paths != null) + { + DragPathsToNewSpace(data.paths, folder); + } + } + } + else + { + visualMode = DragAndDropVisualMode.Rejected; //must be a variantfolder + } + } + + return visualMode; + } + + private DragAndDropVisualMode HandleDragDropBetween(DragAndDropData data) + { + DragAndDropVisualMode visualMode = DragAndDropVisualMode.Copy; //Move; + + BundleTreeItem parent = data.args.parentItem as AssetBundleModel.BundleTreeItem; + + if (parent != null) + { + BundleVariantFolderInfo variantFolder = parent.bundle as AssetBundleModel.BundleVariantFolderInfo; + if (variantFolder != null) + return DragAndDropVisualMode.Rejected; + + if (data.args.performDrop) + { + BundleFolderConcreteInfo folder = parent.bundle as AssetBundleModel.BundleFolderConcreteInfo; + if (folder != null) + { + if (data.draggedNodes != null) + { + AssetBundleModel.Model.HandleBundleReparent(data.draggedNodes, folder); + Reload(); + } + else if (data.paths != null) + { + DragPathsToNewSpace(data.paths, folder); + } + } + } + } + + return visualMode; + } + + private string[] dragToNewSpacePaths = null; + private AssetBundleModel.BundleFolderInfo dragToNewSpaceRoot = null; + + private void DragPathsAsOneBundle() + { + BundleInfo newBundle = AssetBundleModel.Model.CreateEmptyBundle(dragToNewSpaceRoot); + AssetBundleModel.Model.MoveAssetToBundle(dragToNewSpacePaths, newBundle.m_Name.bundleName, newBundle.m_Name.variant); + AssetBundleModel.Model.ExecuteAssetMove(); + ReloadAndSelect(newBundle.nameHashCode, true); + } + + private void DragPathsAsManyBundles() + { + List hashCodes = new List(); + foreach (string assetPath in dragToNewSpacePaths) + { + BundleInfo newBundle = AssetBundleModel.Model.CreateEmptyBundle(dragToNewSpaceRoot, System.IO.Path.GetFileNameWithoutExtension(assetPath).ToLower()); + AssetBundleModel.Model.MoveAssetToBundle(assetPath, newBundle.m_Name.bundleName, newBundle.m_Name.variant); + hashCodes.Add(newBundle.nameHashCode); + } + + AssetBundleModel.Model.ExecuteAssetMove(); + ReloadAndSelect(hashCodes); + } + + private void DragPathsToNewSpace(string[] paths, AssetBundleModel.BundleFolderInfo root) + { + dragToNewSpacePaths = paths; + dragToNewSpaceRoot = root; + if (paths.Length > 1) + { + GenericMenu menu = new GenericMenu(); + menu.AddItem(new GUIContent("Create 1 Bundle"), false, DragPathsAsOneBundle); + string message = "Create "; + message += paths.Length; + message += " Bundles"; + menu.AddItem(new GUIContent(message), false, DragPathsAsManyBundles); + menu.ShowAsContext(); + } + else + { + DragPathsAsManyBundles(); + } + } + + protected override void SetupDragAndDrop(SetupDragAndDropArgs args) + { + if (args.draggedItemIDs == null) + return; + + DragAndDrop.PrepareStartDrag(); + + List selectedBundles = new List(); + foreach (int id in args.draggedItemIDs) + { + BundleTreeItem item = FindItem(id, rootItem) as AssetBundleModel.BundleTreeItem; + selectedBundles.Add(item.bundle); + } + + DragAndDrop.paths = null; + DragAndDrop.objectReferences = m_EmptyObjectList.ToArray(); + DragAndDrop.SetGenericData("AssetBundleModel.BundleInfo", selectedBundles); + DragAndDrop.visualMode = DragAndDropVisualMode.Copy; //Move; + DragAndDrop.StartDrag("AssetBundleTree"); + } + + protected override bool CanStartDrag(CanStartDragArgs args) + { + return true; + } + + internal void Refresh() + { + IList selection = GetSelection(); + Reload(); + SelectionChanged(selection); + } + + private void ReloadAndSelect(int hashCode, bool rename) + { + List selection = new List(); + selection.Add(hashCode); + ReloadAndSelect(selection); + if (rename) BeginRename(FindItem(hashCode, rootItem), 0.25f); + } + + private void ReloadAndSelect(IList hashCodes) + { + Reload(); + SetSelection(hashCodes, TreeViewSelectionOptions.RevealAndFrame); + SelectionChanged(hashCodes); + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleTree.cs.meta b/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleTree.cs.meta new file mode 100644 index 0000000..ef357c3 --- /dev/null +++ b/Assets/Plugins/AssetBundles-Browser/Editor/AssetBundleTree.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 54744ac396176e74aaed3c5053b12150 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/AssetListTree.cs b/Assets/Plugins/AssetBundles-Browser/Editor/AssetListTree.cs new file mode 100644 index 0000000..c30c948 --- /dev/null +++ b/Assets/Plugins/AssetBundles-Browser/Editor/AssetListTree.cs @@ -0,0 +1,447 @@ +using UnityEditor; +using UnityEngine; +using System.Collections.Generic; +using UnityEditor.IMGUI.Controls; +using System.Linq; +using AssetBundleBrowser.AssetBundleModel; + +//using System; + + +namespace AssetBundleBrowser +{ + internal class AssetListTree : TreeView + { + private List m_SourceBundles = new List(); + private AssetBundleManageTab m_Controller; + private List m_EmptyObjectList = new List(); + + internal static MultiColumnHeaderState CreateDefaultMultiColumnHeaderState() + { + return new MultiColumnHeaderState(GetColumns()); + } + + private static MultiColumnHeaderState.Column[] GetColumns() + { + MultiColumnHeaderState.Column[] retVal = new MultiColumnHeaderState.Column[] + { + new MultiColumnHeaderState.Column(), + new MultiColumnHeaderState.Column(), + new MultiColumnHeaderState.Column(), + new MultiColumnHeaderState.Column() + }; + retVal[0].headerContent = new GUIContent("Asset", "Short name of asset. For full name select asset and see message below"); + retVal[0].minWidth = 50; + retVal[0].width = 100; + retVal[0].maxWidth = 300; + retVal[0].headerTextAlignment = TextAlignment.Left; + retVal[0].canSort = true; + retVal[0].autoResize = true; + + retVal[1].headerContent = new GUIContent("Bundle", "Bundle name. 'auto' means asset was pulled in due to dependency"); + retVal[1].minWidth = 50; + retVal[1].width = 100; + retVal[1].maxWidth = 300; + retVal[1].headerTextAlignment = TextAlignment.Left; + retVal[1].canSort = true; + retVal[1].autoResize = true; + + retVal[2].headerContent = new GUIContent("Size", "Size on disk"); + retVal[2].minWidth = 30; + retVal[2].width = 75; + retVal[2].maxWidth = 100; + retVal[2].headerTextAlignment = TextAlignment.Left; + retVal[2].canSort = true; + retVal[2].autoResize = true; + + retVal[3].headerContent = new GUIContent("!", "Errors, Warnings, or Info"); + retVal[3].minWidth = 16; + retVal[3].width = 16; + retVal[3].maxWidth = 16; + retVal[3].headerTextAlignment = TextAlignment.Left; + retVal[3].canSort = true; + retVal[3].autoResize = false; + + return retVal; + } + + private enum MyColumns + { + Asset, + Bundle, + Size, + Message + } + + internal enum SortOption + { + Asset, + Bundle, + Size, + Message + } + + private SortOption[] m_SortOptions = + { + SortOption.Asset, + SortOption.Bundle, + SortOption.Size, + SortOption.Message + }; + + internal AssetListTree(TreeViewState state, MultiColumnHeaderState mchs, AssetBundleManageTab ctrl) : base(state, new MultiColumnHeader(mchs)) + { + m_Controller = ctrl; + showBorder = true; + showAlternatingRowBackgrounds = true; + multiColumnHeader.sortingChanged += OnSortingChanged; + } + + + internal void Update() + { + bool dirty = false; + foreach (BundleInfo bundle in m_SourceBundles) dirty |= bundle.dirty; + if (dirty) + Reload(); + } + + public override void OnGUI(Rect rect) + { + base.OnGUI(rect); + if (Event.current.type == EventType.MouseDown && Event.current.button == 0 && rect.Contains(Event.current.mousePosition)) SetSelection(new int[0], TreeViewSelectionOptions.FireSelectionChanged); + } + + + protected override IList BuildRows(TreeViewItem root) + { + IList rows = base.BuildRows(root); + SortIfNeeded(root, rows); + return rows; + } + + internal void SetSelectedBundles(IEnumerable bundles) + { + m_Controller.SetSelectedItems(null); + m_SourceBundles = bundles.ToList(); + SetSelection(new List()); + Reload(); + } + + protected override TreeViewItem BuildRoot() + { + AssetTreeItem root = AssetBundleModel.Model.CreateAssetListTreeView(m_SourceBundles); + return root; + } + + protected override void RowGUI(RowGUIArgs args) + { + for (int i = 0; i < args.GetNumVisibleColumns(); ++i) + CellGUI(args.GetCellRect(i), args.item as AssetBundleModel.AssetTreeItem, args.GetColumn(i), ref args); + } + + private void CellGUI(Rect cellRect, AssetBundleModel.AssetTreeItem item, int column, ref RowGUIArgs args) + { + Color oldColor = GUI.color; + CenterRectUsingSingleLineHeight(ref cellRect); + if (column != 3) + GUI.color = item.itemColor; + + switch (column) + { + case 0: + { + Rect iconRect = new Rect(cellRect.x + 1, cellRect.y + 1, cellRect.height - 2, cellRect.height - 2); + if (item.icon != null) + GUI.DrawTexture(iconRect, item.icon, ScaleMode.ScaleToFit); + DefaultGUI.Label( + new Rect(cellRect.x + iconRect.xMax + 1, cellRect.y, cellRect.width - iconRect.width, cellRect.height), + item.displayName, + args.selected, + args.focused); + } + break; + case 1: + DefaultGUI.Label(cellRect, item.asset.bundleName, args.selected, args.focused); + break; + case 2: + DefaultGUI.Label(cellRect, item.asset.GetSizeString(), args.selected, args.focused); + break; + case 3: + Texture2D icon = item.MessageIcon(); + if (icon != null) + { + Rect iconRect = new Rect(cellRect.x, cellRect.y, cellRect.height, cellRect.height); + GUI.DrawTexture(iconRect, icon, ScaleMode.ScaleToFit); + } + + break; + } + + GUI.color = oldColor; + } + + protected override void DoubleClickedItem(int id) + { + AssetTreeItem assetItem = FindItem(id, rootItem) as AssetBundleModel.AssetTreeItem; + if (assetItem != null) + { + Object o = AssetDatabase.LoadAssetAtPath(assetItem.asset.fullAssetName); + EditorGUIUtility.PingObject(o); + Selection.activeObject = o; + } + } + + public void SetSelection(List paths) + { + List selected = new List(); + AddIfInPaths(paths, selected, rootItem); + SetSelection(selected); + } + + private void AddIfInPaths(List paths, List selected, TreeViewItem me) + { + AssetTreeItem assetItem = me as AssetBundleModel.AssetTreeItem; + if (assetItem != null && assetItem.asset != null) + if (paths.Contains(assetItem.asset.fullAssetName)) + if (selected.Contains(me.id) == false) + selected.Add(me.id); + + if (me.hasChildren) + foreach (TreeViewItem item in me.children) + AddIfInPaths(paths, selected, item); + } + + protected override void SelectionChanged(IList selectedIds) + { + if (selectedIds == null) + return; + + List selectedObjects = new List(); + List selectedAssets = new List(); + foreach (int id in selectedIds) + { + AssetTreeItem assetItem = FindItem(id, rootItem) as AssetBundleModel.AssetTreeItem; + if (assetItem != null) + { + Object o = AssetDatabase.LoadAssetAtPath(assetItem.asset.fullAssetName); + selectedObjects.Add(o); + Selection.activeObject = o; + selectedAssets.Add(assetItem.asset); + } + } + + m_Controller.SetSelectedItems(selectedAssets); + Selection.objects = selectedObjects.ToArray(); + } + + protected override bool CanBeParent(TreeViewItem item) + { + return false; + } + + protected override bool CanStartDrag(CanStartDragArgs args) + { + args.draggedItemIDs = GetSelection(); + return true; + } + + protected override void SetupDragAndDrop(SetupDragAndDropArgs args) + { + DragAndDrop.PrepareStartDrag(); + DragAndDrop.objectReferences = m_EmptyObjectList.ToArray(); + List items = + new List(args.draggedItemIDs.Select(id => FindItem(id, rootItem) as AssetBundleModel.AssetTreeItem)); + DragAndDrop.paths = items.Select(a => a.asset.fullAssetName).ToArray(); + DragAndDrop.SetGenericData("AssetListTreeSource", this); + DragAndDrop.StartDrag("AssetListTree"); + } + + protected override DragAndDropVisualMode HandleDragAndDrop(DragAndDropArgs args) + { + if (IsValidDragDrop()) + { + if (args.performDrop) + { + AssetBundleModel.Model.MoveAssetToBundle(DragAndDrop.paths, m_SourceBundles[0].m_Name.bundleName, m_SourceBundles[0].m_Name.variant); + AssetBundleModel.Model.ExecuteAssetMove(); + foreach (BundleInfo bundle in m_SourceBundles) bundle.RefreshAssetList(); + m_Controller.UpdateSelectedBundles(m_SourceBundles); + } + + return DragAndDropVisualMode.Copy; //Move; + } + + return DragAndDropVisualMode.Rejected; + } + + protected bool IsValidDragDrop() + { + //can't do drag & drop if data source is read only + if (AssetBundleModel.Model.DataSource.IsReadOnly()) + return false; + + //can't drag onto none or >1 bundles + if (m_SourceBundles.Count == 0 || m_SourceBundles.Count > 1) + return false; + + //can't drag nothing + if (DragAndDrop.paths == null || DragAndDrop.paths.Length == 0) + return false; + + //can't drag into a folder + BundleFolderInfo folder = m_SourceBundles[0] as AssetBundleModel.BundleFolderInfo; + if (folder != null) + return false; + + BundleDataInfo data = m_SourceBundles[0] as AssetBundleModel.BundleDataInfo; + if (data == null) + return false; // this should never happen. + + AssetListTree thing = DragAndDrop.GetGenericData("AssetListTreeSource") as AssetListTree; + if (thing != null) + return false; + + if (data.IsEmpty()) + return true; + + + if (data.isSceneBundle) + { + foreach (string assetPath in DragAndDrop.paths) + if (AssetDatabase.GetMainAssetTypeAtPath(assetPath) != typeof(SceneAsset) && + !AssetDatabase.IsValidFolder(assetPath)) + return false; + } + else + { + foreach (string assetPath in DragAndDrop.paths) + if (AssetDatabase.GetMainAssetTypeAtPath(assetPath) == typeof(SceneAsset)) + return false; + } + + return true; + } + + protected override void ContextClickedItem(int id) + { + if (AssetBundleModel.Model.DataSource.IsReadOnly()) return; + + List selectedNodes = new List(); + foreach (int nodeID in GetSelection()) selectedNodes.Add(FindItem(nodeID, rootItem) as AssetBundleModel.AssetTreeItem); + + if (selectedNodes.Count > 0) + { + GenericMenu menu = new GenericMenu(); + menu.AddItem(new GUIContent("Remove asset(s) from bundle."), false, RemoveAssets, selectedNodes); + menu.ShowAsContext(); + } + } + + private void RemoveAssets(object obj) + { + List selectedNodes = obj as List; + List assets = new List(); + //var bundles = new List(); + foreach (AssetTreeItem node in selectedNodes) + if (!string.IsNullOrEmpty(node.asset.bundleName)) + assets.Add(node.asset); + AssetBundleModel.Model.MoveAssetToBundle(assets, string.Empty, string.Empty); + AssetBundleModel.Model.ExecuteAssetMove(); + foreach (BundleInfo bundle in m_SourceBundles) bundle.RefreshAssetList(); + m_Controller.UpdateSelectedBundles(m_SourceBundles); + //ReloadAndSelect(new List()); + } + + protected override void KeyEvent() + { + if (m_SourceBundles.Count > 0 && Event.current.keyCode == KeyCode.Delete && GetSelection().Count > 0) + { + List selectedNodes = new List(); + foreach (int nodeID in GetSelection()) selectedNodes.Add(FindItem(nodeID, rootItem) as AssetBundleModel.AssetTreeItem); + + RemoveAssets(selectedNodes); + } + } + + private void OnSortingChanged(MultiColumnHeader multiColumnHeader) + { + SortIfNeeded(rootItem, GetRows()); + } + + private void SortIfNeeded(TreeViewItem root, IList rows) + { + if (rows.Count <= 1) + return; + + if (multiColumnHeader.sortedColumnIndex == -1) + return; + + SortByColumn(); + + rows.Clear(); + for (int i = 0; i < root.children.Count; i++) + rows.Add(root.children[i]); + + Repaint(); + } + + private void SortByColumn() + { + int[] sortedColumns = multiColumnHeader.state.sortedColumns; + + if (sortedColumns.Length == 0) + return; + + List assetList = new List(); + foreach (TreeViewItem item in rootItem.children) assetList.Add(item as AssetBundleModel.AssetTreeItem); + IOrderedEnumerable orderedItems = InitialOrder(assetList, sortedColumns); + + rootItem.children = orderedItems.Cast().ToList(); + } + + private IOrderedEnumerable InitialOrder(IEnumerable myTypes, int[] columnList) + { + SortOption sortOption = m_SortOptions[columnList[0]]; + bool ascending = multiColumnHeader.IsSortedAscending(columnList[0]); + switch (sortOption) + { + case SortOption.Asset: + return myTypes.Order(l => l.displayName, ascending); + case SortOption.Size: + return myTypes.Order(l => l.asset.fileSize, ascending); + case SortOption.Message: + return myTypes.Order(l => l.HighestMessageLevel(), ascending); + case SortOption.Bundle: + default: + return myTypes.Order(l => l.asset.bundleName, ascending); + } + } + + private void ReloadAndSelect(IList hashCodes) + { + Reload(); + SetSelection(hashCodes); + SelectionChanged(hashCodes); + } + } + + internal static class MyExtensionMethods + { + internal static IOrderedEnumerable Order(this IEnumerable source, System.Func selector, bool ascending) + { + if (ascending) + return source.OrderBy(selector); + else + return source.OrderByDescending(selector); + } + + internal static IOrderedEnumerable ThenBy(this IOrderedEnumerable source, System.Func selector, bool ascending) + { + if (ascending) + return source.ThenBy(selector); + else + return source.ThenByDescending(selector); + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/AssetListTree.cs.meta b/Assets/Plugins/AssetBundles-Browser/Editor/AssetListTree.cs.meta new file mode 100644 index 0000000..ca9d508 --- /dev/null +++ b/Assets/Plugins/AssetBundles-Browser/Editor/AssetListTree.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a3caba452c4f3a543b831e94871aebc6 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/BundleDetailList.cs b/Assets/Plugins/AssetBundles-Browser/Editor/BundleDetailList.cs new file mode 100644 index 0000000..4c61e29 --- /dev/null +++ b/Assets/Plugins/AssetBundles-Browser/Editor/BundleDetailList.cs @@ -0,0 +1,300 @@ +using UnityEditor; +using UnityEngine; +using System.Collections.Generic; +using AssetBundleBrowser.AssetBundleModel; +using UnityEditor.IMGUI.Controls; + +namespace AssetBundleBrowser +{ + internal class BundleDetailItem : TreeViewItem + { + internal BundleDetailItem(int id, int depth, string displayName, MessageType type) : base(id, depth, displayName) + { + MessageLevel = type; + } + + internal MessageType MessageLevel { get; set; } + } + + internal class TogglePathTreeViewItem : TreeViewItem + { + private static bool m_DisplayAlt = false; + + private string m_DisplayNamePrefix; + private string m_Path; + + public string Path + { + get { return m_Path; } + } + + public string DisplayNamePrefix + { + get { return m_DisplayNamePrefix; } + } + + public TogglePathTreeViewItem(int id, int depth, string displayName, string path) + { + base.depth = depth; + base.id = id; + base.displayName = displayName; + m_Path = path; + m_DisplayNamePrefix = ""; + } + + public TogglePathTreeViewItem(int id, int depth, string displayNamePrefix, string displayName, string path) + { + base.depth = depth; + base.id = id; + base.displayName = displayName; + m_Path = path; + m_DisplayNamePrefix = displayNamePrefix; + } + + public override string displayName + { + get + { + // TODO this is a bit unresponsive here in large projects, see if can be better elsewhere + Event e = Event.current; + if (e.alt && e.type == EventType.MouseDown) + m_DisplayAlt = !m_DisplayAlt; + + return m_DisplayNamePrefix + (m_DisplayAlt ? m_Path : base.displayName); + } + set { base.displayName = value; } + } + } + + internal class BundleDetailList : TreeView + { + private HashSet m_Selecteditems; + private Rect m_TotalRect; + + private const float k_DoubleIndent = 32f; + private const string k_SizeHeader = "Size: "; + private const string k_DependencyHeader = "Dependent On:"; + private const string k_DependencyEmpty = k_DependencyHeader + " - None"; + private const string k_MessageHeader = "Messages:"; + private const string k_MessageEmpty = k_MessageHeader + " - None"; + private const string k_ReferencedPrefix = "- "; + + + internal BundleDetailList(TreeViewState state) : base(state) + { + m_Selecteditems = new HashSet(); + showBorder = true; + } + + internal void Update() + { + bool dirty = false; + foreach (BundleDataInfo bundle in m_Selecteditems) dirty |= bundle.dirty; + if (dirty) + { + Reload(); + ExpandAll(2); + } + } + + protected override TreeViewItem BuildRoot() + { + TreeViewItem root = new TreeViewItem(-1, -1); + root.children = new List(); + if (m_Selecteditems != null) + foreach (BundleDataInfo bundle in m_Selecteditems) + root.AddChild(AppendBundleToTree(bundle)); + return root; + } + + protected override void RowGUI(RowGUIArgs args) + { + if (args.item as BundleDetailItem != null) + { + EditorGUI.HelpBox( + new Rect(args.rowRect.x + k_DoubleIndent, args.rowRect.y, args.rowRect.width - k_DoubleIndent, args.rowRect.height), + args.item.displayName, + (args.item as BundleDetailItem).MessageLevel); + } + else + { + Color old = GUI.color; + if (args.item.depth == 1 && + (args.item.displayName == k_MessageEmpty || args.item.displayName == k_DependencyEmpty)) + GUI.color = Model.k_LightGrey; + base.RowGUI(args); + GUI.color = old; + } + } + + public override void OnGUI(Rect rect) + { + m_TotalRect = rect; + base.OnGUI(rect); + } + + protected override float GetCustomRowHeight(int row, TreeViewItem item) + { + if (item as BundleDetailItem != null) + { + float height = DefaultStyles.backgroundEven.CalcHeight(new GUIContent(item.displayName), m_TotalRect.width); + return height + 3f; + } + + return base.GetCustomRowHeight(row, item); + } + + + protected override void SelectionChanged(IList selectedIds) + { + base.SelectionChanged(selectedIds); + List pathList = new List(); + + for (int i = 0; i < selectedIds.Count; ++i) + { + TreeViewItem item = FindItem(selectedIds[i], rootItem); + if (item != null) AddDependentAssetsRecursive(item, pathList); + } + + AssetBundleBrowserMain.instance.m_ManageTab.SetAssetListSelection(pathList); + } + + private void AddDependentAssetsRecursive(TreeViewItem item, List pathList) + { + TogglePathTreeViewItem pathItem = item as TogglePathTreeViewItem; + if (pathItem != null) + if (string.IsNullOrEmpty(pathItem.DisplayNamePrefix) == false && pathList.Contains(pathItem.Path) == false) + pathList.Add(pathItem.Path); + + if (item.hasChildren) + for (int i = 0; i < item.children.Count; ++i) + AddDependentAssetsRecursive(item.children[i], pathList); + } + + protected override void DoubleClickedItem(int id) + { + base.DoubleClickedItem(id); + TreeViewItem item = FindItem(id, rootItem); + if (item != null) + { + TogglePathTreeViewItem pathItem = item as TogglePathTreeViewItem; + if (pathItem != null) + { + Object o = AssetDatabase.LoadAssetAtPath(pathItem.Path); + if (o != null) + { + Selection.activeObject = o; + EditorGUIUtility.PingObject(o); + } + } + } + } + + internal static TreeViewItem AppendBundleToTree(BundleDataInfo bundle) + { + string itemName = bundle.m_Name.fullNativeName; + TreeViewItem bunRoot = new TreeViewItem(itemName.GetHashCode(), 0, itemName); + + string str = itemName + k_SizeHeader; + TreeViewItem sz = new TreeViewItem(str.GetHashCode(), 1, k_SizeHeader + bundle.TotalSize()); + + str = itemName + k_DependencyHeader; + TreeViewItem dependency = new TreeViewItem(str.GetHashCode(), 1, k_DependencyEmpty); + List depList = bundle.GetBundleDependencies(); + if (depList.Count > 0) + { + dependency.displayName = k_DependencyHeader; + foreach (BundleDependencyInfo dep in bundle.GetBundleDependencies()) + { + str = itemName + dep.m_BundleName; + TreeViewItem newItem = new TreeViewItem(str.GetHashCode(), 2, dep.m_BundleName); + newItem.icon = Model.GetBundleIcon(); + dependency.AddChild(newItem); + + Dictionary toAssetItems = new Dictionary(); + + for (int i = 0; i < dep.m_FromAssets.Count; ++i) + { + TogglePathTreeViewItem item = null; + + if (!toAssetItems.TryGetValue(dep.m_ToAssets[i].fullAssetName, out item)) + { + str = itemName + dep.m_BundleName + dep.m_ToAssets[i].displayName; + item = new TogglePathTreeViewItem(str.GetHashCode(), 3, "/" + dep.m_ToAssets[i].displayName, "/" + dep.m_ToAssets[i].fullAssetName); + item.icon = AssetDatabase.GetCachedIcon(dep.m_ToAssets[i].fullAssetName) as Texture2D; + newItem.AddChild(item); + toAssetItems.Add(dep.m_ToAssets[i].fullAssetName, item); + } + + str = str + dep.m_FromAssets[i].displayName; + TreeViewItem refItem = new TogglePathTreeViewItem(str.GetHashCode(), 4, k_ReferencedPrefix, + dep.m_FromAssets[i].displayName, dep.m_FromAssets[i].fullAssetName); + refItem.icon = AssetDatabase.GetCachedIcon(dep.m_FromAssets[i].fullAssetName) as Texture2D; + item.AddChild(refItem); + } + } + } + + str = itemName + k_MessageHeader; + TreeViewItem msg = new TreeViewItem(str.GetHashCode(), 1, k_MessageEmpty); + if (bundle.HasMessages()) + { + msg.displayName = k_MessageHeader; + List currMessages = bundle.GetMessages(); + + foreach (MessageSystem.Message currMsg in currMessages) + { + str = itemName + currMsg.message; + msg.AddChild(new BundleDetailItem(str.GetHashCode(), 2, currMsg.message, currMsg.severity)); + } + } + + + bunRoot.AddChild(sz); + bunRoot.AddChild(dependency); + bunRoot.AddChild(msg); + + return bunRoot; + } + + + internal void SetItems(IEnumerable items) + { + m_Selecteditems.Clear(); + foreach (BundleInfo item in items) CollectBundles(item); + SetSelection(new List()); + Reload(); + ExpandAll(2); + } + + internal void CollectBundles(BundleInfo bundle) + { + BundleDataInfo bunData = bundle as BundleDataInfo; + if (bunData != null) + { + m_Selecteditems.Add(bunData); + } + else + { + BundleFolderInfo bunFolder = bundle as BundleFolderInfo; + foreach (BundleInfo bun in bunFolder.GetChildList()) CollectBundles(bun); + } + } + + internal void ExpandAll(int maximumDepth) + { + List expanded = new List(GetExpanded()); + FindItems(rootItem, maximumDepth, expanded); + SetExpanded(expanded); + } + + internal void FindItems(TreeViewItem item, int maximumDepth, List expanded) + { + if (item.depth >= maximumDepth || !item.hasChildren) + return; + + expanded.Add(item.id); + for (int i = 0; i < item.children.Count; ++i) FindItems(item.children[i], maximumDepth, expanded); + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/BundleDetailList.cs.meta b/Assets/Plugins/AssetBundles-Browser/Editor/BundleDetailList.cs.meta new file mode 100644 index 0000000..a49595f --- /dev/null +++ b/Assets/Plugins/AssetBundles-Browser/Editor/BundleDetailList.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 37b2e435499908144b0d282ed2719039 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/Icons.meta b/Assets/Plugins/AssetBundles-Browser/Editor/Icons.meta new file mode 100644 index 0000000..05ddae1 --- /dev/null +++ b/Assets/Plugins/AssetBundles-Browser/Editor/Icons.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: fabc705ac6bb6b746ac5ade02708d0b9 +folderAsset: yes +timeCreated: 1491494491 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/Icons/ABundleBrowserIconY1756Basic.png b/Assets/Plugins/AssetBundles-Browser/Editor/Icons/ABundleBrowserIconY1756Basic.png new file mode 100644 index 0000000..de1091a Binary files /dev/null and b/Assets/Plugins/AssetBundles-Browser/Editor/Icons/ABundleBrowserIconY1756Basic.png differ diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/Icons/ABundleBrowserIconY1756Basic.png.meta b/Assets/Plugins/AssetBundles-Browser/Editor/Icons/ABundleBrowserIconY1756Basic.png.meta new file mode 100644 index 0000000..b4d455b --- /dev/null +++ b/Assets/Plugins/AssetBundles-Browser/Editor/Icons/ABundleBrowserIconY1756Basic.png.meta @@ -0,0 +1,77 @@ +fileFormatVersion: 2 +guid: e0af1b5107fe5c2428026d9f032c64c0 +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 5 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapU: -1 + wrapV: -1 + wrapW: -1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/Icons/ABundleBrowserIconY1756Scene.png b/Assets/Plugins/AssetBundles-Browser/Editor/Icons/ABundleBrowserIconY1756Scene.png new file mode 100644 index 0000000..26cecc9 Binary files /dev/null and b/Assets/Plugins/AssetBundles-Browser/Editor/Icons/ABundleBrowserIconY1756Scene.png differ diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/Icons/ABundleBrowserIconY1756Scene.png.meta b/Assets/Plugins/AssetBundles-Browser/Editor/Icons/ABundleBrowserIconY1756Scene.png.meta new file mode 100644 index 0000000..4c67514 --- /dev/null +++ b/Assets/Plugins/AssetBundles-Browser/Editor/Icons/ABundleBrowserIconY1756Scene.png.meta @@ -0,0 +1,77 @@ +fileFormatVersion: 2 +guid: 2c52be92045472a4bb2d2fa348b08d6d +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 5 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapU: -1 + wrapV: -1 + wrapW: -1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/InspectTab.meta b/Assets/Plugins/AssetBundles-Browser/Editor/InspectTab.meta new file mode 100644 index 0000000..4636434 --- /dev/null +++ b/Assets/Plugins/AssetBundles-Browser/Editor/InspectTab.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 5d1c1f5fd30f85c4f971269388fad046 +folderAsset: yes +timeCreated: 1497983785 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/InspectTab/AssetBundleInspectTab.cs b/Assets/Plugins/AssetBundles-Browser/Editor/InspectTab/AssetBundleInspectTab.cs new file mode 100644 index 0000000..1e47136 --- /dev/null +++ b/Assets/Plugins/AssetBundles-Browser/Editor/InspectTab/AssetBundleInspectTab.cs @@ -0,0 +1,460 @@ +using UnityEditor; +using UnityEngine; +using UnityEditor.IMGUI.Controls; +using System.Collections.Generic; +using System.IO; +using System.Runtime.Serialization.Formatters.Binary; +using System.Linq; + +namespace AssetBundleBrowser +{ + [System.Serializable] + internal class AssetBundleInspectTab + { + private Rect m_Position; + + [SerializeField] private InspectTabData m_Data; + + + private Dictionary> m_BundleList; + private InspectBundleTree m_BundleTreeView; + [SerializeField] private TreeViewState m_BundleTreeState; + + internal Editor m_Editor = null; + + private SingleBundleInspector m_SingleInspector; + + /// + /// Collection of loaded asset bundle records indexed by bundle name + /// + private Dictionary m_loadedAssetBundles; + + /// + /// Returns the record for a loaded asset bundle by name if it exists in our container. + /// + /// Asset bundle record instance if loaded, otherwise null. + /// Name of the loaded asset bundle, excluding the variant extension + private AssetBundleRecord GetLoadedBundleRecordByName(string bundleName) + { + if (string.IsNullOrEmpty(bundleName)) return null; + + if (!m_loadedAssetBundles.ContainsKey(bundleName)) return null; + + return m_loadedAssetBundles[bundleName]; + } + + internal AssetBundleInspectTab() + { + m_BundleList = new Dictionary>(); + m_SingleInspector = new SingleBundleInspector(); + m_loadedAssetBundles = new Dictionary(); + } + + internal void OnEnable(Rect pos) + { + m_Position = pos; + if (m_Data == null) + m_Data = new InspectTabData(); + + //LoadData... + string dataPath = Path.GetFullPath("."); + dataPath = dataPath.Replace("\\", "/"); + dataPath += "/Library/AssetBundleBrowserInspect.dat"; + + if (File.Exists(dataPath)) + { + BinaryFormatter bf = new BinaryFormatter(); + FileStream file = File.Open(dataPath, FileMode.Open); + InspectTabData data = bf.Deserialize(file) as InspectTabData; + if (data != null) + m_Data = data; + file.Close(); + } + + + if (m_BundleList == null) + m_BundleList = new Dictionary>(); + + if (m_BundleTreeState == null) + m_BundleTreeState = new TreeViewState(); + m_BundleTreeView = new InspectBundleTree(m_BundleTreeState, this); + + + RefreshBundles(); + } + + internal void OnDisable() + { + ClearData(); + + string dataPath = Path.GetFullPath("."); + dataPath = dataPath.Replace("\\", "/"); + dataPath += "/Library/AssetBundleBrowserInspect.dat"; + + BinaryFormatter bf = new BinaryFormatter(); + FileStream file = File.Create(dataPath); + + bf.Serialize(file, m_Data); + file.Close(); + } + + internal void OnGUI(Rect pos) + { + m_Position = pos; + + if (Application.isPlaying) + { + GUIStyle style = new GUIStyle(GUI.skin.label); + style.alignment = TextAnchor.MiddleCenter; + style.wordWrap = true; + GUI.Label( + new Rect(m_Position.x + 1f, m_Position.y + 1f, m_Position.width - 2f, m_Position.height - 2f), + new GUIContent("Inspector unavailable while in PLAY mode"), + style); + } + else + { + OnGUIEditor(); + } + } + + private void OnGUIEditor() + { + EditorGUILayout.Space(); + GUILayout.BeginHorizontal(); + + if (GUILayout.Button("Add File", GUILayout.MaxWidth(75f))) BrowseForFile(); + if (GUILayout.Button("Add Folder", GUILayout.MaxWidth(75f))) BrowseForFolder(); + + GUILayout.EndHorizontal(); + EditorGUILayout.Space(); + + if (m_BundleList.Count > 0) + { + int halfWidth = (int) (m_Position.width / 2.0f); + m_BundleTreeView.OnGUI(new Rect(m_Position.x, m_Position.y + 30, halfWidth, m_Position.height - 30)); + m_SingleInspector.OnGUI(new Rect(m_Position.x + halfWidth, m_Position.y + 30, halfWidth, m_Position.height - 30)); + } + } + + internal void RemoveBundlePath(string pathToRemove) + { + UnloadBundle(pathToRemove); + m_Data.RemovePath(pathToRemove); + } + + internal void RemoveBundleFolder(string pathToRemove) + { + List paths = null; + if (m_BundleList.TryGetValue(pathToRemove, out paths)) + foreach (string p in paths) + UnloadBundle(p); + m_Data.RemoveFolder(pathToRemove); + } + + private void BrowseForFile() + { + string newPath = EditorUtility.OpenFilePanelWithFilters("Bundle Folder", string.Empty, new string[] { }); + if (!string.IsNullOrEmpty(newPath)) + { + string gamePath = Path.GetFullPath("."); //TODO - FileUtil.GetProjectRelativePath?? + gamePath = gamePath.Replace("\\", "/"); + if (newPath.StartsWith(gamePath)) + newPath = newPath.Remove(0, gamePath.Length + 1); + + m_Data.AddPath(newPath); + + RefreshBundles(); + } + } + + //TODO - this is largely copied from BuildTab, should maybe be shared code. + private void BrowseForFolder(string folderPath = null) + { + folderPath = EditorUtility.OpenFolderPanel("Bundle Folder", string.Empty, string.Empty); + if (!string.IsNullOrEmpty(folderPath)) + { + string gamePath = Path.GetFullPath("."); //TODO - FileUtil.GetProjectRelativePath?? + gamePath = gamePath.Replace("\\", "/"); + if (folderPath.Length > gamePath.Length && folderPath.StartsWith(gamePath)) + folderPath = folderPath.Remove(0, gamePath.Length + 1); + + AddBundleFolder(folderPath); + + RefreshBundles(); + } + } + + internal void AddBundleFolder(string folderPath) + { + m_Data.AddFolder(folderPath); + } + + private void ClearData() + { + m_SingleInspector.SetBundle(null); + + if (null != m_loadedAssetBundles) + { + List records = new List(m_loadedAssetBundles.Values); + foreach (AssetBundleRecord record in records) record.bundle.Unload(true); + + m_loadedAssetBundles.Clear(); + } + } + + internal void RefreshBundles() + { + ClearData(); + + + if (m_Data.BundlePaths == null) + return; + + //find assets + if (m_BundleList == null) + m_BundleList = new Dictionary>(); + + m_BundleList.Clear(); + List pathsToRemove = new List(); + foreach (string filePath in m_Data.BundlePaths) + if (File.Exists(filePath)) + { + AddBundleToList(string.Empty, filePath); + } + else + { + Debug.Log("Expected bundle not found: " + filePath); + pathsToRemove.Add(filePath); + } + + foreach (string path in pathsToRemove) m_Data.RemovePath(path); + pathsToRemove.Clear(); + + foreach (InspectTabData.BundleFolderData folder in m_Data.BundleFolders) + if (Directory.Exists(folder.path)) + { + AddFilePathToList(folder.path, folder.path); + } + else + { + Debug.Log("Expected folder not found: " + folder); + pathsToRemove.Add(folder.path); + } + + foreach (string path in pathsToRemove) m_Data.RemoveFolder(path); + + m_BundleTreeView.Reload(); + } + + private void AddBundleToList(string parent, string bundlePath) + { + List bundles = null; + m_BundleList.TryGetValue(parent, out bundles); + + if (bundles == null) + { + bundles = new List(); + m_BundleList.Add(parent, bundles); + } + + bundles.Add(bundlePath); + } + + private void AddFilePathToList(string rootPath, string path) + { + string[] notAllowedExtensions = new string[] {".meta", ".manifest", ".dll", ".cs", ".exe", ".js"}; + foreach (string file in Directory.GetFiles(path)) + { + string ext = Path.GetExtension(file); + if (!notAllowedExtensions.Contains(ext)) + { + string f = file.Replace('\\', '/'); + if (File.Exists(file) && !m_Data.FolderIgnoresFile(rootPath, f)) AddBundleToList(rootPath, f); + } + } + + foreach (string dir in Directory.GetDirectories(path)) AddFilePathToList(rootPath, dir); + } + + internal Dictionary> BundleList + { + get { return m_BundleList; } + } + + + internal void SetBundleItem(IList selected) + { + //m_SelectedBundleTreeItems = selected; + if (selected == null || selected.Count == 0 || selected[0] == null) + { + m_SingleInspector.SetBundle(null); + } + else if (selected.Count == 1) + { + AssetBundle bundle = LoadBundle(selected[0].bundlePath); + m_SingleInspector.SetBundle(bundle, selected[0].bundlePath, m_Data, this); + } + else + { + m_SingleInspector.SetBundle(null); + + //perhaps there should be a way to set a message in the inspector, to tell it... + //var style = GUI.skin.label; + //style.alignment = TextAnchor.MiddleCenter; + //style.wordWrap = true; + //GUI.Label( + // inspectorRect, + // new GUIContent("Multi-select inspection not supported"), + // style); + } + } + + [System.Serializable] + internal class InspectTabData + { + [SerializeField] private List m_BundlePaths = new List(); + [SerializeField] private List m_BundleFolders = new List(); + + internal IList BundlePaths + { + get { return m_BundlePaths.AsReadOnly(); } + } + + internal IList BundleFolders + { + get { return m_BundleFolders.AsReadOnly(); } + } + + internal void AddPath(string newPath) + { + if (!m_BundlePaths.Contains(newPath)) + { + BundleFolderData possibleFolderData = FolderDataContainingFilePath(newPath); + if (possibleFolderData == null) + m_BundlePaths.Add(newPath); + else + possibleFolderData.ignoredFiles.Remove(newPath); + } + } + + internal void AddFolder(string newPath) + { + if (!BundleFolderContains(newPath)) + m_BundleFolders.Add(new BundleFolderData(newPath)); + } + + internal void RemovePath(string pathToRemove) + { + m_BundlePaths.Remove(pathToRemove); + } + + internal void RemoveFolder(string pathToRemove) + { + m_BundleFolders.Remove(BundleFolders.FirstOrDefault(bfd => bfd.path == pathToRemove)); + } + + internal bool FolderIgnoresFile(string folderPath, string filePath) + { + if (BundleFolders == null) + return false; + BundleFolderData bundleFolderData = BundleFolders.FirstOrDefault(bfd => bfd.path == folderPath); + return bundleFolderData != null && bundleFolderData.ignoredFiles.Contains(filePath); + } + + internal BundleFolderData FolderDataContainingFilePath(string filePath) + { + foreach (BundleFolderData bundleFolderData in BundleFolders) + if (Path.GetFullPath(filePath).StartsWith(Path.GetFullPath(bundleFolderData.path))) + return bundleFolderData; + return null; + } + + private bool BundleFolderContains(string folderPath) + { + foreach (BundleFolderData bundleFolderData in BundleFolders) + if (Path.GetFullPath(bundleFolderData.path) == Path.GetFullPath(folderPath)) + return true; + return false; + } + + [System.Serializable] + internal class BundleFolderData + { + [SerializeField] internal string path; + + [SerializeField] private List m_ignoredFiles; + + internal List ignoredFiles + { + get + { + if (m_ignoredFiles == null) + m_ignoredFiles = new List(); + return m_ignoredFiles; + } + } + + internal BundleFolderData(string p) + { + path = p; + } + } + } + + /// + /// Returns the bundle at the specified path, loading it if necessary. + /// Unloads previously loaded bundles if necessary when dealing with variants. + /// + /// Returns the loaded bundle, null if it could not be loaded. + /// Path of bundle to get + private AssetBundle LoadBundle(string path) + { + if (string.IsNullOrEmpty(path)) return null; + + string extension = Path.GetExtension(path); + + string bundleName = path.Substring(0, path.Length - extension.Length); + + // Check if we have a record for this bundle + AssetBundleRecord record = GetLoadedBundleRecordByName(bundleName); + AssetBundle bundle = null; + if (null != record) + { + // Unload existing bundle if variant names differ, otherwise use existing bundle + if (!record.path.Equals(path)) + UnloadBundle(bundleName); + else + bundle = record.bundle; + } + + if (null == bundle) + { + // Load the bundle + bundle = AssetBundle.LoadFromFile(path); + if (null == bundle) return null; + + m_loadedAssetBundles[bundleName] = new AssetBundleRecord(path, bundle); + + // Load the bundle's assets + string[] assetNames = bundle.GetAllAssetNames(); + foreach (string name in assetNames) bundle.LoadAsset(name); + } + + return bundle; + } + + /// + /// Unloads the bundle with the given name. + /// + /// Name of the bundle to unload without variant extension + private void UnloadBundle(string bundleName) + { + AssetBundleRecord record = GetLoadedBundleRecordByName(bundleName); + if (null == record) return; + + record.bundle.Unload(true); + m_loadedAssetBundles.Remove(bundleName); + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/InspectTab/AssetBundleInspectTab.cs.meta b/Assets/Plugins/AssetBundles-Browser/Editor/InspectTab/AssetBundleInspectTab.cs.meta new file mode 100644 index 0000000..629e210 --- /dev/null +++ b/Assets/Plugins/AssetBundles-Browser/Editor/InspectTab/AssetBundleInspectTab.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c6578866792bb814088661383f4a7471 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/InspectTab/AssetBundleRecord.cs b/Assets/Plugins/AssetBundles-Browser/Editor/InspectTab/AssetBundleRecord.cs new file mode 100644 index 0000000..fb0328c --- /dev/null +++ b/Assets/Plugins/AssetBundles-Browser/Editor/InspectTab/AssetBundleRecord.cs @@ -0,0 +1,60 @@ +using UnityEngine; + +namespace AssetBundleBrowser +{ + /// + /// This class maintains a record of a loaded asset bundle, allowing us + /// to associate the full path of an asset bundle with the actual bundle, + /// so that we can: + /// + /// 1. distinguish between bundle variants, which, when loaded + /// resolve to the same name. + /// + /// 2. Differentiate between the same asset bundles built for different platforms. + /// + /// ex: + /// + /// Two asset bundle variants: + /// + /// - variant one: mycylinder.one + /// - variant two: mycylinder.two + /// + /// Will Resolve to "mycylinder" when loaded. + /// + /// Likewise, + /// + /// - iOS: AssetBundles/iOS/myBundle + /// - Android: AssetBundle/Android/myBundle + /// + /// Will both resolve to "mybundle" when loaded. + /// + /// + internal class AssetBundleRecord + { + /// + /// Full path of the asset bundle. + /// + internal string path { get; private set; } + + /// + /// Reference to the loaded asset bundle associated with the path. + /// + internal AssetBundle bundle { get; private set; } + + internal AssetBundleRecord(string path, AssetBundle bundle) + { + if (string.IsNullOrEmpty(path) || + null == bundle) + { + string msg = string.Format("AssetBundleRecord encountered invalid parameters path={0}, bundle={1}", + path, + bundle); + + throw new System.ArgumentException(msg); + } + + this.path = path; + this.bundle = bundle; + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/InspectTab/AssetBundleRecord.cs.meta b/Assets/Plugins/AssetBundles-Browser/Editor/InspectTab/AssetBundleRecord.cs.meta new file mode 100644 index 0000000..e29312a --- /dev/null +++ b/Assets/Plugins/AssetBundles-Browser/Editor/InspectTab/AssetBundleRecord.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0544e0691b210254c9301d8fb106c04a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/InspectTab/InspectSingleBundle.cs b/Assets/Plugins/AssetBundles-Browser/Editor/InspectTab/InspectSingleBundle.cs new file mode 100644 index 0000000..5153a47 --- /dev/null +++ b/Assets/Plugins/AssetBundles-Browser/Editor/InspectTab/InspectSingleBundle.cs @@ -0,0 +1,127 @@ +using UnityEditor; +using UnityEngine; +using System.IO; + +namespace AssetBundleBrowser +{ + internal class SingleBundleInspector + { + internal static string currentPath { get; set; } + + + internal SingleBundleInspector() + { + } + + private Editor m_Editor = null; + + private Rect m_Position; + + [SerializeField] private Vector2 m_ScrollPosition; + + private AssetBundleInspectTab m_assetBundleInspectTab = null; + private AssetBundleInspectTab.InspectTabData m_inspectTabData = null; + + internal void SetBundle(AssetBundle bundle, string path = "", AssetBundleInspectTab.InspectTabData inspectTabData = null, AssetBundleInspectTab assetBundleInspectTab = null) + { + //static var... + currentPath = path; + m_inspectTabData = inspectTabData; + m_assetBundleInspectTab = assetBundleInspectTab; + + //members + m_Editor = null; + if (bundle != null) m_Editor = Editor.CreateEditor(bundle); + } + + internal void OnGUI(Rect pos) + { + m_Position = pos; + + DrawBundleData(); + } + + private void DrawBundleData() + { + if (m_Editor != null) + { + GUILayout.BeginArea(m_Position); + m_ScrollPosition = EditorGUILayout.BeginScrollView(m_ScrollPosition); + m_Editor.OnInspectorGUI(); + EditorGUILayout.EndScrollView(); + GUILayout.EndArea(); + } + else if (!string.IsNullOrEmpty(currentPath)) + { + GUIStyle style = new GUIStyle(GUI.skin.label); + style.alignment = TextAnchor.MiddleCenter; + style.wordWrap = true; + GUI.Label(m_Position, new GUIContent("Invalid bundle selected"), style); + + if (m_inspectTabData != null && GUI.Button(new Rect(new Vector2(m_Position.position.x + m_Position.width / 2f - 37.5f, m_Position.position.y + m_Position.height / 2f + 15), new Vector2(75, 30)), "Ignore file")) + { + AssetBundleInspectTab.InspectTabData.BundleFolderData possibleFolderData = m_inspectTabData.FolderDataContainingFilePath(currentPath); + if (possibleFolderData != null) + { + if (!possibleFolderData.ignoredFiles.Contains(currentPath)) + possibleFolderData.ignoredFiles.Add(currentPath); + + if (m_assetBundleInspectTab != null) + m_assetBundleInspectTab.RefreshBundles(); + } + } + } + } + } + + [CustomEditor(typeof(AssetBundle))] + internal class AssetBundleEditor : Editor + { + internal bool pathFoldout = false; + internal bool advancedFoldout = false; + + public override void OnInspectorGUI() + { + AssetBundle bundle = target as AssetBundle; + + using (new EditorGUI.DisabledScope(true)) + { + GUIStyle leftStyle = new GUIStyle(GUI.skin.GetStyle("Label")); + leftStyle.alignment = TextAnchor.UpperLeft; + GUILayout.Label(new GUIContent("Name: " + bundle.name), leftStyle); + + long fileSize = -1; + if (!string.IsNullOrEmpty(SingleBundleInspector.currentPath) && File.Exists(SingleBundleInspector.currentPath)) + { + FileInfo fileInfo = new FileInfo(SingleBundleInspector.currentPath); + fileSize = fileInfo.Length; + } + + if (fileSize < 0) + GUILayout.Label(new GUIContent("Size: unknown"), leftStyle); + else + GUILayout.Label(new GUIContent("Size: " + EditorUtility.FormatBytes(fileSize)), leftStyle); + + string[] assetNames = bundle.GetAllAssetNames(); + pathFoldout = EditorGUILayout.Foldout(pathFoldout, "Source Asset Paths"); + if (pathFoldout) + { + EditorGUI.indentLevel++; + foreach (string asset in assetNames) + EditorGUILayout.LabelField(asset); + EditorGUI.indentLevel--; + } + + + advancedFoldout = EditorGUILayout.Foldout(advancedFoldout, "Advanced Data"); + } + + if (advancedFoldout) + { + EditorGUI.indentLevel++; + base.OnInspectorGUI(); + EditorGUI.indentLevel--; + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/InspectTab/InspectSingleBundle.cs.meta b/Assets/Plugins/AssetBundles-Browser/Editor/InspectTab/InspectSingleBundle.cs.meta new file mode 100644 index 0000000..a116365 --- /dev/null +++ b/Assets/Plugins/AssetBundles-Browser/Editor/InspectTab/InspectSingleBundle.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3573b64da26ccbb44a0ad5b58ba36d25 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/InspectTab/InspectTreeView.cs b/Assets/Plugins/AssetBundles-Browser/Editor/InspectTab/InspectTreeView.cs new file mode 100644 index 0000000..39522c1 --- /dev/null +++ b/Assets/Plugins/AssetBundles-Browser/Editor/InspectTab/InspectTreeView.cs @@ -0,0 +1,132 @@ +using UnityEngine; +using UnityEditor.IMGUI.Controls; +using System.Collections.Generic; +using System.Linq; + +namespace AssetBundleBrowser +{ + internal class InspectTreeItem : TreeViewItem + { + internal string bundlePath { get; private set; } + + internal InspectTreeItem(string path, int depth) : base(path.GetHashCode(), depth, path) + { + bundlePath = path; + } + + internal InspectTreeItem(string path, int depth, string prettyName) : base(path.GetHashCode(), depth, prettyName) + { + bundlePath = path; + } + + internal InspectTreeItem(string path, string parentPath, int depth, string prettyName) : base((path + parentPath).GetHashCode(), depth, prettyName) + { + bundlePath = path; + } + } + + internal class InspectBundleTree : TreeView + { + private AssetBundleInspectTab m_InspectTab; + + internal InspectBundleTree(TreeViewState s, AssetBundleInspectTab parent) : base(s) + { + m_InspectTab = parent; + showBorder = true; + } + + protected override TreeViewItem BuildRoot() + { + TreeViewItem root = new TreeViewItem(-1, -1); + root.children = new List(); + if (m_InspectTab == null) + Debug.Log("Unknown problem in AssetBundle Browser Inspect tab. Restart Browser and try again, or file ticket on github."); + else + foreach (KeyValuePair> folder in m_InspectTab.BundleList) + if (string.IsNullOrEmpty(folder.Key)) + { + foreach (string path in folder.Value) + root.AddChild(new InspectTreeItem(path, 0)); + } + else + { + TreeViewItem folderItem = new TreeViewItem(folder.Key.GetHashCode(), 0, folder.Key); + foreach (string path in folder.Value) + { + string prettyName = path; + if (path.StartsWith(folder.Key)) //how could it not? + prettyName = path.Remove(0, folder.Key.Length + 1); + + folderItem.AddChild(new InspectTreeItem(path, folder.Key, 1, prettyName)); + } + + root.AddChild(folderItem); + } + + return root; + } + + public override void OnGUI(Rect rect) + { + base.OnGUI(rect); + if (Event.current.type == EventType.MouseDown && Event.current.button == 0 && rect.Contains(Event.current.mousePosition)) SetSelection(new int[0], TreeViewSelectionOptions.FireSelectionChanged); + } + + protected override void RowGUI(RowGUIArgs args) + { + base.RowGUI(args); + if (args.item.depth == 0) + { + int width = 16; + Rect edgeRect = new Rect(args.rowRect.xMax - width, args.rowRect.y, width, args.rowRect.height); + if (GUI.Button(edgeRect, "-")) + { + if (GetSelection().Contains(args.item.id)) + { + IList selection = GetSelection(); + foreach (int id in selection) + { + TreeViewItem item = FindItem(id, rootItem); + if (item.depth == 0) + RemoveItem(item); + } + } + else + { + RemoveItem(args.item); + } + + m_InspectTab.RefreshBundles(); + } + } + } + + private void RemoveItem(TreeViewItem item) + { + InspectTreeItem inspectItem = item as InspectTreeItem; + if (inspectItem != null) + m_InspectTab.RemoveBundlePath(inspectItem.bundlePath); + else + m_InspectTab.RemoveBundleFolder(item.displayName); + } + + protected override void SelectionChanged(IList selectedIds) + { + base.SelectionChanged(selectedIds); + + if (selectedIds == null) + return; + + if (selectedIds.Count > 0) + m_InspectTab.SetBundleItem(FindRows(selectedIds).Select(tvi => tvi as InspectTreeItem).ToList()); + //m_InspectTab.SetBundleItem(FindItem(selectedIds[0], rootItem) as InspectTreeItem); + else + m_InspectTab.SetBundleItem(null); + } + + protected override bool CanMultiSelect(TreeViewItem item) + { + return true; + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/InspectTab/InspectTreeView.cs.meta b/Assets/Plugins/AssetBundles-Browser/Editor/InspectTab/InspectTreeView.cs.meta new file mode 100644 index 0000000..1f0d6ca --- /dev/null +++ b/Assets/Plugins/AssetBundles-Browser/Editor/InspectTab/InspectTreeView.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: eae882f6f29224b4092f04878a38a0cb +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/MessageList.cs b/Assets/Plugins/AssetBundles-Browser/Editor/MessageList.cs new file mode 100644 index 0000000..67dbf31 --- /dev/null +++ b/Assets/Plugins/AssetBundles-Browser/Editor/MessageList.cs @@ -0,0 +1,112 @@ +using UnityEditor; +using UnityEngine; +using System.Collections.Generic; +using AssetBundleBrowser.AssetBundleModel; + +namespace AssetBundleBrowser +{ + internal class MessageList + { + private Vector2 m_ScrollPosition = Vector2.zero; + + private GUIStyle[] m_Style = new GUIStyle[2]; + + private IEnumerable m_Selecteditems; + private List m_Messages; + + private Vector2 m_Dimensions = new Vector2(0, 0); + private const float k_ScrollbarPadding = 16f; + private const float k_BorderSize = 1f; + + + internal MessageList() + { + Init(); + } + + private void Init() + { + m_Style[0] = "OL EntryBackOdd"; + m_Style[1] = "OL EntryBackEven"; + m_Style[0].wordWrap = true; + m_Style[1].wordWrap = true; + m_Style[0].padding = new RectOffset(32, 0, 1, 4); + m_Style[1].padding = new RectOffset(32, 0, 1, 4); + m_Messages = new List(); + } + + internal void OnGUI(Rect fullPos) + { + DrawOutline(fullPos, 1f); + + Rect pos = new Rect(fullPos.x + k_BorderSize, fullPos.y + k_BorderSize, fullPos.width - 2 * k_BorderSize, fullPos.height - 2 * k_BorderSize); + + + if (m_Dimensions.y == 0 || m_Dimensions.x != pos.width - k_ScrollbarPadding) + { + //recalculate height. + m_Dimensions.x = pos.width - k_ScrollbarPadding; + m_Dimensions.y = 0; + foreach (MessageSystem.Message message in m_Messages) m_Dimensions.y += m_Style[0].CalcHeight(new GUIContent(message.message), m_Dimensions.x); + } + + m_ScrollPosition = GUI.BeginScrollView(pos, m_ScrollPosition, new Rect(0, 0, m_Dimensions.x, m_Dimensions.y)); + int counter = 0; + float runningHeight = 0.0f; + foreach (MessageSystem.Message message in m_Messages) + { + int index = counter % 2; + GUIContent content = new GUIContent(message.message); + float height = m_Style[index].CalcHeight(content, m_Dimensions.x); + + GUI.Box(new Rect(0, runningHeight, m_Dimensions.x, height), content, m_Style[index]); + GUI.DrawTexture(new Rect(0, runningHeight, 32f, 32f), message.icon); + //TODO - cleanup formatting issues and switch to HelpBox + //EditorGUI.HelpBox(new Rect(0, runningHeight, m_dimensions.x, height), message.message, (MessageType)message.severity); + + counter++; + runningHeight += height; + } + + GUI.EndScrollView(); + } + + internal void SetItems(IEnumerable items) + { + m_Selecteditems = items; + CollectMessages(); + } + + internal void CollectMessages() + { + m_Messages.Clear(); + m_Dimensions.y = 0f; + if (m_Selecteditems != null) + foreach (AssetInfo asset in m_Selecteditems) + m_Messages.AddRange(asset.GetMessages()); + } + + internal static void DrawOutline(Rect rect, float size) + { + Color color = new Color(0.6f, 0.6f, 0.6f, 1.333f); + if (EditorGUIUtility.isProSkin) + { + color.r = 0.12f; + color.g = 0.12f; + color.b = 0.12f; + } + + if (Event.current.type != EventType.Repaint) + return; + + Color orgColor = GUI.color; + GUI.color = GUI.color * color; + GUI.DrawTexture(new Rect(rect.x, rect.y, rect.width, size), EditorGUIUtility.whiteTexture); + GUI.DrawTexture(new Rect(rect.x, rect.yMax - size, rect.width, size), EditorGUIUtility.whiteTexture); + GUI.DrawTexture(new Rect(rect.x, rect.y + 1, size, rect.height - 2 * size), EditorGUIUtility.whiteTexture); + GUI.DrawTexture(new Rect(rect.xMax - size, rect.y + 1, size, rect.height - 2 * size), EditorGUIUtility.whiteTexture); + + GUI.color = orgColor; + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/MessageList.cs.meta b/Assets/Plugins/AssetBundles-Browser/Editor/MessageList.cs.meta new file mode 100644 index 0000000..31374ad --- /dev/null +++ b/Assets/Plugins/AssetBundles-Browser/Editor/MessageList.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e706f069c95acf9439828b4a3144c2a7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/MessageSystem.cs b/Assets/Plugins/AssetBundles-Browser/Editor/MessageSystem.cs new file mode 100644 index 0000000..2dae9d8 --- /dev/null +++ b/Assets/Plugins/AssetBundles-Browser/Editor/MessageSystem.cs @@ -0,0 +1,198 @@ +using System; +using UnityEngine; +using UnityEditor; +using UnityEngine.Assertions; +using System.Collections.Generic; +using System.Linq; +using UnityEditor.IMGUI.Controls; + +namespace AssetBundleBrowser +{ + internal class MessageSystem + { + private static Texture2D s_ErrorIcon = null; + private static Texture2D s_WarningIcon = null; + private static Texture2D s_InfoIcon = null; + private static Dictionary s_MessageLookup = null; + + [Flags] + internal enum MessageFlag + { + None = 0x0, + + Info = 0x80, //this flag is only used to check bits, not set. + EmptyBundle = 0x81, + EmptyFolder = 0x82, + + Warning = 0x8000, //this flag is only used to check bits, not set. + WarningInChildren = 0x8100, + AssetsDuplicatedInMultBundles = 0x8200, + VariantBundleMismatch = 0x8400, + + Error = 0x800000, //this flag is only used to check bits, not set. + ErrorInChildren = 0x810000, + SceneBundleConflict = 0x820000, + DependencySceneConflict = 0x840000 + } + + internal class MessageState + { + //I have an enum and a set of enums to make some logic cleaner. + // The enum has masks for Error/Warning/Info that won't ever be in the set + // this allows for easy checking of IsSet for error rather than specific errors. + private MessageFlag m_MessageFlags; + private HashSet m_MessageSet; + + + internal MessageState() + { + m_MessageFlags = MessageFlag.None; + m_MessageSet = new HashSet(); + } + + internal void Clear() + { + m_MessageFlags = MessageFlag.None; + m_MessageSet.Clear(); + } + + internal void SetFlag(MessageFlag flag, bool on) + { + if (flag == MessageFlag.Info || flag == MessageFlag.Warning || flag == MessageFlag.Error) + return; + + if (on) + { + m_MessageFlags |= flag; + m_MessageSet.Add(flag); + } + else + { + m_MessageFlags &= ~flag; + m_MessageSet.Remove(flag); + } + } + + internal bool IsSet(MessageFlag flag) + { + return (m_MessageFlags & flag) == flag; + } + + internal bool HasMessages() + { + return m_MessageFlags != MessageFlag.None; + } + + internal MessageType HighestMessageLevel() + { + if (IsSet(MessageFlag.Error)) + return MessageType.Error; + if (IsSet(MessageFlag.Warning)) + return MessageType.Warning; + if (IsSet(MessageFlag.Info)) + return MessageType.Info; + return MessageType.None; + } + + internal MessageFlag HighestMessageFlag() + { + MessageFlag high = MessageFlag.None; + foreach (MessageFlag f in m_MessageSet) + if (f > high) + high = f; + return high; + } + + internal List GetMessages() + { + List msgs = new List(); + foreach (MessageFlag f in m_MessageSet) msgs.Add(GetMessage(f)); + return msgs; + } + } + + internal static Texture2D GetIcon(MessageType sev) + { + if (sev == MessageType.Error) + return GetErrorIcon(); + else if (sev == MessageType.Warning) + return GetWarningIcon(); + else if (sev == MessageType.Info) + return GetInfoIcon(); + else + return null; + } + + private static Texture2D GetErrorIcon() + { + if (s_ErrorIcon == null) + FindMessageIcons(); + return s_ErrorIcon; + } + + private static Texture2D GetWarningIcon() + { + if (s_WarningIcon == null) + FindMessageIcons(); + return s_WarningIcon; + } + + private static Texture2D GetInfoIcon() + { + if (s_InfoIcon == null) + FindMessageIcons(); + return s_InfoIcon; + } + + private static void FindMessageIcons() + { + s_ErrorIcon = EditorGUIUtility.FindTexture("console.errorIcon"); + s_WarningIcon = EditorGUIUtility.FindTexture("console.warnicon"); + s_InfoIcon = EditorGUIUtility.FindTexture("console.infoIcon"); + } + + internal class Message + { + internal Message(string msg, MessageType sev) + { + message = msg; + severity = sev; + } + + internal MessageType severity; + internal string message; + + internal Texture2D icon + { + get { return GetIcon(severity); } + } + } + + internal static Message GetMessage(MessageFlag lookup) + { + if (s_MessageLookup == null) + InitMessages(); + + Message msg = null; + s_MessageLookup.TryGetValue(lookup, out msg); + if (msg == null) + msg = s_MessageLookup[MessageFlag.None]; + return msg; + } + + private static void InitMessages() + { + s_MessageLookup = new Dictionary(); + + s_MessageLookup.Add(MessageFlag.None, new Message(string.Empty, MessageType.None)); + s_MessageLookup.Add(MessageFlag.EmptyBundle, new Message("This bundle is empty. Empty bundles cannot get saved with the scene and will disappear from this list if Unity restarts or if various other bundle rename or move events occur.", MessageType.Info)); + s_MessageLookup.Add(MessageFlag.EmptyFolder, new Message("This folder is either empty or contains only empty children. Empty bundles cannot get saved with the scene and will disappear from this list if Unity restarts or if various other bundle rename or move events occur.", MessageType.Info)); + s_MessageLookup.Add(MessageFlag.WarningInChildren, new Message("Warning in child(ren)", MessageType.Warning)); + s_MessageLookup.Add(MessageFlag.AssetsDuplicatedInMultBundles, new Message("Assets being pulled into this bundle due to dependencies are also being pulled into another bundle. This will cause duplication in memory", MessageType.Warning)); + s_MessageLookup.Add(MessageFlag.VariantBundleMismatch, new Message("Variants of a given bundle must have exactly the same assets between them based on a Name.Extension (without Path) comparison. These bundle variants fail that check.", MessageType.Warning)); + s_MessageLookup.Add(MessageFlag.ErrorInChildren, new Message("Error in child(ren)", MessageType.Error)); + s_MessageLookup.Add(MessageFlag.SceneBundleConflict, new Message("A bundle with one or more scenes must only contain scenes. This bundle has scenes and non-scene assets.", MessageType.Error)); + s_MessageLookup.Add(MessageFlag.DependencySceneConflict, new Message("The folder added to this bundle has pulled in scenes and non-scene assets. A bundle must only have one type or the other.", MessageType.Error)); + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/MessageSystem.cs.meta b/Assets/Plugins/AssetBundles-Browser/Editor/MessageSystem.cs.meta new file mode 100644 index 0000000..61c9790 --- /dev/null +++ b/Assets/Plugins/AssetBundles-Browser/Editor/MessageSystem.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d88fac5a61f1ec947afdfb1d3124030c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/Unity.AssetBundleBrowser.Editor.asmdef b/Assets/Plugins/AssetBundles-Browser/Editor/Unity.AssetBundleBrowser.Editor.asmdef new file mode 100644 index 0000000..a6660ec --- /dev/null +++ b/Assets/Plugins/AssetBundles-Browser/Editor/Unity.AssetBundleBrowser.Editor.asmdef @@ -0,0 +1,9 @@ +{ + "name": "Unity.AssetBundleBrowser.Editor", + "references": [ + ], + "includePlatforms": [ + "Editor" + ], + "excludePlatforms": [] +} diff --git a/Assets/Plugins/AssetBundles-Browser/Editor/Unity.AssetBundleBrowser.Editor.asmdef.meta b/Assets/Plugins/AssetBundles-Browser/Editor/Unity.AssetBundleBrowser.Editor.asmdef.meta new file mode 100644 index 0000000..dd42f0a --- /dev/null +++ b/Assets/Plugins/AssetBundles-Browser/Editor/Unity.AssetBundleBrowser.Editor.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: c4b8fc492eac8184fb9a42684cf8c464 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AssetBundles-Browser/QAReport.md b/Assets/Plugins/AssetBundles-Browser/QAReport.md new file mode 100644 index 0000000..d1122d7 --- /dev/null +++ b/Assets/Plugins/AssetBundles-Browser/QAReport.md @@ -0,0 +1,18 @@ +# Quality Report + +## QA Owner: @davidla + +## Test strategy +* Unit test coverage: + * Bundle renaming + * Bundle folder movement + * Bundle creation + * Asset movement + * Internal bundle updating + * Bundle merge and delete + * Basic variant functionality + * Internal data (model) stability + +## Package Status +* open bugs: https://github.com/Unity-Technologies/AssetBundles-Browser/issues +* package has been openly available on github since April, officially released on github and the asset store since June. Users have been able to report bugs through github (see above link) and give feedback in the asset store. Current asset store rating is 5 stars after 19 votes. diff --git a/Assets/Plugins/AssetBundles-Browser/QAReport.md.meta b/Assets/Plugins/AssetBundles-Browser/QAReport.md.meta new file mode 100644 index 0000000..fabbb93 --- /dev/null +++ b/Assets/Plugins/AssetBundles-Browser/QAReport.md.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b596f3cdbada8164aa95baafaa47dd5c +timeCreated: 1511283002 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AssetBundles-Browser/README.md b/Assets/Plugins/AssetBundles-Browser/README.md new file mode 100644 index 0000000..9b96f89 --- /dev/null +++ b/Assets/Plugins/AssetBundles-Browser/README.md @@ -0,0 +1,10 @@ +# Unity Asset Bundle Browser tool + +This tool enables the user to view and edit the configuration of asset bundles for their Unity project. It will block editing that would create invalid bundles, and inform you of any issues with existing bundles. It also provides basic build functionality. + +This tool is intended to replace the current workflow of selecting assets and setting their asset bundle manually in the inspector. It can be dropped into any Unity project with a version of 5.6 or greater. It will create a new menu item in *Window->AssetBundle Browser*. + +## Full Documentation +#### Official Released Features +See [the official manual page](https://docs.unity3d.com/Manual/AssetBundles-Browser.html) or view the included [project manual page](Documentation/com.unity.assetbundlebrowser.md) + diff --git a/Assets/Plugins/AssetBundles-Browser/README.md.meta b/Assets/Plugins/AssetBundles-Browser/README.md.meta new file mode 100644 index 0000000..d95c186 --- /dev/null +++ b/Assets/Plugins/AssetBundles-Browser/README.md.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8ed8819a06e39ed4499b36b63173497f +timeCreated: 1507818222 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AssetBundles-Browser/license.md b/Assets/Plugins/AssetBundles-Browser/license.md new file mode 100644 index 0000000..e284167 --- /dev/null +++ b/Assets/Plugins/AssetBundles-Browser/license.md @@ -0,0 +1,5 @@ +Asset Bundle Browser copyright © 2017 Unity Technologies ApS + +Licensed under the Unity Companion License for Unity-dependent projects--see [Unity Companion License](http://www.unity3d.com/legal/licenses/Unity_Companion_License). + +Unless expressly provided otherwise, the Software under this license is made available strictly on an “AS IS” BASIS WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED. Please review the license for details on these and other terms and conditions. \ No newline at end of file diff --git a/Assets/Plugins/AssetBundles-Browser/license.md.meta b/Assets/Plugins/AssetBundles-Browser/license.md.meta new file mode 100644 index 0000000..ad4ff5f --- /dev/null +++ b/Assets/Plugins/AssetBundles-Browser/license.md.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 117b47f9a23bec44b9cff2e62d6a3222 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AssetBundles-Browser/package.json b/Assets/Plugins/AssetBundles-Browser/package.json new file mode 100644 index 0000000..829a314 --- /dev/null +++ b/Assets/Plugins/AssetBundles-Browser/package.json @@ -0,0 +1,12 @@ + +{ + "name": "com.unity.assetbundlebrowser", + "displayName": "Asset Bundle Browser", + "version": "1.7.0", + "unity": "2018.1", + "description": "The Asset Bundle Browser tool enables the user to view and edit the configuration of asset bundles for their Unity project. It will block editing that would create invalid bundles, and inform you of any issues with existing bundles. It also provides basic build functionality.\n\nUse this tool as an alternative to selecting assets and setting their asset bundle manually in the inspector. It can be dropped into any Unity project with a version of 5.6 or greater. It will create a new menu item in Window > AssetBundle Browser. The bundle configuration, build functionality, and built-bundle inspection are split into three tabs within the new window.", + "keywords": ["asset", "bundle", "bundles", "assetbundles"], + "category": "Asset Bundles", + "dependencies": { + } +} \ No newline at end of file diff --git a/Assets/Plugins/AssetBundles-Browser/package.json.meta b/Assets/Plugins/AssetBundles-Browser/package.json.meta new file mode 100644 index 0000000..4422c64 --- /dev/null +++ b/Assets/Plugins/AssetBundles-Browser/package.json.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 4581cc1523d2d3e489a8bd6c62aaa345 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AssetsTools.NET.dll b/Assets/Plugins/AssetsTools.NET.dll new file mode 100644 index 0000000..c9e4f5c Binary files /dev/null and b/Assets/Plugins/AssetsTools.NET.dll differ diff --git a/Assets/Plugins/AssetsTools.NET.dll.meta b/Assets/Plugins/AssetsTools.NET.dll.meta new file mode 100644 index 0000000..917c4f7 --- /dev/null +++ b/Assets/Plugins/AssetsTools.NET.dll.meta @@ -0,0 +1,34 @@ +fileFormatVersion: 2 +guid: 9df90215fee869340954bb3e0b27b3e6 +timeCreated: 1617340512 +licenseType: Free +PluginImporter: + serializedVersion: 2 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + isOverridable: 0 + platformData: + data: + first: + Any: + second: + enabled: 1 + settings: {} + data: + first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + data: + first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Editor.meta b/Assets/Plugins/Editor.meta new file mode 100644 index 0000000..71ace47 --- /dev/null +++ b/Assets/Plugins/Editor.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: d29f50c70a40c5145885ef38984b0754 +folderAsset: yes +timeCreated: 1628215191 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Editor/HiddenGameObjectTools.cs b/Assets/Plugins/Editor/HiddenGameObjectTools.cs new file mode 100644 index 0000000..97a150f --- /dev/null +++ b/Assets/Plugins/Editor/HiddenGameObjectTools.cs @@ -0,0 +1,110 @@ + using UnityEngine; + using UnityEditor; + using UnityEditor.SceneManagement; + using System.Collections.Generic; + + public class HiddenGameObjectTools : EditorWindow + { + #region Menu Command + + [MenuItem("Tools/Hidden GameObject Tools")] + public static void ShowWindow() + { + var window = GetWindow(); + window.titleContent = new GUIContent("Hidden GOs"); + window.GatherHiddenObjects(); + } + + #endregion + + #region GUI + + private static readonly GUILayoutOption ButtonWidth = GUILayout.Width(80); + private static readonly GUILayoutOption BigButtonHeight = GUILayout.Height(35); + + private void OnGUI() + { + GUILayout.Space(10f); + GUILayout.BeginHorizontal(); + { + if (GUILayout.Button("Refresh", BigButtonHeight)) + { + GatherHiddenObjects(); + } + if (GUILayout.Button("Test", BigButtonHeight, ButtonWidth)) + { + var go = new GameObject("HiddenTestObject"); + go.hideFlags = HideFlags.HideInHierarchy; + GatherHiddenObjects(); + } + } + GUILayout.EndHorizontal(); + GUILayout.Space(10f); + + EditorGUILayout.LabelField("Hidden Objects (" + HiddenObjects.Count + ")", EditorStyles.boldLabel); + for (int i = 0; i < HiddenObjects.Count; i++) + { + var hiddenObject = HiddenObjects[i]; + GUILayout.BeginHorizontal(); + { + var gone = hiddenObject == null; + GUILayout.Label(gone ? "null" : hiddenObject.name); + GUILayout.FlexibleSpace(); + if (gone) + { + GUILayout.Box("Select", ButtonWidth); + GUILayout.Box("Reveal", ButtonWidth); + GUILayout.Box("Delete", ButtonWidth); + } + else + { + if (GUILayout.Button("Select", ButtonWidth)) + { + Selection.activeGameObject = hiddenObject; + } + if (GUILayout.Button(IsHidden(hiddenObject) ? "Reveal" : "Hide", ButtonWidth)) + { + hiddenObject.hideFlags ^= HideFlags.HideInHierarchy; + EditorSceneManager.MarkSceneDirty(hiddenObject.scene); + } + if (GUILayout.Button("Delete", ButtonWidth)) + { + var scene = hiddenObject.scene; + DestroyImmediate(hiddenObject); + EditorSceneManager.MarkSceneDirty(scene); + } + } + } + GUILayout.EndHorizontal(); + } + } + + #endregion + + #region Hidden Objects + + private List HiddenObjects = new List(); + + private void GatherHiddenObjects() + { + HiddenObjects.Clear(); + + var allObjects = FindObjectsOfType(); + foreach (var go in allObjects) + { + if ((go.hideFlags & HideFlags.HideInHierarchy) != 0) + { + HiddenObjects.Add(go); + } + } + + Repaint(); + } + + private static bool IsHidden(GameObject go) + { + return (go.hideFlags & HideFlags.HideInHierarchy) != 0; + } + + #endregion + } \ No newline at end of file diff --git a/Assets/Plugins/Editor/HiddenGameObjectTools.cs.meta b/Assets/Plugins/Editor/HiddenGameObjectTools.cs.meta new file mode 100644 index 0000000..aadf1e8 --- /dev/null +++ b/Assets/Plugins/Editor/HiddenGameObjectTools.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 942768540f60f2a4084fdaee6fa509db +timeCreated: 1629347480 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Editor/NavMeshComponents.meta b/Assets/Plugins/Editor/NavMeshComponents.meta new file mode 100644 index 0000000..8d675a7 --- /dev/null +++ b/Assets/Plugins/Editor/NavMeshComponents.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: e6ff8168d990b424b85c55e8aa09801f +folderAsset: yes +timeCreated: 1634920921 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Editor/NavMeshComponents/NavMeshComponentsGUIUtility.cs b/Assets/Plugins/Editor/NavMeshComponents/NavMeshComponentsGUIUtility.cs new file mode 100644 index 0000000..0d3a676 --- /dev/null +++ b/Assets/Plugins/Editor/NavMeshComponents/NavMeshComponentsGUIUtility.cs @@ -0,0 +1,258 @@ +using UnityEngine; +using UnityEngine.AI; + +namespace UnityEditor.AI +{ + public static class NavMeshComponentsGUIUtility + { + public static void AreaPopup(string labelName, SerializedProperty areaProperty) + { + var areaIndex = -1; + var areaNames = GameObjectUtility.GetNavMeshAreaNames(); + for (var i = 0; i < areaNames.Length; i++) + { + var areaValue = GameObjectUtility.GetNavMeshAreaFromName(areaNames[i]); + if (areaValue == areaProperty.intValue) + areaIndex = i; + } + ArrayUtility.Add(ref areaNames, ""); + ArrayUtility.Add(ref areaNames, "Open Area Settings..."); + + var rect = EditorGUILayout.GetControlRect(true, EditorGUIUtility.singleLineHeight); + EditorGUI.BeginProperty(rect, GUIContent.none, areaProperty); + + EditorGUI.BeginChangeCheck(); + areaIndex = EditorGUI.Popup(rect, labelName, areaIndex, areaNames); + + if (EditorGUI.EndChangeCheck()) + { + if (areaIndex >= 0 && areaIndex < areaNames.Length - 2) + areaProperty.intValue = GameObjectUtility.GetNavMeshAreaFromName(areaNames[areaIndex]); + else if (areaIndex == areaNames.Length - 1) + NavMeshEditorHelpers.OpenAreaSettings(); + } + + EditorGUI.EndProperty(); + } + + public static void AgentTypePopup(string labelName, SerializedProperty agentTypeID) + { + var index = -1; + var count = NavMesh.GetSettingsCount(); + var agentTypeNames = new string[count + 2]; + for (var i = 0; i < count; i++) + { + var id = NavMesh.GetSettingsByIndex(i).agentTypeID; + var name = NavMesh.GetSettingsNameFromID(id); + agentTypeNames[i] = name; + if (id == agentTypeID.intValue) + index = i; + } + agentTypeNames[count] = ""; + agentTypeNames[count + 1] = "Open Agent Settings..."; + + bool validAgentType = index != -1; + if (!validAgentType) + { + EditorGUILayout.HelpBox("Agent Type invalid.", MessageType.Warning); + } + + var rect = EditorGUILayout.GetControlRect(true, EditorGUIUtility.singleLineHeight); + EditorGUI.BeginProperty(rect, GUIContent.none, agentTypeID); + + EditorGUI.BeginChangeCheck(); + index = EditorGUI.Popup(rect, labelName, index, agentTypeNames); + if (EditorGUI.EndChangeCheck()) + { + if (index >= 0 && index < count) + { + var id = NavMesh.GetSettingsByIndex(index).agentTypeID; + agentTypeID.intValue = id; + } + else if (index == count + 1) + { + NavMeshEditorHelpers.OpenAgentSettings(-1); + } + } + + EditorGUI.EndProperty(); + } + + // Agent mask is a set (internally array/list) of agentTypeIDs. + // It is used to describe which agents modifiers apply to. + // There is a special case of "None" which is an empty array. + // There is a special case of "All" which is an array of length 1, and value of -1. + public static void AgentMaskPopup(string labelName, SerializedProperty agentMask) + { + // Contents of the dropdown box. + string popupContent = ""; + + if (agentMask.hasMultipleDifferentValues) + popupContent = "\u2014"; + else + popupContent = GetAgentMaskLabelName(agentMask); + + var content = new GUIContent(popupContent); + var popupRect = GUILayoutUtility.GetRect(content, EditorStyles.popup); + + EditorGUI.BeginProperty(popupRect, GUIContent.none, agentMask); + popupRect = EditorGUI.PrefixLabel(popupRect, 0, new GUIContent(labelName)); + bool pressed = GUI.Button(popupRect, content, EditorStyles.popup); + + if (pressed) + { + var show = !agentMask.hasMultipleDifferentValues; + var showNone = show && agentMask.arraySize == 0; + var showAll = show && IsAll(agentMask); + + var menu = new GenericMenu(); + menu.AddItem(new GUIContent("None"), showNone, SetAgentMaskNone, agentMask); + menu.AddItem(new GUIContent("All"), showAll, SetAgentMaskAll, agentMask); + menu.AddSeparator(""); + + var count = NavMesh.GetSettingsCount(); + for (var i = 0; i < count; i++) + { + var id = NavMesh.GetSettingsByIndex(i).agentTypeID; + var sname = NavMesh.GetSettingsNameFromID(id); + + var showSelected = show && AgentMaskHasSelectedAgentTypeID(agentMask, id); + var userData = new object[] { agentMask, id, !showSelected }; + menu.AddItem(new GUIContent(sname), showSelected, ToggleAgentMaskItem, userData); + } + + menu.DropDown(popupRect); + } + + EditorGUI.EndProperty(); + } + + public static GameObject CreateAndSelectGameObject(string suggestedName, GameObject parent) + { + var parentTransform = parent != null ? parent.transform : null; + var uniqueName = GameObjectUtility.GetUniqueNameForSibling(parentTransform, suggestedName); + var child = new GameObject(uniqueName); + + Undo.RegisterCreatedObjectUndo(child, "Create " + uniqueName); + if (parentTransform != null) + Undo.SetTransformParent(child.transform, parentTransform, "Parent " + uniqueName); + + Selection.activeGameObject = child; + + return child; + } + + static bool IsAll(SerializedProperty agentMask) + { + return agentMask.arraySize == 1 && agentMask.GetArrayElementAtIndex(0).intValue == -1; + } + + static void ToggleAgentMaskItem(object userData) + { + var args = (object[])userData; + var agentMask = (SerializedProperty)args[0]; + var agentTypeID = (int)args[1]; + var value = (bool)args[2]; + + ToggleAgentMaskItem(agentMask, agentTypeID, value); + } + + static void ToggleAgentMaskItem(SerializedProperty agentMask, int agentTypeID, bool value) + { + if (agentMask.hasMultipleDifferentValues) + { + agentMask.ClearArray(); + agentMask.serializedObject.ApplyModifiedProperties(); + } + + // Find which index this agent type is in the agentMask array. + int idx = -1; + for (var j = 0; j < agentMask.arraySize; j++) + { + var elem = agentMask.GetArrayElementAtIndex(j); + if (elem.intValue == agentTypeID) + idx = j; + } + + // Handle "All" special case. + if (IsAll(agentMask)) + { + agentMask.DeleteArrayElementAtIndex(0); + } + + // Toggle value. + if (value) + { + if (idx == -1) + { + agentMask.InsertArrayElementAtIndex(agentMask.arraySize); + agentMask.GetArrayElementAtIndex(agentMask.arraySize - 1).intValue = agentTypeID; + } + } + else + { + if (idx != -1) + { + agentMask.DeleteArrayElementAtIndex(idx); + } + } + + agentMask.serializedObject.ApplyModifiedProperties(); + } + + static void SetAgentMaskNone(object data) + { + var agentMask = (SerializedProperty)data; + agentMask.ClearArray(); + agentMask.serializedObject.ApplyModifiedProperties(); + } + + static void SetAgentMaskAll(object data) + { + var agentMask = (SerializedProperty)data; + agentMask.ClearArray(); + agentMask.InsertArrayElementAtIndex(0); + agentMask.GetArrayElementAtIndex(0).intValue = -1; + agentMask.serializedObject.ApplyModifiedProperties(); + } + + static string GetAgentMaskLabelName(SerializedProperty agentMask) + { + if (agentMask.arraySize == 0) + return "None"; + + if (IsAll(agentMask)) + return "All"; + + if (agentMask.arraySize <= 3) + { + var labelName = ""; + for (var j = 0; j < agentMask.arraySize; j++) + { + var elem = agentMask.GetArrayElementAtIndex(j); + var settingsName = NavMesh.GetSettingsNameFromID(elem.intValue); + if (string.IsNullOrEmpty(settingsName)) + continue; + + if (labelName.Length > 0) + labelName += ", "; + labelName += settingsName; + } + return labelName; + } + + return "Mixed..."; + } + + static bool AgentMaskHasSelectedAgentTypeID(SerializedProperty agentMask, int agentTypeID) + { + for (var j = 0; j < agentMask.arraySize; j++) + { + var elem = agentMask.GetArrayElementAtIndex(j); + if (elem.intValue == agentTypeID) + return true; + } + return false; + } + } +} diff --git a/Assets/Plugins/Editor/NavMeshComponents/NavMeshComponentsGUIUtility.cs.meta b/Assets/Plugins/Editor/NavMeshComponents/NavMeshComponentsGUIUtility.cs.meta new file mode 100644 index 0000000..4019c2a --- /dev/null +++ b/Assets/Plugins/Editor/NavMeshComponents/NavMeshComponentsGUIUtility.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 82fa0afb6dbea4d4f9e991c991ceaeb5 +timeCreated: 1634920994 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Editor/NavMeshComponents/NavMeshLinkEditor.cs b/Assets/Plugins/Editor/NavMeshComponents/NavMeshLinkEditor.cs new file mode 100644 index 0000000..106df09 --- /dev/null +++ b/Assets/Plugins/Editor/NavMeshComponents/NavMeshLinkEditor.cs @@ -0,0 +1,281 @@ +#if H3VR_IMPORTED +using UnityEngine; +using UnityEngine.AI; + +namespace UnityEditor.AI +{ + [CanEditMultipleObjects] + [CustomEditor(typeof(NavMeshLink))] + class NavMeshLinkEditor : Editor + { + SerializedProperty m_AgentTypeID; + SerializedProperty m_Area; + SerializedProperty m_CostModifier; + SerializedProperty m_AutoUpdatePosition; + SerializedProperty m_Bidirectional; + SerializedProperty m_EndPoint; + SerializedProperty m_StartPoint; + SerializedProperty m_Width; + + static int s_SelectedID; + static int s_SelectedPoint = -1; + + static Color s_HandleColor = new Color(255f, 167f, 39f, 210f) / 255; + static Color s_HandleColorDisabled = new Color(255f * 0.75f, 167f * 0.75f, 39f * 0.75f, 100f) / 255; + + void OnEnable() + { + m_AgentTypeID = serializedObject.FindProperty("m_AgentTypeID"); + m_Area = serializedObject.FindProperty("m_Area"); + m_CostModifier = serializedObject.FindProperty("m_CostModifier"); + m_AutoUpdatePosition = serializedObject.FindProperty("m_AutoUpdatePosition"); + m_Bidirectional = serializedObject.FindProperty("m_Bidirectional"); + m_EndPoint = serializedObject.FindProperty("m_EndPoint"); + m_StartPoint = serializedObject.FindProperty("m_StartPoint"); + m_Width = serializedObject.FindProperty("m_Width"); + + s_SelectedID = 0; + s_SelectedPoint = -1; + + NavMeshVisualizationSettings.showNavigation++; + } + + void OnDisable() + { + NavMeshVisualizationSettings.showNavigation--; + } + + static Matrix4x4 UnscaledLocalToWorldMatrix(Transform t) + { + return Matrix4x4.TRS(t.position, t.rotation, Vector3.one); + } + + void AlignTransformToEndPoints(NavMeshLink navLink) + { + var mat = UnscaledLocalToWorldMatrix(navLink.transform); + + var worldStartPt = mat.MultiplyPoint(navLink.startPoint); + var worldEndPt = mat.MultiplyPoint(navLink.endPoint); + + var forward = worldEndPt - worldStartPt; + var up = navLink.transform.up; + + // Flatten + forward -= Vector3.Dot(up, forward) * up; + + var transform = navLink.transform; + transform.rotation = Quaternion.LookRotation(forward, up); + transform.position = (worldEndPt + worldStartPt) * 0.5f; + transform.localScale = Vector3.one; + + navLink.startPoint = transform.InverseTransformPoint(worldStartPt); + navLink.endPoint = transform.InverseTransformPoint(worldEndPt); + } + + public override void OnInspectorGUI() + { + serializedObject.Update(); + + NavMeshComponentsGUIUtility.AgentTypePopup("Agent Type", m_AgentTypeID); + EditorGUILayout.Space(); + + EditorGUILayout.PropertyField(m_StartPoint); + EditorGUILayout.PropertyField(m_EndPoint); + + GUILayout.BeginHorizontal(); + GUILayout.Space(EditorGUIUtility.labelWidth); + if (GUILayout.Button("Swap")) + { + foreach (NavMeshLink navLink in targets) + { + var tmp = navLink.startPoint; + navLink.startPoint = navLink.endPoint; + navLink.endPoint = tmp; + } + SceneView.RepaintAll(); + } + if (GUILayout.Button("Align Transform")) + { + foreach (NavMeshLink navLink in targets) + { + Undo.RecordObject(navLink.transform, "Align Transform to End Points"); + Undo.RecordObject(navLink, "Align Transform to End Points"); + AlignTransformToEndPoints(navLink); + } + SceneView.RepaintAll(); + } + GUILayout.EndHorizontal(); + EditorGUILayout.Space(); + + EditorGUILayout.PropertyField(m_Width); + EditorGUILayout.PropertyField(m_CostModifier); + EditorGUILayout.PropertyField(m_AutoUpdatePosition); + EditorGUILayout.PropertyField(m_Bidirectional); + + NavMeshComponentsGUIUtility.AreaPopup("Area Type", m_Area); + + serializedObject.ApplyModifiedProperties(); + + EditorGUILayout.Space(); + } + + static Vector3 CalcLinkRight(NavMeshLink navLink) + { + var dir = navLink.endPoint - navLink.startPoint; + return (new Vector3(-dir.z, 0.0f, dir.x)).normalized; + } + + static void DrawLink(NavMeshLink navLink) + { + var right = CalcLinkRight(navLink); + var rad = navLink.width * 0.5f; + + Gizmos.DrawLine(navLink.startPoint - right * rad, navLink.startPoint + right * rad); + Gizmos.DrawLine(navLink.endPoint - right * rad, navLink.endPoint + right * rad); + Gizmos.DrawLine(navLink.startPoint - right * rad, navLink.endPoint - right * rad); + Gizmos.DrawLine(navLink.startPoint + right * rad, navLink.endPoint + right * rad); + } + + [DrawGizmo(GizmoType.Selected | GizmoType.Active | GizmoType.Pickable)] + static void RenderBoxGizmo(NavMeshLink navLink, GizmoType gizmoType) + { + if (!EditorApplication.isPlaying) + navLink.UpdateLink(); + + var color = s_HandleColor; + if (!navLink.enabled) + color = s_HandleColorDisabled; + + var oldColor = Gizmos.color; + var oldMatrix = Gizmos.matrix; + + Gizmos.matrix = UnscaledLocalToWorldMatrix(navLink.transform); + + Gizmos.color = color; + DrawLink(navLink); + + Gizmos.matrix = oldMatrix; + Gizmos.color = oldColor; + + Gizmos.DrawIcon(navLink.transform.position, "NavMeshLink Icon", true); + } + + [DrawGizmo(GizmoType.NotInSelectionHierarchy | GizmoType.Pickable)] + static void RenderBoxGizmoNotSelected(NavMeshLink navLink, GizmoType gizmoType) + { + if (NavMeshVisualizationSettings.showNavigation > 0) + { + var color = s_HandleColor; + if (!navLink.enabled) + color = s_HandleColorDisabled; + + var oldColor = Gizmos.color; + var oldMatrix = Gizmos.matrix; + + Gizmos.matrix = UnscaledLocalToWorldMatrix(navLink.transform); + + Gizmos.color = color; + DrawLink(navLink); + + Gizmos.matrix = oldMatrix; + Gizmos.color = oldColor; + } + + Gizmos.DrawIcon(navLink.transform.position, "NavMeshLink Icon", true); + } + + public void OnSceneGUI() + { + var navLink = (NavMeshLink)target; + if (!navLink.enabled) + return; + + var mat = UnscaledLocalToWorldMatrix(navLink.transform); + + var startPt = mat.MultiplyPoint(navLink.startPoint); + var endPt = mat.MultiplyPoint(navLink.endPoint); + var midPt = Vector3.Lerp(startPt, endPt, 0.35f); + var startSize = HandleUtility.GetHandleSize(startPt); + var endSize = HandleUtility.GetHandleSize(endPt); + var midSize = HandleUtility.GetHandleSize(midPt); + + var zup = Quaternion.FromToRotation(Vector3.forward, Vector3.up); + var right = mat.MultiplyVector(CalcLinkRight(navLink)); + + var oldColor = Handles.color; + Handles.color = s_HandleColor; + + Vector3 pos; + + if (navLink.GetInstanceID() == s_SelectedID && s_SelectedPoint == 0) + { + EditorGUI.BeginChangeCheck(); + Handles.CubeHandleCap(0, startPt, zup, 0.1f * startSize, Event.current.type); + pos = Handles.PositionHandle(startPt, navLink.transform.rotation); + if (EditorGUI.EndChangeCheck()) + { + Undo.RecordObject(navLink, "Move link point"); + navLink.startPoint = mat.inverse.MultiplyPoint(pos); + } + } + else + { + if (Handles.Button(startPt, zup, 0.1f * startSize, 0.1f * startSize, Handles.CubeHandleCap)) + { + s_SelectedPoint = 0; + s_SelectedID = navLink.GetInstanceID(); + } + } + + if (navLink.GetInstanceID() == s_SelectedID && s_SelectedPoint == 1) + { + EditorGUI.BeginChangeCheck(); + Handles.CubeHandleCap(0, endPt, zup, 0.1f * startSize, Event.current.type); + pos = Handles.PositionHandle(endPt, navLink.transform.rotation); + if (EditorGUI.EndChangeCheck()) + { + Undo.RecordObject(navLink, "Move link point"); + navLink.endPoint = mat.inverse.MultiplyPoint(pos); + } + } + else + { + if (Handles.Button(endPt, zup, 0.1f * endSize, 0.1f * endSize, Handles.CubeHandleCap)) + { + s_SelectedPoint = 1; + s_SelectedID = navLink.GetInstanceID(); + } + } + + EditorGUI.BeginChangeCheck(); + pos = Handles.Slider(midPt + right * navLink.width * 0.5f, right, midSize * 0.03f, Handles.DotHandleCap, 0); + if (EditorGUI.EndChangeCheck()) + { + Undo.RecordObject(navLink, "Adjust link width"); + navLink.width = Mathf.Max(0.0f, 2.0f * Vector3.Dot(right, (pos - midPt))); + } + + EditorGUI.BeginChangeCheck(); + pos = Handles.Slider(midPt - right * navLink.width * 0.5f, -right, midSize * 0.03f, Handles.DotHandleCap, 0); + if (EditorGUI.EndChangeCheck()) + { + Undo.RecordObject(navLink, "Adjust link width"); + navLink.width = Mathf.Max(0.0f, 2.0f * Vector3.Dot(-right, (pos - midPt))); + } + + Handles.color = oldColor; + } + + [MenuItem("GameObject/AI/NavMesh Link", false, 2002)] + static public void CreateNavMeshLink(MenuCommand menuCommand) + { + var parent = menuCommand.context as GameObject; + GameObject go = NavMeshComponentsGUIUtility.CreateAndSelectGameObject("NavMesh Link", parent); + go.AddComponent(); + var view = SceneView.lastActiveSceneView; + if (view != null) + view.MoveToView(go.transform); + } + } +} +#endif \ No newline at end of file diff --git a/Assets/Plugins/Editor/NavMeshComponents/NavMeshLinkEditor.cs.meta b/Assets/Plugins/Editor/NavMeshComponents/NavMeshLinkEditor.cs.meta new file mode 100644 index 0000000..4d46c95 --- /dev/null +++ b/Assets/Plugins/Editor/NavMeshComponents/NavMeshLinkEditor.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: e597cc45bde363241a196cda89c66e4e +timeCreated: 1634920994 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Editor/NavMeshComponents/NavMeshModifierEditor.cs b/Assets/Plugins/Editor/NavMeshComponents/NavMeshModifierEditor.cs new file mode 100644 index 0000000..80e153b --- /dev/null +++ b/Assets/Plugins/Editor/NavMeshComponents/NavMeshModifierEditor.cs @@ -0,0 +1,51 @@ +#if H3VR_IMPORTED +using UnityEngine.AI; + +namespace UnityEditor.AI +{ + [CanEditMultipleObjects] + [CustomEditor(typeof(NavMeshModifier))] + class NavMeshModifierEditor : Editor + { + SerializedProperty m_AffectedAgents; + SerializedProperty m_Area; + SerializedProperty m_IgnoreFromBuild; + SerializedProperty m_OverrideArea; + + void OnEnable() + { + m_AffectedAgents = serializedObject.FindProperty("m_AffectedAgents"); + m_Area = serializedObject.FindProperty("m_Area"); + m_IgnoreFromBuild = serializedObject.FindProperty("m_IgnoreFromBuild"); + m_OverrideArea = serializedObject.FindProperty("m_OverrideArea"); + + NavMeshVisualizationSettings.showNavigation++; + } + + void OnDisable() + { + NavMeshVisualizationSettings.showNavigation--; + } + + public override void OnInspectorGUI() + { + serializedObject.Update(); + + EditorGUILayout.PropertyField(m_IgnoreFromBuild); + + EditorGUILayout.PropertyField(m_OverrideArea); + if (m_OverrideArea.boolValue) + { + EditorGUI.indentLevel++; + NavMeshComponentsGUIUtility.AreaPopup("Area Type", m_Area); + EditorGUI.indentLevel--; + } + + NavMeshComponentsGUIUtility.AgentMaskPopup("Affected Agents", m_AffectedAgents); + EditorGUILayout.Space(); + + serializedObject.ApplyModifiedProperties(); + } + } +} +#endif \ No newline at end of file diff --git a/Assets/Plugins/Editor/NavMeshComponents/NavMeshModifierEditor.cs.meta b/Assets/Plugins/Editor/NavMeshComponents/NavMeshModifierEditor.cs.meta new file mode 100644 index 0000000..00c2868 --- /dev/null +++ b/Assets/Plugins/Editor/NavMeshComponents/NavMeshModifierEditor.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 9fee8ab006bfde447af976b57e626719 +timeCreated: 1634920994 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Editor/NavMeshComponents/NavMeshModifierVolumeEditor.cs b/Assets/Plugins/Editor/NavMeshComponents/NavMeshModifierVolumeEditor.cs new file mode 100644 index 0000000..3616636 --- /dev/null +++ b/Assets/Plugins/Editor/NavMeshComponents/NavMeshModifierVolumeEditor.cs @@ -0,0 +1,156 @@ +#if H3VR_IMPORTED +using UnityEditor.IMGUI.Controls; +using UnityEditorInternal; +using UnityEngine.AI; +using UnityEngine; + +namespace UnityEditor.AI +{ + [CanEditMultipleObjects] + [CustomEditor(typeof(NavMeshModifierVolume))] + class NavMeshModifierVolumeEditor : Editor + { + SerializedProperty m_AffectedAgents; + SerializedProperty m_Area; + SerializedProperty m_Center; + SerializedProperty m_Size; + + static Color s_HandleColor = new Color(187f, 138f, 240f, 210f) / 255; + static Color s_HandleColorDisabled = new Color(187f * 0.75f, 138f * 0.75f, 240f * 0.75f, 100f) / 255; + + static int s_HandleControlIDHint = typeof(NavMeshModifierVolumeEditor).Name.GetHashCode(); + BoxBoundsHandle m_BoundsHandle = new BoxBoundsHandle(s_HandleControlIDHint); + + bool editingCollider + { + get { return EditMode.editMode == EditMode.SceneViewEditMode.Collider && EditMode.IsOwner(this); } + } + + void OnEnable() + { + m_AffectedAgents = serializedObject.FindProperty("m_AffectedAgents"); + m_Area = serializedObject.FindProperty("m_Area"); + m_Center = serializedObject.FindProperty("m_Center"); + m_Size = serializedObject.FindProperty("m_Size"); + + NavMeshVisualizationSettings.showNavigation++; + } + + void OnDisable() + { + NavMeshVisualizationSettings.showNavigation--; + } + + public override void OnInspectorGUI() + { + serializedObject.Update(); + + InspectorEditButtonGUI(); + + EditorGUILayout.PropertyField(m_Size); + EditorGUILayout.PropertyField(m_Center); + + NavMeshComponentsGUIUtility.AreaPopup("Area Type", m_Area); + NavMeshComponentsGUIUtility.AgentMaskPopup("Affected Agents", m_AffectedAgents); + EditorGUILayout.Space(); + + serializedObject.ApplyModifiedProperties(); + } + + [DrawGizmo(GizmoType.Selected | GizmoType.Active)] + static void RenderBoxGizmo(NavMeshModifierVolume navModifier, GizmoType gizmoType) + { + var color = navModifier.enabled ? s_HandleColor : s_HandleColorDisabled; + var colorTrans = new Color(color.r * 0.75f, color.g * 0.75f, color.b * 0.75f, color.a * 0.15f); + + var oldColor = Gizmos.color; + var oldMatrix = Gizmos.matrix; + + Gizmos.matrix = navModifier.transform.localToWorldMatrix; + + Gizmos.color = colorTrans; + Gizmos.DrawCube(navModifier.center, navModifier.size); + + Gizmos.color = color; + Gizmos.DrawWireCube(navModifier.center, navModifier.size); + + Gizmos.matrix = oldMatrix; + Gizmos.color = oldColor; + + Gizmos.DrawIcon(navModifier.transform.position, "NavMeshModifierVolume Icon", true); + } + + [DrawGizmo(GizmoType.NotInSelectionHierarchy | GizmoType.Pickable)] + static void RenderBoxGizmoNotSelected(NavMeshModifierVolume navModifier, GizmoType gizmoType) + { + if (NavMeshVisualizationSettings.showNavigation > 0) + { + var color = navModifier.enabled ? s_HandleColor : s_HandleColorDisabled; + var oldColor = Gizmos.color; + var oldMatrix = Gizmos.matrix; + + Gizmos.matrix = navModifier.transform.localToWorldMatrix; + + Gizmos.color = color; + Gizmos.DrawWireCube(navModifier.center, navModifier.size); + + Gizmos.matrix = oldMatrix; + Gizmos.color = oldColor; + } + + Gizmos.DrawIcon(navModifier.transform.position, "NavMeshModifierVolume Icon", true); + } + + void InspectorEditButtonGUI() + { + var navModifier = (NavMeshModifierVolume)target; + var bounds = new Bounds(navModifier.transform.position, navModifier.size); + + EditMode.DoEditModeInspectorModeButton( + EditMode.SceneViewEditMode.Collider, + "Edit Volume", + EditorGUIUtility.IconContent("EditCollider"), + bounds, + this + ); + } + + void OnSceneGUI() + { + if (!editingCollider) + return; + + var vol = (NavMeshModifierVolume)target; + var color = vol.enabled ? s_HandleColor : s_HandleColorDisabled; + using (new Handles.DrawingScope(color, vol.transform.localToWorldMatrix)) + { + m_BoundsHandle.center = vol.center; + m_BoundsHandle.size = vol.size; + + EditorGUI.BeginChangeCheck(); + m_BoundsHandle.DrawHandle(); + if (EditorGUI.EndChangeCheck()) + { + Undo.RecordObject(vol, "Modified NavMesh Modifier Volume"); + Vector3 center = m_BoundsHandle.center; + Vector3 size = m_BoundsHandle.size; + vol.center = center; + vol.size = size; + EditorUtility.SetDirty(target); + } + } + } + + [MenuItem("GameObject/AI/NavMesh Modifier Volume", false, 2001)] + static public void CreateNavMeshModifierVolume(MenuCommand menuCommand) + { + var parent = menuCommand.context as GameObject; + var go = NavMeshComponentsGUIUtility.CreateAndSelectGameObject("NavMesh Modifier Volume", parent); + go.AddComponent(); + var view = SceneView.lastActiveSceneView; + if (view != null) + view.MoveToView(go.transform); + } + } +} +#endif \ No newline at end of file diff --git a/Assets/Plugins/Editor/NavMeshComponents/NavMeshModifierVolumeEditor.cs.meta b/Assets/Plugins/Editor/NavMeshComponents/NavMeshModifierVolumeEditor.cs.meta new file mode 100644 index 0000000..210a6b4 --- /dev/null +++ b/Assets/Plugins/Editor/NavMeshComponents/NavMeshModifierVolumeEditor.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: dbb2ed6609af812419e32a5765378c59 +timeCreated: 1634920994 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Editor/NavMeshComponents/NavMeshSurfaceEditor.cs b/Assets/Plugins/Editor/NavMeshComponents/NavMeshSurfaceEditor.cs new file mode 100644 index 0000000..d83a9d6 --- /dev/null +++ b/Assets/Plugins/Editor/NavMeshComponents/NavMeshSurfaceEditor.cs @@ -0,0 +1,492 @@ +#if H3VR_IMPORTED +using System.Collections.Generic; +using System.IO; +using System.Linq; +using UnityEditor.IMGUI.Controls; +using UnityEditor.SceneManagement; +using UnityEditorInternal; +using UnityEngine.AI; +using UnityEngine; + +namespace UnityEditor.AI +{ + [CanEditMultipleObjects] + [CustomEditor(typeof(NavMeshSurface))] + class NavMeshSurfaceEditor : Editor + { + SerializedProperty m_AgentTypeID; + SerializedProperty m_BuildHeightMesh; + SerializedProperty m_Center; + SerializedProperty m_CollectObjects; + SerializedProperty m_DefaultArea; + SerializedProperty m_LayerMask; + SerializedProperty m_OverrideTileSize; + SerializedProperty m_OverrideVoxelSize; + SerializedProperty m_Size; + SerializedProperty m_TileSize; + SerializedProperty m_UseGeometry; + SerializedProperty m_VoxelSize; + + class Styles + { + public readonly GUIContent m_LayerMask = new GUIContent("Include Layers"); + + public readonly GUIContent m_ShowInputGeom = new GUIContent("Show Input Geom"); + public readonly GUIContent m_ShowVoxels = new GUIContent("Show Voxels"); + public readonly GUIContent m_ShowRegions = new GUIContent("Show Regions"); + public readonly GUIContent m_ShowRawContours = new GUIContent("Show Raw Contours"); + public readonly GUIContent m_ShowContours = new GUIContent("Show Contours"); + public readonly GUIContent m_ShowPolyMesh = new GUIContent("Show Poly Mesh"); + public readonly GUIContent m_ShowPolyMeshDetail = new GUIContent("Show Poly Mesh Detail"); + } + + struct AsyncBakeOperation + { + public NavMeshSurface surface; + public NavMeshData bakeData; + public AsyncOperation bakeOperation; + } + + static List s_BakeOperations = new List(); + + static Styles s_Styles; + + static bool s_ShowDebugOptions; + + static Color s_HandleColor = new Color(127f, 214f, 244f, 100f) / 255; + static Color s_HandleColorSelected = new Color(127f, 214f, 244f, 210f) / 255; + static Color s_HandleColorDisabled = new Color(127f * 0.75f, 214f * 0.75f, 244f * 0.75f, 100f) / 255; + + static int s_HandleControlIDHint = typeof(NavMeshSurfaceEditor).Name.GetHashCode(); + BoxBoundsHandle m_BoundsHandle = new BoxBoundsHandle(s_HandleControlIDHint); + + bool editingCollider + { + get { return EditMode.editMode == EditMode.SceneViewEditMode.Collider && EditMode.IsOwner(this); } + } + + void OnEnable() + { + m_AgentTypeID = serializedObject.FindProperty("m_AgentTypeID"); + m_BuildHeightMesh = serializedObject.FindProperty("m_BuildHeightMesh"); + m_Center = serializedObject.FindProperty("m_Center"); + m_CollectObjects = serializedObject.FindProperty("m_CollectObjects"); + m_DefaultArea = serializedObject.FindProperty("m_DefaultArea"); + m_LayerMask = serializedObject.FindProperty("m_LayerMask"); + m_OverrideTileSize = serializedObject.FindProperty("m_OverrideTileSize"); + m_OverrideVoxelSize = serializedObject.FindProperty("m_OverrideVoxelSize"); + m_Size = serializedObject.FindProperty("m_Size"); + m_TileSize = serializedObject.FindProperty("m_TileSize"); + m_UseGeometry = serializedObject.FindProperty("m_UseGeometry"); + m_VoxelSize = serializedObject.FindProperty("m_VoxelSize"); + + NavMeshVisualizationSettings.showNavigation++; + } + + void OnDisable() + { + NavMeshVisualizationSettings.showNavigation--; + } + + static string GetAndEnsureTargetPath(NavMeshSurface surface) + { + // Create directory for the asset if it does not exist yet. + var activeScenePath = surface.gameObject.scene.path; + + var targetPath = "Assets"; + if (!string.IsNullOrEmpty(activeScenePath)) + targetPath = Path.Combine(Path.GetDirectoryName(activeScenePath), Path.GetFileNameWithoutExtension(activeScenePath)); + if (!Directory.Exists(targetPath)) + Directory.CreateDirectory(targetPath); + return targetPath; + } + + static void CreateNavMeshAsset(NavMeshSurface surface) + { + var targetPath = GetAndEnsureTargetPath(surface); + + var combinedAssetPath = Path.Combine(targetPath, "NavMesh-" + surface.name + ".asset"); + combinedAssetPath = AssetDatabase.GenerateUniqueAssetPath(combinedAssetPath); + AssetDatabase.CreateAsset(surface.navMeshData, combinedAssetPath); + } + + static NavMeshData GetNavMeshAssetToDelete(NavMeshSurface navSurface) + { + var prefabType = PrefabUtility.GetPrefabType(navSurface); + if (prefabType == PrefabType.PrefabInstance || prefabType == PrefabType.DisconnectedPrefabInstance) + { + // Don't allow deleting the asset belonging to the prefab parent + var parentSurface = PrefabUtility.GetPrefabParent(navSurface) as NavMeshSurface; + if (parentSurface && navSurface.navMeshData == parentSurface.navMeshData) + return null; + } + return navSurface.navMeshData; + } + + void ClearSurface(NavMeshSurface navSurface) + { + var assetToDelete = GetNavMeshAssetToDelete(navSurface); + navSurface.RemoveData(); + navSurface.navMeshData = null; + EditorUtility.SetDirty(navSurface); + + if (assetToDelete) + { + AssetDatabase.DeleteAsset(AssetDatabase.GetAssetPath(assetToDelete)); + EditorSceneManager.MarkSceneDirty(navSurface.gameObject.scene); + } + } + + public override void OnInspectorGUI() + { + if (s_Styles == null) + s_Styles = new Styles(); + + serializedObject.Update(); + + var bs = NavMesh.GetSettingsByID(m_AgentTypeID.intValue); + + if (bs.agentTypeID != -1) + { + // Draw image + const float diagramHeight = 80.0f; + Rect agentDiagramRect = EditorGUILayout.GetControlRect(false, diagramHeight); + NavMeshEditorHelpers.DrawAgentDiagram(agentDiagramRect, bs.agentRadius, bs.agentHeight, bs.agentClimb, bs.agentSlope); + } + NavMeshComponentsGUIUtility.AgentTypePopup("Agent Type", m_AgentTypeID); + + EditorGUILayout.Space(); + + EditorGUILayout.PropertyField(m_CollectObjects); + if ((CollectObjects)m_CollectObjects.enumValueIndex == CollectObjects.Volume) + { + EditorGUI.indentLevel++; + InspectorEditButtonGUI(); + EditorGUILayout.PropertyField(m_Size); + EditorGUILayout.PropertyField(m_Center); + } + else + { + if (editingCollider) + EditMode.QuitEditMode(); + } + + EditorGUILayout.PropertyField(m_LayerMask, s_Styles.m_LayerMask); + EditorGUILayout.PropertyField(m_UseGeometry); + + EditorGUILayout.Space(); + + EditorGUILayout.Space(); + + m_OverrideVoxelSize.isExpanded = EditorGUILayout.Foldout(m_OverrideVoxelSize.isExpanded, "Advanced"); + if (m_OverrideVoxelSize.isExpanded) + { + EditorGUI.indentLevel++; + + NavMeshComponentsGUIUtility.AreaPopup("Default Area", m_DefaultArea); + + // Override voxel size. + EditorGUILayout.PropertyField(m_OverrideVoxelSize); + + using (new EditorGUI.DisabledScope(!m_OverrideVoxelSize.boolValue || m_OverrideVoxelSize.hasMultipleDifferentValues)) + { + EditorGUI.indentLevel++; + + EditorGUILayout.PropertyField(m_VoxelSize); + + if (!m_OverrideVoxelSize.hasMultipleDifferentValues) + { + if (!m_AgentTypeID.hasMultipleDifferentValues) + { + float voxelsPerRadius = m_VoxelSize.floatValue > 0.0f ? (bs.agentRadius / m_VoxelSize.floatValue) : 0.0f; + EditorGUILayout.LabelField(" ", voxelsPerRadius.ToString("0.00") + " voxels per agent radius", EditorStyles.miniLabel); + } + if (m_OverrideVoxelSize.boolValue) + EditorGUILayout.HelpBox("Voxel size controls how accurately the navigation mesh is generated from the level geometry. A good voxel size is 2-4 voxels per agent radius. Making voxel size smaller will increase build time.", MessageType.None); + } + EditorGUI.indentLevel--; + } + + // Override tile size + EditorGUILayout.PropertyField(m_OverrideTileSize); + + using (new EditorGUI.DisabledScope(!m_OverrideTileSize.boolValue || m_OverrideTileSize.hasMultipleDifferentValues)) + { + EditorGUI.indentLevel++; + + EditorGUILayout.PropertyField(m_TileSize); + + if (!m_TileSize.hasMultipleDifferentValues && !m_VoxelSize.hasMultipleDifferentValues) + { + float tileWorldSize = m_TileSize.intValue * m_VoxelSize.floatValue; + EditorGUILayout.LabelField(" ", tileWorldSize.ToString("0.00") + " world units", EditorStyles.miniLabel); + } + + if (!m_OverrideTileSize.hasMultipleDifferentValues) + { + if (m_OverrideTileSize.boolValue) + EditorGUILayout.HelpBox("Tile size controls the how local the changes to the world are (rebuild or carve). Small tile size allows more local changes, while potentially generating more data in overal.", MessageType.None); + } + EditorGUI.indentLevel--; + } + + + // Height mesh + using (new EditorGUI.DisabledScope(true)) + { + EditorGUILayout.PropertyField(m_BuildHeightMesh); + } + + EditorGUILayout.Space(); + EditorGUI.indentLevel--; + } + + EditorGUILayout.Space(); + + serializedObject.ApplyModifiedProperties(); + + var hadError = false; + var multipleTargets = targets.Length > 1; + foreach (NavMeshSurface navSurface in targets) + { + var settings = navSurface.GetBuildSettings(); + // Calculating bounds is potentially expensive when unbounded - so here we just use the center/size. + // It means the validation is not checking vertical voxel limit correctly when the surface is set to something else than "in volume". + var bounds = new Bounds(Vector3.zero, Vector3.zero); + if (navSurface.collectObjects == CollectObjects.Volume) + { + bounds = new Bounds(navSurface.center, navSurface.size); + } + + var errors = settings.ValidationReport(bounds); + if (errors.Length > 0) + { + if (multipleTargets) + EditorGUILayout.LabelField(navSurface.name); + foreach (var err in errors) + { + EditorGUILayout.HelpBox(err, MessageType.Warning); + } + GUILayout.BeginHorizontal(); + GUILayout.Space(EditorGUIUtility.labelWidth); + if (GUILayout.Button("Open Agent Settings...", EditorStyles.miniButton)) + NavMeshEditorHelpers.OpenAgentSettings(navSurface.agentTypeID); + GUILayout.EndHorizontal(); + hadError = true; + } + } + + if (hadError) + EditorGUILayout.Space(); + + using (new EditorGUI.DisabledScope(Application.isPlaying || m_AgentTypeID.intValue == -1)) + { + GUILayout.BeginHorizontal(); + GUILayout.Space(EditorGUIUtility.labelWidth); + if (GUILayout.Button("Clear")) + { + foreach (NavMeshSurface s in targets) + ClearSurface(s); + SceneView.RepaintAll(); + } + + if (GUILayout.Button("Bake")) + { + // Remove first to avoid double registration of the callback + EditorApplication.update -= UpdateAsyncBuildOperations; + EditorApplication.update += UpdateAsyncBuildOperations; + + foreach (NavMeshSurface surf in targets) + { + var oper = new AsyncBakeOperation(); + + oper.bakeData = InitializeBakeData(surf); + oper.bakeOperation = surf.UpdateNavMesh(oper.bakeData); + oper.surface = surf; + + s_BakeOperations.Add(oper); + } + } + + GUILayout.EndHorizontal(); + } + + // Show progress for the selected targets + for (int i = s_BakeOperations.Count - 1; i >= 0; --i) + { + if (!targets.Contains(s_BakeOperations[i].surface)) + continue; + + var oper = s_BakeOperations[i].bakeOperation; + if (oper == null) + continue; + + var p = oper.progress; + if (oper.isDone) + { + SceneView.RepaintAll(); + continue; + } + + GUILayout.BeginHorizontal(); + + if (GUILayout.Button("Cancel", EditorStyles.miniButton)) + { + var bakeData = s_BakeOperations[i].bakeData; + UnityEngine.AI.NavMeshBuilder.Cancel(bakeData); + s_BakeOperations.RemoveAt(i); + } + + EditorGUI.ProgressBar(EditorGUILayout.GetControlRect(), p, "Baking: " + (int)(100 * p) + "%"); + if (p <= 1) + Repaint(); + + GUILayout.EndHorizontal(); + } + } + + static NavMeshData InitializeBakeData(NavMeshSurface surface) + { + var emptySources = new List(); + var emptyBounds = new Bounds(); + return UnityEngine.AI.NavMeshBuilder.BuildNavMeshData(surface.GetBuildSettings(), emptySources, emptyBounds + , surface.transform.position, surface.transform.rotation); + } + + static void UpdateAsyncBuildOperations() + { + foreach (var oper in s_BakeOperations) + { + if (oper.surface == null || oper.bakeOperation == null) + continue; + + if (oper.bakeOperation.isDone) + { + var surface = oper.surface; + var delete = GetNavMeshAssetToDelete(surface); + if (delete != null) + AssetDatabase.DeleteAsset(AssetDatabase.GetAssetPath(delete)); + + surface.RemoveData(); + surface.navMeshData = oper.bakeData; + if (surface.isActiveAndEnabled) + surface.AddData(); + CreateNavMeshAsset(surface); + EditorSceneManager.MarkSceneDirty(surface.gameObject.scene); + } + } + s_BakeOperations.RemoveAll(o => o.bakeOperation == null || o.bakeOperation.isDone); + if (s_BakeOperations.Count == 0) + EditorApplication.update -= UpdateAsyncBuildOperations; + } + + [DrawGizmo(GizmoType.Selected | GizmoType.Active | GizmoType.Pickable)] + static void RenderBoxGizmoSelected(NavMeshSurface navSurface, GizmoType gizmoType) + { + RenderBoxGizmo(navSurface, gizmoType, true); + } + + [DrawGizmo(GizmoType.NotInSelectionHierarchy | GizmoType.Pickable)] + static void RenderBoxGizmoNotSelected(NavMeshSurface navSurface, GizmoType gizmoType) + { + if (NavMeshVisualizationSettings.showNavigation > 0) + RenderBoxGizmo(navSurface, gizmoType, false); + else + Gizmos.DrawIcon(navSurface.transform.position, "NavMeshSurface Icon", true); + } + + static void RenderBoxGizmo(NavMeshSurface navSurface, GizmoType gizmoType, bool selected) + { + var color = selected ? s_HandleColorSelected : s_HandleColor; + if (!navSurface.enabled) + color = s_HandleColorDisabled; + + var oldColor = Gizmos.color; + var oldMatrix = Gizmos.matrix; + + // Use the unscaled matrix for the NavMeshSurface + var localToWorld = Matrix4x4.TRS(navSurface.transform.position, navSurface.transform.rotation, Vector3.one); + Gizmos.matrix = localToWorld; + + if (navSurface.collectObjects == CollectObjects.Volume) + { + Gizmos.color = color; + Gizmos.DrawWireCube(navSurface.center, navSurface.size); + + if (selected && navSurface.enabled) + { + var colorTrans = new Color(color.r * 0.75f, color.g * 0.75f, color.b * 0.75f, color.a * 0.15f); + Gizmos.color = colorTrans; + Gizmos.DrawCube(navSurface.center, navSurface.size); + } + } + else + { + if (navSurface.navMeshData != null) + { + var bounds = navSurface.navMeshData.sourceBounds; + Gizmos.color = Color.grey; + Gizmos.DrawWireCube(bounds.center, bounds.size); + } + } + + Gizmos.matrix = oldMatrix; + Gizmos.color = oldColor; + + Gizmos.DrawIcon(navSurface.transform.position, "NavMeshSurface Icon", true); + } + + void InspectorEditButtonGUI() + { + var navSurface = (NavMeshSurface)target; + var bounds = new Bounds(navSurface.transform.position, navSurface.size); + + EditMode.DoEditModeInspectorModeButton( + EditMode.SceneViewEditMode.Collider, + "Edit Volume", + EditorGUIUtility.IconContent("EditCollider"), + bounds, + this + ); + } + + void OnSceneGUI() + { + if (!editingCollider) + return; + + var navSurface = (NavMeshSurface)target; + var color = navSurface.enabled ? s_HandleColor : s_HandleColorDisabled; + var localToWorld = Matrix4x4.TRS(navSurface.transform.position, navSurface.transform.rotation, Vector3.one); + using (new Handles.DrawingScope(color, localToWorld)) + { + m_BoundsHandle.center = navSurface.center; + m_BoundsHandle.size = navSurface.size; + + EditorGUI.BeginChangeCheck(); + m_BoundsHandle.DrawHandle(); + if (EditorGUI.EndChangeCheck()) + { + Undo.RecordObject(navSurface, "Modified NavMesh Surface"); + Vector3 center = m_BoundsHandle.center; + Vector3 size = m_BoundsHandle.size; + navSurface.center = center; + navSurface.size = size; + EditorUtility.SetDirty(target); + } + } + } + + [MenuItem("GameObject/AI/NavMesh Surface", false, 2000)] + public static void CreateNavMeshSurface(MenuCommand menuCommand) + { + var parent = menuCommand.context as GameObject; + var go = NavMeshComponentsGUIUtility.CreateAndSelectGameObject("NavMesh Surface", parent); + go.AddComponent(); + var view = SceneView.lastActiveSceneView; + if (view != null) + view.MoveToView(go.transform); + } + } +} +#endif \ No newline at end of file diff --git a/Assets/Plugins/Editor/NavMeshComponents/NavMeshSurfaceEditor.cs.meta b/Assets/Plugins/Editor/NavMeshComponents/NavMeshSurfaceEditor.cs.meta new file mode 100644 index 0000000..df0624e --- /dev/null +++ b/Assets/Plugins/Editor/NavMeshComponents/NavMeshSurfaceEditor.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 073386b7052a703489e676087c2b65b0 +timeCreated: 1634920994 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Mono.Cecil.dll b/Assets/Plugins/Mono.Cecil.dll new file mode 100644 index 0000000..18735f9 Binary files /dev/null and b/Assets/Plugins/Mono.Cecil.dll differ diff --git a/Assets/Plugins/Mono.Cecil.dll.meta b/Assets/Plugins/Mono.Cecil.dll.meta new file mode 100644 index 0000000..1a33d79 --- /dev/null +++ b/Assets/Plugins/Mono.Cecil.dll.meta @@ -0,0 +1,34 @@ +fileFormatVersion: 2 +guid: 437f9ab4673f34e4f96969e0db002b45 +timeCreated: 1641675729 +licenseType: Pro +PluginImporter: + serializedVersion: 2 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + isOverridable: 0 + platformData: + data: + first: + Any: + second: + enabled: 1 + settings: {} + data: + first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + data: + first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/NStrip.dll b/Assets/Plugins/NStrip.dll new file mode 100644 index 0000000..467be4a Binary files /dev/null and b/Assets/Plugins/NStrip.dll differ diff --git a/Assets/Plugins/NStrip.dll.meta b/Assets/Plugins/NStrip.dll.meta new file mode 100644 index 0000000..0783ec1 --- /dev/null +++ b/Assets/Plugins/NStrip.dll.meta @@ -0,0 +1,34 @@ +fileFormatVersion: 2 +guid: 903902f7b3dcdd94cb58f9fbdfee66f3 +timeCreated: 1641675222 +licenseType: Pro +PluginImporter: + serializedVersion: 2 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + isOverridable: 0 + platformData: + data: + first: + Any: + second: + enabled: 1 + settings: {} + data: + first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + data: + first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/SimpleLightProbePlacer.meta b/Assets/Plugins/SimpleLightProbePlacer.meta new file mode 100644 index 0000000..0802430 --- /dev/null +++ b/Assets/Plugins/SimpleLightProbePlacer.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 281fe393411cf9e4499b670ae33722a9 +folderAsset: yes +timeCreated: 1629344783 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/SimpleLightProbePlacer/Editor.meta b/Assets/Plugins/SimpleLightProbePlacer/Editor.meta new file mode 100644 index 0000000..30082da --- /dev/null +++ b/Assets/Plugins/SimpleLightProbePlacer/Editor.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 32648b2beb0d5ff438a79aa97cd1b1a9 +folderAsset: yes +timeCreated: 1457191637 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/SimpleLightProbePlacer/Editor/Icons.meta b/Assets/Plugins/SimpleLightProbePlacer/Editor/Icons.meta new file mode 100644 index 0000000..41807b6 --- /dev/null +++ b/Assets/Plugins/SimpleLightProbePlacer/Editor/Icons.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 7bfb3f51474066d41bd9bd4b08f148ea +folderAsset: yes +timeCreated: 1457269144 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/SimpleLightProbePlacer/Editor/Icons/icon_LightProbeGroupControl.png b/Assets/Plugins/SimpleLightProbePlacer/Editor/Icons/icon_LightProbeGroupControl.png new file mode 100644 index 0000000..4806fbe Binary files /dev/null and b/Assets/Plugins/SimpleLightProbePlacer/Editor/Icons/icon_LightProbeGroupControl.png differ diff --git a/Assets/Plugins/SimpleLightProbePlacer/Editor/Icons/icon_LightProbeGroupControl.png.meta b/Assets/Plugins/SimpleLightProbePlacer/Editor/Icons/icon_LightProbeGroupControl.png.meta new file mode 100644 index 0000000..7995dee --- /dev/null +++ b/Assets/Plugins/SimpleLightProbePlacer/Editor/Icons/icon_LightProbeGroupControl.png.meta @@ -0,0 +1,57 @@ +fileFormatVersion: 2 +guid: 34a11416a6b53ee4795f603273b9a46d +timeCreated: 1457269160 +licenseType: Free +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 7 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: -1 + buildTargetSettings: [] + spriteSheet: + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/SimpleLightProbePlacer/Editor/Icons/icon_LightProbeVolume.png b/Assets/Plugins/SimpleLightProbePlacer/Editor/Icons/icon_LightProbeVolume.png new file mode 100644 index 0000000..c393446 Binary files /dev/null and b/Assets/Plugins/SimpleLightProbePlacer/Editor/Icons/icon_LightProbeVolume.png differ diff --git a/Assets/Plugins/SimpleLightProbePlacer/Editor/Icons/icon_LightProbeVolume.png.meta b/Assets/Plugins/SimpleLightProbePlacer/Editor/Icons/icon_LightProbeVolume.png.meta new file mode 100644 index 0000000..72258fc --- /dev/null +++ b/Assets/Plugins/SimpleLightProbePlacer/Editor/Icons/icon_LightProbeVolume.png.meta @@ -0,0 +1,57 @@ +fileFormatVersion: 2 +guid: 152cd48aa35f97f45b3522bf745d7712 +timeCreated: 1457269160 +licenseType: Free +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 7 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: -1 + buildTargetSettings: [] + spriteSheet: + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/SimpleLightProbePlacer/Editor/LightProbeGroupControlEditor.cs b/Assets/Plugins/SimpleLightProbePlacer/Editor/LightProbeGroupControlEditor.cs new file mode 100644 index 0000000..f78bc6c --- /dev/null +++ b/Assets/Plugins/SimpleLightProbePlacer/Editor/LightProbeGroupControlEditor.cs @@ -0,0 +1,94 @@ +using System.Collections.Generic; +using UnityEditor; +using UnityEngine; + +namespace SimpleLightProbePlacer.Editor +{ + [CustomEditor(typeof(LightProbeGroupControl))] + public class LightProbeGroupControlEditor : UnityEditor.Editor + { + public override void OnInspectorGUI() + { + var control = (LightProbeGroupControl)target; + + if (GUILayout.Button("Delete All Light Probes")) + { + Undo.RecordObject(control.LightProbeGroup, "Light Probe Group - delete all"); + control.DeleteAll(); + } + + if (control.LightProbeGroup != null) + { + string message = "Light Probes count: {0}\nMerged Probes: {1}"; + message = string.Format(message, control.LightProbeGroup.probePositions.Length, control.MergedProbes); + + EditorGUILayout.HelpBox(message, MessageType.Info); + } + + if (GUILayout.Button("Create Light Probes")) + { + Undo.RecordObject(control.LightProbeGroup, "Light Probe Group - create"); + control.Create(); + } + + GUILayout.Space(10); + + if (GUILayout.Button("Merge Closest Light Probes")) + { + Undo.RecordObject(control.LightProbeGroup, "Light Probe Group - merge"); + control.Merge(); + } + + EditorGUI.BeginChangeCheck(); + + var mergeDist = EditorGUILayout.Slider("Merge distance", control.MergeDistance, 0, 10); + + GUILayout.Space(20); + EditorGUILayout.LabelField("Point Light Settings", EditorStyles.boldLabel); + + var useLights = EditorGUILayout.Toggle("Use Point Lights", control.UsePointLights); + + GUI.enabled = control.UsePointLights; + var lightRange = EditorGUILayout.FloatField("Range", control.PointLightRange); + GUI.enabled = true; + + if (EditorGUI.EndChangeCheck()) + { + Undo.RecordObject(control, "Light Probe Group Control changes"); + + control.MergeDistance = mergeDist; + control.UsePointLights = useLights; + control.PointLightRange = lightRange; + + EditorUtility.SetDirty(target); + } + } + + [MenuItem("GameObject/Light/Light Probe Group Control")] + private static void CreateLightProbeGroupControl(MenuCommand menuCommand) + { + var go = new GameObject("Light Probe Group Control"); + + go.AddComponent(); + GameObjectUtility.SetParentAndAlign(go, menuCommand.context as GameObject); + Undo.RegisterCreatedObjectUndo(go, "Create Light Probe Group Control"); + + Selection.activeGameObject = go; + } + + [DrawGizmo(GizmoType.Selected | GizmoType.InSelectionHierarchy | GizmoType.Active)] + private static void DrawGizmoPointLight(Light light, GizmoType gizmoType) + { + var control = FindObjectOfType(); + + if (control == null || !control.UsePointLights || light.type != LightType.Point) return; + + List probes = LightProbeGroupControl.CreatePositionsAround(light.transform, control.PointLightRange); + + for (int i = 0; i < probes.Count; i++) + { + Gizmos.DrawIcon(probes[i], "NONE", false); + } + } + } +} diff --git a/Assets/Plugins/SimpleLightProbePlacer/Editor/LightProbeGroupControlEditor.cs.meta b/Assets/Plugins/SimpleLightProbePlacer/Editor/LightProbeGroupControlEditor.cs.meta new file mode 100644 index 0000000..7f24706 --- /dev/null +++ b/Assets/Plugins/SimpleLightProbePlacer/Editor/LightProbeGroupControlEditor.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 66045cdc4e8e7c844a763795dc422257 +timeCreated: 1457268398 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/SimpleLightProbePlacer/Editor/LightProbeVolumeEditor.cs b/Assets/Plugins/SimpleLightProbePlacer/Editor/LightProbeVolumeEditor.cs new file mode 100644 index 0000000..a350657 --- /dev/null +++ b/Assets/Plugins/SimpleLightProbePlacer/Editor/LightProbeVolumeEditor.cs @@ -0,0 +1,92 @@ +using UnityEditor; +using UnityEngine; + +namespace SimpleLightProbePlacer.Editor +{ + [CanEditMultipleObjects, CustomEditor(typeof(LightProbeVolume))] + public class LightProbeVolumeEditor : UnityEditor.Editor + { + public override void OnInspectorGUI() + { + var volume = (LightProbeVolume)target; + + EditorGUI.BeginChangeCheck(); + + GUILayout.Space(10); + EditorGUILayout.LabelField("Volume", EditorStyles.boldLabel); + var origin = EditorGUILayout.Vector3Field("Origin", volume.Origin); + var size = EditorGUILayout.Vector3Field("Size", volume.Size); + + GUILayout.Space(10); + EditorGUILayout.LabelField("Density", EditorStyles.boldLabel); + var type = (LightProbeVolumeType)EditorGUILayout.EnumPopup("Density Type", volume.Type); + + float densityMin = volume.Type == LightProbeVolumeType.Fixed ? 1 : 0.1f; + float densityMax = volume.Type == LightProbeVolumeType.Fixed ? 100 : 50; + + var density = volume.Density; + density.x = EditorGUILayout.Slider("DensityX", volume.Density.x, densityMin, densityMax); + density.y = EditorGUILayout.Slider("DensityY", volume.Density.y, densityMin, densityMax); + density.z = EditorGUILayout.Slider("DensityZ", volume.Density.z, densityMin, densityMax); + + if (EditorGUI.EndChangeCheck()) + { + Undo.RecordObject(target, "Light Probe Volume changes"); + + volume.Density = density; + volume.Type = type; + volume.Volume = new Volume(origin, size); + + EditorUtility.SetDirty(target); + } + } + + private void OnSceneGUI() + { + var lightProbeVolume = (LightProbeVolume)target; + + var volume = TransformVolume.EditorVolumeControl(lightProbeVolume, 0.1f, LightProbeVolume.EditorColor); + + if (volume != lightProbeVolume.Volume) + { + Undo.RecordObject(target, "Light Probe Volume changes"); + lightProbeVolume.Volume = volume; + EditorUtility.SetDirty(target); + } + } + + [DrawGizmo(GizmoType.Selected | GizmoType.InSelectionHierarchy | GizmoType.Active)] + private static void DrawGizmoVolume(LightProbeVolume volume, GizmoType gizmoType) + { + var color = LightProbeVolume.EditorColor; + Gizmos.color = color; + Gizmos.matrix = Matrix4x4.TRS(volume.transform.position, volume.transform.rotation, Vector3.one); + Gizmos.DrawWireCube(volume.Origin, volume.Size); + + if (gizmoType != (GizmoType.Selected | GizmoType.InSelectionHierarchy | GizmoType.Active)) return; + + color.a = 0.25f; + Gizmos.color = color; + Gizmos.DrawCube(volume.Origin, volume.Size); + + var probes = volume.CreatePositions(); + + for (int i = 0; i < probes.Count; i++) + { + Gizmos.DrawIcon(probes[i], "NONE", false); + } + } + + [MenuItem("GameObject/Light/Light Probe Volume")] + private static void CreateLightProbeVolume(MenuCommand menuCommand) + { + var go = new GameObject("Light Probe Volume"); + + go.AddComponent(); + GameObjectUtility.SetParentAndAlign(go, menuCommand.context as GameObject); + Undo.RegisterCreatedObjectUndo(go, "Create Light Probe Volume"); + + Selection.activeGameObject = go; + } + } +} diff --git a/Assets/Plugins/SimpleLightProbePlacer/Editor/LightProbeVolumeEditor.cs.meta b/Assets/Plugins/SimpleLightProbePlacer/Editor/LightProbeVolumeEditor.cs.meta new file mode 100644 index 0000000..6ddef42 --- /dev/null +++ b/Assets/Plugins/SimpleLightProbePlacer/Editor/LightProbeVolumeEditor.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: ed7bb5f68f00e944da65fd411da6fd53 +timeCreated: 1457260999 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/SimpleLightProbePlacer/Scripts.meta b/Assets/Plugins/SimpleLightProbePlacer/Scripts.meta new file mode 100644 index 0000000..28c05e0 --- /dev/null +++ b/Assets/Plugins/SimpleLightProbePlacer/Scripts.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: fb0bc3e0b33493443b1caeaaee1a0196 +folderAsset: yes +timeCreated: 1457191632 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/SimpleLightProbePlacer/Scripts/LightProbeGroupControl.cs b/Assets/Plugins/SimpleLightProbePlacer/Scripts/LightProbeGroupControl.cs new file mode 100644 index 0000000..ac5ca8c --- /dev/null +++ b/Assets/Plugins/SimpleLightProbePlacer/Scripts/LightProbeGroupControl.cs @@ -0,0 +1,153 @@ +using UnityEngine; +using System.Collections.Generic; +using System.Linq; + +namespace SimpleLightProbePlacer +{ + [RequireComponent(typeof(LightProbeGroup))] + [AddComponentMenu("Rendering/Light Probe Group Control")] + public class LightProbeGroupControl : MonoBehaviour + { + [SerializeField] private float m_mergeDistance = 0.5f; + [SerializeField] private bool m_usePointLights = true; + [SerializeField] private float m_pointLightRange = 1; + + public float MergeDistance { get { return m_mergeDistance; } set { m_mergeDistance = value; } } + public int MergedProbes { get { return m_mergedProbes; } } + public bool UsePointLights { get { return m_usePointLights; } set { m_usePointLights = value; } } + public float PointLightRange { get { return m_pointLightRange; } set { m_pointLightRange = value; } } + + public LightProbeGroup LightProbeGroup + { + get + { + if (m_lightProbeGroup != null) return m_lightProbeGroup; + return m_lightProbeGroup = GetComponent(); + } + } + + private int m_mergedProbes; + private LightProbeGroup m_lightProbeGroup; + + public void DeleteAll() + { + LightProbeGroup.probePositions = null; + m_mergedProbes = 0; + } + + public void Create() + { + DeleteAll(); + + List positions = CreatePositions(); + positions.AddRange(CreateAroundPointLights(m_pointLightRange)); + positions = MergeClosestPositions(positions, m_mergeDistance, out m_mergedProbes); + + ApplyPositions(positions); + } + + public void Merge() + { + if (LightProbeGroup.probePositions == null) return; + + List positions = MergeClosestPositions(LightProbeGroup.probePositions.ToList(), m_mergeDistance, out m_mergedProbes); + positions = positions.Select(x => transform.TransformPoint(x)).ToList(); + + ApplyPositions(positions); + } + + private void ApplyPositions(List positions) + { + LightProbeGroup.probePositions = positions.Select(x => transform.InverseTransformPoint(x)).ToArray(); + } + + private static List CreatePositions() + { + var lightProbeVolumes = FindObjectsOfType(); + + if (lightProbeVolumes.Length == 0) return new List(); + + List probes = new List(); + + for (int i = 0; i < lightProbeVolumes.Length; i++) + { + probes.AddRange(lightProbeVolumes[i].CreatePositions()); + } + + return probes; + } + + private static List CreateAroundPointLights(float range) + { + var lights = FindObjectsOfType().Where(x => x.type == LightType.Point).ToList(); + + if (lights.Count == 0) return new List(); + + List probes = new List(); + + for (int i = 0; i < lights.Count; i++) + { + probes.AddRange(CreatePositionsAround(lights[i].transform, range)); + } + + return probes; + } + + private static List MergeClosestPositions(List positions, float distance, out int mergedCount) + { + if (positions == null) + { + mergedCount = 0; + return new List(); + } + + int exist = positions.Count; + bool done = false; + + while (!done) + { + Dictionary> closest = new Dictionary>(); + + for (int i = 0; i < positions.Count; i++) + { + List points = positions.Where(x => (x - positions[i]).magnitude < distance).ToList(); + if (points.Count > 0 && !closest.ContainsKey(positions[i])) + { + closest.Add(positions[i], points); + } + } + + positions.Clear(); + List keys = closest.Keys.ToList(); + + for (int i = 0; i < keys.Count; i++) + { + var center = closest[keys[i]].Aggregate(Vector3.zero, (result, target) => result + target) / closest[keys[i]].Count; + if (!positions.Exists(x => x == center)) positions.Add(center); + } + + done = positions.Select(x => positions.Where(y => y != x && (y - x).magnitude < distance)).All(x => !x.Any()); + } + + mergedCount = exist - positions.Count; + return positions; + } + + public static List CreatePositionsAround(Transform transform, float range) + { + Vector3[] corners = + { + new Vector3(-0.5f, 0.5f, -0.5f), + new Vector3(-0.5f, 0.5f, 0.5f), + new Vector3(0.5f, 0.5f, 0.5f), + new Vector3(0.5f, 0.5f, -0.5f), + new Vector3(-0.5f, -0.5f, -0.5f), + new Vector3(-0.5f, -0.5f, 0.5f), + new Vector3(0.5f, -0.5f, 0.5f), + new Vector3(0.5f, -0.5f, -0.5f) + }; + + return corners.Select(x => transform.TransformPoint(x * range)).ToList(); + } + } +} diff --git a/Assets/Plugins/SimpleLightProbePlacer/Scripts/LightProbeGroupControl.cs.meta b/Assets/Plugins/SimpleLightProbePlacer/Scripts/LightProbeGroupControl.cs.meta new file mode 100644 index 0000000..db9a687 --- /dev/null +++ b/Assets/Plugins/SimpleLightProbePlacer/Scripts/LightProbeGroupControl.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 9e58b2a5f02556c4897347a45818c57a +timeCreated: 1457269174 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: 34a11416a6b53ee4795f603273b9a46d, type: 3} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/SimpleLightProbePlacer/Scripts/LightProbeVolume.cs b/Assets/Plugins/SimpleLightProbePlacer/Scripts/LightProbeVolume.cs new file mode 100644 index 0000000..9589b81 --- /dev/null +++ b/Assets/Plugins/SimpleLightProbePlacer/Scripts/LightProbeVolume.cs @@ -0,0 +1,97 @@ +using UnityEngine; +using System.Collections.Generic; + +namespace SimpleLightProbePlacer +{ + public enum LightProbeVolumeType { Fixed, Float } + + [AddComponentMenu("Rendering/Light Probe Volume")] + public class LightProbeVolume : TransformVolume + { + [SerializeField] private LightProbeVolumeType m_type = LightProbeVolumeType.Fixed; + [SerializeField] private Vector3 m_densityFixed = Vector3.one; + [SerializeField] private Vector3 m_densityFloat = Vector3.one; + + public LightProbeVolumeType Type { get { return m_type; } set { m_type = value; } } + public Vector3 Density + { + get { return m_type == LightProbeVolumeType.Fixed ? m_densityFixed : m_densityFloat; } + set + { + if (m_type == LightProbeVolumeType.Fixed) m_densityFixed = value; + else m_densityFloat = value; + } + } + + public static Color EditorColor { get { return new Color(1, 0.9f, 0.25f); } } + + public List CreatePositions() + { + return CreatePositions(m_type); + } + + public List CreatePositions(LightProbeVolumeType type) + { + return type == LightProbeVolumeType.Fixed + ? CreatePositionsFixed(transform, Origin, Size, Density) + : CreatePositionsFloat(transform, Origin, Size, Density); + } + + public static List CreatePositionsFixed(Transform volumeTransform, Vector3 origin, Vector3 size, Vector3 density) + { + List posList = new List(); + var offset = origin; + + var moveX = size.x / Mathf.FloorToInt(density.x); + var moveY = size.y / Mathf.FloorToInt(density.y); + var moveZ = size.z / Mathf.FloorToInt(density.z); + + offset -= size * 0.5f; + + for (int x = 0; x <= density.x; x++) + { + for (int y = 0; y <= density.y; y++) + { + for (int z = 0; z <= density.z; z++) + { + var probePos = offset + new Vector3(x * moveX, y * moveY, z * moveZ); + probePos = volumeTransform.TransformPoint(probePos); + posList.Add(probePos); + } + } + } + + return posList; + } + + public static List CreatePositionsFloat(Transform volumeTransform, Vector3 origin, Vector3 size, Vector3 density) + { + List posList = new List(); + var offset = origin; + + var stepX = Mathf.FloorToInt(size.x / density.x); + var stepY = Mathf.FloorToInt(size.y / density.y); + var stepZ = Mathf.FloorToInt(size.z / density.z); + + offset -= size * 0.5f; + offset.x += (size.x - stepX * density.x) * 0.5f; + offset.y += (size.y - stepY * density.y) * 0.5f; + offset.z += (size.z - stepZ * density.z) * 0.5f; + + for (int x = 0; x <= stepX; x++) + { + for (int y = 0; y <= stepY; y++) + { + for (int z = 0; z <= stepZ; z++) + { + var probePos = offset + new Vector3(x * density.x, y * density.y, z * density.z); + probePos = volumeTransform.TransformPoint(probePos); + posList.Add(probePos); + } + } + } + + return posList; + } + } +} diff --git a/Assets/Plugins/SimpleLightProbePlacer/Scripts/LightProbeVolume.cs.meta b/Assets/Plugins/SimpleLightProbePlacer/Scripts/LightProbeVolume.cs.meta new file mode 100644 index 0000000..4e9d8c2 --- /dev/null +++ b/Assets/Plugins/SimpleLightProbePlacer/Scripts/LightProbeVolume.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 6ce72b8e8fac84047a96f26f2b28d1d9 +timeCreated: 1457269185 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: 152cd48aa35f97f45b3522bf745d7712, type: 3} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/SimpleLightProbePlacer/Scripts/TransformVolume.cs b/Assets/Plugins/SimpleLightProbePlacer/Scripts/TransformVolume.cs new file mode 100644 index 0000000..b4e2d80 --- /dev/null +++ b/Assets/Plugins/SimpleLightProbePlacer/Scripts/TransformVolume.cs @@ -0,0 +1,197 @@ +using UnityEngine; +using System.Collections.Generic; +using System.Linq; + +#if UNITY_EDITOR +using UnityEditor; +#endif + +namespace SimpleLightProbePlacer +{ + [AddComponentMenu("")] + public class TransformVolume : MonoBehaviour + { + [SerializeField] private Volume m_volume = new Volume(Vector3.zero, Vector3.one); + + public Volume Volume { get { return m_volume; } set { m_volume = value; } } + public Vector3 Origin { get { return m_volume.Origin; } } + public Vector3 Size { get { return m_volume.Size; } } + + public bool IsInBounds(Vector3[] points) + { + return GetBounds().Intersects(GetBounds(points)); + } + + public bool IsOnBorder(Vector3[] points) + { + if (points.All(x => !IsInVolume(x))) return false; + + return !points.All(IsInVolume); + } + + public bool IsInVolume(Vector3[] points) + { + return points.All(IsInVolume); + } + + public bool IsInVolume(Vector3 position) + { + for (int i = 0; i < 6; i++) + { + var plane = new Plane(GetSideDirection(i), GetSidePosition(i)); + + if (plane.GetSide(position)) return false; + } + + return true; + } + + public Vector3[] GetCorners() + { + Vector3[] corners = + { + new Vector3(-0.5f, 0.5f, -0.5f), + new Vector3(-0.5f, 0.5f, 0.5f), + new Vector3(0.5f, 0.5f, 0.5f), + new Vector3(0.5f, 0.5f, -0.5f), + new Vector3(-0.5f, -0.5f, -0.5f), + new Vector3(-0.5f, -0.5f, 0.5f), + new Vector3(0.5f, -0.5f, 0.5f), + new Vector3(0.5f, -0.5f, -0.5f) + }; + + for (int i = 0; i < corners.Length; i++) + { + corners[i].x *= m_volume.Size.x; + corners[i].y *= m_volume.Size.y; + corners[i].z *= m_volume.Size.z; + + corners[i] = transform.TransformPoint(m_volume.Origin + corners[i]); + } + + return corners; + } + + public Bounds GetBounds() + { + return GetBounds(GetCorners()); + } + + public Bounds GetBounds(Vector3[] points) + { + var center = points.Aggregate(Vector3.zero, (result, point) => result + point) / points.Length; + var bounds = new Bounds(center, Vector3.zero); + + for (int i = 0; i < points.Length; i++) + { + bounds.Encapsulate(points[i]); + } + + return bounds; + } + + public GameObject[] GetGameObjectsInBounds(LayerMask layerMask) + { + MeshRenderer[] meshRenderers = FindObjectsOfType(); + + List list = new List(); + + Bounds bounds = GetBounds(); + + for (int i = 0; i < meshRenderers.Length; i++) + { + if (meshRenderers[i].gameObject == transform.gameObject) continue; + if (meshRenderers[i].GetComponent() != null) continue; + if ((1 << meshRenderers[i].gameObject.layer & layerMask.value) == 0) continue; + + if (bounds.Intersects(meshRenderers[i].bounds)) + { + list.Add(meshRenderers[i].gameObject); + } + } + + return list.ToArray(); + } + + public Vector3 GetSideDirection(int side) + { + Vector3[] sides = new Vector3[6]; + + var right = Vector3.right; + var up = Vector3.up; + var forward = Vector3.forward; + + sides[0] = right; + sides[1] = -right; + sides[2] = up; + sides[3] = -up; + sides[4] = forward; + sides[5] = -forward; + + return transform.TransformDirection(sides[side]); + } + + public Vector3 GetSidePosition(int side) + { + Vector3[] sides = new Vector3[6]; + + var right = Vector3.right; + var up = Vector3.up; + var forward = Vector3.forward; + + sides[0] = right; + sides[1] = -right; + sides[2] = up; + sides[3] = -up; + sides[4] = forward; + sides[5] = -forward; + + return transform.TransformPoint(sides[side] * GetSizeAxis(side) + m_volume.Origin); + } + + public float GetSizeAxis(int side) + { + switch (side) + { + case 0: + case 1: return m_volume.Size.x * 0.5f; + case 2: + case 3: return m_volume.Size.y * 0.5f; + default: return m_volume.Size.z * 0.5f; + } + } + +#if UNITY_EDITOR + public static Volume EditorVolumeControl(TransformVolume transformVolume, float handleSize, Color color) + { + Vector3 origin, size; + Vector3[] controlHandles = new Vector3[6]; + var transform = transformVolume.transform; + + Handles.color = color; + + for (int i = 0; i < controlHandles.Length; i++) + { + controlHandles[i] = transformVolume.GetSidePosition(i); + } + + controlHandles[0] = Handles.Slider(controlHandles[0], transform.right, handleSize, Handles.DotHandleCap, 1); + controlHandles[1] = Handles.Slider(controlHandles[1], transform.right, handleSize, Handles.DotHandleCap, 1); + controlHandles[2] = Handles.Slider(controlHandles[2], transform.up, handleSize, Handles.DotHandleCap, 1); + controlHandles[3] = Handles.Slider(controlHandles[3], transform.up, handleSize, Handles.DotHandleCap, 1); + controlHandles[4] = Handles.Slider(controlHandles[4], transform.forward, handleSize, Handles.DotHandleCap, 1); + controlHandles[5] = Handles.Slider(controlHandles[5], transform.forward, handleSize, Handles.DotHandleCap, 1); + + origin.x = transform.InverseTransformPoint((controlHandles[0] + controlHandles[1]) * 0.5f).x; + origin.y = transform.InverseTransformPoint((controlHandles[2] + controlHandles[3]) * 0.5f).y; + origin.z = transform.InverseTransformPoint((controlHandles[4] + controlHandles[5]) * 0.5f).z; + + size.x = transform.InverseTransformPoint(controlHandles[0]).x - transform.InverseTransformPoint(controlHandles[1]).x; + size.y = transform.InverseTransformPoint(controlHandles[2]).y - transform.InverseTransformPoint(controlHandles[3]).y; + size.z = transform.InverseTransformPoint(controlHandles[4]).z - transform.InverseTransformPoint(controlHandles[5]).z; + + return new Volume(origin, size); + } +#endif + } +} diff --git a/Assets/Plugins/SimpleLightProbePlacer/Scripts/TransformVolume.cs.meta b/Assets/Plugins/SimpleLightProbePlacer/Scripts/TransformVolume.cs.meta new file mode 100644 index 0000000..80bec4a --- /dev/null +++ b/Assets/Plugins/SimpleLightProbePlacer/Scripts/TransformVolume.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: d839bef4d4110b244bf82bcec581a66d +timeCreated: 1457258829 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/SimpleLightProbePlacer/Scripts/Volume.cs b/Assets/Plugins/SimpleLightProbePlacer/Scripts/Volume.cs new file mode 100644 index 0000000..e845b3b --- /dev/null +++ b/Assets/Plugins/SimpleLightProbePlacer/Scripts/Volume.cs @@ -0,0 +1,54 @@ +using UnityEngine; + +namespace SimpleLightProbePlacer +{ + [System.Serializable] + public struct Volume + { + [SerializeField] private Vector3 m_origin; + [SerializeField] private Vector3 m_size; + + public Vector3 Origin { get { return m_origin; } } + public Vector3 Size { get { return m_size; } } + + public Volume(Vector3 origin, Vector3 size) + { + m_origin = origin; + m_size = size; + } + + public static bool operator ==(Volume left, Volume right) + { + return left.Equals(right); + } + + public static bool operator !=(Volume left, Volume right) + { + return !left.Equals(right); + } + + public bool Equals(Volume other) + { + return Origin == other.Origin && Size == other.Size; + } + + public override bool Equals(object obj) + { + if (ReferenceEquals(null, obj)) return false; + return obj is Volume && Equals((Volume) obj); + } + + public override int GetHashCode() + { + unchecked + { + return (Origin.GetHashCode() * 397) ^ Size.GetHashCode(); + } + } + + public override string ToString() + { + return string.Format("Origin: {0}, Size: {1}", Origin, Size); + } + } +} diff --git a/Assets/Plugins/SimpleLightProbePlacer/Scripts/Volume.cs.meta b/Assets/Plugins/SimpleLightProbePlacer/Scripts/Volume.cs.meta new file mode 100644 index 0000000..4b329d5 --- /dev/null +++ b/Assets/Plugins/SimpleLightProbePlacer/Scripts/Volume.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: f270f689c223be84f93d18074813ab7f +timeCreated: 1457259045 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/README.md b/Assets/README.md new file mode 100644 index 0000000..92a58b3 --- /dev/null +++ b/Assets/README.md @@ -0,0 +1,10 @@ +# TNH Quality of Life Improvements +This mod adds quality of life improvements to the *Take and Hold* experience. + +## Features +* More visible HP counter +* Token and hold counter on wrist +* Player count for online leaderboards + * Incompatiible with TNHTweaker + +Enable/disable these features in your mod manager's *Config editor*. \ No newline at end of file diff --git a/Assets/README.md.meta b/Assets/README.md.meta new file mode 100644 index 0000000..77f4911 --- /dev/null +++ b/Assets/README.md.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ab1d6dea017447a48ac348db588a6f35 +timeCreated: 1642657337 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Settings.meta b/Assets/Settings.meta new file mode 100644 index 0000000..6ae2261 --- /dev/null +++ b/Assets/Settings.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 458207f7be969054a86c4182f7b24554 +folderAsset: yes +timeCreated: 1629140349 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Settings/BakeryProjectSettings.asset b/Assets/Settings/BakeryProjectSettings.asset new file mode 100644 index 0000000..2da2938 --- /dev/null +++ b/Assets/Settings/BakeryProjectSettings.asset @@ -0,0 +1,23 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 05ce0574111032a418688d5d3961cb09, type: 3} + m_Name: BakeryProjectSettings + m_EditorClassIdentifier: + mipmapLightmaps: 0 + format8bit: 0 + texelPaddingForDefaultAtlasPacker: 3 + texelPaddingForXatlasAtlasPacker: 1 + alphaMetaPassResolutionMultiplier: 2 + volumeRenderMode: 1000 + deletePreviousLightmapsBeforeBake: 0 + logLevel: 3 + alternativeScaleInLightmap: 0 + generateSmoothPos: 1 diff --git a/Assets/Settings/BakeryProjectSettings.asset.meta b/Assets/Settings/BakeryProjectSettings.asset.meta new file mode 100644 index 0000000..3b4a284 --- /dev/null +++ b/Assets/Settings/BakeryProjectSettings.asset.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: b4e6f6c2117595b4697d03c8b3545474 +timeCreated: 1629140350 +licenseType: Pro +NativeFormatImporter: + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/_Fonts.meta b/Assets/_Fonts.meta new file mode 100644 index 0000000..da4de23 --- /dev/null +++ b/Assets/_Fonts.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 623ce5e3a46127b4492d42d663741c3c +folderAsset: yes +timeCreated: 1642676798 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/_Fonts/AGENCYR.TTF b/Assets/_Fonts/AGENCYR.TTF new file mode 100644 index 0000000..f0f7e95 Binary files /dev/null and b/Assets/_Fonts/AGENCYR.TTF differ diff --git a/Assets/_Fonts/AGENCYR.TTF.meta b/Assets/_Fonts/AGENCYR.TTF.meta new file mode 100644 index 0000000..b081385 --- /dev/null +++ b/Assets/_Fonts/AGENCYR.TTF.meta @@ -0,0 +1,21 @@ +fileFormatVersion: 2 +guid: 05d48c500227c8a4bbb7c02e3ccbb0b3 +timeCreated: 1642730970 +licenseType: Free +TrueTypeFontImporter: + serializedVersion: 4 + fontSize: 16 + forceTextureCase: -2 + characterSpacing: 0 + characterPadding: 1 + includeFontData: 1 + fontName: Agency FB + fontNames: + - Agency FB + fallbackFontReferences: [] + customCharacters: + fontRenderingMode: 0 + ascentCalculationMode: 1 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/_Prefabs.meta b/Assets/_Prefabs.meta new file mode 100644 index 0000000..f6d6ca2 --- /dev/null +++ b/Assets/_Prefabs.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: c7b95c01c3e82834aadd369899319f0b +folderAsset: yes +timeCreated: 1642674489 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/_Prefabs/HoldCounter.prefab b/Assets/_Prefabs/HoldCounter.prefab new file mode 100644 index 0000000..8e771c3 --- /dev/null +++ b/Assets/_Prefabs/HoldCounter.prefab @@ -0,0 +1,298 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1001 &100100000 +Prefab: + m_ObjectHideFlags: 1 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: [] + m_RemovedComponents: [] + m_ParentPrefab: {fileID: 0} + m_RootGameObject: {fileID: 1421894940388160} + m_IsPrefabParent: 1 +--- !u!1 &1421894940388160 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 5 + m_Component: + - component: {fileID: 224724389550513542} + - component: {fileID: 223280777066573960} + - component: {fileID: 114413880290494276} + - component: {fileID: 114972162530505676} + - component: {fileID: 114407045877202294} + m_Layer: 5 + m_Name: HoldCounter + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!1 &1448892060479262 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 5 + m_Component: + - component: {fileID: 224142695019321682} + - component: {fileID: 222624738574860422} + - component: {fileID: 114715654616436284} + - component: {fileID: 114381015890763796} + m_Layer: 5 + m_Name: Text (1) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!1 &1698114397066010 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 5 + m_Component: + - component: {fileID: 224364969672532764} + - component: {fileID: 222541359112789466} + - component: {fileID: 114032145135548160} + - component: {fileID: 114133878122943296} + m_Layer: 5 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &114032145135548160 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1698114397066010} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_FontData: + m_Font: {fileID: 12800000, guid: 05d48c500227c8a4bbb7c02e3ccbb0b3, type: 3} + m_FontSize: 30 + m_FontStyle: 0 + m_BestFit: 1 + m_MinSize: 10 + m_MaxSize: 67 + m_Alignment: 7 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: HOLDS COMPLETED +--- !u!114 &114133878122943296 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1698114397066010} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1573420865, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_EffectColor: {r: 0, g: 0, b: 0, a: 0.734} + m_EffectDistance: {x: 3.5, y: -3.5} + m_UseGraphicAlpha: 1 +--- !u!114 &114381015890763796 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1448892060479262} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1573420865, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_EffectColor: {r: 0, g: 0, b: 0, a: 0.734} + m_EffectDistance: {x: 3.5, y: -3.5} + m_UseGraphicAlpha: 1 +--- !u!114 &114407045877202294 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1421894940388160} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 326e8d2367ceda54b967f0b1125e6d80, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!114 &114413880290494276 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1421894940388160} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1980459831, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UiScaleMode: 0 + m_ReferencePixelsPerUnit: 100 + m_ScaleFactor: 1 + m_ReferenceResolution: {x: 800, y: 600} + m_ScreenMatchMode: 0 + m_MatchWidthOrHeight: 0 + m_PhysicalUnit: 3 + m_FallbackScreenDPI: 96 + m_DefaultSpriteDPI: 96 + m_DynamicPixelsPerUnit: 1 +--- !u!114 &114715654616436284 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1448892060479262} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_FontData: + m_Font: {fileID: 12800000, guid: 05d48c500227c8a4bbb7c02e3ccbb0b3, type: 3} + m_FontSize: 200 + m_FontStyle: 0 + m_BestFit: 1 + m_MinSize: 2 + m_MaxSize: 200 + m_Alignment: 1 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: "-1 / \u221E" +--- !u!114 &114972162530505676 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1421894940388160} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1301386320, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreReversedGraphics: 1 + m_BlockingObjects: 0 + m_BlockingMask: + serializedVersion: 2 + m_Bits: 4294967295 +--- !u!222 &222541359112789466 +CanvasRenderer: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1698114397066010} +--- !u!222 &222624738574860422 +CanvasRenderer: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1448892060479262} +--- !u!223 &223280777066573960 +Canvas: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1421894940388160} + m_Enabled: 1 + serializedVersion: 3 + m_RenderMode: 2 + m_Camera: {fileID: 0} + m_PlaneDistance: 100 + m_PixelPerfect: 0 + m_ReceivesEvents: 1 + m_OverrideSorting: 0 + m_OverridePixelPerfect: 0 + m_SortingBucketNormalizedSize: 0 + m_AdditionalShaderChannelsFlag: 0 + m_SortingLayerID: 0 + m_SortingOrder: 0 + m_TargetDisplay: 0 +--- !u!224 &224142695019321682 +RectTransform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1448892060479262} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: -0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 224724389550513542} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: -45} + m_SizeDelta: {x: 0, y: -90} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!224 &224364969672532764 +RectTransform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1698114397066010} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 224724389550513542} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 105.9} + m_SizeDelta: {x: 0, y: -211.8} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!224 &224724389550513542 +RectTransform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1421894940388160} + m_LocalRotation: {x: 0.7071068, y: 0, z: 0, w: 0.7071068} + m_LocalPosition: {x: 0, y: 0, z: 150.00005} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 224364969672532764} + - {fileID: 224142695019321682} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 500, y: 300} + m_Pivot: {x: 1, y: 1} diff --git a/Assets/_Prefabs/HoldCounter.prefab.meta b/Assets/_Prefabs/HoldCounter.prefab.meta new file mode 100644 index 0000000..51e5143 --- /dev/null +++ b/Assets/_Prefabs/HoldCounter.prefab.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 2e88fb286dba59a45b49fb0ae7d9449b +timeCreated: 1642736281 +licenseType: Free +NativeFormatImporter: + mainObjectFileID: 100100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/_Prefabs/PlayerCount_LoadingText.prefab b/Assets/_Prefabs/PlayerCount_LoadingText.prefab new file mode 100644 index 0000000..9b01004 --- /dev/null +++ b/Assets/_Prefabs/PlayerCount_LoadingText.prefab @@ -0,0 +1,181 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1001 &100100000 +Prefab: + m_ObjectHideFlags: 1 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: [] + m_RemovedComponents: [] + m_ParentPrefab: {fileID: 0} + m_RootGameObject: {fileID: 1395656030192232} + m_IsPrefabParent: 1 +--- !u!1 &1395656030192232 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 5 + m_Component: + - component: {fileID: 224970090103090422} + - component: {fileID: 223521617718617028} + - component: {fileID: 114173028243638044} + - component: {fileID: 114058974758343450} + m_Layer: 5 + m_Name: PlayerCount_LoadingText + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!1 &1849953753455062 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 5 + m_Component: + - component: {fileID: 224396513112325860} + - component: {fileID: 222658238543524802} + - component: {fileID: 114817670491675782} + m_Layer: 5 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &114058974758343450 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1395656030192232} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1301386320, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreReversedGraphics: 1 + m_BlockingObjects: 0 + m_BlockingMask: + serializedVersion: 2 + m_Bits: 4294967295 +--- !u!114 &114173028243638044 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1395656030192232} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1980459831, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UiScaleMode: 0 + m_ReferencePixelsPerUnit: 100 + m_ScaleFactor: 1 + m_ReferenceResolution: {x: 800, y: 600} + m_ScreenMatchMode: 0 + m_MatchWidthOrHeight: 0 + m_PhysicalUnit: 3 + m_FallbackScreenDPI: 96 + m_DefaultSpriteDPI: 96 + m_DynamicPixelsPerUnit: 1 +--- !u!114 &114817670491675782 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1849953753455062} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 35 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 0 + m_MaxSize: 105 + m_Alignment: 0 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: LOADING PLAYER COUNT +--- !u!222 &222658238543524802 +CanvasRenderer: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1849953753455062} +--- !u!223 &223521617718617028 +Canvas: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1395656030192232} + m_Enabled: 1 + serializedVersion: 3 + m_RenderMode: 2 + m_Camera: {fileID: 0} + m_PlaneDistance: 100 + m_PixelPerfect: 0 + m_ReceivesEvents: 1 + m_OverrideSorting: 0 + m_OverridePixelPerfect: 0 + m_SortingBucketNormalizedSize: 0 + m_AdditionalShaderChannelsFlag: 0 + m_SortingLayerID: 0 + m_SortingOrder: 0 + m_TargetDisplay: 0 +--- !u!224 &224396513112325860 +RectTransform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1849953753455062} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 224970090103090422} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!224 &224970090103090422 +RectTransform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1395656030192232} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 224396513112325860} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 450, y: 192} + m_Pivot: {x: 0, y: 1} diff --git a/Assets/_Prefabs/PlayerCount_LoadingText.prefab.meta b/Assets/_Prefabs/PlayerCount_LoadingText.prefab.meta new file mode 100644 index 0000000..437ff4d --- /dev/null +++ b/Assets/_Prefabs/PlayerCount_LoadingText.prefab.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 6085354c72844664589bb5f21f9872b1 +timeCreated: 1642835309 +licenseType: Free +NativeFormatImporter: + mainObjectFileID: 100100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/_Prefabs/Store.asset b/Assets/_Prefabs/Store.asset new file mode 100644 index 0000000..9274818 --- /dev/null +++ b/Assets/_Prefabs/Store.asset @@ -0,0 +1,18 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f6d6db4144b34551885c304840edfb62, type: 3} + m_Name: Store + m_EditorClassIdentifier: + BundleName: tnh_qol_improvements + Items: + - {fileID: 1428988585174978, guid: c034a3fdd4eaa554bb81a9a202bf37dd, type: 2} + - {fileID: 1421894940388160, guid: 2e88fb286dba59a45b49fb0ae7d9449b, type: 2} + - {fileID: 1395656030192232, guid: 6085354c72844664589bb5f21f9872b1, type: 2} diff --git a/Assets/_Prefabs/Store.asset.meta b/Assets/_Prefabs/Store.asset.meta new file mode 100644 index 0000000..7a2976b --- /dev/null +++ b/Assets/_Prefabs/Store.asset.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: ccaff18373cd99848b344316974e6d46 +timeCreated: 1642674520 +licenseType: Free +NativeFormatImporter: + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/_Prefabs/TokenCounter.prefab b/Assets/_Prefabs/TokenCounter.prefab new file mode 100644 index 0000000..3e44b31 --- /dev/null +++ b/Assets/_Prefabs/TokenCounter.prefab @@ -0,0 +1,292 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1001 &100100000 +Prefab: + m_ObjectHideFlags: 1 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: [] + m_RemovedComponents: [] + m_ParentPrefab: {fileID: 0} + m_RootGameObject: {fileID: 1428988585174978} + m_IsPrefabParent: 1 +--- !u!1 &1428988585174978 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 5 + m_Component: + - component: {fileID: 224329896993820026} + - component: {fileID: 223840259008442902} + - component: {fileID: 114023855375514618} + - component: {fileID: 114997006325241484} + - component: {fileID: 114629829404751886} + m_Layer: 5 + m_Name: TokenCounter + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!1 &1714985504387126 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 5 + m_Component: + - component: {fileID: 224145026042435474} + - component: {fileID: 222323166142114182} + - component: {fileID: 114562368475859182} + - component: {fileID: 114321304637231422} + m_Layer: 5 + m_Name: Image + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!1 &1883700859314550 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 5 + m_Component: + - component: {fileID: 224085687087491578} + - component: {fileID: 222005519373611324} + - component: {fileID: 114683981307345848} + - component: {fileID: 114713007365190620} + m_Layer: 5 + m_Name: Text (1) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &114023855375514618 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1428988585174978} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1980459831, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UiScaleMode: 0 + m_ReferencePixelsPerUnit: 100 + m_ScaleFactor: 1 + m_ReferenceResolution: {x: 800, y: 600} + m_ScreenMatchMode: 0 + m_MatchWidthOrHeight: 0 + m_PhysicalUnit: 3 + m_FallbackScreenDPI: 96 + m_DefaultSpriteDPI: 96 + m_DynamicPixelsPerUnit: 1 +--- !u!114 &114321304637231422 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1714985504387126} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1573420865, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_EffectColor: {r: 0, g: 0, b: 0, a: 0.734} + m_EffectDistance: {x: 3.5, y: -3.5} + m_UseGraphicAlpha: 1 +--- !u!114 &114562368475859182 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1714985504387126} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_Sprite: {fileID: 0} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 +--- !u!114 &114629829404751886 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1428988585174978} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3224502095ea8c64bb61578336e0ae1b, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!114 &114683981307345848 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1883700859314550} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_FontData: + m_Font: {fileID: 12800000, guid: 05d48c500227c8a4bbb7c02e3ccbb0b3, type: 3} + m_FontSize: 200 + m_FontStyle: 0 + m_BestFit: 1 + m_MinSize: 1 + m_MaxSize: 200 + m_Alignment: 3 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: -1 +--- !u!114 &114713007365190620 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1883700859314550} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1573420865, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_EffectColor: {r: 0, g: 0, b: 0, a: 0.734} + m_EffectDistance: {x: 3.5, y: -3.5} + m_UseGraphicAlpha: 1 +--- !u!114 &114997006325241484 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1428988585174978} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1301386320, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreReversedGraphics: 1 + m_BlockingObjects: 0 + m_BlockingMask: + serializedVersion: 2 + m_Bits: 4294967295 +--- !u!222 &222005519373611324 +CanvasRenderer: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1883700859314550} +--- !u!222 &222323166142114182 +CanvasRenderer: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1714985504387126} +--- !u!223 &223840259008442902 +Canvas: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1428988585174978} + m_Enabled: 1 + serializedVersion: 3 + m_RenderMode: 2 + m_Camera: {fileID: 0} + m_PlaneDistance: 100 + m_PixelPerfect: 0 + m_ReceivesEvents: 1 + m_OverrideSorting: 0 + m_OverridePixelPerfect: 0 + m_SortingBucketNormalizedSize: 0 + m_AdditionalShaderChannelsFlag: 0 + m_SortingLayerID: 0 + m_SortingOrder: 0 + m_TargetDisplay: 0 +--- !u!224 &224085687087491578 +RectTransform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1883700859314550} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1.0000005, z: 1.0000005} + m_Children: [] + m_Father: {fileID: 224329896993820026} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 73.2, y: 0} + m_SizeDelta: {x: -146.4, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!224 &224145026042435474 +RectTransform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1714985504387126} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 224329896993820026} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: -122, y: 0} + m_SizeDelta: {x: 120, y: 120} + m_Pivot: {x: 1, y: 0.5} +--- !u!224 &224329896993820026 +RectTransform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1428988585174978} + m_LocalRotation: {x: 0.7071068, y: 0, z: 0, w: 0.7071068} + m_LocalPosition: {x: 0, y: 0, z: 150.00002} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 224145026042435474} + - {fileID: 224085687087491578} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 500, y: 300} + m_Pivot: {x: 0, y: 1} diff --git a/Assets/_Prefabs/TokenCounter.prefab.meta b/Assets/_Prefabs/TokenCounter.prefab.meta new file mode 100644 index 0000000..85beda4 --- /dev/null +++ b/Assets/_Prefabs/TokenCounter.prefab.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: c034a3fdd4eaa554bb81a9a202bf37dd +timeCreated: 1642677361 +licenseType: Free +NativeFormatImporter: + mainObjectFileID: 100100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/_Scripts.meta b/Assets/_Scripts.meta new file mode 100644 index 0000000..3d7bbdb --- /dev/null +++ b/Assets/_Scripts.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 69c5c3c698a11cc449f00eaa9fc72b45 +folderAsset: yes +timeCreated: 1642658518 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/_Scripts/HoldCounter.cs b/Assets/_Scripts/HoldCounter.cs new file mode 100644 index 0000000..840f361 --- /dev/null +++ b/Assets/_Scripts/HoldCounter.cs @@ -0,0 +1,30 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.UI; +using FistVR; + +namespace TNHQoLImprovements +{ + public class HoldCounter : MonoBehaviour + { + void Start() + { + transform.parent = GameObject.Find("_NewTAHReticle/TAHReticle_HealthBar").transform; + transform.localPosition = new Vector3(-1f, 0, -.5f); + transform.localRotation = Quaternion.Euler(90, 0, 0); + transform.localScale = new Vector3(0.002f, 0.002f, 0.002f); + } + + void Update() + { + string display = ""; + if (InPlay.tnhManager.ProgressionMode == TNHSetting_ProgressionType.Marathon) + display = string.Format("{0} / ∞", InPlay.tnhManager.m_level); + else + display = string.Format("{0} / {1}", InPlay.tnhManager.m_level, InPlay.tnhManager.m_maxLevels); + + transform.GetChild(1).GetComponent().text = display; + } + } +} \ No newline at end of file diff --git a/Assets/_Scripts/HoldCounter.cs.meta b/Assets/_Scripts/HoldCounter.cs.meta new file mode 100644 index 0000000..ee49fca --- /dev/null +++ b/Assets/_Scripts/HoldCounter.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 326e8d2367ceda54b967f0b1125e6d80 +timeCreated: 1642908727 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/_Scripts/InPlay.cs b/Assets/_Scripts/InPlay.cs new file mode 100644 index 0000000..b517b23 --- /dev/null +++ b/Assets/_Scripts/InPlay.cs @@ -0,0 +1,65 @@ +using System.Collections; +using UnityEngine; +using UnityEngine.UI; +using FistVR; + +namespace TNHQoLImprovements +{ + /// + /// Code here should only be run when in TNH play. + /// + public class InPlay : MonoBehaviour + { + private GameObject gObjHUD; + private GameObject gObjTokens; + public static TNH_Manager tnhManager; + + #region INITIALIZATION + void ImproveHPTextReadability() + { + var canvas = gObjHUD.GetComponent(); + var gObjBG = new GameObject(); + var tranHPTitle = gObjHUD.transform.Find("Label_Title (1)"); + var tranHP = gObjHUD.transform.Find("Label_Title"); + + // apply background + if (MeatKitPlugin.showHPBackground.Value) + { + gObjBG.transform.parent = gObjHUD.transform; + gObjBG.transform.SetSiblingIndex(0); + gObjBG.transform.localPosition = new Vector3(0, 1, 0); + gObjBG.transform.localRotation = Quaternion.identity; + gObjBG.transform.localScale = tranHP.localScale; + var rawImage = gObjBG.AddComponent(); + rawImage.color = new Color(0, 0, 0, MeatKitPlugin.hpBackgroundOpacity.Value); + rawImage.rectTransform.SetWidth(100); + rawImage.rectTransform.SetHeight(52); + } + + // full text alphas + tranHPTitle.GetComponent().color = Color.white; + tranHP.GetComponent().color = Color.white; + // text shadows + var shadow = tranHPTitle.gameObject.AddComponent(); + shadow.effectColor = new Color(0, 0, 0, .95f); + shadow.effectDistance = new Vector2(0.5f, -0.5f); + shadow = tranHP.gameObject.AddComponent(); + shadow.effectColor = new Color(0, 0, 0, .95f); + shadow.effectDistance = new Vector2(0.5f, -0.5f); + } + + // Use this for initialization + void Start() + { + tnhManager = GameObject.Find("_GameManager").GetComponent(); + gObjHUD = GameObject.Find("HealthBar(Clone)/f"); + + ImproveHPTextReadability(); + if (MeatKitPlugin.showTokens.Value) + Instantiate(MeatKitPlugin.bundle.LoadAsset("TokenCounter")); + if (MeatKitPlugin.showHolds.Value) + Instantiate(MeatKitPlugin.bundle.LoadAsset("HoldCounter")); + } + #endregion + } +} \ No newline at end of file diff --git a/Assets/_Scripts/InPlay.cs.meta b/Assets/_Scripts/InPlay.cs.meta new file mode 100644 index 0000000..b8ad71a --- /dev/null +++ b/Assets/_Scripts/InPlay.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: fe22950149f00884eadae4da41fa5ee3 +timeCreated: 1642761823 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/_Scripts/LeaderboardPlayerCount.cs b/Assets/_Scripts/LeaderboardPlayerCount.cs new file mode 100644 index 0000000..893a189 --- /dev/null +++ b/Assets/_Scripts/LeaderboardPlayerCount.cs @@ -0,0 +1,84 @@ +using System; +using System.Reflection; +using BepInEx.Bootstrap; +using UnityEngine; +using UnityEngine.UI; +using FistVR; +using RUST.Steamworks; +using System.Collections.Generic; + +namespace TNHQoLImprovements +{ + public class LeaderboardPlayerCount : MonoBehaviour + { + private bool initialized = false; + private bool tnhTweakerInstalled = false; + + private string curID; + + private TNH_ScoreDisplay scoreDisplay; + private Text lblGlobalScores; + private GameObject gObjLoading; + + public void Start() + { + Debug.Log("--- Installed BepInEx Plugins ---"); + foreach (var plugin in Chainloader.PluginInfos) + { + Debug.Log(plugin.Key); + } + Debug.Log("--- End Plugins ---"); + } + + public void Init(TNH_ScoreDisplay tnhScore, Text scoreLabel, GameObject gObjLoading) + { + if (initialized) + return; + + this.scoreDisplay = tnhScore; + this.lblGlobalScores = scoreLabel; + this.lblGlobalScores.resizeTextForBestFit = true; + this.lblGlobalScores.horizontalOverflow = HorizontalWrapMode.Overflow; + this.gObjLoading = gObjLoading; + + var loadedAssemblies = System.AppDomain.CurrentDomain.GetAssemblies(); + if (Array.Exists(loadedAssemblies, x => x.GetName().Name == "TakeAndHoldTweaker")) + { + tnhTweakerInstalled = true; + this.gObjLoading.transform.GetChild(0).GetComponent().text = "Online leaderboards player count is incompatible with TNHTweaker."; + this.gObjLoading.SetActive(true); + } + + initialized = true; + } + + private void Update() + { + if (!initialized || tnhTweakerInstalled) + return; + + string newID = scoreDisplay.m_curSequenceID; + if (newID != curID) + UpdatePlayerCountDisplay(newID); + } + + private void UpdatePlayerCountDisplay(string id) + { + try + { + string playerCountText = Steamworks.SteamUserStats + .GetLeaderboardEntryCount(HighScoreManager.Leaderboards[id]) + .ToString("N0"); + lblGlobalScores.text = "Global Scores: (" + playerCountText + " players)"; + curID = id; + gObjLoading.SetActive(false); + } + catch (KeyNotFoundException e) + { + lblGlobalScores.text = "Global Scores:"; + gObjLoading.SetActive(true); + curID = null; + } + } + } +} \ No newline at end of file diff --git a/Assets/_Scripts/LeaderboardPlayerCount.cs.meta b/Assets/_Scripts/LeaderboardPlayerCount.cs.meta new file mode 100644 index 0000000..687d0a4 --- /dev/null +++ b/Assets/_Scripts/LeaderboardPlayerCount.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: b5ac26e534584c84babdbf9380fec1c9 +timeCreated: 1642852455 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/_Scripts/LeaderboardPlayerCountPatch.cs b/Assets/_Scripts/LeaderboardPlayerCountPatch.cs new file mode 100644 index 0000000..b7cc673 --- /dev/null +++ b/Assets/_Scripts/LeaderboardPlayerCountPatch.cs @@ -0,0 +1,58 @@ +using HarmonyLib; +using UnityEngine; +using UnityEngine.UI; +using FistVR; + +namespace TNHQoLImprovements +{ + [HarmonyPatch] + public class LeaderboardPlayerCountPatch + { + Harmony harmony; + private static GameObject gObjLoading; + private static Text uiGlobalText; + + public LeaderboardPlayerCountPatch() + { + harmony = new Harmony("me.muskit.TNHQualityOfLifeImprovements.LeaderboardPlayerCount"); + harmony.PatchAll(); + } + + [HarmonyPostfix] + [HarmonyPatch(typeof(TNH_ScoreDisplay), "Start")] + public static void Setup(TNH_ScoreDisplay __instance) + { + GameObject gObjLeaderboard = null; + gObjLoading = GameObject.Instantiate(MeatKitPlugin.bundle.LoadAsset("PlayerCount_LoadingText")); + if (__instance.gameObject.name == "_MainMenu") // lobby + { + gObjLeaderboard = __instance.transform.GetChild(3).gameObject; // MainMenuCanvas_RightFar + gObjLoading.transform.SetParent(gObjLeaderboard.transform, false); + gObjLoading.GetComponent().pivot = new Vector2(0, 1); + gObjLoading.transform.localPosition = new Vector3(520, 380, 0); + gObjLoading.transform.GetChild(0).GetComponent().alignment = TextAnchor.UpperLeft; + } + if (__instance.gameObject.name == "_FinalScoreDisplay(Clone)") // game over room + { + gObjLeaderboard = __instance.transform.GetChild(0).gameObject; // ScoreCanvas_PastScores + gObjLoading.transform.SetParent(gObjLeaderboard.transform, false); + gObjLoading.GetComponent().pivot = new Vector2(1, 1); + gObjLoading.transform.localPosition = new Vector3(-520, 380, 0); + gObjLoading.transform.GetChild(0).GetComponent().alignment = TextAnchor.UpperRight; + } + uiGlobalText = gObjLeaderboard.transform.GetChild(0).GetChild(2).GetComponent(); + gObjLoading.transform.rotation = gObjLeaderboard.transform.rotation; + gObjLoading.transform.GetChild(0).GetComponent().font = uiGlobalText.font; + + var playerCountComponent = gObjLeaderboard.AddComponent(); + playerCountComponent.Init(__instance, uiGlobalText, gObjLoading); + } + + [HarmonyPostfix] + [HarmonyPatch(typeof(TNH_ScoreDisplay), "SwitchToModeID")] + public static void OnModeIDSwitch_Post(string id, TNH_ScoreDisplay __instance) + { + Debug.Log(string.Format("Changing scoreboard mode to {0}!", id)); + } + } +} \ No newline at end of file diff --git a/Assets/_Scripts/LeaderboardPlayerCountPatch.cs.meta b/Assets/_Scripts/LeaderboardPlayerCountPatch.cs.meta new file mode 100644 index 0000000..4b3b428 --- /dev/null +++ b/Assets/_Scripts/LeaderboardPlayerCountPatch.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 8e36ded23fd7c7b40acf6063a3a8c3db +timeCreated: 1642841022 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/_Scripts/TokenCounter.cs b/Assets/_Scripts/TokenCounter.cs new file mode 100644 index 0000000..d024ed5 --- /dev/null +++ b/Assets/_Scripts/TokenCounter.cs @@ -0,0 +1,47 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.UI; + +namespace TNHQoLImprovements +{ + public class TokenCounter : MonoBehaviour + { + void Start() + { + transform.parent = GameObject.Find("_NewTAHReticle/TAHReticle_HealthBar").transform; + transform.localPosition = new Vector3(1, 0, -.5f); + transform.localRotation = Quaternion.Euler(90, 0, 0); + transform.localScale = new Vector3(0.002f, 0.002f, 0.002f); + + StartCoroutine(SetTokenImage()); + } + + private IEnumerator SetTokenImage() + { + int debug_iterations = 0; + Sprite tokenSprite = null; + while (tokenSprite == null) // END: loop until Token sprite is found + { + var obj = GameObject.Find("_TNH_ObjectConstructor(Clone)/_CanvasHolder/_UITest_Canvas/Icon_0/Cost_1/Image"); + if (obj != null) + { + tokenSprite = obj.GetComponent().sprite; + } + else + { + debug_iterations++; + yield return new WaitForSeconds(0.25f); + } + } + Debug.Log("Token sprite found after " + debug_iterations.ToString() + " iterations."); + transform.GetChild(0).GetComponent().sprite = tokenSprite; + } + + void Update() + { + int tokens = InPlay.tnhManager.GetNumTokens(); + transform.GetChild(1).GetComponent().text = tokens.ToString(); + } + } +} \ No newline at end of file diff --git a/Assets/_Scripts/TokenCounter.cs.meta b/Assets/_Scripts/TokenCounter.cs.meta new file mode 100644 index 0000000..2416537 --- /dev/null +++ b/Assets/_Scripts/TokenCounter.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 3224502095ea8c64bb61578336e0ae1b +timeCreated: 1642908735 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/_Scripts/_RectTransformExtensions.cs b/Assets/_Scripts/_RectTransformExtensions.cs new file mode 100644 index 0000000..8e5b601 --- /dev/null +++ b/Assets/_Scripts/_RectTransformExtensions.cs @@ -0,0 +1,66 @@ +using UnityEngine; + +public static class _RectTransformExtensions +{ + public static void SetDefaultScale(this RectTransform trans) + { + trans.localScale = new Vector3(1, 1, 1); + } + public static void SetPivotAndAnchors(this RectTransform trans, Vector2 aVec) + { + trans.pivot = aVec; + trans.anchorMin = aVec; + trans.anchorMax = aVec; + } + + public static Vector2 GetSize(this RectTransform trans) + { + return trans.rect.size; + } + public static float GetWidth(this RectTransform trans) + { + return trans.rect.width; + } + public static float GetHeight(this RectTransform trans) + { + return trans.rect.height; + } + + public static void SetPositionOfPivot(this RectTransform trans, Vector2 newPos) + { + trans.localPosition = new Vector3(newPos.x, newPos.y, trans.localPosition.z); + } + + public static void SetLeftBottomPosition(this RectTransform trans, Vector2 newPos) + { + trans.localPosition = new Vector3(newPos.x + (trans.pivot.x * trans.rect.width), newPos.y + (trans.pivot.y * trans.rect.height), trans.localPosition.z); + } + public static void SetLeftTopPosition(this RectTransform trans, Vector2 newPos) + { + trans.localPosition = new Vector3(newPos.x + (trans.pivot.x * trans.rect.width), newPos.y - ((1f - trans.pivot.y) * trans.rect.height), trans.localPosition.z); + } + public static void SetRightBottomPosition(this RectTransform trans, Vector2 newPos) + { + trans.localPosition = new Vector3(newPos.x - ((1f - trans.pivot.x) * trans.rect.width), newPos.y + (trans.pivot.y * trans.rect.height), trans.localPosition.z); + } + public static void SetRightTopPosition(this RectTransform trans, Vector2 newPos) + { + trans.localPosition = new Vector3(newPos.x - ((1f - trans.pivot.x) * trans.rect.width), newPos.y - ((1f - trans.pivot.y) * trans.rect.height), trans.localPosition.z); + } + + public static void SetSize(this RectTransform trans, Vector2 newSize) + { + Vector2 oldSize = trans.rect.size; + Vector2 deltaSize = newSize - oldSize; + trans.offsetMin = trans.offsetMin - new Vector2(deltaSize.x * trans.pivot.x, deltaSize.y * trans.pivot.y); + trans.offsetMax = trans.offsetMax + new Vector2(deltaSize.x * (1f - trans.pivot.x), deltaSize.y * (1f - trans.pivot.y)); + } + public static void SetWidth(this RectTransform trans, float newSize) + { + SetSize(trans, new Vector2(newSize, trans.rect.size.y)); + } + public static void SetHeight(this RectTransform trans, float newSize) + { + SetSize(trans, new Vector2(trans.rect.size.x, newSize)); + } +} \ No newline at end of file diff --git a/Assets/_Scripts/_RectTransformExtensions.cs.meta b/Assets/_Scripts/_RectTransformExtensions.cs.meta new file mode 100644 index 0000000..e465a99 --- /dev/null +++ b/Assets/_Scripts/_RectTransformExtensions.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 2738f251e64b4104f94dd7e0907680af +timeCreated: 1642904567 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..39d89d8 --- /dev/null +++ b/LICENSE @@ -0,0 +1,22 @@ + +The MIT License (MIT) + +Copyright (c) 2021 Nathan Gill + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/MeatKit.sln.DotSettings b/MeatKit.sln.DotSettings new file mode 100644 index 0000000..8df2bc4 --- /dev/null +++ b/MeatKit.sln.DotSettings @@ -0,0 +1,6 @@ + + True + True + True + True + True \ No newline at end of file diff --git a/Packages/AtlasPackage.unitypackage b/Packages/AtlasPackage.unitypackage new file mode 100644 index 0000000..bd33b72 Binary files /dev/null and b/Packages/AtlasPackage.unitypackage differ diff --git a/Packages/OtherloaderPackage.unitypackage b/Packages/OtherloaderPackage.unitypackage new file mode 100644 index 0000000..564e0c2 Binary files /dev/null and b/Packages/OtherloaderPackage.unitypackage differ diff --git a/ProjectSettings/AudioManager.asset b/ProjectSettings/AudioManager.asset new file mode 100644 index 0000000..2c4f5a1 --- /dev/null +++ b/ProjectSettings/AudioManager.asset @@ -0,0 +1,16 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!11 &1 +AudioManager: + m_ObjectHideFlags: 0 + m_Volume: 1 + Rolloff Scale: 1 + Doppler Factor: 1 + Default Speaker Mode: 2 + m_SampleRate: 0 + m_DSPBufferSize: 0 + m_VirtualVoiceCount: 512 + m_RealVoiceCount: 32 + m_SpatializerPlugin: + m_DisableAudio: 0 + m_VirtualizeEffects: 1 diff --git a/ProjectSettings/ClusterInputManager.asset b/ProjectSettings/ClusterInputManager.asset new file mode 100644 index 0000000..e7886b2 --- /dev/null +++ b/ProjectSettings/ClusterInputManager.asset @@ -0,0 +1,6 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!236 &1 +ClusterInputManager: + m_ObjectHideFlags: 0 + m_Inputs: [] diff --git a/ProjectSettings/DynamicsManager.asset b/ProjectSettings/DynamicsManager.asset new file mode 100644 index 0000000..0cf2aa0 --- /dev/null +++ b/ProjectSettings/DynamicsManager.asset @@ -0,0 +1,18 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!55 &1 +PhysicsManager: + m_ObjectHideFlags: 0 + serializedVersion: 3 + m_Gravity: {x: 0, y: -9.81, z: 0} + m_DefaultMaterial: {fileID: 0} + m_BounceThreshold: 2 + m_SleepThreshold: 0.005 + m_DefaultContactOffset: 0.01 + m_DefaultSolverIterations: 6 + m_DefaultSolverVelocityIterations: 1 + m_QueriesHitBackfaces: 0 + m_QueriesHitTriggers: 1 + m_EnableAdaptiveForce: 0 + m_EnablePCM: 1 + m_LayerCollisionMatrix: c928d80cc800000cc800000cffffffffc800000cc800000cffffffffffffffffc800000cc80c800cc80e800cc906080cc800000cc9a0580cc840080cc820910cc880000cc800000cc800000cc968581dc9a0d80cc800000cc92018ecc986900cc800080dc800000cffffffffffffffffc800080cc800400cc800408cc800404c diff --git a/ProjectSettings/EditorBuildSettings.asset b/ProjectSettings/EditorBuildSettings.asset new file mode 100644 index 0000000..6dc24f7 --- /dev/null +++ b/ProjectSettings/EditorBuildSettings.asset @@ -0,0 +1,7 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1045 &1 +EditorBuildSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Scenes: [] diff --git a/ProjectSettings/EditorSettings.asset b/ProjectSettings/EditorSettings.asset new file mode 100644 index 0000000..a9d5ffb --- /dev/null +++ b/ProjectSettings/EditorSettings.asset @@ -0,0 +1,14 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!159 &1 +EditorSettings: + m_ObjectHideFlags: 0 + serializedVersion: 3 + m_ExternalVersionControlSupport: Visible Meta Files + m_SerializationMode: 2 + m_DefaultBehaviorMode: 0 + m_SpritePackerMode: 0 + m_SpritePackerPaddingPower: 1 + m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd;asmdef + m_ProjectGenerationRootNamespace: + m_UserGeneratedProjectSuffix: diff --git a/ProjectSettings/GraphicsSettings.asset b/ProjectSettings/GraphicsSettings.asset new file mode 100644 index 0000000..50dda91 --- /dev/null +++ b/ProjectSettings/GraphicsSettings.asset @@ -0,0 +1,112 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!30 &1 +GraphicsSettings: + m_ObjectHideFlags: 0 + serializedVersion: 12 + m_Deferred: + m_Mode: 0 + m_Shader: {fileID: 0} + m_DeferredReflections: + m_Mode: 0 + m_Shader: {fileID: 0} + m_ScreenSpaceShadows: + m_Mode: 1 + m_Shader: {fileID: 64, guid: 0000000000000000f000000000000000, type: 0} + m_LegacyDeferred: + m_Mode: 0 + m_Shader: {fileID: 0} + m_DepthNormals: + m_Mode: 1 + m_Shader: {fileID: 62, guid: 0000000000000000f000000000000000, type: 0} + m_MotionVectors: + m_Mode: 0 + m_Shader: {fileID: 0} + m_LightHalo: + m_Mode: 1 + m_Shader: {fileID: 105, guid: 0000000000000000f000000000000000, type: 0} + m_LensFlare: + m_Mode: 1 + m_Shader: {fileID: 102, guid: 0000000000000000f000000000000000, type: 0} + m_AlwaysIncludedShaders: + - {fileID: 7, guid: 0000000000000000f000000000000000, type: 0} + - {fileID: 15104, guid: 0000000000000000f000000000000000, type: 0} + - {fileID: 15105, guid: 0000000000000000f000000000000000, type: 0} + - {fileID: 15106, guid: 0000000000000000f000000000000000, type: 0} + - {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0} + - {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0} + - {fileID: 10782, guid: 0000000000000000f000000000000000, type: 0} + - {fileID: 16000, guid: 0000000000000000f000000000000000, type: 0} + m_PreloadedShaders: + - {fileID: 20000000, guid: 3a459384e2e4c82418fa885241e4424a, type: 2} + m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, + type: 0} + m_CustomRenderPipeline: {fileID: 0} + m_TransparencySortMode: 0 + m_TransparencySortAxis: {x: 0, y: 0, z: 1} + m_DefaultRenderingPath: 1 + m_DefaultMobileRenderingPath: 1 + m_TierSettings: + - serializedVersion: 4 + m_BuildTarget: 1 + m_Tier: 0 + m_Settings: + standardShaderQuality: 2 + renderingPath: 1 + hdrMode: 1 + realtimeGICPUUsage: 25 + useReflectionProbeBoxProjection: 1 + useReflectionProbeBlending: 1 + useHDR: 1 + useDetailNormalMap: 1 + useCascadedShadowMaps: 1 + enableLPPV: 1 + useDitherMaskForAlphaBlendedShadows: 1 + m_Automatic: 0 + - serializedVersion: 4 + m_BuildTarget: 1 + m_Tier: 1 + m_Settings: + standardShaderQuality: 2 + renderingPath: 1 + hdrMode: 1 + realtimeGICPUUsage: 25 + useReflectionProbeBoxProjection: 1 + useReflectionProbeBlending: 1 + useHDR: 1 + useDetailNormalMap: 1 + useCascadedShadowMaps: 1 + enableLPPV: 1 + useDitherMaskForAlphaBlendedShadows: 1 + m_Automatic: 0 + - serializedVersion: 4 + m_BuildTarget: 1 + m_Tier: 2 + m_Settings: + standardShaderQuality: 2 + renderingPath: 1 + hdrMode: 1 + realtimeGICPUUsage: 50 + useReflectionProbeBoxProjection: 1 + useReflectionProbeBlending: 1 + useHDR: 1 + useDetailNormalMap: 1 + useCascadedShadowMaps: 1 + enableLPPV: 1 + useDitherMaskForAlphaBlendedShadows: 1 + m_Automatic: 0 + m_LightmapStripping: 0 + m_FogStripping: 0 + m_InstancingStripping: 0 + m_LightmapKeepPlain: 1 + m_LightmapKeepDirCombined: 1 + m_LightmapKeepDynamicPlain: 1 + m_LightmapKeepDynamicDirCombined: 1 + m_LightmapKeepShadowMask: 1 + m_LightmapKeepSubtractive: 1 + m_FogKeepLinear: 1 + m_FogKeepExp: 1 + m_FogKeepExp2: 1 + m_AlbedoSwatchInfos: [] + m_LightsUseLinearIntensity: 1 + m_LightsUseColorTemperature: 0 diff --git a/ProjectSettings/InputManager.asset b/ProjectSettings/InputManager.asset new file mode 100644 index 0000000..17c8f53 --- /dev/null +++ b/ProjectSettings/InputManager.asset @@ -0,0 +1,295 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!13 &1 +InputManager: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Axes: + - serializedVersion: 3 + m_Name: Horizontal + descriptiveName: + descriptiveNegativeName: + negativeButton: left + positiveButton: right + altNegativeButton: a + altPositiveButton: d + gravity: 3 + dead: 0.001 + sensitivity: 3 + snap: 1 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Vertical + descriptiveName: + descriptiveNegativeName: + negativeButton: down + positiveButton: up + altNegativeButton: s + altPositiveButton: w + gravity: 3 + dead: 0.001 + sensitivity: 3 + snap: 1 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Fire1 + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: left ctrl + altNegativeButton: + altPositiveButton: mouse 0 + gravity: 1000 + dead: 0.001 + sensitivity: 1000 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Fire2 + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: left alt + altNegativeButton: + altPositiveButton: mouse 1 + gravity: 1000 + dead: 0.001 + sensitivity: 1000 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Fire3 + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: left shift + altNegativeButton: + altPositiveButton: mouse 2 + gravity: 1000 + dead: 0.001 + sensitivity: 1000 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Jump + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: space + altNegativeButton: + altPositiveButton: + gravity: 1000 + dead: 0.001 + sensitivity: 1000 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Mouse X + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: + altNegativeButton: + altPositiveButton: + gravity: 0 + dead: 0 + sensitivity: 0.1 + snap: 0 + invert: 0 + type: 1 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Mouse Y + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: + altNegativeButton: + altPositiveButton: + gravity: 0 + dead: 0 + sensitivity: 0.1 + snap: 0 + invert: 0 + type: 1 + axis: 1 + joyNum: 0 + - serializedVersion: 3 + m_Name: Mouse ScrollWheel + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: + altNegativeButton: + altPositiveButton: + gravity: 0 + dead: 0 + sensitivity: 0.1 + snap: 0 + invert: 0 + type: 1 + axis: 2 + joyNum: 0 + - serializedVersion: 3 + m_Name: Horizontal + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: + altNegativeButton: + altPositiveButton: + gravity: 0 + dead: 0.19 + sensitivity: 1 + snap: 0 + invert: 0 + type: 2 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Vertical + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: + altNegativeButton: + altPositiveButton: + gravity: 0 + dead: 0.19 + sensitivity: 1 + snap: 0 + invert: 1 + type: 2 + axis: 1 + joyNum: 0 + - serializedVersion: 3 + m_Name: Fire1 + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: joystick button 0 + altNegativeButton: + altPositiveButton: + gravity: 1000 + dead: 0.001 + sensitivity: 1000 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Fire2 + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: joystick button 1 + altNegativeButton: + altPositiveButton: + gravity: 1000 + dead: 0.001 + sensitivity: 1000 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Fire3 + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: joystick button 2 + altNegativeButton: + altPositiveButton: + gravity: 1000 + dead: 0.001 + sensitivity: 1000 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Jump + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: joystick button 3 + altNegativeButton: + altPositiveButton: + gravity: 1000 + dead: 0.001 + sensitivity: 1000 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Submit + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: return + altNegativeButton: + altPositiveButton: joystick button 0 + gravity: 1000 + dead: 0.001 + sensitivity: 1000 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Submit + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: enter + altNegativeButton: + altPositiveButton: space + gravity: 1000 + dead: 0.001 + sensitivity: 1000 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Cancel + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: escape + altNegativeButton: + altPositiveButton: joystick button 1 + gravity: 1000 + dead: 0.001 + sensitivity: 1000 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 diff --git a/ProjectSettings/NavMeshAreas.asset b/ProjectSettings/NavMeshAreas.asset new file mode 100644 index 0000000..06b68d9 --- /dev/null +++ b/ProjectSettings/NavMeshAreas.asset @@ -0,0 +1,89 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!126 &1 +NavMeshProjectSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + areas: + - name: Walkable + cost: 1 + - name: Not Walkable + cost: 1 + - name: Jump + cost: 2 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + m_LastAgentTypeID: -887442657 + m_Settings: + - serializedVersion: 2 + agentTypeID: 0 + agentRadius: 0.75 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.75 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + accuratePlacement: 0 + m_SettingNames: + - Humanoid diff --git a/ProjectSettings/NetworkManager.asset b/ProjectSettings/NetworkManager.asset new file mode 100644 index 0000000..5dc6a83 --- /dev/null +++ b/ProjectSettings/NetworkManager.asset @@ -0,0 +1,8 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!149 &1 +NetworkManager: + m_ObjectHideFlags: 0 + m_DebugLevel: 0 + m_Sendrate: 15 + m_AssetToPrefab: {} diff --git a/ProjectSettings/Physics2DSettings.asset b/ProjectSettings/Physics2DSettings.asset new file mode 100644 index 0000000..c01f9b9 --- /dev/null +++ b/ProjectSettings/Physics2DSettings.asset @@ -0,0 +1,35 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!19 &1 +Physics2DSettings: + m_ObjectHideFlags: 0 + serializedVersion: 3 + m_Gravity: {x: 0, y: -9.81} + m_DefaultMaterial: {fileID: 0} + m_VelocityIterations: 8 + m_PositionIterations: 3 + m_VelocityThreshold: 1 + m_MaxLinearCorrection: 0.2 + m_MaxAngularCorrection: 8 + m_MaxTranslationSpeed: 100 + m_MaxRotationSpeed: 360 + m_BaumgarteScale: 0.2 + m_BaumgarteTimeOfImpactScale: 0.75 + m_TimeToSleep: 0.5 + m_LinearSleepTolerance: 0.01 + m_AngularSleepTolerance: 2 + m_DefaultContactOffset: 0.01 + m_QueriesHitTriggers: 1 + m_QueriesStartInColliders: 1 + m_ChangeStopsCallbacks: 0 + m_CallbacksOnDisable: 1 + m_AlwaysShowColliders: 0 + m_ShowColliderSleep: 1 + m_ShowColliderContacts: 0 + m_ShowColliderAABB: 0 + m_ContactArrowScale: 0.2 + m_ColliderAwakeColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.7529412} + m_ColliderAsleepColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.36078432} + m_ColliderContactColor: {r: 1, g: 0, b: 1, a: 0.6862745} + m_ColliderAABBColor: {r: 1, g: 1, b: 0, a: 0.2509804} + m_LayerCollisionMatrix: c928d808c8000008c8000008ffffffffc8000008c8000008ffffffffffffffffc8000008c80c8008c80e800cc9060808c800000cc9a0580cc840080cc820910cc880000cc800000cc800000cc968581dc9a0d80cc800000cc92018ecc986900cc800080dc800000cc8f4ffffffffffffc800080cc800400cc800408cc800404c diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset new file mode 100644 index 0000000..466645a --- /dev/null +++ b/ProjectSettings/ProjectSettings.asset @@ -0,0 +1,598 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!129 &1 +PlayerSettings: + m_ObjectHideFlags: 0 + serializedVersion: 11 + productGUID: 5b30187e2c413a44094b04fa7c8f179a + AndroidProfiler: 0 + defaultScreenOrientation: 4 + targetDevice: 2 + useOnDemandResources: 0 + accelerometerFrequency: 60 + companyName: DefaultCompany + productName: MeatKit + defaultCursor: {fileID: 0} + cursorHotspot: {x: 0, y: 0} + m_SplashScreenBackgroundColor: {r: 0.13333334, g: 0.17254902, b: 0.21176471, a: 1} + m_ShowUnitySplashScreen: 1 + m_ShowUnitySplashLogo: 1 + m_SplashScreenOverlayOpacity: 1 + m_SplashScreenAnimation: 1 + m_SplashScreenLogoStyle: 1 + m_SplashScreenDrawMode: 0 + m_SplashScreenBackgroundAnimationZoom: 1 + m_SplashScreenLogoAnimationZoom: 1 + m_SplashScreenBackgroundLandscapeAspect: 1 + m_SplashScreenBackgroundPortraitAspect: 1 + m_SplashScreenBackgroundLandscapeUvs: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + m_SplashScreenBackgroundPortraitUvs: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + m_SplashScreenLogos: [] + m_SplashScreenBackgroundLandscape: {fileID: 0} + m_SplashScreenBackgroundPortrait: {fileID: 0} + m_VirtualRealitySplashScreen: {fileID: 0} + m_HolographicTrackingLossScreen: {fileID: 0} + defaultScreenWidth: 1024 + defaultScreenHeight: 768 + defaultScreenWidthWeb: 960 + defaultScreenHeightWeb: 600 + m_StereoRenderingPath: 1 + m_ActiveColorSpace: 1 + m_MTRendering: 1 + m_MobileMTRendering: 0 + m_StackTraceTypes: 010000000100000001000000010000000100000001000000 + iosShowActivityIndicatorOnLoading: -1 + androidShowActivityIndicatorOnLoading: -1 + tizenShowActivityIndicatorOnLoading: -1 + iosAppInBackgroundBehavior: 0 + displayResolutionDialog: 1 + iosAllowHTTPDownload: 1 + allowedAutorotateToPortrait: 1 + allowedAutorotateToPortraitUpsideDown: 1 + allowedAutorotateToLandscapeRight: 1 + allowedAutorotateToLandscapeLeft: 1 + useOSAutorotation: 1 + use32BitDisplayBuffer: 1 + disableDepthAndStencilBuffers: 0 + defaultIsFullScreen: 1 + defaultIsNativeResolution: 1 + runInBackground: 0 + captureSingleScreen: 0 + muteOtherAudioSources: 0 + Prepare IOS For Recording: 0 + submitAnalytics: 1 + usePlayerLog: 1 + bakeCollisionMeshes: 0 + forceSingleInstance: 0 + resizableWindow: 0 + useMacAppStoreValidation: 0 + macAppStoreCategory: public.app-category.games + gpuSkinning: 0 + graphicsJobs: 0 + xboxPIXTextureCapture: 0 + xboxEnableAvatar: 0 + xboxEnableKinect: 0 + xboxEnableKinectAutoTracking: 0 + xboxEnableFitness: 0 + visibleInBackground: 0 + allowFullscreenSwitch: 1 + graphicsJobMode: 0 + macFullscreenMode: 2 + d3d9FullscreenMode: 1 + d3d11FullscreenMode: 1 + xboxSpeechDB: 0 + xboxEnableHeadOrientation: 0 + xboxEnableGuest: 0 + xboxEnablePIXSampling: 0 + n3dsDisableStereoscopicView: 0 + n3dsEnableSharedListOpt: 1 + n3dsEnableVSync: 0 + ignoreAlphaClear: 0 + xboxOneResolution: 0 + xboxOneMonoLoggingLevel: 0 + xboxOneLoggingLevel: 1 + videoMemoryForVertexBuffers: 0 + psp2PowerMode: 0 + psp2AcquireBGM: 1 + wiiUTVResolution: 0 + wiiUGamePadMSAA: 1 + wiiUSupportsNunchuk: 0 + wiiUSupportsClassicController: 0 + wiiUSupportsBalanceBoard: 0 + wiiUSupportsMotionPlus: 0 + wiiUSupportsProController: 0 + wiiUAllowScreenCapture: 1 + wiiUControllerCount: 0 + m_SupportedAspectRatios: + 4:3: 1 + 5:4: 1 + 16:10: 1 + 16:9: 1 + Others: 1 + bundleVersion: 1.0 + preloadedAssets: [] + metroInputSource: 0 + m_HolographicPauseOnTrackingLoss: 1 + xboxOneDisableKinectGpuReservation: 0 + xboxOneEnable7thCore: 0 + vrSettings: + cardboard: + depthFormat: 0 + enableTransitionView: 0 + daydream: + depthFormat: 0 + useSustainedPerformanceMode: 0 + hololens: + depthFormat: 1 + protectGraphicsMemory: 0 + useHDRDisplay: 0 + applicationIdentifier: {} + buildNumber: {} + AndroidBundleVersionCode: 1 + AndroidMinSdkVersion: 16 + AndroidTargetSdkVersion: 0 + AndroidPreferredInstallLocation: 1 + aotOptions: + stripEngineCode: 1 + iPhoneStrippingLevel: 0 + iPhoneScriptCallOptimization: 0 + ForceInternetPermission: 0 + ForceSDCardPermission: 0 + CreateWallpaper: 0 + APKExpansionFiles: 0 + keepLoadedShadersAlive: 0 + StripUnusedMeshComponents: 0 + VertexChannelCompressionMask: + serializedVersion: 2 + m_Bits: 238 + iPhoneSdkVersion: 988 + iOSTargetOSVersionString: + tvOSSdkVersion: 0 + tvOSRequireExtendedGameController: 0 + tvOSTargetOSVersionString: + uIPrerenderedIcon: 0 + uIRequiresPersistentWiFi: 0 + uIRequiresFullScreen: 1 + uIStatusBarHidden: 1 + uIExitOnSuspend: 0 + uIStatusBarStyle: 0 + iPhoneSplashScreen: {fileID: 0} + iPhoneHighResSplashScreen: {fileID: 0} + iPhoneTallHighResSplashScreen: {fileID: 0} + iPhone47inSplashScreen: {fileID: 0} + iPhone55inPortraitSplashScreen: {fileID: 0} + iPhone55inLandscapeSplashScreen: {fileID: 0} + iPadPortraitSplashScreen: {fileID: 0} + iPadHighResPortraitSplashScreen: {fileID: 0} + iPadLandscapeSplashScreen: {fileID: 0} + iPadHighResLandscapeSplashScreen: {fileID: 0} + appleTVSplashScreen: {fileID: 0} + tvOSSmallIconLayers: [] + tvOSLargeIconLayers: [] + tvOSTopShelfImageLayers: [] + tvOSTopShelfImageWideLayers: [] + iOSLaunchScreenType: 0 + iOSLaunchScreenPortrait: {fileID: 0} + iOSLaunchScreenLandscape: {fileID: 0} + iOSLaunchScreenBackgroundColor: + serializedVersion: 2 + rgba: 0 + iOSLaunchScreenFillPct: 100 + iOSLaunchScreenSize: 100 + iOSLaunchScreenCustomXibPath: + iOSLaunchScreeniPadType: 0 + iOSLaunchScreeniPadImage: {fileID: 0} + iOSLaunchScreeniPadBackgroundColor: + serializedVersion: 2 + rgba: 0 + iOSLaunchScreeniPadFillPct: 100 + iOSLaunchScreeniPadSize: 100 + iOSLaunchScreeniPadCustomXibPath: + iOSDeviceRequirements: [] + iOSURLSchemes: [] + iOSBackgroundModes: 0 + iOSMetalForceHardShadows: 0 + metalEditorSupport: 1 + metalAPIValidation: 1 + iOSRenderExtraFrameOnPause: 0 + appleDeveloperTeamID: + iOSManualSigningProvisioningProfileID: + tvOSManualSigningProvisioningProfileID: + appleEnableAutomaticSigning: 0 + AndroidTargetDevice: 0 + AndroidSplashScreenScale: 0 + androidSplashScreen: {fileID: 0} + AndroidKeystoreName: + AndroidKeyaliasName: + AndroidTVCompatibility: 1 + AndroidIsGame: 1 + androidEnableBanner: 1 + m_AndroidBanners: + - width: 320 + height: 180 + banner: {fileID: 0} + androidGamepadSupportLevel: 0 + resolutionDialogBanner: {fileID: 0} + m_BuildTargetIcons: [] + m_BuildTargetBatching: [] + m_BuildTargetGraphicsAPIs: [] + m_BuildTargetVRSettings: + - m_BuildTarget: Standalone + m_Enabled: 1 + m_Devices: + - Oculus + - OpenVR + openGLRequireES31: 0 + openGLRequireES31AEP: 0 + webPlayerTemplate: APPLICATION:Default + m_TemplateCustomTags: {} + wiiUTitleID: 0005000011000000 + wiiUGroupID: 00010000 + wiiUCommonSaveSize: 4096 + wiiUAccountSaveSize: 2048 + wiiUOlvAccessKey: 0 + wiiUTinCode: 0 + wiiUJoinGameId: 0 + wiiUJoinGameModeMask: 0000000000000000 + wiiUCommonBossSize: 0 + wiiUAccountBossSize: 0 + wiiUAddOnUniqueIDs: [] + wiiUMainThreadStackSize: 3072 + wiiULoaderThreadStackSize: 1024 + wiiUSystemHeapSize: 128 + wiiUTVStartupScreen: {fileID: 0} + wiiUGamePadStartupScreen: {fileID: 0} + wiiUDrcBufferDisabled: 0 + wiiUProfilerLibPath: + playModeTestRunnerEnabled: 0 + actionOnDotNetUnhandledException: 1 + enableInternalProfiler: 0 + logObjCUncaughtExceptions: 1 + enableCrashReportAPI: 0 + cameraUsageDescription: + locationUsageDescription: + microphoneUsageDescription: + switchNetLibKey: + switchSocketMemoryPoolSize: 6144 + switchSocketAllocatorPoolSize: 128 + switchSocketConcurrencyLimit: 14 + switchScreenResolutionBehavior: 2 + switchUseCPUProfiler: 0 + switchApplicationID: 0x01004b9000490000 + switchNSODependencies: + switchTitleNames_0: + switchTitleNames_1: + switchTitleNames_2: + switchTitleNames_3: + switchTitleNames_4: + switchTitleNames_5: + switchTitleNames_6: + switchTitleNames_7: + switchTitleNames_8: + switchTitleNames_9: + switchTitleNames_10: + switchTitleNames_11: + switchPublisherNames_0: + switchPublisherNames_1: + switchPublisherNames_2: + switchPublisherNames_3: + switchPublisherNames_4: + switchPublisherNames_5: + switchPublisherNames_6: + switchPublisherNames_7: + switchPublisherNames_8: + switchPublisherNames_9: + switchPublisherNames_10: + switchPublisherNames_11: + switchIcons_0: {fileID: 0} + switchIcons_1: {fileID: 0} + switchIcons_2: {fileID: 0} + switchIcons_3: {fileID: 0} + switchIcons_4: {fileID: 0} + switchIcons_5: {fileID: 0} + switchIcons_6: {fileID: 0} + switchIcons_7: {fileID: 0} + switchIcons_8: {fileID: 0} + switchIcons_9: {fileID: 0} + switchIcons_10: {fileID: 0} + switchIcons_11: {fileID: 0} + switchSmallIcons_0: {fileID: 0} + switchSmallIcons_1: {fileID: 0} + switchSmallIcons_2: {fileID: 0} + switchSmallIcons_3: {fileID: 0} + switchSmallIcons_4: {fileID: 0} + switchSmallIcons_5: {fileID: 0} + switchSmallIcons_6: {fileID: 0} + switchSmallIcons_7: {fileID: 0} + switchSmallIcons_8: {fileID: 0} + switchSmallIcons_9: {fileID: 0} + switchSmallIcons_10: {fileID: 0} + switchSmallIcons_11: {fileID: 0} + switchManualHTML: + switchAccessibleURLs: + switchLegalInformation: + switchMainThreadStackSize: 1048576 + switchPresenceGroupId: + switchLogoHandling: 0 + switchReleaseVersion: 0 + switchDisplayVersion: 1.0.0 + switchStartupUserAccount: 0 + switchTouchScreenUsage: 0 + switchSupportedLanguagesMask: 0 + switchLogoType: 0 + switchApplicationErrorCodeCategory: + switchUserAccountSaveDataSize: 0 + switchUserAccountSaveDataJournalSize: 0 + switchApplicationAttribute: 0 + switchCardSpecSize: -1 + switchCardSpecClock: -1 + switchRatingsMask: 0 + switchRatingsInt_0: 0 + switchRatingsInt_1: 0 + switchRatingsInt_2: 0 + switchRatingsInt_3: 0 + switchRatingsInt_4: 0 + switchRatingsInt_5: 0 + switchRatingsInt_6: 0 + switchRatingsInt_7: 0 + switchRatingsInt_8: 0 + switchRatingsInt_9: 0 + switchRatingsInt_10: 0 + switchRatingsInt_11: 0 + switchLocalCommunicationIds_0: + switchLocalCommunicationIds_1: + switchLocalCommunicationIds_2: + switchLocalCommunicationIds_3: + switchLocalCommunicationIds_4: + switchLocalCommunicationIds_5: + switchLocalCommunicationIds_6: + switchLocalCommunicationIds_7: + switchParentalControl: 0 + switchAllowsScreenshot: 1 + switchDataLossConfirmation: 0 + switchSupportedNpadStyles: 3 + switchSocketConfigEnabled: 0 + switchTcpInitialSendBufferSize: 32 + switchTcpInitialReceiveBufferSize: 64 + switchTcpAutoSendBufferSizeMax: 256 + switchTcpAutoReceiveBufferSizeMax: 256 + switchUdpSendBufferSize: 9 + switchUdpReceiveBufferSize: 42 + switchSocketBufferEfficiency: 4 + switchSocketInitializeEnabled: 1 + switchNetworkInterfaceManagerInitializeEnabled: 1 + switchPlayerConnectionEnabled: 1 + ps4NPAgeRating: 12 + ps4NPTitleSecret: + ps4NPTrophyPackPath: + ps4ParentalLevel: 11 + ps4ContentID: ED1633-NPXX51362_00-0000000000000000 + ps4Category: 0 + ps4MasterVersion: 01.00 + ps4AppVersion: 01.00 + ps4AppType: 0 + ps4ParamSfxPath: + ps4VideoOutPixelFormat: 0 + ps4VideoOutInitialWidth: 1920 + ps4VideoOutBaseModeInitialWidth: 1920 + ps4VideoOutReprojectionRate: 120 + ps4PronunciationXMLPath: + ps4PronunciationSIGPath: + ps4BackgroundImagePath: + ps4StartupImagePath: + ps4SaveDataImagePath: + ps4SdkOverride: + ps4BGMPath: + ps4ShareFilePath: + ps4ShareOverlayImagePath: + ps4PrivacyGuardImagePath: + ps4NPtitleDatPath: + ps4RemotePlayKeyAssignment: -1 + ps4RemotePlayKeyMappingDir: + ps4PlayTogetherPlayerCount: 0 + ps4EnterButtonAssignment: 1 + ps4ApplicationParam1: 0 + ps4ApplicationParam2: 0 + ps4ApplicationParam3: 0 + ps4ApplicationParam4: 0 + ps4DownloadDataSize: 0 + ps4GarlicHeapSize: 2048 + ps4ProGarlicHeapSize: 2560 + ps4Passcode: frAQBc8Wsa1xVPfvJcrgRYwTiizs2trQ + ps4UseDebugIl2cppLibs: 0 + ps4pnSessions: 1 + ps4pnPresence: 1 + ps4pnFriends: 1 + ps4pnGameCustomData: 1 + playerPrefsSupport: 0 + restrictedAudioUsageRights: 0 + ps4UseResolutionFallback: 0 + ps4ReprojectionSupport: 0 + ps4UseAudio3dBackend: 0 + ps4SocialScreenEnabled: 0 + ps4ScriptOptimizationLevel: 3 + ps4Audio3dVirtualSpeakerCount: 14 + ps4attribCpuUsage: 0 + ps4PatchPkgPath: + ps4PatchLatestPkgPath: + ps4PatchChangeinfoPath: + ps4PatchDayOne: 0 + ps4attribUserManagement: 0 + ps4attribMoveSupport: 0 + ps4attrib3DSupport: 0 + ps4attribShareSupport: 0 + ps4attribExclusiveVR: 0 + ps4disableAutoHideSplash: 0 + ps4videoRecordingFeaturesUsed: 0 + ps4contentSearchFeaturesUsed: 0 + ps4attribEyeToEyeDistanceSettingVR: 0 + ps4IncludedModules: [] + monoEnv: + psp2Splashimage: {fileID: 0} + psp2NPTrophyPackPath: + psp2NPSupportGBMorGJP: 0 + psp2NPAgeRating: 12 + psp2NPTitleDatPath: + psp2NPCommsID: + psp2NPCommunicationsID: + psp2NPCommsPassphrase: + psp2NPCommsSig: + psp2ParamSfxPath: + psp2ManualPath: + psp2LiveAreaGatePath: + psp2LiveAreaBackroundPath: + psp2LiveAreaPath: + psp2LiveAreaTrialPath: + psp2PatchChangeInfoPath: + psp2PatchOriginalPackage: + psp2PackagePassword: F69AzBlax3CF3EDNhm3soLBPh71Yexui + psp2KeystoneFile: + psp2MemoryExpansionMode: 0 + psp2DRMType: 0 + psp2StorageType: 0 + psp2MediaCapacity: 0 + psp2DLCConfigPath: + psp2ThumbnailPath: + psp2BackgroundPath: + psp2SoundPath: + psp2TrophyCommId: + psp2TrophyPackagePath: + psp2PackagedResourcesPath: + psp2SaveDataQuota: 10240 + psp2ParentalLevel: 1 + psp2ShortTitle: Not Set + psp2ContentID: IV0000-ABCD12345_00-0123456789ABCDEF + psp2Category: 0 + psp2MasterVersion: 01.00 + psp2AppVersion: 01.00 + psp2TVBootMode: 0 + psp2EnterButtonAssignment: 2 + psp2TVDisableEmu: 0 + psp2AllowTwitterDialog: 1 + psp2Upgradable: 0 + psp2HealthWarning: 0 + psp2UseLibLocation: 0 + psp2InfoBarOnStartup: 0 + psp2InfoBarColor: 0 + psp2UseDebugIl2cppLibs: 0 + psmSplashimage: {fileID: 0} + splashScreenBackgroundSourceLandscape: {fileID: 0} + splashScreenBackgroundSourcePortrait: {fileID: 0} + spritePackerPolicy: + webGLMemorySize: 256 + webGLExceptionSupport: 1 + webGLNameFilesAsHashes: 0 + webGLDataCaching: 0 + webGLDebugSymbols: 0 + webGLEmscriptenArgs: + webGLModulesDirectory: + webGLTemplate: APPLICATION:Default + webGLAnalyzeBuildSize: 0 + webGLUseEmbeddedResources: 0 + webGLUseWasm: 0 + webGLCompressionFormat: 1 + scriptingDefineSymbols: + 1: H3VR_IMPORTED + platformArchitecture: {} + scriptingBackend: {} + incrementalIl2cppBuild: {} + additionalIl2CppArgs: + apiCompatibilityLevelPerPlatform: {} + m_RenderingPath: 1 + m_MobileRenderingPath: 1 + metroPackageName: MeatKit + metroPackageVersion: + metroCertificatePath: + metroCertificatePassword: + metroCertificateSubject: + metroCertificateIssuer: + metroCertificateNotAfter: 0000000000000000 + metroApplicationDescription: MeatKit + wsaImages: {} + metroTileShortName: + metroCommandLineArgsFile: + metroTileShowName: 0 + metroMediumTileShowName: 0 + metroLargeTileShowName: 0 + metroWideTileShowName: 0 + metroDefaultTileSize: 1 + metroTileForegroundText: 2 + metroTileBackgroundColor: {r: 0.13333334, g: 0.17254902, b: 0.21568628, a: 0} + metroSplashScreenBackgroundColor: {r: 0.12941177, g: 0.17254902, b: 0.21568628, + a: 1} + metroSplashScreenUseBackgroundColor: 0 + platformCapabilities: {} + metroFTAName: + metroFTAFileTypes: [] + metroProtocolName: + metroCompilationOverrides: 1 + tizenProductDescription: + tizenProductURL: + tizenSigningProfileName: + tizenGPSPermissions: 0 + tizenMicrophonePermissions: 0 + tizenDeploymentTarget: + tizenDeploymentTargetType: -1 + tizenMinOSVersion: 1 + n3dsUseExtSaveData: 0 + n3dsCompressStaticMem: 1 + n3dsExtSaveDataNumber: 0x12345 + n3dsStackSize: 131072 + n3dsTargetPlatform: 2 + n3dsRegion: 7 + n3dsMediaSize: 0 + n3dsLogoStyle: 3 + n3dsTitle: GameName + n3dsProductCode: + n3dsApplicationId: 0xFF3FF + stvDeviceAddress: + stvProductDescription: + stvProductAuthor: + stvProductAuthorEmail: + stvProductLink: + stvProductCategory: 0 + XboxOneProductId: + XboxOneUpdateKey: + XboxOneSandboxId: + XboxOneContentId: + XboxOneTitleId: + XboxOneSCId: + XboxOneGameOsOverridePath: + XboxOnePackagingOverridePath: + XboxOneAppManifestOverridePath: + XboxOnePackageEncryption: 0 + XboxOnePackageUpdateGranularity: 2 + XboxOneDescription: + XboxOneLanguage: + - enus + XboxOneCapability: [] + XboxOneGameRating: {} + XboxOneIsContentPackage: 0 + XboxOneEnableGPUVariability: 0 + XboxOneSockets: {} + XboxOneSplashScreen: {fileID: 0} + XboxOneAllowedProductIds: [] + XboxOnePersistentLocalStorageSize: 0 + xboxOneScriptCompiler: 0 + vrEditorSettings: + daydream: + daydreamIconForeground: {fileID: 0} + daydreamIconBackground: {fileID: 0} + cloudServicesEnabled: {} + facebookSdkVersion: 7.9.1 + apiCompatibilityLevel: 2 + cloudProjectId: + projectName: + organizationId: + cloudEnabled: 0 + enableNewInputSystem: 0 diff --git a/ProjectSettings/ProjectVersion.txt b/ProjectSettings/ProjectVersion.txt new file mode 100644 index 0000000..cec5751 --- /dev/null +++ b/ProjectSettings/ProjectVersion.txt @@ -0,0 +1 @@ +m_EditorVersion: 5.6.3p4 diff --git a/ProjectSettings/QualitySettings.asset b/ProjectSettings/QualitySettings.asset new file mode 100644 index 0000000..3c4c5fd --- /dev/null +++ b/ProjectSettings/QualitySettings.asset @@ -0,0 +1,207 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!47 &1 +QualitySettings: + m_ObjectHideFlags: 0 + serializedVersion: 5 + m_CurrentQuality: 6 + m_QualitySettings: + - serializedVersion: 2 + name: Ultra + pixelLightCount: 4 + shadows: 2 + shadowResolution: 2 + shadowProjection: 1 + shadowCascades: 4 + shadowDistance: 320 + shadowNearPlaneOffset: 2 + shadowCascade2Split: 0.33333334 + shadowCascade4Split: {x: 0.015800854, y: 0.17402595, z: 0.42445904} + blendWeights: 4 + textureQuality: 0 + anisotropicTextures: 2 + antiAliasing: 4 + softParticles: 1 + softVegetation: 1 + realtimeReflectionProbes: 1 + billboardsFaceCameraPosition: 1 + vSyncCount: 1 + lodBias: 1 + maximumLODLevel: 0 + particleRaycastBudget: 4096 + asyncUploadTimeSlice: 1 + asyncUploadBufferSize: 49 + excludedTargetPlatforms: [] + - serializedVersion: 2 + name: High + pixelLightCount: 4 + shadows: 2 + shadowResolution: 2 + shadowProjection: 1 + shadowCascades: 2 + shadowDistance: 160 + shadowNearPlaneOffset: 2 + shadowCascade2Split: 0.07471262 + shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} + blendWeights: 4 + textureQuality: 0 + anisotropicTextures: 2 + antiAliasing: 4 + softParticles: 1 + softVegetation: 1 + realtimeReflectionProbes: 1 + billboardsFaceCameraPosition: 1 + vSyncCount: 1 + lodBias: 1 + maximumLODLevel: 0 + particleRaycastBudget: 4096 + asyncUploadTimeSlice: 1 + asyncUploadBufferSize: 49 + excludedTargetPlatforms: [] + - serializedVersion: 2 + name: Medium + pixelLightCount: 4 + shadows: 2 + shadowResolution: 2 + shadowProjection: 1 + shadowCascades: 1 + shadowDistance: 80 + shadowNearPlaneOffset: 2 + shadowCascade2Split: 0.33333334 + shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} + blendWeights: 4 + textureQuality: 0 + anisotropicTextures: 2 + antiAliasing: 2 + softParticles: 0 + softVegetation: 1 + realtimeReflectionProbes: 0 + billboardsFaceCameraPosition: 1 + vSyncCount: 1 + lodBias: 1 + maximumLODLevel: 0 + particleRaycastBudget: 2048 + asyncUploadTimeSlice: 1 + asyncUploadBufferSize: 49 + excludedTargetPlatforms: [] + - serializedVersion: 2 + name: Low + pixelLightCount: 3 + shadows: 0 + shadowResolution: 0 + shadowProjection: 1 + shadowCascades: 1 + shadowDistance: 0 + shadowNearPlaneOffset: 2 + shadowCascade2Split: 0.33333334 + shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} + blendWeights: 4 + textureQuality: 0 + anisotropicTextures: 1 + antiAliasing: 0 + softParticles: 1 + softVegetation: 1 + realtimeReflectionProbes: 1 + billboardsFaceCameraPosition: 1 + vSyncCount: 1 + lodBias: 1 + maximumLODLevel: 0 + particleRaycastBudget: 1024 + asyncUploadTimeSlice: 1 + asyncUploadBufferSize: 49 + excludedTargetPlatforms: [] + - serializedVersion: 2 + name: Potato + pixelLightCount: 1 + shadows: 0 + shadowResolution: 0 + shadowProjection: 1 + shadowCascades: 1 + shadowDistance: 0 + shadowNearPlaneOffset: 2 + shadowCascade2Split: 0.33333334 + shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} + blendWeights: 2 + textureQuality: 0 + anisotropicTextures: 0 + antiAliasing: 0 + softParticles: 0 + softVegetation: 1 + realtimeReflectionProbes: 0 + billboardsFaceCameraPosition: 0 + vSyncCount: 1 + lodBias: 1 + maximumLODLevel: 0 + particleRaycastBudget: 512 + asyncUploadTimeSlice: 1 + asyncUploadBufferSize: 49 + excludedTargetPlatforms: [] + - serializedVersion: 2 + name: TurboPotato + pixelLightCount: 1 + shadows: 0 + shadowResolution: 0 + shadowProjection: 1 + shadowCascades: 1 + shadowDistance: 0 + shadowNearPlaneOffset: 2 + shadowCascade2Split: 0.33333334 + shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} + blendWeights: 4 + textureQuality: 0 + anisotropicTextures: 0 + antiAliasing: 0 + softParticles: 0 + softVegetation: 1 + realtimeReflectionProbes: 0 + billboardsFaceCameraPosition: 1 + vSyncCount: 1 + lodBias: 0.7 + maximumLODLevel: 0 + particleRaycastBudget: 512 + asyncUploadTimeSlice: 1 + asyncUploadBufferSize: 49 + excludedTargetPlatforms: [] + - serializedVersion: 2 + name: Custom + pixelLightCount: 2 + shadows: 0 + shadowResolution: 0 + shadowProjection: 1 + shadowCascades: 1 + shadowDistance: 40 + shadowNearPlaneOffset: 2 + shadowCascade2Split: 0.33333334 + shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} + blendWeights: 4 + textureQuality: 0 + anisotropicTextures: 0 + antiAliasing: 0 + softParticles: 0 + softVegetation: 1 + realtimeReflectionProbes: 0 + billboardsFaceCameraPosition: 1 + vSyncCount: 1 + lodBias: 1 + maximumLODLevel: 0 + particleRaycastBudget: 512 + asyncUploadTimeSlice: 1 + asyncUploadBufferSize: 49 + excludedTargetPlatforms: [] + m_PerPlatformDefaultQuality: + Android: 0 + Nintendo 3DS: 0 + PS4: 0 + PSM: 0 + PSP2: 0 + Samsung TV: 0 + Standalone: 4 + Switch: 0 + Tizen: 0 + Web: 0 + WebGL: 0 + WiiU: 0 + Windows Store Apps: 0 + XboxOne: 0 + iPhone: 0 + tvOS: 0 diff --git a/ProjectSettings/TagManager.asset b/ProjectSettings/TagManager.asset new file mode 100644 index 0000000..033924b --- /dev/null +++ b/ProjectSettings/TagManager.asset @@ -0,0 +1,86 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!78 &1 +TagManager: + serializedVersion: 2 + tags: + - Matchbox + - Burning + - MaskedTarget + - QuickbeltSlot + - Harmless + - FVRFireArmChamber + - FVRFireArmReloadTriggerWell + - FVRFireArmReloadTriggerMag + - FVRFireArmMagazineReloadTrigger + - Pickup + - GunPortationTarget + - FVRFireArmAttachmentMount + - IFFTeam1 + - IFFTeam2 + - IFFTeam3 + - IFFTeam4 + - FxTemporaire + - FVRFireArmRound + - NoTeleport + - OptionsPanelButton + - ESlabSlot + - ESlabDisc + - HorseshoePost + - wwHatReturn + - KeyDetectTrigger + - FVRFireArmClipReloadTriggerWell + - FVRFireArmClipReloadTriggerClip + - Agent + - PlayerHand + - explosion + - IgnitorSystem + - LighterFluid + - projectile + - noOcclude + - flintlock_shot + - flintlock_paper + - flintlock_wadding + - flintlock_powdergrain + - flintlock_ramrod + - flintlock_flint + - GronchTarget + - FillMe + - RawGrab + layers: + - Default + - TransparentFX + - Ignore Raycast + - + - Water + - UI + - + - + - NoCol + - HandTrigger + - Interactable + - NoSelfCol + - NavBlock + - AgentMeleeWeapon + - NonBlockingSmoke + - PlayerHead + - ColOnlyHead + - TurnMeIntoSomethingElse2 + - ThermalContact + - Environment + - AgentBody + - TeleValid + - LightExclusion + - PlayerAndRBTrigger + - Smoke + - AIEntity + - + - + - ExternalCamOnly + - Distant + - Burning + - Flammable + m_SortingLayers: + - name: Default + uniqueID: 0 + locked: 0 diff --git a/ProjectSettings/TimeManager.asset b/ProjectSettings/TimeManager.asset new file mode 100644 index 0000000..2706b46 --- /dev/null +++ b/ProjectSettings/TimeManager.asset @@ -0,0 +1,9 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!5 &1 +TimeManager: + m_ObjectHideFlags: 0 + Fixed Timestep: 0.01111111 + Maximum Allowed Timestep: 0.02222222 + m_TimeScale: 1 + Maximum Particle Timestep: 0.03 diff --git a/ProjectSettings/UnityConnectSettings.asset b/ProjectSettings/UnityConnectSettings.asset new file mode 100644 index 0000000..ec1ab29 --- /dev/null +++ b/ProjectSettings/UnityConnectSettings.asset @@ -0,0 +1,32 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!310 &1 +UnityConnectSettings: + m_ObjectHideFlags: 0 + m_Enabled: 0 + m_TestMode: 0 + m_TestEventUrl: + m_TestConfigUrl: + m_TestInitMode: 0 + CrashReportingSettings: + m_EventUrl: https://perf-events.cloud.unity3d.com/api/events/crashes + m_Enabled: 0 + m_CaptureEditorExceptions: 1 + UnityPurchasingSettings: + m_Enabled: 0 + m_TestMode: 0 + UnityAnalyticsSettings: + m_Enabled: 0 + m_InitializeOnStartup: 1 + m_TestMode: 0 + m_TestEventUrl: + m_TestConfigUrl: + UnityAdsSettings: + m_Enabled: 0 + m_InitializeOnStartup: 1 + m_TestMode: 0 + m_EnabledPlatforms: 4294967295 + m_IosGameId: + m_AndroidGameId: + PerformanceReportingSettings: + m_Enabled: 0 diff --git a/README.md b/README.md new file mode 100644 index 0000000..9c5932f --- /dev/null +++ b/README.md @@ -0,0 +1,10 @@ +# TNH Quality of Life Improvements +A *Hot Dogs, Horseshoes, and Hand Grenades* mod that adds quality of life improvements to the *Take and Hold* experience. + +## Features +* More visible HP counter +* Token and hold counter on wrist +* Player count for online leaderboards + * Incompatiible with TNHTweaker + +Enable/disable these features in your mod manager's *Config editor*. \ No newline at end of file