diff --git a/RealToon/RealToon.meta b/RealToon/RealToon.meta new file mode 100644 index 0000000..d5b62a0 --- /dev/null +++ b/RealToon/RealToon.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6c2ff81700b1b294b869bf24ec0e960d +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/RealToon/RealToon/Change - Fix Log.txt b/RealToon/RealToon/Change - Fix Log.txt new file mode 100644 index 0000000..32e2e9e --- /dev/null +++ b/RealToon/RealToon/Change - Fix Log.txt @@ -0,0 +1,1431 @@ +========================================== +Realtoon (Change - Fix Log) +========================================== +v1.0 (2016): + +- Initial Release + + + + + +========================================== +v1.0.1 (2016): + +- New "Fresnel effect". +- New control/function "Reduce White". +- You can now enable/disable light falloff of a spotlight or pointlight. +- Added 2 example scenes. +- "FReflection Scale" is removed and changed it to Unity3d's "Tiling - Offset" to control the size. +- All sliders are now 0 to 1..... values. +- Some controls are renamed/corrected. + + + + + +========================================== +v1.0.2 (2016): + +- Added "No Outline" (If you're not using the outline and want less draw calls). +- New "Fade Transparency" (For smooth & fade transparency). +- Added "Tutorials" pdf (Tutorials and tips on how to use realtoon, using the shader with receive shadows turned on and more). +- Added 1 example scene. +- Folder "RealToon Shader" renamed to "RealToon Shaders". +- Default color changed to gray. +- Updated example scene number 8. +- Updated "Read Me First" pdf file. + +========================================== +End of Version 1 +========================================== + + + + + +========================================== +Start of Version 2 +========================================== +V2.0.0 (2017) + +- New Multi & Single Light Mode. +- New Cutout. +- New Double Sided. +- New Self Shadow PTexture feature. +- New AO (Texture) +- New Outline Noise +- New added controls "Fresnel Hard edge, Fresnel Fill, Fresnel on Light/Shadow, +Main Texture Color Self Shadow & Self Shadow at View Direction". +- All new Examples. +- Read me first is now changed to User Guide and its all new. +- Some controls are rearranged and renamed. +- You can now change Receive Shadows color. +- Each version shader will have its own folder like "Version2, Version3, etc.". +- Tutorials PDF removed just for now. + +(Read "User Guide" for more info about the new controls and new features) + + + + + +========================================== +V2.0.1 (Feb 2017) + +*New - Gloss* +- Gloss (Texture) - Custom Gloss. +- Main Texture Color Gloss - Now you can use main texture color to color the gloss +just like Self Shadow/Shadows & AO. + +*New - Color Adjustment* +- Texture Washout - Adding washout effect. + +*New - Outline* +- Dynamic Noise Outline - You can now disable - enable moving distort/noisy outline. + +*Changed - Fixed - Added* +- FReflection default size changed to texture size. +- User Guide PDF - Added some page and info. +- Added one new example scene. + +(Read "User Guide" for more info about the new controls and new features) + + + + + +========================================== +V2.0.2 (Jun 2017) + +[New] + +- "Refraction Shader" - a new realtoon shader for anime/cartoon style glass, liquid, ice etc.. +- "Texture Pattern Style" - Make the Main Texture to Pattern Style. +- "Main Texture Color SS/S (Mix Shadow Color)" - Mix "Main Texture Color Self Shadow/Shadow" and "Shadow/Self Shadow" color. +- "Main Texture Color SS/S (Saturation)" - Adjust the "Main Texture Color Self Shadow/Shadow" color intensity/saturation. +- "FReflection Texture Blend" - Blends "FReflection" to Main Texture, Gloss, AO, Self Lit & Fresnel. + + +[Changed - Fixed - Added - Others] + +- FReflection is now support texture/image with alpha/transparent. +- FReflection is much better now than the previous one. +- Fresnel On Light & Fresnel On Self Shadow/Shadow now needs to be enabled to show Fresnel on both light & shadow area of the object. +- Fresnel Visible On Dark/Ambient Light is changed to Experimental and might be remove or change its function/name soon. +- Fix and updated User Guide PDF. +- Added one new example scene for Refraction & Texture Pattern Style. +- You can now try to use this shader in your Xbox One, PS 4 and PS Vita game project. + +(Read "User Guide" for more info about the new controls, new features and new notes & tips) + +========================================== +End of Version 2 +========================================== + + + + + +========================================== +Start of Version 3 +========================================== +V3.0.0 (Aug 2017) + +[New] + +- RealToon is now fully multi-light. +* No separate multi-light & single-light anymore. + +- ShadowT - Texture based shadow. + +[Changed - Fixed - Added - Others] +- Fresnel Visible On Dark/Ambient Light is not Experimental anymore. +- AO is removed. +- Revise and Update User Guide (PDF). +- Added one example scene for "ShadowT". + +Note: +(Previous version V2.0.2 is included as unity package.) +(Don't import this new RealToon V3 version into your unity project with realtoon V2.0.2 or below.) +(If you want to use both V2.0.2 & V3.0.0, Import v3.0.0 first then V2.0.2 .) +(Please see or read again User Guide (PDF) for more info about the changes and updates.) + +========================================== +V3.0.1 (Aug 2017) + +[Fixed] +- Fade Transparancy & Refraction lighting problem (Fixed) +- Gloss does not affected by point & spotlight light falloff even the color of the shadow color is black. (Fixed) + +Note: + +(Previous version V2.0.2 is included as unity package.) +(Don't import this new RealToon V3 version into your unity project with realtoon V2.0.2 or below.) +(If you want to use both V2.0.2 & V3.0.0, Import v3.0.0 first then V2.0.2 .) +(Please see or read again User Guide (PDF) for more info about the changes and updates.) + +========================================== +V3.0.2 (Jan 2018) + +New +- Self Shadow Only - Shadow settings control only self shadow, useful if Received Shadows turned off. +- Double Sided (On/Off) - No separate double sided shader anymore, you can just turn it on or off. +- GPU Instancing/Instancing Support. + +========================================== +End of Version 3 +========================================== + + + + + +========================================== +Start of Version 4 +========================================== +V4.0.0 (Jan 2018) + +[New] +- Can now receive GI Lighthing (with smooth or flat shade) & Sky lighting. +- Can now receive and do Baked/Real-Time Reflection. +- GPU Instancing/Instancing Support. +- Double Sided (On/Off) - No more separate double sided shader, you can just turn it on or off. + +[New Shadow settings featuring] + - Shadow Color Texture - Fully custom shadow color in texture form. + +[New Lighting settings] +*Controls GI lighting and Light-falloff. + +[New Reflection settings] +*Controls both Default Reflection & FReflection. + +[Gloss Texture - New Controls] +- Follow Object Rotation - Gloss Texture Follow Object Rotation. +- Follow Light - Gloss Texture Follow Light. +- Rotate - Rotate Gloss Texture. + +[Fixed, Changes & Others] +- Reduce White & Washout are removed. +- Point & Spotlight Light-Falloff problem is finally solved/fixed. +- You can now use both Point - Spotlight & Directional Light at the same time without problem. +- Previous Old Examples are removed. +- Old RealToon V2.0.2 & Updated RealToon V3.0.2 are included as Package. + +[Notes] +- Please see or read again User Guide (PDF) for more info about the changes and updates. +- Also read "[Notes & Tips]" on the User Guide. + + + + + +========================================== +V4.0.1 (Jan 2018) + +[Fixed] +- "Add Light" does not decrease when Directional Light Intensity is decreased. + +[Others - Changes] +- Affect Light (Directional Light Only) is removed. +*Because "Add light" problem in Directional Light is now fixed. + +- User Guide (PDF) revised and added some tips & links. + +[Notes] +- Please see or read again User Guide (PDF) for more info about the changes and updates. +- Read also "Change - Fix Log.txt" for previous updates/release notes and changes. + + + + + +========================================== +V4.0.2 (Feb 2018) + +[New] + +- RealToon Tessellation Version shader. + +{Outline (New Property/Control)} +- Outline Mode + +{Cutout (New Property/Control)} +- Secondary Cutout + +{Opacity (New Property/Control)} +- Mask Transparency + +{Self Lit (New Property/Control)} +- High Contrast + +{ShadowT (New Property/Control)} +- Light Falloff Affect ShadowT + +{Lighting (New Property/Control)} +- Directional Light Affect Shadow +*Use Directional Light as Ambient Light. + + +[Fixed - Changes - Others] + +- Improved "Self Lit". +- "Color" property changed is to "Main Color" to prevent sudden color change or conflict. +- User Guide (PDF) revised and added some tips & links. +- Can now be use in Unity3D 2018. + + +[Notes] +*Warning: "Color" property is changed to "Main Color" | Reason: To prevent sudden color change or conflict. +*This will revert object color "not texture" to default gray color if you import +this into your current project with realtoon v4.0.1, realtoon v4.0.0 or older realtoon versions. + +- Please see or read again User Guide (PDF) for more info about the new properties, changes and updates. +- Read also "Change - Fix Log.txt" for previous updates/release notes and changes. + + + + + +========================================== +V4.1.2 (March 2018) + +[New] + +- Sobel Outline Effect +- See Through (New Property/Control) + +[Fixed - Changes - Others] +- Added "See Through Example" scene. +- User Guide (PDF) revised and added some tips & links. +- Added "RealToon Update Rollback" shader package (A Rollback to previous version if the current version is not working properly to you.) + +[Notes] +- Please see or read again User Guide (PDF) for more info about the changes and updates. +- Read also "Change - Fix Log.txt" for previous updates/release notes and changes. + + + + + +========================================== +V4.0.3 (June 2018) + +[New] + +"Frame By Frame Rendering (Tool)" +- Frame by frame render to Image Sequence or PNG Sequence. +- For Animation & Illustration/Art Use. + +"Now supports Nintendo Switch." + +[Texture Color - New Options/Controls] + +- Vertex Colors Intensity + +[Shadow - New Options/Controls] +- Custom Light Direction +- Light Intensity Affect (OC - AL - CT - PT) (Directional Light) +- ShadowT Color +- Shadow PTexture Power + +[Outline - New Options/Controls] +- Outline Width Control (Texture) +- Outline Offset + +[Refraction Shader - New Options/Controls] +- Main Color Affect Texture +- Depth + +[Cutout Shader - New Options/Controls] +- Use Secondary Cutout Only + +[Fade Transparency Shader - New Options/Controls] +- Affect Shadow + +[Changes] +- Assets name changed from RealToon (PC/MAC & Mobile) to RealToon. +- "Outline Width" Changed from Silder to Value. +- "Outline Mode" has been removed. +- "Follow Light" changed from Silder to Value. +- "Saturation (Point & Spotlight) only affect main texture & color. +- "Self Lit High Contrast" changed default value to checked. + +[Fixed] +- "Mask Reflection" masking problem. +- Fade Transparency "Opacity" does not affect shadow. +- Point & Spotlight Overblown/Overexposure when using fog (Unity3D 2017 & below). + +[Others] +- Updated, revised & fixed "RealToon (User Guide).pdf" +- Added "What's New.txt" to know right away new features & options. + +[Note] +Warning to those who planned to update/download to this new version to your current project: +"There are options/control changes and you might need to re-set or set them again. Be sure you write/list all the necessary values/settings." + +(Read "RealToon (User Guide).pdf" for more info about the new controls, tools & tips) + +========================================== +End of Version 4 +========================================== + + + + + +========================================== +Start of Version 5 +========================================== +V5.0.0 (August 2018) + +[New] + +*"RealToon Lite Version (Shaders)" +- For mobile or games that only need low-end/lite features. + +*"Smooth Object Normal/Ignore Object Normal (Feature)" +- Smooth object normal for better smooth shade. + +*"Reduce Shadow (Feature)" +- Reduce Real-Time shadow of an object - material without affecting other parts of an object. + +*"Custom Shadow Resolution (Tool)" +- Custom shadow resolution for higher quality shadow. (Useful for Film/Animation & Illustration/Art) + +*"Outline Width Affected By View Distance (Feature)" + +*New GUI. +*Can now fully color the shadow and maintain light falloff. +*Can now fully use multiple lights and maintain object color and light exposure/brightness. +*Can now disable/enable features you want or don't want to use. + +[Improved] + +- PTexture & Texture Pattern Style scale by view distance. + +[Changed] + +- "Fresnel" changed to "Rim Light". +- "Override Color" changed to "Overall Shadow Color". +- "Cutout" merged to "Default" shader, means no more separate "Cutout" shader. +- "Self Shadow" & "Real-Time Shadow" are now combined. +- No more separate "No Outline" shaders, you can choose to disable/enable it. +- "Color Adjustment - Saturation" is temporarily removed but i might add it again in the next future updates. +- Some "Intensity" feature are removed because you can now disable/enable features. +- "Vertex Colors Intensity" is removed. +- "Shadow Mask Gloss Texture" removed, Gloss Texture now always masked by shadows. +- "Add Light", "Adjust Light (Point & Spotlight)", "Adjust Light (Directional Light)", "Saturation (Point & Spotlight)"" + And "Light Intensity Affect [OC - AL - CT - PT] (Directional Light)" + are now removed because you can now fully color shadow and maintain light falloff. + without using those features. +- Features with "Size" word are changed to "Threshold". +- "Enable Light Falloff" is removed and replace with "Light Falloff Softness". +- ShadowT "On light" & "On Self Shadow" is remove, ShadowT now always visible in light. +- "Use GI Lighting" is removed, GI is now always used. +- "RealToon Old Version Package" is removed. +- "RealToon Rollback Update" is removed. + +(Please Read "RealToon (User Guide).pdf" again for more info about the new features/changes.) + + + + + +========================================== +V5.0.1 (November 2018) + +[New] + +- Fade Transparency with Outline. +- Reduce Outline Backface (Fade Transparency) [New Option/Feature] +- Self Shadow Affected By Light Strength [New Option/Feature] +- Environmental Lighthing Intensity [New Option/Feature] + +- Light Affect Shadow [New Option/Feature] +- Light Intensity [New Option/Feature] + +- Show In Shadow (ShadowT) [New Option/Feature] +- Show In Ambient Light (ShadowT) [New Option/Feature] +- Show In Ambient Light Intensity (ShadowT) [New Option/Feature] +- Show In Ambient Light & Shadow Threshold (ShadowT) [New Option/Feature] + +- ShadowT Intensity [Re-added Option/Feature] +- Gloss Intensity [Re-added Option/Feature] +- Self Shadow Intensity [Re-added Option/Feature] +- Saturation [Re-added Option/Feature] + +- Hide Directional Light Shadow [New Option/Feature] + +[Others] + +- Can now be use in 2D games. +- Foldout state are now remembered. +- Fade Transparency can now affect shadow. +- Added some new info [RealToon (User Guide).pdf] + +[Changes] + +- "Self Shadow Threshold" value is changed and the default value is now 0.85. +- "Directional Light Affect Shadow" is changed to "Light Affect Shadow". +- "_Texture" property is changed to "_MainTex", this also affect lite version. +- "PTexture Power" default value changed to 1. +- "Reduce Shadow (Spot & Directional Light)" default value changed to 10. + +[Fixed] + +- Object looks transparent when using AO (Ambient Occlusion FX). +- Directional Light Cookie is not working. +- Rim Light is flickering when using DX9 and softness set to 0. + +[Note] +(To those who planned to update to this version to your current project.) +*There are some changes, be sure you backup or list down "Self Shadow Threshold", "Texture" & "Directional Light Affect Shadow" values. +*It's better to test this version to a new project file or test project first. + +(Read "RealToon (User Guide).pdf" for more info) + + + + + +========================================== +V5.1.1 (December 2018) + +[Fixed] + +- Fade Transparency error when Fog is enabled. + +[Others] + +- Added Fade Transparency with outline example. + + + + + +========================================== +V5.2.1 (December 2018) + +[New] + +- Outline Extrude Method [Re-added Option/Feature] + + + + + +========================================== +(V5.3.1) (January 2019) + + +[Fixed] + +- See Through option is not working when Outline is enabled. + + + + + +========================================== +(V5.0.2) (February 2019) + +[New] + +- Shadow Hardness [New Option/Feature] +- Hide Cast Shadow (Fade Transparency) [New Option/Feature] +- Double Sided Outline [New Option/Feature] +- Outline Z Position in Camera [New Option/Feature] + +[Other New] + +- Fog Affect Outline. + +[Fixed] + +- Default "Fade Transparency" fixed transparent shadow problem. +- "Cutout" doesn't affect outline. + +[Changes] +- "Outline" can be set to negative values. +- GUI/UI changed a bit to fix inspector width problem. +- "Outline Offset Enable" is removed and "Outline Offset" function has been changed. + + + + + +========================================== +(V5.1.2) (February 2019) + +[New] + +- Metallic (Reflection) [New Option/Feature] + +- RealToon LWRP [Included as package to unpack or import] + (Unity 2018 with LWRP V4.0.0 or latest) + +[Changes] + +- "ShadowT Light Threshold" default value changed to 50 and its precision to 0.01. + +(To convert your "ShadowT Light Threshold" current value, just multiply your "ShadowT Light Threshold" current value by 100" if you updated your current work/project to this version and if you are using "ShadowT".) + + + + + +========================================== +(V5.2.2) (March 2019) + +[New] + +- Directional Light Intensity [New Option/Feature] +- No Light and Shadow On Backface [New Option/Feature] +- Far Distance Max Width [New Option/Feature] [For Outline Width Affected By View Distance] + +[Other New] +- Video Tutorials [Button] +* To access "Video Tutorials" right away. + +- Added support "GLES 2.0". + +[Fixed] + +- Fix GPU instancing "Outline" [LWRP Version] +- "PTexture" is not working. [Lite Version - Default] +- Normal is visible/showing when there is pointlight + GI. [LWRP Version] +- Disable/Enable "Outline" option not working properly + when doing Multi Material/Selected Material Editing. [Both Standard and LWRP Version] +- On/Off "Disable Cast Shadow" option not working properly + when doing Multi Material/Selected Material Editing. [LWRP Version] +- Shadow is still visible even if "Double Sided" is off. [LWRP Version] +- Fixed and added some new notes and tips on "RealToon User Guide.pdf" at page 22. + +[Changes] + +- "Show In Ambient Light Intensity" changed to "Show In Ambient Light Shadow Intensity". +*Both "Show In Ambient Light" & "Show In Shadow" intensity can be adjust. + +- Light blend changed back to old or traditional light blend. [Lite version] +*So the shader can also be use on older mobile device. + +- "ZWrite" default value changed to Off. [Fade Transparency & Refraction]. + +[Improvents] + +- Improve "GI Flat Shade". +- Removed unnecessary duplicate lines. [LWRP Version] + + + + + +========================================== +(V5.0.3) (May 2019) + +[New] + +- Transparent Threshold. [New Option/Feature] [For Fade Transparency] +- Use Traditonal Light Blend. [New Option/Feature] [For LWRP Version] + +[Other New] + +- Added "RealToon (UserGuide).pdf" button. +*So you can access the file right away. + +- Added "Show/Hide UI". +*If you want to hide options/properties UI. + +- Can disable/enable Normal Map. + +[Improvements] + +- "Outline Z Position In Camera" precision has been improved. + +[Fixed] + +- DX11, GLCORE, GLES 3.0 and Vulkan compilation error. +- Point and Spotlight light falloff not working when on GLCore and GLES. +- "Light Affect Shadow" option doesn't affect ShadowT. +- "Outline Z Position In Camera" becomes negative value when on GLCore and GLES. +- Shadow disappear when using Cutout or enabled "Enable Texture Transparent" on Unity 2017 to Unity 2019. + +[Changes] + +- "Highlight Color" & "Highlight Power" moved to "Texture - Color" category. +- "Self Shadow & Realtime Shadow Intensity" moved outside "Self Shadow" category. + +- All color picker changed to HDR color picker for more color control. +*You might need to adjust your color a-bit if you update to this 5.0.3 version. + +- You can now disable/enable Normal Map, the default state/value is off, +*You might need to re-enable this if you update to this 5.0.3 version. + +- "Outline Z Position In Camera" precision has been changed and improved. + +- Normal Map intensity default value changed to 1. +- "Point and Spotlight intensity" default value changed to 0. +- "No Light and Shadow On BackFace" default value changed to off. +- "Reduce Shadow (Directional Light)" default value changed 0.5. [LWRP Version] + + +[Note] + +(To those who planned to update to this version to your current project) + +* You might need to enable "Normal Map" if you use this option/feature. +* All color picker changed to HDR color picker, you might need to adjust a-bit the color of your character or object uses RealToon. +* "Outline Z Position In Camera" precision has been changed you might need to adjust it again. +* Test this first in a new project before update. +* Always make a backup of your current realtoon shader and your current project also before update. + + +(To those who have custom/modified realtoon shader on your current project). + +*Don't update it might overwrite it. +*Only update if you make another project. + + + + + +========================================== +(V5.0.4) (September 2019) + +[New] + +- "MatCap" [New Feature] [All RealToon Shader] + +- "Mix Vertex Color" [New Option/Feature] [For Default & Fade Transparency] +*To show vertex color or mix vertex color on main texture and color. + +- "Mix Main Texture To Outline" [New Option/Feature][For Outline] + +- "Ignore Light" [New Option/Feature] [For ShadowT] +*When you want ShadowT to not moving with the light. + +- "Main Color In Ambient Light Only" [New Option/Feature] [For Default & Fade Transparency] +*This is useful when doing dual shading/multi shading. + +- "Pointlight Shadow Visibility Distance" [New Option/Feature] +*To adjust the pointlight shadow visibility. +*When you move the pointlight away from the object the shadows will disappear, +To prevent that adjust this option. + +- RealToon URP version (For Unity 2019.3.0 to later) + +[Improvements] + +- Codes/lines are re-written, re-arranged and optimized especially the RealToon lite. +- Disable/Enable feature keywords are now moved to local. [Unity 2019 to later] + +[Changes] + +- SRP packages are moved to "RealToon SRP". +- RealToon SRP GUI editor script renamed to "RealToonShaderGUI_LWRP_SRP" and "RealToonShaderGUI_URP_SRP". + "Use FReflection" is removed so once you enabled "FReflection" it will be use right away. +- Main Color default value changed to RGB 0.6886792 or RGB 176 to prevent initial light overexposure. +- "Point and Spot light intensity" default value changed from 0 to 0.45 because the Main Color default value is changed. +- RealToon Lite version "Point and Spot light intensity" default value changed from 0 to 0.1. +- Fixed and added some new info on “RealToon (User Guide).pdf” + +[Fixed] + +- One GLES compile error. +- One Fade Transparency shader error (LWRP). + +========================================== +(V5.0.5) (September 2019) + +[Fixed] + +- RealToon Default compile errors. (URP) +- No spotlight shadow. (URP) + +[Improvements] + +- Improved "Enable/Disable Features". + +(For those who use URP, after you update to this version, update your URP package to 7.1.1) + + + + + +========================================== +(V5.0.6) (March 2020) +========================================== +This update supports Unity 5, 2017, 2018, 2019, 2020 and future unity versions. + +[New] + +- Receive Environmental Lighting and GI [New Option/Feature] [All RealToon Shaders] +*Turn off or on Ambient Light or Environmental Lighting and GI. + +- Pattern Style [New Option/Feature] +*New option for 'Gloss Texture'. +*This will turn 'Gloss Texture' into pattern style. + +- Specular Mode [New Option/Feature] +*New option for 'MatCap'. +*This will turn 'MatCap' into specular mode. + +- Texture and Main Color Intensity [New Option/Feature] +*New option for 'SelfLit'. +*This will adjust 'Texture and Main Color' intensity. +*This is useful if these two are too strong or too bright for 'SelfLit'. + +- Automatic Remove Unused Shader Keywords [New Option/Feature]` +* This will remove unused shader keywords. +* This can also fix keywords error problem. +* Warning: This will also remove previous shaders stored shader keywords, +Only enable this if you don't planned to reuse or change back to previous shaders you used. + +- ToolTip [New Feature] +*ToolTip for all options. +*For quick option description. + +- Automatic convert color properties into Linear when you switch your project into Linear color space. + +[Fixed] + +- Keywords error problem. +- "Implicit truncation of vector type". (LWRP/URP Only) +- "Vertex Color Green Control Self Shadow Threshold" option is not working. +- "Use Traditional Light Blend" option is not working. (URP and LWRP Only) +- "RealToon Default" Shaders goes pink when the object is in static and using ShadowMask. +- Some other errors that turned the object to pink. +- Shadow cascades glitch or weird shadow distort lines. (URP 7.2.0 to latest version) + +[Changed] + +- 'See Through' functions has been changed and improved. + +[Improved] + +- Fixed and added some new info in “RealToon (User Guide).pdf” + + + +NOTE: To those who planned to update to this version to your current project: + +- You need to disable and enable again the new option "Receive Environmental Lighting and GI", +that option is under the "Lighting" category. + +- If your current project is in Linear color space, RealToon color properties +will be automatically converted to that color space. + + + + + +========================================== +(V5.0.7) (May 2020) +========================================== +This update supports Unity 5, 2017, 2018, 2019, 2020 and future unity versions. + + + +**(Main Update)** + +[New] + +- RealToon HDRP Version. +- Adding instructions for Unpacking/Importing SRP's. + +[Fixed] + +- "See Through" feature stencil problem. (VR Chat) +*For VRChat users, set A and B to "Blank". + +[Changed] + +- "Reduce Outline Backface" removed because you can just turn on "ZWrite" then adjust "Opacity". [Fade Transparency] [LWRP/URP] +- "Vertex Color Red Affect Outline" Changed To "Vertex Color Blue Affect Outline". +- "Vertex Color Blue Control Smooth Object Normal" Changed To "Vertex Color Red Control Smooth Object Normal". + + + +NOTE: To those who planned to update to this version to your current project: + +- Backup your current RealToon and your current project also if needed. + +- "Vertex Color Red Affect Outline" Changed To "Vertex Color Blue Affect Outline" and +"Vertex Color Blue Control Smooth Object Normal" Changed To "Vertex Color Red Control Smooth Object Normal", +means you need to recolor if you currently using these options. + +- If you are using "Reduce Outline Backface" option, just turn on the "ZWrite" then adjust the "Opacity". [Only LWRP/URP] + +___________________________________________________________________________________ +___________________________________________________________________________________ + + +**(Includes new Patch #4 for RealToon 5.0.7) January 2021 Release** + +[New] + +- Added SSGI (Screen Space Global Illumination) to RealToon HDRP. +- Recursive Rendering (Transparency and Reflection) support. (RealToon HDRP) +- HDRP 10 support. (RealToon HDRP) + +- New option "Remove Outline/Add Outline". (RealToon URP and RealToon HDRP) +*This will completely remove or add outline on the shader file, this is not per material. +*Useful if you are not really using the outline, want to use a 3rd party outline or want to use your own created outline method. +*This will also reduce calls/draw calls when using the shader on an environment objects. + +[Fix] + +- Reflection probe smooth blend. (RealToon HDRP) + + + + +**(Includes Patch #3 for RealToon 5.0.7) December 2020 Release** + +[New] + +- RealToon URP and RealToon HDRP SRP Batcher compatible + +[Fix] + +- Fade Transparency does not convert color from linear to gamma. (URP) + + + + +**(Includes Patch #2 for RealToon 5.0.7) September 2020 Release** + +[New] + +- Added DXR/Ray Tracing support to RealToon HDRP. +- Added SSR (Screen Space Reflection) to RealToon HDRP. +- new "Enable Screen Space Shadow" option (HDRP). +- RealToon HDRP has been improved. + +- "Ray Traced GI shade falloff" option. (HDRP) +*Adjust the Ray traced global illumination shade falloff. +*Useful if you want to blend the colored shadow in a pitch black scene. + +- Refresh Settings (New Inspector Option) (Currently HDRP) +*This will refresh all the realtoon properties and apply the settings properly. +*This is useful after update and after change material shader. + +[Fix] + +- Outline looks transparent in a Render Texture. (Built-In RP) +- Looks too bright when using Point and Spotlight. (Built-In RP - RealToon Lite) +- Object turned pink when ShadowMask is enabled. (Built-In RP - RealToon Lite "Default") + +[Changes] + +- “ColorMask RGB” has been removed because it is not the right fix for "outline look transparent in Render Texture" problem. (Built-In RP) +- RealToon HDRP Reflection "Roughness" option name changed to "Smoothness" because of the added ray tracing. (HDRP) +- RealToon HDRP codes has been re-arranged and separated for fast update and one call functions, this will also apply to RealToon URP later. +- "See Through" feature on RealToon HDRP has been temporarily disabled or removed, because Unity HDRP uses the "Stencil" differently, +It will be back if there's a new solution. (HDRP) +- "ZTest" has been temporarily removed or totally remove soon on RealToon HDRP, because Unity HDRP uses the "ZTest" differently. (HDRP) + +NOTE: +*RealToon HDRP Reflection "Roughness" name has been changed to "Smoothness", you might need to change the value again. +*After you update your RealToon HDRP, click the "Refresh Settings" on the RealToon Inspector to refresh and apply the properties properly. + +*For HDRP Users: +Read the "RealToon HDRP (Temporary User Guide)" for new info and setup steps. +Read the "Please read before you unpack or import" for important new notes. + + + + +**(Includes Patch #1 for RealToon 5.0.7) August 2020 Release** + +[Fixed] + +* “ColorMask RGB” added to outline pass to prevent transparent outline when capturing single image. (ALL) +* ”Normal Bias” is not working properly. (URP) +* “Normal Bias” has been removed to prevent double shades. (HDRP) +* “Spotlight Cookie “ not working (HDRP) +* ”Spotlight Box Type” doesn’t have Attenuation/Light falloff. +* "Hide Contact Shadow" not working properly. (HDRP) +* "Shadow Color Texture" is still affected by “Main Color” even if the "Main Color In Ambient Light Only" is enabled. (HDRP) +* ”Spotlight Attenuation“ is too strong. (Built-In RP) +* ”_ShadowCoord” error. (Built-In RP - Unity 2020) +* ”_GIShadeThreshold” and GUI error. (Built-In RP - Unity 2017) +* One Pointlight cookie line typo. (Built-In RP) + + + + + +========================================== +(V5.0.8) (March 2021) +========================================== +This update supports Unity 5, 2017, 2018, 2019, 2020, 2021 and future unity versions. + + + +**(Main Update)** + +[New Options] + +- Use Vertex Color As Normal Direction (Outline) [URP and HDRP] +*Use the vertex colors of the object as normal direction for outline. + +- Affect Shadow (Transparency) [URP] +*Transparency affects shadow. + +- PTexture Color (PTexture) [URP] +*Can now color the PTexture feature. + +- Optimize for [Light Mode:Baked] (Lightmapping) [URP] +*Optimize the shader for [Light Mode: Baked] + +- On shader "Screen Space Outline" (Outline) [URP and HDRP] +*Screen space - depth based outline on the shader. + +- Blending (Transparency) [URP and HDRP] +- Rim Light Intensity (RimLight) [URP] + +- Refresh Settings (URP) +*This will refresh the settings and apply it properly. +*Useful if the settings are not applied properly or after change shader or if there is a problem on the shader. + + +[New Features and Support] + +- DeNorSob Outline (Post - Processing Effect) [URP and HDRP] +*Sobel, Depth and Normal based outline. + +- Smooth Object Normal - Helper Script (Smooth Object Normal) [URP and HDRP] +*This helper script will help "Smooth Object Normal" feature to follow object animation or movement. + +- Lightmap Support [URP] +- PlayStation Support [URP and HDRP] +- URP 11 Support +- HDRP 11 Support +- Unity DOTS Ready [URP and HDRP] +=========================================================== + +[Note] +Patches from the previous version 5.0.7 are +integrated to this new version. +See previous version list for more info about the patches. + +=========================================================== +Changes and Improvements +=========================================================== +- Improved user guide/documentation. +- "Double Sided" has been changed to "Culling" for more polygon sides control. [URP] +- "Fade Transparency" is now merged to "Default", there will be one shader and you'll just need to toggle the "Transparent Mode". [URP] +- Color blending/mixing has been changed - improved, it is now accurate than before. [URP] +- "Main Color" default color has been changed. [URP] +- "Smooth Object Normal" has been improved, you don't need anymore a Hardness option and can adjust it in any direction. [URP and HDRP] +- Shaders and Examples are now in packages. [All] +- "Light Intensity" default value has been changed from -1 to 1 because of the color blending/mixing change. [URP] + +=========================================================== +Fixed +=========================================================== +- Turns pink after iOS or Mac build (Metal Graphics API). [URP] +- Spotlight don't have shadow. (URP 10) +- Can't select the front face of a plane object or quad face object, the cause is the traditional outline culling. [URP and HDRP] + +=========================================================== +Note and warning +=========================================================== +To those who planned to update your current project to this version: +*RealToon URP color blending or mixing has been changed, You need to adjust the colors of your object again. +*RealToon URP "Fade Transparency" is now merged to "Default", Change your transparent object shader to "Default" and enable "Transparent Mode". + + + + +**(5.0.8p10 [Patch#10] - July 2024)** + +[New] +- Screen Space Rimlight [HDRP] +- Triplanar [URP and HDRP] +- Soft Cutout (New Option for Cutout Feature) [URP and HDRP] +- HDRP is finally out of beta starting Unity 6 (HDRP 17) +- Starting Unity 6 (URP 17) DeNorSob Outline is finally volume based. + +[Improvements] +- Improved DeNorSob Outline outline width. [URP and HDRP] +- Improved Near Fade Transparency distance. [URP and HDRP] + +[Fixed] +- Fix all errors [URP and HDRP] +- Fix DOTS errors [URP and HDRP] + + + +**(5.0.8p9 [Patch#9] - May 2024)** + +[New] +- Added support for HDRP 17 and URP 17. +- Added support for Unity 6 and ready. [URP and HDRP] +- GPU Resident compatible. [URP 17 and HDRP 17] +**GPU Resident on RealToon URP, you need to set the Shader Compilation from 2.0 to 4.5 under the RealToon Settings section. + +[Improvements] +- GI/Ambient light improved and can use both Static and Dynamic. [HDRP 14 to HDRP 17] +- GI Flat Shade correct light. [URP and HDRP] +- Improved URP and HDRP DOTS/Hybrid Renderer shader properties. [URP 17 and HDRP 17] + +[Fix] +- URP 17 and HDRP 17 properties error. + + + + +**(5.0.8p8 [Patch#8] - October 2023)** + +[New] +- APV (Adaptive Probe Volume) [URP 15 to later] +- Arealight out of beta. [HDRP 16 to later] +- DeNorSob Outline does not need a separate Depth-Normals Render Feature [URP 15 to later] +- URP Deferred Support [URP 12 to later] + +[Improvements] +- DeNorSob Outline can now be affected by the Cutout feature. [URP 15 to later] +- Arealight light falloff is improved and can now be set to any XY size without any noise. [HDRP 16] + +[Changes] +- DeNorSob Outline will not affect transparency [URP and HDRP] +- In Transparent Mode, On Shader Screen Space Outline will be disabled except Cutout Feature. [URP and HDRP] +- DeNorSob Outline Injection is now AfterOpaqueAndSky and transparent object will not affected by the outline. [HDRP] + +[Fix] +- Blinking/Flashing when using Cutout Feature [HDRP] +- Blinking/Flashing colors [HDRP 14 to later] +- "INDIRECTDIFFUSEMODE_RAYTRACE" error [HDRP 14 to later] +- Arealight errors [HDRP 16 to later] +- DeNorSob Outline not working [URP 15 to later] +- URP 7 - 8 and HDRP 7 - 8 are not supported and removed. + + + + +**(5.0.8p7 [Patch#7] - December 2022)** + +[New] +- Near Fade Dithering (URP and HDRP) +*Objects fade when the camera is near. + +- LOD Crossfading (URP 14 and HDRP 14) +- URP 14 and HDRP 14 full support +- Quick ready support for Unity 2023 (For Testing Purpose) + +[Improvements] +- RayTracing reflections and RayTracing GI (HDRP 14) + + + + +**(5.0.8p6 [Patch#6] - September 2022)** + +[New] +- Simple Transparency (For Transparent) +*This option is for platforms that only need simple transparency like (Playstation) + +- Disable DOTS Mesh Deformation (For DOTS Enabled Project) (URP) +*For objects that are static. + +- URP 14 and HDRP 14 Support. +- Forward+ Support. (URP 14 to later) +- 1 simple example for RealToon URP. + + +[Fix] +- Transparent is not working properly. (Playstation) +- DOTS not working properly (URP 12) + + + + +**(5.0.8p5 [Patch#5] - April 2022)** + +[New] +- AO/Ambient Occlusion Support. (HDRP and [URP 10 to later]) + *To use just enable "Enable Screen Space AO" under the Category shadow. +- Glow/Emission effect for Cutout. (URP and HDRP) +- Decal Support (URP 12 to later) +- 1 Simple Example Package. (HDRP) + +[Fix] +- SSR/Screen Space Reflection waterfall look when decal is behind the object. (HDRP) +- RealToon Inspector error when there is no "Render Pipeline Asset" on the Current selected + "Quality Level". (HDRP 12) +- Transparent is not working properly. (Playstation) (URP and HDRP) + +[Change] +- Add namespace on all RealToon scripts and editors. (All Render Pipeline) + + + + +**(5.0.8p4 [Patch#4] - December 2021)** + +[New] +- Planar Reflection (HDRP 10 to Later) +- Swap Shader To RealToon (New Tool) (Built-In, URP and HDRP) + *Swap shader from VRoid|VRM or Unity Shaders to RealToon. + +[Fix] +- Object selection on the scene window. (HDRP 10 to later) + +[Change] +- "Selflit - Power" option changed default value to 50. (HDRP) +- "Texture and Main Color Intensity" changed default value to 0. (HDRP) +- "Light Ignore Y Normal Direction" has been moved to Shadow category, (URP and HDRP) + because it is also affect "ShadowT" feature. + +[Improved] +- RayTracing exposure. (HDRP 10 to later) + + + + +**(5.0.8p3 [Patch#3] - October 2021)** + +[New] +- Main Color Power (URP and HDRP) + * This will let you adjust the intensity of the Main Color. + * You don't need to adjust the Main Color to darker color or gray color to prevent overexposure, just adjust this new option. + +- Compute Deformation [DOTS - Hybrid Renderer] (Currently URP 10, 12 and later) + +- Light Ignore Y Normal Direction (Self Shadow) (URP and HDRP) + * Light will ignore object's Y normal direction when the angle or position of the light is in X or Z. + * Self Shadow/Shade will move in X or Z only. + +[Fix] +- Transparent mode "Affect Shadow" does not work properly. +- Include "Sobel Outline Effect" again, this was missing or not included in packing the shader. (Built-In) (Unity 2019 to Later) + +[Change] +- "Use Vertex Color As Normal" has been removed. (URP and HDRP) +- "Main Color" default color has been changed to white because of the new option "Main Color Power". (URP and HDRP) + +[Improved] +- "Shadow Color" and "Shadow Color Texture" has been improved, the colors are now accurate and you'll get what you select. (When Light Affect Shadow is disabled) (HDRP) + + + +Note/Warning (If you are already a RealToon (URP or HDRP) user and planned to update your project to this patch): + *There is a new option for "Main Color" to adjust the intensity and it is set to low value to prevent overexposure, + if you still want to use the previous "Main Color" intesnity, just set the "Main Color Power" to 1. + + *"Shadow Color" and "Shadow Color Texture" has been improved on RealToon HDRP, you might need to re-adjust the shadow color or the "Overall Shadow Color Power" + + + + +**(5.0.8p2 [Patch#2] - August 2021)** + +[New] +- DOTS - Hybrid Renderer Support (URP and HDRP)(10 to 12) +- Linear Blend Skinning [DOTS - Hybrid Renderer] (Currently URP 10, 12 and later) +- URP 12 Support +- HDRP 12 Support +- Added "Settings" Section (Currently URP) +- Added "Change Shader Compilation Target 2.0/4.5" (Currently URP) +- VRoid - manually change shader guide + +[Fix] +- Gloss, Rim Light and Self Shadow at View Direction is not working properly when +in GPU Instancing or SRP Batched (URP) +- Object turns pink/error when disabling Outline. (URP and HDRP) (Apple Metal) + +Improved: +- Disable/Enable outline. (URP and HDRP) + + +Note: +*To use RealToon URP on a DOTS - Hybrid Renderer project, +change the "Shader Compilation Target" to 4.5, it is under the "Settings" section. +RealToon HDRP is already Shader Compilation Target 4.5. + + + + + +========================================== +(V5.0.9) (October 2024) +========================================== +This update supports Unity 5, 2017, 2018, 2019, 2020, 2021, Unity and future unity versions. + + + +**(Main Update)** + +[New] +- Perspective Adjustment +"Adjusting the perspective from 3D to 2D/2D to 3D." + +- Smear Effect +"For Anime/Toon style smear motion." + +[Improvements] +- Minor UI improvements starting Unity 6 - URP 16 & HDRP 16. + +[Fixed] +- Fix all errors starting URP10/HDRP 10 to 16. + + + + +========================================== +(V5.0.10) (December 2024) +========================================== +This update supports Unity 5, 2017, 2018, 2019, 2020, 2021, Unity and future unity versions. + + + +**(Main Update)** + +[New] +- SDF Mode (ShadowT New Option) (Built-In, URP and HDRP) +"SDF Style Shadowing." + +- Add/Remove "See Through" feature (New Setting Option) (URP) +"Add or Remove 'See Through' feature on the RealToon Shader." +"Useful for those who don't want to use it and fix overlap fog on the Outline." + +[Changes] +- Smooth Object Normal does not get disable anymore when Self Shadow is disabled. (Built-In, URP and HDRP) +- "See Through" feature is default disabled, just enable or add it if you need it, Your settings are still maintained even disabled. (URP) + +[Improvements] +- Smooth Object Normal has been improved including the Smooth Object Normal helper script. (Built-In, URP and HDRP) +- RealToon Tools/Script has been improved and added some info. + +[Fixed] +- Some fog asset overlap the RealToon Shader - Outline, it can be fix by disable the 'See Through' feature. (URP) + + + + +========================================== +(V5.0.11) (February 2025) +========================================== +This update supports Unity 5, 2017, 2018, 2019, 2020, 2021, Unity 6 and future unity versions. + + + +**(Main Update)** + + +[New] +- (ShadowT - SDF Mode Helper - New Options) (Built-In, URP and HDRP) +*Forward Inverted - Invert Forward/Front position of the object. +*Right Inverted - Invert Right position of the object. +*Light Threshold - The amount of light. + +- RealToon Shader Cache (New Tool) (Built-In, URP and HDRP) +"To reduce or clear cached RealToon Shader." +"Useful for after update RealToon Shader or Re-import RealToon Shader." +"To access this, "Window -> RealToon -> RealToon Shader Cache"." + +- Support URP Dynamic Lightmap. (Unity 6.0 to Latest) +- Support URP Deferred+. (Unity 6.1 to Latest) +- Support Unity 6.1 +- Early add support for the later Unity 6.2. + + +[Changes] +- RealToon Shader (SRP) packages has been reorganized, separate Unity 6 folder and Older/Previous Unity version folders. +- (URP 10 - 11) and (HDRP 10 - 11) has been removed, not supported anymore. + + +[Fixed] +- Gloss feature "Unity_WorldToObject" error. (URP) +- Overlap Sky & RayTracing Reflection. (HDRP) +- RealToon HDRP Example missing Global Volume and overexposed. (HDRP) +- URP Lightmap errors. (URP) + + + + +========================================== +(V5.0.12) (April 2025) +========================================== +This update supports Unity 5, 2017, 2018, 2019, 2020, 2021, Unity 6 and future unity versions. + + + +**(Main Update)** + + +[New] +- Multiple Directional Lights support (HDRP) +- Anisotropic Mode (Anisotropic Highlights) (New Feature for Gloss Texture) (URP and HDRP) +- RealToon Built-In/BiRP now support Perspective Adjustment. (BiRP/Built-In) +- Anti - Aliasing (MSAA) Affect Cutout (New Option for Cutout) (URP) + +[Changes] +- Cutout feature option default value changed to 0.5. + +[Minor Improvements] +- Object Selection (HDRP) +- DeNorSob Outline (URP and HDRP) +- Screen Space Outline (URP and HDRP) +- Screen Space Rimlight(HDRP) + +[Fixed] +- Can't select object including flat plane object. (BiRP/Built-In and URP) +- Error when in debug baked lightmap. (URP) + + + +========================================== +(V5.0.13) (June 2025) +========================================== +This update supports Unity 5, 2017, 2018, 2019, 2020, 2021, Unity 6 and future unity versions. + + + +**(Main Update)** + + +[New] +- VRC Light Volumes Support (VRChat) (Built-In/BiRP) +*VRC Light Volumes packages is needed to be able to use this. + +- Anti - Aliasing Softness (New Companion Option for Anti - Aliasing Affect Cutout) (URP) +*This will adjust the Anti - Aliasing Softness/Hardness Cutout. + +- Stencil: Pass (New Option For Outline) (URP) +*Use it to resolve 'Mask UI' and other assets like weather and fog overlap issues. +*Use 'Keep' for Mask UI while 'Invert' for other assets like weather and fog. + +- Limit Light Intensity (New Option For Lighthing) (Built-In/BiRP, URP & HDRP) +*To limit light intensity, minimum and maximum intensity value. + +- RealToon Resources (New Folder Added) +*Some resource for you to use on your objects/models that uses RealToon Shader. + +- A new Improved RealToon Welcome Screen +*You can just click a button to import the right RealToon Shader package. +*Information section about your project including SRP version and Unity Versions, +You don't need to go to package manager to see the versions. + +- Map Mode (New Option For Self Lit) +*This will allow you to use Emission Maps. + +- Lightmap Support (RealToon Shader - Default Lite) (Built-In/BiRP) +- WebGPU support (URP) (Unity 6 to Later) +- Nintendo Switch 2 support (URP & HDRP) + + +[Changes] +- Change RealToon Reflection Roughtness shader variable "_ReflectionRoughtness" to "_Smoothness". (URP) +*Changed so that other assets affects RealToon's Reflection roughtness value. + +[Fixed] +- 'Cutout' does not affect Depth. (URP) +- 'Anisotropic Highlights' does not work. (URP) (Deferred and Deferred+) (Unity 6.1) +- 'UI Mask' overlap issues, resolve by setting the added new outline option 'Stencil: Pass' to 'Keep'. (URP) +- 'Gloss Texture Follow Light' not working properly. (URP) +- Raytracing doubled declared punctual light function. (HDRP) \ No newline at end of file diff --git a/RealToon/RealToon/Change - Fix Log.txt.meta b/RealToon/RealToon/Change - Fix Log.txt.meta new file mode 100644 index 0000000..b5f343f --- /dev/null +++ b/RealToon/RealToon/Change - Fix Log.txt.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: dc22032b278b46f469de30872180ade5 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/RealToon/RealToon/Editor.meta b/RealToon/RealToon/Editor.meta new file mode 100644 index 0000000..523b8e2 --- /dev/null +++ b/RealToon/RealToon/Editor.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 658e403a0a86079459a910d6eb1ee150 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/RealToon/RealToon/Editor/RTW.sett b/RealToon/RealToon/Editor/RTW.sett new file mode 100644 index 0000000..56a6051 --- /dev/null +++ b/RealToon/RealToon/Editor/RTW.sett @@ -0,0 +1 @@ +1 \ No newline at end of file diff --git a/RealToon/RealToon/Editor/RTW.sett.meta b/RealToon/RealToon/Editor/RTW.sett.meta new file mode 100644 index 0000000..a4fb00c --- /dev/null +++ b/RealToon/RealToon/Editor/RTW.sett.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: d5a3be5e8e97b7a4bbb0c7eb475b4cbd +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/RealToon/RealToon/Editor/RT_GUI_Img.png b/RealToon/RealToon/Editor/RT_GUI_Img.png new file mode 100644 index 0000000..1d62542 Binary files /dev/null and b/RealToon/RealToon/Editor/RT_GUI_Img.png differ diff --git a/RealToon/RealToon/Editor/RT_GUI_Img.png.meta b/RealToon/RealToon/Editor/RT_GUI_Img.png.meta new file mode 100644 index 0000000..a3e57f7 --- /dev/null +++ b/RealToon/RealToon/Editor/RT_GUI_Img.png.meta @@ -0,0 +1,130 @@ +fileFormatVersion: 2 +guid: c0678c6822cb57145a91e3ed1743f981 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + 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 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 4 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spriteCustomMetadata: + entries: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/RealToon/RealToon/Editor/RT_Welcome.cs b/RealToon/RealToon/Editor/RT_Welcome.cs new file mode 100644 index 0000000..f867fbf --- /dev/null +++ b/RealToon/RealToon/Editor/RT_Welcome.cs @@ -0,0 +1,482 @@ +//MJQStudioWorks + +using UnityEditor; +using System.IO; +using UnityEngine; +using UnityEngine.Rendering; +using UnityEditor.PackageManager; + + +namespace RealToon.Editor.Welcome +{ + + [InitializeOnLoad] + public class RTWelcome : EditorWindow + { + + #region Variables + + static float WinHig = 300; + static EditorWindow EdiWin; + static string CurrRP; + static string CurrRPDisp; + static string CurrRPVer; + static string CurrRPFullVer; + static string UniVer; + static string UniVerFull = null; + static string VRC_LV_Stat; + static bool VRC_LV_CHK; + static bool SRP_CHK_AVAI; + static Object RT_Pack; + static string RT_pac_name; + static Object RP_ReMe; + static Object RP_Qui_ReMe; + static Vector2 scroll; + static Vector2 scroll2; + static Vector2 scroll3; + static string rt_welcome_settings = "Assets/RealToon/Editor/RTW.sett"; + static string[] RP_Info = { "Built-In Render Pipeline (BiRP)", + "Universal Render Pipeline (URP)", + "High Definition Render Pipeline (HDRP)" }; + + #endregion + + #region RT_Welcome + static RTWelcome() + { + if (File.Exists(rt_welcome_settings)) + { + if (File.ReadAllText(rt_welcome_settings) == "0") + { + if (File.Exists(rt_welcome_settings)) + { + EditorApplication.delayCall += Ini; + } + } + } + } + #endregion + + #region ini + + [MenuItem("Window/RealToon/Welcome Screen")] + static void Ini() + { + EdiWin = GetWindow(true); + EdiWin.titleContent = new GUIContent("Welcome RealToon Shader User"); + WinHig = 682; + EdiWin.minSize = new Vector2(658, WinHig); + EdiWin.maxSize = new Vector2(658, WinHig); + + } + #endregion + + #region check_srp_ver + static void check_srp_ver() + { + var request = Client.List(); + + while (!request.IsCompleted) { } + + if (request.Status == StatusCode.Success) + { + foreach (var package in request.Result) + { + if (package.name == "com.unity.render-pipelines.universal") + { + CurrRPVer = package.version.Substring(0, 2); + CurrRPFullVer = package.version; + CurrRP = package.displayName; + SRP_CHK_AVAI = true; + return; + } + else if (package.name == "com.unity.render-pipelines.high-definition") + { + CurrRPVer = package.version.Substring(0, 2); + CurrRPFullVer = package.version; + CurrRP = package.displayName; + SRP_CHK_AVAI = true; + return; + } + } + } + else if (request.Status >= StatusCode.Failure) + { + UnityEngine.Debug.LogWarning("URP and HDRP Packages are not available or present in your project."); + SRP_CHK_AVAI = false; + } + } + #endregion + + #region check_vrc_lv + static void check_vrc_lv() + { + if (GraphicsSettings.currentRenderPipeline == null) + { + if (Directory.Exists("Assets/VRCLightVolumes")) + { + VRC_LV_CHK = true; + VRC_LV_Stat = "Is present"; + } + else + { + VRC_LV_CHK = false; + VRC_LV_Stat = "Not Present"; + } + } + else + { + VRC_LV_CHK = false; + VRC_LV_Stat = "BiRP Only"; + } + } + #endregion + + #region rt_pac_set + static void rt_pac_set() + { + if (GraphicsSettings.currentRenderPipeline != null) + { + if (CurrRP == "Universal Render Pipeline" || CurrRP == "Universal RP") + { + if (int.Parse(CurrRPVer) == 12 || int.Parse(CurrRPVer) == 13) + { + RT_pac_name = "RealToon URP (URP 15 and 16)"; + } + if (int.Parse(CurrRPVer) == 14) + { + RT_pac_name = "RealToon URP (URP 14)"; + } + if (int.Parse(CurrRPVer) == 15 || int.Parse(CurrRPVer) == 16) + { + RT_pac_name = "RealToon URP (URP 15 and 16)"; + } + + if (UniVerFull.Substring(0, 6) == "6000.0") + { + RT_pac_name = "RealToon URP (Unity 6.0)"; + } + else if (UniVerFull.Substring(0, 6) == "6000.1" || (int.Parse(UniVerFull.Substring(0, 1)) == 6 && int.Parse(UniVerFull.Substring(5, 1)) >= 1)) + { + RT_pac_name = "RealToon URP (Unity 6.1 To Later)"; + } + + var ids_reme = AssetDatabase.FindAssets("Please read before you unpack or import", new[] { "Assets/RealToon/RealToon Shader Packages/SRP (LWRP - URP - HDRP)/URP" }); + if (ids_reme.Length == 1) + { + RP_ReMe = AssetDatabase.LoadMainAssetAtPath(AssetDatabase.GUIDToAssetPath(ids_reme[0])); + } + else + { + Debug.Log("Couldn't find ReadMe's"); + } + + } + else if (CurrRP == "High Definition Render Pipeline" || CurrRP == "High Definition RP") + { + + if (int.Parse(CurrRPVer) == 12 || int.Parse(CurrRPVer) == 13) + { + RT_pac_name = "RealToon HDRP (HDRP 12 and 13)"; + } + else if (int.Parse(CurrRPVer) == 16) + { + RT_pac_name = "RealToon HDRP (HDRP 16)"; + } + else if (int.Parse(CurrRPVer) == 14 || int.Parse(CurrRPVer) == 15) + { + RT_pac_name = "RealToon HDRP (HDRP 14 and 15)"; + } + + if (UniVerFull.Substring(0, 6) == "6000.0") + { + RT_pac_name = "RealToon HDRP (Unity 6.0)"; + } + else if (UniVerFull.Substring(0, 6) == "6000.1" || (int.Parse(UniVerFull.Substring(0, 1)) == 6 && int.Parse(UniVerFull.Substring(5, 1)) >= 1)) + { + RT_pac_name = "RealToon HDRP (Unity 6.1 To Later)"; + } + + var ids_reme = AssetDatabase.FindAssets("Please read before you unpack or import", new[] { "Assets/RealToon/RealToon Shader Packages/SRP (LWRP - URP - HDRP)/HDRP" }); + if (ids_reme.Length == 1) + { + RP_ReMe = AssetDatabase.LoadMainAssetAtPath(AssetDatabase.GUIDToAssetPath(ids_reme[0])); + } + else + { + Debug.Log("Couldn't find ReadMe's"); + } + + var ids_qui_reme = AssetDatabase.FindAssets("RealToon HDRP (Quick Guide)", new[] { "Assets/RealToon/RealToon Shader Packages/SRP (LWRP - URP - HDRP)/HDRP" }); + if (ids_qui_reme.Length == 1) + { + RP_Qui_ReMe = AssetDatabase.LoadMainAssetAtPath(AssetDatabase.GUIDToAssetPath(ids_qui_reme[0])); + } + else + { + Debug.Log("Couldn't find Quick ReadMe's"); + } + } + } + else + { + if (int.Parse(Application.unityVersion.Substring(0, 4)) >= 2019) + { + RT_pac_name = "RealToon Built-In RP [3D] (Unity 2019 and Later)"; + } + else if (int.Parse(Application.unityVersion.Substring(0, 4)) < 2019) + { + RT_pac_name = "RealToon Built-In RP [3D] (Unity 2018 and below) (FV)"; + } + } + + var ids = AssetDatabase.FindAssets(RT_pac_name); + + if (ids.Length == 1) + { + RT_Pack = AssetDatabase.LoadMainAssetAtPath(AssetDatabase.GUIDToAssetPath(ids[0])); + } + else + { + RT_pac_name = "Package Not Found In Your Project"; + Debug.Log("Couldn't find packages"); + } + } + #endregion + + #region Process & UI + void OnGUI() + { + Texture2D t = EditorGUIUtility.Load("Assets/RealToon/Editor/RT_GUI_Img.png") as Texture2D; + Rect rect = new Rect(233, 0, t.width + 70, t.height + 70); + GUI.DrawTexture(rect, t, ScaleMode.ScaleToFit); + + EditorGUILayout.Space(76); + + EditorGUILayout.BeginVertical(); + + EditorGUILayout.BeginVertical(); + + if (GraphicsSettings.currentRenderPipeline != null) + { + if (CurrRP == "Universal Render Pipeline" || CurrRP == "Universal RP") + { + CurrRPDisp = RP_Info[1] + " v" + CurrRPFullVer; + } + else if (CurrRP == "High Definition Render Pipeline" || CurrRP == "High Definition RP") + { + CurrRPDisp = RP_Info[2] + " v" + CurrRPFullVer; + } + } + else + { + CurrRPDisp = RP_Info[0] + CurrRPFullVer; + } + + + GUIStyle centeredtext = GUI.skin.GetStyle("Label"); + centeredtext.alignment = TextAnchor.MiddleCenter; + centeredtext.fontSize = 18; + centeredtext.fontStyle = FontStyle.Bold; + EditorGUILayout.LabelField("A PRO Anime/Toon Shader", centeredtext); + + EditorGUILayout.EndVertical(); + + EditorGUILayout.Space(19); + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + + EditorGUILayout.BeginHorizontal(); + + EditorGUILayout.Space(22); + + EditorGUILayout.BeginVertical("TextArea", GUILayout.Height(90)); + + EditorGUILayout.LabelField("Introduction:"); + + scroll = EditorGUILayout.BeginScrollView(scroll, GUILayout.Height(280)); + + EditorGUILayout.Space(4); + + GUILayout.TextArea( + "*Thank you for purchasing RealToon Shader, before you start using RealToon, please read first the 'ReadMe - Important - Guide.txt' text file for setups and infos.\n\n" + + + "*All shaders packages are in the folder 'RealToon Shader Packages', just unpack the 'RealToon Shader' that correspond to your projects render pipeline.\n" + + "You can also just click the package on the Welcome Screen, To access the Welcome Screen just go to 'Window > RealToon > Welcome Screen'.\n\n" + + + "*If you are a VRoid user, read the 'For VRoid-VRM users.txt' text file.\n\n" + + + "*For video tutorials and user guide, see the bottom part of RealToon Inspector panel.\n\n" + + + "*If you need some help/support, just send an email including the invoice number.\n" + + "See the 'User Guide.pdf' file for the links and email support.\n\n" + + + "*PlayStation support is currently for URP and HDRP only.\n\n" + + + "Note:\nDon't move the 'RealToon' folder to other folder, it should stay in the root folder 'Asset'."); + + EditorGUILayout.EndScrollView(); + + EditorGUILayout.EndVertical(); + + EditorGUILayout.Space(22); + + EditorGUILayout.EndHorizontal(); + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + + EditorGUILayout.BeginHorizontal(); + + EditorGUILayout.Space(20); + + EditorGUILayout.BeginVertical("TextArea", GUILayout.Height(90)); + + EditorGUILayout.LabelField("Project Info:"); + + scroll2 = EditorGUILayout.BeginScrollView(scroll2, GUILayout.Height(140)); + + EditorGUILayout.Space(4); + + GUIStyle Pro_info = GUI.skin.GetStyle("Label"); + Pro_info.alignment = TextAnchor.MiddleLeft; + Pro_info.fontSize = 12; + + GUILayout.Label("Rendering Pipeline: \n" + CurrRPDisp, Pro_info); + + EditorGUILayout.Space(10); + + GUILayout.Label("Unity Version: \n" + UniVerFull, Pro_info); + + EditorGUILayout.Space(10); + + if (GraphicsSettings.currentRenderPipeline == null) + { + GUILayout.Label("VRC Light Volumes (VRC Users Only): \n" + VRC_LV_Stat, Pro_info); + } + + EditorGUILayout.EndScrollView(); + + EditorGUILayout.EndVertical(); + + EditorGUILayout.Space(30); + + EditorGUILayout.BeginVertical("TextArea", GUILayout.Height(90)); + + EditorGUILayout.LabelField("Suitable Packages & ReadMe:"); + + scroll3 = EditorGUILayout.BeginScrollView(scroll3, GUILayout.Height(140)); + + GUIStyle Pro_info2 = GUI.skin.GetStyle("Label"); + Pro_info2.fontSize = 12; + Pro_info2.fontStyle = FontStyle.Bold; + + EditorGUILayout.LabelField("Packages: ", Pro_info2); + + if(GUILayout.Button(RT_pac_name)) + { + if(RT_pac_name != "Package Not Found In Your Project") + { + Debug.LogWarning("Now opening RealToon Shader package: " + RT_Pack.name); + AssetDatabase.OpenAsset(RT_Pack); + } + } + + EditorGUILayout.Space(10); + + EditorGUILayout.LabelField("ReadMe: ", Pro_info2); + + if (GraphicsSettings.currentRenderPipeline != null) + { + if (CurrRP == "Universal Render Pipeline" || CurrRP == "Universal RP") + { + if(GUILayout.Button("Read Me First (URP)")) + { + AssetDatabase.OpenAsset(RP_ReMe); + } + } + else if (CurrRP == "High Definition Render Pipeline" || CurrRP == "High Definition RP") + { + if(GUILayout.Button("Read Me First (HDRP)")) + { + AssetDatabase.OpenAsset(RP_ReMe); + } + + if(GUILayout.Button("Quick Guide (HDRP)")) + { + AssetDatabase.OpenAsset(RP_Qui_ReMe); + } + } + } + + if(GUILayout.Button("ReadMe for Manual Unpacking & Info")) + { + Application.OpenURL(Application.dataPath + "/RealToon/ReadMe - Important - Guide.txt"); + } + + if(GUILayout.Button("VRoid-VRM users Read Me")) + { + Application.OpenURL(Application.dataPath + "/RealToon/For VRoid-VRM users.txt"); + } + + if(GUILayout.Button("What's New")) + { + Application.OpenURL(Application.dataPath + "/RealToon/What's New.txt"); + } + + EditorGUILayout.EndScrollView(); + + EditorGUILayout.EndVertical(); + + EditorGUILayout.Space(20); + + EditorGUILayout.EndHorizontal(); + + EditorGUILayout.Space(5); + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + + EditorGUILayout.BeginHorizontal(); + + if (GUILayout.Button("User Guide")) + { + Application.OpenURL(Application.dataPath + "/RealToon/RealToon (User Guide).pdf"); + } + if (GUILayout.Button("Video Tutorials")) + { + Application.OpenURL("www.youtube.com/playlist?list=PL0M1m9smMVPJ4qEkJnZObqJE5mU9uz6SY"); + } + if (GUILayout.Button("Contact/Support")) + { + Application.OpenURL("www.mjqstudioworks.weebly.com/contact.html"); + } + if (GUILayout.Button("Website")) + { + Application.OpenURL("www.mjqstudioworks.weebly.com"); + } + + EditorGUILayout.EndHorizontal(); + + EditorGUILayout.EndVertical(); + + } + private void OnEnable() + { + check_srp_ver(); + check_vrc_lv(); + UniVer = Application.unityVersion.Substring(0, 4); + UniVerFull = Application.unityVersion; + rt_pac_set(); + } + + private void OnDestroy() + { + if (File.Exists(rt_welcome_settings) && File.ReadAllText(rt_welcome_settings) == "0") + { + File.WriteAllText(rt_welcome_settings, "1"); + AssetDatabase.Refresh(); + } + } + #endregion + } + +} \ No newline at end of file diff --git a/RealToon/RealToon/Editor/RT_Welcome.cs.meta b/RealToon/RealToon/Editor/RT_Welcome.cs.meta new file mode 100644 index 0000000..aadfe19 --- /dev/null +++ b/RealToon/RealToon/Editor/RT_Welcome.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3eddd3adb3383a342a543d148d492447 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/RealToon/RealToon/Editor/RealToonShaderCache.cs b/RealToon/RealToon/Editor/RealToonShaderCache.cs new file mode 100644 index 0000000..3eaabf3 --- /dev/null +++ b/RealToon/RealToon/Editor/RealToonShaderCache.cs @@ -0,0 +1,130 @@ +//RealToon Shader Cache +//MJQStudioWorks +//2025 + + +using UnityEngine; +using UnityEditor; +using System.IO; + +namespace RealToon.Tools +{ + public class RealToonShaderCache : EditorWindow + { + + #region Variables + + static float WinHig = 300; + static EditorWindow EdiWin; + static int countsha = 0; + + static string shaderCachePath = Directory.GetParent(Application.dataPath).ToString() + "/Library/ShaderCache/shader"; + + static string infospace = null; + + static string[] rt_shaders = + { "D_Default" + , "D_Fade_Transparency" + , "D_Refraction" + , "L_Default" + , "L_Fade_Transparency" + , "T_Default" + , "T_Fade_Transparency" + , "T_Refraction" + , "D_Default_URP" + , "D_Default_HDRP" + , "RealToon_Sobel_Outline_FX" + , "DeNorSobOutline"}; + + #endregion + + [MenuItem("Window/RealToon/RealToon Shader Cache")] + static void Init() + { + EdiWin = GetWindow(true); + EdiWin.titleContent = new GUIContent("RealToon Shader Cache"); + WinHig = 200; + EdiWin.minSize = new Vector2(440, WinHig); + EdiWin.maxSize = new Vector2(440, WinHig); + + CountRTCache(); + infospace = "There are " + countsha + " RealToon Shaders & Effects cached."; + + } + + void OnGUI() + { + + var lblcenstyle = new GUIStyle(GUI.skin.label) { alignment = TextAnchor.MiddleCenter }; + + GUILayout.Space(10); + EditorGUILayout.BeginVertical(); + + GUILayout.Label(infospace, lblcenstyle); + + CountRTCache(); + infospace = "There are " + countsha + " RealToon Shaders cached."; + + GUILayout.Space(10); + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + + if (GUILayout.Button("Reduce/Clean Cached RealToon Shader")) + { + + foreach (string rt_sha in rt_shaders) + { + string[] direc = Directory.GetDirectories(@shaderCachePath, rt_sha + "*"); + + foreach (string dir in direc) + { + if (direc.Length == 1) + { + Debug.Log("RealToon Shader Cache: " + rt_sha + " Shader Cache removed."); + Directory.Delete(dir.ToString(), true); + } + } + + + if (direc.Length == 0) + { + Debug.LogWarning("RealToon Shader Cache: " + rt_sha + " Shader already removed or not present."); + } + + } + + } + + if (GUILayout.Button("Re-import RealToon Shader")) + { + AssetDatabase.ImportAsset("Assets/RealToon", ImportAssetOptions.ImportRecursive); + } + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + + GUILayout.Label("Note:"); + GUILayout.Label("*This will reduce or clear cached RealToon Shaders.\n" + + "*Useful for after update RealToon Shader or Re-import RealToon Shader.\n" + + "*'Re-import RealToon Shader', will cache RealToon Shaders again."); + + EditorGUILayout.EndVertical(); + + } + + static void CountRTCache() + { + countsha = 0; + foreach (string rt_sha in rt_shaders) + { + string[] direc = Directory.GetDirectories(@shaderCachePath, rt_sha + "*"); + + foreach (string dir in direc) + { + ++countsha; + } + } + + } + + } + +} \ No newline at end of file diff --git a/RealToon/RealToon/Editor/RealToonShaderCache.cs.meta b/RealToon/RealToon/Editor/RealToonShaderCache.cs.meta new file mode 100644 index 0000000..c4c8774 --- /dev/null +++ b/RealToon/RealToon/Editor/RealToonShaderCache.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 84840fc1d4c96e342b2cfdc247538fef +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/RealToon/RealToon/Editor/RealToonShaderGUI_URP_SRP.cs b/RealToon/RealToon/Editor/RealToonShaderGUI_URP_SRP.cs new file mode 100644 index 0000000..326eb70 --- /dev/null +++ b/RealToon/RealToon/Editor/RealToonShaderGUI_URP_SRP.cs @@ -0,0 +1,3966 @@ +//RealToonGUI URP +//MJQStudioWorks +//©2025 + +#if UNITY_EDITOR + +using UnityEngine; +using UnityEditor; +using System; + +namespace RealToon.GUIInspector +{ + + public class RealToonShaderGUI_URP_SRP : ShaderGUI + { + + #region foldout bools variable + + static bool ShowTextureColor; + static bool ShowNormalMap; + static bool ShowTransparency; + static bool ShowMatCap; + static bool ShowCutout; + static bool ShowColorAdjustment; + static bool ShowOutline; + static bool ShowSelfLit; + static bool ShowGloss; + static bool ShowShadow; + static bool ShowLighting; + static bool ShowReflection; + static bool ShowRimLight; + static bool ShowSeeThrough; + static bool NearFadeDithering; + static bool Triplanar; + static bool ShowPerspecAdju; + static bool ShowSmeEff; + //static bool ShowTessellation; In Progress + static bool ShowDisableEnable; + static bool ShowSettings; + //static bool ShowFReflection; //remove later + //static bool ShowLightmapping; //remove later + //static bool ShowDepth; //remove later + + static bool ShowUI = true; + + string LightBlendString = "Anime/Cartoon"; + static string ShowUIString = "Hide Settings"; + + + #endregion + + #region Variables + +string realtoon_version = "5.0.13"; +string shader_type = "Default"; +string srp_mode = "URP"; +bool del_skw = false; +static bool aruskw = false; + +static bool UseSSOL = true; +static string UseSSOLStat = "Use Screen Space Outline"; +static string OLType = "Traditional"; + +static bool remoout = true; +static string remooutstat = "Remove Outline"; + +static bool twofourfive_target = false; +static string twofourfive_target_string = "Change shader compilation target to 4.5"; + +static bool dots_lbs_cd = false; +static string dots_lbs_cd_string = "DOTS|HR - Use Compute Deformation"; + +static bool add_st = true; +static string add_st_string = "Add 'See Through' feature"; + + Texture2D t = (Texture2D)AssetDatabase.LoadAssetAtPath("Assets/RealToon/Editor/RT_GUI_Img.png", typeof(Texture2D)); + + #endregion + + #region Material Properties Variables + + MaterialProperty _Culling = null; + MaterialProperty _TRANSMODE = null; + + MaterialProperty _MainTex = null; + MaterialProperty _TexturePatternStyle = null; + MaterialProperty _MainColor = null; + MaterialProperty _MaiColPo = null; + MaterialProperty _MVCOL = null; + MaterialProperty _MCIALO = null; + + MaterialProperty _MCapIntensity = null; + MaterialProperty _MCap = null; + MaterialProperty _SPECMODE = null; + MaterialProperty _SPECIN = null; + MaterialProperty _MCapMask = null; + + MaterialProperty _Cutout = null; + MaterialProperty _UseSecondaryCutout = null; + MaterialProperty _SecondaryCutout = null; + MaterialProperty _AlphaBaseCutout = null; + MaterialProperty _N_F_SCO = null; + MaterialProperty _AlpToCov = null; + MaterialProperty _AAS = null; + MaterialProperty _N_F_COEDGL = null; + MaterialProperty _Glow_Color = null; + MaterialProperty _Glow_Edge_Width = null; + + MaterialProperty _Opacity = null; + MaterialProperty _TransparentThreshold = null; + MaterialProperty _MaskTransparency = null; + MaterialProperty _BleModSour = null; + MaterialProperty _BleModDest = null; + + MaterialProperty _SimTrans = null; + MaterialProperty _TransAffSha = null; + + MaterialProperty _NormalMap = null; + MaterialProperty _NormalMapIntensity = null; + + MaterialProperty _Saturation = null; + + MaterialProperty _OutlineWidth = null; + MaterialProperty _OutlineWidthControl = null; + MaterialProperty _OutlineExtrudeMethod = null; + MaterialProperty _OutlineOffset = null; + MaterialProperty _OutlineZPostionInCamera = null; + MaterialProperty _DoubleSidedOutline = null; + MaterialProperty _OutlineColor = null; + MaterialProperty _MixMainTexToOutline = null; + MaterialProperty _NoisyOutlineIntensity = null; + MaterialProperty _DynamicNoisyOutline = null; + MaterialProperty _LightAffectOutlineColor = null; + MaterialProperty _OutlineWidthAffectedByViewDistance = null; + MaterialProperty _FarDistanceMaxWidth = null; + MaterialProperty _VertexColorBlueAffectOutlineWitdh = null; + MaterialProperty _OutStenPass = null; + + MaterialProperty _N_F_MSSOLTFO = null; + MaterialProperty _DepthThreshold = null; + + MaterialProperty _SelfLitIntensity = null; + MaterialProperty _SelfLitColor = null; + MaterialProperty _SelfLitPower = null; + MaterialProperty _TEXMCOLINT = null; + MaterialProperty _SelfLitHighContrast = null; + MaterialProperty _N_F_SLMM = null; + MaterialProperty _MaskSelfLit = null; + + MaterialProperty _GlossIntensity = null; + MaterialProperty _Glossiness = null; + MaterialProperty _GlossSoftness = null; + MaterialProperty _GlossColor = null; + MaterialProperty _GlossColorPower = null; + MaterialProperty _MaskGloss = null; + + MaterialProperty _GlossTexture = null; + MaterialProperty _GlossTextureSoftness = null; + MaterialProperty _PSGLOTEX = null; + MaterialProperty _GlossTextureRotate = null; + MaterialProperty _GlossTextureFollowObjectRotation = null; + MaterialProperty _N_F_ANIS = null; + MaterialProperty _NoisTexInten = null; + MaterialProperty _StraWidt = null; + MaterialProperty _NoiTexAffStraWidt; + MaterialProperty _ShifAnis = null; + MaterialProperty _GlossTextureFollowLight = null; + + MaterialProperty _OverallShadowColor = null; + MaterialProperty _OverallShadowColorPower = null; + MaterialProperty _SelfShadowShadowTAtViewDirection = null; + + MaterialProperty _ReduSha = null; + MaterialProperty _ShadowHardness = null; + + MaterialProperty _HighlightColor = null; + MaterialProperty _HighlightColorPower = null; + + MaterialProperty _SelfShadowRealtimeShadowIntensity = null; + MaterialProperty _SelfShadowThreshold = null; + MaterialProperty _VertexColorGreenControlSelfShadowThreshold = null; + MaterialProperty _SelfShadowHardness = null; + MaterialProperty _SelfShadowRealTimeShadowColor = null; + MaterialProperty _SelfShadowRealTimeShadowColorPower = null; + MaterialProperty _LigIgnoYNorDir = null; + MaterialProperty _SelfShadowAffectedByLightShadowStrength = null; + + MaterialProperty _SmoothObjectNormal = null; + MaterialProperty _VertexColorRedControlSmoothObjectNormal = null; + //MaterialProperty _XYZPosition = null; + MaterialProperty _ShowNormal = null; + + MaterialProperty _ShadowColorTexture = null; + MaterialProperty _ShadowColorTexturePower = null; + + MaterialProperty _ShadowTIntensity = null; + MaterialProperty _ShadowT = null; + MaterialProperty _ShadowTLightThreshold = null; + MaterialProperty _ShadowTShadowThreshold = null; + MaterialProperty _ShadowTColor = null; + MaterialProperty _ShadowTColorPower = null; + MaterialProperty _ShadowTHardness = null; + MaterialProperty _STIL = null; + MaterialProperty _N_F_STIS = null; + MaterialProperty _N_F_STIAL = null; + MaterialProperty _ShowInAmbientLightShadowIntensity = null; + MaterialProperty _ShowInAmbientLightShadowThreshold = null; + MaterialProperty _LightFalloffAffectShadowT = null; + MaterialProperty _N_F_STSDFM = null; + + MaterialProperty _PTexture = null; + MaterialProperty _PTCol = null; + MaterialProperty _PTexturePower = null; + + MaterialProperty _RELG = null; + MaterialProperty _EnvironmentalLightingIntensity = null; + + MaterialProperty _GIFlatShade = null; + MaterialProperty _GIShadeThreshold = null; + MaterialProperty _LightAffectShadow = null; + MaterialProperty _LightIntensity = null; + + MaterialProperty _N_F_LLI = null; + MaterialProperty _LLI_Min = null; + MaterialProperty _LLI_Max = null; + + MaterialProperty _UseTLB = null; + MaterialProperty _N_F_EAL = null; + + MaterialProperty _DirectionalLightIntensity = null; + MaterialProperty _PointSpotlightIntensity = null; + MaterialProperty _LightFalloffSoftness = null; + + MaterialProperty _CustomLightDirectionIntensity = null; + MaterialProperty _CustomLightDirectionFollowObjectRotation = null; + MaterialProperty _CustomLightDirection = null; + + MaterialProperty _ReflectionIntensity = null; + MaterialProperty _Smoothness = null; + MaterialProperty _RefMetallic = null; + MaterialProperty _MaskReflection = null; + MaterialProperty _FReflection = null; + + MaterialProperty _RimLigInt = null; + MaterialProperty _RimLightUnfill = null; + MaterialProperty _RimLightColor = null; + MaterialProperty _RimLightColorPower = null; + MaterialProperty _RimLightSoftness = null; + MaterialProperty _RimLightInLight = null; + MaterialProperty _LightAffectRimLightColor = null; + + MaterialProperty _MinFadDistance = null; + MaterialProperty _MaxFadDistance = null; + + MaterialProperty _TriPlaTile = null; + MaterialProperty _TriPlaBlend = null; + + MaterialProperty _PresAdju = null; + MaterialProperty _ClipAdju = null; + MaterialProperty _PASize = null; + MaterialProperty _PASmooTrans = null; + MaterialProperty _PADist = null; + + //MaterialProperty _NoiseSize = null; + //MaterialProperty _TrailSize = null; + + //MaterialProperty _TessellationSmoothness = null; + //MaterialProperty _TessellationTransition = null; + //MaterialProperty _TessellationNear = null; + //MaterialProperty _TessellationFar = null; + + MaterialProperty _RefVal = null; + MaterialProperty _Oper = null; + MaterialProperty _Compa = null; + + MaterialProperty _N_F_ESSAO = null; + MaterialProperty _SSAOColor = null; + + MaterialProperty _N_F_MC = null; + MaterialProperty _N_F_NM = null; + MaterialProperty _N_F_CO = null; + MaterialProperty _N_F_O = null; + MaterialProperty _N_F_CA = null; + MaterialProperty _N_F_SL = null; + MaterialProperty _N_F_GLO = null; + MaterialProperty _N_F_GLOT = null; + MaterialProperty _N_F_SS = null; + MaterialProperty _N_F_SON = null; + MaterialProperty _N_F_SCT = null; + MaterialProperty _N_F_ST = null; + MaterialProperty _N_F_PT = null; + MaterialProperty _N_F_CLD = null; + MaterialProperty _N_F_R = null; + MaterialProperty _N_F_FR = null; + MaterialProperty _N_F_RL = null; + MaterialProperty _N_F_HDLS = null; + MaterialProperty _N_F_HPSS = null; + MaterialProperty _ZWrite = null; + MaterialProperty _N_F_DCS = null; + MaterialProperty _N_F_NLASOBF = null; + MaterialProperty _N_F_RDC = null; + MaterialProperty _N_F_DDMD = null; + MaterialProperty _N_F_NFD = null; + MaterialProperty _N_F_TP = null; + MaterialProperty _N_F_PA = null; + MaterialProperty _N_F_SE = null; + + MaterialProperty _N_F_OFLMB = null; + + #endregion + + #region List of Toggle Keywords + + enum SFKW + { + N_F_USETLB_ON, + N_F_STIS_ON, + N_F_STIAL_ON, + N_F_EAL_ON, + N_F_MC_ON, + N_F_NM_ON, + N_F_CO_ON, + N_F_O_ON, + N_F_CA_ON, + N_F_SL_ON, + N_F_GLO_ON, + N_F_GLOT_ON, + N_F_SS_ON, + N_F_SON_ON, + N_F_SCT_ON, + N_F_ST_ON, + N_F_PT_ON, + N_F_RELGI_ON, + N_F_CLD_ON, + N_F_R_ON, + N_F_FR_ON, + N_F_RL_ON, + N_F_HDLS_ON, + N_F_HPSS_ON, + N_F_DCS_ON, + N_F_NLASOBF_ON, + N_F_DNO_ON, + N_F_TRANS_ON, + N_F_TRANSAFFSHA_ON, + N_F_OFLMB_ON, + N_F_ESSAO_ON, + N_F_RDC_ON, + N_F_COEDGL_ON, + N_F_DDMD_ON, + N_F_SIMTRANS_ON, + N_F_NFD_ON, + N_F_TP_ON, + N_F_PA_ON, + N_F_SE_ON, + N_F_SCO_ON, + N_F_STSDFM_ON, + N_F_ATC_ON, + N_F_ANIS_ON, + N_F_LLI_ON, + N_F_SLMM_ON + } + + #endregion + + #region TOTIPS + + string[] TOTIPS = + { + + //Culling [0] + "Controls which sides of polygons should be culled (not drawn).\n\n\nBack: Don’t render polygons that are facing away from the viewer.\n\nFront: Don’t render polygons that are facing towards the viewer, Used for turning objects inside-out.\n\nOff: Disables culling - all faces are drawn, This also called Double Sided." , + + //Texture [1] + "Main or base texture." , + + //Texture Pattern Style [2] + "Turn the 'Main/Base Texture' into pattern style." , + + //Main Color [3] + "Main or base color." , + + //Mix Vertex Color [4] + "Mix or show vertex color." , + + //Main Color in Ambient Light Only [5] + "Put the 'Main/Base Color' into ambient light." , + + //Highlight Color [6] + "Highlight color." , + + //Highlight Color Power [7] + "'Highlight Color' power or intensity." , + + //Main Color Power [8] + "'Main Color' power or intensity." , + + //Blend - Source [9] [Transparent Mode] + "Blending source.\n\n-Default Value: ScrAlpha" , + + //Blend - Destination [10] [Transparent Mode] + "Blending Destination.\n\n-Default Value: OneMinusScrAlpha" , + + //Transparent Mode [11] + "Setting the current mode from Opaque to Transparent.\n\nThis will allow you to use 'Fade Transparency' and 'Cutout' feature.", + + //Intensity [12] [MatCap] + "MatCap intensity." , + + //MatCap [13] [MatCap] + "MatCap texture." , + + //Specualar Mode [14] [MatCap] + "Turn MatCap into specular." , + + //Specular Power [15] [MatCap] + "Specular intensity or power." , + + //Mask MatCap [16] [MatCap] + "Mask MatCap.\n\nUse a Black and White texture map.\nWhite means visible matcap while Black is not." , + + //Cutout [17] + "Cutout value or threshold." , + + //Alpha Base Cutout [18] + "It will use the alpha/transparent channel of the 'Main/Base Texture' to cutout." , + + //Use Secondary Cutout Only [19] + "Use only the 'Secondary Cutout' to do the cutout." , + + //Secondary Cutout [20] + "Secondary texture cutout.\n\nUse a Black and White texture map.\nWhite means not cut out while Black is cutout." , + + //Opacity [21] + "Adjust the Transparency - Opacity of the object" , + + //Transparent Threshold [22] + "'Main/Base Texture' transparency threshold." , + + //Mask Transparency [23] + "Mask Transparency.\n\nWhite means opaque while Black means transparent." , + + //Normal Map [24] + "Normal Map." , + + //Normal Map Intensity [25] + "'Normal Map' intensity." , + + //Saturation [26] [Color Adjustment] + "Color saturation of the object." , + + //Width [27] [Outline] + "Outline main width." , + + //Width Control [28] [Outline] + "Controls the 'Outline Width' using texture Map.\n\nUse a Black and White texture map.\nWhite means 1 while Black means 0.\nThis will not work if the Outline main width value is 0." , + + //Outline Extrude Method [29] [Outline] + "Outline Extrude Methods.\n\nNormal - The outline extrusion will be based on normal direction.\n\nOrigin - The outline extrusion will be based on the center of the object." , + + //Outline Offset [30] [Outline] + "Outline XYZ position." , + + //Double Sided Outline [31] [Outline] + "Show the front side of the outline.\n\nUseful for plane object.\n'Outline Z Position In Camera' option is needed to be adjust to show the object." , + + //Color [32] [Outline] [Outline] + "Outline color." , + + //Mix Main Texture To Outline [33] [Outline] + "Mix 'Main/Base Texture' to oultine." , + + //Noisy Outline Intensity [34] [Outline] + "The power/intensity of the outline distortion or noise." , + + //Dynamic Noisy Outline [35] [Outline] + "Moving noisy or distort outline." , + + //Light Affect Outline Color [36] [Outline] + "Light (Brightness and Color) affect Outline color." , + + //Outline Width Affected By View Distance [37] [Outline] + "'Outline Width' affected by view distance." , + + //Far Distance Max Width [38] [Outline] + "The maximum 'Outline Width' limit when moving far from the object." , + + //Vertex Color Blue Affect Outline Width [39] [Outline] + "'Vertex Color Blue will affect the Outline Width.\n\nThis will not work if the Outline main width value is 0." , + + //Intensity [40] [SelfLit] + "How visible or strong the 'Self Lit' is." , + + //Color [41] [SelfLit] + "Self Lit color" , + + //Power [42] [SelfLit] + "'Self Lit Color' power or intensity." , + + //Texture and Main Color Intensity [43] [SelfLit] + "'Main/Base Texture' and 'Main/Base Color' intensity.\n\nAdjust this if the 'Main/Base Texture' and 'Main/Base Color' is too strong or too bright for Self Lit." , + + //High Contrast [44] [SelfLit] + "Turn Self Lit into high contrast colors and mix 'Base/Main Texture' twice." , + + //Mask Self Lit [45] [SelfLit] + "Mask Self Lit.\n\nUse a Black and White texture map.\nWhite means visible Self Lit while Black is not." , + + //Gloss Intensity [46] [Gloss] + "How visible or strong the 'Gloss' is." , + + //Glossiness [47] [Gloss] + "Glossiness." , + + //Softness [48] [Gloss] + "How soft the 'Gloss' is." , + + //Color [49] [Gloss] + "Gloss color" , + + //Power [50] [Gloss] + "'Gloss Color' power or intensity." , + + //Mask Gloss [51] [Gloss] + "Mask Gloss.\n\nWhite means visible Gloss while black is not." , + + //Gloss Texture [52] [Gloss Texture] + "A Black and White texture map to be used as gloss.\n\nWhite means gloss while Black is not." , + + //Softness [53] [Gloss Texture] + "The softness of the 'Gloss Texture'." , + + //Pattern Style [54] [Gloss Texture] + "Turn 'Gloss Texture' into pattern style." , + + //Rotate [55] [Gloss Texture] + "Rotate 'Gloss Texture'." , + + //Follow Object Rotation [56] [Gloss Texture] + "'Gloss Texture' will follow the object local rotation." , + + //Follow Light [57] [Gloss Texture] + "'Gloss Texture' will follow the light direction or position." , + + //Overall Shadow Color [58] + "Overall shadow color.\n\nThis will affect Realtime Shadow, Self Shadow/Shade and ShadowT." , + + //Overall Shadow Color Power [59] + "'Overall shadow Color' power or intensity." , + + //Self Shadow & ShadowT At View Direction [60] + "'Self Shadow' and 'ShadowT' follow your view or camera view direction." , + + //Reduce Shadow (Point Light) [61] + "The amount of reduce self cast shadow.\n\nThis option will only take effect when there's a Point Light." , + + //Refresh Settings [62] + "This will refresh and re-apply the settings properly.\n\nClick this if there are some problem, after you update, after material reset or re-import RealToon.", + + //Reduce Shadow [63] + "The amount of reduce self cast shadow.\n\nThis option will only take effect when there's a 'Directional Light', 'Point' or 'Spot Light'." , + + //Shadow Hardness [64] [RealTime Shadow] + "Real time shadow hardness" , + + //Threshold [65] [Self Shadow] + "The amount of 'Self Shadow/Shade' on the object." , + + //Vertex Color Green Control Self Shadow Threshold [66] + "Controls 'Self Shadow Threshold' by using vertex color Green." , + + //Hardness [67] [Self Shadow] + "'Self Shadow/Shade' hardness." , + + //Self Shadow & Real Time Shadow Color [68] + "'Self Shadow and Real Time Shadow Color'.\n\nBefore you set/change this, Set 'Overall Shadow Color' to White." , + + //Self Shadow & Real Time Shadow Color Power [69] + "'Self Shadow and Real Time Shadow Color' power or intensity." , + + //Self Shadow Affected By Light Shadow Strength [70] + "Light shadow strength will affect self shadow visibility." , + + //Smooth Object Normal [71] + "The amount of smooth object normal." , + + //Vertex Color Red Control Smooth Object Normal [72] + "'Vertex color Red controls the amount of smooth object normal." , + + //XYZ Position [73] [Smooth Object Normal] + "Normal's XYZ positions." , + + //Affect Shadow [74] + "Transparency affect shadow." , + + //Show Normal [75] [Smooth Object Normal] + "Show the normal of the object." , + + //Shadow Color Texture [76] + "A texture to color shadow.\n\nThis includes (RealTime Shadow, Self Shadow/Shade and ShadowT.\nYou can also use your 'Main/Base Texture' and adjust 'Power' to make it dark." , + + //Power [77] [Shadow Color Texture] + "How strong or dark the 'Shadow Color Texture'." , + + //Intensity [78] [ShadowT] + "How visitble or strong the 'ShadowT' is." , + + //ShadowT [79] + "ShadowT or Shadow Texture, shadows in texture form.\n\nUse Black or Gray and White Flat, Gradient and Smooth texture map.\nGray and White affected by light while Black is not.\n\nFor more info and how to use and make ShadowT texture maps, see 'Video Tutorials' and 'User Guide.pdf' at the bottom of this RealToon inspector.", + + //Light Threshold [80] [ShadowT] + "The amount of light." , + + //Shadow Threshold [81] [ShadowT] + "The amount of ShadowT." , + + //Hardness [82] [ShadowT] + "'ShadowT' hardness." , + + //Show In Shadow [83] [ShadowT] + "Show 'ShadowT' in shadow.\n\nThis will only be visible if realtime shadow and self shadow/shade color is not Black." , + + //Show In Ambient Light [84] [ShadowT] + "Show 'ShadowT' in Ambient Light.\n\nThis will only be visible if there's an Ambient Light present or GI." , + + //Show In Ambient Light & Shadow Intensity [85] [ShadowT] + "'ShadowT' intensity or visibility in shadow and ambient light." , + + //Show In Ambient Light & Shadow Threshold [86] [ShadowT] + "'ShadowT' threshold in Ambient Light and shadow." , + + //Light Falloff Affect ShadowT [87] + "'Point light' and 'Spot Light' light falloff affect 'ShadowT'." , + + //PTexture [88] + "A Black and White texture to be used as pattern for shadow.\n\nBlack means pattern while White is nothing.\nThis will not be visible if the shadow color is Black." , + + //Power [89] [PTexture] + "How strong or dark the pattern is." , + + //Receive Environmental Ligthing and GI [90] [Lighting] + "Turn on or off receive 'Environmental Ligthing' or 'GI'." , + + //Environmental Ligthing Intensity [91] [Lighting] + "Ambient Light, GI or Environmental Ligthing intensity on the object." , + + //GI Flat Shade [92] [Lighting] + "Turn GI or SH lighting shade into flat shade." , + + //GI Shade Threshold [93] [Lighting] + "The amount of GI Shade on the object." , + + //Light affect Shadow [94] [Lighting] + "Light intensity, color and light falloff affect shadows.\n\nThis will affect (RealTime shadow, Self Shadow and ShadowT)." , + + //Directional Light Intensity [95] [Lighting] + "Directional Light intensity received on the object." , + + //Point and Spot Light Intensity [96] [Lighting] + "Point and Spot light intensity received on the object." , + + //Light Falloff Softness [97] [Lighting] + "How soft is the point and spot light light falloff." , + + //Intensity [98] [Custom Light Direction] + "The amount of custom light direction." , + + //Custom Light Direction [99] [Custom Light Direction] + "XYZ light direction." , + + //Follow Object Rotation [100] [Custom Light Direction] + "'Custom Light Direction' follow object rotation." , + + //Intensity [101] [Reflection] + "The amount reflection visibility." , + + //Roughness [102] [Reflection] + "'Reflection' roughness." , + + //Metallic [103] [Reflection] + "The amount of reflection metallic look." , + + //Mask Reflection [104] + "Mask Reflection.\n\nWhite means visible relfection while Black means reflection not visible." , + + //FReflection [105] + "A texture or image to be used as reflection." , + + //Unfill [106] [Rim Light] + "Unfill the 'Rim Light' on the object." , + + //Softness [107] [Rim Light] + "'Rim Light' softness." , + + //Light Affect Rim Light [108] [Rim Light] + "Light (Brightness and Color) affect 'Rim Light'." , + + //Color [109] [Rim Light] + "'Rim Light' color." , + + //Color Power [110] [Rim Light] + "'Rim Light Color' power or intensity." , + + //Rim Light In Light [111] + "'Rim Light' will be visible in light only." , + + //ID [112] [See Through] + "ID or reference value.\n\n-Default Value: 0" , + + //Set A [113] [See Through] + "'A' The see through object while 'B' is the object to be seen through 'A'.\n\n-Default Value: A" , + + //Set B [114] [See Through] + "'A' The see through object while 'B' is the object to be seen through 'A'.\n\n-Default Value: None" , + + //No Light and Shadow On Backface [115] + "No light and shadow will be visible on a back of a plane/flat object or face.\n\nThis will only be take effect or visible if 'Culling' is turned 'Off' or 'Front'." , + + //Change Shader Compilation Target To 2.0/4.5. [116] + "This will change the Shader Compilation Target of the RealToon Shader file to '2.0' or '4.5'.\n\n*If the shader compilation target is changed to 4.5, the shader will support DOTS/DOTS Hybrid Renderer, GPU Resident and Tessellation.", + + //Hide Directional Light Shadow [117] + "Hide received 'Directional Light' shadows on the object." , + + //Hide Point & Spot Light Shadow [118] + "Hide received 'Point and Spot Light' shadows on the object." , + + //Disable Cast Shadow [119] + "Disable object cast shadow." , + + //ZWrite [120] + "Turn on or off ZWrite." , + + //Automatic Remove Unused Shader Keywords [121] + "Remove unused shader keywords automatically in all materials with Realtoon Shader. This will take effect once this enabled and when the RealToon Inspector shown. Disable this if you experience too slow Inspector.\n\n(Warning: This will also remove stored previous shaders shader keywords.)", + + //Color[122] [PTexture] + "'PTexture' color." , + + //Outline Z Position In Camera [123] [Outline] + "Adjust the outline Z position in camera space." , + + //RealTime Shadow Intensity [124] [RealTime Shadow] + "Adjust the realtime shadow intensity." , + + //Rim Light Intensity [125] [RimLight] + "'Rim Light' intensity.", + + //Self Shadow & RealTime Shadow Intensity [126] + "Adjust the 'Self Shadow' and realtime shadow intensity." , + + //Self Shadow Color [127] [Shadow] + "'Self Shadow' color." , + + //Self Shadow Color Power [128] [Shadow] + "'Self Shadow' color power or intensity." , + + //Color [129] [ShadowT] + "'ShadowT' color." , + + //Color Power [130] [ShadowT] + "'ShadowT' color power or intensity.", + + //Ignore Light [131] [ShadowT] + "'ShadowT' ignore direction light or light position.", + + //Light Intensity [132] [Lighting] + "How strong is the Light in the shadow.", + + //Enable Additional Lights [133] [Lighting] + "Enable additional lights like Point and Spot lights.", + + //Use Traditional Light Blend [134] [Lighting] + "Use traditional light blend.\n\nIf enabled light blending will be in add mode, if not enabled the light blending will based on high or maximum light intensity and the blending will be similar to Anime or Cartoon.", + + //Remove Outline/Add Outline (On Shader) [135] + "This will remove the Outline feature completely on the shader file or Add back the Outline feature on the shader file.\n\nThis is not per material.", + + //Video Tutorials [136] + "RealToon's video tutorial playlist.", + + //RealToon (User Guide).pdf [137] + "RealToon's user guide or documentation.", + + //Hide/Show UI [138] + "This will hide or show RealToon's Inspector UI.\n\nThis is global and not per material.", + + //Depth Threshold [139] [outline] + "This will adjust the depth based outline threshold.", + + //Mix Outline To The Shader Output [140] [outline] + "This will mix the outline to the shader output", + + //Optimize for [Light Mode:Baked] [141] + "If enabled, it will disable all realtime features on the shader and optimize it for [Light Mode:Baked].\n\nDisable or uncheck this for [Light Mode: RealTime or Mixed] use.", + + //Use Screen Space Outline/Use Traditional Outline [142] [outline] + "This will enable you to use 'Screen Space Outline' or 'Traditional Outline'.\n\n'Depth Texture' needs to be turn 'On' if you use the 'Screen Space Outline'.\n\nThis is not per material.", + + //Use Linear Blend Skinning/Compute Deformation [143] + "This will enable you to use 'Linear Blend Skinning' or 'Compute Deformation'.\n\nThis will modify the RealToon shader file.", + + //Light Ignore Y Normal Direcion [144] + "Light will ignore Object Normal Y direction.", + + //Enable Screen Space Ambient Occlusion [145] + "Enable SSAO or Screen Space Ambient Occlusion." , + + //Ambient Occlusion Color [146] + "Ambient Occlusion color or tint.", + + //Receive Decal [147] + "The object will Receive Decal.", + + //Glow Color [148] + "Glow edge color.", + + //Glow Edge Width [149] + "The width of the glow.", + + //Simple Transparency Mode[150] + "Common simple transparency.\nOnly 'Opacity', 'Blend Modes' and 'Affect Shadow' are available.\n\n'Transparent Threshold' and 'Mask Transparency' not available on this mode.", + + //Disable DOTS Mesh Deformation[151] + "Disable DOTS Mesh Deformation: 'Linear Blend Skinning and Compute Deformation'.\n\n*For Static Objects, enabled this.", + + //Near Fade Dithering - Min Distance[152] + "The minimum near distance.", + + //Near Fade Dithering - Max Distance[153] + "The maximum near distance.", + + //Soft Cutout [154] + "Dithering/Dot style cutout.\n\nFor a soft edge cutout.", + + //Tile (Triplanar) [155] + "Tiling scale of the texture.", + + //Blend (Triplanar) [156] + "Blending of the triplanar texture.", + + //Perspective (Perspective Adjustment) [157] + "This will change the perspective of an object to 2D or 3D or FOV stretch look.\nFor 2d toon/anime look, set it to 0.5 or 0.", + + //Clip (Perspective Adjustment) [158] + "This will change the clipping on the object.\nChange this if the object is overlapping front or back.\nHigher value will slice the object.", + + //Close-Up Size (Perspective Adjustment) [159] + "This will adjust the size of the object when the camera is closer.", + + //Close-Up Size Smooth Transition (Perspective Adjustment) [160] + "How smooth the transition of the sizing.", + + //Close-Up Size Distance (Perspective Adjustment) [161] + "Distance transition from the camera to the object.", + + //SDF Mode (ShadowT) [162] + "SDF Style Shadowing.\nNote: This only affect 3D Space X & Z axis.", + + //Add/Remove 'See Through' feature [163] + "This will add or remove 'See Through' feature on the RealToon Shader.\n\nUse this if you don't need the 'See Through' feature.\n\nThis will modify the RealToon shader file.", + + //Anti-Aliasing Affects Cutout (Cutout) [164] + "Anti-Aliasing/MSAA affects cutout.\n\n*This is Alpha To Coverage and it will only work if Forward/Forward+ Path Rendering is use.\n*If you turn off Cutout feature, this will revert to disable/off.", + + //Anisotropic Mode (Gloss Texture) [165] + "Setting the Gloss Texture to Anisotropic Mode.\n\nNote: This will use Gloss Texture texture input as noise.", + + //Noise Texture Intensity (Gloss Texture) [166] + "How strong the Noise Texture distortion.", + + //Width (Gloss Texture) [167] + "Width of the Anisotropic.", + + //Shift (Gloss Texture) [168] + "Shift the Anisotropic to Up or Down.", + + //Noise Texture Affect Width (Gloss Texture) [169] + "Noise Texture affect Anisotropic Width.\n\nNote: White means 1 while Black is 0.", + + //Stencil: Pass (Outline) [170] + "Use for fixing outline overlapping issues to other assets, objects and UI.", + + //Limit Light Intensity [171] + "This will limit the light intensity.\nMinimum and maximum light intensity.", + + //Minimum (Limit Light Intensity) [172] + "Minimum Light Intensity value.", + + //Maximum (Limit Light Intensity) [173] + "Maximum Light Intensity value.", + + //Anti-Aliasing Softness (Anti-Aliasing Affects Cutout) (Cutout) [174] + "How soft the Anti-Aliasing.", + + //Map Mode (SelfLit) [175] + "Use SelfLit Mask as SelfLit Map/Emission Map", + + //SelfLit Map (SelfLit) [176] + "A SelfLit Map/Emission Map.\nYou can use Grayscale/alpha or RGB/Colored Map." + + }; + + #endregion + + #region TOTIPS for EnDisFeatures + + string[] TOTIPSEDF = + { + //MatCap [0] + "MatCap or Material Capture.", + + //Normal Map [1] + "Normal Map.", + + //Outline [2] + "Outline.", + + //Cutout [3] + "Cutout.", + + //Color Adjustment [4] + "Adjust the color of the object.", + + //SelfLit [5] + "Own light or Emission.", + + //Gloss [6] + "Gloss.", + + //Gloss Texture [7] + "Gloss in texture form.\n\nUse a Black and White texture map.\nWhite means gloss while Black is not.", + + //Self Shadow [8] + "Self Shadow or Shade.", + + //Smooth Object Normal [9] + "Smooth object normal or ignore object normal.", + + //Shadow Color Texture [10] + "Color shadow using texture.", + + //ShadowT [11] + "ShadowT or Shadow Texture, shadows in texture form.\n\nUse Black or Gray and White Flat, Gradient and Smooth texture map.\nGray and White affected by light while Black is not.\n\nFor more info and how to use and make ShadowT texture maps, see 'Video Tutorials' and 'User Guide.pdf' at the bottom of this RealToon inspector.", + + //PTexture [12] + "PTexture or Pattern Texture.\n\nA Black and White texture to be used as pattern for shadow.\n\nBlack means pattern while White is nothing.\nThis will not be visible if the shadow color is Black.", + + //Custom Light Direction [13] + "Custom light direction.", + + //Reflection [14] + "Reflection.", + + //FReflection [15] + "FReflection or Fake Reflection.\n\nUse any texture or image as reflection.", + + //Rim Light [16] + "Rim light or fresnel effect.", + + //Near Fade Dithering [17] + "Object fades when the camera near.", + + //Triplanar [18] + "For a uniform texture scale and tiles.\n\nUseful for static objects and environment.", + + //Perspective Adjustment [19] + "This will adjust the perspective of your object to look 2D Toon/Anime or Default 3D.", + + //Smear Effect [20] + "Trail lines or Line noise effect when an object move fast, like the Anime/Cartoon." + + }; + + #endregion + + public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] properties) + { + //This Material + Material targetMat = materialEditor.target as Material; + + //Settings + materialEditor.SetDefaultGUIWidths(); + + //Content + + //Will remove soon if no use anymore + #region Shader Name Switch + + //switch (targetMat.shader.name) + //{ + //case "Universal Render Pipeline/RealToon/Version 5/Default/Default": + // shader_name = "default_d"; + // shader_type = "URP - Default"; + // break; + //case "Universal Render Pipeline/RealToon/Version 5/Default/Fade Transparency": + // shader_name = "default_ft"; + // shader_type = "URP - Fade Transperancy"; + // break; + //case "RealToon/Version 5/Default/Refraction": //Temporarily Removed + //shader_name = "default_ref"; //Temporarily Removed + //shader_type = "Refraction"; + //break; + //case "RealToon/Version 5/Tessellation/Default": //Temporarily Removed + //shader_name = "tessellation_d"; //Temporarily Removed + //shader_type = "Tessellation - Default"; //Temporarily Removed + //break; //Temporarily Removed + //case "RealToon/Version 5/Tessellation/Fade Transparency": //Temporarily Removed + //shader_name = "tessellation_ft"; //Temporarily Removed + //shader_type = "Tessellation - Fade Transparency"; //Temporarily Removed + //break; //Temporarily Removed + //case "RealToon/Version 5/Tessellation/Refraction": //Temporarily Removed + //shader_name = "tessellation_ref"; //Temporarily Removed + //shader_type = "Tessellation - Refraction"; //Temporarily Removed + //break; //Temporarily Removed + //default: + // shader_name = string.Empty; + // shader_type = string.Empty; + // break; + //} + + + #endregion + + #region Material Properties + + _UseTLB = ShaderGUI.FindProperty("_UseTLB", properties); + _Culling = ShaderGUI.FindProperty("_Culling", properties); + _TRANSMODE = ShaderGUI.FindProperty("_TRANSMODE", properties); + + _MainTex = ShaderGUI.FindProperty("_MainTex", properties); + _TexturePatternStyle = ShaderGUI.FindProperty("_TexturePatternStyle", properties); + + _MainColor = ShaderGUI.FindProperty("_MainColor", properties); + _MaiColPo = ShaderGUI.FindProperty("_MaiColPo", properties); + + _MVCOL = ShaderGUI.FindProperty("_MVCOL", properties); + _MCIALO = ShaderGUI.FindProperty("_MCIALO", properties); + + _MCapIntensity = ShaderGUI.FindProperty("_MCapIntensity", properties); + _MCap = ShaderGUI.FindProperty("_MCap", properties); + _SPECMODE = ShaderGUI.FindProperty("_SPECMODE", properties); + _SPECIN = ShaderGUI.FindProperty("_SPECIN", properties); + _MCapMask = ShaderGUI.FindProperty("_MCapMask", properties); + + _Cutout = ShaderGUI.FindProperty("_Cutout", properties); + _UseSecondaryCutout = ShaderGUI.FindProperty("_UseSecondaryCutout", properties); + _SecondaryCutout = ShaderGUI.FindProperty("_SecondaryCutout", properties); + _AlphaBaseCutout = ShaderGUI.FindProperty("_AlphaBaseCutout", properties); + _AAS = ShaderGUI.FindProperty("_AAS", properties); + _N_F_SCO = ShaderGUI.FindProperty("_N_F_SCO", properties); + _AlpToCov = ShaderGUI.FindProperty("_AlpToCov", properties); + + _N_F_COEDGL = ShaderGUI.FindProperty("_N_F_COEDGL", properties); + _Glow_Color = ShaderGUI.FindProperty("_Glow_Color", properties); + _Glow_Edge_Width = ShaderGUI.FindProperty("_Glow_Edge_Width", properties); + + _Opacity = ShaderGUI.FindProperty("_Opacity", properties); + _TransparentThreshold = ShaderGUI.FindProperty("_TransparentThreshold", properties); + _MaskTransparency = ShaderGUI.FindProperty("_MaskTransparency", properties); + _BleModSour = ShaderGUI.FindProperty("_BleModSour", properties); + _BleModDest = ShaderGUI.FindProperty("_BleModDest", properties); + + _SimTrans = ShaderGUI.FindProperty("_SimTrans", properties); + _TransAffSha = ShaderGUI.FindProperty("_TransAffSha", properties); + + _NormalMap = ShaderGUI.FindProperty("_NormalMap", properties); + _NormalMapIntensity = ShaderGUI.FindProperty("_NormalMapIntensity", properties); + + _Saturation = ShaderGUI.FindProperty("_Saturation", properties); + + _OutlineWidth = ShaderGUI.FindProperty("_OutlineWidth", properties); + _OutlineWidthControl = ShaderGUI.FindProperty("_OutlineWidthControl", properties); + _OutlineExtrudeMethod = ShaderGUI.FindProperty("_OutlineExtrudeMethod", properties); + _OutlineOffset = ShaderGUI.FindProperty("_OutlineOffset", properties); + _OutlineZPostionInCamera = ShaderGUI.FindProperty("_OutlineZPostionInCamera", properties); + _DoubleSidedOutline = ShaderGUI.FindProperty("_DoubleSidedOutline", properties); + _OutlineColor = ShaderGUI.FindProperty("_OutlineColor", properties); + _MixMainTexToOutline = ShaderGUI.FindProperty("_MixMainTexToOutline", properties); + _NoisyOutlineIntensity = ShaderGUI.FindProperty("_NoisyOutlineIntensity", properties); + _DynamicNoisyOutline = ShaderGUI.FindProperty("_DynamicNoisyOutline", properties); + _LightAffectOutlineColor = ShaderGUI.FindProperty("_LightAffectOutlineColor", properties); + _OutlineWidthAffectedByViewDistance = ShaderGUI.FindProperty("_OutlineWidthAffectedByViewDistance", properties); + _FarDistanceMaxWidth = ShaderGUI.FindProperty("_FarDistanceMaxWidth", properties); + _VertexColorBlueAffectOutlineWitdh = ShaderGUI.FindProperty("_VertexColorBlueAffectOutlineWitdh", properties); + _OutStenPass = ShaderGUI.FindProperty("_OutStenPass", properties); + + _DepthThreshold = ShaderGUI.FindProperty("_DepthThreshold", properties); + _N_F_MSSOLTFO = ShaderGUI.FindProperty("_N_F_MSSOLTFO", properties); + + _SelfLitIntensity = ShaderGUI.FindProperty("_SelfLitIntensity", properties); + _SelfLitColor = ShaderGUI.FindProperty("_SelfLitColor", properties); + _SelfLitPower = ShaderGUI.FindProperty("_SelfLitPower", properties); + _TEXMCOLINT = ShaderGUI.FindProperty("_TEXMCOLINT", properties); + _SelfLitHighContrast = ShaderGUI.FindProperty("_SelfLitHighContrast", properties); + _N_F_SLMM = ShaderGUI.FindProperty("_N_F_SLMM", properties); + _MaskSelfLit = ShaderGUI.FindProperty("_MaskSelfLit", properties); + + _GlossIntensity = ShaderGUI.FindProperty("_GlossIntensity", properties); + _Glossiness = ShaderGUI.FindProperty("_Glossiness", properties); + _GlossSoftness = ShaderGUI.FindProperty("_GlossSoftness", properties); + _GlossColor = ShaderGUI.FindProperty("_GlossColor", properties); + _GlossColorPower = ShaderGUI.FindProperty("_GlossColorPower", properties); + _MaskGloss = ShaderGUI.FindProperty("_MaskGloss", properties); + + _GlossTexture = ShaderGUI.FindProperty("_GlossTexture", properties); + _GlossTextureSoftness = ShaderGUI.FindProperty("_GlossTextureSoftness", properties); + _PSGLOTEX = ShaderGUI.FindProperty("_PSGLOTEX", properties); + _GlossTextureRotate = ShaderGUI.FindProperty("_GlossTextureRotate", properties); + _GlossTextureFollowObjectRotation = ShaderGUI.FindProperty("_GlossTextureFollowObjectRotation", properties); + _N_F_ANIS = ShaderGUI.FindProperty("_N_F_ANIS", properties); + _NoisTexInten = ShaderGUI.FindProperty("_NoisTexInten", properties); + _StraWidt = ShaderGUI.FindProperty("_StraWidt", properties); + _NoiTexAffStraWidt = ShaderGUI.FindProperty("_NoiTexAffStraWidt", properties); + _ShifAnis = ShaderGUI.FindProperty("_ShifAnis", properties); + _GlossTextureFollowLight = ShaderGUI.FindProperty("_GlossTextureFollowLight", properties); + + _OverallShadowColor = ShaderGUI.FindProperty("_OverallShadowColor", properties); + _OverallShadowColorPower = ShaderGUI.FindProperty("_OverallShadowColorPower", properties); + _SelfShadowShadowTAtViewDirection = ShaderGUI.FindProperty("_SelfShadowShadowTAtViewDirection", properties); + + _HighlightColor = ShaderGUI.FindProperty("_HighlightColor", properties); + _HighlightColorPower = ShaderGUI.FindProperty("_HighlightColorPower", properties); + + _SelfShadowThreshold = ShaderGUI.FindProperty("_SelfShadowThreshold", properties); + _VertexColorGreenControlSelfShadowThreshold = ShaderGUI.FindProperty("_VertexColorGreenControlSelfShadowThreshold", properties); + _SelfShadowHardness = ShaderGUI.FindProperty("_SelfShadowHardness", properties); + + _SelfShadowRealtimeShadowIntensity = ShaderGUI.FindProperty("_SelfShadowRealtimeShadowIntensity", properties); + + _SelfShadowRealTimeShadowColor = ShaderGUI.FindProperty("_SelfShadowRealTimeShadowColor", properties); + _SelfShadowRealTimeShadowColorPower = ShaderGUI.FindProperty("_SelfShadowRealTimeShadowColorPower", properties); + + _LigIgnoYNorDir = ShaderGUI.FindProperty("_LigIgnoYNorDir", properties); + _SelfShadowAffectedByLightShadowStrength = ShaderGUI.FindProperty("_SelfShadowAffectedByLightShadowStrength", properties); + + _SmoothObjectNormal = ShaderGUI.FindProperty("_SmoothObjectNormal", properties); + _VertexColorRedControlSmoothObjectNormal = ShaderGUI.FindProperty("_VertexColorRedControlSmoothObjectNormal", properties); + //_XYZPosition = ShaderGUI.FindProperty("_XYZPosition", properties); + _ShowNormal = ShaderGUI.FindProperty("_ShowNormal", properties); + + _ShadowColorTexture = ShaderGUI.FindProperty("_ShadowColorTexture", properties); + _ShadowColorTexturePower = ShaderGUI.FindProperty("_ShadowColorTexturePower", properties); + + _ShadowTIntensity = ShaderGUI.FindProperty("_ShadowTIntensity", properties); + _ShadowT = ShaderGUI.FindProperty("_ShadowT", properties); + _ShadowTLightThreshold = ShaderGUI.FindProperty("_ShadowTLightThreshold", properties); + _ShadowTShadowThreshold = ShaderGUI.FindProperty("_ShadowTShadowThreshold", properties); + _ShadowTColor = ShaderGUI.FindProperty("_ShadowTColor", properties); + _ShadowTColorPower = ShaderGUI.FindProperty("_ShadowTColorPower", properties); + _ShadowTHardness = ShaderGUI.FindProperty("_ShadowTHardness", properties); + _STIL = ShaderGUI.FindProperty("_STIL", properties); + _N_F_STIS = ShaderGUI.FindProperty("_N_F_STIS", properties); + _N_F_STIAL = ShaderGUI.FindProperty("_N_F_STIAL", properties); + _ShowInAmbientLightShadowIntensity = ShaderGUI.FindProperty("_ShowInAmbientLightShadowIntensity", properties); + _ShowInAmbientLightShadowThreshold = ShaderGUI.FindProperty("_ShowInAmbientLightShadowThreshold", properties); + + _LightFalloffAffectShadowT = ShaderGUI.FindProperty("_LightFalloffAffectShadowT", properties); + + _N_F_STSDFM = ShaderGUI.FindProperty("_N_F_STSDFM", properties); + + _PTexture = ShaderGUI.FindProperty("_PTexture", properties); + _PTCol = ShaderGUI.FindProperty("_PTCol", properties); + _PTexturePower = ShaderGUI.FindProperty("_PTexturePower", properties); + + _EnvironmentalLightingIntensity = ShaderGUI.FindProperty("_EnvironmentalLightingIntensity", properties); + _RELG = ShaderGUI.FindProperty("_RELG", properties); + + _GIFlatShade = ShaderGUI.FindProperty("_GIFlatShade", properties); + _GIShadeThreshold = ShaderGUI.FindProperty("_GIShadeThreshold", properties); + _LightAffectShadow = ShaderGUI.FindProperty("_LightAffectShadow", properties); + _LightIntensity = ShaderGUI.FindProperty("_LightIntensity", properties); + + _N_F_EAL = ShaderGUI.FindProperty("_N_F_EAL", properties); + + _DirectionalLightIntensity = ShaderGUI.FindProperty("_DirectionalLightIntensity", properties); + _PointSpotlightIntensity = ShaderGUI.FindProperty("_PointSpotlightIntensity", properties); + _LightFalloffSoftness = ShaderGUI.FindProperty("_LightFalloffSoftness", properties); + + _N_F_LLI = ShaderGUI.FindProperty("_N_F_LLI", properties); + _LLI_Min = ShaderGUI.FindProperty("_LLI_Min", properties); + _LLI_Max = ShaderGUI.FindProperty("_LLI_Max", properties); + + _ReduSha = ShaderGUI.FindProperty("_ReduSha", properties); + _ShadowHardness = ShaderGUI.FindProperty("_ShadowHardness", properties); + + _CustomLightDirectionIntensity = ShaderGUI.FindProperty("_CustomLightDirectionIntensity", properties); + _CustomLightDirectionFollowObjectRotation = ShaderGUI.FindProperty("_CustomLightDirectionFollowObjectRotation", properties); + _CustomLightDirection = ShaderGUI.FindProperty("_CustomLightDirection", properties); + + _ReflectionIntensity = ShaderGUI.FindProperty("_ReflectionIntensity", properties); + _Smoothness = ShaderGUI.FindProperty("_Smoothness", properties); + _RefMetallic = ShaderGUI.FindProperty("_RefMetallic", properties); + _MaskReflection = ShaderGUI.FindProperty("_MaskReflection", properties); + _FReflection = ShaderGUI.FindProperty("_FReflection", properties); + + _RimLigInt = ShaderGUI.FindProperty("_RimLigInt", properties); + _RimLightUnfill = ShaderGUI.FindProperty("_RimLightUnfill", properties); + _RimLightColor = ShaderGUI.FindProperty("_RimLightColor", properties); + _RimLightColorPower = ShaderGUI.FindProperty("_RimLightColorPower", properties); + _RimLightSoftness = ShaderGUI.FindProperty("_RimLightSoftness", properties); + _RimLightInLight = ShaderGUI.FindProperty("_RimLightInLight", properties); + _LightAffectRimLightColor = ShaderGUI.FindProperty("_LightAffectRimLightColor", properties); + + _MinFadDistance = ShaderGUI.FindProperty("_MinFadDistance", properties); + _MaxFadDistance = ShaderGUI.FindProperty("_MaxFadDistance", properties); + + _TriPlaTile = ShaderGUI.FindProperty("_TriPlaTile", properties); + _TriPlaBlend = ShaderGUI.FindProperty("_TriPlaBlend", properties); + + _PresAdju = ShaderGUI.FindProperty("_PresAdju", properties); + _ClipAdju = ShaderGUI.FindProperty("_ClipAdju", properties); + _PASize = ShaderGUI.FindProperty("_PASize", properties); + _PASmooTrans = ShaderGUI.FindProperty("_PASmooTrans", properties); + _PADist = ShaderGUI.FindProperty("_PADist", properties); + + //_NoiseSize = ShaderGUI.FindProperty("_NoiseSize", properties); + //_TrailSize = ShaderGUI.FindProperty("_TrailSize", properties); + + //if (shader_name == "tessellation_d" || shader_name == "tessellation_ft" || shader_name == "tessellation_ref") + //{ + // _TessellationSmoothness = ShaderGUI.FindProperty("_TessellationSmoothness", properties); + // _TessellationTransition = ShaderGUI.FindProperty("_TessellationTransition", properties); + // _TessellationNear = ShaderGUI.FindProperty("_TessellationNear", properties); + // _TessellationFar = ShaderGUI.FindProperty("_TessellationFar", properties); + //} + //else if (shader_name == "default_d" || shader_name == "default_ft" || shader_name == "default_ref") + //{ + + // _TessellationSmoothness = null; + // _TessellationTransition = null; + // _TessellationNear = null; + // _TessellationFar = null; + + //} + + _RefVal = ShaderGUI.FindProperty("_RefVal", properties); + _Oper = ShaderGUI.FindProperty("_Oper", properties); + _Compa = ShaderGUI.FindProperty("_Compa", properties); + + _N_F_MC = ShaderGUI.FindProperty("_N_F_MC", properties); + _N_F_NM = ShaderGUI.FindProperty("_N_F_NM", properties); + _N_F_CO = ShaderGUI.FindProperty("_N_F_CO", properties); + _N_F_O = ShaderGUI.FindProperty("_N_F_O", properties); + _N_F_CA = ShaderGUI.FindProperty("_N_F_CA", properties); + _N_F_SL = ShaderGUI.FindProperty("_N_F_SL", properties); + _N_F_GLO = ShaderGUI.FindProperty("_N_F_GLO", properties); + _N_F_GLOT = ShaderGUI.FindProperty("_N_F_GLOT", properties); + _N_F_SS = ShaderGUI.FindProperty("_N_F_SS", properties); + _N_F_SON = ShaderGUI.FindProperty("_N_F_SON", properties); + _N_F_SCT = ShaderGUI.FindProperty("_N_F_SCT", properties); + _N_F_ST = ShaderGUI.FindProperty("_N_F_ST", properties); + _N_F_PT = ShaderGUI.FindProperty("_N_F_PT", properties); + _N_F_CLD = ShaderGUI.FindProperty("_N_F_CLD", properties); + _N_F_R = ShaderGUI.FindProperty("_N_F_R", properties); + _N_F_FR = ShaderGUI.FindProperty("_N_F_FR", properties); + _N_F_RL = ShaderGUI.FindProperty("_N_F_RL", properties); + _N_F_NFD = ShaderGUI.FindProperty("_N_F_NFD", properties); + _N_F_TP = ShaderGUI.FindProperty("_N_F_TP", properties); + _N_F_PA = ShaderGUI.FindProperty("_N_F_PA", properties); + _N_F_SE = ShaderGUI.FindProperty("_N_F_SE", properties); + + _N_F_HDLS = ShaderGUI.FindProperty("_N_F_HDLS", properties); + _N_F_HPSS = ShaderGUI.FindProperty("_N_F_HPSS", properties); + + _N_F_DCS = ShaderGUI.FindProperty("_N_F_DCS", properties); + + _N_F_HDLS = ShaderGUI.FindProperty("_N_F_HDLS", properties); + _N_F_HPSS = ShaderGUI.FindProperty("_N_F_HPSS", properties); + _N_F_DCS = ShaderGUI.FindProperty("_N_F_DCS", properties); + _ZWrite = ShaderGUI.FindProperty("_ZWrite", properties); + + _N_F_NLASOBF = ShaderGUI.FindProperty("_N_F_NLASOBF", properties); + + _N_F_OFLMB = ShaderGUI.FindProperty("_N_F_OFLMB", properties); + + _N_F_ESSAO = ShaderGUI.FindProperty("_N_F_ESSAO", properties); + _SSAOColor = ShaderGUI.FindProperty("_SSAOColor", properties); + + _N_F_RDC = ShaderGUI.FindProperty("_N_F_RDC", properties); + + _N_F_DDMD = ShaderGUI.FindProperty("_N_F_DDMD", properties); + + #endregion + + + //UI + + #region UI + + //Header + Rect r_header = EditorGUILayout.BeginVertical("HelpBox"); + + Rect rect = new Rect(36, 11, t.width, t.height); + GUI.DrawTexture(rect, t, ScaleMode.ScaleToFit); + GUILayout.Space(32); + + EditorGUILayout.LabelField("(" + realtoon_version + " - " + srp_mode + " - " + shader_type + ")", EditorStyles.boldLabel); + + EditorGUILayout.EndVertical(); + + + if (ShowUI == true) + { + + GUILayout.Space(20); + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + + //Light Blend + + #region Light Blend + + Rect r_lightblend = EditorGUILayout.BeginVertical("HelpBox"); + EditorGUILayout.LabelField("Light Blend Style: " + LightBlendString); + EditorGUILayout.EndVertical(); + + switch ((int)_UseTLB.floatValue) + { + case 0: + LightBlendString = "Anime/Cartoon"; + break; + case 1: + LightBlendString = "Traditional"; + break; + default: + break; + } + + #endregion + + //Double Sided + + #region Culling + + Rect r_culling = EditorGUILayout.BeginVertical("HelpBox"); + materialEditor.ShaderProperty(_Culling, new GUIContent(_Culling.displayName, TOTIPS[0])); + EditorGUILayout.EndVertical(); + + #endregion + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + + GUILayout.Space(20); + + //Render Queue + + #region Transparent Mode + + Rect r_renderqueue = EditorGUILayout.BeginVertical("HelpBox"); + + EditorGUI.BeginChangeCheck(); + + materialEditor.ShaderProperty(_TRANSMODE, new GUIContent(_TRANSMODE.displayName, TOTIPS[11])); + + if (EditorGUI.EndChangeCheck()) + { + foreach (Material m in materialEditor.targets) + { + switch (_TRANSMODE.floatValue) + { + case 0: + + m.renderQueue = -1; + m.SetOverrideTag("RenderType", "Opaque"); + m.SetInt("_BleModSour", 1); + m.SetInt("_BleModDest", 0); + shader_type = "Default"; + break; + + case 1: + + m.SetInt("_BleModSour", 5); + m.SetInt("_BleModDest", 10); + + if (m.IsKeywordEnabled("N_F_CO_ON") || m.GetFloat("_N_F_CO") == 1.0f) + { + m.renderQueue = 2450; + m.SetOverrideTag("RenderType", "TransparentCutout"); + } + else + { + m.renderQueue = 3000; + m.SetOverrideTag("RenderType", "Transparent"); + } + + shader_type = "Fade Transperancy"; + break; + + default: + break; + } + + } + + materialEditor.PropertiesChanged(); + + } + + EditorGUILayout.EndVertical(); + + #endregion + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + + GUILayout.Space(20); + + //Texture - Color + + #region Texture - Color + + Rect r_texturecolor = EditorGUILayout.BeginVertical("Button"); + + ShowTextureColor = EditorGUILayout.Foldout(ShowTextureColor, "(Texture - Color)", true, EditorStyles.foldout); + + if (ShowTextureColor) + { + + GUILayout.Space(10); + + materialEditor.ShaderProperty(_MainTex, new GUIContent(_MainTex.displayName, TOTIPS[1])); + + EditorGUI.BeginDisabledGroup(_MainTex.textureValue == null); + materialEditor.ShaderProperty(_TexturePatternStyle, new GUIContent(_TexturePatternStyle.displayName, TOTIPS[2])); + EditorGUI.EndDisabledGroup(); + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + + materialEditor.ShaderProperty(_MainColor, new GUIContent(_MainColor.displayName, TOTIPS[3])); + materialEditor.ShaderProperty(_MaiColPo, new GUIContent(_MaiColPo.displayName, TOTIPS[8])); + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + materialEditor.ShaderProperty(_MVCOL, new GUIContent(_MVCOL.displayName, TOTIPS[4])); + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + materialEditor.ShaderProperty(_MCIALO, new GUIContent(_MCIALO.displayName, TOTIPS[5])); + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + + materialEditor.ShaderProperty(_HighlightColor, new GUIContent(_HighlightColor.displayName, TOTIPS[6])); + materialEditor.ShaderProperty(_HighlightColorPower, new GUIContent(_HighlightColorPower.displayName, TOTIPS[7])); + + GUILayout.Space(10); + + } + + EditorGUILayout.EndVertical(); + + #endregion + + //MatCap + + #region MatCap + + if (_N_F_MC.floatValue == 1) + { + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + + Rect r_matcap = EditorGUILayout.BeginVertical("Button"); + ShowMatCap = EditorGUILayout.Foldout(ShowMatCap, "(MatCap)", true, EditorStyles.foldout); + + if (ShowMatCap) + { + + GUILayout.Space(10); + + materialEditor.ShaderProperty(_MCapIntensity, new GUIContent(_MCapIntensity.displayName, TOTIPS[13])); + materialEditor.ShaderProperty(_MCap, _MCap.displayName); + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + + materialEditor.ShaderProperty(_SPECMODE, new GUIContent(_SPECMODE.displayName, TOTIPS[14])); + EditorGUI.BeginDisabledGroup(_SPECMODE.floatValue == 0); + materialEditor.ShaderProperty(_SPECIN, new GUIContent(_SPECIN.displayName, TOTIPS[15])); + EditorGUI.EndDisabledGroup(); + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + + materialEditor.ShaderProperty(_MCapMask, new GUIContent(_MCapMask.displayName, TOTIPS[16])); + + GUILayout.Space(10); + + } + + EditorGUILayout.EndVertical(); + } + + #endregion + + //Cutout + + #region Cutout + + if (_TRANSMODE.floatValue == 1) + { + if (_N_F_CO.floatValue == 1) + { + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + + EditorGUI.BeginDisabledGroup(_N_F_CO.floatValue == 0); + + Rect r_cutout = EditorGUILayout.BeginVertical("Button"); + ShowCutout = EditorGUILayout.Foldout(ShowCutout, "(Cutout)", true, EditorStyles.foldout); + + if (ShowCutout) + { + + GUILayout.Space(10); + + materialEditor.ShaderProperty(_Cutout, new GUIContent(_Cutout.displayName, TOTIPS[17])); + materialEditor.ShaderProperty(_AlphaBaseCutout, new GUIContent(_AlphaBaseCutout.displayName, TOTIPS[18])); + materialEditor.ShaderProperty(_N_F_SCO, new GUIContent(_N_F_SCO.displayName, TOTIPS[154])); + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + + materialEditor.ShaderProperty(_AlpToCov, new GUIContent(_AlpToCov.displayName, TOTIPS[164])); + + EditorGUI.BeginDisabledGroup(_AlpToCov.floatValue == 0.0f); + materialEditor.ShaderProperty(_AAS, new GUIContent(_AAS.displayName, TOTIPS[174])); + EditorGUI.EndDisabledGroup(); + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + + materialEditor.ShaderProperty(_UseSecondaryCutout, new GUIContent(_UseSecondaryCutout.displayName, TOTIPS[19])); + materialEditor.ShaderProperty(_SecondaryCutout, new GUIContent(_SecondaryCutout.displayName, TOTIPS[20])); + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + + materialEditor.ShaderProperty(_N_F_COEDGL, _N_F_COEDGL.displayName); + EditorGUI.BeginDisabledGroup(_N_F_COEDGL.floatValue == 0.0f); + materialEditor.ShaderProperty(_Glow_Color, new GUIContent(_Glow_Color.displayName, TOTIPS[148])); + materialEditor.ShaderProperty(_Glow_Edge_Width, new GUIContent(_Glow_Edge_Width.displayName, TOTIPS[149])); + EditorGUI.EndDisabledGroup(); + + GUILayout.Space(10); + + } + + EditorGUILayout.EndVertical(); + + EditorGUI.EndDisabledGroup(); + } + } + + #endregion + + //Transperancy + + #region Transperancy + + if (_TRANSMODE.floatValue == 1) + { + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + + EditorGUI.BeginDisabledGroup(_N_F_CO.floatValue == 1); + + Rect r_transparency = EditorGUILayout.BeginVertical("Button"); + ShowTransparency = EditorGUILayout.Foldout(ShowTransparency, "(Transparency)", true, EditorStyles.foldout); + + if (ShowTransparency) + { + + GUILayout.Space(10); + materialEditor.ShaderProperty(_SimTrans, new GUIContent(_SimTrans.displayName, TOTIPS[150])); + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + + materialEditor.ShaderProperty(_Opacity, new GUIContent(_Opacity.displayName, TOTIPS[21])); + + EditorGUI.BeginDisabledGroup(_SimTrans.floatValue == 1); + materialEditor.ShaderProperty(_TransparentThreshold, new GUIContent(_TransparentThreshold.displayName, TOTIPS[22])); + EditorGUI.EndDisabledGroup(); + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + + materialEditor.ShaderProperty(_BleModSour, new GUIContent(_BleModSour.displayName, TOTIPS[9])); + materialEditor.ShaderProperty(_BleModDest, new GUIContent(_BleModDest.displayName, TOTIPS[10])); + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + + materialEditor.ShaderProperty(_TransAffSha, new GUIContent(_TransAffSha.displayName, TOTIPS[74])); + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + + EditorGUI.BeginDisabledGroup(_SimTrans.floatValue == 1); + materialEditor.ShaderProperty(_MaskTransparency, new GUIContent(_MaskTransparency.displayName, TOTIPS[23])); + EditorGUI.EndDisabledGroup(); + + GUILayout.Space(10); + + } + + EditorGUI.EndDisabledGroup(); + + EditorGUILayout.EndVertical(); + } + + #endregion + + //Normal Map + + #region Normal Map + + if (_N_F_NM.floatValue == 1) + { + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + + Rect r_normalmap = EditorGUILayout.BeginVertical("Button"); + ShowNormalMap = EditorGUILayout.Foldout(ShowNormalMap, "(Normal Map)", true, EditorStyles.foldout); + + if (ShowNormalMap) + { + GUILayout.Space(10); + + materialEditor.ShaderProperty(_NormalMap, new GUIContent(_NormalMap.displayName, TOTIPS[24])); + + EditorGUI.BeginDisabledGroup(_NormalMap.textureValue == null); + materialEditor.ShaderProperty(_NormalMapIntensity, new GUIContent(_NormalMapIntensity.displayName, TOTIPS[25])); + EditorGUI.EndDisabledGroup(); + + GUILayout.Space(10); + + } + + EditorGUILayout.EndVertical(); + + } + #endregion + + //Color Adjustment + + #region Color Adjustment + + if (_N_F_CA.floatValue == 1) + { + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + + Rect r_cadjustment = EditorGUILayout.BeginVertical("Button"); + ShowColorAdjustment = EditorGUILayout.Foldout(ShowColorAdjustment, "Color Adjustment", true, EditorStyles.foldout); + + if (ShowColorAdjustment) + { + + GUILayout.Space(10); + + materialEditor.ShaderProperty(_Saturation, new GUIContent(_Saturation.displayName, TOTIPS[26])); + + GUILayout.Space(10); + + } + + EditorGUILayout.EndVertical(); ; + + } + + #endregion + + //Outline + + #region Outline + + if (remoout == true) + { + + if (_N_F_O.floatValue == 1) + { + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + + Rect r_outline = EditorGUILayout.BeginVertical("Button"); + ShowOutline = EditorGUILayout.Foldout(ShowOutline, "(Outline - " + OLType + ")", true, EditorStyles.foldout); + + + if (ShowOutline) + { + + GUILayout.Space(10); + + EditorGUI.BeginDisabledGroup(_TRANSMODE.floatValue == 1 && _N_F_CO.floatValue == 0 && UseSSOL == false); + materialEditor.ShaderProperty(_OutlineWidth, new GUIContent(_OutlineWidth.displayName, TOTIPS[8])); + EditorGUI.EndDisabledGroup(); + + if (UseSSOL == true) + { + + materialEditor.ShaderProperty(_OutlineWidthControl, new GUIContent(_OutlineWidthControl.displayName, TOTIPS[28])); + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + + materialEditor.ShaderProperty(_OutlineExtrudeMethod, new GUIContent(_OutlineExtrudeMethod.displayName, TOTIPS[29])); + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + materialEditor.ShaderProperty(_OutlineOffset, new GUIContent(_OutlineOffset.displayName, TOTIPS[30])); + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + materialEditor.ShaderProperty(_OutlineZPostionInCamera, new GUIContent(_OutlineZPostionInCamera.displayName, TOTIPS[123])); + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + materialEditor.ShaderProperty(_DoubleSidedOutline, new GUIContent(_DoubleSidedOutline.displayName, TOTIPS[31])); + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + materialEditor.ShaderProperty(_OutlineColor, new GUIContent(_OutlineColor.displayName, TOTIPS[32])); + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + materialEditor.ShaderProperty(_MixMainTexToOutline, new GUIContent(_MixMainTexToOutline.displayName, TOTIPS[33])); + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + materialEditor.ShaderProperty(_NoisyOutlineIntensity, new GUIContent(_NoisyOutlineIntensity.displayName, TOTIPS[34])); + materialEditor.ShaderProperty(_DynamicNoisyOutline, new GUIContent(_DynamicNoisyOutline.displayName, TOTIPS[35])); + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + materialEditor.ShaderProperty(_LightAffectOutlineColor, new GUIContent(_LightAffectOutlineColor.displayName, TOTIPS[36])); + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + materialEditor.ShaderProperty(_OutlineWidthAffectedByViewDistance, new GUIContent(_OutlineWidthAffectedByViewDistance.displayName, TOTIPS[37])); + EditorGUI.BeginDisabledGroup(_OutlineWidthAffectedByViewDistance.floatValue == 0); + materialEditor.ShaderProperty(_FarDistanceMaxWidth, new GUIContent(_FarDistanceMaxWidth.displayName, TOTIPS[38])); + EditorGUI.EndDisabledGroup(); + + GUILayout.Space(10); + + materialEditor.ShaderProperty(_VertexColorBlueAffectOutlineWitdh, new GUIContent(_VertexColorBlueAffectOutlineWitdh.displayName, TOTIPS[39])); + + } + else + { + EditorGUI.BeginDisabledGroup(_TRANSMODE.floatValue == 1 && _N_F_CO.floatValue == 0); + materialEditor.ShaderProperty(_OutlineColor, new GUIContent(_OutlineColor.displayName, TOTIPS[28])); + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + + materialEditor.ShaderProperty(_N_F_MSSOLTFO, new GUIContent(_N_F_MSSOLTFO.displayName, TOTIPS[140])); + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + + materialEditor.ShaderProperty(_DepthThreshold, new GUIContent(_DepthThreshold.displayName, TOTIPS[122])); + EditorGUI.EndDisabledGroup(); + + } + + if (add_st == true) + { + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + materialEditor.ShaderProperty(_OutStenPass, new GUIContent(_OutStenPass.displayName, TOTIPS[170])); + } + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + + if (GUILayout.Button(new GUIContent(UseSSOLStat, TOTIPS[142]), "Button")) + { + USSOL_OR_TOL(); + } + + GUILayout.Space(10); + + } + + EditorGUILayout.EndVertical(); + + } + + } + + #endregion + + //Self Lit + + #region SelfLit + + if (_N_F_SL.floatValue == 1) + { + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + + Rect r_selflit = EditorGUILayout.BeginVertical("Button"); + ShowSelfLit = EditorGUILayout.Foldout(ShowSelfLit, "(Self Lit)", true, EditorStyles.foldout); + + if (ShowSelfLit) + { + + GUILayout.Space(10); + + materialEditor.ShaderProperty(_SelfLitIntensity, new GUIContent(_SelfLitIntensity.displayName, TOTIPS[40])); + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + + materialEditor.ShaderProperty(_SelfLitColor, new GUIContent(_SelfLitColor.displayName, TOTIPS[41])); + materialEditor.ShaderProperty(_SelfLitPower, new GUIContent(_SelfLitPower.displayName, TOTIPS[42])); + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + + materialEditor.ShaderProperty(_TEXMCOLINT, new GUIContent(_TEXMCOLINT.displayName, TOTIPS[43])); + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + + EditorGUI.BeginDisabledGroup(_N_F_SLMM.floatValue == 1); + materialEditor.ShaderProperty(_SelfLitHighContrast, new GUIContent(_SelfLitHighContrast.displayName, TOTIPS[44])); + EditorGUI.EndDisabledGroup(); + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + + materialEditor.ShaderProperty(_N_F_SLMM, new GUIContent(_N_F_SLMM.displayName, TOTIPS[175])); + + GUILayout.Space(1); + + if (_N_F_SLMM.floatValue == 1) + { + materialEditor.ShaderProperty(_MaskSelfLit, new GUIContent("Self Lit Map", TOTIPS[176])); + } + else + { + materialEditor.ShaderProperty(_MaskSelfLit, new GUIContent(_MaskSelfLit.displayName, TOTIPS[45])); + } + + GUILayout.Space(10); + + } + + EditorGUILayout.EndVertical(); + + } + #endregion + + //Gloss + + #region Gloss + + if (_N_F_OFLMB.floatValue == 0) + { + + if (_N_F_GLO.floatValue == 1) + { + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + + Rect r_gloss = EditorGUILayout.BeginVertical("Button"); + ShowGloss = EditorGUILayout.Foldout(ShowGloss, "(Gloss)", true, EditorStyles.foldout); + + if (ShowGloss) + { + + GUILayout.Space(10); + + materialEditor.ShaderProperty(_GlossIntensity, new GUIContent(_GlossIntensity.displayName, TOTIPS[46])); + + EditorGUI.BeginDisabledGroup(_N_F_GLOT.floatValue == 1); + materialEditor.ShaderProperty(_Glossiness, new GUIContent(_Glossiness.displayName, TOTIPS[47])); + EditorGUI.EndDisabledGroup(); + + materialEditor.ShaderProperty(_GlossSoftness, new GUIContent(_GlossSoftness.displayName, TOTIPS[48])); + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + + materialEditor.ShaderProperty(_GlossColor, new GUIContent(_GlossColor.displayName, TOTIPS[49])); + materialEditor.ShaderProperty(_GlossColorPower, new GUIContent(_GlossColorPower.displayName, TOTIPS[50])); + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); ; + + materialEditor.ShaderProperty(_MaskGloss, new GUIContent(_MaskGloss.displayName, TOTIPS[51])); + + GUILayout.Space(10); + + //Gloss Texture + + #region Gloss Texture + + if (_N_F_GLOT.floatValue == 1) + { + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + + Rect r_glosstexture = EditorGUILayout.BeginVertical("Button"); + GUILayout.Label("Gloss Texture", EditorStyles.boldLabel); + EditorGUILayout.EndVertical(); + + if (_N_F_GLOT.floatValue == 1) + { + + GUILayout.Space(10); + + materialEditor.ShaderProperty(_GlossTexture, new GUIContent(_GlossTexture.displayName, TOTIPS[52])); + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + + materialEditor.ShaderProperty(_N_F_ANIS, new GUIContent(_N_F_ANIS.displayName, TOTIPS[165])); + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + + + if (_N_F_ANIS.floatValue == 1) + { + + materialEditor.ShaderProperty(_NoisTexInten, new GUIContent(_NoisTexInten.displayName, TOTIPS[166])); + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + + materialEditor.ShaderProperty(_StraWidt, new GUIContent(_StraWidt.displayName, TOTIPS[167])); + materialEditor.ShaderProperty(_NoiTexAffStraWidt, new GUIContent(_NoiTexAffStraWidt.displayName, TOTIPS[169])); + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + + materialEditor.ShaderProperty(_ShifAnis, new GUIContent(_ShifAnis.displayName, TOTIPS[168])); + materialEditor.ShaderProperty(_GlossTextureFollowLight, new GUIContent(_GlossTextureFollowLight.displayName, TOTIPS[57])); + + } + else if (_N_F_ANIS.floatValue == 0) + { + + EditorGUI.BeginDisabledGroup(_GlossTexture.textureValue == null); + materialEditor.ShaderProperty(_GlossTextureSoftness, new GUIContent(_GlossTextureSoftness.displayName, TOTIPS[53])); + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + + materialEditor.ShaderProperty(_PSGLOTEX, new GUIContent(_PSGLOTEX.displayName, TOTIPS[54])); + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + + EditorGUI.BeginDisabledGroup(_PSGLOTEX.floatValue == 1); + materialEditor.ShaderProperty(_GlossTextureRotate, new GUIContent(_GlossTextureRotate.displayName, TOTIPS[55])); + materialEditor.ShaderProperty(_GlossTextureFollowObjectRotation, new GUIContent(_GlossTextureFollowObjectRotation.displayName, TOTIPS[56])); + materialEditor.ShaderProperty(_GlossTextureFollowLight, new GUIContent(_GlossTextureFollowLight.displayName, TOTIPS[57])); + EditorGUI.EndDisabledGroup(); + + EditorGUI.EndDisabledGroup(); + } + + } + + GUILayout.Space(10); + + } + #endregion + + } + + EditorGUILayout.EndVertical(); + + } + + } + + #endregion + + //Shadow + + #region Shadow + + if (_N_F_OFLMB.floatValue == 0) + { + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + + Rect r_shadow = EditorGUILayout.BeginVertical("Button"); + ShowShadow = EditorGUILayout.Foldout(ShowShadow, "(Shadow)", true, EditorStyles.foldout); + + if (ShowShadow) + { + + GUILayout.Space(10); + + materialEditor.ShaderProperty(_OverallShadowColor, new GUIContent(_OverallShadowColor.displayName, TOTIPS[58])); + materialEditor.ShaderProperty(_OverallShadowColorPower, new GUIContent(_OverallShadowColorPower.displayName, TOTIPS[59])); + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + + materialEditor.ShaderProperty(_SelfShadowShadowTAtViewDirection, new GUIContent(_SelfShadowShadowTAtViewDirection.displayName, TOTIPS[60])); + materialEditor.ShaderProperty(_LigIgnoYNorDir, new GUIContent(_LigIgnoYNorDir.displayName, TOTIPS[144])); + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + + materialEditor.ShaderProperty(_ReduSha, new GUIContent(_ReduSha.displayName, TOTIPS[63])); + + if (_N_F_HDLS.floatValue == 0 || _N_F_HPSS.floatValue == 0) + { + GUILayout.Space(10); + materialEditor.ShaderProperty(_ShadowHardness, new GUIContent(_ShadowHardness.displayName, TOTIPS[64])); + } + + switch ((int)_N_F_SS.floatValue) + { + case 0: + materialEditor.ShaderProperty(_SelfShadowRealtimeShadowIntensity, new GUIContent("Realtime Shadow Intensity", TOTIPS[124])); + break; + case 1: + materialEditor.ShaderProperty(_SelfShadowRealtimeShadowIntensity, new GUIContent(_SelfShadowRealtimeShadowIntensity.displayName, TOTIPS[126])); + break; + default: + break; + } + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + + materialEditor.ShaderProperty(_N_F_ESSAO, new GUIContent(_N_F_ESSAO.displayName, TOTIPS[145])); + EditorGUI.BeginDisabledGroup(_N_F_ESSAO.floatValue == 0.0f); + materialEditor.ShaderProperty(_SSAOColor, new GUIContent(_SSAOColor.displayName, TOTIPS[146])); + EditorGUI.EndDisabledGroup(); + + + //Self Shadow + + #region Self Shadow + + if (_N_F_SS.floatValue == 1) + { + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + + Rect r_selfshadow = EditorGUILayout.BeginVertical("Button"); + GUILayout.Label("Self Shadow", EditorStyles.boldLabel); + EditorGUILayout.EndVertical(); + + if (_N_F_SS.floatValue == 1) + { + + GUILayout.Space(10); + + materialEditor.ShaderProperty(_SelfShadowThreshold, new GUIContent(_SelfShadowThreshold.displayName, TOTIPS[65])); + + materialEditor.ShaderProperty(_VertexColorGreenControlSelfShadowThreshold, new GUIContent(_VertexColorGreenControlSelfShadowThreshold.displayName, TOTIPS[66])); + + materialEditor.ShaderProperty(_SelfShadowHardness, new GUIContent(_SelfShadowHardness.displayName, TOTIPS[67])); + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + + materialEditor.ShaderProperty(_SelfShadowRealTimeShadowColor, new GUIContent(_SelfShadowRealTimeShadowColor.displayName, TOTIPS[68])); + materialEditor.ShaderProperty(_SelfShadowRealTimeShadowColorPower, new GUIContent(_SelfShadowRealTimeShadowColorPower.displayName, TOTIPS[69])); + + GUILayout.Space(10); + materialEditor.ShaderProperty(_SelfShadowAffectedByLightShadowStrength, new GUIContent(_SelfShadowAffectedByLightShadowStrength.displayName, TOTIPS[70])); + + } + + GUILayout.Space(10); + + } + #endregion + + //Smooth Object Normal + + #region Smooth Object Normal + + if (_N_F_SON.floatValue == 1) + { + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + + Rect r_smoothobjectnormal = EditorGUILayout.BeginVertical("Button"); + GUILayout.Label("Smooth Object Normal", EditorStyles.boldLabel); + EditorGUILayout.EndVertical(); + + if (_N_F_SON.floatValue == 1) + { + + GUILayout.Space(10); + + materialEditor.ShaderProperty(_SmoothObjectNormal, new GUIContent(_SmoothObjectNormal.displayName, TOTIPS[71])); + + materialEditor.ShaderProperty(_VertexColorRedControlSmoothObjectNormal, new GUIContent(_VertexColorRedControlSmoothObjectNormal.displayName, TOTIPS[72])); + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + + //materialEditor.ShaderProperty(_XYZPosition, new GUIContent(_XYZPosition.displayName, TOTIPS[73])); + + materialEditor.ShaderProperty(_ShowNormal, new GUIContent(_ShowNormal.displayName, TOTIPS[75])); + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + EditorGUI.BeginDisabledGroup(true); + EditorGUILayout.TextArea("Add the 'Smooth Object Normal - Helper' component to your object for this to work.\n\nTo Add:\nClick your object then click 'Add Component'\nthen 'RealToon>Tool>Smooth Object Normal - Helper.", EditorStyles.label, GUILayout.ExpandWidth(true)); + EditorGUI.EndDisabledGroup(); + + } + + GUILayout.Space(10); + + } + + #endregion + + //Shadow Color Texture + + #region Shadow Color Texture + + if (_N_F_SCT.floatValue == 1) + { + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + + Rect r_shadowcolortexture = EditorGUILayout.BeginVertical("Button"); + GUILayout.Label("Shadow Color Texture", EditorStyles.boldLabel); + EditorGUILayout.EndVertical(); + + if (_N_F_SCT.floatValue == 1) + { + + GUILayout.Space(10); + + materialEditor.ShaderProperty(_ShadowColorTexture, new GUIContent(_ShadowColorTexture.displayName, TOTIPS[76])); + materialEditor.ShaderProperty(_ShadowColorTexturePower, new GUIContent(_ShadowColorTexturePower.displayName, TOTIPS[77])); + } + + GUILayout.Space(10); + + } + + #endregion + + //ShadowT + + #region ShadowT + + if (_N_F_ST.floatValue == 1) + { + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + + Rect r_shadowt = EditorGUILayout.BeginVertical("Button"); + GUILayout.Label("ShadowT", EditorStyles.boldLabel); + EditorGUILayout.EndVertical(); + + if (_N_F_ST.floatValue == 1) + { + GUILayout.Space(10); + + materialEditor.ShaderProperty(_ShadowTIntensity, new GUIContent(_ShadowTIntensity.displayName, TOTIPS[78])); + materialEditor.ShaderProperty(_ShadowT, new GUIContent(_ShadowT.displayName, TOTIPS[79])); + materialEditor.ShaderProperty(_ShadowTLightThreshold, new GUIContent(_ShadowTLightThreshold.displayName, TOTIPS[80])); + + if (_N_F_STSDFM.floatValue == 0) + { + materialEditor.ShaderProperty(_ShadowTShadowThreshold, new GUIContent(_ShadowTShadowThreshold.displayName, TOTIPS[81])); + } + + materialEditor.ShaderProperty(_ShadowTHardness, new GUIContent(_ShadowTHardness.displayName, TOTIPS[82])); + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + materialEditor.ShaderProperty(_ShadowTColor, new GUIContent(_ShadowTColor.displayName, TOTIPS[129])); + materialEditor.ShaderProperty(_ShadowTColorPower, new GUIContent(_ShadowTColorPower.displayName, TOTIPS[130])); + + if (_N_F_STSDFM.floatValue == 0) + { + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + materialEditor.ShaderProperty(_STIL, new GUIContent(_STIL.displayName, TOTIPS[131])); + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + materialEditor.ShaderProperty(_N_F_STIS, new GUIContent(_N_F_STIS.displayName, TOTIPS[83])); + materialEditor.ShaderProperty(_N_F_STIAL, new GUIContent(_N_F_STIAL.displayName, TOTIPS[84])); + + EditorGUI.BeginDisabledGroup(_N_F_STIAL.floatValue == 0 && _N_F_STIS.floatValue == 0); + materialEditor.ShaderProperty(_ShowInAmbientLightShadowIntensity, new GUIContent(_ShowInAmbientLightShadowIntensity.displayName, TOTIPS[85])); + EditorGUI.EndDisabledGroup(); + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + materialEditor.ShaderProperty(_ShowInAmbientLightShadowThreshold, new GUIContent(_ShowInAmbientLightShadowThreshold.displayName, TOTIPS[86])); + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + materialEditor.ShaderProperty(_LightFalloffAffectShadowT, new GUIContent(_LightFalloffAffectShadowT.displayName, TOTIPS[87])); + } + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + materialEditor.ShaderProperty(_N_F_STSDFM, new GUIContent(_N_F_STSDFM.displayName, TOTIPS[162])); + + if (_N_F_STSDFM.floatValue == 1) + { + GUILayout.Space(10); + + EditorGUI.BeginDisabledGroup(true); + EditorGUILayout.TextArea("Add the 'ShadowT SDF Mode - Helper' component to your object for this to work.\n\nTo Add:\nClick your object then click 'Add Component'\nthen 'RealToon>Tool>ShadowT SDF Mode - Helper.", EditorStyles.label, GUILayout.ExpandWidth(true)); + EditorGUI.EndDisabledGroup(); + } + + } + + GUILayout.Space(10); + + } + + #endregion + + //Shadow PTexture + + #region PTexture + + if (_N_F_PT.floatValue == 1) + { + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + + Rect r_ptexture = EditorGUILayout.BeginVertical("Button"); + GUILayout.Label("PTexture", EditorStyles.boldLabel); + EditorGUILayout.EndVertical(); + + GUILayout.Space(10); + + if (_N_F_PT.floatValue == 1) + { + materialEditor.ShaderProperty(_PTexture, new GUIContent(_PTexture.displayName, TOTIPS[88])); + materialEditor.ShaderProperty(_PTexturePower, new GUIContent(_PTexturePower.displayName, TOTIPS[89])); + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + + materialEditor.ShaderProperty(_PTCol, new GUIContent(_PTCol.displayName, TOTIPS[122])); + } + + GUILayout.Space(10); + + } + + #endregion + + } + + EditorGUILayout.EndVertical(); + + } + + #endregion + + //Lighting + + #region Lighting + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + + Rect r_lighting = EditorGUILayout.BeginVertical("Button"); + ShowLighting = EditorGUILayout.Foldout(ShowLighting, "(Lighting)", true, EditorStyles.foldout); + + if (ShowLighting) + { + + GUILayout.Space(10); + + materialEditor.ShaderProperty(_RELG, new GUIContent(_RELG.displayName, TOTIPS[90])); + EditorGUI.BeginDisabledGroup(_RELG.floatValue == 0); + materialEditor.ShaderProperty(_EnvironmentalLightingIntensity, new GUIContent(_EnvironmentalLightingIntensity.displayName, TOTIPS[91])); + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + + materialEditor.ShaderProperty(_GIFlatShade, new GUIContent(_GIFlatShade.displayName, TOTIPS[92])); + materialEditor.ShaderProperty(_GIShadeThreshold, new GUIContent(_GIShadeThreshold.displayName, TOTIPS[93])); + EditorGUI.EndDisabledGroup(); + + if (_N_F_OFLMB.floatValue == 0) + { + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + + materialEditor.ShaderProperty(_LightAffectShadow, new GUIContent(_LightAffectShadow.displayName, TOTIPS[94])); + EditorGUI.BeginDisabledGroup(_LightAffectShadow.floatValue == 0); + materialEditor.ShaderProperty(_LightIntensity, new GUIContent(_LightIntensity.displayName, TOTIPS[132])); + EditorGUI.EndDisabledGroup(); + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + materialEditor.ShaderProperty(_UseTLB, new GUIContent(_UseTLB.displayName, TOTIPS[134])); + materialEditor.ShaderProperty(_N_F_EAL, new GUIContent(_N_F_EAL.displayName, TOTIPS[133])); + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + materialEditor.ShaderProperty(_DirectionalLightIntensity, new GUIContent(_DirectionalLightIntensity.displayName, TOTIPS[95])); + EditorGUI.BeginDisabledGroup(_N_F_EAL.floatValue == 0); + materialEditor.ShaderProperty(_PointSpotlightIntensity, new GUIContent(_PointSpotlightIntensity.displayName, TOTIPS[96])); + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + materialEditor.ShaderProperty(_LightFalloffSoftness, new GUIContent(_LightFalloffSoftness.displayName, TOTIPS[97])); + EditorGUI.EndDisabledGroup(); + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + materialEditor.ShaderProperty(_N_F_LLI, new GUIContent(_N_F_LLI.displayName, TOTIPS[171])); + GUILayout.Space(5); + EditorGUI.BeginDisabledGroup(_N_F_LLI.floatValue == 0); + materialEditor.ShaderProperty(_LLI_Min, new GUIContent(_LLI_Min.displayName, TOTIPS[172])); + materialEditor.ShaderProperty(_LLI_Max, new GUIContent(_LLI_Max.displayName, TOTIPS[173])); + EditorGUI.EndDisabledGroup(); + + GUILayout.Space(10); + + //Custom Light Direction + + #region Custom Light Direction + + if (_N_F_CLD.floatValue == 1) + { + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + + EditorGUI.BeginDisabledGroup(_N_F_CLD.floatValue == 0); + + Rect r_customlightdirection = EditorGUILayout.BeginVertical("Button"); + GUILayout.Label("Custom Light Direction", EditorStyles.boldLabel); + EditorGUILayout.EndVertical(); + + if (_N_F_CLD.floatValue == 1) + { + + GUILayout.Space(10); + + materialEditor.ShaderProperty(_CustomLightDirectionIntensity, new GUIContent(_CustomLightDirectionIntensity.displayName, TOTIPS[98])); + materialEditor.ShaderProperty(_CustomLightDirection, new GUIContent(_CustomLightDirection.displayName, TOTIPS[99])); + materialEditor.ShaderProperty(_CustomLightDirectionFollowObjectRotation, new GUIContent(_CustomLightDirectionFollowObjectRotation.displayName, TOTIPS[100])); + + } + + EditorGUI.EndDisabledGroup(); + + GUILayout.Space(10); + + } + + #endregion + + } + + GUILayout.Space(10); + } + + EditorGUILayout.EndVertical(); + + #endregion + + //Reflection + + #region Reflection + + if (_N_F_R.floatValue == 1) + { + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + + Rect r_reflection = EditorGUILayout.BeginVertical("Button"); + ShowReflection = EditorGUILayout.Foldout(ShowReflection, "(Reflection)", true, EditorStyles.foldout); + + if (ShowReflection) + { + + GUILayout.Space(10); + + materialEditor.ShaderProperty(_ReflectionIntensity, new GUIContent(_ReflectionIntensity.displayName, TOTIPS[101])); + materialEditor.ShaderProperty(_Smoothness, new GUIContent(_Smoothness.displayName, TOTIPS[102])); + materialEditor.ShaderProperty(_RefMetallic, new GUIContent(_RefMetallic.displayName, TOTIPS[103])); + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + + materialEditor.ShaderProperty(_MaskReflection, new GUIContent(_MaskReflection.displayName, TOTIPS[104])); + + GUILayout.Space(10); + + //FReflection + + #region FReflection + + if (_N_F_FR.floatValue == 1) + { + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + + EditorGUI.BeginDisabledGroup(_N_F_FR.floatValue == 0); + + Rect r_freflection = EditorGUILayout.BeginVertical("Button"); + GUILayout.Label("FReflection", EditorStyles.boldLabel); + EditorGUILayout.EndVertical(); + + materialEditor.ShaderProperty(_FReflection, new GUIContent(_FReflection.displayName, TOTIPS[105])); + + EditorGUI.EndDisabledGroup(); + + GUILayout.Space(10); + } + + } + + #endregion + + EditorGUILayout.EndVertical(); + } + + #endregion + + // Rim Light + + #region Rim Light + + if (_N_F_RL.floatValue == 1) + { + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + + Rect r_rimlight = EditorGUILayout.BeginVertical("Button"); + ShowRimLight = EditorGUILayout.Foldout(ShowRimLight, "(Rim Light)", true, EditorStyles.foldout); + + if (ShowRimLight) + { + + GUILayout.Space(10); + + materialEditor.ShaderProperty(_RimLigInt, new GUIContent(_RimLigInt.displayName, TOTIPS[125])); + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + + materialEditor.ShaderProperty(_RimLightUnfill, new GUIContent(_RimLightUnfill.displayName, TOTIPS[106])); + materialEditor.ShaderProperty(_RimLightSoftness, new GUIContent(_RimLightSoftness.displayName, TOTIPS[107])); + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + + materialEditor.ShaderProperty(_LightAffectRimLightColor, new GUIContent(_LightAffectRimLightColor.displayName, TOTIPS[108])); + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + + materialEditor.ShaderProperty(_RimLightColor, new GUIContent(_RimLightColor.displayName, TOTIPS[109])); + materialEditor.ShaderProperty(_RimLightColorPower, new GUIContent(_RimLightColorPower.displayName, TOTIPS[110])); + + if (_N_F_OFLMB.floatValue == 0) + { + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + materialEditor.ShaderProperty(_RimLightInLight, new GUIContent(_RimLightInLight.displayName, TOTIPS[111])); + } + + GUILayout.Space(10); + + } + + EditorGUILayout.EndVertical(); + + } + + #endregion + + //Near Fade Dithering + + #region Near Fade Dithering + + if (_N_F_NFD.floatValue == 1) + { + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + + Rect r_nerfaddithe = EditorGUILayout.BeginVertical("Button"); + NearFadeDithering = EditorGUILayout.Foldout(NearFadeDithering, "(Near Fade Dithering)", true, EditorStyles.foldout); + + if (NearFadeDithering) + { + + GUILayout.Space(10); + + materialEditor.ShaderProperty(_MinFadDistance, new GUIContent(_MinFadDistance.displayName, TOTIPS[152])); + materialEditor.ShaderProperty(_MaxFadDistance, new GUIContent(_MaxFadDistance.displayName, TOTIPS[153])); + + GUILayout.Space(10); + + } + + EditorGUILayout.EndVertical(); + + } + + #endregion + + //Triplanar + + #region Triplanar + + if (_N_F_TP.floatValue == 1) + { + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + + Rect r_tripla = EditorGUILayout.BeginVertical("Button"); + Triplanar = EditorGUILayout.Foldout(Triplanar, "(Triplanar)", true, EditorStyles.foldout); + + if (Triplanar) + { + + GUILayout.Space(10); + + materialEditor.ShaderProperty(_TriPlaTile, new GUIContent(_TriPlaTile.displayName, TOTIPS[155])); + materialEditor.ShaderProperty(_TriPlaBlend, new GUIContent(_TriPlaBlend.displayName, TOTIPS[156])); + + GUILayout.Space(10); + + } + + EditorGUILayout.EndVertical(); + + } + + #endregion + + //Perspective Adjustment + + #region Perspective Adjustment + + if (_N_F_PA.floatValue == 1) + { + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + + Rect r_perspecadju = EditorGUILayout.BeginVertical("Button"); + ShowPerspecAdju = EditorGUILayout.Foldout(ShowPerspecAdju, "(Perspective Adjustment)", true, EditorStyles.foldout); + + if (ShowPerspecAdju) + { + + GUILayout.Space(10); + + materialEditor.ShaderProperty(_PresAdju, new GUIContent(_PresAdju.displayName, TOTIPS[157])); + materialEditor.ShaderProperty(_ClipAdju, new GUIContent(_ClipAdju.displayName, TOTIPS[158])); + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + + materialEditor.ShaderProperty(_PASize, new GUIContent(_PASize.displayName, TOTIPS[159])); + materialEditor.ShaderProperty(_PASmooTrans, new GUIContent(_PASmooTrans.displayName, TOTIPS[160])); + materialEditor.ShaderProperty(_PADist, new GUIContent(_PADist.displayName, TOTIPS[161])); + + GUILayout.Space(10); + + } + + EditorGUILayout.EndVertical(); + + } + + #endregion + + //Smear Effect + + #region Smear Effect + + if (_N_F_SE.floatValue == 1) + { + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + + Rect r_perspecadju = EditorGUILayout.BeginVertical("Button"); + ShowSmeEff = EditorGUILayout.Foldout(ShowSmeEff, "(Smear Effect)", true, EditorStyles.foldout); + + if (ShowSmeEff) + { + + EditorGUI.BeginDisabledGroup(true); + EditorGUILayout.TextArea("Add the 'Smear Effect [Helper]' component to your object for this to work.\nAdjustable options are on the 'Smear Effect [Helper]' component.\n\nTo Add:\nClick your object then click 'Add Component'\nthen 'RealToon>Tool>Smear Effect [Helper].", EditorStyles.label, GUILayout.ExpandWidth(true)); + EditorGUI.EndDisabledGroup(); + + GUILayout.Space(10); + + } + + EditorGUILayout.EndVertical(); + + } + + #endregion + + //Tessellation (In Progress) + + #region Tessellation + +//if (shader_name == "tessellation_d" || shader_name == "tessellation_ft" || shader_name == "tessellation_ref") +//{ + +// EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + +// Rect r_tessellation = EditorGUILayout.BeginVertical("Button"); +// ShowTessellation = EditorGUILayout.Foldout(ShowTessellation, "(Tessellation)", true, EditorStyles.foldout); + +// if (ShowTessellation) +// { + +// GUILayout.Space(10); + +// materialEditor.ShaderProperty(_TessellationSmoothness, _TessellationSmoothness.displayName); +// materialEditor.ShaderProperty(_TessellationTransition, _TessellationTransition.displayName); +// materialEditor.ShaderProperty(_TessellationNear, _TessellationNear.displayName); +// materialEditor.ShaderProperty(_TessellationFar, _TessellationFar.displayName); + +// } + +// EditorGUILayout.EndVertical(); +//} + + #endregion + + //See Through + + #region See Through + + if(add_st == false) + { + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + + Rect r_seethrough = EditorGUILayout.BeginVertical("Button"); + ShowSeeThrough = EditorGUILayout.Foldout(ShowSeeThrough, "(See Through)", true, EditorStyles.foldout); + + if (ShowSeeThrough) + { + + GUILayout.Space(10); + + materialEditor.ShaderProperty(_RefVal, new GUIContent(_RefVal.displayName, TOTIPS[112])); + materialEditor.ShaderProperty(_Oper, new GUIContent(_Oper.displayName, TOTIPS[113])); + materialEditor.ShaderProperty(_Compa, new GUIContent(_Compa.displayName, TOTIPS[114])); + + GUILayout.Space(10); + + } + + EditorGUILayout.EndVertical(); + + GUILayout.Space(20); + } + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + + #endregion + + + //Disable/Enable Features + + #region Disable/Enable Features + + Rect r_disableenablefeature = EditorGUILayout.BeginVertical("Button"); + ShowDisableEnable = EditorGUILayout.Foldout(ShowDisableEnable, "(Disable/Enable Features)", true, EditorStyles.foldout); + + if (ShowDisableEnable) + { + + Rect r_mc = EditorGUILayout.BeginVertical("HelpBox"); + materialEditor.ShaderProperty(_N_F_MC, new GUIContent(_N_F_MC.displayName, TOTIPSEDF[0])); + EditorGUILayout.EndVertical(); + + Rect r_nm = EditorGUILayout.BeginVertical("HelpBox"); + materialEditor.ShaderProperty(_N_F_NM, new GUIContent(_N_F_NM.displayName, TOTIPSEDF[1])); + EditorGUILayout.EndVertical(); + + if (remoout == true) + { + Rect r_ou = EditorGUILayout.BeginVertical("HelpBox"); + + EditorGUI.BeginChangeCheck(); + + materialEditor.ShaderProperty(_N_F_O, new GUIContent(_N_F_O.displayName, TOTIPSEDF[2])); + + if (EditorGUI.EndChangeCheck()) + { + int f_deo_int = (int)_N_F_O.floatValue; + foreach (Material m in materialEditor.targets) + { + switch (f_deo_int) + { + case 0: + m.SetShaderPassEnabled("SRPDefaultUnlit", false); + break; + case 1: + m.SetShaderPassEnabled("SRPDefaultUnlit", true); + break; + default: + break; + } + } + + } + + EditorGUILayout.EndVertical(); + } + + EditorGUI.BeginDisabledGroup(_TRANSMODE.floatValue == 0); + + Rect r_co = EditorGUILayout.BeginVertical("HelpBox"); + + EditorGUI.BeginChangeCheck(); + + materialEditor.ShaderProperty(_N_F_CO, new GUIContent(_N_F_CO.displayName, TOTIPSEDF[3])); + + if (EditorGUI.EndChangeCheck()) + { + int f_co_int = (int)_N_F_CO.floatValue; + foreach (Material m in materialEditor.targets) + { + switch (f_co_int) + { + case 0: + + m.renderQueue = 3000; + m.SetOverrideTag("RenderType", "Transparent"); + + m.DisableKeyword("N_F_ATC_ON"); + m.SetFloat("_AlpToCov", 0.0f); + + break; + + case 1: + + m.renderQueue = 2450; + m.SetOverrideTag("RenderType", "TransparentCutout"); + break; + + default: + break; + } + } + } + + EditorGUILayout.EndVertical(); + + EditorGUI.EndDisabledGroup(); + + Rect r_ca = EditorGUILayout.BeginVertical("HelpBox"); + materialEditor.ShaderProperty(_N_F_CA, new GUIContent(_N_F_CA.displayName, TOTIPSEDF[4])); + EditorGUILayout.EndVertical(); + + + EditorGUI.BeginChangeCheck(); + + Rect r_sl = EditorGUILayout.BeginVertical("HelpBox"); + materialEditor.ShaderProperty(_N_F_SL, new GUIContent(_N_F_SL.displayName, TOTIPSEDF[5])); + EditorGUILayout.EndVertical(); + + if (EditorGUI.EndChangeCheck()) + { + int f_sl_int = (int)_N_F_SL.floatValue; + foreach (Material m in materialEditor.targets) + { + switch (f_sl_int) + { + case 0: + m.globalIlluminationFlags = MaterialGlobalIlluminationFlags.None; + break; + case 1: + m.globalIlluminationFlags = MaterialGlobalIlluminationFlags.BakedEmissive; + break; + default: + break; + } + } + + } + + + if (_N_F_OFLMB.floatValue == 0) + { + Rect r_o = EditorGUILayout.BeginVertical("HelpBox"); + materialEditor.ShaderProperty(_N_F_GLO, new GUIContent(_N_F_GLO.displayName, TOTIPSEDF[6])); + EditorGUILayout.EndVertical(); + + Rect r_glot = EditorGUILayout.BeginVertical("HelpBox"); + materialEditor.ShaderProperty(_N_F_GLOT, new GUIContent(_N_F_GLOT.displayName, TOTIPSEDF[7])); + EditorGUILayout.EndVertical(); + } + + + if (_N_F_OFLMB.floatValue == 0) + { + Rect r_ss = EditorGUILayout.BeginVertical("HelpBox"); + materialEditor.ShaderProperty(_N_F_SS, new GUIContent(_N_F_SS.displayName, TOTIPSEDF[8])); + EditorGUILayout.EndVertical(); + } + + + if (_N_F_OFLMB.floatValue == 0) + { + Rect r_son = EditorGUILayout.BeginVertical("HelpBox"); + materialEditor.ShaderProperty(_N_F_SON, new GUIContent(_N_F_SON.displayName, TOTIPSEDF[9])); + EditorGUILayout.EndVertical(); + } + + + if (_N_F_OFLMB.floatValue == 0) + { + Rect r_sct = EditorGUILayout.BeginVertical("HelpBox"); + materialEditor.ShaderProperty(_N_F_SCT, new GUIContent(_N_F_SCT.displayName, TOTIPSEDF[10])); + EditorGUILayout.EndVertical(); + } + + + if (_N_F_OFLMB.floatValue == 0) + { + Rect r_st = EditorGUILayout.BeginVertical("HelpBox"); + materialEditor.ShaderProperty(_N_F_ST, new GUIContent(_N_F_ST.displayName, TOTIPSEDF[11])); + EditorGUILayout.EndVertical(); + } + + + if (_N_F_OFLMB.floatValue == 0) + { + Rect r_pt = EditorGUILayout.BeginVertical("HelpBox"); + materialEditor.ShaderProperty(_N_F_PT, new GUIContent(_N_F_PT.displayName, TOTIPSEDF[12])); + EditorGUILayout.EndVertical(); + } + + + if (_N_F_OFLMB.floatValue == 0) + { + Rect r_cld = EditorGUILayout.BeginVertical("HelpBox"); + materialEditor.ShaderProperty(_N_F_CLD, new GUIContent(_N_F_CLD.displayName, TOTIPSEDF[13])); + EditorGUILayout.EndVertical(); + } + + + Rect r_r = EditorGUILayout.BeginVertical("HelpBox"); + materialEditor.ShaderProperty(_N_F_R, new GUIContent(_N_F_R.displayName, TOTIPSEDF[14])); + EditorGUILayout.EndVertical(); + + Rect r_fr = EditorGUILayout.BeginVertical("HelpBox"); + materialEditor.ShaderProperty(_N_F_FR, new GUIContent(_N_F_FR.displayName, TOTIPSEDF[15])); + EditorGUILayout.EndVertical(); + + Rect r_rl = EditorGUILayout.BeginVertical("HelpBox"); + materialEditor.ShaderProperty(_N_F_RL, new GUIContent(_N_F_RL.displayName, TOTIPSEDF[16])); + EditorGUILayout.EndVertical(); + + Rect r_nfd = EditorGUILayout.BeginVertical("HelpBox"); + materialEditor.ShaderProperty(_N_F_NFD, new GUIContent(_N_F_NFD.displayName, TOTIPSEDF[17])); + EditorGUILayout.EndVertical(); + + Rect r_tp = EditorGUILayout.BeginVertical("HelpBox"); + materialEditor.ShaderProperty(_N_F_TP, new GUIContent(_N_F_TP.displayName, TOTIPSEDF[18])); + EditorGUILayout.EndVertical(); + + Rect r_pa = EditorGUILayout.BeginVertical("HelpBox"); + materialEditor.ShaderProperty(_N_F_PA, new GUIContent(_N_F_PA.displayName, TOTIPSEDF[19])); + EditorGUILayout.EndVertical(); + + Rect r_se = EditorGUILayout.BeginVertical("HelpBox"); + materialEditor.ShaderProperty(_N_F_SE, new GUIContent(_N_F_SE.displayName, TOTIPSEDF[20])); + EditorGUILayout.EndVertical(); + + } + + EditorGUILayout.EndVertical(); + + #endregion + + //Settings + + #region Settings + + GUILayout.Space(5); + + Rect r_showsettings = EditorGUILayout.BeginVertical("Button"); + ShowSettings = EditorGUILayout.Foldout(ShowSettings, "(Settings)", true, EditorStyles.foldout); + + if (ShowSettings) + { + + GUILayout.Space(10); + + if (GUILayout.Button(new GUIContent(twofourfive_target_string, TOTIPS[116]), "Button")) + { + TWOFORFIVE(); + } + + if (twofourfive_target == true) + { + if (GUILayout.Button(new GUIContent(dots_lbs_cd_string, TOTIPS[143]), "Button")) + { + DOTSLBSCD(); + } + } + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + + if (GUILayout.Button(new GUIContent(add_st_string, TOTIPS[163]), "Button")) + { + ADD_ST(); + } + + GUILayout.Space(10); + + } + + EditorGUILayout.EndVertical(); + + #endregion + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + + if (_N_F_OFLMB.floatValue == 0) + { + GUILayout.Space(10); + + materialEditor.ShaderProperty(_N_F_HDLS, new GUIContent(_N_F_HDLS.displayName, TOTIPS[117])); + materialEditor.ShaderProperty(_N_F_HPSS, new GUIContent(_N_F_HPSS.displayName, TOTIPS[118])); + + EditorGUI.BeginChangeCheck(); + + materialEditor.ShaderProperty(_N_F_DCS, new GUIContent(_N_F_DCS.displayName, TOTIPS[119])); + + if (EditorGUI.EndChangeCheck()) + { + int f_hcs_int = (int)_N_F_DCS.floatValue; + foreach (Material m in materialEditor.targets) + { + switch (f_hcs_int) + { + case 0: + m.SetShaderPassEnabled("ShadowCaster", true); + break; + case 1: + m.SetShaderPassEnabled("ShadowCaster", false); + break; + default: + break; + } + } + + } + + materialEditor.ShaderProperty(_N_F_NLASOBF, new GUIContent(_N_F_NLASOBF.displayName, TOTIPS[115])); + + GUILayout.Space(10); + + } + + materialEditor.ShaderProperty(_ZWrite, new GUIContent(_ZWrite.displayName, TOTIPS[120])); + + GUILayout.Space(10); + + materialEditor.RenderQueueField(); + + GUILayout.Space(10); + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + + GUILayout.Space(10); + + materialEditor.EnableInstancingField(); + + materialEditor.ShaderProperty(_N_F_DDMD, new GUIContent(_N_F_DDMD.displayName, TOTIPS[151])); + + materialEditor.ShaderProperty(_N_F_RDC, new GUIContent(_N_F_RDC.displayName, TOTIPS[147])); + materialEditor.ShaderProperty(_N_F_OFLMB, new GUIContent(_N_F_OFLMB.displayName, TOTIPS[141])); + aruskw = EditorGUILayout.Toggle(new GUIContent("Automatic Remove Unused Shader Keywords (Global)", TOTIPS[121]), aruskw); + + GUILayout.Space(10); + + } + + #region Automatic Remove UorOSKW + if (aruskw == true) + { + foreach (Material m1 in materialEditor.targets) + { + for (int x = 0; x < m1.shaderKeywords.Length; x++) + { + if (m1.shaderKeywords[x] != String.Empty) + { + for (int y = 0; y < Enum.GetValues(typeof(SFKW)).Length; y++) + { + if (m1.shaderKeywords[x] == Enum.GetValues(typeof(SFKW)).GetValue(y).ToString()) + { + del_skw = false; + break; + } + else + { + del_skw = true; + } + } + + if (del_skw == true) + { + m1.DisableKeyword(m1.shaderKeywords[x]); + del_skw = false; + } + + } + else + { + break; + } + } + } + } + #endregion + + //Footbar + #region Footbar + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + + Rect r_footbar = EditorGUILayout.BeginHorizontal(); + + if (GUILayout.Button(new GUIContent("[" + remooutstat + " (On Shader)]", TOTIPS[135]), "Toolbar")) + { + REMO_OUTL(); + } + + GUILayout.Space(5); + + if (GUILayout.Button(new GUIContent("[Refresh Settings]", TOTIPS[62]), "Toolbar")) + { + foreach (Material m in materialEditor.targets) + { + CheckingPropKeyWord(m); + } + + Check_RE_OL(); + + Debug.Log("You clicked [Refresh Settings]: RealToon on the material has been refresh and re-apply the settings properly."); + + } + + GUILayout.Space(5); + + if (GUILayout.Button(new GUIContent("[Video Tutorials]", TOTIPS[136]), "Toolbar")) + { + Application.OpenURL("www.youtube.com/playlist?list=PL0M1m9smMVPJ4qEkJnZObqJE5mU9uz6SY"); + } + + GUILayout.Space(5); + + if (GUILayout.Button(new GUIContent("[RealToon (User Guide).pdf]", TOTIPS[137]), "Toolbar")) + { + Application.OpenURL(Application.dataPath + "/RealToon/RealToon (User Guide).pdf"); + } + + GUILayout.Space(5); + + if (GUILayout.Button(new GUIContent("[" + ShowUIString + "(Global)]", TOTIPS[138]), "Toolbar")) + { + if (ShowUI == false) + { + ShowUI = true; + ShowUIString = "Hide UI"; + } + else + { + ShowUI = false; + ShowUIString = "Show UI"; + } + } + + EditorGUILayout.EndHorizontal(); + + #endregion + + #endregion + + } + + // + #region Checking + + public override void AssignNewShaderToMaterial(Material material, Shader oldShader, Shader newShader) + { + base.AssignNewShaderToMaterial(material, oldShader, newShader); + + if (oldShader.name != "Universal Render Pipeline/RealToon/Version 5/Default/Default") + { + + if (oldShader.name == "HDRP/RealToon/Version 5/Default") + { + material.SetFloat("_MaiColPo", material.GetFloat("_MaiColPo") + 0.65f); + } + + } + + CheckingPropKeyWord(material); + } + + #region CheckingPropKeyWord + + void CheckingPropKeyWord(Material material) + { + + if (material.IsKeywordEnabled("N_F_TRANS_ON") || material.GetFloat("_TRANSMODE") == 1.0f) + { + + if (material.IsKeywordEnabled("N_F_CO_ON") || material.GetFloat("_N_F_CO") == 1.0f) + { + + material.renderQueue = 2450; + material.SetOverrideTag("RenderType", "TransparentCutout"); + + } + else if (material.IsKeywordEnabled("N_F_TRANS_ON") || material.GetFloat("_TRANSMODE") == 1.0f) + { + material.renderQueue = 3000; + + material.EnableKeyword("N_F_TRANS_ON"); + material.SetFloat("_TRANSMODE", 1.0f); + material.SetOverrideTag("RenderType", "Transparent"); + } + + shader_type = "Transparency"; + } + else if (!material.IsKeywordEnabled("N_F_TRANS_ON") || material.GetFloat("_TRANSMODE") == 0.0f) + { + material.DisableKeyword("N_F_TRANS_ON"); + material.SetFloat("_TRANSMODE", 0.0f); + + shader_type = "Default"; + } + + if ((material.IsKeywordEnabled("N_F_TRANSAFFSHA") || material.GetFloat("_TransAffSha") == 1.0f)) + { + material.EnableKeyword("N_F_TRANSAFFSHA"); + material.SetFloat("_TransAffSha", 1.0f); + } + else if ((!material.IsKeywordEnabled("N_F_TRANSAFFSHA") || material.GetFloat("_TransAffSha") == 0.0f)) + { + material.DisableKeyword("N_F_TRANSAFFSHA"); + material.SetFloat("_TransAffSha", 0.0f); + } + + if ((material.IsKeywordEnabled("N_F_ATC_ON") || material.GetFloat("_AlpToCov") == 1.0f)) + { + material.EnableKeyword("N_F_ATC_ON"); + material.SetFloat("_AlpToCov", 1.0f); + } + else if ((!material.IsKeywordEnabled("N_F_ATC_ON") || material.GetFloat("_AlpToCov") == 0.0f)) + { + material.DisableKeyword("N_F_ATC_ON"); + material.SetFloat("_AlpToCov", 0.0f); + } + + if ((material.IsKeywordEnabled("N_F_OFLMB_ON") || material.GetFloat("_N_F_OFLMB") == 1.0f)) + { + material.EnableKeyword("N_F_OFLMB_ON"); + material.SetFloat("_N_F_OFLMB", 1.0f); + } + else if ((!material.IsKeywordEnabled("N_F_OFLMB_ON") || material.GetFloat("_N_F_OFLMB") == 0.0f)) + { + material.DisableKeyword("N_F_OFLMB_ON"); + material.SetFloat("_N_F_OFLMB", 0.0f); + } + + if ((material.IsKeywordEnabled("N_F_SIMTRANS_ON") || material.GetFloat("_SimTrans") == 1.0f)) + { + material.EnableKeyword("N_F_SIMTRANS_ON"); + material.SetFloat("_SimTrans", 1.0f); + } + else if ((!material.IsKeywordEnabled("N_F_SIMTRANS_ON") || material.GetFloat("_SimTrans") == 0.0f)) + { + material.DisableKeyword("N_F_SIMTRANS_ON"); + material.SetFloat("_SimTrans", 0.0f); + } + + if ((material.IsKeywordEnabled("N_F_DDMD_ON") || material.GetFloat("_N_F_DDMD") == 1.0f)) + { + material.EnableKeyword("N_F_DDMD_ON"); + material.SetFloat("_N_F_DDMD", 1.0f); + } + else if ((!material.IsKeywordEnabled("N_F_DDMD_ON") || material.GetFloat("_N_F_DDMD") == 0.0f)) + { + material.DisableKeyword("N_F_DDMD_ON"); + material.SetFloat("_N_F_DDMD", 0.0f); + } + + //====================================================================================================== + + if ((material.IsKeywordEnabled("N_F_DNO_ON") || material.GetFloat("_DynamicNoisyOutline") == 1.0f)) + { + material.EnableKeyword("N_F_DNO_ON"); + material.SetFloat("_DynamicNoisyOutline", 1.0f); + } + else if ((!material.IsKeywordEnabled("N_F_DNO_ON") || material.GetFloat("_DynamicNoisyOutline") == 0.0f)) + { + material.DisableKeyword("N_F_DNO_ON"); + material.SetFloat("_DynamicNoisyOutline", 0.0f); + } + + //====================================================================================================== + + if ((material.IsKeywordEnabled("N_F_COEDGL_ON") || material.GetFloat("_N_F_COEDGL") == 1.0f)) + { + material.EnableKeyword("N_F_COEDGL_ON"); + material.SetFloat("_N_F_COEDGL", 1.0f); + } + else if ((!material.IsKeywordEnabled("N_F_COEDGL_ON") || material.GetFloat("_N_F_COEDGL") == 0.0f)) + { + material.DisableKeyword("N_F_COEDGL_ON"); + material.SetFloat("_N_F_COEDGL", 0.0f); + } + + if ((material.IsKeywordEnabled("N_F_MC_ON") || material.GetFloat("_N_F_MC") == 1.0f)) + { + material.EnableKeyword("N_F_MC_ON"); + material.SetFloat("_N_F_MC", 1.0f); + } + else if ((!material.IsKeywordEnabled("N_F_MC_ON") || material.GetFloat("_N_F_MC") == 0.0f)) + { + material.DisableKeyword("N_F_MC_ON"); + material.SetFloat("_N_F_MC", 0.0f); + } + + if ((material.IsKeywordEnabled("N_F_NM_ON") || material.GetFloat("_N_F_NM") == 1.0f)) + { + material.EnableKeyword("N_F_NM_ON"); + material.SetFloat("_N_F_NM", 1.0f); + } + else if ((!material.IsKeywordEnabled("N_F_NM_ON") || material.GetFloat("_N_F_NM") == 0.0f)) + { + material.DisableKeyword("N_F_NM_ON"); + material.SetFloat("_N_F_NM", 0.0f); + } + + if ((material.IsKeywordEnabled("N_F_CO_ON") || material.GetFloat("_N_F_CO") == 1.0f)) + { + material.EnableKeyword("N_F_CO_ON"); + material.SetFloat("_N_F_CO", 1.0f); + } + else if ((!material.IsKeywordEnabled("N_F_CO_ON") || material.GetFloat("_N_F_CO") == 0.0f)) + { + material.DisableKeyword("N_F_CO_ON"); + material.SetFloat("_N_F_CO", 0.0f); + } + + if ((material.IsKeywordEnabled("N_F_SCO_ON") || material.GetFloat("_N_F_SCO") == 1.0f)) + { + material.EnableKeyword("N_F_SCO_ON"); + material.SetFloat("_N_F_SCO", 1.0f); + } + else if ((!material.IsKeywordEnabled("N_F_SCO_ON") || material.GetFloat("_N_F_SCO") == 0.0f)) + { + material.DisableKeyword("N_F_SCO_ON"); + material.SetFloat("_N_F_SCO", 0.0f); + } + + if ((material.IsKeywordEnabled("N_F_O_ON") || material.GetFloat("_N_F_O") == 1.0f)) + { + material.EnableKeyword("N_F_O_ON"); + material.SetShaderPassEnabled("SRPDefaultUnlit", true); + material.SetFloat("_N_F_O", 1.0f); + } + else if ((!material.IsKeywordEnabled("N_F_O_ON") || material.GetFloat("_N_F_O") == 0.0f)) + { + material.DisableKeyword("N_F_O_ON"); + material.SetShaderPassEnabled("SRPDefaultUnlit", false); + material.SetFloat("_N_F_O", 0.0f); + } + + if ((material.IsKeywordEnabled("N_F_CA_ON") || material.GetFloat("_N_F_CA") == 1.0f)) + { + material.EnableKeyword("N_F_CA_ON"); + material.SetFloat("_N_F_CA", 1.0f); + } + else if ((!material.IsKeywordEnabled("N_F_CA_ON") || material.GetFloat("_N_F_CA") == 0.0f)) + { + material.DisableKeyword("N_F_CA_ON"); + material.SetFloat("_N_F_CA", 0.0f); + } + + if ((material.IsKeywordEnabled("N_F_SL_ON") || material.GetFloat("_N_F_SL") == 1.0f)) + { + material.EnableKeyword("N_F_SL_ON"); + material.SetFloat("_N_F_SL", 1.0f); + material.globalIlluminationFlags = MaterialGlobalIlluminationFlags.BakedEmissive; + } + else if ((!material.IsKeywordEnabled("N_F_SL_ON") || material.GetFloat("_N_F_SL") == 0.0f)) + { + material.DisableKeyword("N_F_SL_ON"); + material.SetFloat("_N_F_SL", 0.0f); + material.globalIlluminationFlags = MaterialGlobalIlluminationFlags.None; + } + + if ((material.IsKeywordEnabled("N_F_SLMM_ON") || material.GetFloat("_N_F_SLMM") == 1.0f)) + { + material.EnableKeyword("N_F_SLMM_ON"); + material.SetFloat("_N_F_SLMM", 1.0f); + } + else if ((!material.IsKeywordEnabled("N_F_SLMM_ON") || material.GetFloat("_N_F_SLMM") == 0.0f)) + { + material.DisableKeyword("N_F_SLMM_ON"); + material.SetFloat("_N_F_SLMM", 0.0f); + } + + if ((material.IsKeywordEnabled("N_F_GLO_ON") || material.GetFloat("_N_F_GLO") == 1.0f)) + { + material.EnableKeyword("N_F_GLO_ON"); + material.SetFloat("_N_F_GLO", 1.0f); + } + else if ((!material.IsKeywordEnabled("N_F_GLO_ON") || material.GetFloat("_N_F_GLO") == 0.0f)) + { + material.DisableKeyword("N_F_GLO_ON"); + material.SetFloat("_N_F_GLO", 0.0f); + } + + if ((material.IsKeywordEnabled("N_F_GLOT_ON") || material.GetFloat("_N_F_GLOT") == 1.0f)) + { + material.EnableKeyword("N_F_GLOT_ON"); + material.SetFloat("_N_F_GLOT", 1.0f); + } + else if ((!material.IsKeywordEnabled("N_F_GLOT_ON") || material.GetFloat("_N_F_GLOT") == 0.0f)) + { + material.DisableKeyword("N_F_GLOT_ON"); + material.SetFloat("_N_F_GLOT", 0.0f); + } + + if ((material.IsKeywordEnabled("N_F_SS_ON") || material.GetFloat("_N_F_SS") == 1.0f)) + { + material.EnableKeyword("N_F_SS_ON"); + material.SetFloat("_N_F_SS", 1.0f); + } + else if ((!material.IsKeywordEnabled("N_F_SS_ON") || material.GetFloat("_N_F_SS") == 0.0f)) + { + material.DisableKeyword("N_F_SS_ON"); + material.SetFloat("_N_F_SS", 0.0f); + } + + if ((material.IsKeywordEnabled("N_F_SON_ON") || material.GetFloat("_N_F_SON") == 1.0f)) + { + material.EnableKeyword("N_F_SON_ON"); + material.SetFloat("_N_F_SON", 1.0f); + } + else if ((!material.IsKeywordEnabled("N_F_SON_ON") || material.GetFloat("_N_F_SON") == 0.0f)) + { + material.DisableKeyword("N_F_SON_ON"); + material.SetFloat("_N_F_SON", 0.0f); + } + + if ((material.IsKeywordEnabled("N_F_SCT_ON") || material.GetFloat("_N_F_SCT") == 1.0f)) + { + material.EnableKeyword("N_F_SCT_ON"); + material.SetFloat("_N_F_SCT", 1.0f); + } + else if ((!material.IsKeywordEnabled("N_F_SCT_ON") || material.GetFloat("_N_F_SCT") == 0.0f)) + { + material.DisableKeyword("N_F_SCT_ON"); + material.SetFloat("_N_F_SCT", 0.0f); + } + + if ((material.IsKeywordEnabled("N_F_ST_ON") || material.GetFloat("_N_F_ST") == 1.0f)) + { + material.EnableKeyword("N_F_ST_ON"); + material.SetFloat("_N_F_ST", 1.0f); + } + else if ((!material.IsKeywordEnabled("N_F_ST_ON") || material.GetFloat("_N_F_ST") == 0.0f)) + { + material.DisableKeyword("N_F_ST_ON"); + material.SetFloat("_N_F_ST", 0.0f); + } + + if ((material.IsKeywordEnabled("N_F_PT_ON") || material.GetFloat("_N_F_PT") == 1.0f)) + { + material.EnableKeyword("N_F_PT_ON"); + material.SetFloat("_N_F_PT", 1.0f); + } + else if ((!material.IsKeywordEnabled("N_F_PT_ON") || material.GetFloat("_N_F_PT") == 0.0f)) + { + material.DisableKeyword("N_F_PT_ON"); + material.SetFloat("_N_F_PT", 0.0f); + } + + if ((material.IsKeywordEnabled("N_F_CLD_ON") || material.GetFloat("_N_F_CLD") == 1.0f)) + { + material.EnableKeyword("N_F_CLD_ON"); + material.SetFloat("_N_F_CLD", 1.0f); + } + else if ((!material.IsKeywordEnabled("N_F_CLD_ON") || material.GetFloat("_N_F_CLD") == 0.0f)) + { + material.DisableKeyword("N_F_CLD_ON"); + material.SetFloat("_N_F_CLD", 0.0f); + } + + if ((material.IsKeywordEnabled("N_F_R_ON") || material.GetFloat("_N_F_R") == 1.0f)) + { + material.EnableKeyword("N_F_R_ON"); + material.SetFloat("_N_F_R", 1.0f); + } + else if ((!material.IsKeywordEnabled("N_F_R_ON") || material.GetFloat("_N_F_R") == 0.0f)) + { + material.DisableKeyword("N_F_R_ON"); + material.SetFloat("_N_F_R", 0.0f); + } + + if ((material.IsKeywordEnabled("N_F_FR_ON") || material.GetFloat("_N_F_FR") == 1.0f)) + { + material.EnableKeyword("N_F_FR_ON"); + material.SetFloat("_N_F_FR", 1.0f); + } + else if ((!material.IsKeywordEnabled("N_F_FR_ON") || material.GetFloat("_N_F_FR") == 0.0f)) + { + material.DisableKeyword("N_F_FR_ON"); + material.SetFloat("_N_F_FR", 0.0f); + } + + if ((material.IsKeywordEnabled("N_F_RL_ON") || material.GetFloat("_N_F_RL") == 1.0f)) + { + material.EnableKeyword("N_F_RL_ON"); + material.SetFloat("_N_F_RL", 1.0f); + } + else if ((!material.IsKeywordEnabled("N_F_RL_ON") || material.GetFloat("_N_F_RL") == 0.0f)) + { + material.DisableKeyword("N_F_RL_ON"); + material.SetFloat("_N_F_RL", 0.0f); + } + + if ((material.IsKeywordEnabled("N_F_NFD_ON") || material.GetFloat("_N_F_NFD") == 1.0f)) + { + material.EnableKeyword("N_F_NFD_ON"); + material.SetFloat("_N_F_NFD", 1.0f); + } + else if ((!material.IsKeywordEnabled("N_F_NFD_ON") || material.GetFloat("_N_F_NFD") == 0.0f)) + { + material.DisableKeyword("N_F_NFD_ON"); + material.SetFloat("_N_F_NFD", 0.0f); + } + + if ((material.IsKeywordEnabled("N_F_TP_ON") || material.GetFloat("_N_F_TP") == 1.0f)) + { + material.EnableKeyword("N_F_TP_ON"); + material.SetFloat("_N_F_TP", 1.0f); + } + else if ((!material.IsKeywordEnabled("N_F_TP_ON") || material.GetFloat("_N_F_TP") == 0.0f)) + { + material.DisableKeyword("N_F_TP_ON"); + material.SetFloat("_N_F_TP", 0.0f); + } + + if ((material.IsKeywordEnabled("N_F_STSDFM_ON") || material.GetFloat("_N_F_STSDFM") == 1.0f)) + { + material.EnableKeyword("N_F_STSDFM_ON"); + material.SetFloat("_N_F_STSDFM", 1.0f); + } + else if ((!material.IsKeywordEnabled("N_F_STSDFM_ON") || material.GetFloat("_N_F_STSDFM") == 0.0f)) + { + material.DisableKeyword("N_F_STSDFM_ON"); + material.SetFloat("_N_F_STSDFM", 0.0f); + } + + //====================================================================================================== + + if ((material.IsKeywordEnabled("N_F_ANIS_ON") || material.GetFloat("_N_F_ANIS") == 1.0f)) + { + material.EnableKeyword("N_F_ANIS_ON"); + material.SetFloat("_N_F_ANIS", 1.0f); + } + else if ((!material.IsKeywordEnabled("N_F_ANIS_ON") || material.GetFloat("_N_F_ANIS") == 0.0f)) + { + material.DisableKeyword("N_F_ANIS_ON"); + material.SetFloat("_N_F_ANIS", 0.0f); + } + + if ((material.IsKeywordEnabled("N_F_ESSAO_ON") || material.GetFloat("_N_F_ESSAO") == 1.0f)) + { + material.EnableKeyword("N_F_ESSAO_ON"); + material.SetFloat("_N_F_ESSAO", 1.0f); + } + else if ((!material.IsKeywordEnabled("N_F_ESSAO_ON") || material.GetFloat("_N_F_ESSAO") == 0.0f)) + { + material.DisableKeyword("N_F_ESSAO_ON"); + material.SetFloat("_N_F_ESSAO", 0.0f); + } + + if ((material.IsKeywordEnabled("N_F_RELGI_ON") || material.GetFloat("_RELG") == 1.0f)) + { + material.EnableKeyword("N_F_RELGI_ON"); + material.SetFloat("_RELG", 1.0f); + } + else if ((!material.IsKeywordEnabled("N_F_RELGI_ON") || material.GetFloat("_RELG") == 0.0f)) + { + material.DisableKeyword("N_F_RELGI_ON"); + material.SetFloat("_RELG", 0.0f); + } + + if ((material.IsKeywordEnabled("N_F_USETLB_ON") || material.GetFloat("_UseTLB") == 1.0f)) + { + material.EnableKeyword("N_F_USETLB_ON"); + material.SetFloat("_UseTLB", 1.0f); + } + else if ((!material.IsKeywordEnabled("N_F_USETLB_ON") || material.GetFloat("_UseTLB") == 0.0f)) + { + material.DisableKeyword("N_F_USETLB_ON"); + material.SetFloat("_UseTLB", 0.0f); + } + + if ((material.IsKeywordEnabled("N_F_EAL_ON") || material.GetFloat("_N_F_EAL") == 1.0f)) + { + material.EnableKeyword("N_F_EAL_ON"); + material.SetFloat("_N_F_EAL", 1.0f); + } + else if ((!material.IsKeywordEnabled("N_F_EAL_ON") || material.GetFloat("_N_F_EAL") == 0.0f)) + { + material.DisableKeyword("N_F_EAL_ON"); + material.SetFloat("_N_F_EAL", 0.0f); + } + + if ((material.IsKeywordEnabled("N_F_LLI_ON") || material.GetFloat("_N_F_LLI") == 1.0f)) + { + material.EnableKeyword("N_F_LLI_ON"); + material.SetFloat("_N_F_LLI", 1.0f); + } + else if ((!material.IsKeywordEnabled("N_F_LLI_ON") || material.GetFloat("_N_F_LLI") == 0.0f)) + { + material.DisableKeyword("N_F_LLI_ON"); + material.SetFloat("_N_F_LLI", 0.0f); + } + + if ((material.IsKeywordEnabled("N_F_HDLS_ON") || material.GetFloat("_N_F_HDLS") == 1.0f)) + { + material.EnableKeyword("N_F_HDLS_ON"); + material.SetFloat("_N_F_HDLS", 1.0f); + } + else if ((!material.IsKeywordEnabled("N_F_HDLS_ON") || material.GetFloat("_N_F_HDLS") == 0.0f)) + { + material.DisableKeyword("N_F_HDLS_ON"); + material.SetFloat("_N_F_HDLS", 0.0f); + } + + if ((material.IsKeywordEnabled("N_F_HPSS_ON") || material.GetFloat("_N_F_HPSS") == 1.0f)) + { + material.EnableKeyword("N_F_HPSS_ON"); + material.SetFloat("_N_F_HPSS", 1.0f); + } + else if ((!material.IsKeywordEnabled("N_F_HPSS_ON") || material.GetFloat("_N_F_HPSS") == 0.0f)) + { + material.DisableKeyword("N_F_HPSS_ON"); + material.SetFloat("_N_F_HPSS", 0.0f); + } + + if ((material.IsKeywordEnabled("N_F_DCS_ON") || material.GetFloat("_N_F_DCS") == 1.0f)) + { + material.EnableKeyword("N_F_DCS_ON"); + material.SetShaderPassEnabled("ShadowCaster", false); + material.SetFloat("_N_F_DCS", 1.0f); + } + else if ((!material.IsKeywordEnabled("N_F_DCS_ON") || material.GetFloat("_N_F_DCS") == 0.0f)) + { + material.DisableKeyword("N_F_DCS_ON"); + material.SetShaderPassEnabled("ShadowCaster", true); + material.SetFloat("_N_F_DCS", 0.0f); + } + + if ((material.IsKeywordEnabled("N_F_RDC_ON") || material.GetFloat("_N_F_RDC") == 1.0f)) + { + material.EnableKeyword("N_F_RDC_ON"); + material.SetFloat("_N_F_RDC", 1.0f); + } + else if ((!material.IsKeywordEnabled("N_F_RDC_ON") || material.GetFloat("_N_F_RDC") == 0.0f)) + { + material.DisableKeyword("N_F_RDC_ON"); + material.SetFloat("_N_F_RDC", 0.0f); + } + + if ((material.IsKeywordEnabled("N_F_NLASOBF_ON") || material.GetFloat("_N_F_NLASOBF") == 1.0f)) + { + material.EnableKeyword("_N_F_NLASOBF"); + material.SetFloat("_N_F_NLASOBF", 1.0f); + } + else if ((!material.IsKeywordEnabled("N_F_NLASOBF_ON") || material.GetFloat("_N_F_NLASOBF") == 0.0f)) + { + material.DisableKeyword("N_F_NLASOBF_ON"); + material.SetFloat("_N_F_NLASOBF", 0.0f); + } + + #endregion + + } + + #endregion + + #region ChanLi + static void ChanLi(string searchTXT, string TXTChange, string fileName) + { + + if (System.IO.File.Exists(fileName)) + { + string[] arrLine = System.IO.File.ReadAllLines(fileName); + + for (int i = 0; i < arrLine.Length; ++i) + { + if (arrLine[i] == searchTXT) + { + arrLine[i] = TXTChange; + System.IO.File.WriteAllLines(fileName, arrLine); + break; + } + } + + } + else + { + Debug.Log("Can't enable do 'Use Screen Space Outline' or 'Use Traditional Outline' because '" + fileName + "' Does not exist or file not found."); + } + + } + #endregion + + #region ReaLi + static bool ReaLi(string searchTXT, string fileName) + { + + if (System.IO.File.Exists(fileName)) + { + string[] arrLine = System.IO.File.ReadAllLines(fileName); + + for (int i = 0; i < arrLine.Length; ++i) + { + if (arrLine[i] == searchTXT) + { + return true; + } + } + + } + else + { + Debug.Log("Can't read a line because '" + fileName + "' Does not exist or file not found."); + } + + return false; + + } + + #endregion + + #region Check_RE_OL + void Check_RE_OL() + { + if (ReaLi("//OL_RE", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader")) + { + remoout = true; + REMO_OUTL(); + } + else + { + remoout = false; + REMO_OUTL(); + } + } + #endregion + + #region REMO_OUTL + void REMO_OUTL() + { + if (remoout == true) + { + ChanLi("Tags{" + (char)34 + "LightMode" + (char)34 + "=" + (char)34 + "SRPDefaultUnlit" + (char)34 + "}", "Tags{" + (char)34 + "LightMode" + (char)34 + "=" + (char)34 + "remove" + (char)34 + "}", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("Cull [_DoubleSidedOutline]//OL_RCUL", "//Cull [_DoubleSidedOutline]//OL_RCUL", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + + ChanLi("#ifdef UNITY_COLORSPACE_GAMMA//SSOL", "//#ifdef UNITY_COLORSPACE_GAMMA//SSOL", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("_OutlineColor=float4(LinearToGamma22(_OutlineColor.rgb),_OutlineColor.a);//SSOL", "//_OutlineColor=float4(LinearToGamma22(_OutlineColor.rgb),_OutlineColor.a);//SSOL", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("#endif//SSOL", "//#endif//SSOL", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + + ChanLi("#if N_F_O_ON//SSOL", "//#if N_F_O_ON//SSOL", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("float3 SSOLi=(float3)EdgDet(sceneUVs.xy);//SSOL", "//float3 SSOLi=(float3)EdgDet(sceneUVs.xy);//SSOL", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("#if N_F_O_MOTTSO_ON//SSOL", "//#if N_F_O_MOTTSO_ON//SSOL", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("float3 Init_FO=((RTD_CA*RTD_SON_CHE_1))*lerp((float3)1.0,_OutlineColor.rgb,SSOLi);//SSOL", "//float3 Init_FO=((RTD_CA*RTD_SON_CHE_1))*lerp((float3)1.0,_OutlineColor.rgb,SSOLi);//SSOL", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("#else//SSOL", "//#else//SSOL", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("float3 Init_FO=lerp((RTD_CA*RTD_SON_CHE_1),_OutlineColor.rgb,SSOLi);//SSOL", "//float3 Init_FO=lerp((RTD_CA*RTD_SON_CHE_1),_OutlineColor.rgb,SSOLi);//SSOL", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("#endif//SSOL", "//#endif//SSOL", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("#else//SSOL", "//#else//SSOL", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + + ChanLi("#endif//SSOL", "//#endif//SSOL", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + + ChanLi("//OL_NRE", "//OL_RE", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + + ChanLi("//SSOL_U", "//SSOL_NU", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + + //============================ + //============================ + + ChanLi("static bool remoout = true;", "static bool remoout = false;", "Assets/RealToon/Editor/RealToonShaderGUI_URP_SRP.cs"); + ChanLi("static string remooutstat = " + (char)34 + "Remove Outline" + (char)34 + ";", "static string remooutstat = " + (char)34 + "Add Outline" + (char)34 + ";", "Assets/RealToon/Editor/RealToonShaderGUI_URP_SRP.cs"); + + AssetDatabase.ImportAsset("Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + AssetDatabase.ImportAsset("Assets/RealToon/Editor/RealToonShaderGUI_URP_SRP.cs"); + Debug.Log("Outline feature removed on RealToon URP shader."); + } + else if (remoout == false) + { + ChanLi("Tags{" + (char)34 + "LightMode" + (char)34 + "=" + (char)34 + "remove" + (char)34 + "}", "Tags{" + (char)34 + "LightMode" + (char)34 + "=" + (char)34 + "SRPDefaultUnlit" + (char)34 + "}", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("//Cull [_DoubleSidedOutline]//OL_RCUL", "Cull [_DoubleSidedOutline]//OL_RCUL", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + + ChanLi("//OL_RE", "//OL_NRE", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + + Check_SSOL_TOL(); + + //============================ + //============================ + + ChanLi("static bool remoout = false;", "static bool remoout = true;", "Assets/RealToon/Editor/RealToonShaderGUI_URP_SRP.cs"); + ChanLi("static string remooutstat = " + (char)34 + "Add Outline" + (char)34 + ";", "static string remooutstat = " + (char)34 + "Remove Outline" + (char)34 + ";", "Assets/RealToon/Editor/RealToonShaderGUI_URP_SRP.cs"); + + AssetDatabase.ImportAsset("Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + AssetDatabase.ImportAsset("Assets/RealToon/Editor/RealToonShaderGUI_URP_SRP.cs"); + Debug.Log("Outline feature added on RealToon URP shader."); + } + } + #endregion + + #region Check_SSOL_TOL + void Check_SSOL_TOL() + { + if (ReaLi("//SSOL_U", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader")) + { + UseSSOL = true; + USSOL_OR_TOL(); + } + else + { + UseSSOL = false; + USSOL_OR_TOL(); + } + } + #endregion + + #region USSOL_OR_TOL + void USSOL_OR_TOL() + { + if (UseSSOL == true) + { + ChanLi("Tags{" + (char)34 + "LightMode" + (char)34 + "=" + (char)34 + "SRPDefaultUnlit" + (char)34 + "}", "Tags{" + (char)34 + "LightMode" + (char)34 + "=" + (char)34 + "remove" + (char)34 + "}", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("Cull [_DoubleSidedOutline]//OL_RCUL", "//Cull [_DoubleSidedOutline]//OL_RCUL", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + + ChanLi("//#ifdef UNITY_COLORSPACE_GAMMA//SSOL", "#ifdef UNITY_COLORSPACE_GAMMA//SSOL", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("//_OutlineColor=float4(LinearToGamma22(_OutlineColor.rgb),_OutlineColor.a);//SSOL", "_OutlineColor=float4(LinearToGamma22(_OutlineColor.rgb),_OutlineColor.a);//SSOL", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("//#endif//SSOL", "#endif//SSOL", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + + ChanLi("//#if N_F_O_ON//SSOL", "#if N_F_O_ON//SSOL", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("//float3 SSOLi=(float3)EdgDet(sceneUVs.xy);//SSOL", "float3 SSOLi=(float3)EdgDet(sceneUVs.xy);//SSOL", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("//#if N_F_O_MOTTSO_ON//SSOL", "#if N_F_O_MOTTSO_ON//SSOL", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("//float3 Init_FO=((RTD_CA*RTD_SON_CHE_1))*lerp((float3)1.0,_OutlineColor.rgb,SSOLi);//SSOL", "float3 Init_FO=((RTD_CA*RTD_SON_CHE_1))*lerp((float3)1.0,_OutlineColor.rgb,SSOLi);//SSOL", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("//#else//SSOL", "#else//SSOL", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("//float3 Init_FO=lerp((RTD_CA*RTD_SON_CHE_1),_OutlineColor.rgb,SSOLi);//SSOL", "float3 Init_FO=lerp((RTD_CA*RTD_SON_CHE_1),_OutlineColor.rgb,SSOLi);//SSOL", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("//#endif//SSOL", "#endif//SSOL", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("//#else//SSOL", "#else//SSOL", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + + ChanLi("//#endif//SSOL", "#endif//SSOL", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + + ChanLi("//SSOL_NU", "//SSOL_U", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + + //============================ + //============================ + + ChanLi("static bool UseSSOL = true;", "static bool UseSSOL = false;", "Assets/RealToon/Editor/RealToonShaderGUI_URP_SRP.cs"); + ChanLi("static string OLType = " + (char)34 + "Traditional" + (char)34 + ";", "static string OLType = " + (char)34 + "Screen Space" + (char)34 + ";", "Assets/RealToon/Editor/RealToonShaderGUI_URP_SRP.cs"); + ChanLi("static string UseSSOLStat = " + (char)34 + "Use Screen Space Outline" + (char)34 + ";", "static string UseSSOLStat = " + (char)34 + "Use Traditional Outline" + (char)34 + ";", "Assets/RealToon/Editor/RealToonShaderGUI_URP_SRP.cs"); + + AssetDatabase.ImportAsset("Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + AssetDatabase.ImportAsset("Assets/RealToon/Editor/RealToonShaderGUI_URP_SRP.cs"); + Debug.Log("Screen Space Outline is now use."); + } + else if (UseSSOL == false) + { + ChanLi("Tags{" + (char)34 + "LightMode" + (char)34 + "=" + (char)34 + "remove" + (char)34 + "}", "Tags{" + (char)34 + "LightMode" + (char)34 + "=" + (char)34 + "SRPDefaultUnlit" + (char)34 + "}", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("//Cull [_DoubleSidedOutline]//OL_RCUL", "Cull [_DoubleSidedOutline]//OL_RCUL", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + + ChanLi("#ifdef UNITY_COLORSPACE_GAMMA//SSOL", "//#ifdef UNITY_COLORSPACE_GAMMA//SSOL", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("_OutlineColor=float4(LinearToGamma22(_OutlineColor.rgb),_OutlineColor.a);//SSOL", "//_OutlineColor=float4(LinearToGamma22(_OutlineColor.rgb),_OutlineColor.a);//SSOL", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("#endif//SSOL", "//#endif//SSOL", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + + ChanLi("#if N_F_O_ON//SSOL", "//#if N_F_O_ON//SSOL", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("float3 SSOLi=(float3)EdgDet(sceneUVs.xy);//SSOL", "//float3 SSOLi=(float3)EdgDet(sceneUVs.xy);//SSOL", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("#if N_F_O_MOTTSO_ON//SSOL", "//#if N_F_O_MOTTSO_ON//SSOL", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("float3 Init_FO=((RTD_CA*RTD_SON_CHE_1))*lerp((float3)1.0,_OutlineColor.rgb,SSOLi);//SSOL", "//float3 Init_FO=((RTD_CA*RTD_SON_CHE_1))*lerp((float3)1.0,_OutlineColor.rgb,SSOLi);//SSOL", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("#else//SSOL", "//#else//SSOL", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("float3 Init_FO=lerp((RTD_CA*RTD_SON_CHE_1),_OutlineColor.rgb,SSOLi);//SSOL", "//float3 Init_FO=lerp((RTD_CA*RTD_SON_CHE_1),_OutlineColor.rgb,SSOLi);//SSOL", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("#endif//SSOL", "//#endif//SSOL", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("#else//SSOL", "//#else//SSOL", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + + ChanLi("#endif//SSOL", "//#endif//SSOL", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + + ChanLi("//SSOL_U", "//SSOL_NU", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + + //============================ + //============================ + + ChanLi("static bool UseSSOL = false;", "static bool UseSSOL = true;", "Assets/RealToon/Editor/RealToonShaderGUI_URP_SRP.cs"); + ChanLi("static string OLType = " + (char)34 + "Screen Space" + (char)34 + ";", "static string OLType = " + (char)34 + "Traditional" + (char)34 + ";", "Assets/RealToon/Editor/RealToonShaderGUI_URP_SRP.cs"); + ChanLi("static string UseSSOLStat = " + (char)34 + "Use Traditional Outline" + (char)34 + ";", "static string UseSSOLStat = " + (char)34 + "Use Screen Space Outline" + (char)34 + ";", "Assets/RealToon/Editor/RealToonShaderGUI_URP_SRP.cs"); + + AssetDatabase.ImportAsset("Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + AssetDatabase.ImportAsset("Assets/RealToon/Editor/RealToonShaderGUI_URP_SRP.cs"); + Debug.Log("Traditional Outline is now use."); + } + } + #endregion + + #region TWOFORFIVE + void TWOFORFIVE() + { + if (twofourfive_target == false) + { + ChanLi("static bool twofourfive_target = false;", "static bool twofourfive_target = true;", "Assets/RealToon/Editor/RealToonShaderGUI_URP_SRP.cs"); + ChanLi("static string twofourfive_target_string = " + (char)34 + "Change shader compilation target to 4.5" + (char)34 + ";", "static string twofourfive_target_string = " + (char)34 + "Change shader compilation target to 2.0" + (char)34 + ";", "Assets/RealToon/Editor/RealToonShaderGUI_URP_SRP.cs"); + + ChanLi("#pragma target 2.0 //targetol", "#pragma target 4.5 //targetol", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("#pragma target 2.0 //targetfl", "#pragma target 4.5 //targetfl", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("#pragma target 2.0 //targetsc", "#pragma target 4.5 //targetsc", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("#pragma target 2.0 //targetdo", "#pragma target 4.5 //targetdo", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("#pragma target 2.0 //targetdn", "#pragma target 4.5 //targetdn", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("#pragma target 2.0 //targetm", "#pragma target 4.5 //targetm", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + + AssetDatabase.ImportAsset("Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + AssetDatabase.ImportAsset("Assets/RealToon/Editor/RealToonShaderGUI_URP_SRP.cs"); + Debug.LogWarning("RealToon shader compilation target has been changed to 4.5, added support for DOTS and Tessellation."); + } + else if (twofourfive_target == true) + { + ChanLi("static bool twofourfive_target = true;", "static bool twofourfive_target = false;", "Assets/RealToon/Editor/RealToonShaderGUI_URP_SRP.cs"); + ChanLi("static string twofourfive_target_string = " + (char)34 + "Change shader compilation target to 2.0" + (char)34 + ";", "static string twofourfive_target_string = " + (char)34 + "Change shader compilation target to 4.5" + (char)34 + ";", "Assets/RealToon/Editor/RealToonShaderGUI_URP_SRP.cs"); + + ChanLi("#pragma target 4.5 //targetol", "#pragma target 2.0 //targetol", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("#pragma target 4.5 //targetfl", "#pragma target 2.0 //targetfl", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("#pragma target 4.5 //targetsc", "#pragma target 2.0 //targetsc", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("#pragma target 4.5 //targetdo", "#pragma target 2.0 //targetdo", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("#pragma target 4.5 //targetdn", "#pragma target 2.0 //targetdn", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("#pragma target 4.5 //targetm", "#pragma target 2.0 //targetm", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + + AssetDatabase.ImportAsset("Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + AssetDatabase.ImportAsset("Assets/RealToon/Editor/RealToonShaderGUI_URP_SRP.cs"); + Debug.LogWarning("RealToon shader compilation target has been changed to 2.0."); + } + } + #endregion + + #region DOTSLBSCD + + void DOTSLBSCD() + { + if (dots_lbs_cd == false) + { + + ChanLi("static bool dots_lbs_cd = false;", "static bool dots_lbs_cd = true;", "Assets/RealToon/Editor/RealToonShaderGUI_URP_SRP.cs"); + ChanLi("static string dots_lbs_cd_string = " + (char)34 + "DOTS|HR - Use Compute Deformation" + (char)34 + ";", "static string dots_lbs_cd_string = " + (char)34 + "DOTS|HR - Use Linear Blend Skinning" + (char)34 + ";", "Assets/RealToon/Editor/RealToonShaderGUI_URP_SRP.cs"); + + + ChanLi("float4 weights : BLENDWEIGHTS;//DOTS_LiBleSki_OL", "//float4 weights : BLENDWEIGHTS;//DOTS_LiBleSki_OL", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("uint4 indices : BLENDINDICES;//DOTS_LiBleSki_OL", "//uint4 indices : BLENDINDICES;//DOTS_LiBleSki_OL", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("//uint vertexID : SV_VertexID;//DOTS_CompDef_OL", "uint vertexID : SV_VertexID;//DOTS_CompDef_OL", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("//DOTS_CompDef(input.vertexID, (float3)_LBS_CD_Position, _LBS_CD_Normal, (float3)_LBS_CD_Tangent);//DOTS_CompDef_OL", "DOTS_CompDef(input.vertexID, (float3)_LBS_CD_Position, _LBS_CD_Normal, (float3)_LBS_CD_Tangent);//DOTS_CompDef_OL", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("DOTS_LiBleSki(input.indices, input.weights, input.positionOS.xyz, input.normalOS.xyz, input.tangentOS.xyz, (float3)_LBS_CD_Position, _LBS_CD_Normal, (float3)_LBS_CD_Tangent);//DOTS_LiBleSki_OL", "//DOTS_LiBleSki(input.indices, input.weights, input.positionOS.xyz, input.normalOS.xyz, input.tangentOS.xyz, (float3)_LBS_CD_Position, _LBS_CD_Normal, (float3)_LBS_CD_Tangent);//DOTS_LiBleSki_OL", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + + + ChanLi("float4 weights : BLENDWEIGHTS;//DOTS_LiBleSki_FL", "//float4 weights : BLENDWEIGHTS;//DOTS_LiBleSki_FL", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("uint4 indices : BLENDINDICES;//DOTS_LiBleSki_FL", "//uint4 indices : BLENDINDICES;//DOTS_LiBleSki_FL", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("//uint vertexID : SV_VertexID;//DOTS_CompDef_FL", "uint vertexID : SV_VertexID;//DOTS_CompDef_FL", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("//DOTS_CompDef(input.vertexID, (float3)_LBS_CD_Position, _LBS_CD_Normal, (float3)_LBS_CD_Tangent);//DOTS_CompDef_FL", "DOTS_CompDef(input.vertexID, (float3)_LBS_CD_Position, _LBS_CD_Normal, (float3)_LBS_CD_Tangent);//DOTS_CompDef_FL", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("DOTS_LiBleSki(input.indices, input.weights, input.positionOS.xyz, input.normalOS.xyz, input.tangentOS.xyz, (float3)_LBS_CD_Position, _LBS_CD_Normal, (float3)_LBS_CD_Tangent);//DOTS_LiBleSki_FL", "//DOTS_LiBleSki(input.indices, input.weights, input.positionOS.xyz, input.normalOS.xyz, input.tangentOS.xyz, (float3)_LBS_CD_Position, _LBS_CD_Normal, (float3)_LBS_CD_Tangent);//DOTS_LiBleSki_FL", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + + + ChanLi("float4 weights : BLENDWEIGHTS;//DOTS_LiBleSki_GB", "//float4 weights : BLENDWEIGHTS;//DOTS_LiBleSki_GB", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("uint4 indices : BLENDINDICES;//DOTS_LiBleSki_GB", "//uint4 indices : BLENDINDICES;//DOTS_LiBleSki_GB", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("//uint vertexID : SV_VertexID;//DOTS_CompDef_GB", "uint vertexID : SV_VertexID;//DOTS_CompDef_GB", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("//DOTS_CompDef(input.vertexID, (float3)_LBS_CD_Position, _LBS_CD_Normal, (float3)_LBS_CD_Tangent);//DOTS_CompDef_GB", "DOTS_CompDef(input.vertexID, (float3)_LBS_CD_Position, _LBS_CD_Normal, (float3)_LBS_CD_Tangent);//DOTS_CompDef_GB", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("DOTS_LiBleSki(input.indices, input.weights, input.positionOS.xyz, input.normalOS.xyz, input.tangentOS.xyz, (float3)_LBS_CD_Position, _LBS_CD_Normal, (float3)_LBS_CD_Tangent);//DOTS_LiBleSki_GB", "//DOTS_LiBleSki(input.indices, input.weights, input.positionOS.xyz, input.normalOS.xyz, input.tangentOS.xyz, (float3)_LBS_CD_Position, _LBS_CD_Normal, (float3)_LBS_CD_Tangent);//DOTS_LiBleSki_GB", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + + + ChanLi("float4 weights : BLENDWEIGHTS;//DOTS_LiBleSki_SC", "//float4 weights : BLENDWEIGHTS;//DOTS_LiBleSki_SC", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("uint4 indices : BLENDINDICES;//DOTS_LiBleSki_SC", "//uint4 indices : BLENDINDICES;//DOTS_LiBleSki_SC", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("//uint vertexID : SV_VertexID;//DOTS_CompDef_SC", "uint vertexID : SV_VertexID;//DOTS_CompDef_SC", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("//DOTS_CompDef(input.vertexID, (float3)_LBS_CD_Position, _LBS_CD_Normal, (float3)_LBS_CD_Tangent);//DOTS_CompDef_SC", "DOTS_CompDef(input.vertexID, (float3)_LBS_CD_Position, _LBS_CD_Normal, (float3)_LBS_CD_Tangent);//DOTS_CompDef_SC", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("DOTS_LiBleSki(input.indices, input.weights, input.positionOS.xyz, input.normalOS.xyz, input.tangentOS.xyz, (float3)_LBS_CD_Position, _LBS_CD_Normal, (float3)_LBS_CD_Tangent);//DOTS_LiBleSki_SC", "//DOTS_LiBleSki(input.indices, input.weights, input.positionOS.xyz, input.normalOS.xyz, input.tangentOS.xyz, (float3)_LBS_CD_Position, _LBS_CD_Normal, (float3)_LBS_CD_Tangent);//DOTS_LiBleSki_SC", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + + + ChanLi("float4 weights : BLENDWEIGHTS;//DOTS_LiBleSki_DO", "//float4 weights : BLENDWEIGHTS;//DOTS_LiBleSki_DO", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("uint4 indices : BLENDINDICES;//DOTS_LiBleSki_DO", "//uint4 indices : BLENDINDICES;//DOTS_LiBleSki_DO", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("//uint vertexID : SV_VertexID;//DOTS_CompDef_DO", "uint vertexID : SV_VertexID;//DOTS_CompDef_DO", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("//DOTS_CompDef(input.vertexID, (float3)_LBS_CD_Position, _LBS_CD_Normal, (float3)_LBS_CD_Tangent);//DOTS_CompDef_DO", "DOTS_CompDef(input.vertexID, (float3)_LBS_CD_Position, _LBS_CD_Normal, (float3)_LBS_CD_Tangent);//DOTS_CompDef_DO", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("DOTS_LiBleSki(input.indices, input.weights, input.position.xyz, input.normalOS.xyz, input.tangentOS.xyz, (float3)_LBS_CD_Position, _LBS_CD_Normal, (float3)_LBS_CD_Tangent);//DOTS_LiBleSki_DO", "//DOTS_LiBleSki(input.indices, input.weights, input.position.xyz, input.normalOS.xyz, input.tangentOS.xyz, (float3)_LBS_CD_Position, _LBS_CD_Normal, (float3)_LBS_CD_Tangent);//DOTS_LiBleSki_DO", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + + + ChanLi("float4 weights : BLENDWEIGHTS;//DOTS_LiBleSki_DN", "//float4 weights : BLENDWEIGHTS;//DOTS_LiBleSki_DN", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("uint4 indices : BLENDINDICES;//DOTS_LiBleSki_DN", "//uint4 indices : BLENDINDICES;//DOTS_LiBleSki_DN", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("//uint vertexID : SV_VertexID;//DOTS_CompDef_DN", "uint vertexID : SV_VertexID;//DOTS_CompDef_DN", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("//DOTS_CompDef(input.vertexID, (float3)_LBS_CD_Position, _LBS_CD_Normal, (float3)_LBS_CD_Tangent);//DOTS_CompDef_DN", "DOTS_CompDef(input.vertexID, (float3)_LBS_CD_Position, _LBS_CD_Normal, (float3)_LBS_CD_Tangent);//DOTS_CompDef_DN", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("DOTS_LiBleSki(input.indices, input.weights, input.positionOS.xyz, input.normal.xyz, input.tangentOS.xyz, (float3)_LBS_CD_Position, _LBS_CD_Normal, (float3)_LBS_CD_Tangent);//DOTS_LiBleSki_DN", "//DOTS_LiBleSki(input.indices, input.weights, input.positionOS.xyz, input.normal.xyz, input.tangentOS.xyz, (float3)_LBS_CD_Position, _LBS_CD_Normal, (float3)_LBS_CD_Tangent);//DOTS_LiBleSki_DN", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + + + ChanLi("float4 weights : BLENDWEIGHTS;//DOTS_LiBleSki_MV", "//float4 weights : BLENDWEIGHTS;//DOTS_LiBleSki_MV", "Assets/RealToon/RealToon Shaders/RealToon Core/URP/Pass/RT_URP_MoVecPas.hlsl"); + ChanLi("uint4 indices : BLENDINDICES;//DOTS_LiBleSki_MV", "//uint4 indices : BLENDINDICES;//DOTS_LiBleSki_MV", "Assets/RealToon/RealToon Shaders/RealToon Core/URP/Pass/RT_URP_MoVecPas.hlsl"); + ChanLi("//uint vertexID : SV_VertexID;//DOTS_CompDef_MV", "uint vertexID : SV_VertexID;//DOTS_CompDef_MV", "Assets/RealToon/RealToon Shaders/RealToon Core/URP/Pass/RT_URP_MoVecPas.hlsl"); + ChanLi("//DOTS_CompDef(input.vertexID, (float3)_LBS_CD_Position, _LBS_CD_Normal, (float3)_LBS_CD_Tangent);//DOTS_CompDef_MV", "DOTS_CompDef(input.vertexID, (float3)_LBS_CD_Position, _LBS_CD_Normal, (float3)_LBS_CD_Tangent);//DOTS_CompDef_MV", "Assets/RealToon/RealToon Shaders/RealToon Core/URP/Pass/RT_URP_MoVecPas.hlsl"); + ChanLi("DOTS_LiBleSki(input.indices, input.weights, input.position.xyz, input.normalOS.xyz, input.tangentOS.xyz, (float3)_LBS_CD_Position, _LBS_CD_Normal, (float3)_LBS_CD_Tangent);//DOTS_LiBleSki_MV", "//DOTS_LiBleSki(input.indices, input.weights, input.position.xyz, input.normalOS.xyz, input.tangentOS.xyz, (float3)_LBS_CD_Position, _LBS_CD_Normal, (float3)_LBS_CD_Tangent);//DOTS_LiBleSki_MV", "Assets/RealToon/RealToon Shaders/RealToon Core/URP/Pass/RT_URP_MoVecPas.hlsl"); + + + AssetDatabase.ImportAsset("Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + AssetDatabase.ImportAsset("Assets/RealToon/RealToon Shaders/RealToon Core/URP/Pass/RT_URP_MoVecPas.hlsl"); + AssetDatabase.ImportAsset("Assets/RealToon/Editor/RealToonShaderGUI_URP_SRP.cs"); + Debug.LogWarning("DOTS|HR - Compute Deformation is now use, This will enable you to use BlendShapes and other deformation."); + + } + else if (dots_lbs_cd == true) + { + ChanLi("static bool dots_lbs_cd = true;", "static bool dots_lbs_cd = false;", "Assets/RealToon/Editor/RealToonShaderGUI_URP_SRP.cs"); + ChanLi("static string dots_lbs_cd_string = " + (char)34 + "DOTS|HR - Use Linear Blend Skinning" + (char)34 + ";", "static string dots_lbs_cd_string = " + (char)34 + "DOTS|HR - Use Compute Deformation" + (char)34 + ";", "Assets/RealToon/Editor/RealToonShaderGUI_URP_SRP.cs"); + + + ChanLi("//float4 weights : BLENDWEIGHTS;//DOTS_LiBleSki_OL", "float4 weights : BLENDWEIGHTS;//DOTS_LiBleSki_OL", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("//uint4 indices : BLENDINDICES;//DOTS_LiBleSki_OL", "uint4 indices : BLENDINDICES;//DOTS_LiBleSki_OL", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("uint vertexID : SV_VertexID;//DOTS_CompDef_OL", "//uint vertexID : SV_VertexID;//DOTS_CompDef_OL", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("DOTS_CompDef(input.vertexID, (float3)_LBS_CD_Position, _LBS_CD_Normal, (float3)_LBS_CD_Tangent);//DOTS_CompDef_OL", "//DOTS_CompDef(input.vertexID, (float3)_LBS_CD_Position, _LBS_CD_Normal, (float3)_LBS_CD_Tangent);//DOTS_CompDef_OL", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("//DOTS_LiBleSki(input.indices, input.weights, input.positionOS.xyz, input.normalOS.xyz, input.tangentOS.xyz, (float3)_LBS_CD_Position, _LBS_CD_Normal, (float3)_LBS_CD_Tangent);//DOTS_LiBleSki_OL", "DOTS_LiBleSki(input.indices, input.weights, input.positionOS.xyz, input.normalOS.xyz, input.tangentOS.xyz, (float3)_LBS_CD_Position, _LBS_CD_Normal, (float3)_LBS_CD_Tangent);//DOTS_LiBleSki_OL", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + + + ChanLi("//float4 weights : BLENDWEIGHTS;//DOTS_LiBleSki_FL", "float4 weights : BLENDWEIGHTS;//DOTS_LiBleSki_FL", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("//uint4 indices : BLENDINDICES;//DOTS_LiBleSki_FL", "uint4 indices : BLENDINDICES;//DOTS_LiBleSki_FL", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("uint vertexID : SV_VertexID;//DOTS_CompDef_FL", "//uint vertexID : SV_VertexID;//DOTS_CompDef_FL", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("DOTS_CompDef(input.vertexID, (float3)_LBS_CD_Position, _LBS_CD_Normal, (float3)_LBS_CD_Tangent);//DOTS_CompDef_FL", "//DOTS_CompDef(input.vertexID, (float3)_LBS_CD_Position, _LBS_CD_Normal, (float3)_LBS_CD_Tangent);//DOTS_CompDef_FL", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("//DOTS_LiBleSki(input.indices, input.weights, input.positionOS.xyz, input.normalOS.xyz, input.tangentOS.xyz, (float3)_LBS_CD_Position, _LBS_CD_Normal, (float3)_LBS_CD_Tangent);//DOTS_LiBleSki_FL", "DOTS_LiBleSki(input.indices, input.weights, input.positionOS.xyz, input.normalOS.xyz, input.tangentOS.xyz, (float3)_LBS_CD_Position, _LBS_CD_Normal, (float3)_LBS_CD_Tangent);//DOTS_LiBleSki_FL", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + + + ChanLi("//float4 weights : BLENDWEIGHTS;//DOTS_LiBleSki_GB", "float4 weights : BLENDWEIGHTS;//DOTS_LiBleSki_GB", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("//uint4 indices : BLENDINDICES;//DOTS_LiBleSki_GB", "uint4 indices : BLENDINDICES;//DOTS_LiBleSki_GB", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("uint vertexID : SV_VertexID;//DOTS_CompDef_GB", "//uint vertexID : SV_VertexID;//DOTS_CompDef_GB", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("DOTS_CompDef(input.vertexID, (float3)_LBS_CD_Position, _LBS_CD_Normal, (float3)_LBS_CD_Tangent);//DOTS_CompDef_GB", "//DOTS_CompDef(input.vertexID, (float3)_LBS_CD_Position, _LBS_CD_Normal, (float3)_LBS_CD_Tangent);//DOTS_CompDef_GB", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("//DOTS_LiBleSki(input.indices, input.weights, input.positionOS.xyz, input.normalOS.xyz, input.tangentOS.xyz, (float3)_LBS_CD_Position, _LBS_CD_Normal, (float3)_LBS_CD_Tangent);//DOTS_LiBleSki_GB", "DOTS_LiBleSki(input.indices, input.weights, input.positionOS.xyz, input.normalOS.xyz, input.tangentOS.xyz, (float3)_LBS_CD_Position, _LBS_CD_Normal, (float3)_LBS_CD_Tangent);//DOTS_LiBleSki_GB", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + + + ChanLi("//float4 weights : BLENDWEIGHTS;//DOTS_LiBleSki_SC", "float4 weights : BLENDWEIGHTS;//DOTS_LiBleSki_SC", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("//uint4 indices : BLENDINDICES;//DOTS_LiBleSki_SC", "uint4 indices : BLENDINDICES;//DOTS_LiBleSki_SC", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("uint vertexID : SV_VertexID;//DOTS_CompDef_SC", "//uint vertexID : SV_VertexID;//DOTS_CompDef_SC", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("DOTS_CompDef(input.vertexID, (float3)_LBS_CD_Position, _LBS_CD_Normal, (float3)_LBS_CD_Tangent);//DOTS_CompDef_SC", "//DOTS_CompDef(input.vertexID, (float3)_LBS_CD_Position, _LBS_CD_Normal, (float3)_LBS_CD_Tangent);//DOTS_CompDef_SC", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("//DOTS_LiBleSki(input.indices, input.weights, input.positionOS.xyz, input.normalOS.xyz, input.tangentOS.xyz, (float3)_LBS_CD_Position, _LBS_CD_Normal, (float3)_LBS_CD_Tangent);//DOTS_LiBleSki_SC", "DOTS_LiBleSki(input.indices, input.weights, input.positionOS.xyz, input.normalOS.xyz, input.tangentOS.xyz, (float3)_LBS_CD_Position, _LBS_CD_Normal, (float3)_LBS_CD_Tangent);//DOTS_LiBleSki_SC", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + + + ChanLi("//float4 weights : BLENDWEIGHTS;//DOTS_LiBleSki_DO", "float4 weights : BLENDWEIGHTS;//DOTS_LiBleSki_DO", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("//uint4 indices : BLENDINDICES;//DOTS_LiBleSki_DO", "uint4 indices : BLENDINDICES;//DOTS_LiBleSki_DO", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("uint vertexID : SV_VertexID;//DOTS_CompDef_DO", "//uint vertexID : SV_VertexID;//DOTS_CompDef_DO", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("DOTS_CompDef(input.vertexID, (float3)_LBS_CD_Position, _LBS_CD_Normal, (float3)_LBS_CD_Tangent);//DOTS_CompDef_DO", "//DOTS_CompDef(input.vertexID, (float3)_LBS_CD_Position, _LBS_CD_Normal, (float3)_LBS_CD_Tangent);//DOTS_CompDef_DO", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("//DOTS_LiBleSki(input.indices, input.weights, input.position.xyz, input.normalOS.xyz, input.tangentOS.xyz, (float3)_LBS_CD_Position, _LBS_CD_Normal, (float3)_LBS_CD_Tangent);//DOTS_LiBleSki_DO", "DOTS_LiBleSki(input.indices, input.weights, input.position.xyz, input.normalOS.xyz, input.tangentOS.xyz, (float3)_LBS_CD_Position, _LBS_CD_Normal, (float3)_LBS_CD_Tangent);//DOTS_LiBleSki_DO", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + + + ChanLi("//float4 weights : BLENDWEIGHTS;//DOTS_LiBleSki_DN", "float4 weights : BLENDWEIGHTS;//DOTS_LiBleSki_DN", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("//uint4 indices : BLENDINDICES;//DOTS_LiBleSki_DN", "uint4 indices : BLENDINDICES;//DOTS_LiBleSki_DN", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("uint vertexID : SV_VertexID;//DOTS_CompDef_DN", "//uint vertexID : SV_VertexID;//DOTS_CompDef_DN", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("DOTS_CompDef(input.vertexID, (float3)_LBS_CD_Position, _LBS_CD_Normal, (float3)_LBS_CD_Tangent);//DOTS_CompDef_DN", "//DOTS_CompDef(input.vertexID, (float3)_LBS_CD_Position, _LBS_CD_Normal, (float3)_LBS_CD_Tangent);//DOTS_CompDef_DN", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("//DOTS_LiBleSki(input.indices, input.weights, input.positionOS.xyz, input.normal.xyz, input.tangentOS.xyz, (float3)_LBS_CD_Position, _LBS_CD_Normal, (float3)_LBS_CD_Tangent);//DOTS_LiBleSki_DN", "DOTS_LiBleSki(input.indices, input.weights, input.positionOS.xyz, input.normal.xyz, input.tangentOS.xyz, (float3)_LBS_CD_Position, _LBS_CD_Normal, (float3)_LBS_CD_Tangent);//DOTS_LiBleSki_DN", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + + + ChanLi("//float4 weights : BLENDWEIGHTS;//DOTS_LiBleSki_MV", "float4 weights : BLENDWEIGHTS;//DOTS_LiBleSki_MV", "Assets/RealToon/RealToon Shaders/RealToon Core/URP/Pass/RT_URP_MoVecPas.hlsl"); + ChanLi("//uint4 indices : BLENDINDICES;//DOTS_LiBleSki_MV", "uint4 indices : BLENDINDICES;//DOTS_LiBleSki_MV", "Assets/RealToon/RealToon Shaders/RealToon Core/URP/Pass/RT_URP_MoVecPas.hlsl"); + ChanLi("uint vertexID : SV_VertexID;//DOTS_CompDef_MV", "//uint vertexID : SV_VertexID;//DOTS_CompDef_MV", "Assets/RealToon/RealToon Shaders/RealToon Core/URP/Pass/RT_URP_MoVecPas.hlsl"); + ChanLi("DOTS_CompDef(input.vertexID, (float3)_LBS_CD_Position, _LBS_CD_Normal, (float3)_LBS_CD_Tangent);//DOTS_CompDef_MV", "//DOTS_CompDef(input.vertexID, (float3)_LBS_CD_Position, _LBS_CD_Normal, (float3)_LBS_CD_Tangent);//DOTS_CompDef_MV", "Assets/RealToon/RealToon Shaders/RealToon Core/URP/Pass/RT_URP_MoVecPas.hlsl"); + ChanLi("//DOTS_LiBleSki(input.indices, input.weights, input.position.xyz, input.normalOS.xyz, input.tangentOS.xyz, (float3)_LBS_CD_Position, _LBS_CD_Normal, (float3)_LBS_CD_Tangent);//DOTS_LiBleSki_MV", "DOTS_LiBleSki(input.indices, input.weights, input.position.xyz, input.normalOS.xyz, input.tangentOS.xyz, (float3)_LBS_CD_Position, _LBS_CD_Normal, (float3)_LBS_CD_Tangent);//DOTS_LiBleSki_MV", "Assets/RealToon/RealToon Shaders/RealToon Core/URP/Pass/RT_URP_MoVecPas.hlsl"); + + + AssetDatabase.ImportAsset("Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + AssetDatabase.ImportAsset("Assets/RealToon/RealToon Shaders/RealToon Core/URP/Pass/RT_URP_MoVecPas.hlsl"); + AssetDatabase.ImportAsset("Assets/RealToon/Editor/RealToonShaderGUI_URP_SRP.cs"); + Debug.LogWarning("DOTS|HR - Linear Blending Skinning is now use."); + } + } + + #endregion + + #region ADD_ST + void ADD_ST() + { + if (add_st == true) + { + ChanLi("static bool add_st = true;", "static bool add_st = false;", "Assets/RealToon/Editor/RealToonShaderGUI_URP_SRP.cs"); + ChanLi("static string add_st_string = " + (char)34 + "Add 'See Through' feature" + (char)34 + ";", "static string add_st_string = " + (char)34 + "Remove 'See Through' feature" + (char)34 + ";", "Assets/RealToon/Editor/RealToonShaderGUI_URP_SRP.cs"); + + ChanLi("/*//O_ST", "//O_ST/*", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("/*//F_ST", "//F_ST/*", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("/*//G_ST", "//G_ST/*", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("Pass [_OutStenPass]//O_PI", "//Pass [_OutStenPass]//O_PI", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + + AssetDatabase.ImportAsset("Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + AssetDatabase.ImportAsset("Assets/RealToon/Editor/RealToonShaderGUI_URP_SRP.cs"); + Debug.LogWarning("'See Through feature' has been added."); + } + else if (add_st == false) + { + ChanLi("static bool add_st = false;", "static bool add_st = true;", "Assets/RealToon/Editor/RealToonShaderGUI_URP_SRP.cs"); + ChanLi("static string add_st_string = " + (char)34 + "Remove 'See Through' feature" + (char)34 + ";", "static string add_st_string = " + (char)34 + "Add 'See Through' feature" + (char)34 + ";", "Assets/RealToon/Editor/RealToonShaderGUI_URP_SRP.cs"); + ChanLi("//Pass [_OutStenPass]//O_PI", "Pass [_OutStenPass]//O_PI", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + + ChanLi("//O_ST/*", "/*//O_ST", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("//F_ST/*", "/*//F_ST", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + ChanLi("//G_ST/*", "/*//G_ST", "Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + + AssetDatabase.ImportAsset("Assets/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader"); + AssetDatabase.ImportAsset("Assets/RealToon/Editor/RealToonShaderGUI_URP_SRP.cs"); + Debug.LogWarning("'See Through feature' has been remove."); + } + } + #endregion + } + +} + +#endif diff --git a/RealToon/RealToon/Editor/RealToonShaderGUI_URP_SRP.cs.meta b/RealToon/RealToon/Editor/RealToonShaderGUI_URP_SRP.cs.meta new file mode 100644 index 0000000..e542e6f --- /dev/null +++ b/RealToon/RealToon/Editor/RealToonShaderGUI_URP_SRP.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e44691c063f9e5943b99e9a918b7647a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/RealToon/RealToon/Editor/SwapShaderToRealToon.cs b/RealToon/RealToon/Editor/SwapShaderToRealToon.cs new file mode 100644 index 0000000..db9a2d2 --- /dev/null +++ b/RealToon/RealToon/Editor/SwapShaderToRealToon.cs @@ -0,0 +1,1849 @@ +//Swap Shader To RealToon +//MJQStudioWorks +//2025 + +using UnityEngine; +using UnityEditor; + +namespace RealToon.Tools +{ + public class SwapShaderToRealToon : EditorWindow + { + #region Variables + + private string ShaderName = string.Empty; + + private Color ShaColor = Color.white; + private Color ShaEmiColor = Color.black; + private Color VRMShadeColor = Color.black; + private Color VRMRimColor = Color.black; + private Color VRMOutliColor = Color.black; + private Color ShaSpecCol = Color.black; + private Color RTBiPDefCol = new Color(0.6886792f, 0.6886792f, 0.6886792f); + + private float MatType = 0.0f; + private float ShaNormalScale = 0.0f; + private float CullingMode = 0.0f; + private float VRMOutlineMode = 0.0f; + private float ShaSmooth = 0.0f; + private float ShaAlpClip = 0.0f; + private float ShaMetal = 0.0f; + private float ShaSpecHighEn = 0.0f; + private float ShaRefEn = 0.0f; + private float ShaWorFloMod = 0.0f; + private float ShaMetaRemMinMax = 0.0f; + private float ShaSmoRemMinMax = 0.0f; + private float ShaDoubSid = 0.0f; + private float ShaMatID = 0.0f; + + private Texture ShaMainTex = null; + private Texture ShaNormalMap = null; + private Texture ShaEmiMap = null; + private Texture ShaMetaMap = null; + private Texture ShaSpecMap = null; + private Texture ShaMasMa = null; + private Texture VRMShaOutWid = null; + + private bool Enswap = true; + private bool SKEmi = false; + private bool ForTrasCuto = true; + private bool EnhaHiLighColInt = true; + private bool IncShaCol = true; + private bool IncEmi = false; + private bool EnaGiSha = false; + private bool GiFlaLo = false; + private bool FERL = false; + private bool FUL = false; + private bool UsEmiMapAnColAsGloTex = false; + private bool DisRecSha = false; + private bool LigAffSha = false; + static string InfoString = string.Empty; + private string FromShader = "VRoid|VRM"; + private string UnShaType = string.Empty; + private string ProcMat = "None"; + static string SupShaURP = string.Empty; + static string SupShaHDRP = string.Empty; + static string SupShaBiRP = string.Empty; + static string SupShaVRM = string.Empty; + + private int MatNum = 0; + static float WinHig = 700; + static EditorWindow EdiWin; + static Shader ShaRTURP; + static Shader ShaRTHDRP; + static Shader ShaRTBID; + static Shader ShaRTBIFT; + static Shader ShaVRM; + static Shader ShaVRM10; + static Shader ShaVRM10URP; + private string RTShader = "No RealToon Shader In Your Project"; + + int ToBaInt = 0; + private string[] tobastrings = { "VRoid|VRM", "Unity" }; + + private Vector2 scroll; + + #endregion + + [MenuItem("Window/RealToon/Shader Swap to RealToon")] + static void Init() + { + EdiWin = GetWindow(true); + EdiWin.titleContent = new GUIContent("Swap Shader to RealToon"); + WinHig = 700; + EdiWin.minSize = new Vector2(420, WinHig); + EdiWin.maxSize = new Vector2(420, WinHig); + ShaRTURP = Shader.Find("Universal Render Pipeline/RealToon/Version 5/Default/Default"); + ShaRTHDRP = Shader.Find("HDRP/RealToon/Version 5/Default"); + ShaRTBID = Shader.Find("RealToon/Version 5/Default/Default"); + ShaRTBIFT = Shader.Find("RealToon/Version 5/Default/Fade Transparency"); + ShaVRM = Shader.Find("VRM/MToon"); + ShaVRM10 = Shader.Find("VRM10/MToon10"); + ShaVRM10URP = Shader.Find("VRM10/Universal Render Pipeline/MToon10"); + + SupShaURP = "Supported Unity URP Shaders:\n" + + "*Complex Lit\n" + + "*Lit\n" + + "*Simple Lit\n" + + "*Unlit\n" + + "*Baked Lit\n\n"; + + SupShaHDRP = "Supported Unity HDRP Shaders:\n" + + "*Lit\n" + + "*LitTessellation\n" + + "*Unlit\n\n"; + + SupShaBiRP = "Supported Unity Built-In Shaders:\n" + + "*Standard\n" + + "*Standard (Specular setup)\n" + + "*Unlit/Color\n" + + "*Unlit/Texture\n" + + "*Unlit/Transparent\n" + + "*Unlit/Transparent Cutout\n\n"; + + SupShaVRM = "Supported VRoid|VRM Shaders:\n" + + "*VRM\n" + + "*VRM10\n" + + "*VRM10 [URP]\n\n"; + + InfoString = SupShaVRM; + + //For Future Use + //EditorWindow.GetWindow(typeof(SwapShaderToRealToon)); + //EdiWin.ShowTab(); + } + + void OnGUI() + { + Object[] mat = Selection.GetFiltered(typeof(Material), SelectionMode.Assets); + var lblcenstyle = new GUIStyle(GUI.skin.label) { alignment = TextAnchor.MiddleCenter }; + + #region Checking + + if (ShaRTURP) + { + Enswap = true; + RTShader = "Click To Swap To RealToon (URP) Shader"; + } + else if (ShaRTHDRP) + { + Enswap = true; + RTShader = "Click To Swap To RealToon (HDRP) Shader"; + } + else if (ShaRTBID && ShaRTBIFT) + { + Enswap = true; + RTShader = "Click To Swap To RealToon (Built-In) Shader"; + } + else if (ShaRTURP && ShaRTHDRP && (ShaRTBID && ShaRTBIFT)) + { + Enswap = false; + RTShader = "Use One RealToon Shader For Each Render Pipeline"; + } + else + { + Enswap = false; + RTShader = "No RealToon Built-In/URP/HDRP Shader In Your Project"; + } + + GUILayout.Space(10); + GUILayout.Label("From Shader:"); + EditorGUI.BeginChangeCheck(); + ToBaInt = GUILayout.Toolbar(ToBaInt, tobastrings); + if (EditorGUI.EndChangeCheck()) + { + FromShader = tobastrings[ToBaInt]; + + if (ToBaInt == 1) + { + WinHig = 550; + EdiWin.minSize = new Vector2(420, WinHig); + EdiWin.maxSize = new Vector2(420, WinHig); + + if (Shader.Find("Universal Render Pipeline/Complex Lit") || Shader.Find("Universal Render Pipeline/Lit") || Shader.Find("Universal Render Pipeline/Simple Lit") || Shader.Find("Universal Render Pipeline/Unlit") || Shader.Find("Universal Render Pipeline/Baked Lit")) + { + UnShaType = "(URP)"; + InfoString = SupShaURP; + + } + else if (Shader.Find("HDRP/Lit") || Shader.Find("HDRP/LitTessellation") || Shader.Find("HDRP/Unlit")) + { + UnShaType = "(HDRP)"; + InfoString = SupShaHDRP; + + } + else if (Shader.Find("Standard") || Shader.Find("Standard (Specular setup)") || Shader.Find("Unlit/Color") || Shader.Find("Unlit/Texture") || Shader.Find("Unlit/Transparent") || Shader.Find("Unlit/Transparent Cutout")) + { + UnShaType = "(Built-In)"; + InfoString = SupShaBiRP; + + } + else + { + UnShaType = string.Empty; + } + } + if (ToBaInt == 0) + { + WinHig = 700; + EdiWin.minSize = new Vector2(420, WinHig); + EdiWin.maxSize = new Vector2(420, WinHig); + + UnShaType = string.Empty; + InfoString = SupShaVRM; + } + } + + #endregion + + GUILayout.Space(10); + GUILayout.Label("Selected: " + FromShader + " Shader " + UnShaType, lblcenstyle); + + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + GUILayout.Space(10); + + #region Processing + + EditorGUI.BeginDisabledGroup(Enswap == false); + if (GUILayout.Button(RTShader)) + { + + if (mat.Length == 0) + { + InfoString = "Please Select Materials\n\n"; + } + else + { + InfoString = string.Empty; + MatNum = 0; + + foreach (Material m in mat) + { + ProcMat = m.name; + + if (ToBaInt == 0) + { + if (ShaVRM || ShaVRM10) + { + if (m.shader.name == "VRM/MToon" || m.shader.name == "VRM10/MToon10" || m.shader.name == "VRM10/Universal Render Pipeline/MToon10") + { + ShaderName = m.shader.name; + + if (ShaderName == "VRM10/MToon10" || m.shader.name == "VRM10/Universal Render Pipeline/MToon10") + { + MatType = m.GetFloat("_AlphaMode"); + } + else if (ShaderName == "VRM/MToon") + { + MatType = m.GetFloat("_BlendMode"); + } + + ShaMainTex = m.GetTexture("_MainTex"); + ShaNormalMap = m.GetTexture("_BumpMap"); + VRMShaOutWid = m.GetTexture("_OutlineWidthTex"); + ShaNormalScale = m.GetFloat("_BumpScale"); + ShaColor = m.GetColor("_Color"); + VRMShadeColor = m.GetColor("_ShadeColor"); + + if (ShaderName == "VRM10/MToon10" || m.shader.name == "VRM10/Universal Render Pipeline/MToon10") + { + CullingMode = m.GetFloat("_DoubleSided"); + } + else if (ShaderName == "VRM/MToon") + { + CullingMode = m.GetFloat("_CullMode"); + } + + ShaEmiMap = m.GetTexture("_EmissionMap"); + ShaEmiColor = m.GetColor("_EmissionColor"); + + if (m.HasProperty("_RimColor")) + { + VRMRimColor = m.GetColor("_RimColor"); + } + + VRMOutlineMode = m.GetFloat("_OutlineWidthMode"); + VRMOutliColor = m.GetColor("_OutlineColor"); + + } + else if (m.shader.name != "VRM/MToon" || m.shader.name != "VRM10/MToon10" || m.shader.name == "VRM10/Universal Render Pipeline/MToon10") + { + InfoString += "The selected '" + m.name + "' material, shader is not supported.\n '" + m.shader.name + "'\n\n" + SupShaVRM; + } + + if (ShaderName == "VRM/MToon" || ShaderName == "VRM10/MToon10" || m.shader.name == "VRM10/Universal Render Pipeline/MToon10") + { + + if (ShaRTURP) + { + m.shader = ShaRTURP; + } + else if (ShaRTHDRP) + { + m.shader = ShaRTHDRP; + } + else if (ShaRTBID) + { + m.shader = ShaRTBID; + } + + InfoString += "Processing Material: " + m.name + "\nPrevious Shader: " + ShaderName; + + if (FUL == true) + { + FERL = false; + IncEmi = false; + DisRecSha = false; + LigAffSha = false; + } + + m.SetFloat("_OutlineWidth", 0.12f); + + if (VRMShaOutWid != null) + { + m.SetTexture("_OutlineWidthControl", VRMShaOutWid); + } + + if (ForTrasCuto != true) + { + if (MatType == 2.0f) + { + if (!ShaRTBID) + { + m.SetInt("_BleModSour", 5); + m.SetInt("_BleModDest", 10); + + m.EnableKeyword("N_F_TRANS_ON"); + m.SetFloat("_TRANSMODE", 1.0f); + m.renderQueue = 3000; + m.SetOverrideTag("RenderType", "Transparent"); + + if (ShaRTHDRP) + { + if ((m.IsKeywordEnabled("N_F_R_ON") && (m.IsKeywordEnabled("N_F_ESSR_ON") || m.GetFloat("_N_F_ESSR") == 1.0f)) || ((m.IsKeywordEnabled("N_F_ESSGI_ON") || m.GetFloat("_N_F_ESSGI") == 1.0f))) + { + m.SetInt("_SSRefDeOn", 0); + m.SetInt("_SSRefGBu", 2); + m.SetInt("_SSRefMoVe", 32); + } + + m.SetInt("_ZTeForLiOpa", 4); + } + } + else if (ShaRTBID) + { + m.shader = ShaRTBIFT; + } + + } + else if (MatType == 1.0f) + { + if (!ShaRTBID) + { + m.SetInt("_BleModSour", 5); + m.SetInt("_BleModDest", 10); + + m.EnableKeyword("N_F_TRANS_ON"); + m.SetFloat("_TRANSMODE", 1.0f); + + m.EnableKeyword("N_F_CO_ON"); + m.SetFloat("_N_F_CO", 1.0f); + + m.SetInt("_ZWrite", 1); + + if (ShaRTURP) + { + m.SetFloat("_Cutout", 0.4f); + } + else if (ShaRTHDRP) + { + m.SetFloat("_Cutout", 0.51f); + } + + m.renderQueue = 2450; + m.SetOverrideTag("RenderType", "TransparentCutout"); + + if (ShaRTHDRP) + { + if ((m.IsKeywordEnabled("N_F_R_ON") && (m.IsKeywordEnabled("N_F_ESSR_ON") || m.GetFloat("_N_F_ESSR") == 1.0f)) || ((m.IsKeywordEnabled("N_F_ESSGI_ON") || m.GetFloat("_N_F_ESSGI") == 1.0f))) + { + m.SetInt("_SSRefDeOn", 8); + m.SetInt("_SSRefGBu", 10); + m.SetInt("_SSRefMoVe", 40); + } + + m.SetInt("_ZTeForLiOpa", 3); + } + + } + else if (ShaRTBID) + { + m.shader = ShaRTBID; + m.EnableKeyword("N_F_CO_ON"); + m.SetFloat("_N_F_CO", 1.0f); + m.SetFloat("_Cutout", 0.4f); + + } + } + + } + else if (ForTrasCuto == true) + { + if (MatType == 1.0f || MatType == 2.0f) + { + if (!ShaRTBID) + { + m.SetInt("_BleModSour", 5); + m.SetInt("_BleModDest", 10); + + m.EnableKeyword("N_F_TRANS_ON"); + m.SetFloat("_TRANSMODE", 1.0f); + + m.EnableKeyword("N_F_CO_ON"); + m.SetFloat("_N_F_CO", 1.0f); + + m.SetInt("_ZWrite", 1); + + if (ShaRTURP) + { + m.SetFloat("_Cutout", 0.4f); + } + else if (ShaRTHDRP) + { + m.SetFloat("_Cutout", 0.51f); + } + + m.renderQueue = 2450; + m.SetOverrideTag("RenderType", "TransparentCutout"); + + if (ShaRTHDRP) + { + if ((m.IsKeywordEnabled("N_F_R_ON") && (m.IsKeywordEnabled("N_F_ESSR_ON") || m.GetFloat("_N_F_ESSR") == 1.0f)) || ((m.IsKeywordEnabled("N_F_ESSGI_ON") || m.GetFloat("_N_F_ESSGI") == 1.0f))) + { + m.SetInt("_SSRefDeOn", 8); + m.SetInt("_SSRefGBu", 10); + m.SetInt("_SSRefMoVe", 40); + } + + m.SetInt("_ZTeForLiOpa", 3); + } + + } + else if (ShaRTBID) + { + m.shader = ShaRTBID; + m.EnableKeyword("N_F_CO_ON"); + m.SetFloat("_N_F_CO", 1.0f); + m.SetFloat("_Cutout", 0.4f); + + } + } + } + + if (ShaRTURP) + { + if (EnhaHiLighColInt == true) + { + m.SetFloat("_HighlightColorPower", 0.7f); + m.SetFloat("_OverallShadowColorPower", 0.7f); + } + } + else if (ShaRTHDRP) + { + if (EnhaHiLighColInt == true) + { + m.SetFloat("_HighlightColorPower", 1.7f); + } + } + else if (ShaRTBID) + { + if (PlayerSettings.colorSpace != ColorSpace.Gamma) + { + if (EnhaHiLighColInt == true) + { + if (m.GetColor("_MainColor") == RTBiPDefCol) + { + m.SetColor("_MainColor", new Color(1.0f, 1.0f, 1.0f)); + m.SetFloat("_HighlightColorPower", 0.8f); + } + else + { + m.SetFloat("_HighlightColorPower", 0.8f); + } + } + } + } + + if (ShaNormalMap != null) + { + m.EnableKeyword("N_F_NM_ON"); + m.SetFloat("_N_F_NM", 1.0f); + m.SetTexture("_NormalMap", ShaNormalMap); + m.SetFloat("_NormalMapIntensity", ShaNormalScale); + } + + if (!ShaRTBID) + { + if (ShaColor != Color.white) + { + m.SetColor("_MainColor", ShaColor * ShaColor); + } + if (VRMShadeColor != Color.black) + { + m.SetColor("_OverallShadowColor", VRMShadeColor * VRMShadeColor); + if (IncShaCol == false) + { + m.SetColor("_OverallShadowColor", new Color(0.4f, 0.4f, 0.4f)); + } + } + } + else if (ShaRTBID) + { + if (ShaColor != Color.white) + { + if (PlayerSettings.colorSpace == ColorSpace.Gamma) + { + m.SetColor("_MainColor", ShaColor * RTBiPDefCol); + } + else + { + m.SetColor("_MainColor", ShaColor); + } + } + + if (VRMShadeColor != Color.black && IncShaCol == true) + { + if (PlayerSettings.colorSpace == ColorSpace.Gamma) + { + m.SetColor("_OverallShadowColor", VRMShadeColor * RTBiPDefCol); + } + else + { + m.SetColor("_OverallShadowColor", VRMShadeColor); + } + } + else if (IncShaCol == false) + { + m.SetColor("_OverallShadowColor", new Color(0.4f, 0.4f, 0.4f)); + } + + if ((ShaColor == Color.white) && EnhaHiLighColInt == false) + { + m.SetColor("_MainColor", RTBiPDefCol); + } + } + + if (!ShaRTBID) + { + if (ShaderName == "VRM10/MToon10" || m.shader.name == "VRM10/Universal Render Pipeline/MToon10") + { + if (CullingMode != 0.0f) + { + if (CullingMode == 1.0) + { + m.SetFloat("_Culling", 0); + } + } + } + else if (ShaderName == "VRM/MToon") + { + if (CullingMode != 2.0f) + { + m.SetFloat("_Culling", CullingMode); + } + } + } + else if (ShaRTBID) + { + if (ShaderName == "VRM10/MToon10" || m.shader.name == "VRM10/Universal Render Pipeline/MToon10") + { + if (CullingMode == 1.0) + { + m.SetFloat("_Culling", 0); + } + else if (CullingMode == 0.0) + { + m.SetFloat("_Culling", 2); + } + } + else if (ShaderName == "VRM/MToon") + { + if (CullingMode == 2.0f || CullingMode == 1.0f) + { + m.SetFloat("_DoubleSided", 2); + } + else if (CullingMode == 0.0f) + { + m.SetFloat("_DoubleSided", 0); + } + } + } + + if (IncEmi == true) + { + if (ShaEmiMap != null || ShaEmiColor != Color.black) + { + m.EnableKeyword("N_F_SL_ON"); + m.SetFloat("_N_F_SL", 1.0f); + m.SetFloat("_SelfLitIntensity", 1.0f); + m.SetFloat("_SelfLitHighContrast", 0.0F); + m.SetFloat("_SelfLitPower", 20.0f); + m.SetTexture("_MaskSelfLit", ShaEmiMap); + if (!ShaRTBID) + { + m.SetColor("_SelfLitColor", ShaEmiColor * ShaEmiColor); + } + else if (ShaRTBID) + { + if (PlayerSettings.colorSpace == ColorSpace.Gamma) + { + m.SetColor("_SelfLitColor", ShaEmiColor * RTBiPDefCol); + } + else + { + m.SetColor("_SelfLitColor", ShaEmiColor); + } + } + } + } + + if (FERL == false) + { + if ((VRMRimColor != Color.black && m.HasProperty("_RimColor")) || m.HasProperty("_RimColor")) + { + m.EnableKeyword("N_F_RL_ON"); + m.SetFloat("_N_F_RL", 1.0f); + if (!ShaRTBID) + { + m.SetColor("_RimLightColor", VRMRimColor * VRMRimColor); + } + else if (ShaRTBID) + { + if (PlayerSettings.colorSpace == ColorSpace.Gamma) + { + m.SetColor("_RimLightColor", VRMRimColor * RTBiPDefCol); + } + else + { + m.SetColor("_RimLightColor", VRMRimColor); + } + } + } + } + else if (FERL == true) + { + m.EnableKeyword("N_F_RL_ON"); + m.SetFloat("_N_F_RL", 1.0f); + m.SetFloat("_RimLightSoftness", 0.0f); + m.SetFloat("_RimLightUnfill", 2.3f); + + if (ShaRTHDRP || ShaRTURP) + { + m.SetFloat("_RimLigInt", 0.2f); + } + + m.SetColor("_RimLightColor", new Color(1.0f, 1.0f, 1.0f)); + + } + + if (VRMOutlineMode == 1 || VRMOutlineMode == 2) + { + if (!ShaRTBID) + { + m.SetColor("_OutlineColor", VRMOutliColor * VRMOutliColor); + } + else if (ShaRTBID) + { + if (PlayerSettings.colorSpace == ColorSpace.Gamma) + { + m.SetColor("_OutlineColor", VRMOutliColor * RTBiPDefCol); + } + else + { + m.SetColor("_OutlineColor", VRMOutliColor); + } + } + } + + if (UsEmiMapAnColAsGloTex == true) + { + if (ShaEmiMap != null) + { + m.EnableKeyword("N_F_GLO_ON"); + m.SetFloat("_N_F_GLO", 1.0f); + m.EnableKeyword("N_F_GLOT_ON"); + m.SetFloat("_N_F_GLOT", 1.0f); + m.SetTexture("_GlossTexture", ShaEmiMap); + m.SetTextureOffset("_GlossTexture", new Vector2(0.0f, 0.28f)); + + if (ShaRTHDRP) + { + m.SetFloat("_GlossIntensity", 0.35f); + } + else if (ShaRTURP) + { + m.SetFloat("_GlossIntensity", 0.055f); + } + + if (ShaRTBID) + { + m.SetFloat("_GlossColorPower", 100.0f); + } + + if (ShaEmiColor != Color.black) + { + if (!ShaRTBID) + { + m.SetColor("_GlossColor", ShaEmiColor * ShaEmiColor); + } + else + { + if (PlayerSettings.colorSpace == ColorSpace.Gamma) + { + m.SetColor("_GlossColor", ShaEmiColor * RTBiPDefCol); + } + else + { + m.SetColor("_GlossColor", ShaEmiColor); + } + } + } + } + + } + + if (EnaGiSha == true) + { + m.SetFloat("_GIShadeThreshold", 1.0f); + } + + if (EnaGiSha == true && GiFlaLo == true) + { + m.SetFloat("_GIFlatShade", 1.0f); + } + + m.SetFloat("_OutlineWidth", 0.12f); + + if (FUL == true) + { + if (ShaRTBID) + { + m.EnableKeyword("N_F_SL_ON"); + m.SetFloat("_N_F_SL", 1.0f); + + if (m.GetColor("_MainColor") == new Color(0.6886792f, 0.6886792f, 0.6886792f)) + { + m.SetFloat("_SelfLitPower", 3); + } + else + { + m.SetFloat("_SelfLitPower", 0.2f); + } + + m.SetFloat("_SelfLitIntensity", 1.0f); + m.SetFloat("_SelfLitHighContrast", 0.0f); + + m.DisableKeyword("N_F_SS_ON"); + m.SetFloat("_N_F_SS", 0.0f); + + m.DisableKeyword("N_F_RELGI_ON"); + m.SetFloat("_RELG", 0.0f); + + m.DisableKeyword("N_F_RL_ON"); + m.SetFloat("_N_F_RL", 0.0f); + + m.DisableKeyword("N_F_NM_ON"); + m.SetFloat("_N_F_NM", 0.0f); + + if (m.HasProperty("_N_F_HDLS") && m.HasProperty("_N_F_HPSS")) + { + m.EnableKeyword("N_F_HDLS_ON"); + m.SetFloat("_N_F_HDLS", 1.0f); + + m.EnableKeyword("N_F_HPSS_ON"); + m.SetFloat("_N_F_HPSS", 1.0f); + } + } + + if (ShaRTURP) + { + m.EnableKeyword("N_F_SL_ON"); + m.SetFloat("_N_F_SL", 1.0f); + m.SetFloat("_SelfLitPower", 0.3f); + m.SetFloat("_SelfLitIntensity", 1.0f); + m.SetFloat("_SelfLitHighContrast", 0.0f); + + m.DisableKeyword("N_F_SS_ON"); + m.SetFloat("_N_F_SS", 0.0f); + + m.DisableKeyword("N_F_RELGI_ON"); + m.SetFloat("_RELG", 0.0f); + + m.DisableKeyword("N_F_EAL_ON"); + m.SetFloat("_N_F_EAL", 0.0f); + + m.EnableKeyword("N_F_USETLB_ON"); + m.SetFloat("_UseTLB", 1.0f); + + m.DisableKeyword("N_F_NM_ON"); + m.SetFloat("_N_F_NM", 0.0f); + + m.EnableKeyword("N_F_HDLS_ON"); + m.SetFloat("_N_F_HDLS", 1.0f); + + m.EnableKeyword("N_F_HPSS_ON"); + m.SetFloat("_N_F_HPSS", 1.0f); + } + + if (ShaRTHDRP) + { + m.EnableKeyword("N_F_SL_ON"); + m.SetFloat("_N_F_SL", 1.0f); + m.SetFloat("_SelfLitPower", 6.5f); + m.SetFloat("_SelfLitIntensity", 1.0f); + m.SetFloat("_SelfLitHighContrast", 0.0f); + + m.DisableKeyword("N_F_SS_ON"); + m.SetFloat("_N_F_SS", 0.0f); + + m.DisableKeyword("N_F_RELGI_ON"); + m.SetFloat("_RELG", 0.0f); + + m.DisableKeyword("N_F_PAL_ON"); + m.SetFloat("_N_F_PAL", 0.0f); + + m.EnableKeyword("N_F_USETLB_ON"); + m.SetFloat("_UseTLB", 1.0f); + + m.DisableKeyword("N_F_NM_ON"); + m.SetFloat("_N_F_NM", 0.0f); + + m.EnableKeyword("N_F_HDLS_ON"); + m.SetFloat("_N_F_HDLS", 1.0f); + + m.EnableKeyword("N_F_HPSAS_ON"); + m.SetFloat("_N_F_HPSAS", 1.0f); + } + } + + if (ShaRTBID) + { + if (LigAffSha == true) + { + m.SetFloat("_LightAffectShadow", 1.0f); + } + + if (m.HasProperty("_N_F_HDLS") && m.HasProperty("_N_F_HPSS")) + { + if (DisRecSha == true) + { + m.EnableKeyword("N_F_HDLS_ON"); + m.SetFloat("_N_F_HDLS", 1.0f); + + m.EnableKeyword("N_F_HPSS_ON"); + m.SetFloat("_N_F_HPSS", 1.0f); + } + } + } + + if (ShaRTURP) + { + if (LigAffSha == true) + { + m.SetFloat("_LightAffectShadow", 1.0f); + } + + if (DisRecSha == true) + { + m.EnableKeyword("N_F_HDLS_ON"); + m.SetFloat("_N_F_HDLS", 1.0f); + + m.EnableKeyword("N_F_HPSS_ON"); + m.SetFloat("_N_F_HPSAS", 1.0f); + } + } + + if (ShaRTHDRP) + { + if (LigAffSha == true) + { + m.SetFloat("_LightAffectShadow", 1.0f); + } + + if (DisRecSha == true) + { + m.EnableKeyword("N_F_HDLS_ON"); + m.SetFloat("_N_F_HDLS", 1.0f); + + m.EnableKeyword("N_F_HPSAS_ON"); + m.SetFloat("_N_F_HPSAS", 1.0f); + } + } + + ShaderName = string.Empty; + InfoString += "\n[Done]\n\n"; + + } + } + else if (!ShaVRM || !ShaVRM10) + { + InfoString = "Can't proceed, No VRoid|VRM shaders in your project"; + } + + } + else if (ToBaInt == 1) + { + + if (UnShaType == "(URP)") + { + + if (m.shader.name == "Universal Render Pipeline/Complex Lit" || m.shader.name == "Universal Render Pipeline/Lit" || m.shader.name == "Universal Render Pipeline/Simple Lit") + { + ShaderName = m.shader.name; + ShaMainTex = m.GetTexture("_BaseMap"); + ShaColor = m.GetColor("_BaseColor"); + ShaNormalMap = m.GetTexture("_BumpMap"); + ShaNormalScale = m.GetFloat("_BumpScale"); + ShaEmiColor = m.GetColor("_EmissionColor"); + ShaEmiMap = m.GetTexture("_EmissionMap"); + ShaSmooth = m.GetFloat("_Smoothness"); + MatType = m.GetFloat("_Surface"); + CullingMode = m.GetFloat("_Cull"); + ShaAlpClip = m.GetFloat("_AlphaClip"); + SKEmi = m.IsKeywordEnabled("_EMISSION"); + ShaSpecHighEn = m.GetFloat("_SpecularHighlights"); + + if (m.HasProperty("_EnvironmentReflections")) + { + ShaRefEn = m.GetFloat("_EnvironmentReflections"); + } + + if (m.HasProperty("_SpecColor")) + { + ShaSpecCol = m.GetColor("_SpecColor"); + } + + if (m.HasProperty("_WorkflowMode")) + { + ShaWorFloMod = m.GetFloat("_WorkflowMode"); + } + + if (m.HasProperty("_Metallic")) + { + ShaMetal = m.GetFloat("_Metallic"); + } + + if (m.HasProperty("_MetallicGlossMap")) + { + ShaMetaMap = m.GetTexture("_MetallicGlossMap"); + } + + if (m.HasProperty("_SpecGlossMap")) + { + ShaSpecMap = m.GetTexture("_SpecGlossMap"); + } + } + else if (m.shader.name == "Universal Render Pipeline/Unlit") + { + ShaderName = m.shader.name; + ShaMainTex = m.GetTexture("_BaseMap"); + ShaColor = m.GetColor("_BaseColor"); + MatType = m.GetFloat("_Surface"); + CullingMode = m.GetFloat("_Cull"); + ShaAlpClip = m.GetFloat("_AlphaClip"); + } + else if (m.shader.name == "Universal Render Pipeline/Baked Lit") + { + ShaderName = m.shader.name; + ShaMainTex = m.GetTexture("_BaseMap"); + ShaColor = m.GetColor("_BaseColor"); + ShaNormalMap = m.GetTexture("_BumpMap"); + MatType = m.GetFloat("_Surface"); + CullingMode = m.GetFloat("_Cull"); + ShaAlpClip = m.GetFloat("_AlphaClip"); + } + else if (m.shader.name != "Universal Render Pipeline/Complex Lit" || m.shader.name != "Universal Render Pipeline/Lit" || m.shader.name != "Universal Render Pipeline/Simple Lit" || m.shader.name != "Universal Render Pipeline/Unlit" || m.shader.name != "Universal Render Pipeline/Baked Lit") + { + InfoString += "The selected '" + m.name + "' material, shader is not supported.\n '" + m.shader.name + "'\n\n" + SupShaURP; + } + + if (m.shader.name == "Universal Render Pipeline/Complex Lit" || m.shader.name == "Universal Render Pipeline/Lit" || m.shader.name == "Universal Render Pipeline/Simple Lit" || m.shader.name == "Universal Render Pipeline/Unlit" || m.shader.name == "Universal Render Pipeline/Baked Lit") + { + if (ShaRTURP) + { + m.shader = ShaRTURP; + } + + InfoString += "Processing Material: " + m.name + "\nPrevious Shader: " + ShaderName; + + if (ShaMainTex != null) + { + m.SetTexture("_MainTex", ShaMainTex); + } + + if (ShaderName != "Universal Render Pipeline/Unlit" || ShaderName != "Universal Render Pipeline/Baked Lit") + { + m.SetColor("_OverallShadowColor", new Color(0.2f, 0.2f, 0.2f)); + } + + m.SetFloat("_OutlineWidth", 0.12f); + + if (MatType == 1.0f) + { + m.SetInt("_BleModSour", 5); + m.SetInt("_BleModDest", 10); + + m.EnableKeyword("N_F_TRANS_ON"); + m.SetFloat("_TRANSMODE", 1.0f); + m.renderQueue = 3000; + m.SetOverrideTag("RenderType", "Transparent"); + m.SetFloat("_Opacity", ShaColor.a); + + } + + if (ShaAlpClip == 1.0f) + { + m.SetInt("_BleModSour", 5); + m.SetInt("_BleModDest", 10); + + m.EnableKeyword("N_F_TRANS_ON"); + m.SetFloat("_TRANSMODE", 1.0f); + + m.EnableKeyword("N_F_CO_ON"); + m.SetFloat("_N_F_CO", 1.0f); + m.SetFloat("_Cutout", 0.4f); + m.renderQueue = 2450; + m.SetOverrideTag("RenderType", "TransparentCutout"); + } + + if (ShaderName != "Universal Render Pipeline/Unlit") + { + if (ShaNormalMap != null) + { + m.EnableKeyword("N_F_NM_ON"); + m.SetFloat("_N_F_NM", 1.0f); + m.SetTexture("_NormalMap", ShaNormalMap); + m.SetFloat("_NormalMapIntensity", ShaNormalScale); + } + + } + + if (ShaColor != Color.white) + { + m.SetColor("_MainColor", ShaColor * ShaColor); + } + + if (CullingMode == 2.0f) + { + m.SetFloat("_Culling", 2.0f); + } + else if (CullingMode == 1.0f) + { + m.SetFloat("_Culling", 1.0f); + } + else if (CullingMode == 0.0) + { + m.SetFloat("_Culling", 0.0f); + } + + if (ShaderName != "Universal Render Pipeline/Unlit" || ShaderName != "Universal Render Pipeline/Baked Lit") + { + if (SKEmi) + { + m.EnableKeyword("N_F_SL_ON"); + m.SetFloat("_N_F_SL", 1.0f); + m.EnableKeyword("N_F_SLMM_ON"); + m.SetFloat("_N_F_SLMM", 1.0f); + m.SetFloat("_SelfLitPower", 10.0f); + m.SetFloat("_SelfLitIntensity", 1.0f); + m.SetTexture("_MaskSelfLit", ShaEmiMap); + m.SetColor("_SelfLitColor", ShaEmiColor * ShaEmiColor); + } + } + + if (ShaderName != "Universal Render Pipeline/Unlit" || ShaderName != "Universal Render Pipeline/Baked Lit") + { + if (ShaSpecHighEn == 1 || ShaSpecHighEn == 0 && ShaderName == "Universal Render Pipeline/Simple Lit") + { + if (ShaSmooth >= 0.5) + { + m.EnableKeyword("N_F_GLO_ON"); + m.SetFloat("_N_F_GLO", 1.0f); + m.SetFloat("_Glossiness", 0.6f); + } + + if ((ShaWorFloMod == 0 && ShaderName != "Universal Render Pipeline/Simple Lit") || ShaderName == "Universal Render Pipeline/Simple Lit") + { + if (ShaSpecMap != null) + { + m.SetTexture("_MaskGloss", ShaSpecMap); + } + else + { + m.SetColor("_GlossColor", ShaSpecCol * ShaSpecCol); + } + } + else if ((ShaWorFloMod == 1 && ShaderName != "Universal Render Pipeline/Simple Lit")) + { + if (ShaMetaMap != null) + { + m.SetTexture("_MaskGloss", ShaMetaMap); + } + } + } + } + + if (ShaderName != "Universal Render Pipeline/Unlit" || ShaderName != "Universal Render Pipeline/Baked Lit") + { + if (ShaWorFloMod == 1 && ShaderName != "Universal Render Pipeline/Simple Lit") + { + if (ShaRefEn == 1.0f) + { + if (ShaMetal != 0.0f && ShaMetaMap == null) + { + m.EnableKeyword("N_F_R_ON"); + m.SetFloat("_N_F_R", 1.0f); + m.SetFloat("_ReflectionIntensity", ShaMetal); + m.SetFloat("_ReflectionRoughtness", 1.0f - ShaSmooth); + m.SetFloat("_RefMetallic", 0.65f); + } + else if (ShaMetaMap != null) + { + m.EnableKeyword("N_F_R_ON"); + m.SetFloat("_N_F_R", 1.0f); + m.SetFloat("_ReflectionIntensity", 1f); + m.SetFloat("_ReflectionRoughtness", 1.0f - ShaSmooth); + m.SetTexture("_MaskReflection", ShaMetaMap); + m.SetFloat("_RefMetallic", 0.65f); + } + } + } + + } + + if (ShaderName == "Universal Render Pipeline/Baked Lit") + { + m.EnableKeyword("N_F_OFLMB_ON"); + m.SetFloat("_N_F_OFLMB", 1.0f); + + m.DisableKeyword("N_F_EAL_ON"); + m.SetFloat("_N_F_EAL", 0.0f); + + m.EnableKeyword("N_F_USETLB_ON"); + m.SetFloat("_UseTLB", 1.0f); + + m.EnableKeyword("N_F_HDLS_ON"); + m.SetFloat("_N_F_HDLS", 1.0f); + + m.EnableKeyword("N_F_HPSS_ON"); + m.SetFloat("_N_F_HPSS", 1.0f); + + m.DisableKeyword("N_F_SS_ON"); + m.SetFloat("_N_F_SS", 0.0f); + + m.SetFloat("_GIShadeThreshold", 1.0f); + } + + if (ShaderName == "Universal Render Pipeline/Unlit") + { + m.EnableKeyword("N_F_SL_ON"); + m.SetFloat("_N_F_SL", 1.0f); + m.SetFloat("_SelfLitPower", 0.3f); + m.SetFloat("_SelfLitIntensity", 1.0f); + + m.DisableKeyword("N_F_SS_ON"); + m.SetFloat("_N_F_SS", 0.0f); + + m.DisableKeyword("N_F_RELGI_ON"); + m.SetFloat("_RELG", 0.0f); + + m.DisableKeyword("N_F_EAL_ON"); + m.SetFloat("_N_F_EAL", 0.0f); + + m.EnableKeyword("N_F_USETLB_ON"); + m.SetFloat("_UseTLB", 1.0f); + + m.EnableKeyword("N_F_HDLS_ON"); + m.SetFloat("_N_F_HDLS", 1.0f); + + m.EnableKeyword("N_F_HPSS_ON"); + m.SetFloat("_N_F_HPSS", 1.0f); + } + + if (LigAffSha == true) + { + m.SetFloat("_LightAffectShadow", 1.0f); + } + + ShaderName = string.Empty; + InfoString += "\n[Done]\n\n"; + } + + } + + if (UnShaType == "(HDRP)") + { + + if (m.shader.name == "HDRP/Lit" || m.shader.name == "HDRP/LitTessellation") + { + ShaderName = m.shader.name; + ShaMainTex = m.GetTexture("_BaseColorMap"); + ShaColor = m.GetColor("_BaseColor"); + ShaNormalMap = m.GetTexture("_NormalMap"); + ShaNormalScale = m.GetFloat("_NormalScale"); + ShaEmiColor = m.GetColor("_EmissiveColor"); + ShaEmiMap = m.GetTexture("_EmissiveColorMap"); + ShaSmooth = m.GetFloat("_Smoothness"); + MatType = m.GetFloat("_SurfaceType"); + CullingMode = m.GetFloat("_CullMode"); + ShaAlpClip = m.GetFloat("_AlphaCutoffEnable"); + ShaMasMa = m.GetTexture("_MaskMap"); + ShaMetal = m.GetFloat("_Metallic"); + ShaMetaRemMinMax = Mathf.Clamp01(m.GetFloat("_MetallicRemapMin") + m.GetFloat("_MetallicRemapMax")); + ShaSmoRemMinMax = m.GetFloat("_SmoothnessRemapMin") + m.GetFloat("_SmoothnessRemapMax"); + ShaDoubSid = m.GetFloat("_DoubleSidedEnable"); + ShaMatID = m.GetFloat("_MaterialID"); + ShaSpecMap = m.GetTexture("_SpecularColorMap"); + ShaSpecCol = m.GetColor("_SpecularColor"); + } + else if (m.shader.name == "HDRP/Unlit") + { + ShaderName = m.shader.name; + ShaMainTex = m.GetTexture("_MainTex"); + ShaColor = m.GetColor("_Color"); + MatType = m.GetFloat("_SurfaceType"); + CullingMode = m.GetFloat("_CullMode"); + ShaAlpClip = m.GetFloat("_AlphaCutoffEnable"); + ShaDoubSid = m.GetFloat("_DoubleSidedEnable"); + } + else if (m.shader.name != "HDRP/Lit" || m.shader.name != "HDRP/LitTessellation" || m.shader.name != "HDRP/Unlit") + { + InfoString += "The selected '" + m.name + "' material, shader is not supported.\n '" + m.shader.name + "'\n\n" + SupShaHDRP; + } + + if (m.shader.name == "HDRP/Lit" || m.shader.name == "HDRP/LitTessellation" || m.shader.name == "HDRP/Unlit") + { + if (ShaRTHDRP) + { + m.shader = ShaRTHDRP; + } + + InfoString += "Processing Material: " + m.name + "\nPrevious Shader: " + ShaderName; + + if (ShaMainTex != null) + { + m.SetTexture("_MainTex", ShaMainTex); + } + + if (ShaderName != "HDRP/Unlit") + { + m.SetColor("_OverallShadowColor", new Color(0.2f, 0.2f, 0.2f)); + } + + m.SetFloat("_OutlineWidth", 0.12f); + + if (MatType == 1.0f) + { + m.SetInt("_BleModSour", 5); + m.SetInt("_BleModDest", 10); + + m.EnableKeyword("N_F_TRANS_ON"); + m.SetFloat("_TRANSMODE", 1.0f); + + m.renderQueue = 3000; + m.SetOverrideTag("RenderType", "Transparent"); + + m.SetFloat("_Opacity", ShaColor.a); + + if ((m.IsKeywordEnabled("N_F_R_ON") && (m.IsKeywordEnabled("N_F_ESSR_ON") || m.GetFloat("_N_F_ESSR") == 1.0f)) || ((m.IsKeywordEnabled("N_F_ESSGI_ON") || m.GetFloat("_N_F_ESSGI") == 1.0f))) + { + m.SetInt("_SSRefDeOn", 0); + m.SetInt("_SSRefGBu", 2); + m.SetInt("_SSRefMoVe", 32); + } + + m.SetInt("_ZTeForLiOpa", 4); + } + + if (ShaAlpClip == 1.0f) + { + m.SetInt("_BleModSour", 5); + m.SetInt("_BleModDest", 10); + + m.EnableKeyword("N_F_TRANS_ON"); + m.SetFloat("_TRANSMODE", 1.0f); + + m.EnableKeyword("N_F_CO_ON"); + m.SetFloat("_N_F_CO", 1.0f); + m.SetFloat("_Cutout", 0.51f); + m.renderQueue = 2450; + + m.SetOverrideTag("RenderType", "TransparentCutout"); + + if ((m.IsKeywordEnabled("N_F_R_ON") && (m.IsKeywordEnabled("N_F_ESSR_ON") || m.GetFloat("_N_F_ESSR") == 1.0f)) || ((m.IsKeywordEnabled("N_F_ESSGI_ON") || m.GetFloat("_N_F_ESSGI") == 1.0f))) + { + m.SetInt("_SSRefDeOn", 8); + m.SetInt("_SSRefGBu", 10); + m.SetInt("_SSRefMoVe", 40); + } + + m.SetInt("_ZTeForLiOpa", 3); + } + + if (ShaderName != "HDRP/Unlit") + { + if (ShaNormalMap != null) + { + m.EnableKeyword("N_F_NM_ON"); + m.SetFloat("_N_F_NM", 1.0f); + m.SetTexture("_NormalMap", ShaNormalMap); + m.SetFloat("_NormalMapIntensity", ShaNormalScale); + } + } + + if (ShaColor != Color.white) + { + m.SetColor("_MainColor", ShaColor * ShaColor); + } + + if (ShaDoubSid == 1.0f) + { + m.SetFloat("_Culling", 0); + } + else if (ShaDoubSid == 0.0f) + { + if (CullingMode != 2.0f) + { + m.SetFloat("_Culling", CullingMode); + } + } + + if (ShaderName != "HDRP/Unlit") + { + if (ShaEmiColor != Color.black) + { + m.EnableKeyword("N_F_SL_ON"); + m.SetFloat("_N_F_SL", 1.0f); + m.EnableKeyword("N_F_SLMM_ON"); + m.SetFloat("_N_F_SLMM", 1.0f); + m.SetFloat("_SelfLitPower", 50.0f); + m.SetFloat("_SelfLitIntensity", 1.0f); + + if (ShaEmiMap != null) + { + m.SetTexture("_MaskSelfLit", ShaEmiMap); + } + + m.SetColor("_SelfLitColor", ShaEmiColor * ShaEmiColor); + } + } + + if (ShaderName != "HDRP/Unlit") + { + if (ShaSmooth >= 0.5) + { + m.EnableKeyword("N_F_GLO_ON"); + m.SetFloat("_N_F_GLO", 1.0f); + m.SetFloat("_Glossiness", 0.6f); + } + else + { + m.DisableKeyword("N_F_GLO_ON"); + m.SetFloat("_N_F_GLO", 0.0f); + } + } + + if (ShaderName != "HDRP/Unlit") + { + + if (ShaMatID == 4.0f) + { + if (ShaSpecMap != null) + { + m.SetTexture("_MaskGloss", ShaSpecMap); + } + + m.SetColor("_GlossColor", ShaSpecCol * ShaSpecCol); + } + + if (ShaMasMa != null) + { + m.SetTexture("_MaskGloss", ShaMasMa); + } + + } + + if (ShaderName != "HDRP/Unlit") + { + if (ShaMetal != 0.0f && ShaMasMa == null) + { + m.EnableKeyword("N_F_R_ON"); + m.SetFloat("_N_F_R", 1.0f); + m.SetFloat("_ReflectionIntensity", ShaMetal); + m.SetFloat("_ReflectionRoughtness", ShaSmooth); + m.SetFloat("_RefMetallic", 0.65f); + + if ((m.IsKeywordEnabled("N_F_R_ON") && m.IsKeywordEnabled("N_F_ESSR_ON")) || m.IsKeywordEnabled("N_F_ESSGI_ON")) + { + + m.SetInt("_SSRefDeOn", 8); + m.SetInt("_SSRefGBu", 10); + m.SetInt("_SSRefMoVe", 40); + + } + else if (!m.IsKeywordEnabled("N_F_R_ON")) + { + m.SetInt("_SSRefDeOn", 0); + m.SetInt("_SSRefGBu", 2); + m.SetInt("_SSRefMoVe", 32); + } + + if (m.IsKeywordEnabled("N_F_TRANS_ON") && !m.IsKeywordEnabled("N_F_CO_ON")) + { + m.SetInt("_SSRefDeOn", 0); + m.SetInt("_SSRefGBu", 2); + m.SetInt("_SSRefMoVe", 32); + } + + } + else if (ShaMasMa != null) + { + ShaSmooth = ShaSmoRemMinMax; + m.EnableKeyword("N_F_R_ON"); + m.SetFloat("_N_F_R", 1.0f); + m.SetFloat("_ReflectionIntensity", ShaMetaRemMinMax); + m.SetFloat("_ReflectionRoughtness", ShaSmooth); + m.SetTexture("_MaskReflection", ShaMasMa); + m.SetFloat("_RefMetallic", 0.65f); + + if ((m.IsKeywordEnabled("N_F_R_ON") && m.IsKeywordEnabled("N_F_ESSR_ON")) || m.IsKeywordEnabled("N_F_ESSGI_ON")) + { + + m.SetInt("_SSRefDeOn", 8); + m.SetInt("_SSRefGBu", 10); + m.SetInt("_SSRefMoVe", 40); + + } + else if (!m.IsKeywordEnabled("N_F_R_ON")) + { + m.SetInt("_SSRefDeOn", 0); + m.SetInt("_SSRefGBu", 2); + m.SetInt("_SSRefMoVe", 32); + } + + if (m.IsKeywordEnabled("N_F_TRANS_ON") && !m.IsKeywordEnabled("N_F_CO_ON")) + { + m.SetInt("_SSRefDeOn", 0); + m.SetInt("_SSRefGBu", 2); + m.SetInt("_SSRefMoVe", 32); + } + } + } + + if (ShaderName == "HDRP/Unlit") + { + m.EnableKeyword("N_F_SL_ON"); + m.SetFloat("_N_F_SL", 1.0f); + m.SetFloat("_SelfLitPower", 6.5f); + m.SetFloat("_SelfLitIntensity", 1.0f); + m.SetFloat("_SelfLitHighContrast", 0.0f); + + m.DisableKeyword("N_F_SS_ON"); + m.SetFloat("_N_F_SS", 0.0f); + + m.DisableKeyword("N_F_RELGI_ON"); + m.SetFloat("_RELG", 0.0f); + + m.DisableKeyword("N_F_PAL_ON"); + m.SetFloat("_N_F_PAL", 0.0f); + + m.EnableKeyword("N_F_USETLB_ON"); + m.SetFloat("_UseTLB", 1.0f); + + m.EnableKeyword("N_F_HDLS_ON"); + m.SetFloat("_N_F_HDLS", 1.0f); + + m.EnableKeyword("N_F_HPSAS_ON"); + m.SetFloat("_N_F_HPSAS", 1.0f); + } + + if (LigAffSha == true) + { + m.SetFloat("_LightAffectShadow", 1.0f); + } + + ShaderName = string.Empty; + InfoString += "\n[Done]\n\n"; + } + + } + + if (UnShaType == "(Built-In)") + { + + if (m.shader.name == "Standard" || m.shader.name == "Standard (Specular setup)") + { + ShaderName = m.shader.name; + ShaMainTex = m.GetTexture("_MainTex"); + ShaColor = m.GetColor("_Color"); + ShaNormalMap = m.GetTexture("_BumpMap"); + ShaNormalScale = m.GetFloat("_BumpScale"); + ShaEmiColor = m.GetColor("_EmissionColor"); + ShaEmiMap = m.GetTexture("_EmissionMap"); + ShaSmooth = m.GetFloat("_Glossiness"); + MatType = m.GetFloat("_Mode"); + SKEmi = m.IsKeywordEnabled("_EMISSION"); + ShaSpecHighEn = m.GetFloat("_SpecularHighlights"); + ShaRefEn = m.GetFloat("_GlossyReflections"); + + if (m.HasProperty("_SpecGlossMap")) + { + ShaSpecMap = m.GetTexture("_SpecGlossMap"); + } + + if (m.HasProperty("_Metallic")) + { + ShaMetal = m.GetFloat("_Metallic"); + } + + if (m.HasProperty("_MetallicGlossMap")) + { + ShaMetaMap = m.GetTexture("_MetallicGlossMap"); + } + + if (m.HasProperty("_SpecColor")) + { + ShaSpecCol = m.GetColor("_SpecColor"); + } + } + else if (m.shader.name == "Unlit/Color" || m.shader.name == "Unlit/Texture" || m.shader.name == "Unlit/Transparent" || m.shader.name == "Unlit/Transparent Cutout") + { + ShaderName = m.shader.name; + + if (m.HasProperty("_MainTex")) + { + ShaMainTex = m.GetTexture("_MainTex"); + } + + if (m.shader.name == "Unlit/Color") + { + ShaColor = m.GetColor("_Color"); + } + } + else if (m.shader.name != "Standard" || m.shader.name != "Standard (Specular setup)" || m.shader.name != "Unlit/Color" || m.shader.name != "Unlit/Texture" || m.shader.name != "Unlit/Transparent" || m.shader.name != "Unlit/Transparent Cutout") + { + InfoString += "The selected '" + m.name + "' material, shader is not supported.\n '" + m.shader.name + "'\n\n" + SupShaBiRP; + } + + if (m.shader.name == "Standard" || m.shader.name == "Standard (Specular setup)" || m.shader.name == "Unlit/Color" || m.shader.name == "Unlit/Texture" || m.shader.name == "Unlit/Transparent" || m.shader.name == "Unlit/Transparent Cutout") + { + InfoString += "Processing Material: " + m.name + "\nPrevious Shader: " + ShaderName; + } + + if (m.shader.name == "Standard" || m.shader.name == "Standard (Specular setup)") + { + + if (MatType == 0.0f || MatType == 1.0f) + { + m.shader = ShaRTBID; + } + else if (MatType == 2.0f || MatType == 3.0f) + { + m.shader = ShaRTBIFT; + m.SetFloat("_Opacity", ShaColor.a); + } + + m.SetFloat("_OutlineWidth", 0.2f); + + if (MatType == 1.0f) + { + m.EnableKeyword("N_F_CO_ON"); + m.SetFloat("_N_F_CO", 1.0f); + m.SetFloat("_Cutout", 0.4f); + } + + if (ShaMainTex != null) + { + m.SetTexture("_MainTex", ShaMainTex); + } + + m.SetColor("_OverallShadowColor", new Color(0.2f, 0.2f, 0.2f)); + + if (ShaNormalMap != null) + { + m.EnableKeyword("N_F_NM_ON"); + m.SetFloat("_N_F_NM", 1.0f); + m.SetTexture("_NormalMap", ShaNormalMap); + m.SetFloat("_NormalMapIntensity", ShaNormalScale); + } + + if (ShaColor != Color.white) + { + m.SetColor("_MainColor", ShaColor); + } + + if (SKEmi) + { + m.EnableKeyword("N_F_SL_ON"); + m.SetFloat("_N_F_SL", 1.0f); + m.EnableKeyword("N_F_SLMM_ON"); + m.SetFloat("_N_F_SLMM", 1.0f); + m.SetFloat("_SelfLitPower", 10.0f); + m.SetFloat("_SelfLitIntensity", 1.0f); + m.SetTexture("_MaskSelfLit", ShaEmiMap); + m.SetColor("_SelfLitColor", ShaEmiColor); + } + + if (ShaSpecHighEn == 1.0f) + { + if (ShaSmooth >= 0.5) + { + m.EnableKeyword("N_F_GLO_ON"); + m.SetFloat("_N_F_GLO", 1.0f); + m.SetFloat("_Glossiness", 0.6f); + } + else + { + m.DisableKeyword("N_F_GLO_ON"); + m.SetFloat("_N_F_GLO", 0.0f); + } + } + + if (ShaderName == "Standard (Specular setup)") + { + if (ShaSpecMap != null) + { + m.SetTexture("_MaskGloss", ShaSpecMap); + } + else + { + if (ShaSpecHighEn == 1.0f) + { + m.SetColor("_GlossColor", ShaSpecCol * ShaSpecCol); + } + } + } + + if (ShaderName == "Standard") + { + if (ShaRefEn == 1.0f) + { + if (ShaMetal != 0.0f && ShaMetaMap == null) + { + m.EnableKeyword("N_F_R_ON"); + m.SetFloat("_N_F_R", 1.0f); + m.SetFloat("_ReflectionIntensity", ShaMetal); + m.SetFloat("_ReflectionRoughtness", 1.0f - ShaSmooth); + m.SetFloat("_RefMetallic", 0.65f); + } + else if (ShaMetaMap != null) + { + m.EnableKeyword("N_F_R_ON"); + m.SetFloat("_N_F_R", 1.0f); + m.SetFloat("_ReflectionIntensity", 1f); + m.SetFloat("_ReflectionRoughtness", 1.0f - ShaSmooth); + m.SetTexture("_MaskReflection", ShaMetaMap); + m.SetFloat("_RefMetallic", 0.65f); + } + } + } + + ShaderName = string.Empty; + InfoString += "\n[Done]\n\n"; + + } + + if (m.shader.name == "Unlit/Color" || m.shader.name == "Unlit/Texture" || m.shader.name == "Unlit/Transparent" || m.shader.name == "Unlit/Transparent Cutout") + { + + if (m.shader.name == "Unlit/Color" || m.shader.name == "Unlit/Texture" || m.shader.name == "Unlit/Transparent Cutout") + { + m.shader = ShaRTBID; + } + else if (m.shader.name == "Unlit/Transparent") + { + m.shader = ShaRTBIFT; + } + + m.EnableKeyword("N_F_SL_ON"); + m.SetFloat("_N_F_SL", 1.0f); + m.SetFloat("_SelfLitPower", 10); + m.SetFloat("_SelfLitIntensity", 1.0f); + + m.DisableKeyword("N_F_SS_ON"); + m.SetFloat("_N_F_SS", 0.0f); + + m.DisableKeyword("N_F_RELGI_ON"); + m.SetFloat("_RELG", 0.0f); + + if (m.shader.name != "Unlit/Transparent") + { + m.EnableKeyword("N_F_HDLS_ON"); + m.SetFloat("_N_F_HDLS", 1.0f); + + m.EnableKeyword("N_F_HPSS_ON"); + m.SetFloat("_N_F_HPSS", 1.0f); + } + + if (m.shader.name != "Unlit/Texture" || m.shader.name != "Unlit/Transparent" || m.shader.name != "Unlit/Transparent Cutout") + { + m.SetColor("_MainColor", ShaColor); + } + + if (m.shader.name == "Unlit/Texture" || m.shader.name == "Unlit/Transparent" || m.shader.name == "Unlit/Transparent Cutout") + { + if (ShaMainTex != null) + { + m.SetTexture("_MainTex", ShaMainTex); + } + } + + if (m.shader.name == "Unlit/Transparent Cutout") + { + m.EnableKeyword("N_F_CO_ON"); + m.SetFloat("_N_F_CO", 1.0f); + m.SetFloat("_Cutout", 0.4f); + } + + if (LigAffSha == true) + { + m.SetFloat("_LightAffectShadow", 1.0f); + } + + ShaderName = string.Empty; + InfoString += "\n[Done]\n\n"; + + } + + } + + } + + MatNum++; + } + + } + + } + EditorGUI.EndDisabledGroup(); + #endregion + + EditorGUILayout.BeginHorizontal(); + GUILayout.FlexibleSpace(); + GUILayout.Label("Material: " + "[" + MatNum + ": " + ProcMat + "]"); + GUILayout.FlexibleSpace(); + EditorGUILayout.EndHorizontal(); + + #region Other Settings + + if (ToBaInt == 0) + { + GUILayout.Space(10); + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + + EditorGUILayout.BeginHorizontal(); + + EditorGUILayout.BeginVertical(); + + FUL = GUILayout.Toggle(FUL, new GUIContent("Force Unlit", "This will disable all lighting and shadows,\nOnly Main Texture and Main Color are set.")); + ForTrasCuto = GUILayout.Toggle(ForTrasCuto, "Force Transparent Material to Cutout"); + + EditorGUI.BeginDisabledGroup(FUL == true); + + EditorGUI.BeginDisabledGroup(ShaRTBID && PlayerSettings.colorSpace == ColorSpace.Gamma); + EnhaHiLighColInt = GUILayout.Toggle(EnhaHiLighColInt, new GUIContent("Enhance Light Highlight Color Intensity", "Not available if project color space is Gamma.")); + EditorGUI.EndDisabledGroup(); + + IncShaCol = GUILayout.Toggle(IncShaCol, "Include Shade/Shadow Color"); + LigAffSha = GUILayout.Toggle(LigAffSha, new GUIContent("Light Affect Shadows", "Light's intensity and color will affect shadows.\nIf not enabled, The light will not affect the shadow and it will prevent overexpose shadow color when there are more lights on the scene and high intensity light value.")); + DisRecSha = GUILayout.Toggle(DisRecSha, new GUIContent("Disable Received Shadows", "This will disable received shadows from other objects including received self cast shadows.")); + + EditorGUI.BeginDisabledGroup(UsEmiMapAnColAsGloTex == true); + IncEmi = GUILayout.Toggle(IncEmi, "Include Emission"); + EditorGUI.EndDisabledGroup(); + + EditorGUI.BeginDisabledGroup(IncEmi == true); + UsEmiMapAnColAsGloTex = GUILayout.Toggle(UsEmiMapAnColAsGloTex, new GUIContent("Use Emission Map And Color As Gloss", "Mostly useful for hair materials.\nThis will use the VRoid Emission map as a gloss and use the selected Emission color.")); + EditorGUI.EndDisabledGroup(); + + FERL = GUILayout.Toggle(FERL, "Force Enable Rim Light And Use White Color"); + + EditorGUILayout.BeginHorizontal(); + EnaGiSha = GUILayout.Toggle(EnaGiSha, "Enable Global Illumination Shade"); + + EditorGUI.BeginDisabledGroup(EnaGiSha == false); + GiFlaLo = GUILayout.Toggle(GiFlaLo, new GUIContent("Global Illumination Flat Shade", "This will make the Global Illumination shade into flat/cel shade.")); + EditorGUI.EndDisabledGroup(); + + EditorGUILayout.EndHorizontal(); + + EditorGUI.EndDisabledGroup(); + + EditorGUILayout.EndVertical(); + + EditorGUILayout.EndHorizontal(); + } + else if (ToBaInt == 1) + { + GUILayout.Space(10); + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + + EditorGUILayout.BeginHorizontal(); + GUILayout.Space(135); + LigAffSha = GUILayout.Toggle(LigAffSha, new GUIContent("Light Affect Shadows", "Light's intensity and color will affect shadows.\nIf not enabled, The light will not affect the shadow,\nthis will also prevent overexpose shadow color when there are more lights on the scene.")); + EditorGUILayout.EndHorizontal(); + } + + #endregion + + #region Info + + GUILayout.Space(10); + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + GUILayout.Label("Info:"); + + EditorGUILayout.BeginVertical("TextArea", GUILayout.Height(90)); + scroll = EditorGUILayout.BeginScrollView(scroll, GUILayout.Height(120)); + GUILayout.TextArea(InfoString); + EditorGUILayout.EndScrollView(); + EditorGUILayout.EndVertical(); + + GUILayout.Space(10); + GUILayout.Label(mat.Length.ToString() + " Selected Materials."); + + GUILayout.Space(10); + EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); + + GUILayout.Label("Note:"); + GUILayout.Label("*This tool supports RealToon Built-In, URP and HDRP shaders.\n" + + "*Supported Unity Shader to swap are Built-In, URP and HDRP shaders.\n" + + "*Read the included documentation/user guide for more info.\n" + + "*After the swap, click the 'Refresh Settings' on the RealToon Inspector.\n" + + " -This will refresh and re-apply the settings properly. (URP/HDRP)"); + + #endregion + } + + } + +} diff --git a/RealToon/RealToon/Editor/SwapShaderToRealToon.cs.meta b/RealToon/RealToon/Editor/SwapShaderToRealToon.cs.meta new file mode 100644 index 0000000..cedd5e0 --- /dev/null +++ b/RealToon/RealToon/Editor/SwapShaderToRealToon.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b5506465586dd18499b022aff98e6ac8 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/RealToon/RealToon/For VRoid-VRM users.txt b/RealToon/RealToon/For VRoid-VRM users.txt new file mode 100644 index 0000000..66ea87d --- /dev/null +++ b/RealToon/RealToon/For VRoid-VRM users.txt @@ -0,0 +1,20 @@ +For VRoid|VRM Users +=============================================================== +There is a Swap Shader To RealToon Shader included. +This tool is Swap shader materials from +VRoid|VRM shader and Unity Shaders to RealToon shader. +It is really easy to use, just select the materials, +select from what shader is the material/s then click swap. +================================================================ + +*How to Use* + +1. Click "Window" on the menu above beside "Help" then go to "RealToon -> Swap Shader To RealToon". +2. Select the "Materials" on your project window/panel. +3. Select from what Shader. +4. Select the options you need if available. +5. Click "Click To Swap To RealToon Shader". +6. All materials shader are now swap to RealToon Shader. + + +================================================================ diff --git a/RealToon/RealToon/For VRoid-VRM users.txt.meta b/RealToon/RealToon/For VRoid-VRM users.txt.meta new file mode 100644 index 0000000..870babf --- /dev/null +++ b/RealToon/RealToon/For VRoid-VRM users.txt.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 82bc586cc72389c489021c62b8bc8333 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/RealToon/RealToon/ReadMe - Important - Guide.txt b/RealToon/RealToon/ReadMe - Important - Guide.txt new file mode 100644 index 0000000..7ed3877 --- /dev/null +++ b/RealToon/RealToon/ReadMe - Important - Guide.txt @@ -0,0 +1,153 @@ +=========================================================================== +Important - ReadMe - Quick User Guide +=========================================================================== + + + +=========================================================================== +For users who first time use Unity +=========================================================================== + +Note: +*Install the latest unity version or latest LTS version. + +If your project is 3D or Built-In RP: +1.Go to folder "RealToon Shader Packages -> Built-In RP [3D]" +2.Double click "RealToon Built-In RP [3D]", the latest one with the 'Later' word on it. +3.Click "Import". + +If your project is Universal Render Pipeline or High Definition RP: +1.Go to folder "RealToon Shader Packages -> SRP (LWRP - URP - HDRP)". +2.Open the folder that correspond to your project render pipeline. +3.Double click the latest one with the 'Later' word on it. +4.Click "Import". + +To use RealToon: +1.Create a material by press mouse button "Right" on the "Project" window/panel. +2.Go to "Create -> Material". +3.Name your material then press keyboard key "Enter". +4.Click your created material. +5.Go to "Inspector" window/panel then change the "Shader" by left mouse button - click that drop down menu. +6-a.For 3D/Built-In: Go to "RealToon -> Default" and select "Default". +6-b.For Universal Render Pipeline: Go to "Universal Render Pipeline -> Default" and select "Default". +6-c.For High Definition RP: Go to "HDRP -> Default" and select "Default". +7.Drag your created material to the object you want to apply it. + +Note: +Unity Built-In RP or 3D is the old unity render pipeline. +Unity SRP/Scriptable Render Pipeline (LWRP,URP and HDRP) are the new unity render pipeline, made using the Unity Scriptable Render Pipeline. + +=========================================================================== + + + +=========================================================================== +Import/Unpack RealToon Shaders Packages +=========================================================================== + +If your project is Unity Built-In RP/3D: +1.Go to folder "RealToon Shader Packages -> Built-In RP" +2.Double click the RealToon Built-In version package you want to use. + +=========================================================================== + +If your project is Unity SRP: +1.Go to folder "RealToon Shader Packages -> SRP (LWRP - URP - HDRP)" + +For LWRP: +1.Open the folder "LWRP". +2.Double click the RealToon LWRP version package you want to use. +3.Click "Import". + +For URP: +1.Open the folder "URP". +2.Double click the RealToon LWRP version package you want to use. +3.Click "Import". + +For HDRP: +1.Open the folder "HDRP". +2.Double click the RealToon LWRP version package you want to use. +3.Click "Import". + +Note: +'Below' means older verion. +'Later' means Current and later future version. + +There are 2 folder each SRP(URP & HDRP): +*Unity 6 folder is for Unity 6.0 to later/latest unity version. +*Unity 2023 and Below folder is for Unity 2023,2022,2021 and 2019 + + +=========================================================================== + +Accessing the shader: +[RealToon Built-In RP/3D] The shaders are in "RealToon" folder. +[RealToon LWRP] The shaders are in "Lightweight Render Pipeline" folder. +[RealToon URP] The shader is in "Universal Render Pipeline" folder. +[RealToon HDRP] The shader is in "HDRP" folder. + +=========================================================================== + +Recommended Unity and SRP Versions: +[RealToon LWRP] - Unity 2018 and LWRP V4.0.0 or latest version. +[RealToon URP] - Unity 2020.3.0 to newer versions and URP 10 or latest version. +[RealToon HDRP] - Unity 2020.2.0 to newer versions and HDRP 10 or latest version. + +Unity and SRP(URP and HDRP) Versions: +[URP] +Unity 6.0 to Later - URP +Unity 2023.1.0 to before 2023.2.20 - URP 15 to 16 +Unity 2021.3.0 to before 2022.2.0 - URP 14 +Unity 2021.2.0 to before 2021.3.0 - URP 12 to 13 + +[HDRP] +Unity 6.0 to Later - HDRP +Unity 2023.2.0 to before 2023.2.20 - HDRP 16 +Unity 2022.2.0 to before 2022.3.0 - HDRP 14 to 15 +Unity 2021.2.0 to before 2022.2.0 - HDRP 12 to 13 + +Recommended Unity versions for Built-In RP/3D: +From Unity 5 to current latest unity version. + +=========================================================================== + + + +=========================================================================== +For Demo/Example Scenes +=========================================================================== + +1.Go to folder "RealToon Examples" +2.Open the folder. + *For RealToon Built-In RP/3D: Built-In RP [3D] folder + *For RealToon LWRP - URP - HDRP: SRP folder + +** For more info about the example/demo, +read the "Read Me First [About the Example - Demos].txt" +=========================================================================== + + + +=========================================================================== +Notes +=========================================================================== + +*For VRoid model users, read the "For VRoid model users.txt". +*For documentation or user guide, read "RealToon (User Guide).pdf" pdf/printed document file. +*To know previous or current version, read "Change - Fix Log.txt" text file. +*To know what's new, read the "What's New.txt" text file. + +=========================================================================== + + + +=========================================================================== +Video Tutorials +=========================================================================== + +*How to download, import and unpack RealToon (URP,HDRP and BiRP) Shader Packages (For Beginners and Others levels): +https://www.youtube.com/watch?v=JVlbOYi2V3M + +*RealToon Tutorials: +https://www.youtube.com/playlist?list=PL0M1m9smMVPJ4qEkJnZObqJE5mU9uz6SY +=========================================================================== \ No newline at end of file diff --git a/RealToon/RealToon/ReadMe - Important - Guide.txt.meta b/RealToon/RealToon/ReadMe - Important - Guide.txt.meta new file mode 100644 index 0000000..a86644f --- /dev/null +++ b/RealToon/RealToon/ReadMe - Important - Guide.txt.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 1a9714562b1d1f54b8209db56f4f9722 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/RealToon/RealToon/RealToon (User Guide).pdf b/RealToon/RealToon/RealToon (User Guide).pdf new file mode 100644 index 0000000..ffe7bdc Binary files /dev/null and b/RealToon/RealToon/RealToon (User Guide).pdf differ diff --git a/RealToon/RealToon/RealToon (User Guide).pdf.meta b/RealToon/RealToon/RealToon (User Guide).pdf.meta new file mode 100644 index 0000000..4a7f134 --- /dev/null +++ b/RealToon/RealToon/RealToon (User Guide).pdf.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 1ecd1292463dbba41ae18d3c9c8dfafd +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/RealToon/RealToon/RealToon Resources.meta b/RealToon/RealToon/RealToon Resources.meta new file mode 100644 index 0000000..08278e8 --- /dev/null +++ b/RealToon/RealToon/RealToon Resources.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c35075f3b7892104c9fbb8e30571ea9e +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/RealToon/RealToon/RealToon Resources/GlossTexture-AnisotrophicNoise.png b/RealToon/RealToon/RealToon Resources/GlossTexture-AnisotrophicNoise.png new file mode 100644 index 0000000..539632b Binary files /dev/null and b/RealToon/RealToon/RealToon Resources/GlossTexture-AnisotrophicNoise.png differ diff --git a/RealToon/RealToon/RealToon Resources/GlossTexture-AnisotrophicNoise.png.meta b/RealToon/RealToon/RealToon Resources/GlossTexture-AnisotrophicNoise.png.meta new file mode 100644 index 0000000..1bc184d --- /dev/null +++ b/RealToon/RealToon/RealToon Resources/GlossTexture-AnisotrophicNoise.png.meta @@ -0,0 +1,99 @@ +fileFormatVersion: 2 +guid: a262df9417c34d94f9348dd5e946c03d +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 11 + 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 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMasterTextureLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + spritePackingTag: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/RealToon/RealToon/RealToon Resources/SDF-FaceShadow.png b/RealToon/RealToon/RealToon Resources/SDF-FaceShadow.png new file mode 100644 index 0000000..58fab36 Binary files /dev/null and b/RealToon/RealToon/RealToon Resources/SDF-FaceShadow.png differ diff --git a/RealToon/RealToon/RealToon Resources/SDF-FaceShadow.png.meta b/RealToon/RealToon/RealToon Resources/SDF-FaceShadow.png.meta new file mode 100644 index 0000000..e773a5f --- /dev/null +++ b/RealToon/RealToon/RealToon Resources/SDF-FaceShadow.png.meta @@ -0,0 +1,99 @@ +fileFormatVersion: 2 +guid: 3f43d5b1c87da4e4d871043e1e19ac46 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 11 + 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 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMasterTextureLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + spritePackingTag: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/RealToon/RealToon/RealToon Shader Packages.meta b/RealToon/RealToon/RealToon Shader Packages.meta new file mode 100644 index 0000000..36de18d --- /dev/null +++ b/RealToon/RealToon/RealToon Shader Packages.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f4f609eb2dc9c9f409de74267e0a996a +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/RealToon/RealToon/RealToon Shader Packages/SRP (LWRP - URP - HDRP).meta b/RealToon/RealToon/RealToon Shader Packages/SRP (LWRP - URP - HDRP).meta new file mode 100644 index 0000000..712eef1 --- /dev/null +++ b/RealToon/RealToon/RealToon Shader Packages/SRP (LWRP - URP - HDRP).meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ab3032666bf87064a80b0c304f26d5c1 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/RealToon/RealToon/RealToon Shader Packages/SRP (LWRP - URP - HDRP)/URP.meta b/RealToon/RealToon/RealToon Shader Packages/SRP (LWRP - URP - HDRP)/URP.meta new file mode 100644 index 0000000..082449c --- /dev/null +++ b/RealToon/RealToon/RealToon Shader Packages/SRP (LWRP - URP - HDRP)/URP.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4fb4eafaaec7fd641960ecf923a9f59e +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/RealToon/RealToon/RealToon Shader Packages/SRP (LWRP - URP - HDRP)/URP/Please read before you unpack or import.txt b/RealToon/RealToon/RealToon Shader Packages/SRP (LWRP - URP - HDRP)/URP/Please read before you unpack or import.txt new file mode 100644 index 0000000..cab24af --- /dev/null +++ b/RealToon/RealToon/RealToon Shader Packages/SRP (LWRP - URP - HDRP)/URP/Please read before you unpack or import.txt @@ -0,0 +1,13 @@ +RealToon (URP) +=========================================================== +Note: +=========================================================== + +URP is universal, from mobile, console to high end. +Shadow for Pointlight is not available on older URP versions. +Tessellation will be coming soon. + +=========================================================== +*How to download, import and unpack RealToon (URP) Shader Packages Video Tutorial: +https://www.youtube.com/watch?v=JVlbOYi2V3M&t=83s +=========================================================== \ No newline at end of file diff --git a/RealToon/RealToon/RealToon Shader Packages/SRP (LWRP - URP - HDRP)/URP/Please read before you unpack or import.txt.meta b/RealToon/RealToon/RealToon Shader Packages/SRP (LWRP - URP - HDRP)/URP/Please read before you unpack or import.txt.meta new file mode 100644 index 0000000..397d6a8 --- /dev/null +++ b/RealToon/RealToon/RealToon Shader Packages/SRP (LWRP - URP - HDRP)/URP/Please read before you unpack or import.txt.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: b27cd9e670c186d46a9a3bcf35ddb0a9 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/RealToon/RealToon/RealToon Shader Packages/SRP (LWRP - URP - HDRP)/URP/Unity 6.meta b/RealToon/RealToon/RealToon Shader Packages/SRP (LWRP - URP - HDRP)/URP/Unity 6.meta new file mode 100644 index 0000000..9f85445 --- /dev/null +++ b/RealToon/RealToon/RealToon Shader Packages/SRP (LWRP - URP - HDRP)/URP/Unity 6.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 12d53aaf194111048be163d2c6118823 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/RealToon/RealToon/RealToon Shader Packages/SRP (LWRP - URP - HDRP)/URP/Unity 6/RealToon URP (Unity 6.0).unitypackage b/RealToon/RealToon/RealToon Shader Packages/SRP (LWRP - URP - HDRP)/URP/Unity 6/RealToon URP (Unity 6.0).unitypackage new file mode 100644 index 0000000..70a3ed9 Binary files /dev/null and b/RealToon/RealToon/RealToon Shader Packages/SRP (LWRP - URP - HDRP)/URP/Unity 6/RealToon URP (Unity 6.0).unitypackage differ diff --git a/RealToon/RealToon/RealToon Shader Packages/SRP (LWRP - URP - HDRP)/URP/Unity 6/RealToon URP (Unity 6.0).unitypackage.meta b/RealToon/RealToon/RealToon Shader Packages/SRP (LWRP - URP - HDRP)/URP/Unity 6/RealToon URP (Unity 6.0).unitypackage.meta new file mode 100644 index 0000000..66e812e --- /dev/null +++ b/RealToon/RealToon/RealToon Shader Packages/SRP (LWRP - URP - HDRP)/URP/Unity 6/RealToon URP (Unity 6.0).unitypackage.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: f2d6850d720a3234a8788304af582ff9 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/RealToon/RealToon/RealToon Shader Packages/SRP (LWRP - URP - HDRP)/URP/Unity 6/RealToon URP (Unity 6.1 To Later).unitypackage b/RealToon/RealToon/RealToon Shader Packages/SRP (LWRP - URP - HDRP)/URP/Unity 6/RealToon URP (Unity 6.1 To Later).unitypackage new file mode 100644 index 0000000..74556db Binary files /dev/null and b/RealToon/RealToon/RealToon Shader Packages/SRP (LWRP - URP - HDRP)/URP/Unity 6/RealToon URP (Unity 6.1 To Later).unitypackage differ diff --git a/RealToon/RealToon/RealToon Shader Packages/SRP (LWRP - URP - HDRP)/URP/Unity 6/RealToon URP (Unity 6.1 To Later).unitypackage.meta b/RealToon/RealToon/RealToon Shader Packages/SRP (LWRP - URP - HDRP)/URP/Unity 6/RealToon URP (Unity 6.1 To Later).unitypackage.meta new file mode 100644 index 0000000..6295d26 --- /dev/null +++ b/RealToon/RealToon/RealToon Shader Packages/SRP (LWRP - URP - HDRP)/URP/Unity 6/RealToon URP (Unity 6.1 To Later).unitypackage.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: be4d0c51ee19515428ded7c18c589137 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/RealToon/RealToon/RealToon Shaders.meta b/RealToon/RealToon/RealToon Shaders.meta new file mode 100644 index 0000000..c08aa33 --- /dev/null +++ b/RealToon/RealToon/RealToon Shaders.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a3f4aac2557070e4b8d46c47babb417c +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/RealToon/RealToon/RealToon Shaders/Effects.meta b/RealToon/RealToon/RealToon Shaders/Effects.meta new file mode 100644 index 0000000..8c5dcb9 --- /dev/null +++ b/RealToon/RealToon/RealToon Shaders/Effects.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b23c00d9746fd7a449110741bd21ac03 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/RealToon/RealToon/RealToon Shaders/Effects/DeNorSob Outline.unitypackage b/RealToon/RealToon/RealToon Shaders/Effects/DeNorSob Outline.unitypackage new file mode 100644 index 0000000..40f7d14 Binary files /dev/null and b/RealToon/RealToon/RealToon Shaders/Effects/DeNorSob Outline.unitypackage differ diff --git a/RealToon/RealToon/RealToon Shaders/Effects/DeNorSob Outline.unitypackage.meta b/RealToon/RealToon/RealToon Shaders/Effects/DeNorSob Outline.unitypackage.meta new file mode 100644 index 0000000..a1285dd --- /dev/null +++ b/RealToon/RealToon/RealToon Shaders/Effects/DeNorSob Outline.unitypackage.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 5468d29cc8b510d47920ef4d6db9d05d +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/RealToon/RealToon/RealToon Shaders/RealToon Core.meta b/RealToon/RealToon/RealToon Shaders/RealToon Core.meta new file mode 100644 index 0000000..30d58de --- /dev/null +++ b/RealToon/RealToon/RealToon Shaders/RealToon Core.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 409a13bd17e16ba4a8defa637cb847ba +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/RealToon/RealToon/RealToon Shaders/RealToon Core/URP.meta b/RealToon/RealToon/RealToon Shaders/RealToon Core/URP.meta new file mode 100644 index 0000000..9916c3e --- /dev/null +++ b/RealToon/RealToon/RealToon Shaders/RealToon Core/URP.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 580baea314e3bca4e8164a0821e5c8ad +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/RealToon/RealToon/RealToon Shaders/RealToon Core/URP/Pass.meta b/RealToon/RealToon/RealToon Shaders/RealToon Core/URP/Pass.meta new file mode 100644 index 0000000..3565363 --- /dev/null +++ b/RealToon/RealToon/RealToon Shaders/RealToon Core/URP/Pass.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6dbbc6eb0a9826649bd01acd58991111 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/RealToon/RealToon/RealToon Shaders/RealToon Core/URP/Pass/RT_URP_MoVecPas.hlsl b/RealToon/RealToon/RealToon Shaders/RealToon Core/URP/Pass/RT_URP_MoVecPas.hlsl new file mode 100644 index 0000000..b653d4d --- /dev/null +++ b/RealToon/RealToon/RealToon Shaders/RealToon Core/URP/Pass/RT_URP_MoVecPas.hlsl @@ -0,0 +1,140 @@ +//RealToon HDRP - MoVecPas +//MJQStudioWorks + +//========================= + +struct Attributes +{ + float4 position : POSITION; + float3 normalOS : NORMAL; + float4 tangentOS : TANGENT; + float2 uv : TEXCOORD0; + float3 positionOld : TEXCOORD4; + #if _ADD_PRECOMPUTED_VELOCITY + float3 alembicMotionVector : TEXCOORD5; + #endif + + #ifndef N_F_DDMD_ON +float4 weights : BLENDWEIGHTS;//DOTS_LiBleSki_MV +uint4 indices : BLENDINDICES;//DOTS_LiBleSki_MV +//uint vertexID : SV_VertexID;//DOTS_CompDef_MV + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID +}; + +struct Varyings +{ + float4 positionCS : SV_POSITION; + float4 positionCSNoJitter : POSITION_CS_NO_JITTER; + float4 previousPositionCSNoJitter : PREV_POSITION_CS_NO_JITTER; + float2 uv : TEXCOORD0; + float3 positionWS : TEXCOORD1; + float3 normalWS : TEXCOORD2; + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO +}; + +Varyings vert(Attributes input) +{ + Varyings output = (Varyings)0; + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + + #if defined(UNITY_DOTS_INSTANCING_ENABLED) + + #ifdef N_F_DDMD_ON + + float4 _LBS_CD_Position = input.position; + float3 _LBS_CD_Normal = input.normalOS; + //float4 _LBS_CD_Tangent = input.tangentOS; //not currently needed + + #else + + float4 _LBS_CD_Position = 0; + float3 _LBS_CD_Normal = 0; + float4 _LBS_CD_Tangent = 0; + +DOTS_LiBleSki(input.indices, input.weights, input.position.xyz, input.normalOS.xyz, input.tangentOS.xyz, (float3)_LBS_CD_Position, _LBS_CD_Normal, (float3)_LBS_CD_Tangent);//DOTS_LiBleSki_MV +//DOTS_CompDef(input.vertexID, (float3)_LBS_CD_Position, _LBS_CD_Normal, (float3)_LBS_CD_Tangent);//DOTS_CompDef_MV + _LBS_CD_Position.w = 1.0; + + #endif + + #else + float4 _LBS_CD_Position = input.position; + float3 _LBS_CD_Normal = input.normalOS; + //float4 _LBS_CD_Tangent = input.tangentOS; //not currently needed + #endif + + + const VertexPositionInputs vertexInput = GetVertexPositionInputs(_LBS_CD_Position.xyz); + + //RT_SE + #if N_F_SE_ON + input.position = RT_SE(vertexInput.positionWS, input.position); + _LBS_CD_Position = input.position; + #endif + //== + + //RT_PA + #if N_F_PA_ON + output.positionCS = mul(RT_PA(vertexInput.positionWS), float4(_LBS_CD_Position.xyz,1.0) ); + #else + output.positionCS = vertexInput.positionCS; + #endif + //== + + output.uv = TRANSFORM_TEX(input.uv, _MainTex); + output.positionWS = TransformObjectToWorld(_LBS_CD_Position.xyz); + output.normalWS = TransformObjectToWorldDir(_LBS_CD_Normal); + output.positionCSNoJitter = mul(_NonJitteredViewProjMatrix, mul(UNITY_MATRIX_M, _LBS_CD_Position)); + + float4 prevPos = (unity_MotionVectorsParams.x == 1) ? float4(input.positionOld, 1) : _LBS_CD_Position; + #if _ADD_PRECOMPUTED_VELOCITY + prevPos = prevPos - float4(input.alembicMotionVector, 0); + #endif + + output.previousPositionCSNoJitter = mul(_PrevViewProjMatrix, mul(UNITY_PREV_MATRIX_M, prevPos)); + + ApplyMotionVectorZBias(output.positionCS); + + return output; +} + +float4 frag(Varyings input) : SV_Target +{ + UNITY_SETUP_INSTANCE_ID(input); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input); + + #ifdef N_F_TP_ON + half4 _MainTex_var = RT_Tripl_Default(_MainTex, sampler_MainTex, input.positionWS, input.normalWS); + #else + half4 _MainTex_var = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, TRANSFORM_TEX(input.uv, _MainTex)); + #endif + + + //RT_CO + RT_CO(input.uv, _MainTex_var, _MainTex_var.a, input.positionWS, input.normalWS, input.positionCS.xy); + //== + + + //RT_NFD + #ifdef N_F_NFD_ON + RT_NFD(input.positionCS.xy); + #endif + //== + + + #if defined(LOD_FADE_CROSSFADE) + LODFadeCrossFade(input.positionCS); + #endif + + return float4(CalcNdcMotionVectorFromCsPositions(input.positionCSNoJitter, input.previousPositionCSNoJitter), 0, 0); +} + +// \ No newline at end of file diff --git a/RealToon/RealToon/RealToon Shaders/RealToon Core/URP/Pass/RT_URP_MoVecPas.hlsl.meta b/RealToon/RealToon/RealToon Shaders/RealToon Core/URP/Pass/RT_URP_MoVecPas.hlsl.meta new file mode 100644 index 0000000..318580d --- /dev/null +++ b/RealToon/RealToon/RealToon Shaders/RealToon Core/URP/Pass/RT_URP_MoVecPas.hlsl.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 13d5ac7414ba40c4a95664ea1aa48e50 +ShaderIncludeImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/RealToon/RealToon/RealToon Shaders/RealToon Core/URP/RT_URP_Core.hlsl b/RealToon/RealToon/RealToon Shaders/RealToon Core/URP/RT_URP_Core.hlsl new file mode 100644 index 0000000..9ae163d --- /dev/null +++ b/RealToon/RealToon/RealToon Shaders/RealToon Core/URP/RT_URP_Core.hlsl @@ -0,0 +1,1535 @@ +//RealToon URP - Core +//MJQStudioWorks + +//========================= + +#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" +#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareDepthTexture.hlsl" +#include "Packages/realtoon/RealToon/RealToon Shaders/RealToon Core/URP/RT_URP_PROP.hlsl" + +half RTD_LVLC_F(float3 Light_Color_f3) +{ + #ifdef SHADER_API_MOBILE + + return saturate(dot(Light_Color_f3.rgb, float3(0.3, 0.59, 0.11))); + + #else + + float4 node_3149_k = float4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0); + float4 node_3149_p = lerp(float4(float4(Light_Color_f3.rgb, 0.0).zy, node_3149_k.wz), float4(float4(Light_Color_f3.rgb, 0.0).yz, node_3149_k.xy), step(float4(Light_Color_f3.rgb, 0.0).z, float4(Light_Color_f3.rgb, 0.0).y)); + float4 node_3149_q = lerp(float4(node_3149_p.xyw, float4(Light_Color_f3.rgb, 0.0).x), float4(float4(Light_Color_f3.rgb, 0.0).x, node_3149_p.yzx), step(node_3149_p.x, float4(Light_Color_f3.rgb, 0.0).x)); + float node_3149_d = node_3149_q.x - min(node_3149_q.w, node_3149_q.y); + float node_3149_e = 1.0e-10; + half3 node_3149 = float3(abs(node_3149_q.z + (node_3149_q.w - node_3149_q.y) / (6.0 * node_3149_d + node_3149_e)), node_3149_d / (node_3149_q.x + node_3149_e), node_3149_q.x); + + return saturate(node_3149.b); + + #endif +} + +half3 AL_GI(float3 N) +{ + + return SampleSH(N); + +} + +float2 PixPos(float2 positionCS) +{ + #if UNITY_UV_STARTS_AT_TOP + return float2(positionCS.x, (_ProjectionParams.x < 0) ? (_ScreenParams.y - positionCS.y) : positionCS.y); + #else + return float2(positionCS.x, (_ProjectionParams.x > 0) ? (_ScreenParams.y - positionCS.y) : positionCS.y); + #endif +} + +//RT_Tripl_Default +half4 RT_Tripl_Default(TEXTURE2D_PARAM(tex, samp), float3 positionWS, float3 normalWS) +{ + float3 UV = positionWS * _TriPlaTile; + + float3 Blend = pow(abs(normalWS), _TriPlaBlend); + Blend /= dot(Blend, 1.0); + + float4 X = SAMPLE_TEXTURE2D_LOD(tex, samp, UV.zy, 0.0); + float4 Y = SAMPLE_TEXTURE2D_LOD(tex, samp, UV.xz, 0.0); + float4 Z = SAMPLE_TEXTURE2D_LOD(tex, samp, UV.xy, 0.0); + + return X * Blend.x + Y * Blend.y + Z * Blend.z; +} + +//Dither_Setup +void Dither_Float(float In, float4 ScreenPosition, out float Out) +{ + float2 uv = ScreenPosition.xy * _ScreenParams.xy; + float DITHER_THRESHOLDS[16] = + { + 1.0 / 17.0, 9.0 / 17.0, 3.0 / 17.0, 11.0 / 17.0, + 13.0 / 17.0, 5.0 / 17.0, 15.0 / 17.0, 7.0 / 17.0, + 4.0 / 17.0, 12.0 / 17.0, 2.0 / 17.0, 10.0 / 17.0, + 16.0 / 17.0, 8.0 / 17.0, 14.0 / 17.0, 6.0 / 17.0, + }; + uint index = (uint(uv.x) % 4) * 4 + uint(uv.y) % 4; + + Out = In - DITHER_THRESHOLDS[index]; +} + +//Dither_Out +float RT_Dither_Out(float2 positionCS) +{ + float2 PixelPositions = PixPos(positionCS); + + float2 NDCPositions; + NDCPositions = PixelPositions.xy / _ScreenParams.xy; + NDCPositions.y = 1.0f - NDCPositions.y; + + float dither_out; + Dither_Float(1, float4(NDCPositions.xy, 0, 0), dither_out); + return dither_out; +} + +//RT_ViewVecWorl +float3 RT_ViewVecWorl(float3 WorldSpacePosition) +{ + float3 sub = _WorldSpaceCameraPos.xyz - GetAbsolutePositionWS(WorldSpacePosition); + if (!IsPerspectiveProjection()) + { + sub = GetViewForwardDir() * dot(sub, GetViewForwardDir()); + } + + return sub; +} + +//RT_Anis_Shift +float3 RTShifTan(float3 bitangentWS, float3 normalDirection, float NoiTex) +{ + float3 ShifTan = bitangentWS + NoiTex * normalDirection; + return normalize(ShifTan); +} + +//RT_Anis_Stra +float StraSpec(float3 bitangentWS, float3 viewDirection, float3 halfDirection, float StraPow) +{ + float3 H = lerp(viewDirection, halfDirection, _GlossTextureFollowLight); + float dotTH = dot(bitangentWS, H); + float sinTH = sqrt(1 - dotTH * dotTH); + float dirAtten = smoothstep(-1, 0, dotTH); + return dirAtten * pow(sinTH, StraPow); +} + +//========================= + +//EdgDet/SSOL +float EdgDet(float2 uv) +{ + + float2 _ScreenSize = (1.0) / float2(1920, 1080); + float obj_only = (float) SampleSceneDepth(uv) != UNITY_RAW_FAR_CLIP_VALUE; + + float halfScaleFloor = floor(_OutlineWidth * 0.5); + float halfScaleCeil = ceil(_OutlineWidth * 0.5); + + float2 bottomLeftUV = uv - float2(_ScreenSize.x, _ScreenSize.y) * halfScaleFloor; + float2 topRightUV = uv + float2(_ScreenSize.x, _ScreenSize.y) * halfScaleCeil; + float2 bottomRightUV = uv + float2(_ScreenSize.x * halfScaleCeil, -_ScreenSize.y * halfScaleFloor); + float2 topLeftUV = uv + float2(-_ScreenSize.x * halfScaleFloor, _ScreenSize.y * halfScaleCeil); + + float depth0 = SampleSceneDepth(bottomLeftUV); + float depth1 = SampleSceneDepth(topRightUV); + float depth2 = SampleSceneDepth(bottomRightUV); + float depth3 = SampleSceneDepth(topLeftUV); + + float depthDerivative0 = depth1 - depth0; + float depthDerivative1 = depth3 - depth2; + + float edgeDepth = sqrt(pow(depthDerivative0, 2.0) + pow(depthDerivative1, 2.0)) * 100; + edgeDepth = (edgeDepth > (depth0 * (_DepthThreshold * 0.01)) ? 1 : 0) * obj_only; + + #ifdef N_F_CO_ON + return edgeDepth; + #elif !N_F_CO_ON && N_F_TRANS_ON + return 0.0; + #else + return edgeDepth; + #endif + +} + +//DOTS_LinBlenSki +uniform ByteAddressBuffer _SkinMatrices; + +float3x4 LoadSkinMatrix(uint index) +{ + uint offset = index * 48; + float4 p1 = asfloat(_SkinMatrices.Load4(offset + 0 * 16)); + float4 p2 = asfloat(_SkinMatrices.Load4(offset + 1 * 16)); + float4 p3 = asfloat(_SkinMatrices.Load4(offset + 2 * 16)); + return float3x4(p1.x, p1.w, p2.z, p3.y, p1.y, p2.x, p2.w, p3.z, p1.z, p2.y, p3.x, p3.w); +} + +void DOTS_LiBleSki(uint4 indices, float4 weights, float3 positionIn, float3 normalIn, float3 tangentIn, out float3 positionOut, out float3 normalOut, out float3 tangentOut) +{ + positionOut = 0; + normalOut = 0; + tangentOut = 0; + + for (int i = 0; i < 4; ++i) + { + uint skinMatrixIndex = indices[i] + asint(UNITY_ACCESS_HYBRID_INSTANCED_PROP(_SkinMatrixIndex, float)); + float3x4 skinMatrix = LoadSkinMatrix(skinMatrixIndex); + float3 vtransformed = mul(skinMatrix, float4(positionIn, 1)); + float3 ntransformed = mul(skinMatrix, float4(normalIn, 0)); + float3 ttransformed = mul(skinMatrix, float4(tangentIn, 0)); + + positionOut += vtransformed * weights[i]; + normalOut += ntransformed * weights[i]; + tangentOut += ttransformed * weights[i]; + } +} + +//DOTS_Compdef +struct DeformedVertexData +{ + float3 Position; + float3 Normal; + float3 Tangent; +}; + +uniform StructuredBuffer _DeformedMeshData : register(t1); + +void DOTS_CompDef(uint vertexID, out float3 positionOut, out float3 normalOut, out float3 tangentOut) +{ + const DeformedVertexData vertexData = _DeformedMeshData[asuint(UNITY_ACCESS_HYBRID_INSTANCED_PROP(_ComputeMeshIndex, float)) + vertexID]; + positionOut = vertexData.Position; + normalOut = vertexData.Normal; + tangentOut = vertexData.Tangent; +} + +//RT NM +float3 RT_NM(float2 uv, float3 positionWS, float3x3 tangentTransform, float3 normalWS) +{ + #if N_F_NM_ON + + #ifdef N_F_TP_ON + + float3 UV = positionWS * _TriPlaTile; + + float3 Blend = pow(abs(normalWS), _TriPlaBlend); + Blend /= dot(Blend, 1.0); + + float3 X = UnpackNormal(SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, UV.zy)); + float3 Y = UnpackNormal(SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, UV.xz)); + float3 Z = UnpackNormal(SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, UV.xy)); + + float3 _NormalMap_var = X * Blend.x + Y * Blend.y + Z * Blend.z; + + #else + + float3 _NormalMap_var = UnpackNormal( SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap , TRANSFORM_TEX(uv, _NormalMap) ) ); + + #endif + + float3 normalLocal = lerp(float3(0.0,0.0,1.0),_NormalMap_var ,_NormalMapIntensity); + return normalLocal; + + #else + + return float3(0.0,0.0,1.0); + + #endif +} +// + +//RT_MCAP +half3 RT_MCAP(float2 uv, float3 normalDirection) +{ + #if N_F_MC_ON + + half2 MUV = (mul(UNITY_MATRIX_V, float4(normalDirection, 0.0)).xyz.rgb.rg * 0.5 + 0.5); + half4 _MatCap_var = SAMPLE_TEXTURE2D(_MCap, sampler_MCap, TRANSFORM_TEX(MUV, _MCap)); + half4 _MCapMask_var = SAMPLE_TEXTURE2D(_MCapMask, sampler_MCapMask, TRANSFORM_TEX(uv, _MCapMask)); + + half3 RT_SPECMO_OO; + if (!_SPECMODE) + { + RT_SPECMO_OO = (float3)1.0; + } + else + { + RT_SPECMO_OO = (float3)0.0; + } + + float3 MCapOutP = lerp(RT_SPECMO_OO, lerp(RT_SPECMO_OO, _MatCap_var.rgb, _MCapIntensity), _MCapMask_var.rgb); + + return MCapOutP; + + #else + + return (half3)1.0; + + #endif +} +// + +//RT_MCAP_SUB1 +half3 RT_MCAP_SUB1(half3 MCapOutP, half4 _MainTex_var, half3 _RTD_MVCOL, out half3 RTD_TEX_COL) +{ + #if N_F_MC_ON + + half3 RT_SPECMO_OO; + if (!_SPECMODE) + { + RT_SPECMO_OO = (_MainColor.rgb * _MaiColPo) * MCapOutP; + } + else + { + RT_SPECMO_OO = (_MainColor.rgb * _MaiColPo) + (MCapOutP * _SPECIN); + } + + half3 RT_SPECMO_OO_2; + if (!_SPECMODE) + { + RT_SPECMO_OO_2 = MCapOutP; + } + else + { + RT_SPECMO_OO_2 = MCapOutP * _SPECIN; + } + + half3 SPECMode_Sel; + if (!_MCIALO) + { + SPECMode_Sel = RT_SPECMO_OO; + } + else + { + SPECMode_Sel = RT_SPECMO_OO_2; + } + + RTD_TEX_COL = _MainTex_var.rgb * SPECMode_Sel * _RTD_MVCOL; + + half3 RTD_MCIALO_IL = RTD_TEX_COL; + + return RTD_MCIALO_IL; + + #else + + RTD_TEX_COL = _MainTex_var.rgb * (_MainColor.rgb * _MaiColPo) * MCapOutP * _RTD_MVCOL; + + half3 RTD_MCIALO_IL; + if (!_MCIALO) + { + RTD_MCIALO_IL = RTD_TEX_COL; + } + else + { + RTD_MCIALO_IL = _MainTex_var.rgb * MCapOutP * _RTD_MVCOL; + } + + return RTD_MCIALO_IL; + + #endif +} +// + +//RT TRANS CO +void RT_TRANS_CO(float2 uv, half4 _MainTex_var, out half _MainTex_var_a, out half RTD_TRAN_OPA_Sli, half RTD_CO, float3 positionWS, float3 normalDirection, float2 positionCS, inout half3 GLO_OUT) +{ + + RTD_TRAN_OPA_Sli = 1.0; + GLO_OUT = (half3)0.0; + _MainTex_var_a = 1.0; + + #if N_F_TRANS_ON + + #if N_F_CO_ON + + #ifdef N_F_TP_ON + half4 _SecondaryCutout_var = RT_Tripl_Default(_SecondaryCutout, sampler_SecondaryCutout, positionWS, normalDirection); + #else + half4 _SecondaryCutout_var = SAMPLE_TEXTURE2D(_SecondaryCutout, sampler_SecondaryCutout ,TRANSFORM_TEX(uv,_SecondaryCutout)); + #endif + + half RT_USSECCUT_OO; + if (!_UseSecondaryCutout) + { + RT_USSECCUT_OO = _MainTex_var.r * _SecondaryCutout_var.r; + } + else + { + RT_USSECCUT_OO = _SecondaryCutout_var.r; + } + + half RT_USSECCUT_OO_2; + if (!_UseSecondaryCutout) + { + RT_USSECCUT_OO_2 = _MainTex_var.a * _SecondaryCutout_var.r; + } + else + { + RT_USSECCUT_OO_2 = _SecondaryCutout_var.a; + } + + half RTD_CO_ON = (half)lerp((RT_USSECCUT_OO + lerp(0.5, (-1.0), _Cutout)), saturate(((1.0 - _Cutout) > 0.5 ? (1.0 - (1.0 - 2.0 * ((1.0 - _Cutout) - 0.5)) * ( 1.0 - RT_USSECCUT_OO_2)) : (2.0 * (1.0 - _Cutout) * RT_USSECCUT_OO_2))), _AlphaBaseCutout); + RTD_CO = RTD_CO_ON; + + //GLOW + #ifdef N_F_COEDGL_ON + half _Glow_Edge_Width_Val = (1.0 - _Glow_Edge_Width); + half _Glow_Edge_Width_Add_Input_Value = (_Glow_Edge_Width_Val + RTD_CO); + half _Remapping = (_Glow_Edge_Width_Add_Input_Value * 8.0 + -4.0); + half _Pre_Output = (1.0 - saturate(_Remapping)); + half3 _Final_Output = (_Pre_Output * lerp(0.0, _Glow_Color.rgb, saturate(_Cutout * 200.0)) ); + GLO_OUT = _Final_Output; + #endif + + #if N_F_ATC_ON + + #ifdef N_F_SCO_ON + _MainTex_var_a = saturate( ( -( RT_Dither_Out(positionCS) - RTD_CO ) - _Cutout) / max(fwidth(-( RT_Dither_Out(positionCS) - RTD_CO )), 0.0001) + 0.5 ); + #else + _MainTex_var_a = saturate( (RTD_CO - _Cutout) / max(fwidth(RTD_CO), _AAS) + 0.5 ); + #endif + + #else + + #ifdef N_F_SCO_ON + clip( -( RT_Dither_Out(positionCS) - RTD_CO )); + #else + clip(RTD_CO - 0.5); + #endif + + #endif + + #else + + #ifdef N_F_TP_ON + half4 _MaskTransparency_var = RT_Tripl_Default(_MaskTransparency, sampler_MaskTransparency, GetAbsolutePositionWS(positionWS), normalDirection); + #else + half4 _MaskTransparency_var = SAMPLE_TEXTURE2D(_MaskTransparency, sampler_MaskTransparency ,TRANSFORM_TEX(uv,_MaskTransparency)); + #endif + + //Backup (Old) + //half RTD_TRAN_MAS = (smoothstep(clamp(-20.0, 1.0, _TransparentThreshold), 1.0, _MainTex_var.a) * _MaskTransparency_var.r); + //RTD_TRAN_OPA_Sli = lerp(RTD_TRAN_MAS, smoothstep(clamp(-20.0, 1.0, _TransparentThreshold), 1.0, _MainTex_var.a), _Opacity); + + #ifdef N_F_SIMTRANS_ON + RTD_TRAN_OPA_Sli = _MainTex_var.a * _Opacity; + #else + RTD_TRAN_OPA_Sli = lerp(smoothstep(clamp(-20.0, 1.0, _TransparentThreshold), 1.0, _MainTex_var.a) * _Opacity, 1.0, _MaskTransparency_var.r); + #endif + + #endif + + #endif + +} +// + +//RT_CO +void RT_CO(float2 uv, half4 _MainTex_var, out half _MainTex_var_a, float3 positionWS, float3 normalDirection, float2 positionCS) +{ + _MainTex_var_a = 1.0; + + #if N_F_TRANS_ON + + #if N_F_CO_ON + + #ifdef N_F_TP_ON + half4 _SecondaryCutout_var = RT_Tripl_Default(_SecondaryCutout, sampler_SecondaryCutout, GetAbsolutePositionWS(positionWS), normalDirection); + #else + half4 _SecondaryCutout_var = SAMPLE_TEXTURE2D(_SecondaryCutout, sampler_SecondaryCutout ,TRANSFORM_TEX(uv,_SecondaryCutout)); + #endif + + half RT_USSECCUT_OO; + if (!_UseSecondaryCutout) + { + RT_USSECCUT_OO = _MainTex_var.r * _SecondaryCutout_var.r; + } + else + { + RT_USSECCUT_OO = _SecondaryCutout_var.r; + } + + half RT_USSECCUT_OO_2; + if (!_UseSecondaryCutout) + { + RT_USSECCUT_OO_2 = _MainTex_var.a * _SecondaryCutout_var.r; + } + else + { + RT_USSECCUT_OO_2 = _SecondaryCutout_var.a; + } + + half RTD_CO_ON = (half)lerp(( RT_USSECCUT_OO + lerp(0.5, (-1.0), _Cutout)), saturate(((1.0 - _Cutout) > 0.5 ? (1.0 - (1.0 - 2.0 * ((1.0 - _Cutout) - 0.5)) * (1.0 - RT_USSECCUT_OO_2 )) : (2.0 * (1.0 - _Cutout) * RT_USSECCUT_OO_2 ))), _AlphaBaseCutout); + + #if N_F_ATC_ON + + #ifdef N_F_SCO_ON + _MainTex_var_a = saturate( ( -( RT_Dither_Out(positionCS) - RTD_CO_ON ) - _Cutout) / max(fwidth(-( RT_Dither_Out(positionCS) - RTD_CO_ON )), 0.0001) + 0.5 ); + #else + _MainTex_var_a = saturate( (RTD_CO_ON - _Cutout) / max(fwidth(RTD_CO_ON), 0.0001) + 0.5 ); + #endif + + #else + + #ifdef N_F_SCO_ON + clip( -( RT_Dither_Out(positionCS) - RTD_CO_ON )); + #else + clip(RTD_CO_ON - 0.5); + #endif + + #endif + + #endif + + #endif +} +// + +//RT SON +float3 RT_SON(float4 vertexColor, float3 calNorm, float3 normalDirection, out float3 RTD_SON_CHE_1) +{ + + RTD_SON_CHE_1 = float3(1.0, 1.0, 1.0); + + #if N_F_SON_ON + + float RTD_SON_VCBCSON_OO; + if (!_VertexColorRedControlSmoothObjectNormal) + { + RTD_SON_VCBCSON_OO = _SmoothObjectNormal; + } + else + { + RTD_SON_VCBCSON_OO = _SmoothObjectNormal * (1.0 - vertexColor.r); + } + + float3 RTD_SON_ON_OTHERS = lerp(normalDirection, -normalize(_XYZPosition.xyz - calNorm), RTD_SON_VCBCSON_OO); + + float3 RTD_SNorm_OO; + if (!_ShowNormal) + { + RTD_SNorm_OO = (float3)1.0; + } + else + { + RTD_SNorm_OO = smoothstep(0.0, 0.01, RTD_SON_ON_OTHERS); + } + + RTD_SON_CHE_1 = RTD_SNorm_OO; + float3 RTD_SON = RTD_SON_ON_OTHERS; + return RTD_SON; + + #else + + float3 RTD_SON = normalDirection; + return RTD_SON; + + #endif + +} +// + +//RT_RELGI +float3 RT_RELGI( float3 RTD_SON ) +{ + + #if N_F_RELGI_ON + + half3 RTD_GI_ST_Sli = (RTD_SON*_GIShadeThreshold); + + half3 RTD_GI_FS_OO; + if (!_GIFlatShade) + { + RTD_GI_FS_OO = RTD_GI_ST_Sli; + } + else + { + RTD_GI_FS_OO = half3(smoothstep(0.0, 0.01, RTD_SON.r * _GIShadeThreshold), 0.0, smoothstep(0.0, 0.01, RTD_SON.b * _GIShadeThreshold)); + //RTD_GI_FS_OO = half3(smoothstep(float2(0.0, 0.0), float2(0.01, 0.01), (RTD_SON.rb * _GIShadeThreshold)), 0.0); //Old + } + + + return RTD_GI_FS_OO; + + #else + + half3 RTD_GI_FS_OO = RTD_SON; + + return RTD_GI_FS_OO; + + #endif + +} + +//RT_SCT +half3 RT_SCT(float2 uv, float3 positionWS, float3 normalDirection, half3 RTD_MCIALO_IL) +{ + + #ifndef N_F_OFLMB_ON + + #if N_F_SCT_ON + + #ifdef N_F_TP_ON + half4 _ShadowColorTexture_var = RT_Tripl_Default(_ShadowColorTexture, sampler_ShadowColorTexture, positionWS, normalDirection); + #else + half4 _ShadowColorTexture_var = SAMPLE_TEXTURE2D(_ShadowColorTexture, sampler_ShadowColorTexture ,TRANSFORM_TEX(uv,_ShadowColorTexture)); + #endif + + half3 RTD_SCT_ON = lerp(_ShadowColorTexture_var.rgb,(_ShadowColorTexture_var.rgb*_ShadowColorTexture_var.rgb),_ShadowColorTexturePower); + + half3 RT_MCIALO_OO; + if (!_MCIALO) + { + RT_MCIALO_OO = (_MainColor.rgb * _MaiColPo); + } + else + { + RT_MCIALO_OO = (half3)1.0; + } + + half3 RTD_SCT = RTD_SCT_ON * RT_MCIALO_OO; + return RTD_SCT; + + #else + + half3 RTD_SCT = RTD_MCIALO_IL; + return RTD_SCT; + + #endif + + #else + + half3 RTD_SCT = RTD_MCIALO_IL; + return RTD_SCT; + + #endif + +} +// + +//RT_PT +half RT_PT( float2 RTD_VD_Cal , out half3 RTD_PT_COL ) +{ + + RTD_PT_COL = half3(1.0,1.0,1.0); + + #ifndef N_F_OFLMB_ON + + #if N_F_PT_ON + + half4 _PTexture_var = SAMPLE_TEXTURE2D(_PTexture, sampler_PTexture ,TRANSFORM_TEX(RTD_VD_Cal,_PTexture)); + half RTD_PT_ON = lerp((1.0 - _PTexturePower),1.0,_PTexture_var.r); + RTD_PT_COL = _PTCol.rgb; + + half RTD_PT = RTD_PT_ON; + + return RTD_PT; + + #else + + half RTD_PT = 1.0; + + return RTD_PT; + + #endif + + #else + + half RTD_PT = 1.0; + + return RTD_PT; + + #endif +} +// + +//RT_CLD +float3 RT_CLD( float3 lightDirection ) +{ + + #ifndef N_F_OFLMB_ON + + #if N_F_CLD_ON + + float3 RTD_CLD_CLDFOR_OO; + if (!_CustomLightDirectionFollowObjectRotation) + { + RTD_CLD_CLDFOR_OO = _CustomLightDirection.xyz; + } + else + { + RTD_CLD_CLDFOR_OO = mul(unity_ObjectToWorld, float4(_CustomLightDirection.xyz, 0.0)).xyz; + } + + float3 RTD_CLD_CLDI_Sli = lerp(lightDirection,RTD_CLD_CLDFOR_OO,_CustomLightDirectionIntensity); + float3 RTD_CLD = RTD_CLD_CLDI_Sli; + + return RTD_CLD; + + #else + + float3 RTD_CLD = lightDirection; + + return RTD_CLD; + + #endif + + #else + + float3 RTD_CLD = lightDirection; + + return RTD_CLD; + + #endif + +} +// + +//RT_GLO +void RT_GLO(float2 uv, float2 RTD_VD_Cal, float3 halfDirection, float3 bitangentWS, float3 normalDirection, float3 viewDirection, float3 positionWS, out half RTD_GLO, out half3 RTD_GLO_COL) +{ + + #ifndef N_F_OFLMB_ON + + #if N_F_GLO_ON + + #if USE_FORWARD_PLUS + #ifdef N_F_TP_ON + half4 _MaskGloss_var = RT_Tripl_Default(_MaskGloss, sampler_MaskGloss, positionWS, normalDirection); + #else + half4 _MaskGloss_var = SAMPLE_TEXTURE2D_LOD(_MaskGloss, sampler_MaskGloss, TRANSFORM_TEX(uv, _MaskGloss), 0.0); + #endif + #else + #ifdef N_F_TP_ON + half4 _MaskGloss_var = RT_Tripl_Default(_MaskGloss, sampler_MaskGloss, positionWS, normalDirection); + #else + half4 _MaskGloss_var = SAMPLE_TEXTURE2D(_MaskGloss, sampler_MaskGloss, TRANSFORM_TEX(uv, _MaskGloss)); + #endif + #endif + + + // + #ifdef UNITY_COLORSPACE_GAMMA + _GlossColor = float4(LinearToGamma22(_GlossColor.rgb), _GlossColor.a); + #endif + + RTD_GLO_COL = (_GlossColor.rgb*_GlossColorPower); + // + + + #if N_F_GLOT_ON + + #if N_F_ANIS_ON + + half4 _GlossTexture_var = SAMPLE_TEXTURE2D(_GlossTexture, sampler_GlossTexture , TRANSFORM_TEX(uv,_GlossTexture) ); + + half RTD_ANIS_SHIF = ( _GlossTexture_var.r - _ShifAnis ); + half RTD_ANIS = StraSpec( RTShifTan( bitangentWS , normalDirection , lerp(0.0, RTD_ANIS_SHIF ,_NoisTexInten * 0.1) ), viewDirection, halfDirection , ((_StraWidt * 200) * 0.1) * lerp(1.0,(1.0 - _GlossTexture_var.r ),_NoiTexAffStraWidt) ); + half RTD_ANIS_SOF = smoothstep( 0.1, lerp(0.1,1.0, _GlossSoftness) , RTD_ANIS); + half RTD_GT_ON = RTD_ANIS_SOF; + + #else + + float _5992_ang = _GlossTextureRotate; + float _5992_spd = 1.0; + float _5992_cos = cos(_5992_spd*_5992_ang); + float _5992_sin = sin(_5992_spd*_5992_ang); + float2 _5992_piv = float2(0.5,0.5); + + half3 RefGlo = reflect( lerp(viewDirection,halfDirection,_GlossTextureFollowLight) ,normalDirection); + + half3 RTD_GT_FOR_OO; + if (!_GlossTextureFollowObjectRotation) + { + RTD_GT_FOR_OO = RefGlo; + } + else + { + RTD_GT_FOR_OO = mul(GetWorldToObjectMatrix(), float4(RefGlo, 0.0)).xyz; + } + + half2 glot_rot_cal = (mul(float2((-1* RTD_GT_FOR_OO.r), RTD_GT_FOR_OO.g)-_5992_piv,float2x2( _5992_cos, -_5992_sin, _5992_sin, _5992_cos))+_5992_piv); + half2 glot_rot_out = (glot_rot_cal*0.5+0.5); + + half2 PSGLOTEX_Sel; + if (!_PSGLOTEX) + { + PSGLOTEX_Sel = glot_rot_out; + } + else + { + PSGLOTEX_Sel = RTD_VD_Cal; + } + + half4 _GlossTexture_var = SAMPLE_TEXTURE2D_LOD(_GlossTexture, sampler_GlossTexture, TRANSFORM_TEX(PSGLOTEX_Sel, _GlossTexture), _GlossTextureSoftness); + half RTD_GT_ON = _GlossTexture_var.r; + + #endif + + half3 RTD_GT = RTD_GT_ON; + + #else + + half RTD_GLO_MAIN_Sof_Sli = lerp( 0.1 , 1.0 ,_GlossSoftness); + half RTD_NDOTH = saturate(dot(halfDirection, normalDirection)); + half RTD_GLO_MAIN = smoothstep( 0.1, RTD_GLO_MAIN_Sof_Sli, pow(RTD_NDOTH,exp2(lerp(-2.0,15.0,_Glossiness))) ); + + half3 RTD_GT = RTD_GLO_MAIN; + + #endif + + half RTD_GLO_I_Sli = lerp(0.0, (half)RTD_GT,_GlossIntensity); + + half RTD_GLO_MAS = lerp( 0.0, RTD_GLO_I_Sli ,_MaskGloss_var.r); + RTD_GLO = RTD_GLO_MAS; + + #else + + RTD_GLO_COL = (half3)1.0; + RTD_GLO = 0.0; + + #endif + + #else + + RTD_GLO_COL = (half3)1.0; + RTD_GLO = 0.0; + + #endif + +} +// + +//RT_RL +half RT_RL(float3 viewDirection , float3 normalDirection , half3 lightColor, out half3 RTD_RL_LARL_OO , out half RTD_RL_MAIN) +{ + + RTD_RL_MAIN = 0.0; + + #if N_F_RL_ON + + // + #ifdef UNITY_COLORSPACE_GAMMA + _RimLightColor = float4(LinearToGamma22(_RimLightColor.rgb), _RimLightColor.a); + #endif + + half3 RT_LARLC_OO; + if (!_LightAffectRimLightColor) + { + RT_LARLC_OO = _RimLightColor.rgb; + } + else + { + RT_LARLC_OO = lerp(half3(0.0, 0.0, 0.0), _RimLightColor.rgb, lightColor); + } + + RTD_RL_LARL_OO = RT_LARLC_OO * _RimLightColorPower; + // + + + half RTD_RL_S_Sli = lerp(1.70,0.29,_RimLightSoftness); + RTD_RL_MAIN = lerp(0.0, 1.0 ,smoothstep( 1.71, RTD_RL_S_Sli, pow(abs( 1.0-max(0,dot(normalDirection, viewDirection) ) ), (1.0 - _RimLightUnfill) ) ) ); + + half RTD_RL_IL_OO = lerp( 0.0, RTD_RL_MAIN, _RimLigInt); + + half RTD_RL_CHE_1 = RTD_RL_IL_OO; + + return RTD_RL_CHE_1; + + #else + + RTD_RL_LARL_OO = (half3)1.0; + + half RTD_RL_CHE_1 = 0.0; + + return RTD_RL_CHE_1; + + #endif + +} +// + +//RT_ST +half RT_ST ( float2 uv, float3 positionWS, float3 normalDirection, half RTD_NDOTL, half attenuation, float3 DirLig, half RTD_LVLC, half3 RTD_PT_COL, half3 lightColint, half3 RTD_SCT, half3 RTD_OSC, half RTD_PT , out half3 RTD_SHAT_COL , out half RTD_STIAL , out half RTD_ST_IS , out half3 RTD_ST_LAF) +{ + + RTD_ST_LAF = (half3) 1.0; + RTD_STIAL = 1.0; + RTD_ST_IS = 1.0; + + #ifndef N_F_OFLMB_ON + + #if N_F_ST_ON + + #ifdef N_F_STSDFM_ON + float3 HF = _ObjectForward; + float2 HF_RB = float2(HF[0],HF[2]); + float2 HF_RB_Norma = normalize(HF_RB); + + float2 DirLig_RB = float2(DirLig[0],DirLig[2] *_ShadowTLightThreshold*0.01); + float2 DirLig_RB_Norma = normalize(DirLig_RB); + + float DirLig_HF_Dot = dot(HF_RB_Norma,DirLig_RB_Norma); + float Ste_DirLig_HF_Dot = step(float(0),DirLig_HF_Dot); + + float3 HR = _ObjectRight; + float2 HR_RB = float2(HR[0],HR[2]); + float2 HR_RB_Norma = normalize(HR_RB); + + float DirLig_HR_Dot = dot(HR_RB_Norma,DirLig_RB_Norma); + half Comp_DirLig_HR_Dot = DirLig_HR_Dot > half(0) ? 1 : 0; + + float2 UV_Mod_R = float2( (1 - uv.r) , uv.g); + half2 Bran_uv = Comp_DirLig_HR_Dot ? UV_Mod_R : uv; + #else + half2 Bran_uv = uv; + #endif + + + #if USE_FORWARD_PLUS + #ifdef N_F_TP_ON + float4 _ShadowT_var = RT_Tripl_Default(_ShadowT, sampler_ShadowT, positionWS, normalDirection); + #else + float4 _ShadowT_var = SAMPLE_TEXTURE2D_LOD(_ShadowT, sampler_ShadowT, TRANSFORM_TEX(Bran_uv, _ShadowT), 0.0); + #endif + #else + #ifdef N_F_TP_ON + float4 _ShadowT_var = RT_Tripl_Default(_ShadowT, sampler_ShadowT, positionWS, normalDirection); + #else + float4 _ShadowT_var = SAMPLE_TEXTURE2D(_ShadowT, sampler_ShadowT , TRANSFORM_TEX(Bran_uv,_ShadowT)); + #endif + #endif + + + // + #ifdef UNITY_COLORSPACE_GAMMA + _ShadowTColor = float4(LinearToGamma22(_ShadowTColor.rgb), _ShadowTColor.a); + #endif + + RTD_SHAT_COL = lerp( RTD_PT_COL, (_ShadowTColor.rgb*_ShadowTColorPower) * RTD_SCT * RTD_OSC, RTD_PT); + // + + + if (!_LightAffectShadow) + { + RTD_ST_LAF = RTD_SHAT_COL * RTD_LVLC; + } + else + { + RTD_ST_LAF = RTD_SHAT_COL * lightColint; + } + + + #if !defined(N_F_STSDFM_ON) + half RTD_ST_H_Sli = lerp(0.0,0.22,_ShadowTHardness); + half RTD_ST_IS_ON = (half)smoothstep( RTD_ST_H_Sli, 0.22, (_ShowInAmbientLightShadowThreshold*_ShadowT_var.rgb) ); + + #if N_F_STIAL_ON + half RTD_ST_ALI_Sli = lerp(1.0,RTD_ST_IS_ON,_ShowInAmbientLightShadowIntensity); + half RTD_STIAL_ON = (half)lerp(RTD_ST_ALI_Sli,half3(1.0,1.0,1.0),clamp((RTD_LVLC*8.0),0.0,1.0)); + + RTD_STIAL = RTD_STIAL_ON; + #else + RTD_STIAL = 1.0; + #endif + + #if N_F_STIS_ON + RTD_ST_IS = lerp(1.0,RTD_ST_IS_ON,_ShowInAmbientLightShadowIntensity); + #else + RTD_ST_IS = 1.0; + #endif + + + half RT_LFOAST_OO; + if (!_TexturePatternStyle) + { + RT_LFOAST_OO = RTD_NDOTL; + } + else + { + RT_LFOAST_OO = attenuation * RTD_NDOTL; + } + + + half RTD_ST_LFAST_OO; + if (!_STIL) + { + RTD_ST_LFAST_OO = RT_LFOAST_OO; + } + else + { + RTD_ST_LFAST_OO = 1.0; + } + + + half RTD_ST_In_Sli = lerp( 1.0 ,smoothstep( RTD_ST_H_Sli, 0.22, ((_ShadowT_var.r*(1.0 - _ShadowTShadowThreshold))*(RTD_ST_LFAST_OO *_ShadowTLightThreshold*0.01)) ),_ShadowTIntensity); + #endif + + #ifdef N_F_STSDFM_ON + float Pi_Cons = 3.141593; + float DirLig_HR_Dot_acos = acos(DirLig_HR_Dot); + float acos_pi_div = DirLig_HR_Dot_acos/Pi_Cons; + float acos_pi_div_mul_val = acos_pi_div * 2; + + float RoundMinuOn = 1 - acos_pi_div_mul_val; + float RoundRev = -1 * RoundMinuOn; + float Bran_Sphe = Comp_DirLig_HR_Dot ? RoundMinuOn : RoundRev; + + half SmooLo_SDF = lerp(_ShadowT_var.r, float(1), (1 - _ShadowTHardness) ); + half SmooSte = smoothstep(_ShadowT_var.r, SmooLo_SDF, Bran_Sphe * distance(DirLig_RB_Norma,HF_RB_Norma) ); + half SmooSte_mi_one = 1 - SmooSte.r; + + half SDF_Final = Ste_DirLig_HF_Dot * SmooSte_mi_one; + half RTD_ST_In_Sli = lerp( 1.0 , SDF_Final ,_ShadowTIntensity); + #endif + + float RTD_ST_ON = RTD_ST_In_Sli; + float RTD_ST = RTD_ST_ON; + return RTD_ST; + + #else + + half RTD_ST = 1.0; + RTD_SHAT_COL = (half3)1.0; + RTD_ST_LAF = (half3) 1.0; + RTD_STIAL = 1.0; + RTD_ST_IS = 1.0; + + return RTD_ST; + + #endif + + #else + + half RTD_ST = 1.0; + RTD_SHAT_COL = (half3)1.0; + RTD_ST_LAF = (half3)1.0; + RTD_STIAL = 1.0; + RTD_ST_IS = 1.0; + + return RTD_ST; + + #endif +} +// + +//RT_SS +half RT_SS( float4 vertexColor , float3 RTD_NDOTL , half attenuation , float dim_val ) +{ + + #ifndef N_F_OFLMB_ON + + #if N_F_SS_ON + + half RTD_SS_SSH_Sil = lerp(0.3,1.0,_SelfShadowHardness); + half RTD_SS_SSTH_Sli = lerp(-1.0, 1.0, _SelfShadowThreshold); + + half RTD_SS_VCGCSSS_OO; + if (!_VertexColorGreenControlSelfShadowThreshold) + { + RTD_SS_VCGCSSS_OO = RTD_SS_SSTH_Sli; + } + else + { + RTD_SS_VCGCSSS_OO = RTD_SS_SSTH_Sli * (1.0 - vertexColor.g); + } + + half RTD_SS_SST = smoothstep( RTD_SS_SSH_Sil, 1.0, ((float)RTD_NDOTL * lerp(7.0, RTD_SS_VCGCSSS_OO ,RTD_SS_SSTH_Sli)) ); + half RTD_SS_SSABLSS_OO = lerp( RTD_SS_SST, lerp(RTD_SS_SST,1.0, (1.0 - dim_val) ), _SelfShadowAffectedByLightShadowStrength ); + half RTD_SS_ON = lerp(1.0,(RTD_SS_SSABLSS_OO*attenuation),_SelfShadowRealtimeShadowIntensity); + + half RTD_SS = RTD_SS_ON; + + return RTD_SS; + + #else + + half RTD_SS_OFF = lerp(1.0,attenuation,_SelfShadowRealtimeShadowIntensity); + + half RTD_SS = RTD_SS_OFF; + + return RTD_SS; + + #endif + + #else + + half RTD_SS_OFF = lerp(1.0, attenuation, _SelfShadowRealtimeShadowIntensity); + + half RTD_SS = RTD_SS_OFF; + + return RTD_SS; + + #endif + +} +// + +//RT_RELGI_SUB1 +half3 RT_RELGI_SUB1(float2 uv, half3 RTD_GI_FS_OO , half3 RTD_SHAT_COL , half3 RTD_MCIALO , half RTD_STIAL, Light mainLight, float3 normalDirection, float3 positionWS, float3 viewDirection, float2 positionCS) // +{ + half3 RTD_SL_OFF_OTHERS = float3(1.0, 1.0, 1.0); + half3 RTD_B_GI_AND_AL_GI = half3(1.0, 1.0, 1.0); + + #if N_F_RELGI_ON + + #if defined(LIGHTMAP_ON) + + half3 baked_GI = SampleLightmap(uv, 0, lerp(float3(0.0, 0.0, 0.0), float3(1.0, 1.0, 1.0), RTD_GI_FS_OO) ); + MixRealtimeAndBakedGI(mainLight, normalDirection, baked_GI, half4(0, 0, 0, 0)); + RTD_B_GI_AND_AL_GI = baked_GI * 2; + + MixRealtimeAndBakedGI(mainLight, normalDirection, baked_GI , half4(0, 0, 0, 0)); + + //#elif ( defined(LIGHTMAP_ON) & defined(_MIXED_LIGHTING_SUBTRACTIVE) ) || (!defined(LIGHTMAP_ON)) + + //half3 RTD_B_GI_AND_AL_GI = float3(0.0, 0.0, 0.0); + + #else + + #if defined(PROBE_VOLUMES_L1) || defined(PROBE_VOLUMES_L2) + + EvaluateAdaptiveProbeVolume(GetAbsolutePositionWS(positionWS), lerp(float3(0.0, 0.0, 0.0), float3(1.0, 1.0, 1.0), RTD_GI_FS_OO), viewDirection, positionCS, RTD_B_GI_AND_AL_GI); + + #else + + RTD_B_GI_AND_AL_GI = (AL_GI(lerp(float3(0.0, 0.0, 0.0), float3(1.0, 1.0, 1.0), RTD_GI_FS_OO))); + + #endif + + #endif + + RTD_SL_OFF_OTHERS = lerp(RTD_SHAT_COL, RTD_MCIALO, RTD_STIAL) * (RTD_B_GI_AND_AL_GI * ((_EnvironmentalLightingIntensity))); + + + return RTD_SL_OFF_OTHERS; + + #else + + RTD_SL_OFF_OTHERS = half3(0.0,0.0,0.0); + + return RTD_SL_OFF_OTHERS; + + #endif + +} +// + +//RT_R +half3 RT_R( float2 uv, float3 viewReflectDirection, float3 viewDirection, float3 normalDirection, half3 RTD_TEX_COL, half3 RTD_R_OFF_OTHERS, float3 positionWS ) +{ + + #if N_F_R_ON + + #if !USE_FORWARD_PLUS + half3 RTD_FR_OFF_OTHERS = GlossyEnvironmentReflection(viewReflectDirection, positionWS, _Smoothness, 1.0); + #else + half3 RTD_FR_OFF_OTHERS = GlossyEnvironmentReflection(viewReflectDirection, positionWS, _Smoothness, 1.0, float2(0.0f, 0.0f)); + #endif + + #if N_F_FR_ON + + half2 ref_cal = reflect(viewDirection,normalDirection).rg; + half2 ref_cal_out = (float2(ref_cal.r,(-1.0*ref_cal.g))*0.5+0.5); + half4 _FReflection_var = SAMPLE_TEXTURE2D_LOD(_FReflection, sampler_FReflection, TRANSFORM_TEX(ref_cal_out, _FReflection), _Smoothness); + half3 RTD_FR_ON = _FReflection_var.rgb; + + half3 RTD_FR = RTD_FR_ON; + + #else + + half3 RTD_FR = RTD_FR_OFF_OTHERS; + + #endif + + #if USE_FORWARD_PLUS + #ifdef N_F_TP_ON + half4 _MaskReflection_var = RT_Tripl_Default(_MaskReflection, sampler_MaskReflection, positionWS, normalDirection); + #else + half4 _MaskReflection_var = SAMPLE_TEXTURE2D_LOD(_MaskReflection, sampler_MaskReflection, TRANSFORM_TEX(uv, _MaskReflection), 0.0); + #endif + #else + #ifdef N_F_TP_ON + half4 _MaskReflection_var = RT_Tripl_Default(_MaskReflection, sampler_MaskReflection, positionWS, normalDirection); + #else + half4 _MaskReflection_var = SAMPLE_TEXTURE2D(_MaskReflection, sampler_MaskReflection , TRANSFORM_TEX(uv, _MaskReflection)); + #endif + #endif + + half3 RTD_R_MET_Sli = lerp((half3)1.0,(9.0 * (RTD_TEX_COL - (9.0 * 0.005) ) ) , _RefMetallic); + half3 RTD_R_MAS = lerp(RTD_R_OFF_OTHERS, (RTD_FR * RTD_R_MET_Sli) ,_MaskReflection_var.r); + half3 RTD_R_ON = lerp(RTD_R_OFF_OTHERS, RTD_R_MAS ,_ReflectionIntensity); + + half3 RTD_R = RTD_R_ON; + + return RTD_R; + + #else + + half3 RTD_R = RTD_R_OFF_OTHERS; + + return RTD_R; + + #endif + +} +// + +//RT_SL +half3 RT_SL( float2 uv, float3 positionWS, float3 normalDirection, half3 RTD_SL_OFF_OTHERS, half3 RTD_TEX_COL, half3 RTD_R, out half3 RTD_SL_CHE_1 ) +{ + + #if N_F_SL_ON + + #ifdef N_F_TP_ON + half4 _MaskSelfLit_var = RT_Tripl_Default(_MaskSelfLit, sampler_MaskSelfLit, positionWS, normalDirection); + #else + half4 _MaskSelfLit_var = SAMPLE_TEXTURE2D_LOD(_MaskSelfLit, sampler_MaskSelfLit, TRANSFORM_TEX(uv, _MaskSelfLit), 0.0); + #endif + + + // + #ifdef UNITY_COLORSPACE_GAMMA + _SelfLitColor = float4(LinearToGamma22(_SelfLitColor.rgb), _SelfLitColor.a); + #endif + // + + #ifdef N_F_SLMM_ON + half3 RTD_SL_MAS = lerp(RTD_SL_OFF_OTHERS,(_SelfLitColor.rgb*_SelfLitPower),_MaskSelfLit_var.rgb); + half3 RTD_R_SEL = lerp(RTD_R,lerp(RTD_R,RTD_TEX_COL*_TEXMCOLINT,_MaskSelfLit_var.rgb),_SelfLitIntensity); + #else + + half3 RTD_SL_HC_OO; + if (!_SelfLitHighContrast) + { + RTD_SL_HC_OO = (half3)1.0; + } + else + { + RTD_SL_HC_OO = RTD_TEX_COL; + } + + half3 RTD_SL_MAS = lerp(RTD_SL_OFF_OTHERS,((_SelfLitColor.rgb * RTD_TEX_COL * RTD_SL_HC_OO)*_SelfLitPower),_MaskSelfLit_var.r); + half3 RTD_R_SEL = lerp(RTD_R,lerp(RTD_R,RTD_TEX_COL*_TEXMCOLINT,_MaskSelfLit_var.r),_SelfLitIntensity); + #endif + + + half3 RTD_SL_ON = lerp(RTD_SL_OFF_OTHERS,RTD_SL_MAS,_SelfLitIntensity); + + half3 RTD_SL = RTD_SL_ON; + RTD_SL_CHE_1 = RTD_R_SEL; + + return RTD_SL; + + #else + + half3 RTD_SL = RTD_SL_OFF_OTHERS; + RTD_SL_CHE_1 = RTD_R; + + return RTD_SL; + + #endif + +} +// + +//RT_RL_SUB1 +half3 RT_RL_SUB1(half3 RTD_SL_CHE_1 , half3 RTD_RL_LARL_OO , half3 RTD_RL_MAIN) +{ + + #if N_F_RL_ON + + #ifndef N_F_OFLMB_ON + half3 RT_RLIL_OO; + if (!_RimLightInLight) + { + RT_RLIL_OO = lerp(RTD_SL_CHE_1, RTD_RL_LARL_OO, RTD_RL_MAIN); + } + else + { + RT_RLIL_OO = RTD_SL_CHE_1; + } + + half3 RTD_RL_ON = lerp(RTD_SL_CHE_1, RT_RLIL_OO, _RimLigInt); + + #else + half3 RTD_RL_ON = lerp(RTD_SL_CHE_1, lerp(RTD_SL_CHE_1, RTD_RL_LARL_OO, RTD_RL_MAIN), _RimLigInt); + #endif + + half3 RTD_RL = RTD_RL_ON; + + return RTD_RL; + + #else + + half3 RTD_RL = RTD_SL_CHE_1; + + return RTD_RL; + + #endif + +} +// + +//RT_CA +half3 RT_CA( half3 color ) +{ + + #if N_F_CA_ON + + half3 RTD_CA_ON = lerp(color,dot(color,half3(0.3,0.59,0.11)),(1.0 - _Saturation)); + half3 RTD_CA = RTD_CA_ON; + + return RTD_CA; + + #else + + half3 RTD_CA = color; + + return RTD_CA; + + #endif + +} +// + +//RT_DC +void RT_DC(float4 positionCS, inout half4 _MainTex_var, inout half3 normalWS) +{ + half3 specular = 0; + half metallic = 0; + half occlusion = 0; + half smoothness = 0; + ApplyDecal(positionCS, _MainTex_var.rgb, specular, normalWS, metallic, occlusion, smoothness); +} +// + +//RT_SSAO +half3 RT_SSAO(float4 positionCS) +{ + float3 RT_SSAmOc = 1.0; + + #if defined(_SCREEN_SPACE_OCCLUSION) && !defined(N_F_TRANS_ON) + float2 normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(positionCS); + AmbientOcclusionFactor aoFactor = GetScreenSpaceAmbientOcclusion(normalizedScreenSpaceUV); + RT_SSAmOc = lerp(_SSAOColor.rgb, 1.0, aoFactor.directAmbientOcclusion); + #endif + + #ifdef N_F_ESSAO_ON + return RT_SSAmOc; + #else + return 1.0; + #endif + +} +// + +//RT_NFD +void RT_NFD(float2 positionCS) +{ + float distanceFromCamera = distance(GetAbsolutePositionWS(UNITY_MATRIX_M._m03_m13_m23), _WorldSpaceCameraPos); + clip(-(RT_Dither_Out(positionCS) - saturate((distanceFromCamera - _MinFadDistance) / _MaxFadDistance))); +} + +//RT_PA +float4x4 RT_PA(float3 positionRWS) +{ + float3 ViewVec_Out = RT_ViewVecWorl(positionRWS); + float Neg = length(ViewVec_Out) - float(1.0) * (_PADist * 0.1); + float limit = smoothstep(((1 - _PASmooTrans) * 0.1), 1, clamp(Neg, (1 - _PASize), float(1.0))); + + float4x4 VPM_Mul = mul(GetWorldToHClipMatrix(), GetObjectToWorldMatrix()); + float4x4 VPM_Mod = float4x4(VPM_Mul[0][0], VPM_Mul[0][1], VPM_Mul[0][2], VPM_Mul[0][3], VPM_Mul[1][0], VPM_Mul[1][1], VPM_Mul[1][2], VPM_Mul[1][3], VPM_Mul[2][0] * (_ClipAdju * 5), VPM_Mul[2][1] * (_ClipAdju * 5), VPM_Mul[2][2] * (_ClipAdju * 5), VPM_Mul[2][3], VPM_Mul[3][0] * _PresAdju, VPM_Mul[3][1], VPM_Mul[3][2] * _PresAdju, VPM_Mul[3][3] * limit); + return VPM_Mod; +} +// + +//RT_SE +float haS(float n) { return frac(sin(n) * 43758.5453); } +float4 RT_SE(float3 positionWS, float4 positionOS) +{ + float4 WSPos = float4(positionWS, 1.0); + float3 WSOff = _ObjPosi.xyz - _PrevPosition.xyz; + float3 OSOff = WSPos.xyz - _ObjPosi.xyz; + float3 NoiSi = WSPos.xyz * _NoiseSize; + float3 p = floor(NoiSi); + float3 f = frac(NoiSi); + float n = p.x + p.y * 57.0 + 113.0 * p.z; + + f = f * f * (3.0 - 2.0 * f); + float Noi = lerp(lerp(lerp(haS(n + 0.0), haS(n + 1.0), f.x), lerp(haS(n + 57.0), haS(n + 58.0), f.x), f.y), lerp(lerp(haS(n + 113.0), haS(n + 114.0), f.x), lerp(haS(n + 170.0), haS(n + 171.0), f.x), f.y), f.z); + float DirDotComp = dot(normalize(WSOff), normalize(OSOff)); + float3 NoiSizAdj = (float3)_TrailSize; + + WSOff = clamp(WSOff, NoiSizAdj * -1, NoiSizAdj); + WSOff *= -clamp(DirDotComp, -1, 0) * lerp(1, 0, step(length(WSOff), 0)); + WSPos.xyz += -WSOff.xyz * lerp(1, Noi, step(0, _NoiseSize)); + return mul(GetWorldToObjectMatrix(), WSPos); +} +// + +//=========================== +//RT_ADD_LI Function +//=========================== + +//RT_ADD_LI +float3 RT_ADD_LI(Light light, float3 bitangentWS, float3 viewDirection, float3 viewReflectDirection, float3 positionWS, half3 ss_col, half3 RTD_TEX_COL, half3 _MC_MCP, half4 _MainTex_var, half3 MCapOutP, half3 _RTD_MVCOL, half2 RTD_VD_Cal, float3 normalDirection, float3 RTD_SON, half3 RTD_PT_COL, half3 RTD_SCT, half3 RTD_OSC, half RTD_PT, half3 RTD_MCIALO_IL, float2 uv, float4 vertexColor, half isFrontFace, int lightIndex) +{ + + float3 lightDirection = light.direction; + + #ifdef N_F_LLI_ON + half3 PuncLighCol = clamp(light.color.rgb,_LLI_Min,_LLI_Max); + #else + half3 PuncLighCol = light.color.rgb; + #endif + + #if N_F_NLASOBF_ON + half3 lightColor = lerp((half3)0.0,PuncLighCol,isFrontFace); + #else + half3 lightColor = PuncLighCol; + #endif + + #if N_F_HPSS_ON + half attenuation = 1.0; + #else + half dlshmin = lerp( 0.0 , 0.6 ,_ShadowHardness); + half dlshmax = lerp( 1.0 , 0.6 ,_ShadowHardness); + + #if N_F_NLASOBF_ON + half FB_Check = lerp( 1.0 ,light.shadowAttenuation,isFrontFace); + #else + half FB_Check = light.shadowAttenuation; + #endif + half attenuation = smoothstep(dlshmin, dlshmax ,FB_Check); + #endif + + half RTD_LVLC = RTD_LVLC_F(lightColor.rgb); + half lightfos = smoothstep( 0.0 , _LightFalloffSoftness ,light.distanceAttenuation); + half3 lig_col_int = (_LightIntensity * lightColor.rgb); + float3 halfDirection = normalize(viewDirection + lightDirection); + + + //** + half3 RTD_LAS; + if (!_LightAffectShadow) + { + RTD_LAS = ss_col * RTD_LVLC; + } + else + { + RTD_LAS = ss_col * lig_col_int; + } + //** + + + half3 RTD_HL = (_HighlightColor.rgb*_HighlightColorPower+_PointSpotlightIntensity); + + + //** + half3 RTD_MC_SM_TC_OO; + if (!_SPECMODE) + { + RTD_MC_SM_TC_OO = RTD_TEX_COL * _MC_MCP; + } + else + { + RTD_MC_SM_TC_OO = RTD_TEX_COL + _MC_MCP; + } + //** + + + //** + half3 RTD_MCIALO_OO; + if (!_MCIALO) + { + RTD_MCIALO_OO = RTD_TEX_COL; + } + else + { + RTD_MCIALO_OO = lerp(RTD_MC_SM_TC_OO, _MainTex_var.rgb * MCapOutP * _RTD_MVCOL * 0.7, clamp((RTD_LVLC * 1.0), 0.0, 1.0)); + } + //** + + + half3 RTD_MCIALO = RTD_MCIALO_OO; + + + //RT_GLO + half RTD_GLO; + half3 RTD_GLO_COL; + RT_GLO(uv, RTD_VD_Cal, halfDirection, bitangentWS, normalDirection, viewDirection, positionWS, RTD_GLO, RTD_GLO_COL); + half3 RTD_GLO_OTHERS = RTD_GLO; + //== + + + //RT_RL + half3 RTD_RL_LARL_OO; + half RTD_RL_MAIN; + half RTD_RL_CHE_1 = RT_RL(viewDirection, normalDirection, lightColor, RTD_RL_LARL_OO, RTD_RL_MAIN); + //== + + + //RT_CLD + float3 RTD_CLD = RT_CLD(lightDirection); + //== + + + //** + half3 RTD_ST_SS_AVD_OO; + if (!_SelfShadowShadowTAtViewDirection) + { + RTD_ST_SS_AVD_OO = RTD_CLD; + } + else + { + RTD_ST_SS_AVD_OO = viewDirection; + } + //** + + + half RTD_NDOTL = 0.5*dot(RTD_ST_SS_AVD_OO, float3(RTD_SON.x, RTD_SON.y * (1 - _LigIgnoYNorDir), RTD_SON.z))+0.5; + + + //RT_ST + half3 RTD_SHAT_COL; + half RTD_STIAL; + half RTD_ST_IS; + half3 RTD_ST_LAF; + half RTD_ST = RT_ST(uv, positionWS, normalDirection, RTD_NDOTL, lightfos, lightDirection, RTD_LVLC, RTD_PT_COL, lig_col_int, RTD_SCT, RTD_OSC, RTD_PT, RTD_SHAT_COL, RTD_STIAL, RTD_ST_IS, RTD_ST_LAF); + + //== + + + //RT_SS + half RTD_SS = RT_SS(vertexColor, RTD_NDOTL, attenuation, GetAdditionalLightShadowParams(lightIndex).x); + //== + + + half3 RTD_R_OFF_OTHERS = lerp(lerp(RTD_ST_LAF, RTD_LAS, RTD_ST_IS), lerp(RTD_ST_LAF, lerp(lerp(RTD_MCIALO_IL * RTD_HL, RTD_GLO_COL, RTD_GLO_OTHERS), RTD_RL_LARL_OO, RTD_RL_CHE_1) * lightColor.rgb, RTD_ST), RTD_SS); + + + //RT_R + half3 RTD_R = RT_R(uv, viewReflectDirection, viewDirection, normalDirection, RTD_TEX_COL, RTD_R_OFF_OTHERS, positionWS); + //== + + + //RT_SL + half3 RTD_SL_CHE_1; + half3 RTD_SL = RT_SL(uv, positionWS, normalDirection, (half3)0.0, RTD_TEX_COL, RTD_R, RTD_SL_CHE_1); + //== + + + //RT_RL_SUB1 + half3 RTD_RL = RT_RL_SUB1(RTD_SL_CHE_1, RTD_RL_LARL_OO, RTD_RL_MAIN); + //== + + + half3 RTD_CA_OFF_OTHERS = (RTD_RL + RTD_SL); + half3 add_light_output = RTD_CA_OFF_OTHERS * lightfos; + + return add_light_output; +} +// diff --git a/RealToon/RealToon/RealToon Shaders/RealToon Core/URP/RT_URP_Core.hlsl.meta b/RealToon/RealToon/RealToon Shaders/RealToon Core/URP/RT_URP_Core.hlsl.meta new file mode 100644 index 0000000..e787d33 --- /dev/null +++ b/RealToon/RealToon/RealToon Shaders/RealToon Core/URP/RT_URP_Core.hlsl.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 7314c2e030540e5409b59feea5b784ae +ShaderIncludeImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/RealToon/RealToon/RealToon Shaders/RealToon Core/URP/RT_URP_PROP.hlsl b/RealToon/RealToon/RealToon Shaders/RealToon Core/URP/RT_URP_PROP.hlsl new file mode 100644 index 0000000..5ee5fbb --- /dev/null +++ b/RealToon/RealToon/RealToon Shaders/RealToon Core/URP/RT_URP_PROP.hlsl @@ -0,0 +1,1034 @@ +//RealToon URP - RT_URP_PROP +//MJQStudioWorks + +#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + +//=============================================================================== +//CBUF +//=============================================================================== + +CBUFFER_START(UnityPerMaterial) + + //== Others + uniform float4 _MainTex_ST; + + uniform half4 _MainColor; + uniform half _MaiColPo; + uniform half _MVCOL; + uniform half _MCIALO; + uniform half _TexturePatternStyle; + uniform half4 _HighlightColor; + uniform half _HighlightColorPower; + //== + + + //== N_F_O_ON + uniform float4 _OutlineWidthControl_ST; + uniform half _OutlineWidth; + uniform int _OutlineExtrudeMethod; + uniform half3 _OutlineOffset; + uniform half _OutlineZPostionInCamera; + uniform half4 _OutlineColor; + uniform half _MixMainTexToOutline; + uniform half _NoisyOutlineIntensity; + uniform half _DynamicNoisyOutline; + uniform half _LightAffectOutlineColor; + uniform half _OutlineWidthAffectedByViewDistance; + uniform half _FarDistanceMaxWidth; + uniform half _VertexColorBlueAffectOutlineWitdh; + //== + + + //== N_F_O_SSOL + uniform float _DepthThreshold; + //== + + + //== N_F_MC_ON + uniform half _MCapIntensity; + + uniform float4 _MCap_ST; + + uniform half _SPECMODE; + uniform half _SPECIN; + + uniform float4 _MCapMask_ST; + //== + + + //== Transparency + uniform float4 _MaskTransparency_ST; + uniform half _Opacity; + uniform half _TransparentThreshold; + //== + + + //== N_F_CO_ON + uniform half _Cutout; + uniform half _AlphaBaseCutout; + uniform half _UseSecondaryCutout; + uniform half _AAS; + uniform half _Glow_Edge_Width; + uniform half4 _Glow_Color; + + uniform float4 _SecondaryCutout_ST; + //== + + + //== N_F_NM_ON + uniform float4 _NormalMap_ST; + + uniform half _NormalMapIntensity; + //== + + + //== N_F_CA_ON + uniform half _Saturation; + //== + + + //== N_F_SL_ON + uniform half _SelfLitIntensity; + uniform half4 _SelfLitColor; + uniform half _SelfLitPower; + uniform half _TEXMCOLINT; + uniform half _SelfLitHighContrast; + + uniform float4 _MaskSelfLit_ST; + //== + + + //== N_F_GLO_ON + uniform half _GlossIntensity; + uniform half _Glossiness; + uniform half _GlossSoftness; + uniform half4 _GlossColor; + uniform half _GlossColorPower; + + uniform float4 _MaskGloss_ST; + //== + + + //== N_F_GLO_ON -> N_F_GLOT_ON + uniform float4 _GlossTexture_ST; + + uniform half _GlossTextureSoftness; + uniform half _PSGLOTEX; + uniform half _GlossTextureRotate; + uniform half _GlossTextureFollowObjectRotation; + uniform half _NoisTexInten; + uniform half _StraWidt; + uniform half _NoiTexAffStraWidt; + uniform half _ShifAnis; + uniform half _GlossTextureFollowLight; + //== + + + //== Others + uniform half4 _OverallShadowColor; + uniform half _OverallShadowColorPower; + + uniform half _SelfShadowShadowTAtViewDirection; + + uniform half _ShadowHardness; + uniform half _SelfShadowRealtimeShadowIntensity; + //== + + + //== N_F_SS_ON + uniform half _SelfShadowThreshold; + uniform half _VertexColorGreenControlSelfShadowThreshold; + uniform half _SelfShadowHardness; + uniform half _LigIgnoYNorDir; + uniform half _SelfShadowAffectedByLightShadowStrength; + //== + + + //== N_F_SS_ON -> Transparency + uniform half _SelfShadowIntensity; + uniform half4 _SelfShadowColor; + uniform half _SelfShadowColorPower; + //== + + + //== Others + uniform half4 _SelfShadowRealTimeShadowColor; + uniform half _SelfShadowRealTimeShadowColorPower; + //== + + + //== N_F_SON_ON + uniform half _SmoothObjectNormal; + uniform half _VertexColorRedControlSmoothObjectNormal; + uniform float4 _XYZPosition; + uniform half _ShowNormal; + //== + + + //== N_F_SCT_ON + uniform float4 _ShadowColorTexture_ST; + + uniform half _ShadowColorTexturePower; + //== + + + //== N_F_ST_ON + uniform half _ShadowTIntensity; + + uniform float4 _ShadowT_ST; + + uniform half _ShadowTLightThreshold; + uniform half _ShadowTShadowThreshold; + uniform half4 _ShadowTColor; + uniform half _ShadowTColorPower; + uniform half _ShadowTHardness; + uniform half _STIL; + uniform half _ShowInAmbientLightShadowIntensity; + uniform half _ShowInAmbientLightShadowThreshold; + uniform half _LightFalloffAffectShadowT; + //== + + + //== N_F_PT_ON + uniform float4 _PTexture_ST; + uniform half4 _PTCol; + uniform half _PTexturePower; + //== + + + //== N_F_RELGI_ON + uniform half _GIFlatShade; + uniform half _GIShadeThreshold; + uniform half _EnvironmentalLightingIntensity; + //== + + + //== Others + uniform half _LightAffectShadow; + uniform half _LightIntensity; + uniform half _DirectionalLightIntensity; + uniform half _PointSpotlightIntensity; + uniform half _LightFalloffSoftness; + uniform half _LLI_Min; + uniform half _LLI_Max; + //== + + + //== N_F_CLD_ON + uniform half _CustomLightDirectionIntensity; + uniform half4 _CustomLightDirection; + uniform half _CustomLightDirectionFollowObjectRotation; + //== + + + //== N_F_R_ON + uniform half _ReflectionIntensity; + uniform half _Smoothness; + uniform half _RefMetallic; + + uniform float4 _MaskReflection_ST; + //== + + + //== N_F_FR_ON + float4 _FReflection_ST; + //== + + + //== N_F_RL_ON + uniform half _RimLigInt; + uniform half _RimLightUnfill; + uniform half _RimLightSoftness; + uniform half _LightAffectRimLightColor; + uniform half4 _RimLightColor; + uniform half _RimLightColorPower; + uniform half _RimLightInLight; + //== + + + //== N_F_NFD_ON + uniform half _MinFadDistance; + uniform half _MaxFadDistance; + //== + + + //== N_F_TP_ON + uniform float _TriPlaTile; + uniform float _TriPlaBlend; + //== + + + //== N_F_PA_ON + uniform half _PresAdju; + uniform half _ClipAdju; + uniform float _PASize; + uniform float _PASmooTrans; + uniform float _PADist; + //== + + + //== N_F_SE_ON + uniform float _NoiseSize; + uniform float _TrailSize; + + //== + + + //== Others + uniform half4 _SSAOColor; + + uniform half _ReduSha; + uniform sampler3D _DitherMaskLOD; + + float _SkinMatrixIndex; + float _ComputeMeshIndex; + float4 _PrevPosition; + float4 _ObjPosi; + float3 _ObjectForward; + float3 _ObjectRight; + //== + +CBUFFER_END + +//=============================================================================== +//DOTS Instancing +//=============================================================================== +#ifdef UNITY_DOTS_INSTANCING_ENABLED + +UNITY_DOTS_INSTANCING_START(MaterialPropertyMetadata) + + UNITY_DOTS_INSTANCED_PROP(float4, _MainColor) + UNITY_DOTS_INSTANCED_PROP(float, _MaiColPo) + UNITY_DOTS_INSTANCED_PROP(float, _MVCOL) + UNITY_DOTS_INSTANCED_PROP(float, _MCIALO) + UNITY_DOTS_INSTANCED_PROP(float, _TexturePatternStyle) + UNITY_DOTS_INSTANCED_PROP(float4, _HighlightColor) + UNITY_DOTS_INSTANCED_PROP(float, _HighlightColorPower) + + UNITY_DOTS_INSTANCED_PROP(float, _OutlineWidth) + UNITY_DOTS_INSTANCED_PROP(int, _OutlineExtrudeMethod) + UNITY_DOTS_INSTANCED_PROP(float3, _OutlineOffset) + UNITY_DOTS_INSTANCED_PROP(float, _OutlineZPostionInCamera) + UNITY_DOTS_INSTANCED_PROP(float4, _OutlineColor) + UNITY_DOTS_INSTANCED_PROP(float, _MixMainTexToOutline) + UNITY_DOTS_INSTANCED_PROP(float, _NoisyOutlineIntensity) + UNITY_DOTS_INSTANCED_PROP(float, _DynamicNoisyOutline) + UNITY_DOTS_INSTANCED_PROP(float, _LightAffectOutlineColor) + UNITY_DOTS_INSTANCED_PROP(float, _OutlineWidthAffectedByViewDistance) + UNITY_DOTS_INSTANCED_PROP(float, _FarDistanceMaxWidth) + UNITY_DOTS_INSTANCED_PROP(float, _VertexColorBlueAffectOutlineWitdh) + + UNITY_DOTS_INSTANCED_PROP(float, _DepthThreshold) + + UNITY_DOTS_INSTANCED_PROP(float, _MCapIntensity) + UNITY_DOTS_INSTANCED_PROP(float, _SPECMODE) + UNITY_DOTS_INSTANCED_PROP(float, _SPECIN) + + UNITY_DOTS_INSTANCED_PROP(float, _Opacity) + UNITY_DOTS_INSTANCED_PROP(float, _TransparentThreshold) + + UNITY_DOTS_INSTANCED_PROP(float, _Cutout) + UNITY_DOTS_INSTANCED_PROP(float, _AlphaBaseCutout) + UNITY_DOTS_INSTANCED_PROP(float, _UseSecondaryCutout) + + UNITY_DOTS_INSTANCED_PROP(float, _AAS) + + UNITY_DOTS_INSTANCED_PROP(float4, _Glow_Color) + UNITY_DOTS_INSTANCED_PROP(float, _Glow_Edge_Width) + + UNITY_DOTS_INSTANCED_PROP(float, _NormalMapIntensity) + + UNITY_DOTS_INSTANCED_PROP(float, _Saturation) + + UNITY_DOTS_INSTANCED_PROP(float, _SelfLitIntensity) + UNITY_DOTS_INSTANCED_PROP(float4, _SelfLitColor) + UNITY_DOTS_INSTANCED_PROP(float, _SelfLitPower) + UNITY_DOTS_INSTANCED_PROP(float, _TEXMCOLINT) + UNITY_DOTS_INSTANCED_PROP(float, _SelfLitHighContrast) + + UNITY_DOTS_INSTANCED_PROP(float, _GlossIntensity) + UNITY_DOTS_INSTANCED_PROP(float, _Glossiness) + UNITY_DOTS_INSTANCED_PROP(float, _GlossSoftness) + UNITY_DOTS_INSTANCED_PROP(float4, _GlossColor) + UNITY_DOTS_INSTANCED_PROP(float, _GlossColorPower) + + UNITY_DOTS_INSTANCED_PROP(float, _GlossTextureSoftness) + UNITY_DOTS_INSTANCED_PROP(float, _PSGLOTEX) + UNITY_DOTS_INSTANCED_PROP(float, _GlossTextureRotate) + UNITY_DOTS_INSTANCED_PROP(float, _GlossTextureFollowObjectRotation) + UNITY_DOTS_INSTANCED_PROP(float, _NoisTexInten) + UNITY_DOTS_INSTANCED_PROP(float, _StraWidt) + UNITY_DOTS_INSTANCED_PROP(float, _NoiTexAffStraWidt) + UNITY_DOTS_INSTANCED_PROP(float, _ShifAnis) + UNITY_DOTS_INSTANCED_PROP(float, _GlossTextureFollowLight) + + UNITY_DOTS_INSTANCED_PROP(float4, _OverallShadowColor) + UNITY_DOTS_INSTANCED_PROP(float, _OverallShadowColorPower) + UNITY_DOTS_INSTANCED_PROP(float, _SelfShadowShadowTAtViewDirection) + UNITY_DOTS_INSTANCED_PROP(float, _ShadowHardness) + UNITY_DOTS_INSTANCED_PROP(float, _SelfShadowRealtimeShadowIntensity) + + UNITY_DOTS_INSTANCED_PROP(float, _SelfShadowThreshold) + UNITY_DOTS_INSTANCED_PROP(float, _VertexColorGreenControlSelfShadowThreshold) + UNITY_DOTS_INSTANCED_PROP(float, _SelfShadowHardness) + UNITY_DOTS_INSTANCED_PROP(float, _LigIgnoYNorDir) + UNITY_DOTS_INSTANCED_PROP(float, _SelfShadowAffectedByLightShadowStrength) + + UNITY_DOTS_INSTANCED_PROP(float, _SelfShadowIntensity) + UNITY_DOTS_INSTANCED_PROP(float4, _SelfShadowColor) + UNITY_DOTS_INSTANCED_PROP(float, _SelfShadowColorPower) + + UNITY_DOTS_INSTANCED_PROP(float4, _SelfShadowRealTimeShadowColor) + UNITY_DOTS_INSTANCED_PROP(float, _SelfShadowRealTimeShadowColorPower) + + UNITY_DOTS_INSTANCED_PROP(float, _SmoothObjectNormal) + UNITY_DOTS_INSTANCED_PROP(float, _VertexColorRedControlSmoothObjectNormal) + UNITY_DOTS_INSTANCED_PROP(float4, _XYZPosition) + UNITY_DOTS_INSTANCED_PROP(float, _ShowNormal) + + UNITY_DOTS_INSTANCED_PROP(float, _ShadowColorTexturePower) + + UNITY_DOTS_INSTANCED_PROP(float, _ShadowTIntensity) + UNITY_DOTS_INSTANCED_PROP(float, _ShadowTLightThreshold) + UNITY_DOTS_INSTANCED_PROP(float, _ShadowTShadowThreshold) + UNITY_DOTS_INSTANCED_PROP(float4, _ShadowTColor) + UNITY_DOTS_INSTANCED_PROP(float, _ShadowTColorPower) + UNITY_DOTS_INSTANCED_PROP(float, _ShadowTHardness) + UNITY_DOTS_INSTANCED_PROP(float, _STIL) + UNITY_DOTS_INSTANCED_PROP(float, _ShowInAmbientLightShadowIntensity) + UNITY_DOTS_INSTANCED_PROP(float, _ShowInAmbientLightShadowThreshold) + UNITY_DOTS_INSTANCED_PROP(float, _LightFalloffAffectShadowT) + + UNITY_DOTS_INSTANCED_PROP(float4, _PTCol) + UNITY_DOTS_INSTANCED_PROP(float, _PTexturePower) + + UNITY_DOTS_INSTANCED_PROP(float, _GIFlatShade) + UNITY_DOTS_INSTANCED_PROP(float, _GIShadeThreshold) + UNITY_DOTS_INSTANCED_PROP(float, _EnvironmentalLightingIntensity) + + UNITY_DOTS_INSTANCED_PROP(float, _LightAffectShadow) + UNITY_DOTS_INSTANCED_PROP(float, _LightIntensity) + UNITY_DOTS_INSTANCED_PROP(float, _DirectionalLightIntensity) + UNITY_DOTS_INSTANCED_PROP(float, _PointSpotlightIntensity) + UNITY_DOTS_INSTANCED_PROP(float, _LightFalloffSoftness) + UNITY_DOTS_INSTANCED_PROP(float, _LLI_Min) + UNITY_DOTS_INSTANCED_PROP(float, _LLI_Max) + + UNITY_DOTS_INSTANCED_PROP(float, _CustomLightDirectionIntensity) + UNITY_DOTS_INSTANCED_PROP(float4, _CustomLightDirection) + UNITY_DOTS_INSTANCED_PROP(float, _CustomLightDirectionFollowObjectRotation) + + UNITY_DOTS_INSTANCED_PROP(float, _ReflectionIntensity) + UNITY_DOTS_INSTANCED_PROP(float, _Smoothness) + UNITY_DOTS_INSTANCED_PROP(float, _RefMetallic) + + UNITY_DOTS_INSTANCED_PROP(float, _RimLigInt) + UNITY_DOTS_INSTANCED_PROP(float, _RimLightUnfill) + UNITY_DOTS_INSTANCED_PROP(float, _RimLightSoftness) + UNITY_DOTS_INSTANCED_PROP(float, _LightAffectRimLightColor) + UNITY_DOTS_INSTANCED_PROP(float4, _RimLightColor) + UNITY_DOTS_INSTANCED_PROP(float, _RimLightColorPower) + UNITY_DOTS_INSTANCED_PROP(float, _RimLightInLight) + + UNITY_DOTS_INSTANCED_PROP(float, _MinFadDistance) + UNITY_DOTS_INSTANCED_PROP(float, _MaxFadDistance) + + UNITY_DOTS_INSTANCED_PROP(float, _TriPlaTile) + UNITY_DOTS_INSTANCED_PROP(float, _TriPlaBlend) + + UNITY_DOTS_INSTANCED_PROP(float, _PresAdju) + UNITY_DOTS_INSTANCED_PROP(float, _ClipAdju) + UNITY_DOTS_INSTANCED_PROP(float, _PASize) + UNITY_DOTS_INSTANCED_PROP(float, _PASmooTrans) + UNITY_DOTS_INSTANCED_PROP(float, _PADist) + + UNITY_DOTS_INSTANCED_PROP(float4, _PrevPosition) + UNITY_DOTS_INSTANCED_PROP(float4, _ObjPosi) + UNITY_DOTS_INSTANCED_PROP(float, _NoiseSize) + UNITY_DOTS_INSTANCED_PROP(float, _TrailSize) + + UNITY_DOTS_INSTANCED_PROP(float3, _ObjectForward); + UNITY_DOTS_INSTANCED_PROP(float3, _ObjectRight); + + UNITY_DOTS_INSTANCED_PROP(float4, _SSAOColor) + + UNITY_DOTS_INSTANCED_PROP_OVERRIDE_SUPPORTED(float, _SkinMatrixIndex) + UNITY_DOTS_INSTANCED_PROP_OVERRIDE_SUPPORTED(float, _ComputeMeshIndex) + +UNITY_DOTS_INSTANCING_END(MaterialPropertyMetadata) + + + +static float4 unity_DOTS_Sampled_MainColor; +static float unity_DOTS_Sampled_MaiColPo; +static float unity_DOTS_Sampled_MVCOL; +static float unity_DOTS_Sampled_MCIALO; +static float unity_DOTS_Sampled_TexturePatternStyle; +static float4 unity_DOTS_Sampled_HighlightColor; +static float unity_DOTS_Sampled_HighlightColorPower; + +static float unity_DOTS_Sampled_OutlineWidth; +static int unity_DOTS_Sampled_OutlineExtrudeMethod; +static float3 unity_DOTS_Sampled_OutlineOffset; +static float unity_DOTS_Sampled_OutlineZPostionInCamera; +static float4 unity_DOTS_Sampled_OutlineColor; +static float unity_DOTS_Sampled_MixMainTexToOutline; +static float unity_DOTS_Sampled_NoisyOutlineIntensity; +static float unity_DOTS_Sampled_DynamicNoisyOutline; +static float unity_DOTS_Sampled_LightAffectOutlineColor; +static float unity_DOTS_Sampled_OutlineWidthAffectedByViewDistance; +static float unity_DOTS_Sampled_FarDistanceMaxWidth; +static float unity_DOTS_Sampled_VertexColorBlueAffectOutlineWitdh; + +static float unity_DOTS_Sampled_DepthThreshold; + +static float unity_DOTS_Sampled_MCapIntensity; +static float unity_DOTS_Sampled_SPECMODE; +static float unity_DOTS_Sampled_SPECIN; + +static float unity_DOTS_Sampled_Opacity; +static float unity_DOTS_Sampled_TransparentThreshold; + +static float unity_DOTS_Sampled_Cutout; +static float unity_DOTS_Sampled_AlphaBaseCutout; +static float unity_DOTS_Sampled_UseSecondaryCutout; + +static float unity_DOTS_Sampled_AAS; + +static float4 unity_DOTS_Sampled_Glow_Color; +static float unity_DOTS_Sampled_Glow_Edge_Width; + +static float unity_DOTS_Sampled_NormalMapIntensity; + +static float unity_DOTS_Sampled_Saturation; + +static float unity_DOTS_Sampled_SelfLitIntensity; +static float4 unity_DOTS_Sampled_SelfLitColor; +static float unity_DOTS_Sampled_SelfLitPower; +static float unity_DOTS_Sampled_TEXMCOLINT; +static float unity_DOTS_Sampled_SelfLitHighContrast; + +static float unity_DOTS_Sampled_GlossIntensity; +static float unity_DOTS_Sampled_Glossiness; +static float unity_DOTS_Sampled_GlossSoftness; +static float4 unity_DOTS_Sampled_GlossColor; +static float unity_DOTS_Sampled_GlossColorPower; + +static float unity_DOTS_Sampled_GlossTextureSoftness; +static float unity_DOTS_Sampled_PSGLOTEX; +static float unity_DOTS_Sampled_GlossTextureRotate; +static float unity_DOTS_Sampled_GlossTextureFollowObjectRotation; +static float unity_DOTS_Sampled_NoisTexInten; +static float unity_DOTS_Sampled_StraWidt; +static float unity_DOTS_Sampled_NoiTexAffStraWidt; +static float unity_DOTS_Sampled_ShifAnis; +static float unity_DOTS_Sampled_GlossTextureFollowLight; + +static float4 unity_DOTS_Sampled_OverallShadowColor; +static float unity_DOTS_Sampled_OverallShadowColorPower; +static float unity_DOTS_Sampled_SelfShadowShadowTAtViewDirection; +static float unity_DOTS_Sampled_ShadowHardness; +static float unity_DOTS_Sampled_SelfShadowRealtimeShadowIntensity; + +static float unity_DOTS_Sampled_SelfShadowThreshold; +static float unity_DOTS_Sampled_VertexColorGreenControlSelfShadowThreshold; +static float unity_DOTS_Sampled_SelfShadowHardness; +static float unity_DOTS_Sampled_LigIgnoYNorDir; +static float unity_DOTS_Sampled_SelfShadowAffectedByLightShadowStrength; + +static float unity_DOTS_Sampled_SelfShadowIntensity; +static float4 unity_DOTS_Sampled_SelfShadowColor; +static float unity_DOTS_Sampled_SelfShadowColorPower; + +static float4 unity_DOTS_Sampled_SelfShadowRealTimeShadowColor; +static float unity_DOTS_Sampled_SelfShadowRealTimeShadowColorPower; + +static float unity_DOTS_Sampled_SmoothObjectNormal; +static float unity_DOTS_Sampled_VertexColorRedControlSmoothObjectNormal; +static float4 unity_DOTS_Sampled_XYZPosition; +static float unity_DOTS_Sampled_ShowNormal; + +static float unity_DOTS_Sampled_ShadowColorTexturePower; + +static float unity_DOTS_Sampled_ShadowTIntensity; +static float unity_DOTS_Sampled_ShadowTLightThreshold; +static float unity_DOTS_Sampled_ShadowTShadowThreshold; +static float4 unity_DOTS_Sampled_ShadowTColor; +static float unity_DOTS_Sampled_ShadowTColorPower; +static float unity_DOTS_Sampled_ShadowTHardness; +static float unity_DOTS_Sampled_STIL; +static float unity_DOTS_Sampled_ShowInAmbientLightShadowIntensity; +static float unity_DOTS_Sampled_ShowInAmbientLightShadowThreshold; +static float unity_DOTS_Sampled_LightFalloffAffectShadowT; + +static float4 unity_DOTS_Sampled_PTCol; +static float unity_DOTS_Sampled_PTexturePower; + +static float unity_DOTS_Sampled_GIFlatShade; +static float unity_DOTS_Sampled_GIShadeThreshold; +static float unity_DOTS_Sampled_EnvironmentalLightingIntensity; + +static float unity_DOTS_Sampled_LightAffectShadow; +static float unity_DOTS_Sampled_LightIntensity; +static float unity_DOTS_Sampled_DirectionalLightIntensity; +static float unity_DOTS_Sampled_PointSpotlightIntensity; +static float unity_DOTS_Sampled_LightFalloffSoftness; +static float unity_DOTS_Sampled_LLI_Min; +static float unity_DOTS_Sampled_LLI_Max; + +static float unity_DOTS_Sampled_CustomLightDirectionIntensity; +static float4 unity_DOTS_Sampled_CustomLightDirection; +static float unity_DOTS_Sampled_CustomLightDirectionFollowObjectRotation; + +static float unity_DOTS_Sampled_ReflectionIntensity; +static float unity_DOTS_Sampled_Smoothness; +static float unity_DOTS_Sampled_RefMetallic; + +static float unity_DOTS_Sampled_RimLigInt; +static float unity_DOTS_Sampled_RimLightUnfill; +static float unity_DOTS_Sampled_RimLightSoftness; +static float unity_DOTS_Sampled_LightAffectRimLightColor; +static float4 unity_DOTS_Sampled_RimLightColor; +static float unity_DOTS_Sampled_RimLightColorPower; +static float unity_DOTS_Sampled_RimLightInLight; + +static float unity_DOTS_Sampled_MinFadDistance; +static float unity_DOTS_Sampled_MaxFadDistance; + +static float unity_DOTS_Sampled_TriPlaTile; +static float unity_DOTS_Sampled_TriPlaBlend; + +static float unity_DOTS_Sampled_PresAdju; +static float unity_DOTS_Sampled_ClipAdju; +static float unity_DOTS_Sampled_PASize; +static float unity_DOTS_Sampled_PASmooTrans; +static float unity_DOTS_Sampled_PADist; + +static float4 unity_DOTS_Sampled_PrevPosition; +static float4 unity_DOTS_Sampled_ObjPosi; +static float unity_DOTS_Sampled_NoiseSize; +static float unity_DOTS_Sampled_TrailSize; + +static float3 unity_DOTS_Sampled_ObjectForward; +static float3 unity_DOTS_Sampled_ObjectRight; + +static float4 unity_DOTS_Sampled_SSAOColor; + + + +void SetupDOTSLitMaterialPropertyCaches() +{ + unity_DOTS_Sampled_MainColor = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float4, _MainColor); + unity_DOTS_Sampled_MaiColPo = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _MaiColPo); + unity_DOTS_Sampled_MVCOL = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _MVCOL); + unity_DOTS_Sampled_MCIALO = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _MCIALO); + unity_DOTS_Sampled_TexturePatternStyle = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _TexturePatternStyle); + unity_DOTS_Sampled_HighlightColor = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float4, _HighlightColor); + unity_DOTS_Sampled_HighlightColorPower = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _HighlightColorPower); + + unity_DOTS_Sampled_OutlineWidth = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _OutlineWidth); + unity_DOTS_Sampled_OutlineExtrudeMethod = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(int, _OutlineExtrudeMethod); + unity_DOTS_Sampled_OutlineOffset = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float3, _OutlineOffset); + unity_DOTS_Sampled_OutlineZPostionInCamera = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _OutlineZPostionInCamera); + unity_DOTS_Sampled_OutlineColor = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float4, _OutlineColor); + unity_DOTS_Sampled_MixMainTexToOutline = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _MixMainTexToOutline); + unity_DOTS_Sampled_NoisyOutlineIntensity = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _NoisyOutlineIntensity); + unity_DOTS_Sampled_DynamicNoisyOutline = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _DynamicNoisyOutline); + unity_DOTS_Sampled_LightAffectOutlineColor = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _LightAffectOutlineColor); + unity_DOTS_Sampled_OutlineWidthAffectedByViewDistance = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _OutlineWidthAffectedByViewDistance); + unity_DOTS_Sampled_FarDistanceMaxWidth = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _FarDistanceMaxWidth); + unity_DOTS_Sampled_VertexColorBlueAffectOutlineWitdh = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _VertexColorBlueAffectOutlineWitdh); + + unity_DOTS_Sampled_DepthThreshold = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _DepthThreshold); + + unity_DOTS_Sampled_MCapIntensity = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _MCapIntensity); + unity_DOTS_Sampled_SPECMODE = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _SPECMODE); + unity_DOTS_Sampled_SPECIN = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _SPECIN); + + unity_DOTS_Sampled_Opacity = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _Opacity); + unity_DOTS_Sampled_TransparentThreshold = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _TransparentThreshold); + + unity_DOTS_Sampled_Cutout = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _Cutout); + unity_DOTS_Sampled_AlphaBaseCutout = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _AlphaBaseCutout); + unity_DOTS_Sampled_UseSecondaryCutout = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _UseSecondaryCutout); + + unity_DOTS_Sampled_AAS = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _AAS); + + unity_DOTS_Sampled_Glow_Color = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float4, _Glow_Color); + unity_DOTS_Sampled_Glow_Edge_Width = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _Glow_Edge_Width); + + unity_DOTS_Sampled_NormalMapIntensity = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _NormalMapIntensity); + + unity_DOTS_Sampled_Saturation = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _Saturation); + + unity_DOTS_Sampled_SelfLitIntensity = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _SelfLitIntensity); + unity_DOTS_Sampled_SelfLitColor = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float4, _SelfLitColor); + unity_DOTS_Sampled_SelfLitPower = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _SelfLitPower); + unity_DOTS_Sampled_TEXMCOLINT = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _TEXMCOLINT); + unity_DOTS_Sampled_SelfLitHighContrast = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _SelfLitHighContrast); + + unity_DOTS_Sampled_GlossIntensity = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _GlossIntensity); + unity_DOTS_Sampled_Glossiness = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _Glossiness); + unity_DOTS_Sampled_GlossSoftness = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _GlossSoftness); + unity_DOTS_Sampled_GlossColor = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float4, _GlossColor); + unity_DOTS_Sampled_GlossColorPower = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _GlossColorPower); + + unity_DOTS_Sampled_GlossTextureSoftness = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _GlossTextureSoftness); + unity_DOTS_Sampled_PSGLOTEX = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _PSGLOTEX); + unity_DOTS_Sampled_GlossTextureRotate = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _GlossTextureRotate); + unity_DOTS_Sampled_GlossTextureFollowObjectRotation = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _GlossTextureFollowObjectRotation); + unity_DOTS_Sampled_NoisTexInten = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _NoisTexInten); + unity_DOTS_Sampled_StraWidt = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _StraWidt); + unity_DOTS_Sampled_NoiTexAffStraWidt = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _NoiTexAffStraWidt); + unity_DOTS_Sampled_ShifAnis = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _ShifAnis); + unity_DOTS_Sampled_GlossTextureFollowLight = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _GlossTextureFollowLight); + + unity_DOTS_Sampled_OverallShadowColor = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float4, _OverallShadowColor); + unity_DOTS_Sampled_OverallShadowColorPower = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _OverallShadowColorPower); + unity_DOTS_Sampled_SelfShadowShadowTAtViewDirection = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _SelfShadowShadowTAtViewDirection); + unity_DOTS_Sampled_ShadowHardness = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _ShadowHardness); + unity_DOTS_Sampled_SelfShadowRealtimeShadowIntensity = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _SelfShadowRealtimeShadowIntensity); + + unity_DOTS_Sampled_SelfShadowThreshold = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _SelfShadowThreshold); + unity_DOTS_Sampled_VertexColorGreenControlSelfShadowThreshold = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _VertexColorGreenControlSelfShadowThreshold); + unity_DOTS_Sampled_SelfShadowHardness = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _SelfShadowHardness); + unity_DOTS_Sampled_LigIgnoYNorDir = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _LigIgnoYNorDir); + unity_DOTS_Sampled_SelfShadowAffectedByLightShadowStrength = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _SelfShadowAffectedByLightShadowStrength); + + unity_DOTS_Sampled_SelfShadowIntensity = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _SelfShadowIntensity); + unity_DOTS_Sampled_SelfShadowColor = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float4, _SelfShadowColor); + unity_DOTS_Sampled_SelfShadowColorPower = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _SelfShadowColorPower); + + unity_DOTS_Sampled_SelfShadowRealTimeShadowColor = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float4, _SelfShadowRealTimeShadowColor); + unity_DOTS_Sampled_SelfShadowRealTimeShadowColorPower = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _SelfShadowRealTimeShadowColorPower); + + unity_DOTS_Sampled_SmoothObjectNormal = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _SmoothObjectNormal); + unity_DOTS_Sampled_VertexColorRedControlSmoothObjectNormal = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _VertexColorRedControlSmoothObjectNormal); + unity_DOTS_Sampled_XYZPosition = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float4, _XYZPosition); + unity_DOTS_Sampled_ShowNormal = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _ShowNormal); + + unity_DOTS_Sampled_ShadowColorTexturePower = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _ShadowColorTexturePower); + + unity_DOTS_Sampled_ShadowTIntensity = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _ShadowTIntensity); + unity_DOTS_Sampled_ShadowTLightThreshold = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _ShadowTLightThreshold); + unity_DOTS_Sampled_ShadowTShadowThreshold = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _ShadowTShadowThreshold); + unity_DOTS_Sampled_ShadowTColor = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float4, _ShadowTColor); + unity_DOTS_Sampled_ShadowTColorPower = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _ShadowTColorPower); + unity_DOTS_Sampled_ShadowTHardness = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _ShadowTHardness); + unity_DOTS_Sampled_STIL = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _STIL); + unity_DOTS_Sampled_ShowInAmbientLightShadowIntensity = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _ShowInAmbientLightShadowIntensity); + unity_DOTS_Sampled_ShowInAmbientLightShadowThreshold = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _ShowInAmbientLightShadowThreshold); + unity_DOTS_Sampled_LightFalloffAffectShadowT = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _LightFalloffAffectShadowT); + + unity_DOTS_Sampled_PTCol = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float4, _PTCol); + unity_DOTS_Sampled_PTexturePower = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _PTexturePower); + + unity_DOTS_Sampled_GIFlatShade = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _GIFlatShade); + unity_DOTS_Sampled_GIShadeThreshold = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _GIShadeThreshold); + unity_DOTS_Sampled_EnvironmentalLightingIntensity = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _EnvironmentalLightingIntensity); + + unity_DOTS_Sampled_LightAffectShadow = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _LightAffectShadow); + unity_DOTS_Sampled_LightIntensity = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _LightIntensity); + unity_DOTS_Sampled_DirectionalLightIntensity = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _DirectionalLightIntensity); + unity_DOTS_Sampled_PointSpotlightIntensity = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _PointSpotlightIntensity); + unity_DOTS_Sampled_LightFalloffSoftness = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _LightFalloffSoftness); + unity_DOTS_Sampled_LLI_Min = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _LLI_Min); + unity_DOTS_Sampled_LLI_Max = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _LLI_Max); + + unity_DOTS_Sampled_CustomLightDirectionIntensity = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _CustomLightDirectionIntensity); + unity_DOTS_Sampled_CustomLightDirection = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float4, _CustomLightDirection); + unity_DOTS_Sampled_CustomLightDirectionFollowObjectRotation = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _CustomLightDirectionFollowObjectRotation); + + unity_DOTS_Sampled_ReflectionIntensity = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _ReflectionIntensity); + unity_DOTS_Sampled_Smoothness = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _Smoothness); + unity_DOTS_Sampled_RefMetallic = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _RefMetallic); + + unity_DOTS_Sampled_RimLigInt = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _RimLigInt); + unity_DOTS_Sampled_RimLightUnfill = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _RimLightUnfill); + unity_DOTS_Sampled_RimLightSoftness = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _RimLightSoftness); + unity_DOTS_Sampled_LightAffectRimLightColor = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _LightAffectRimLightColor); + unity_DOTS_Sampled_RimLightColor = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float4, _RimLightColor); + unity_DOTS_Sampled_RimLightColorPower = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _RimLightColorPower); + unity_DOTS_Sampled_RimLightInLight = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _RimLightInLight); + + unity_DOTS_Sampled_MinFadDistance = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _MinFadDistance); + unity_DOTS_Sampled_MaxFadDistance = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _MaxFadDistance); + + unity_DOTS_Sampled_MinFadDistance = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _MinFadDistance); + unity_DOTS_Sampled_MaxFadDistance = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _MaxFadDistance); + + unity_DOTS_Sampled_TriPlaTile = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _TriPlaTile); + unity_DOTS_Sampled_TriPlaBlend = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _TriPlaBlend); + + unity_DOTS_Sampled_PresAdju = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _PresAdju); + unity_DOTS_Sampled_ClipAdju = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _ClipAdju); + unity_DOTS_Sampled_PASize = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _PASize); + unity_DOTS_Sampled_PASmooTrans = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _PASmooTrans); + unity_DOTS_Sampled_PADist = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _PADist); + + unity_DOTS_Sampled_PrevPosition = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float4, _PrevPosition); + unity_DOTS_Sampled_ObjPosi = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float4, _ObjPosi); + unity_DOTS_Sampled_NoiseSize = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _NoiseSize); + unity_DOTS_Sampled_TrailSize = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float, _TrailSize); + + unity_DOTS_Sampled_ObjectForward = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float3, _ObjectForward); + unity_DOTS_Sampled_ObjectRight = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float3, _ObjectRight); + + unity_DOTS_Sampled_SSAOColor = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float4, _SSAOColor); + +} + + + +#undef UNITY_SETUP_DOTS_MATERIAL_PROPERTY_CACHES +#define UNITY_SETUP_DOTS_MATERIAL_PROPERTY_CACHES() SetupDOTSLitMaterialPropertyCaches() + +#define _MainColor unity_DOTS_Sampled_MainColor +#define _MaiColPo unity_DOTS_Sampled_MaiColPo +#define _MVCOL unity_DOTS_Sampled_MVCOL +#define _MCIALO unity_DOTS_Sampled_MCIALO +#define _TexturePatternStyle unity_DOTS_Sampled_TexturePatternStyle +#define _HighlightColor unity_DOTS_Sampled_HighlightColor +#define _HighlightColorPower unity_DOTS_Sampled_HighlightColorPower + +#define _OutlineWidth unity_DOTS_Sampled_OutlineWidth +#define _OutlineExtrudeMethod unity_DOTS_Sampled_OutlineExtrudeMethod +#define _OutlineOffset unity_DOTS_Sampled_OutlineOffset +#define _OutlineZPostionInCamera unity_DOTS_Sampled_OutlineZPostionInCamera +#define _OutlineColor unity_DOTS_Sampled_OutlineColor +#define _MixMainTexToOutline unity_DOTS_Sampled_MixMainTexToOutline +#define _NoisyOutlineIntensity unity_DOTS_Sampled_NoisyOutlineIntensity +#define _DynamicNoisyOutline unity_DOTS_Sampled_DynamicNoisyOutline +#define _LightAffectOutlineColor unity_DOTS_Sampled_LightAffectOutlineColor +#define _OutlineWidthAffectedByViewDistance unity_DOTS_Sampled_OutlineWidthAffectedByViewDistance +#define _FarDistanceMaxWidth unity_DOTS_Sampled_FarDistanceMaxWidth +#define _VertexColorBlueAffectOutlineWitdh unity_DOTS_Sampled_VertexColorBlueAffectOutlineWitdh + +#define _DepthThreshold unity_DOTS_Sampled_DepthThreshold + +#define _MCapIntensity unity_DOTS_Sampled_MCapIntensity +#define _SPECMODE unity_DOTS_Sampled_SPECMODE +#define _SPECIN unity_DOTS_Sampled_SPECIN + +#define _Opacity unity_DOTS_Sampled_Opacity +#define _TransparentThreshold unity_DOTS_Sampled_TransparentThreshold + +#define _Cutout unity_DOTS_Sampled_Cutout +#define _AlphaBaseCutout unity_DOTS_Sampled_AlphaBaseCutout +#define _UseSecondaryCutout unity_DOTS_Sampled_UseSecondaryCutout + +#define _AAS unity_DOTS_Sampled_AAS + +#define _Glow_Color unity_DOTS_Sampled_Glow_Color +#define _Glow_Edge_Width unity_DOTS_Sampled_Glow_Edge_Width + +#define _NormalMapIntensity unity_DOTS_Sampled_NormalMapIntensity + +#define _Saturation unity_DOTS_Sampled_Saturation + +#define _SelfLitIntensity unity_DOTS_Sampled_SelfLitIntensity +#define _SelfLitColor unity_DOTS_Sampled_SelfLitColor +#define _SelfLitPower unity_DOTS_Sampled_SelfLitPower +#define _TEXMCOLINT unity_DOTS_Sampled_TEXMCOLINT +#define _SelfLitHighContrast unity_DOTS_Sampled_SelfLitHighContrast + +#define _GlossIntensity unity_DOTS_Sampled_GlossIntensity +#define _Glossiness unity_DOTS_Sampled_Glossiness +#define _GlossSoftness unity_DOTS_Sampled_GlossSoftness +#define _GlossColor unity_DOTS_Sampled_GlossColor +#define _GlossColorPower unity_DOTS_Sampled_GlossColorPower + +#define _GlossTextureSoftness unity_DOTS_Sampled_GlossTextureSoftness +#define _PSGLOTEX unity_DOTS_Sampled_PSGLOTEX +#define _GlossTextureRotate unity_DOTS_Sampled_GlossTextureRotate +#define _GlossTextureFollowObjectRotation unity_DOTS_Sampled_GlossTextureFollowObjectRotation +#define _NoisTexInten unity_DOTS_Sampled_NoisTexInten +#define _StraWidt unity_DOTS_Sampled_StraWidt +#define _NoiTexAffStraWidt unity_DOTS_Sampled_NoiTexAffStraWidt +#define _ShifAnis unity_DOTS_Sampled_ShifAnis +#define _GlossTextureFollowLight unity_DOTS_Sampled_GlossTextureFollowLight + +#define _OverallShadowColor unity_DOTS_Sampled_OverallShadowColor +#define _OverallShadowColorPower unity_DOTS_Sampled_OverallShadowColorPower +#define _SelfShadowShadowTAtViewDirection unity_DOTS_Sampled_SelfShadowShadowTAtViewDirection +#define _ShadowHardness unity_DOTS_Sampled_ShadowHardness +#define _SelfShadowRealtimeShadowIntensity unity_DOTS_Sampled_SelfShadowRealtimeShadowIntensity + +#define _SelfShadowThreshold unity_DOTS_Sampled_SelfShadowThreshold +#define _VertexColorGreenControlSelfShadowThreshold unity_DOTS_Sampled_VertexColorGreenControlSelfShadowThreshold +#define _SelfShadowHardness unity_DOTS_Sampled_SelfShadowHardness +#define _LigIgnoYNorDir unity_DOTS_Sampled_LigIgnoYNorDir +#define _SelfShadowAffectedByLightShadowStrength unity_DOTS_Sampled_SelfShadowAffectedByLightShadowStrength + +#define _SelfShadowIntensity unity_DOTS_Sampled_SelfShadowIntensity +#define _SelfShadowColor unity_DOTS_Sampled_SelfShadowColor +#define _SelfShadowColorPower unity_DOTS_Sampled_SelfShadowColorPower + +#define _SelfShadowRealTimeShadowColor unity_DOTS_Sampled_SelfShadowRealTimeShadowColor +#define _SelfShadowRealTimeShadowColorPower unity_DOTS_Sampled_SelfShadowRealTimeShadowColorPower + +#define _SmoothObjectNormal unity_DOTS_Sampled_SmoothObjectNormal +#define _VertexColorRedControlSmoothObjectNormal unity_DOTS_Sampled_VertexColorRedControlSmoothObjectNormal +#define _XYZPosition unity_DOTS_Sampled_XYZPosition +#define _ShowNormal unity_DOTS_Sampled_ShowNormal + +#define _ShadowColorTexturePower unity_DOTS_Sampled_ShadowColorTexturePower + +#define _ShadowTIntensity unity_DOTS_Sampled_ShadowTIntensity +#define _ShadowTLightThreshold unity_DOTS_Sampled_ShadowTLightThreshold +#define _ShadowTShadowThreshold unity_DOTS_Sampled_ShadowTShadowThreshold +#define _ShadowTColor unity_DOTS_Sampled_ShadowTColor +#define _ShadowTColorPower unity_DOTS_Sampled_ShadowTColorPower +#define _ShadowTHardness unity_DOTS_Sampled_ShadowTHardness +#define _STIL unity_DOTS_Sampled_STIL +#define _ShowInAmbientLightShadowIntensity unity_DOTS_Sampled_ShowInAmbientLightShadowIntensity +#define _ShowInAmbientLightShadowThreshold unity_DOTS_Sampled_ShowInAmbientLightShadowThreshold +#define _LightFalloffAffectShadowT unity_DOTS_Sampled_LightFalloffAffectShadowT + +#define _PTCol unity_DOTS_Sampled_PTCol +#define _PTexturePower unity_DOTS_Sampled_PTexturePower + +#define _GIFlatShade unity_DOTS_Sampled_GIFlatShade +#define _GIShadeThreshold unity_DOTS_Sampled_GIShadeThreshold +#define _EnvironmentalLightingIntensity unity_DOTS_Sampled_EnvironmentalLightingIntensity + +#define _LightAffectShadow unity_DOTS_Sampled_LightAffectShadow +#define _LightIntensity unity_DOTS_Sampled_LightIntensity +#define _DirectionalLightIntensity unity_DOTS_Sampled_DirectionalLightIntensity +#define _PointSpotlightIntensity unity_DOTS_Sampled_PointSpotlightIntensity +#define _LightFalloffSoftness unity_DOTS_Sampled_LightFalloffSoftness +#define _LLI_Min unity_DOTS_Sampled_LLI_Min +#define _LLI_Max unity_DOTS_Sampled_LLI_Max + +#define _CustomLightDirectionIntensity unity_DOTS_Sampled_CustomLightDirectionIntensity +#define _CustomLightDirection unity_DOTS_Sampled_CustomLightDirection +#define _CustomLightDirectionFollowObjectRotation unity_DOTS_Sampled_CustomLightDirectionFollowObjectRotation + +#define _ReflectionIntensity unity_DOTS_Sampled_ReflectionIntensity +#define _Smoothness unity_DOTS_Sampled_Smoothness +#define _RefMetallic unity_DOTS_Sampled_RefMetallic + +#define _RimLigInt unity_DOTS_Sampled_RimLigInt +#define _RimLightUnfill unity_DOTS_Sampled_RimLightUnfill +#define _RimLightSoftness unity_DOTS_Sampled_RimLightSoftness +#define _LightAffectRimLightColor unity_DOTS_Sampled_LightAffectRimLightColor +#define _RimLightColor unity_DOTS_Sampled_RimLightColor +#define _RimLightColorPower unity_DOTS_Sampled_RimLightColorPower +#define _RimLightInLight unity_DOTS_Sampled_RimLightInLight + +#define _MinFadDistance unity_DOTS_Sampled_MinFadDistance +#define _MaxFadDistance unity_DOTS_Sampled_MaxFadDistance + +#define _TriPlaTile unity_DOTS_Sampled_TriPlaTile +#define _TriPlaBlend unity_DOTS_Sampled_TriPlaBlend + +#define _PresAdju unity_DOTS_Sampled_PresAdju +#define _ClipAdju unity_DOTS_Sampled_ClipAdju +#define _PASize unity_DOTS_Sampled_PASize +#define _PASmooTrans unity_DOTS_Sampled_PASmooTrans +#define _PADist unity_DOTS_Sampled_PADist + +#define _PrevPosition unity_DOTS_Sampled_PrevPosition +#define _ObjPosi unity_DOTS_Sampled_ObjPosi +#define _NoiseSize unity_DOTS_Sampled_NoiseSize +#define _TrailSize unity_DOTS_Sampled_TrailSize + +#define _ObjectForward unity_DOTS_Sampled_ObjectForward +#define _ObjectRight unity_DOTS_Sampled_ObjectRight + +#define _SSAOColor unity_DOTS_Sampled_SSAOColor + +//========= + + + +#define UNITY_ACCESS_HYBRID_INSTANCED_PROP(var, type) UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(type, var) +#elif defined(UNITY_INSTANCING_ENABLED) + +UNITY_INSTANCING_BUFFER_START(DOTSMESDEF) + UNITY_DEFINE_INSTANCED_PROP(float, _SkinMatrixIndex) + UNITY_DEFINE_INSTANCED_PROP(float, _ComputeMeshIndex) +UNITY_INSTANCING_BUFFER_END(DOTSMESDEF) + +#define UNITY_ACCESS_HYBRID_INSTANCED_PROP(var, type) UNITY_ACCESS_INSTANCED_PROP(DOTSMESDEF, var) +#else +#define UNITY_ACCESS_HYBRID_INSTANCED_PROP(var, type) var + +//========= + +#endif + +//=============================================================================== +//Non CBUF +//=============================================================================== + +TEXTURE2D(_MainTex); +SAMPLER(sampler_MainTex); + +TEXTURE2D(_MaskTransparency); +SAMPLER(sampler_MaskTransparency); + +TEXTURE2D(_OutlineWidthControl); +SAMPLER(sampler_OutlineWidthControl); + +#if N_F_MC_ON + TEXTURE2D(_MCap); + SAMPLER(sampler_MCap); + + TEXTURE2D(_MCapMask); + SAMPLER(sampler_MCapMask); +#endif + +#if N_F_CO_ON + TEXTURE2D(_SecondaryCutout); + SAMPLER(sampler_SecondaryCutout); +#endif + +#if N_F_NM_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); +#endif + +#if N_F_SL_ON + TEXTURE2D(_MaskSelfLit); + SAMPLER(sampler_MaskSelfLit); +#endif + +#if N_F_GLO_ON + TEXTURE2D(_MaskGloss); + SAMPLER(sampler_MaskGloss); +#endif + +#if N_F_GLO_ON + #if N_F_GLOT_ON + TEXTURE2D(_GlossTexture); + SAMPLER(sampler_GlossTexture); + #endif +#endif + +#if N_F_SCT_ON + TEXTURE2D(_ShadowColorTexture); + SAMPLER(sampler_ShadowColorTexture); +#endif + +#if N_F_ST_ON + TEXTURE2D(_ShadowT); + SAMPLER(sampler_ShadowT); +#endif + +#if N_F_PT_ON + TEXTURE2D(_PTexture); + SAMPLER(sampler_PTexture); +#endif + +#if N_F_R_ON + TEXTURE2D(_MaskReflection); + SAMPLER(sampler_MaskReflection); +#endif + +#if N_F_R_ON + #if N_F_FR_ON + TEXTURE2D(_FReflection); + SAMPLER(sampler_FReflection); + #endif +#endif \ No newline at end of file diff --git a/RealToon/RealToon/RealToon Shaders/RealToon Core/URP/RT_URP_PROP.hlsl.meta b/RealToon/RealToon/RealToon Shaders/RealToon Core/URP/RT_URP_PROP.hlsl.meta new file mode 100644 index 0000000..782b06f --- /dev/null +++ b/RealToon/RealToon/RealToon Shaders/RealToon Core/URP/RT_URP_PROP.hlsl.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 1a20f2a1310293740b6c544a6fcc743b +ShaderIncludeImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/RealToon/RealToon/RealToon Shaders/Version 5.meta b/RealToon/RealToon/RealToon Shaders/Version 5.meta new file mode 100644 index 0000000..4a2e9a6 --- /dev/null +++ b/RealToon/RealToon/RealToon Shaders/Version 5.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8bb1dffeb58b33748a6224c3880b70af +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/RealToon/RealToon/RealToon Shaders/Version 5/URP.meta b/RealToon/RealToon/RealToon Shaders/Version 5/URP.meta new file mode 100644 index 0000000..a337f59 --- /dev/null +++ b/RealToon/RealToon/RealToon Shaders/Version 5/URP.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8a6b9672af71dd24a90aff56deebb295 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/RealToon/RealToon/RealToon Shaders/Version 5/URP/Default.meta b/RealToon/RealToon/RealToon Shaders/Version 5/URP/Default.meta new file mode 100644 index 0000000..7b5ceb5 --- /dev/null +++ b/RealToon/RealToon/RealToon Shaders/Version 5/URP/Default.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e7465c6b31a542d43a0240672077f1cf +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/RealToon/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader b/RealToon/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader new file mode 100644 index 0000000..95fad6d --- /dev/null +++ b/RealToon/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader @@ -0,0 +1,3235 @@ +//RealToon V5.0.13 (URP) +//MJQStudioWorks +//©2025 + +Shader "Universal Render Pipeline/RealToon/Version 5/Default/Default" +{ + Properties + { + + [Enum(UnityEngine.Rendering.CullMode)] _Culling("Culling", int) = 2 + + [Toggle(N_F_TRANS_ON)] _TRANSMODE("Transparent Mode", Float) = 0.0 + + _MainTex ("Texture", 2D) = "white" {} + [ToggleOff] _TexturePatternStyle ("Texture Pattern Style", Float ) = 0.0 + [HDR] _MainColor ("Main Color", Color) = (1.0,1.0,1.0,1.0) + _MaiColPo("Main Color Power", Float) = 0.8 + + [ToggleOff] _MVCOL ("Mix Vertex Color", Float ) = 0.0 + + [ToggleOff] _MCIALO ("Main Color In Ambient Light Only", Float ) = 0.0 + + [HDR] _HighlightColor ("Highlight Color", Color) = (1.0,1.0,1.0,1.0) + _HighlightColorPower ("Highlight Color Power", Float ) = 1.0 + + _MCapIntensity ("Intensity", Range(0, 1)) = 1.0 + _MCap ("MatCap", 2D) = "white" {} + [ToggleOff] _SPECMODE ("Specular Mode", Float ) = 0.0 + _SPECIN ("Specular Power", Float ) = 1 + _MCapMask ("Mask MatCap", 2D) = "white" {} + + _Cutout ("Cutout", Range(0, 1)) = 0.5 + [ToggleOff] _AlphaBaseCutout ("Alpha Base Cutout", Float ) = 1.0 + [Toggle(N_F_SCO_ON)] _N_F_SCO ("Soft Cutout", Float ) = 0.0 + [Toggle(N_F_ATC_ON)] _AlpToCov("Anti - Aliasing Affect Cutout", int) = 0 + _AAS ("Anti - Aliasing Softness", Range(0.0001, 1)) = 0.0001 + [ToggleOff] _UseSecondaryCutout ("Use Secondary Cutout Only", Float ) = 0.0 + _SecondaryCutout ("Secondary Cutout", 2D) = "white" {} + + [Toggle(N_F_COEDGL_ON)] _N_F_COEDGL("Enable Glow Edge", Float) = 0.0 + [HDR] _Glow_Color("Glow Color", Color) = (1.0,1.0,1.0,1.0) + _Glow_Edge_Width("Glow Edge Width", Float) = 1.0 + + [Toggle(N_F_SIMTRANS_ON)] _SimTrans("Simple Transparency Mode", Float) = 0.0 + _Opacity("Opacity", Range(0, 1)) = 1.0 + _TransparentThreshold("Transparent Threshold", Float) = 0.0 + + [Enum(UnityEngine.Rendering.BlendMode)] _BleModSour("Blend - Source", int) = 1 + [Enum(UnityEngine.Rendering.BlendMode)] _BleModDest("Blend - Destination", int) = 0 + + _MaskTransparency("Mask Transparency", 2D) = "black" {} + + [Toggle(N_F_TRANSAFFSHA_ON)] _TransAffSha("Affect Shadow", Float) = 1.0 + + _NormalMap ("Normal Map", 2D) = "bump" {} + _NormalMapIntensity ("Normal Map Intensity", Float ) = 1.0 + + _Saturation ("Saturation", Range(0, 2)) = 1.0 + + _OutlineWidth ("Width", Float ) = 0.5 + _OutlineWidthControl ("Width Control", 2D) = "white" {} + + [Enum(Normal,0,Origin,1)] _OutlineExtrudeMethod("Outline Extrude Method", int) = 0 + + _OutlineOffset ("Outline Offset", Vector) = (0,0,0) + _OutlineZPostionInCamera ("Outline Z Position In Camera", Float) = 0.0 + + [Enum(Off,1,On,0)] _DoubleSidedOutline("Double Sided Outline", int) = 1 + + [HDR] _OutlineColor ("Color", Color) = (0.0,0.0,0.0,1.0) + + [ToggleOff] _MixMainTexToOutline ("Mix Main Texture To Outline", Float ) = 0.0 + + _NoisyOutlineIntensity ("Noisy Outline Intensity", Range(0, 1)) = 0.0 + [Toggle(N_F_DNO_ON)] _DynamicNoisyOutline ("Dynamic Noisy Outline", Float ) = 0.0 + [ToggleOff] _LightAffectOutlineColor ("Light Affect Outline Color", Float ) = 0.0 + + [ToggleOff] _OutlineWidthAffectedByViewDistance ("Outline Width Affected By View Distance", Float ) = 0.0 + _FarDistanceMaxWidth ("Far Distance Max Width", Float ) = 10.0 + + [ToggleOff] _VertexColorBlueAffectOutlineWitdh ("Vertex Color Blue Affect Outline Witdh", Float ) = 0.0 + + _DepthThreshold("Depth Threshold", Float) = 900.0 + + [Toggle(N_F_O_MOTTSO_ON)] _N_F_MSSOLTFO("Mix Outline To The Shader Output", Float) = 0.0 + + [Enum(UnityEngine.Rendering.StencilOp)] _OutStenPass("Stencil: Pass", int) = 0 + + _SelfLitIntensity ("Intensity", Range(0, 1)) = 0.0 + [HDR] _SelfLitColor ("Color", Color) = (1.0,1.0,1.0,1.0) + _SelfLitPower ("Power", Float ) = 2.0 + _TEXMCOLINT ("Texture and Main Color Intensity", Float ) = 1.0 + [ToggleOff] _SelfLitHighContrast ("High Contrast", Float ) = 1.0 + [Toggle(N_F_SLMM_ON)] _N_F_SLMM ("Map Mode", Float ) = 0.0 + _MaskSelfLit ("Mask Self Lit", 2D) = "white" {} + + _GlossIntensity ("Gloss Intensity", Range(0, 1)) = 1.0 + _Glossiness ("Glossiness", Range(0, 1)) = 0.6 + _GlossSoftness ("Softness", Range(0, 1)) = 0.0 + [HDR] _GlossColor ("Color", Color) = (1.0,1.0,1.0,1.0) + _GlossColorPower ("Color Power", Float ) = 10.0 + _MaskGloss ("Mask Gloss", 2D) = "white" {} + + _GlossTexture ("Gloss Texture", 2D) = "black" {} + [Toggle(N_F_ANIS_ON)] _N_F_ANIS ("Anisotropic Mode", Float ) = 0.0 + _GlossTextureSoftness ("Softness", Float ) = 0.0 + [ToggleOff] _PSGLOTEX ("Pattern Style", Float ) = 0.0 + _GlossTextureRotate ("Rotate", Float ) = 0.0 + [ToggleOff] _GlossTextureFollowObjectRotation ("Follow Object Rotation", Float ) = 0.0 + _NoisTexInten ("Noise Texture Intensity", Range(0, 10)) = 1.0 + _StraWidt ("Width", Float ) = 10.0 + _NoiTexAffStraWidt ("Noise Texture Affect Width", Range(0, 1) ) = 0 + _ShifAnis ("Shift", Float ) = 0.0 + _GlossTextureFollowLight ("Follow Light", Range(0, 1)) = 0.0 + + [HDR] _OverallShadowColor ("Overall Shadow Color", Color) = (0.0,0.0,0.0,1.0) + _OverallShadowColorPower ("Overall Shadow Color Power", Float ) = 1.0 + + [ToggleOff] _SelfShadowShadowTAtViewDirection ("Self Shadow & ShadowT At View Direction", Float ) = 0.0 + + _ReduSha ("Reduce Shadow", Float ) = 0.5 + + _ShadowHardness ("Shadow Hardness", Range(0, 1)) = 0.0 + + _SelfShadowRealtimeShadowIntensity ("Self Shadow & Realtime Shadow Intensity", Range(0, 1)) = 1.0 + _SelfShadowThreshold ("Threshold", Range(0, 1)) = 0.930 + [ToggleOff] _VertexColorGreenControlSelfShadowThreshold ("Vertex Color Green Control Self Shadow Threshold", Float ) = 0.0 + _SelfShadowHardness ("Hardness", Range(0, 1)) = 1.0 + [HDR] _SelfShadowRealTimeShadowColor ("Self Shadow & Real Time Shadow Color", Color) = (1.0,1.0,1.0,1.0) + _SelfShadowRealTimeShadowColorPower ("Self Shadow & Real Time Shadow Color Power", Float ) = 1.0 + [ToggleOff] _LigIgnoYNorDir ("Light Ignore Y Normal Direction", Float) = 0 + [ToggleOff] _SelfShadowAffectedByLightShadowStrength ("Self Shadow Affected By Light Shadow Strength", Float ) = 0.0 + + _SmoothObjectNormal ("Smooth Object Normal", Range(0, 1)) = 0.0 + [ToggleOff] _VertexColorRedControlSmoothObjectNormal ("Vertex Color Red Control Smooth Object Normal", Float ) = 0.0 + [HideInInspector] _XYZPosition ("XYZ Position", Vector) = (0.0,0.0,0.0,0.0) + [ToggleOff] _ShowNormal ("Show Normal", Float ) = 0.0 + + _ShadowColorTexture ("Shadow Color Texture", 2D) = "white" {} + _ShadowColorTexturePower ("Power", Float ) = 0.0 + + _ShadowTIntensity ("ShadowT Intensity", Range(0, 1)) = 1.0 + _ShadowT ("ShadowT", 2D) = "white" {} + _ShadowTLightThreshold ("Light Threshold", Float ) = 50.0 + _ShadowTShadowThreshold ("Shadow Threshold", Float ) = 0.0 + _ShadowTHardness ("Hardness", Range(0, 1)) = 1.0 + [HDR] _ShadowTColor ("Color", Color) = (1.0,1.0,1.0,1.0) + _ShadowTColorPower ("Color Power", Float ) = 1.0 + [Toggle(N_F_STSDFM_ON)] _N_F_STSDFM ("SDF Mode", Float ) = 0.0 + + [ToggleOff] _STIL ("Ignore Light", Float ) = 0.0 + + [Toggle(N_F_STIS_ON)] _N_F_STIS ("Show In Shadow", Float ) = 0.0 + + [Toggle(N_F_STIAL_ON )] _N_F_STIAL ("Show In Ambient Light", Float ) = 0.0 + _ShowInAmbientLightShadowIntensity ("Show In Ambient Light & Shadow Intensity", Range(0, 1)) = 1.0 + _ShowInAmbientLightShadowThreshold ("Show In Ambient Light & Shadow Threshold", Float ) = 0.4 + + [ToggleOff] _LightFalloffAffectShadowT ("Light Falloff Affect ShadowT", Float ) = 0.0 + + _PTexture ("PTexture", 2D) = "white" {} + _PTCol("Color", Color) = (0.0, 0.0, 0.0, 1.0) + _PTexturePower ("Power", Float ) = 1.0 + + [Toggle(N_F_RELGI_ON)] _RELG ("Receive Environmental Lighting and GI", Float ) = 1.0 + _EnvironmentalLightingIntensity ("Environmental Lighting Intensity", Float ) = 1.0 + + [ToggleOff] _GIFlatShade ("GI Flat Shade", Float ) = 0.0 + _GIShadeThreshold ("GI Shade Threshold", Range(0, 1)) = 0.0 + + [ToggleOff] _LightAffectShadow ("Light Affect Shadow", Float ) = 0.0 + _LightIntensity ("Light Intensity", Float ) = 1.0 + + [Toggle(N_F_USETLB_ON)] _UseTLB ("Use Traditional Light Blend", Float ) = 0.0 + [Toggle(N_F_EAL_ON)] _N_F_EAL ("Enable Additional Lights", Float ) = 1.0 + + _DirectionalLightIntensity ("Directional Light Intensity", Float ) = 0.0 + _PointSpotlightIntensity ("Point and Spot Light Intensity", Float ) = 0.0 + _LightFalloffSoftness ("Light Falloff Softness", Range(0, 1)) = 1.0 + + [Toggle(N_F_LLI_ON)] _N_F_LLI ("Limit Light Intensity", Float ) = 0.0 + _LLI_Min ("Minimum", Float ) = 0.0 + _LLI_Max ("Maximum", Float ) = 1.0 + + _CustomLightDirectionIntensity ("Intensity", Range(0, 1)) = 0.0 + [ToggleOff] _CustomLightDirectionFollowObjectRotation ("Follow Object Rotation", Float ) = 0.0 + _CustomLightDirection ("Custom Light Direction", Vector) = (0.0,0.0,10.0,0.0) + + _ReflectionIntensity ("Intensity", Range(0, 1)) = 0.0 + _Smoothness ("Roughness", Float ) = 0.0 + _RefMetallic ("Metallic", Range(0, 1) ) = 0.0 + + _MaskReflection ("Mask Reflection", 2D) = "white" {} + + _FReflection ("FReflection", 2D) = "black" {} + + _RimLigInt("Rim Light Intensity", Range(0, 1)) = 1.0 + _RimLightUnfill ("Unfill", Float ) = 1.5 + [HDR] _RimLightColor ("Color", Color) = (1.0,1.0,1.0,1.0) + _RimLightColorPower ("Color Power", Float ) = 10.0 + _RimLightSoftness ("Softness", Range(0, 1)) = 1.0 + [ToggleOff] _RimLightInLight ("Rim Light In Light", Float ) = 1.0 + [ToggleOff] _LightAffectRimLightColor ("Light Affect Rim Light Color", Float ) = 0.0 + + _MinFadDistance("Min Distance", Float) = 0.0 + _MaxFadDistance("Max Distance", Float) = 2.0 + + _TriPlaTile("Tile", Float) = 1.0 + _TriPlaBlend("Blend", Float) = 4.0 + + _PresAdju("Prespective", Float) = 1.0 + _ClipAdju("Clip", Float) = 0.0 + _PASize("Close-Up Size", Float) = 0.5 + _PASmooTrans("Close-Up Size Smooth Transition", Float) = 1 + _PADist("Close-Up Size Distance", Float) = 0 + + [HideInInspector]_NoiseSize("Noise Size", Float) = 100 + [HideInInspector]_TrailSize("Trail Size", Float) = 1.5 + + _RefVal ("ID", int ) = 0 + [Enum(Blank,8,A,0,B,2)] _Oper("Set 1", int) = 0 + [Enum(Blank,8,None,4,A,6,B,7)] _Compa("Set 2", int) = 4 + + [Toggle(N_F_MC_ON)] _N_F_MC ("MatCap", Float ) = 0.0 + [Toggle(N_F_NM_ON)] _N_F_NM ("Normal Map", Float ) = 0.0 + [Toggle(N_F_CO_ON)] _N_F_CO ("Cutout", Float ) = 0.0 + [Toggle(N_F_O_ON)] _N_F_O ("Outline", Float ) = 1.0 + [Toggle(N_F_CA_ON)] _N_F_CA ("Color Adjustment", Float ) = 0.0 + [Toggle(N_F_SL_ON)] _N_F_SL ("Self Lit", Float ) = 0.0 + [Toggle(N_F_GLO_ON)] _N_F_GLO ("Gloss", Float ) = 0.0 + [Toggle(N_F_GLOT_ON)] _N_F_GLOT ("Gloss Texture", Float ) = 0.0 + [Toggle(N_F_SS_ON)] _N_F_SS ("Self Shadow", Float ) = 1.0 + [Toggle(N_F_SON_ON)] _N_F_SON ("Smooth Object Normal", Float ) = 0.0 + [Toggle(N_F_SCT_ON)] _N_F_SCT ("Shadow Color Texture", Float ) = 0.0 + [Toggle(N_F_ST_ON)] _N_F_ST ("ShadowT", Float ) = 0.0 + [Toggle(N_F_PT_ON)] _N_F_PT ("PTexture", Float ) = 0.0 + [Toggle(N_F_CLD_ON)] _N_F_CLD ("Custom Light Direction", Float ) = 0.0 + [Toggle(N_F_R_ON)] _N_F_R ("Relfection", Float ) = 0.0 + [Toggle(N_F_FR_ON)] _N_F_FR ("FRelfection", Float ) = 0.0 + [Toggle(N_F_RL_ON)] _N_F_RL ("Rim Light", Float ) = 0.0 + [Toggle(N_F_NFD_ON)] _N_F_NFD ("Near Fade Dithering", Float) = 0.0 + [Toggle(N_F_TP_ON)] _N_F_TP ("Triplanar", Float ) = 0.0 + [Toggle(N_F_PA_ON)] _N_F_PA ("Perspective Adjustment", Float ) = 0.0 + [Toggle(N_F_SE_ON)] _N_F_SE ("Smear Effect", Float ) = 0.0 + + [Toggle(N_F_HDLS_ON)] _N_F_HDLS ("Hide Directional Light Shadow", Float ) = 0.0 + [Toggle(N_F_HPSS_ON)] _N_F_HPSS ("Hide Point & Spot Light Shadow", Float ) = 0.0 + + [Toggle(N_F_DCS_ON)] _N_F_DCS ("Disable Cast Shadow", Float ) = 0.0 + [Toggle(N_F_NLASOBF_ON)] _N_F_NLASOBF ("No Light and Shadow On BackFace", Float ) = 0.0 + + [Toggle(N_F_ESSAO_ON)] _N_F_ESSAO("Enable Screen Space Ambient Occlusion", Float) = 0.0 + [HDR] _SSAOColor("Ambient Occlusion Color", Color) = (0.0, 0.0, 0.0, 0.0) + + [Toggle(N_F_RDC_ON)] _N_F_RDC("Receive Decal", Float) = 1.0 + [Toggle(N_F_OFLMB_ON)] _N_F_OFLMB("Optimize for [Light Mode: Baked]", Float) = 0.0 + + [Toggle(N_F_DDMD_ON)] _N_F_DDMD("Disable DOTS Mesh Deformation", Float) = 1.0 + + [Enum(On, 1, Off, 0)] _ZWrite("ZWrite", int) = 1 + + //Others + [HideInInspector]_SkinMatrixIndex("Skin Matrix Index Offset", Float) = 0 + [HideInInspector]_ComputeMeshIndex("Compute Mesh Buffer Index Offset", Float) = 0 + [HideInInspector]_PrevPosition("Prev Position", Vector) = (0, 0, 0, 0) + [HideInInspector]_ObjPosi ("Object Position", Vector) = (0, 0, 0, 0) + [HideInInspector]_ObjectForward("Object Forward", Vector) = (0, 0, 0, 0) + [HideInInspector]_ObjectRight("Object Right", Vector) = (0, 0, 0, 0) + + } + +SubShader +{ + + Tags + { + "Queue" = "Geometry" + "RenderType" = "Opaque" + "RenderPipeline" = "UniversalPipeline" + "UniversalMaterialType" = "Lit" + "IgnoreProjector" = "True" + } + LOD 300 + + Pass + { + + Name "ForwardLit" + Tags{"LightMode" = "UniversalForward"} + + Cull [_Culling] + Blend [_BleModSour] [_BleModDest] + ZWrite[_ZWrite] + + AlphaToMask[_AlpToCov] + +/*//F_ST + Stencil { + Ref[_RefVal] + Comp [_Compa] + Pass [_Oper] + Fail [_Oper] + } +//F_ST_En*/ + + HLSLPROGRAM + + #pragma only_renderers d3d9 d3d11 vulkan glcore gles3 gles metal xboxone ps4 xboxseries playstation switch webgpu //ounce //switch2 +#pragma target 2.0 //targetfl + + #pragma multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN + #pragma multi_compile _ _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHTS + #pragma multi_compile _ EVALUATE_SH_MIXED EVALUATE_SH_VERTEX + #pragma multi_compile_fragment _ _ADDITIONAL_LIGHT_SHADOWS + #pragma multi_compile_fragment _ _REFLECTION_PROBE_BLENDING + #pragma multi_compile_fragment _ _REFLECTION_PROBE_BOX_PROJECTION + #pragma multi_compile_fragment _ _SHADOWS_SOFT _SHADOWS_SOFT_LOW _SHADOWS_SOFT_MEDIUM _SHADOWS_SOFT_HIGH + #pragma multi_compile_fragment _ _SCREEN_SPACE_OCCLUSION + #pragma multi_compile_fragment _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3 + #pragma multi_compile_fragment _ _LIGHT_COOKIES + #pragma multi_compile _ _LIGHT_LAYERS + #pragma multi_compile _ _FORWARD_PLUS + + #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/RenderingLayers.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ProbeVolumeVariants.hlsl" + + #pragma multi_compile _ LIGHTMAP_SHADOW_MIXING + #pragma multi_compile _ SHADOWS_SHADOWMASK + #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ DYNAMICLIGHTMAP_ON + #pragma multi_compile _ USE_LEGACY_LIGHTMAPS + #pragma multi_compile _ LOD_FADE_CROSSFADE + + #pragma multi_compile_fog + #pragma multi_compile_instancing + #pragma instancing_options renderinglayer + + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" + + #pragma vertex LitPassVertex + #pragma fragment LitPassFragment + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/realtoon/RealToon/RealToon Shaders/RealToon Core/URP/RT_URP_Core.hlsl" + + #if defined(LOD_FADE_CROSSFADE) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl" + #endif + + #pragma shader_feature_local_fragment N_F_USETLB_ON + #pragma shader_feature_local_fragment N_F_TRANS_ON + #pragma shader_feature_local_fragment N_F_SIMTRANS_ON + #pragma shader_feature_local_vertex N_F_DDMD_ON + + #pragma shader_feature_local_fragment N_F_O_ON + #pragma shader_feature_local_fragment N_F_O_MOTTSO_ON + #pragma shader_feature_local_fragment N_F_MC_ON + #pragma shader_feature_local_fragment N_F_NM_ON + #pragma shader_feature_local_fragment N_F_CO_ON + #pragma shader_feature_local_fragment N_F_SL_ON + #pragma shader_feature_local_fragment N_F_CA_ON + #pragma shader_feature_local_fragment N_F_GLO_ON + #pragma shader_feature_local_fragment N_F_GLOT_ON + #pragma shader_feature_local_fragment N_F_SS_ON + #pragma shader_feature_local_fragment N_F_SCT_ON + #pragma shader_feature_local_fragment N_F_ST_ON + #pragma shader_feature_local_fragment N_F_STIS_ON + #pragma shader_feature_local_fragment N_F_STIAL_ON + #pragma shader_feature_local N_F_SON_ON + #pragma shader_feature_local_fragment N_F_PT_ON + #pragma shader_feature_local_fragment N_F_RELGI_ON + #pragma shader_feature_local_fragment N_F_CLD_ON + #pragma shader_feature_local_fragment N_F_R_ON + #pragma shader_feature_local_fragment N_F_FR_ON + #pragma shader_feature_local_fragment N_F_RL_ON + #pragma shader_feature_local_fragment N_F_HDLS_ON + #pragma shader_feature_local_fragment N_F_HPSS_ON + #pragma shader_feature_local_fragment N_F_EAL_ON + #pragma shader_feature_local_fragment N_F_NLASOBF_ON + #pragma shader_feature_local_fragment N_F_OFLMB_ON + #pragma shader_feature_local_fragment N_F_ESSAO_ON + #pragma shader_feature_local_fragment N_F_RDC_ON + #pragma shader_feature_local_fragment N_F_COEDGL_ON + #pragma shader_feature_local_fragment N_F_NFD_ON + #pragma shader_feature_local_fragment N_F_TP_ON + #pragma shader_feature_local_vertex N_F_PA_ON + #pragma shader_feature_local_vertex N_F_SE_ON + #pragma shader_feature_local_fragment N_F_SCO_ON + #pragma shader_feature_local_fragment N_F_STSDFM_ON + #pragma shader_feature_local_fragment N_F_ATC_ON + #pragma shader_feature_local_fragment N_F_ANIS_ON + #pragma shader_feature_local_fragment N_F_LLI_ON + #pragma shader_feature_local_fragment N_F_SLMM_ON + + #define _EMISSION + + struct Attributes + { + + float4 positionOS : POSITION; + float3 normalOS : NORMAL; + float4 tangentOS : TANGENT; + float2 uv : TEXCOORD0; + float2 staticLightmapUV : TEXCOORD1; + float2 dynamicLightmapUV : TEXCOORD2; + float4 vertexColor : COLOR; + + #if defined(UNITY_DOTS_INSTANCING_ENABLED) + + #ifndef N_F_DDMD_ON +float4 weights : BLENDWEIGHTS;//DOTS_LiBleSki_FL +uint4 indices : BLENDINDICES;//DOTS_LiBleSki_FL +//uint vertexID : SV_VertexID;//DOTS_CompDef_FL + #endif + + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + + }; + + struct Varyings + { + + float2 uv : TEXCOORD0; + float4 positionWSAndFogFactor : TEXCOORD1; + float3 normalWS : TEXCOORD2; + float3 tangentWS : TEXCOORD3; + float3 bitangentWS : TEXCOORD4; + float4 posWorld : TEXCOORD5; + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD6; + #endif + + float4 projPos : TEXCOORD7; + + float2 staticLightmapUV : TEXCOORD8; + #ifdef DYNAMICLIGHTMAP_ON + float2 dynamicLightmapUV : TEXCOORD9; + #endif + + float3 smoNorm : TEXCOORD10; + float4 vertexColor : COLOR; + float4 positionCS : SV_POSITION; + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + + }; + + Varyings LitPassVertex(Attributes input) + { + + Varyings output = (Varyings)0; + + UNITY_SETUP_INSTANCE_ID (input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if defined(UNITY_DOTS_INSTANCING_ENABLED) + + #ifdef N_F_DDMD_ON + + float4 _LBS_CD_Position = input.positionOS; + float3 _LBS_CD_Normal = input.normalOS; + float4 _LBS_CD_Tangent = input.tangentOS; + + #else + + float4 _LBS_CD_Position = 0; + float3 _LBS_CD_Normal = 0; + float4 _LBS_CD_Tangent = 0; + +DOTS_LiBleSki(input.indices, input.weights, input.positionOS.xyz, input.normalOS.xyz, input.tangentOS.xyz, (float3)_LBS_CD_Position, _LBS_CD_Normal, (float3)_LBS_CD_Tangent);//DOTS_LiBleSki_FL +//DOTS_CompDef(input.vertexID, (float3)_LBS_CD_Position, _LBS_CD_Normal, (float3)_LBS_CD_Tangent);//DOTS_CompDef_FL + + #endif + + #else + float4 _LBS_CD_Position = input.positionOS; + float3 _LBS_CD_Normal = input.normalOS; + float4 _LBS_CD_Tangent = input.tangentOS; + #endif + + VertexPositionInputs vertexInput = GetVertexPositionInputs(_LBS_CD_Position.xyz); + VertexNormalInputs vertexNormalInput = GetVertexNormalInputs(_LBS_CD_Normal, _LBS_CD_Tangent); + + + //RT_SE + #if N_F_SE_ON + input.positionOS = RT_SE(vertexInput.positionWS, input.positionOS); + _LBS_CD_Position = input.positionOS; + #endif + //== + + + //RT_PA + #if N_F_PA_ON + output.positionCS = mul(RT_PA(vertexInput.positionWS), float4(_LBS_CD_Position.xyz,1.0) ); + #else + output.positionCS = vertexInput.positionCS; + #endif + // + + + output.uv = input.uv; + output.vertexColor = input.vertexColor; + + output.normalWS = vertexNormalInput.normalWS; + output.tangentWS = vertexNormalInput.tangentWS; + output.bitangentWS = vertexNormalInput.bitangentWS; + + float fogFactor = ComputeFogFactor(vertexInput.positionCS.z); + output.positionWSAndFogFactor = float4(vertexInput.positionWS, fogFactor); + + output.posWorld = float4(vertexInput.positionWS, 1.0); + output.projPos = ComputeScreenPos (output.positionCS); + + OUTPUT_LIGHTMAP_UV(input.staticLightmapUV, unity_LightmapST, output.staticLightmapUV); + #ifdef DYNAMICLIGHTMAP_ON + output.dynamicLightmapUV = input.dynamicLightmapUV.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #endif + + //RT_SON + #if N_F_SON_ON + output.smoNorm = GetAbsolutePositionWS(vertexInput.positionWS); + #endif + //== + + +#if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + + output.shadowCoord = GetShadowCoord(vertexInput); +#endif + + return output; + } + + void LitPassFragment(Varyings input + , out half4 outColor : SV_Target0 + , float facing : VFACE + #ifdef _WRITE_RENDERING_LAYERS + , out float4 outRenderingLayers : SV_Target1 + #endif + ) + { + + UNITY_SETUP_INSTANCE_ID (input); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input); + + #if defined(DYNAMICLIGHTMAP_ON) + float2 RTD_LIG_UV = input.dynamicLightmapUV; + #else + float2 RTD_LIG_UV = input.staticLightmapUV; + #endif + + //========= + + float4 shadow_mask = SAMPLE_SHADOWMASK(RTD_LIG_UV); + + #if defined(SHADOWS_SHADOWMASK) && defined(LIGHTMAP_ON) + half4 shadowMask = shadow_mask; + #elif !defined (LIGHTMAP_ON) + half4 shadowMask = unity_ProbesOcclusion; + #else + half4 shadowMask = half4(1.0, 1.0, 1.0, 1.0); + #endif + + //========== + + half3 color = (half3)0.0; + float3 A_L_O = (float3)0.0; + + half isFrontFace = ( facing >= 0 ? 1 : 0 ); + float4 objPos = mul ( GetObjectToWorldMatrix(), float4(0.0,0.0,0.0,1.0) ); + float2 sceneUVs = (input.projPos.xy / input.projPos.w); + half RTD_OB_VP_CAL = distance(objPos.rgb, _WorldSpaceCameraPos); + half2 RTD_VD_Cal = (float2((sceneUVs.x * 2.0 - 1.0) * (_ScreenParams.r / _ScreenParams.g), sceneUVs.y * 2.0 - 1.0).rg * RTD_OB_VP_CAL); + + float3 positionWS = input.positionWSAndFogFactor.xyz; + input.normalWS = normalize(input.normalWS); + float3x3 tangentTransform = float3x3( input.tangentWS, input.bitangentWS, input.normalWS); + + + //RT_NM + float3 normalLocal = RT_NM(input.uv, positionWS, tangentTransform, input.normalWS); + //== + + + float3 viewDirection = normalize(_WorldSpaceCameraPos.xyz - input.posWorld.xyz); + float3 normalDirection = normalize(mul( normalLocal, tangentTransform )); + float3 viewReflectDirection = reflect( -viewDirection, normalDirection ); + + + //** + half2 RTD_TC_TP_OO; + if (!_TexturePatternStyle) + { + RTD_TC_TP_OO = input.uv; + } + else + { + RTD_TC_TP_OO = RTD_VD_Cal; + } + //** + + + #ifdef N_F_TP_ON + half4 _MainTex_var = RT_Tripl_Default(_MainTex, sampler_MainTex, positionWS, normalDirection); + #else + half4 _MainTex_var = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, TRANSFORM_TEX(RTD_TC_TP_OO, _MainTex)); + #endif + + #if defined(N_F_RDC_ON) + #if defined(_DBUFFER) && (!defined(N_F_TRANS_ON) || defined(N_F_CO_ON)) + RT_DC(input.positionCS, _MainTex_var, input.normalWS); + #endif + #endif + + #ifdef LOD_FADE_CROSSFADE + LODFadeCrossFade(input.positionCS); + #endif + + + //** + half3 _RTD_MVCOL; + if (!_MVCOL) + { + _RTD_MVCOL = (half3)1.0; + } + else + { + _RTD_MVCOL = input.vertexColor.rgb; + } + + uint meshRenderingLayers = GetMeshRenderingLayer(); + //** + + + // + #ifdef UNITY_COLORSPACE_GAMMA + _OverallShadowColor = float4(LinearToGamma22(_OverallShadowColor.rgb), _OverallShadowColor.a); + #endif + + #ifndef N_F_OFLMB_ON + half3 RTD_OSC = (_OverallShadowColor.rgb*_OverallShadowColorPower); + #else + half3 RTD_OSC = (half3)0.0; + #endif + // + + + + //RT_MCAP + half3 MCapOutP = RT_MCAP(input.uv, normalDirection); + //== + + + // + #ifdef UNITY_COLORSPACE_GAMMA + _MainColor = float4(LinearToGamma22(_MainColor.rgb),_MainColor.a); + #endif + // + + + half3 _MC_MCP = (_MainColor.rgb * _MaiColPo); + + + //RT_SSAO + half3 SSAmOc = RT_SSAO(input.positionCS); + //== + + + //RT_MCAP_SUB1 + half3 RTD_TEX_COL; + half3 RTD_MCIALO_IL = RT_MCAP_SUB1(MCapOutP, _MainTex_var, _RTD_MVCOL, RTD_TEX_COL); + //== + + + //RT_TRANS_CO + half RTD_TRAN_OPA_Sli; + half RTD_CO; + half3 GLO_OUT = (half3)0.0; + RT_TRANS_CO(input.uv, _MainTex_var, _MainTex_var.a, RTD_TRAN_OPA_Sli, RTD_CO, positionWS, normalDirection, input.positionCS.xy, GLO_OUT); + //== + + + //RT_SON + float3 RTD_SON_CHE_1; + float3 RTD_SON = RT_SON(input.vertexColor, input.smoNorm, normalDirection, RTD_SON_CHE_1); + //== + + + //RT_RELGI + float3 RTD_GI_FS_OO = RT_RELGI(RTD_SON); + //== + + + //RT_SCT + half3 RTD_SCT = RT_SCT(input.uv, positionWS, normalDirection, RTD_MCIALO_IL); + //== + + + //RT_PT + half3 RTD_PT_COL; + half RTD_PT = RT_PT(RTD_VD_Cal, RTD_PT_COL); + //== + + + // + #ifdef UNITY_COLORSPACE_GAMMA + _SelfShadowRealTimeShadowColor = float4(LinearToGamma22(_SelfShadowRealTimeShadowColor.rgb), _SelfShadowRealTimeShadowColor.a); + #endif + + #ifndef N_F_OFLMB_ON + half3 ss_col = lerp( RTD_PT_COL, (_SelfShadowRealTimeShadowColor.rgb * _SelfShadowRealTimeShadowColorPower) * RTD_OSC * RTD_SCT, RTD_PT); + #else + half3 ss_col = (half3)0.0; + #endif + // + + + //========/ + //========/ + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + Light mainLight = GetMainLight(input.shadowCoord, positionWS, shadowMask); + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + Light mainLight = GetMainLight(TransformWorldToShadowCoord(positionWS), positionWS, shadowMask); + #else + Light mainLight = GetMainLight(); + #endif + + half3 mainliCol = 0.0; + half mainliSAtt = 0.0; + float3 mainliDir = float3(0.0,0.0,0.0); + + #ifdef _LIGHT_LAYERS + if (IsMatchingLightLayer(mainLight.layerMask, meshRenderingLayers)) + #endif + { + #ifdef N_F_LLI_ON + mainliCol = clamp(mainLight.color.rgb,_LLI_Min,_LLI_Max); + #else + mainliCol = mainLight.color.rgb; + #endif + + mainliSAtt = mainLight.shadowAttenuation; + mainliDir = mainLight.direction; + } + //========/ + //========/ + + + #ifndef N_F_OFLMB_ON + #if N_F_NLASOBF_ON + half3 lightColor = lerp( (float3)0.0 , mainliCol,isFrontFace); + #else + half3 lightColor = mainliCol; + #endif + #else + half3 lightColor = (half3)0.0; + #endif + + + + #ifndef N_F_OFLMB_ON + #if N_F_HDLS_ON + half attenuation = 1.0; + #else + half dlshmin = lerp( 0.0, 0.6 ,_ShadowHardness); + half dlshmax = lerp( 1.0, 0.6 ,_ShadowHardness); + + #if N_F_NLASOBF_ON + half FB_Check = lerp( 1.0 , mainliSAtt ,isFrontFace); + #else + half FB_Check = mainliSAtt; + #endif + + half attenuation = smoothstep(dlshmin,dlshmax,FB_Check); + #endif + #else + half attenuation = 1.0; + #endif + + + + #ifndef N_F_OFLMB_ON + float3 lightDirection = mainliDir; + float3 halfDirection = normalize(viewDirection + lightDirection); + #else + float3 lightDirection = (float3)0.0; + float3 halfDirection = (float3)0.0; + #endif + + + + //RT_CLD + float3 RTD_CLD = RT_CLD(lightDirection); + //== + + + #ifndef N_F_OFLMB_ON + + + //** + half3 RTD_ST_SS_AVD_OO; + if (!_SelfShadowShadowTAtViewDirection) + { + RTD_ST_SS_AVD_OO = RTD_CLD; + } + else + { + RTD_ST_SS_AVD_OO = viewDirection; + } + //** + + + half RTD_NDOTL = 0.5 * dot(RTD_ST_SS_AVD_OO, float3(RTD_SON.x, RTD_SON.y * (1-_LigIgnoYNorDir), RTD_SON.z)) + 0.5; + half RTD_LVLC = RTD_LVLC_F(lightColor.rgb); + half3 lig_col_int = (_LightIntensity * lightColor.rgb); + + + //** + half3 RTD_LAS; + if (!_LightAffectShadow) + { + RTD_LAS = ss_col * RTD_LVLC; + } + else + { + RTD_LAS = ss_col * lig_col_int; + } + //** + + + #else + half3 RTD_ST_SS_AVD_OO = (half3)0.0; + half RTD_NDOTL = 0.0; + half RTD_LVLC = 0.0; + half3 lig_col_int = (half3)0.0; + half3 RTD_LAS = (half3)0.0; + #endif + + + // + #ifdef UNITY_COLORSPACE_GAMMA + _HighlightColor = float4(LinearToGamma22(_HighlightColor.rgb), _HighlightColor.a); + #endif + + #ifndef _N_F_OFLMB + half3 RTD_HL = (_HighlightColor.rgb*_HighlightColorPower+_DirectionalLightIntensity); + #else + half3 RTD_HL = (half3)0.0; + #endif + // + + + //** + half3 RTD_MC_SM_TC_OO; + if (!_SPECMODE) + { + RTD_MC_SM_TC_OO = RTD_TEX_COL * _MC_MCP; + } + else + { + RTD_MC_SM_TC_OO = RTD_TEX_COL + _MC_MCP; + } + //** + + + //** + half3 RTD_MCIALO_OO; + if (!_MCIALO) + { + RTD_MCIALO_OO = RTD_TEX_COL; + } + else + { + RTD_MCIALO_OO = lerp(RTD_MC_SM_TC_OO, _MainTex_var.rgb * MCapOutP * _RTD_MVCOL * 0.7, clamp((RTD_LVLC * 1.0), 0.0, 1.0)); + } + //** + + + half3 RTD_MCIALO = RTD_MCIALO_OO; + + + //RT_GLO + half RTD_GLO; + half3 RTD_GLO_COL; + RT_GLO(input.uv, RTD_VD_Cal, halfDirection, input.bitangentWS, normalDirection, viewDirection, positionWS, RTD_GLO, RTD_GLO_COL); + half3 RTD_GLO_OTHERS = RTD_GLO; + //** + + + //RT_RL + half3 RTD_RL_LARL_OO; + half RTD_RL_MAIN; + half RTD_RL_CHE_1 = RT_RL(viewDirection, normalDirection, lightColor, RTD_RL_LARL_OO, RTD_RL_MAIN); + //** + + + //RT_ST + half3 RTD_SHAT_COL; + half RTD_STIAL; + half RTD_ST_IS; + half3 RTD_ST_LAF; + half RTD_ST = RT_ST(input.uv, positionWS, normalDirection, RTD_NDOTL, attenuation, lightDirection, RTD_LVLC, RTD_PT_COL, lig_col_int, RTD_SCT, RTD_OSC, RTD_PT, RTD_SHAT_COL, RTD_STIAL, RTD_ST_IS, RTD_ST_LAF); + //** + + + //RT_SS + half RTD_SS = RT_SS(input.vertexColor, RTD_NDOTL, attenuation, _MainLightShadowData.x); + //** + + + //RT_RELGI_SUB1 + half ref_int_val; + half3 RTD_SL_OFF_OTHERS = RT_RELGI_SUB1(RTD_LIG_UV, RTD_GI_FS_OO, RTD_SHAT_COL, RTD_MCIALO, RTD_STIAL, mainLight, normalDirection, positionWS, viewDirection, input.positionCS.xy ); + //== + + + #ifndef N_F_OFLMB_ON + half3 RTD_R_OFF_OTHERS = lerp( lerp( RTD_ST_LAF, RTD_LAS, RTD_ST_IS) , lerp( RTD_ST_LAF, lerp( lerp( RTD_MCIALO_IL * RTD_HL , RTD_GLO_COL , RTD_GLO_OTHERS) , RTD_RL_LARL_OO , RTD_RL_CHE_1 ) * lightColor.rgb, RTD_ST) , RTD_SS ) ; + #else + half3 RTD_R_OFF_OTHERS = (half3)0.0; + #endif + + + //RT_R + half3 RTD_R = RT_R(input.uv, viewReflectDirection, viewDirection, normalDirection, RTD_TEX_COL, RTD_R_OFF_OTHERS, positionWS); + //== + + + //RT_SL + half3 RTD_SL_CHE_1; + half3 RTD_SL = RT_SL(input.uv, positionWS, normalDirection, RTD_SL_OFF_OTHERS, RTD_TEX_COL, RTD_R, RTD_SL_CHE_1); + //== + + + //RT_RL_SUB1 + half3 RTD_RL = RT_RL_SUB1(RTD_SL_CHE_1, RTD_RL_LARL_OO, RTD_RL_MAIN); + //== + + + half3 RTD_CA_OFF_OTHERS = (RTD_RL + RTD_SL); + half3 main_light_output = RTD_CA_OFF_OTHERS; + + + //========/ + //========/ + #ifndef N_F_OFLMB_ON + + #ifdef _ADDITIONAL_LIGHTS + + #if N_F_EAL_ON + + uint pixelLightCount = GetAdditionalLightsCount(); + + #if USE_FORWARD_PLUS + + InputData inputData = (InputData)0; + inputData.positionWS = positionWS; + inputData.normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(input.positionCS); + + for (uint lightIndex = 0; lightIndex < min(URP_FP_DIRECTIONAL_LIGHTS_COUNT, MAX_VISIBLE_LIGHTS); lightIndex++) + { + Light light = GetAdditionalLight(lightIndex, input.posWorld.xyz, shadowMask); + + #ifdef _LIGHT_LAYERS + if (IsMatchingLightLayer(light.layerMask, meshRenderingLayers)) + #endif + { + #if N_F_USETLB_ON + A_L_O += RT_ADD_LI(light, input.bitangentWS, viewDirection, viewReflectDirection, positionWS, ss_col, RTD_TEX_COL, _MC_MCP, _MainTex_var, MCapOutP, _RTD_MVCOL, RTD_VD_Cal, normalDirection, RTD_SON, RTD_PT_COL, RTD_SCT, RTD_OSC, RTD_PT, RTD_MCIALO_IL, input.uv, input.vertexColor, isFrontFace, lightIndex); + #else + A_L_O = max(RT_ADD_LI(light, input.bitangentWS, viewDirection, viewReflectDirection, positionWS, ss_col, RTD_TEX_COL, _MC_MCP, _MainTex_var, MCapOutP, _RTD_MVCOL, RTD_VD_Cal, normalDirection, RTD_SON, RTD_PT_COL, RTD_SCT, RTD_OSC, RTD_PT, RTD_MCIALO_IL, input.uv, input.vertexColor, isFrontFace, lightIndex),A_L_O); + #endif + } + } + + #endif + + LIGHT_LOOP_BEGIN(pixelLightCount) + + Light light = GetAdditionalLight(lightIndex, input.posWorld.xyz, shadowMask); + + #ifdef _LIGHT_LAYERS + if (IsMatchingLightLayer(light.layerMask, meshRenderingLayers)) + #endif + { + #if N_F_USETLB_ON + A_L_O += RT_ADD_LI(light, input.bitangentWS, viewDirection, viewReflectDirection, positionWS, ss_col, RTD_TEX_COL, _MC_MCP, _MainTex_var, MCapOutP, _RTD_MVCOL, RTD_VD_Cal, normalDirection, RTD_SON, RTD_PT_COL, RTD_SCT, RTD_OSC, RTD_PT, RTD_MCIALO_IL, input.uv, input.vertexColor, isFrontFace, lightIndex); + #else + A_L_O = max(RT_ADD_LI(light, input.bitangentWS, viewDirection, viewReflectDirection, positionWS, ss_col, RTD_TEX_COL, _MC_MCP, _MainTex_var, MCapOutP, _RTD_MVCOL, RTD_VD_Cal, normalDirection, RTD_SON, RTD_PT_COL, RTD_SCT, RTD_OSC, RTD_PT, RTD_MCIALO_IL, input.uv, input.vertexColor, isFrontFace, lightIndex),A_L_O); + #endif + } + + LIGHT_LOOP_END + + #endif + + #endif + + #endif + //========/ + //========/ + + #ifndef N_F_OFLMB_ON + #if N_F_USETLB_ON + color = main_light_output + A_L_O; + #else + color = max (main_light_output,A_L_O); + #endif + #else + color = main_light_output; + #endif + + #if N_F_TRANS_ON + float Trans_Val = 1.0; + #ifndef N_F_CO_ON + Trans_Val = RTD_TRAN_OPA_Sli; + #else + #if N_F_ATC_ON + Trans_Val = _MainTex_var.a; + #else + Trans_Val = 1.0; + #endif + #endif + #else + float Trans_Val = 1.0; + #endif + + + //RT_CA + float3 RTD_CA = RT_CA(color * SSAmOc + GLO_OUT); + //== + +//SSOL_NUs +//SSOL +//#ifdef UNITY_COLORSPACE_GAMMA//SSOL +//_OutlineColor=float4(LinearToGamma22(_OutlineColor.rgb),_OutlineColor.a);//SSOL +//#endif//SSOL +//#if N_F_O_ON//SSOL +//float3 SSOLi=(float3)EdgDet(sceneUVs.xy);//SSOL +//#if N_F_O_MOTTSO_ON//SSOL +//float3 Init_FO=((RTD_CA*RTD_SON_CHE_1))*lerp((float3)1.0,_OutlineColor.rgb,SSOLi);//SSOL +//#else//SSOL +//float3 Init_FO=lerp((RTD_CA*RTD_SON_CHE_1),_OutlineColor.rgb,SSOLi);//SSOL +//#endif//SSOL +//#else//SSOL +float3 Init_FO=RTD_CA*RTD_SON_CHE_1; +//#endif//SSOL + + + //RT_NFD + #ifdef N_F_NFD_ON + RT_NFD(input.positionCS.xy); + #endif + //== + + + float fogFactor = input.positionWSAndFogFactor.w; + + color = MixFog(Init_FO, fogFactor); + outColor = half4( color , Trans_Val); + + #ifdef _WRITE_RENDERING_LAYERS + uint renderingLayers = GetMeshRenderingLayer(); + outRenderingLayers = float4(EncodeMeshRenderingLayer(renderingLayers), 0, 0, 0); + #endif + + } + + ENDHLSL + + } + + Pass + { + Name "ShadowCaster" + Tags{"LightMode" = "ShadowCaster"} + + Cull [_Culling] + ZWrite On + ZTest LEqual + ColorMask 0 + + HLSLPROGRAM + #pragma only_renderers d3d9 d3d11 vulkan glcore gles3 gles metal xboxone ps4 xboxseries playstation switch webgpu //ounce //switch2 +#pragma target 2.0 //targetsc + + #pragma multi_compile_instancing + + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" + + #pragma shader_feature_local_fragment N_F_TRANS_ON + #pragma shader_feature_local_fragment N_F_SIMTRANS_ON + #pragma shader_feature_local_vertex N_F_DDMD_ON + + #pragma shader_feature_local_fragment N_F_TRANSAFFSHA_ON + #pragma shader_feature_local_fragment N_F_CO_ON + #pragma shader_feature_local_fragment N_F_NFD_ON + #pragma shader_feature_local_fragment N_F_TP_ON + #pragma shader_feature_local_fragment N_F_SCO_ON + #pragma shader_feature_local_vertex N_F_SE_ON + + #pragma multi_compile_vertex _ _CASTING_PUNCTUAL_LIGHT_SHADOW + #pragma multi_compile_fragment _ LOD_FADE_CROSSFADE + + #pragma vertex ShadowPassVertex + #pragma fragment ShadowPassFragment + + #include "Packages/realtoon/RealToon/RealToon Shaders/RealToon Core/URP/RT_URP_Core.hlsl" + + #if defined(LOD_FADE_CROSSFADE) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl" + #endif + + float3 _LightDirection; + float3 _LightPosition; + + struct Attributes + { + + float4 positionOS : POSITION; + float3 normalOS : NORMAL; + float2 texcoord : TEXCOORD0; + #if defined(UNITY_DOTS_INSTANCING_ENABLED) + + #ifndef N_F_DDMD_ON + float4 tangentOS : TANGENT; +float4 weights : BLENDWEIGHTS;//DOTS_LiBleSki_SC +uint4 indices : BLENDINDICES;//DOTS_LiBleSki_SC +//uint vertexID : SV_VertexID;//DOTS_CompDef_SC + #endif + + #endif + UNITY_VERTEX_INPUT_INSTANCE_ID + + }; + + struct Varyings + { + + float2 uv : TEXCOORD0; + float4 projPos : TEXCOORD1; + float3 normalWS : TEXCOORD2; + float3 positionWS : TEXCOORD3; + float4 positionCS : SV_POSITION; + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + + }; + + float4 GetShadowPositionHClip(Attributes input, float3 positionWS, float3 normalWS) + { + + #if _CASTING_PUNCTUAL_LIGHT_SHADOW + float3 lightDirectionWS = normalize(_LightPosition - positionWS); + #else + float3 lightDirectionWS = _LightDirection; + #endif + + float invNdotL = 1.0 - saturate(dot(lightDirectionWS, normalWS)); + float scale = invNdotL * _ShadowBias.y; + + positionWS = lightDirectionWS * _ShadowBias.xxx + positionWS; + positionWS = normalWS * scale.xxx + positionWS; + float4 positionCS = TransformWorldToHClip( positionWS ); + + #if UNITY_REVERSED_Z + positionCS.z = min(positionCS.z, UNITY_NEAR_CLIP_VALUE) + -_ReduSha * 0.01; + #else + positionCS.z = max(positionCS.z, UNITY_NEAR_CLIP_VALUE) + _ReduSha * 0.01; + #endif + + + return positionCS; + + } + + Varyings ShadowPassVertex(Attributes input) + { + + Varyings output = (Varyings)0; + UNITY_SETUP_INSTANCE_ID (input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + output.uv = input.texcoord; + + #if defined(UNITY_DOTS_INSTANCING_ENABLED) + + #ifdef N_F_DDMD_ON + + float4 _LBS_CD_Position = input.positionOS; + float3 _LBS_CD_Normal = input.normalOS; + //float4 _LBS_CD_Tangent = input.tangentOS; //not currently needed + + #else + + float4 _LBS_CD_Position = 0; + float3 _LBS_CD_Normal = 0; + float4 _LBS_CD_Tangent = 0; + +DOTS_LiBleSki(input.indices, input.weights, input.positionOS.xyz, input.normalOS.xyz, input.tangentOS.xyz, (float3)_LBS_CD_Position, _LBS_CD_Normal, (float3)_LBS_CD_Tangent);//DOTS_LiBleSki_SC +//DOTS_CompDef(input.vertexID, (float3)_LBS_CD_Position, _LBS_CD_Normal, (float3)_LBS_CD_Tangent);//DOTS_CompDef_SC + + #endif + + #else + float4 _LBS_CD_Position = input.positionOS; + float3 _LBS_CD_Normal = input.normalOS; + //float4 _LBS_CD_Tangent = input.tangentOS; //not currently needed + #endif + + VertexPositionInputs vertexInput = GetVertexPositionInputs(_LBS_CD_Position.xyz); + + + //RT_SE + #if N_F_SE_ON + input.positionOS = RT_SE(vertexInput.positionWS, input.positionOS); + _LBS_CD_Position = input.positionOS; + #endif + //== + + + //output.positionCS = vertexInput.positionCS; //might remove + output.positionWS = TransformObjectToWorld(_LBS_CD_Position.xyz); + output.normalWS = TransformObjectToWorldDir(_LBS_CD_Normal); + output.projPos = ComputeScreenPos (output.positionCS); + output.positionCS = GetShadowPositionHClip(input, output.positionWS, output.normalWS); + + return output; + + } + + half4 ShadowPassFragment(Varyings input) : SV_TARGET + { + + UNITY_SETUP_INSTANCE_ID (input); + + float4 objPos = mul ( GetObjectToWorldMatrix(), float4(0.0,0.0,0.0,1.0) ); + float2 sceneUVs = (input.projPos.xy / input.projPos.w); + half RTD_OB_VP_CAL = distance(objPos.rgb,_WorldSpaceCameraPos); + half2 RTD_VD_Cal = (float2((sceneUVs.x * 2.0 - 1.0)*(_ScreenParams.r/_ScreenParams.g), sceneUVs.y * 2.0 - 1.0).rg*RTD_OB_VP_CAL); + + + //** + half2 _TexturePatternStyle_var; + if (!_TexturePatternStyle) + { + _TexturePatternStyle_var = input.uv; + } + else + { + _TexturePatternStyle_var = RTD_VD_Cal; + } + //** + + + #ifdef N_F_TP_ON + half4 _MainTex_var = RT_Tripl_Default(_MainTex, sampler_MainTex, input.positionWS, input.normalWS); + #else + half4 _MainTex_var = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, TRANSFORM_TEX(_TexturePatternStyle_var, _MainTex)); + #endif + + + #if N_F_TRANSAFFSHA_ON + + + //RT_TRANS_CO + half RTD_TRAN_OPA_Sli; + half RTD_CO; + half3 GLO_OUT; + RT_TRANS_CO(input.uv, _MainTex_var, _MainTex_var.a, RTD_TRAN_OPA_Sli, RTD_CO, input.positionWS, input.normalWS, input.positionCS.xy, GLO_OUT); + + #if N_F_TRANS_ON + #ifndef N_F_CO_ON + float dither = tex3D(_DitherMaskLOD, float3(input.positionCS.xy * 0.25, RTD_TRAN_OPA_Sli * 0.99)).a; + clip(saturate((0.74 > 0.5 ? (1.0 - (1.0 - 2.0 * (0.74 - 0.5)) * (1.0 - dither)) : (2.0 * 0.74 * dither))) - 0.5); + #endif + #endif + //== + + + #endif + + + //RT_NFD + #ifdef N_F_NFD_ON + RT_NFD(input.positionCS.xy); + #endif + //== + + + #ifdef LOD_FADE_CROSSFADE + LODFadeCrossFade(input.positionCS); + #endif + + return 0; + } + + ENDHLSL + } + + Pass + { + + Name "GBuffer" + Tags{"LightMode" = "UniversalGBuffer"} + + Cull [_Culling] + ZWrite[_ZWrite] + ZTest LEqual + +/*//G_ST + Stencil { + Ref[_RefVal] + Comp [_Compa] + Pass [_Oper] + Fail [_Oper] + } +//G_ST_En*/ + + HLSLPROGRAM + + #pragma only_renderers d3d9 d3d11 vulkan glcore gles3 gles metal xboxone ps4 xboxseries playstation switch webgpu //ounce //switch2 + #pragma target 4.5 + + #pragma multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN + #pragma multi_compile _ _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHTS + #pragma multi_compile _ EVALUATE_SH_MIXED EVALUATE_SH_VERTEX + #pragma multi_compile_fragment _ _ADDITIONAL_LIGHT_SHADOWS + #pragma multi_compile_fragment _ _REFLECTION_PROBE_BLENDING + #pragma multi_compile_fragment _ _REFLECTION_PROBE_BOX_PROJECTION + #pragma multi_compile_fragment _ _SHADOWS_SOFT _SHADOWS_SOFT_LOW _SHADOWS_SOFT_MEDIUM _SHADOWS_SOFT_HIGH + #pragma multi_compile_fragment _ _SCREEN_SPACE_OCCLUSION + #pragma multi_compile_fragment _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3 + #pragma multi_compile_fragment _ _LIGHT_COOKIES + #pragma multi_compile _ _LIGHT_LAYERS + #pragma multi_compile_fragment _ _RENDER_PASS_ENABLED + + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/RenderingLayers.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ProbeVolumeVariants.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/UnityGBuffer.hlsl" + + #pragma multi_compile _ LIGHTMAP_SHADOW_MIXING + #pragma multi_compile _ SHADOWS_SHADOWMASK + #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ DYNAMICLIGHTMAP_ON + #pragma multi_compile _ USE_LEGACY_LIGHTMAPS + #pragma multi_compile _ LOD_FADE_CROSSFADE + #pragma multi_compile_fragment _ _GBUFFER_NORMALS_OCT + + #pragma multi_compile_fog + #pragma multi_compile_instancing + #pragma instancing_options renderinglayer + + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" + + #pragma vertex LitPassVertex + #pragma fragment LitPassFragment + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/realtoon/RealToon/RealToon Shaders/RealToon Core/URP/RT_URP_Core.hlsl" + + #if defined(LOD_FADE_CROSSFADE) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl" + #endif + + #pragma shader_feature_local_fragment N_F_USETLB_ON + #pragma shader_feature_local_fragment N_F_TRANS_ON + #pragma shader_feature_local_fragment N_F_SIMTRANS_ON + #pragma shader_feature_local_vertex N_F_DDMD_ON + + #pragma shader_feature_local_fragment N_F_O_ON + #pragma shader_feature_local_fragment N_F_O_MOTTSO_ON + #pragma shader_feature_local_fragment N_F_MC_ON + #pragma shader_feature_local_fragment N_F_NM_ON + #pragma shader_feature_local_fragment N_F_CO_ON + #pragma shader_feature_local_fragment N_F_SL_ON + #pragma shader_feature_local_fragment N_F_CA_ON + #pragma shader_feature_local_fragment N_F_GLO_ON + #pragma shader_feature_local_fragment N_F_GLOT_ON + #pragma shader_feature_local_fragment N_F_SS_ON + #pragma shader_feature_local_fragment N_F_SCT_ON + #pragma shader_feature_local_fragment N_F_ST_ON + #pragma shader_feature_local_fragment N_F_STIS_ON + #pragma shader_feature_local_fragment N_F_STIAL_ON + #pragma shader_feature_local N_F_SON_ON + #pragma shader_feature_local_fragment N_F_PT_ON + #pragma shader_feature_local_fragment N_F_RELGI_ON + #pragma shader_feature_local_fragment N_F_CLD_ON + #pragma shader_feature_local_fragment N_F_R_ON + #pragma shader_feature_local_fragment N_F_FR_ON + #pragma shader_feature_local_fragment N_F_RL_ON + #pragma shader_feature_local_fragment N_F_HDLS_ON + #pragma shader_feature_local_fragment N_F_HPSS_ON + #pragma shader_feature_local_fragment N_F_EAL_ON + #pragma shader_feature_local_fragment N_F_NLASOBF_ON + #pragma shader_feature_local_fragment N_F_OFLMB_ON + #pragma shader_feature_local_fragment N_F_ESSAO_ON + #pragma shader_feature_local_fragment N_F_RDC_ON + #pragma shader_feature_local_fragment N_F_COEDGL_ON + #pragma shader_feature_local_fragment N_F_NFD_ON + #pragma shader_feature_local_fragment N_F_TP_ON + #pragma shader_feature_local_vertex N_F_PA_ON + #pragma shader_feature_local_vertex N_F_SE_ON + #pragma shader_feature_local_fragment N_F_SCO_ON + #pragma shader_feature_local_fragment N_F_STSDFM_ON + #pragma shader_feature_local_fragment N_F_ANIS_ON + #pragma shader_feature_local_fragment N_F_LLI_ON + #pragma shader_feature_local_fragment N_F_SLMM_ON + + #define _EMISSION + + struct Attributes + { + + float4 positionOS : POSITION; + float3 normalOS : NORMAL; + float4 tangentOS : TANGENT; + float2 uv : TEXCOORD0; + float2 staticLightmapUV : TEXCOORD1; + float2 dynamicLightmapUV : TEXCOORD2; + float4 vertexColor : COLOR; + #if defined(UNITY_DOTS_INSTANCING_ENABLED) + + #ifndef N_F_DDMD_ON +float4 weights : BLENDWEIGHTS;//DOTS_LiBleSki_GB +uint4 indices : BLENDINDICES;//DOTS_LiBleSki_GB +//uint vertexID : SV_VertexID;//DOTS_CompDef_GB + #endif + + #endif + UNITY_VERTEX_INPUT_INSTANCE_ID + + }; + + struct Varyings + { + + float2 uv : TEXCOORD0; + float4 positionWSAndFogFactor : TEXCOORD1; + float3 normalWS : TEXCOORD2; + float3 tangentWS : TEXCOORD3; + float3 bitangentWS : TEXCOORD4; + float4 posWorld : TEXCOORD5; + +#if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD6; +#endif + float4 projPos : TEXCOORD7; + + float2 staticLightmapUV : TEXCOORD8; + #ifdef DYNAMICLIGHTMAP_ON + float2 dynamicLightmapUV : TEXCOORD9; + #endif + + float3 smoNorm : TEXCOORD10; + float4 vertexColor : COLOR; + float4 positionCS : SV_POSITION; + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + + }; + + Varyings LitPassVertex(Attributes input) + { + + Varyings output = (Varyings)0; + + UNITY_SETUP_INSTANCE_ID (input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if defined(UNITY_DOTS_INSTANCING_ENABLED) + + #ifdef N_F_DDMD_ON + + float4 _LBS_CD_Position = input.positionOS; + float3 _LBS_CD_Normal = input.normalOS; + float4 _LBS_CD_Tangent = input.tangentOS; + + #else + + float4 _LBS_CD_Position = 0; + float3 _LBS_CD_Normal = 0; + float4 _LBS_CD_Tangent = 0; + +DOTS_LiBleSki(input.indices, input.weights, input.positionOS.xyz, input.normalOS.xyz, input.tangentOS.xyz, (float3)_LBS_CD_Position, _LBS_CD_Normal, (float3)_LBS_CD_Tangent);//DOTS_LiBleSki_GB +//DOTS_CompDef(input.vertexID, (float3)_LBS_CD_Position, _LBS_CD_Normal, (float3)_LBS_CD_Tangent);//DOTS_CompDef_GB + + #endif + + #else + float4 _LBS_CD_Position = input.positionOS; + float3 _LBS_CD_Normal = input.normalOS; + float4 _LBS_CD_Tangent = input.tangentOS; + #endif + + VertexPositionInputs vertexInput = GetVertexPositionInputs(_LBS_CD_Position.xyz); + VertexNormalInputs vertexNormalInput = GetVertexNormalInputs(_LBS_CD_Normal, _LBS_CD_Tangent); + + + //RT_SE + #if N_F_SE_ON + input.positionOS = RT_SE(vertexInput.positionWS, input.positionOS); + _LBS_CD_Position = input.positionOS; + #endif + //== + + + //RT_PA + #if N_F_PA_ON + output.positionCS = mul(RT_PA(vertexInput.positionWS), float4(_LBS_CD_Position.xyz,1.0) ); + #else + output.positionCS = vertexInput.positionCS; + #endif + //== + + + output.uv = input.uv; + output.vertexColor = input.vertexColor; + + output.normalWS = vertexNormalInput.normalWS; + output.tangentWS = vertexNormalInput.tangentWS; + output.bitangentWS = vertexNormalInput.bitangentWS; + + float fogFactor = ComputeFogFactor(vertexInput.positionCS.z); + output.positionWSAndFogFactor = float4(vertexInput.positionWS, fogFactor); + + output.posWorld = float4(vertexInput.positionWS, 1.0); + output.projPos = ComputeScreenPos (output.positionCS); + + OUTPUT_LIGHTMAP_UV(input.staticLightmapUV, unity_LightmapST, output.staticLightmapUV); + #ifdef DYNAMICLIGHTMAP_ON + output.dynamicLightmapUV = input.dynamicLightmapUV.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #endif + + + + //RT_SON + #if N_F_SON_ON + output.smoNorm = GetAbsolutePositionWS(vertexInput.positionWS); + #endif + //== + + +#if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + + output.shadowCoord = GetShadowCoord(vertexInput); +#endif + + return output; + } + + void LitPassFragment( + Varyings input + , out half4 GBuffer0 : SV_Target0 + , out half4 GBuffer1 : SV_Target1 + , out half4 GBuffer2 : SV_Target2 + , out half4 GBuffer3 : SV_Target3 + , out half4 GBuffer4 : SV_Target4 + , out half4 Shadow_Mask : SV_Target6 + , float facing : VFACE + #ifdef _WRITE_RENDERING_LAYERS + , out float4 outRenderingLayers : SV_Target5 + #endif + ) + { + + UNITY_SETUP_INSTANCE_ID (input); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input); + + + //RT_SSAO + half SSAmOc_GOF; + #if N_F_ESSAO_ON + SSAmOc_GOF = 1; + #else + SSAmOc_GOF = 0; + #endif + //== + + + GBuffer0 = half4(0.0,0.0,0.0,1); + GBuffer1 = half4(1.0,1.0,1.0,SSAmOc_GOF); + GBuffer4 = half4(0.0,0.0,0.0,0.0); + Shadow_Mask = half4(0.0,0.0,0.0,0.0); + + float3 positionWS = input.positionWSAndFogFactor.xyz; + + #if defined(DYNAMICLIGHTMAP_ON) + float2 RTD_LIG_UV = input.dynamicLightmapUV; + #else + float2 RTD_LIG_UV = input.staticLightmapUV; + #endif + + //========= + float4 shadow_mask = SAMPLE_SHADOWMASK(RTD_LIG_UV); + + #if defined(SHADOWS_SHADOWMASK) && defined(LIGHTMAP_ON) + half4 shadowMask = shadow_mask; + Shadow_Mask = shadowMask; + #elif !defined (LIGHTMAP_ON) + half4 shadowMask = unity_ProbesOcclusion; + #else + half4 shadowMask = half4(1.0, 1.0, 1.0, 1.0); + Shadow_Mask = shadowMask; + #endif + //========== + + half3 color = (half3)0.0; + float3 A_L_O = (float3)0.0; + //float3 baked_GI = (float3)1.0; // Remove + + half isFrontFace = ( facing >= 0 ? 1 : 0 ); + float4 objPos = mul ( GetObjectToWorldMatrix(), float4(0.0,0.0,0.0,1.0) ); + float2 sceneUVs = (input.projPos.xy / input.projPos.w); + half RTD_OB_VP_CAL = distance(objPos.rgb, _WorldSpaceCameraPos); + half2 RTD_VD_Cal = (float2((sceneUVs.x * 2.0 - 1.0) * (_ScreenParams.r / _ScreenParams.g), sceneUVs.y * 2.0 - 1.0).rg * RTD_OB_VP_CAL); + + + //** + half2 RTD_TC_TP_OO; + if (!_TexturePatternStyle) + { + RTD_TC_TP_OO = input.uv; + } + else + { + RTD_TC_TP_OO = RTD_VD_Cal; + } + //** + + + input.normalWS = normalize(input.normalWS); + float3x3 tangentTransform = float3x3( input.tangentWS, input.bitangentWS, input.normalWS); + + + //RT_NM + float3 normalLocal = RT_NM(input.uv, positionWS, tangentTransform, input.normalWS); + //== + + + float3 viewDirection = normalize(_WorldSpaceCameraPos.xyz - input.posWorld.xyz); + float3 normalDirection = normalize(mul( normalLocal, tangentTransform )); + + #if defined(_GBUFFER_NORMALS_OCT) + float3 normalWS = normalize(mul( normalLocal, tangentTransform )); + float2 octNormalWS = PackNormalOctQuadEncode(normalWS); + float2 remappedOctNormalWS = saturate(octNormalWS * 0.5 + 0.5); + half3 packedNormalWS = PackFloat2To888(remappedOctNormalWS); + GBuffer2 = half4(packedNormalWS,0.0); + #else + GBuffer2 = half4(normalDirection,0.0); + #endif + + float3 viewReflectDirection = reflect( -viewDirection, normalDirection ); + + #ifdef N_F_TP_ON + half4 _MainTex_var = RT_Tripl_Default(_MainTex, sampler_MainTex, positionWS, normalDirection); + #else + half4 _MainTex_var = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, TRANSFORM_TEX(RTD_TC_TP_OO, _MainTex)); + #endif + + #if defined(N_F_RDC_ON) + #if defined(_DBUFFER) && (!defined(N_F_TRANS_ON) || defined(N_F_CO_ON)) + RT_DC(input.positionCS, _MainTex_var, input.normalWS); + #endif + #endif + + #ifdef LOD_FADE_CROSSFADE + LODFadeCrossFade(input.positionCS); + #endif + + half3 _RTD_MVCOL; + if (!_MVCOL) + { + _RTD_MVCOL = (half3)1.0; + } + else + { + _RTD_MVCOL = input.vertexColor.rgb; + } + + uint meshRenderingLayers = GetMeshRenderingLayer(); + + + // + #ifdef UNITY_COLORSPACE_GAMMA + _OverallShadowColor = float4(LinearToGamma22(_OverallShadowColor.rgb), _OverallShadowColor.a); + #endif + + #ifndef N_F_OFLMB_ON + half3 RTD_OSC = (_OverallShadowColor.rgb*_OverallShadowColorPower); + #else + half3 RTD_OSC = (half3)0.0; + #endif + // + + + //RT_MCAP + half3 MCapOutP = RT_MCAP(input.uv, normalDirection); + //== + + + // + #ifdef UNITY_COLORSPACE_GAMMA + _MainColor = float4(LinearToGamma22(_MainColor.rgb),_MainColor.a); + #endif + // + half3 _MC_MCP = (_MainColor.rgb * _MaiColPo); + + + //RT_MCAP_SUB1 + half3 RTD_TEX_COL; + half3 RTD_MCIALO_IL = RT_MCAP_SUB1(MCapOutP, _MainTex_var, _RTD_MVCOL, RTD_TEX_COL); + //== + + + //RT_TRANS_CO + half RTD_TRAN_OPA_Sli; + half RTD_CO; + half3 GLO_OUT = (half3)0.0; + RT_TRANS_CO(input.uv, _MainTex_var, _MainTex_var.a, RTD_TRAN_OPA_Sli, RTD_CO, positionWS, normalDirection, input.positionCS.xy, GLO_OUT); + //== + + + //RT_SON + float3 RTD_SON_CHE_1; + float3 RTD_SON = RT_SON(input.vertexColor, input.smoNorm, normalDirection, RTD_SON_CHE_1); + //== + + + //RT_RELGI + float3 RTD_GI_FS_OO = RT_RELGI(RTD_SON); + //== + + + //RT_SCT + half3 RTD_SCT = RT_SCT(input.uv, positionWS, normalDirection, RTD_MCIALO_IL); + //== + + + //RT_PT + half3 RTD_PT_COL; + half RTD_PT = RT_PT(RTD_VD_Cal, RTD_PT_COL); + //== + + + // + #ifdef UNITY_COLORSPACE_GAMMA + _SelfShadowRealTimeShadowColor = float4(LinearToGamma22(_SelfShadowRealTimeShadowColor.rgb), _SelfShadowRealTimeShadowColor.a); + #endif + + #ifndef N_F_OFLMB_ON + half3 ss_col = lerp( RTD_PT_COL, (_SelfShadowRealTimeShadowColor.rgb * _SelfShadowRealTimeShadowColorPower) * RTD_OSC * RTD_SCT, RTD_PT); + #else + half3 ss_col = (half3)0.0; + #endif + // + + + //========/ + //========/ + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + Light mainLight = GetMainLight(input.shadowCoord, positionWS, shadowMask); + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + Light mainLight = GetMainLight(TransformWorldToShadowCoord(positionWS), positionWS, shadowMask); + #else + Light mainLight = GetMainLight(); + #endif + + half3 mainliCol = 0.0; + half mainliSAtt = 0.0; + float3 mainliDir = float3(0.0,0.0,0.0); + + #ifdef _LIGHT_LAYERS + if (IsMatchingLightLayer(mainLight.layerMask, meshRenderingLayers)) + #endif + { + #ifdef N_F_LLI_ON + mainliCol = clamp(mainLight.color.rgb,_LLI_Min,_LLI_Max); + #else + mainliCol = mainLight.color.rgb; + #endif + + mainliSAtt = mainLight.shadowAttenuation; + mainliDir = mainLight.direction; + } + //========/ + //========/ + + + #ifndef N_F_OFLMB_ON + #if N_F_NLASOBF_ON + half3 lightColor = lerp( (float3)0.0 , mainliCol,isFrontFace); + #else + half3 lightColor = mainliCol; + #endif + #else + half3 lightColor = (half3)0.0; + #endif + + + + #ifndef N_F_OFLMB_ON + #if N_F_HDLS_ON + half attenuation = 1.0; + #else + half dlshmin = lerp( 0.0, 0.6 ,_ShadowHardness); + half dlshmax = lerp( 1.0, 0.6 ,_ShadowHardness); + + #if N_F_NLASOBF_ON + half FB_Check = lerp( 1.0 , mainliSAtt ,isFrontFace); + #else + half FB_Check = mainliSAtt; + #endif + + half attenuation = smoothstep(dlshmin,dlshmax,FB_Check); + #endif + #else + half attenuation = 1.0; + #endif + + + + #ifndef N_F_OFLMB_ON + float3 lightDirection = mainliDir; + float3 halfDirection = normalize(viewDirection + lightDirection); + #else + float3 lightDirection = (float3)0.0; + float3 halfDirection = (float3)0.0; + #endif + + + + //RT_CLD + float3 RTD_CLD = RT_CLD(lightDirection); + //== + + + #ifndef N_F_OFLMB_ON + + //** + half3 RTD_ST_SS_AVD_OO; + if (!_SelfShadowShadowTAtViewDirection) + { + RTD_ST_SS_AVD_OO = RTD_CLD; + } + else + { + RTD_ST_SS_AVD_OO = viewDirection; + } + //** + + + half RTD_NDOTL = 0.5 * dot(RTD_ST_SS_AVD_OO, float3(RTD_SON.x, RTD_SON.y * (1-_LigIgnoYNorDir), RTD_SON.z)) + 0.5; + half RTD_LVLC = RTD_LVLC_F(lightColor.rgb); + half3 lig_col_int = (_LightIntensity * lightColor.rgb); + + //** + half3 RTD_LAS; + if (!_LightAffectShadow) + { + RTD_LAS = ss_col * RTD_LVLC; + } + else + { + RTD_LAS = ss_col * lig_col_int; + } + //** + + + #else + half3 RTD_ST_SS_AVD_OO = (half3)0.0; + half RTD_NDOTL = 0.0; + half RTD_LVLC = 0.0; + half3 lig_col_int = (half3)0.0; + half3 RTD_LAS = (half3)0.0; + #endif + + + // + #ifdef UNITY_COLORSPACE_GAMMA + _HighlightColor = float4(LinearToGamma22(_HighlightColor.rgb), _HighlightColor.a); + #endif + + #ifndef _N_F_OFLMB + half3 RTD_HL = (_HighlightColor.rgb*_HighlightColorPower+_DirectionalLightIntensity); + #else + half3 RTD_HL = (half3)0.0; + #endif + // + + + //** + half3 RTD_MC_SM_TC_OO; + if (!_SPECMODE) + { + RTD_MC_SM_TC_OO = RTD_TEX_COL * _MC_MCP; + } + else + { + RTD_MC_SM_TC_OO = RTD_TEX_COL + _MC_MCP; + } + //** + + + //** + half3 RTD_MCIALO_OO; + if (!_MCIALO) + { + RTD_MCIALO_OO = RTD_TEX_COL; + } + else + { + RTD_MCIALO_OO = lerp(RTD_MC_SM_TC_OO, _MainTex_var.rgb * MCapOutP * _RTD_MVCOL * 0.7, clamp((RTD_LVLC * 1.0), 0.0, 1.0)); + } + //** + + + half3 RTD_MCIALO = RTD_MCIALO_OO; + + + //RT_GLO + half RTD_GLO; + half3 RTD_GLO_COL; + RT_GLO(input.uv, RTD_VD_Cal, halfDirection, input.bitangentWS, normalDirection, viewDirection, positionWS, RTD_GLO, RTD_GLO_COL); + half3 RTD_GLO_OTHERS = RTD_GLO; + //== + + + //RT_RL + half3 RTD_RL_LARL_OO; + half RTD_RL_MAIN; + half RTD_RL_CHE_1 = RT_RL(viewDirection, normalDirection, lightColor, RTD_RL_LARL_OO, RTD_RL_MAIN); + //== + + + //RT_ST + half3 RTD_SHAT_COL; + half RTD_STIAL; + half RTD_ST_IS; + half3 RTD_ST_LAF; + half RTD_ST = RT_ST(input.uv, positionWS, normalDirection, RTD_NDOTL, attenuation, lightDirection, RTD_LVLC, RTD_PT_COL, lig_col_int, RTD_SCT, RTD_OSC, RTD_PT, RTD_SHAT_COL, RTD_STIAL, RTD_ST_IS, RTD_ST_LAF); + //== + + + //RT_SS + half RTD_SS = RT_SS(input.vertexColor, RTD_NDOTL, attenuation, _MainLightShadowData.x); + //== + + + //RT_RELGI_SUB1 + half ref_int_val; + half3 RTD_SL_OFF_OTHERS = RT_RELGI_SUB1(RTD_LIG_UV, RTD_GI_FS_OO, RTD_SHAT_COL, RTD_MCIALO, RTD_STIAL, mainLight, normalDirection, positionWS, viewDirection, input.positionCS.xy ); + //== + + + #ifndef N_F_OFLMB_ON + half3 RTD_R_OFF_OTHERS = lerp( lerp( RTD_ST_LAF, RTD_LAS, RTD_ST_IS) , lerp( RTD_ST_LAF, lerp( lerp( RTD_MCIALO_IL * RTD_HL , RTD_GLO_COL , RTD_GLO_OTHERS) , RTD_RL_LARL_OO , RTD_RL_CHE_1 ) * lightColor.rgb, RTD_ST) , RTD_SS ) ; + #else + half3 RTD_R_OFF_OTHERS = (half3)0.0; + #endif + + + + //RT_R + half3 RTD_R = RT_R(input.uv, viewReflectDirection, viewDirection, normalDirection, RTD_TEX_COL, RTD_R_OFF_OTHERS, positionWS); + //== + + + //RT_SL + half3 RTD_SL_CHE_1; + half3 RTD_SL = RT_SL(input.uv, positionWS, normalDirection, RTD_SL_OFF_OTHERS, RTD_TEX_COL, RTD_R, RTD_SL_CHE_1); + //== + + + //RT_RL_SUB1 + half3 RTD_RL = RT_RL_SUB1(RTD_SL_CHE_1, RTD_RL_LARL_OO, RTD_RL_MAIN); + //== + + + half3 RTD_CA_OFF_OTHERS = (RTD_RL + RTD_SL); + half3 main_light_output = RTD_CA_OFF_OTHERS; + + + //========/ + //========/ + #ifndef N_F_OFLMB_ON + + #ifdef _ADDITIONAL_LIGHTS + + #if N_F_EAL_ON + + uint pixelLightCount = GetAdditionalLightsCount(); + + #if USE_FORWARD_PLUS + + InputData inputData = (InputData)0; + inputData.positionWS = positionWS; + inputData.normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(input.positionCS); + + for (uint lightIndex = 0; lightIndex < min(URP_FP_DIRECTIONAL_LIGHTS_COUNT, MAX_VISIBLE_LIGHTS); lightIndex++) + { + Light light = GetAdditionalLight(lightIndex, input.posWorld.xyz, shadowMask); + + #ifdef _LIGHT_LAYERS + if (IsMatchingLightLayer(light.layerMask, meshRenderingLayers)) + #endif + { + #if N_F_USETLB_ON + A_L_O += RT_ADD_LI(light, input.bitangentWS, viewDirection, viewReflectDirection, positionWS, ss_col, RTD_TEX_COL, _MC_MCP, _MainTex_var, MCapOutP, _RTD_MVCOL, RTD_VD_Cal, normalDirection, RTD_SON, RTD_PT_COL, RTD_SCT, RTD_OSC, RTD_PT, RTD_MCIALO_IL, input.uv, input.vertexColor, isFrontFace, lightIndex); + #else + A_L_O = max(RT_ADD_LI(light, input.bitangentWS, viewDirection, viewReflectDirection, positionWS, ss_col, RTD_TEX_COL, _MC_MCP, _MainTex_var, MCapOutP, _RTD_MVCOL, RTD_VD_Cal, normalDirection, RTD_SON, RTD_PT_COL, RTD_SCT, RTD_OSC, RTD_PT, RTD_MCIALO_IL, input.uv, input.vertexColor, isFrontFace, lightIndex),A_L_O); + #endif + } + } + #endif + + LIGHT_LOOP_BEGIN(pixelLightCount) + Light light = GetAdditionalLight(lightIndex, input.posWorld.xyz, shadowMask); + + #ifdef _LIGHT_LAYERS + if (IsMatchingLightLayer(light.layerMask, meshRenderingLayers)) + #endif + { + #if N_F_USETLB_ON + A_L_O += RT_ADD_LI(light, input.bitangentWS, viewDirection, viewReflectDirection, positionWS, ss_col, RTD_TEX_COL, _MC_MCP, _MainTex_var, MCapOutP, _RTD_MVCOL, RTD_VD_Cal, normalDirection, RTD_SON, RTD_PT_COL, RTD_SCT, RTD_OSC, RTD_PT, RTD_MCIALO_IL, input.uv, input.vertexColor, isFrontFace, lightIndex); + #else + A_L_O = max(RT_ADD_LI(light, input.bitangentWS, viewDirection, viewReflectDirection, positionWS, ss_col, RTD_TEX_COL, _MC_MCP, _MainTex_var, MCapOutP, _RTD_MVCOL, RTD_VD_Cal, normalDirection, RTD_SON, RTD_PT_COL, RTD_SCT, RTD_OSC, RTD_PT, RTD_MCIALO_IL, input.uv, input.vertexColor, isFrontFace, lightIndex),A_L_O); + #endif + } + LIGHT_LOOP_END + + #endif + + #endif + + #endif + //========/ + //========/ + + + #ifndef N_F_OFLMB_ON + #if N_F_USETLB_ON + color = main_light_output + A_L_O; + #else + color = max (main_light_output,A_L_O); + #endif + #else + color = main_light_output; + #endif + + + #if N_F_TRANS_ON + float Trans_Val = 1.0; + #ifndef N_F_CO_ON + Trans_Val = RTD_TRAN_OPA_Sli; + #else + Trans_Val = 1.0; + #endif + #else + float Trans_Val = 1.0; + #endif + + + //RT_CA + float3 RTD_CA = RT_CA(color + GLO_OUT); + +//SSOL_NU +//SSOL +//#ifdef UNITY_COLORSPACE_GAMMA//SSOL +//_OutlineColor=float4(LinearToGamma22(_OutlineColor.rgb),_OutlineColor.a);//SSOL +//#endif//SSOL +//#if N_F_O_ON//SSOL +//float3 SSOLi=(float3)EdgDet(sceneUVs.xy);//SSOL +//#if N_F_O_MOTTSO_ON//SSOL +//float3 Init_FO=((RTD_CA*RTD_SON_CHE_1))*lerp((float3)1.0,_OutlineColor.rgb,SSOLi);//SSOL +//#else//SSOL +//float3 Init_FO=lerp((RTD_CA*RTD_SON_CHE_1),_OutlineColor.rgb,SSOLi);//SSOL +//#endif//SSOL +//#else//SSOL +float3 Init_FO=RTD_CA*RTD_SON_CHE_1; +//#endif//SSOL + + + //RT_NFD + #ifdef N_F_NFD_ON + RT_NFD(input.positionCS.xy); + #endif + //== + + + float fogFactor = input.positionWSAndFogFactor.w; + + color = MixFog(Init_FO, fogFactor); + GBuffer3 = half4(color, Trans_Val); + + #ifdef _WRITE_RENDERING_LAYERS + uint renderingLayers = GetMeshRenderingLayer(); + outRenderingLayers = float4(EncodeMeshRenderingLayer(renderingLayers), 0, 0, 0); + #endif + + #if _RENDER_PASS_ENABLED + GBuffer4 = input.positionCS.z; + #endif + + } + + ENDHLSL + + } + + Pass + { + Name "DepthOnly" + Tags{"LightMode" = "DepthOnly"} + + Cull [_Culling] + ZWrite On + ColorMask R + + HLSLPROGRAM + + #pragma only_renderers d3d9 d3d11 vulkan glcore gles3 gles metal xboxone ps4 xboxseries playstation switch webgpu //ounce //switch2 +#pragma target 2.0 //targetdo + + #pragma vertex DepthOnlyVertex + #pragma fragment DepthOnlyFragment + + #pragma multi_compile_instancing + + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" + + #pragma multi_compile_fragment _ LOD_FADE_CROSSFADE + + #pragma shader_feature_local_fragment N_F_TRANS_ON + #pragma shader_feature_local_fragment N_F_SIMTRANS_ON + #pragma shader_feature_local_fragment N_F_TRANSAFFSHA_ON + #pragma shader_feature_local_fragment N_F_CO_ON + #pragma shader_feature_local_fragment N_F_SCO_ON + + #pragma shader_feature_local_vertex N_F_DDMD_ON + #pragma shader_feature_local_vertex N_F_PA_ON + #pragma shader_feature_local_vertex N_F_SE_ON + #pragma shader_feature_local_fragment N_F_NFD_ON + #pragma shader_feature_local_fragment N_F_TP_ON + + #include "Packages/realtoon/RealToon/RealToon Shaders/RealToon Core/URP/RT_URP_Core.hlsl" + + #if defined(LOD_FADE_CROSSFADE) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl" + #endif + + struct Attributes + { + float4 position : POSITION; + float2 texcoord : TEXCOORD0; + float3 normalOS : NORMAL; + float4 tangentOS : TANGENT; + #if defined(UNITY_DOTS_INSTANCING_ENABLED) + + #ifndef N_F_DDMD_ON +float4 weights : BLENDWEIGHTS;//DOTS_LiBleSki_DO +uint4 indices : BLENDINDICES;//DOTS_LiBleSki_DO +//uint vertexID : SV_VertexID;//DOTS_CompDef_DO + #endif + + #endif + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct Varyings + { + float2 uv : TEXCOORD0; + float4 projPos : TEXCOORD1; + float3 positionWS : TEXCOORD2; + float3 normalWS : TEXCOORD3; + float4 positionCS : SV_POSITION; + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + Varyings DepthOnlyVertex(Attributes input) + { + Varyings output = (Varyings)0; + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if defined(UNITY_DOTS_INSTANCING_ENABLED) + + #ifdef N_F_DDMD_ON + + float4 _LBS_CD_Position = input.position; + float3 _LBS_CD_Normal = input.normalOS; + float4 _LBS_CD_Tangent = input.tangentOS; + + #else + + float4 _LBS_CD_Position = 0; + float3 _LBS_CD_Normal = 0; + float4 _LBS_CD_Tangent = 0; + +DOTS_LiBleSki(input.indices, input.weights, input.position.xyz, input.normalOS.xyz, input.tangentOS.xyz, (float3)_LBS_CD_Position, _LBS_CD_Normal, (float3)_LBS_CD_Tangent);//DOTS_LiBleSki_DO +//DOTS_CompDef(input.vertexID, (float3)_LBS_CD_Position, _LBS_CD_Normal, (float3)_LBS_CD_Tangent);//DOTS_CompDef_DO + + #endif + + #else + float4 _LBS_CD_Position = input.position; + float3 _LBS_CD_Normal = input.normalOS; + float4 _LBS_CD_Tangent = input.tangentOS; + #endif + + VertexPositionInputs vertexInput = GetVertexPositionInputs(_LBS_CD_Position.xyz); + VertexNormalInputs normalInput = GetVertexNormalInputs(_LBS_CD_Normal, _LBS_CD_Tangent); + + output.positionWS = TransformObjectToWorld(_LBS_CD_Position.xyz); + output.normalWS = NormalizeNormalPerVertex(normalInput.normalWS); + output.uv = input.texcoord; + + + //RT_SE + #if N_F_SE_ON + input.position = RT_SE(output.positionWS, input.position); + _LBS_CD_Position = input.position; + #endif + //== + + + //RT_PA + #if N_F_PA_ON + output.positionCS = mul(RT_PA(output.positionWS), float4(_LBS_CD_Position.xyz,1.0) ); + #else + output.positionCS = TransformObjectToHClip(_LBS_CD_Position.xyz); + #endif + // + + + output.projPos = ComputeScreenPos (output.positionCS); + + return output; + } + + half4 DepthOnlyFragment(Varyings input) : SV_TARGET + { + UNITY_SETUP_INSTANCE_ID(input); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input); + + float4 objPos = mul ( GetObjectToWorldMatrix(), float4(0.0,0.0,0.0,1.0) ); + float2 sceneUVs = (input.projPos.xy / input.projPos.w); + half RTD_OB_VP_CAL = distance(objPos.rgb,_WorldSpaceCameraPos); + half2 RTD_VD_Cal = (float2((sceneUVs.x * 2.0 - 1.0)*(_ScreenParams.r/_ScreenParams.g), sceneUVs.y * 2.0 - 1.0).rg*RTD_OB_VP_CAL); + //float3x3 tangentTransform = float3x3( input.tangentWS, input.bitangentWS, input.normalWS); + + + //** + half2 _TexturePatternStyle_var; + if (!_TexturePatternStyle) + { + _TexturePatternStyle_var = input.uv; + } + else + { + _TexturePatternStyle_var = RTD_VD_Cal; + } + //** + + + #ifdef N_F_TP_ON + half4 _MainTex_var = RT_Tripl_Default(_MainTex, sampler_MainTex, input.positionWS, input.normalWS); + #else + half4 _MainTex_var = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, TRANSFORM_TEX(_TexturePatternStyle_var, _MainTex)); + #endif + + #if N_F_TRANSAFFSHA_ON + + //RT_TRANS_CO + half RTD_TRAN_OPA_Sli; + half RTD_CO; + half3 GLO_OUT; + RT_TRANS_CO(input.uv, _MainTex_var, _MainTex_var.a, RTD_TRAN_OPA_Sli, RTD_CO, input.positionWS, input.normalWS, input.positionCS.xy, GLO_OUT); + + #if N_F_TRANS_ON + #ifndef N_F_CO_ON + float dither = tex3D(_DitherMaskLOD, float3(input.positionCS.xy * 0.25, RTD_TRAN_OPA_Sli * 0.99)).a; + clip(saturate((0.74 > 0.5 ? (1.0 - (1.0 - 2.0 * (0.74 - 0.5)) * (1.0 - dither)) : (2.0 * 0.74 * dither))) - 0.5); + #endif + #endif + // + + #endif + + + //RT_NFD + #ifdef N_F_NFD_ON + RT_NFD(input.positionCS.xy); + #endif + //== + + + #ifdef LOD_FADE_CROSSFADE + LODFadeCrossFade(input.positionCS); + #endif + + return input.positionCS.z; + } + + + ENDHLSL + } + + Pass + { + Name "DepthNormals" + Tags{"LightMode" = "DepthNormals"} + + ZWrite On + Cull[_Culling] + + HLSLPROGRAM + + #pragma only_renderers d3d9 d3d11 vulkan glcore gles3 gles metal xboxone ps4 xboxseries playstation switch webgpu //ounce //switch2 +#pragma target 2.0 //targetdn + + #pragma vertex DepthNormalsVertex + #pragma fragment DepthNormalsFragment + + + #pragma shader_feature_local _NORMALMAP + #pragma shader_feature_local _PARALLAXMAP + #pragma shader_feature_local _ _DETAIL_MULX2 _DETAIL_SCALED + #pragma shader_feature_local_fragment _ALPHATEST_ON + #pragma shader_feature_local_fragment _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + + #pragma multi_compile_instancing + + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" + #pragma multi_compile_fragment _ LOD_FADE_CROSSFADE + + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/RenderingLayers.hlsl" + + #pragma shader_feature_local_fragment N_F_TRANS_ON + #pragma shader_feature_local_fragment N_F_SIMTRANS_ON + + #pragma shader_feature_local_fragment N_F_TRANSAFFSHA_ON + #pragma shader_feature_local_fragment N_F_CO_ON + + #pragma shader_feature_local_vertex N_F_DDMD_ON + #pragma shader_feature_local_fragment N_F_NFD_ON + #pragma shader_feature_local_fragment N_F_TP_ON + #pragma shader_feature_local_vertex N_F_PA_ON + #pragma shader_feature_local_vertex N_F_SE_ON + #pragma shader_feature_local_fragment N_F_SCO_ON + + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/SurfaceInput.hlsl" + #include "Packages/realtoon/RealToon/RealToon Shaders/RealToon Core/URP/RT_URP_Core.hlsl" + + #if defined(LOD_FADE_CROSSFADE) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl" + #endif + + struct Attributes + { + float4 positionOS : POSITION; + float3 normal : NORMAL; + float4 tangentOS : TANGENT; + float2 texcoord : TEXCOORD0; + #if defined(UNITY_DOTS_INSTANCING_ENABLED) + + #ifndef N_F_DDMD_ON +float4 weights : BLENDWEIGHTS;//DOTS_LiBleSki_DN +uint4 indices : BLENDINDICES;//DOTS_LiBleSki_DN +//uint vertexID : SV_VertexID;//DOTS_CompDef_DN + #endif + + #endif + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct Varyings + { + float4 positionCS : SV_POSITION; + float2 uv : TEXCOORD1; + float3 normalWS : TEXCOORD2; + float3 positionWS : TEXCOORD3; + float4 projPos : TEXCOORD4; + //float3 tangentWS : TEXCOORD5; + //float3 bitangentWS : TEXCOORD6; + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + Varyings DepthNormalsVertex(Attributes input) + { + Varyings output = (Varyings)0; + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if defined(UNITY_DOTS_INSTANCING_ENABLED) + + #ifdef N_F_DDMD_ON + + float4 _LBS_CD_Position = input.positionOS; + float3 _LBS_CD_Normal = input.normal; + float4 _LBS_CD_Tangent = input.tangentOS; + + #else + + float4 _LBS_CD_Position = 0; + float3 _LBS_CD_Normal = 0; + float4 _LBS_CD_Tangent = 0; + +DOTS_LiBleSki(input.indices, input.weights, input.positionOS.xyz, input.normal.xyz, input.tangentOS.xyz, (float3)_LBS_CD_Position, _LBS_CD_Normal, (float3)_LBS_CD_Tangent);//DOTS_LiBleSki_DN +//DOTS_CompDef(input.vertexID, (float3)_LBS_CD_Position, _LBS_CD_Normal, (float3)_LBS_CD_Tangent);//DOTS_CompDef_DN + + #endif + + #else + float4 _LBS_CD_Position = input.positionOS; + float3 _LBS_CD_Normal = input.normal; + float4 _LBS_CD_Tangent = input.tangentOS; + #endif + + VertexPositionInputs vertexInput = GetVertexPositionInputs(_LBS_CD_Position.xyz); + VertexNormalInputs normalInput = GetVertexNormalInputs(_LBS_CD_Normal, _LBS_CD_Tangent); + + output.positionWS = TransformObjectToWorld(_LBS_CD_Position.xyz); + output.normalWS = NormalizeNormalPerVertex(normalInput.normalWS); + //output.tangentWS = normalInput.tangentWS; + //output.bitangentWS = normalInput.bitangentWS; + output.uv = TRANSFORM_TEX(input.texcoord, _MainTex); + + + //RT_SE + #if N_F_SE_ON + input.positionOS = RT_SE(output.positionWS, input.positionOS); + _LBS_CD_Position = input.positionOS; + #endif + //== + + + //RT_PA + #if N_F_PA_ON + output.positionCS = mul(RT_PA(output.positionWS), float4(_LBS_CD_Position.xyz,1.0) ); + #else + output.positionCS = TransformObjectToHClip(_LBS_CD_Position.xyz); + #endif + //== + + + return output; + } + + void DepthNormalsFragment( + Varyings input + , out half4 outNormalWS : SV_Target0 + #ifdef _WRITE_RENDERING_LAYERS + , out float4 outRenderingLayers : SV_Target1 + #endif + ) + { + UNITY_SETUP_INSTANCE_ID(input); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input); + + float4 objPos = mul ( GetObjectToWorldMatrix(), float4(0.0,0.0,0.0,1.0) ); + float2 sceneUVs = (input.projPos.xy / input.projPos.w); + half RTD_OB_VP_CAL = distance(objPos.rgb,_WorldSpaceCameraPos); + half2 RTD_VD_Cal = (float2((sceneUVs.x * 2.0 - 1.0)*(_ScreenParams.r/_ScreenParams.g), sceneUVs.y * 2.0 - 1.0).rg*RTD_OB_VP_CAL); + //float3x3 tangentTransform = float3x3( input.tangentWS, input.bitangentWS, input.normalWS); + + + //** + half2 _TexturePatternStyle_var; + if (!_TexturePatternStyle) + { + _TexturePatternStyle_var = input.uv; + } + else + { + _TexturePatternStyle_var = RTD_VD_Cal; + } + //** + + + #ifdef N_F_TP_ON + half4 _MainTex_var = RT_Tripl_Default(_MainTex, sampler_MainTex, input.positionWS, input.normalWS); + #else + half4 _MainTex_var = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, TRANSFORM_TEX(_TexturePatternStyle_var, _MainTex)); + #endif + + #if N_F_TRANSAFFSHA_ON + + + //RT_TRANS_CO + half RTD_TRAN_OPA_Sli; + half RTD_CO; + half3 GLO_OUT; + RT_TRANS_CO(input.uv, _MainTex_var, _MainTex_var.a, RTD_TRAN_OPA_Sli, RTD_CO, input.positionWS, input.normalWS, input.positionCS.xy, GLO_OUT); + + #if N_F_TRANS_ON + #ifndef N_F_CO_ON + float dither = tex3D(_DitherMaskLOD, float3(input.positionCS.xy * 0.25, RTD_TRAN_OPA_Sli * 0.99)).a; + clip(saturate((0.74 > 0.5 ? (1.0 - (1.0 - 2.0 * (0.74 - 0.5)) * (1.0 - dither)) : (2.0 * 0.74 * dither))) - 0.5); + #endif + #endif + // + + + #endif + + + //RT_NFD + #ifdef N_F_NFD_ON + RT_NFD(input.positionCS.xy); + #endif + //== + + + //RT_NM + //float3 normalLocal = RT_NM(input.uv, input.positionWS, tangentTransform, input.normalWS); + //== + + + #ifdef LOD_FADE_CROSSFADE + LODFadeCrossFade(input.positionCS); + #endif + + #if defined(_GBUFFER_NORMALS_OCT) + float3 normalWS = normalize(input.normalWS); + float2 octNormalWS = PackNormalOctQuadEncode(normalWS); + float2 remappedOctNormalWS = saturate(octNormalWS * 0.5 + 0.5); + half3 packedNormalWS = PackFloat2To888(remappedOctNormalWS); + outNormalWS = half4(packedNormalWS, 0.0); + #else + float3 normalWS = NormalizeNormalPerPixel(input.normalWS); + outNormalWS = half4(normalWS, 0.0); + #endif + + #ifdef _WRITE_RENDERING_LAYERS + uint renderingLayers = GetMeshRenderingLayer(); + outRenderingLayers = float4(EncodeMeshRenderingLayer(renderingLayers), 0, 0, 0); + #endif + + } + + ENDHLSL + } + + Pass + { + Name "Meta" + Tags{"LightMode" = "Meta"} + + Cull Off + + HLSLPROGRAM + + #pragma only_renderers d3d9 d3d11 vulkan glcore gles3 gles metal xboxone ps4 xboxseries playstation switch webgpu //ounce //switch2 +#pragma target 2.0 //targetm + + #pragma vertex UniversalVertexMeta + #pragma fragment UniversalFragmentMeta + + #pragma shader_feature EDITOR_VISUALIZATION + + #pragma shader_feature_local_fragment N_F_SL_ON + #pragma shader_feature_local_fragment N_F_SLMM_ON + + #include "Packages/realtoon/RealToon/RealToon Shaders/RealToon Core/URP/RT_URP_Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/MetaInput.hlsl" + + struct Attributes + { + float4 positionOS : POSITION; + float3 normalOS : NORMAL; + float2 uv0 : TEXCOORD0; + float2 uv1 : TEXCOORD1; + float2 uv2 : TEXCOORD2; + UNITY_VERTEX_INPUT_INSTANCE_ID + //#ifdef _TANGENT_TO_WORLD + //float4 tangentOS : TANGENT; + //#endif + }; + + struct Varyings + { + float4 positionCS : SV_POSITION; + float2 uv : TEXCOORD0; + + // + #ifdef EDITOR_VISUALIZATION + float2 VizUV : TEXCOORD1; + float4 LightCoord : TEXCOORD2; + #endif + // + + float3 normalWS : TEXCOORD3; + float3 positionWS : TEXCOORD4; + }; + + Varyings UniversalVertexMeta(Attributes input) + { + + // + Varyings output = (Varyings)0; + output.positionWS = TransformObjectToWorld(input.positionOS.xyz); + output.normalWS = TransformObjectToWorldDir(input.normalOS); + output.positionCS = UnityMetaVertexPosition(input.positionOS.xyz, input.uv1, input.uv2); + output.uv = TRANSFORM_TEX(input.uv0, _MainTex); + #ifdef EDITOR_VISUALIZATION + UnityEditorVizData(input.positionOS.xyz, input.uv0, input.uv1, input.uv2, output.VizUV, output.LightCoord); + #endif + + return output; + // + } + + half4 UniversalFragmentMeta(Varyings input) : SV_Target + { + #ifdef N_F_TP_ON + half4 _MainTex_var = RT_Tripl_Default(_MainTex, sampler_MainTex, input.positionWS, input.normalWS); + #else + half4 _MainTex_var = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, TRANSFORM_TEX(input.uv, _MainTex)); + #endif + + + // + #ifdef UNITY_COLORSPACE_GAMMA + _MainColor = float4(LinearToGamma22(_MainColor.rgb),_MainColor.a); + #endif + // + + + half4 RTD_TEX_COL = _MainTex_var * (_MainColor * _MaiColPo); + + + //RT_SL + half3 RTD_SL_CHE_1; + half3 RTD_SL = RT_SL(input.uv, input.positionWS, input.normalWS, (half3)0.0, RTD_TEX_COL.rgb, (half3)0.0, RTD_SL_CHE_1); + //== + + + MetaInput metaInput; + metaInput.Albedo = RTD_TEX_COL.rgb; + metaInput.Emission = RTD_SL; + + #ifdef EDITOR_VISUALIZATION + metaInput.VizUV = input.VizUV; + metaInput.LightCoord = input.LightCoord; + #endif + + return MetaFragment(metaInput); + } + + ENDHLSL + } + + Pass + { + Name "MotionVectors" + Tags { "LightMode" = "MotionVectors" } + + ColorMask RG + + HLSLPROGRAM + + #pragma only_renderers d3d9 d3d11 vulkan glcore gles3 gles metal xboxone ps4 xboxseries playstation switch webgpu //ounce //switch2 + #pragma target 3.5 + + #pragma vertex vert + #pragma fragment frag + + #pragma shader_feature_local_fragment N_F_TRANS_ON + #pragma shader_feature_local_fragment N_F_CO_ON + #pragma shader_feature_local_fragment N_F_NFD_ON + #pragma shader_feature_local_fragment N_F_TP_ON + #pragma shader_feature_local_fragment N_F_SCO_ON + #pragma shader_feature_local_vertex N_F_DDMD_ON + #pragma shader_feature_local_vertex N_F_PA_ON + #pragma shader_feature_local_vertex N_F_SE_ON + + #pragma multi_compile _ LOD_FADE_CROSSFADE + #pragma shader_feature_local_vertex _ADD_PRECOMPUTED_VELOCITY + + #include "Packages/realtoon/RealToon/RealToon Shaders/RealToon Core/URP/RT_URP_Core.hlsl" + + #pragma multi_compile_instancing + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" + + #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/UnityInput.hlsl" + + #if defined(LOD_FADE_CROSSFADE) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl" + #endif + + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/MotionVectorsCommon.hlsl" + #include "Packages/realtoon/RealToon/RealToon Shaders/RealToon Core/URP/Pass/RT_URP_MoVecPas.hlsl" + + ENDHLSL + } + + Pass + { + Name "XRMotionVectors" + Tags { "LightMode" = "XRMotionVectors" } + + ColorMask RGBA + + Stencil + { + WriteMask 1 + Ref 1 + Comp Always + Pass Replace + } + + HLSLPROGRAM + + #pragma only_renderers d3d9 d3d11 vulkan glcore gles3 gles metal xboxone ps4 xboxseries playstation switch webgpu //ounce //switch2 + #pragma target 3.5 + + #pragma vertex vert + #pragma fragment frag + + #pragma shader_feature_local_fragment N_F_TRANS_ON + #pragma shader_feature_local_fragment N_F_CO_ON + #pragma shader_feature_local_fragment N_F_NFD_ON + #pragma shader_feature_local_fragment N_F_TP_ON + #pragma shader_feature_local_fragment N_F_SCO_ON + #pragma shader_feature_local_vertex N_F_DDMD_ON + #pragma shader_feature_local_vertex N_F_PA_ON + #pragma shader_feature_local_vertex N_F_SE_ON + + #pragma multi_compile _ LOD_FADE_CROSSFADE + #pragma shader_feature_local_vertex _ADD_PRECOMPUTED_VELOCITY + #define APLICATION_SPACE_WARP_MOTION 1 + + #include "Packages/realtoon/RealToon/RealToon Shaders/RealToon Core/URP/RT_URP_Core.hlsl" + + #pragma multi_compile_instancing + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" + + #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/UnityInput.hlsl" + + #if defined(LOD_FADE_CROSSFADE) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl" + #endif + + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/MotionVectorsCommon.hlsl" + #include_with_pragmas "Packages/realtoon/RealToon/RealToon Shaders/RealToon Core/URP/Pass/RT_URP_MoVecPas.hlsl" + + ENDHLSL + } + + Pass { + +Name"Outline" +Tags{"LightMode"="SRPDefaultUnlit"} +//OL_NRE + +Cull [_DoubleSidedOutline]//OL_RCUL +Blend[_BleModSour][_BleModDest] + +AlphaToMask[_AlpToCov] + + Stencil { +/*//O_ST + Ref[_RefVal] + Comp [_Compa] + Pass [_Oper] + Fail [_Oper] +//O_ST_En*/ + +Pass [_OutStenPass]//O_PI + } + + HLSLPROGRAM + + #pragma only_renderers d3d9 d3d11 vulkan glcore gles3 gles metal xboxone ps4 xboxseries playstation switch webgpu //ounce //switch2 +#pragma target 2.0 //targetol + + #pragma multi_compile _ _ADDITIONAL_LIGHTS + #pragma multi_compile _ _FORWARD_PLUS + + #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/RenderingLayers.hlsl" + #pragma multi_compile_fragment _ _LIGHT_LAYERS + #pragma multi_compile_fog + #pragma multi_compile_instancing + #pragma instancing_options renderinglayer + + #pragma multi_compile _ DOTS_INSTANCING_ON + #pragma multi_compile_fragment _ LOD_FADE_CROSSFADE + + #pragma vertex LitPassVertex + #pragma fragment LitPassFragment + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/realtoon/RealToon/RealToon Shaders/RealToon Core/URP/RT_URP_Core.hlsl" + + #if defined(LOD_FADE_CROSSFADE) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl" + #endif + + #pragma shader_feature_local_fragment N_F_TRANS_ON + #pragma shader_feature_local_fragment N_F_SIMTRANS_ON + #pragma shader_feature_local_fragment N_F_CO_ON + #pragma shader_feature_local_fragment N_F_EAL_ON + #pragma shader_feature_local N_F_O_ON + #pragma shader_feature_local_vertex N_F_DNO_ON + #pragma shader_feature_local_vertex N_F_DDMD_ON + #pragma shader_feature_local_fragment N_F_NFD_ON + #pragma shader_feature_local_fragment N_F_TP_ON + #pragma shader_feature_local_vertex N_F_PA_ON + #pragma shader_feature_local_vertex N_F_SE_ON + #pragma shader_feature_local_fragment N_F_SCO_ON + #pragma shader_feature_local_fragment N_F_ATC_ON + #pragma shader_feature_local_fragment N_F_LLI_ON + + struct Attributes + { + + float4 positionOS : POSITION; + float3 normalOS : NORMAL; + float2 uv : TEXCOORD0; + float4 vertexColor : COLOR; + float2 uvLM : TEXCOORD1; + #if defined(UNITY_DOTS_INSTANCING_ENABLED) + + #ifndef N_F_DDMD_ON + float4 tangentOS : TANGENT; +float4 weights : BLENDWEIGHTS;//DOTS_LiBleSki_OL +uint4 indices : BLENDINDICES;//DOTS_LiBleSki_OL +//uint vertexID : SV_VertexID;//DOTS_CompDef_OL + #endif + + #endif + UNITY_VERTEX_INPUT_INSTANCE_ID + + }; + + struct Varyings + { + + float2 uv : TEXCOORD0; + float4 positionWSAndFogFactor : TEXCOORD2; + float4 projPos : TEXCOORD7; + float4 posWorld : TEXCOORD8; + float3 normalWS : TEXCOORD9; + float4 vertexColor : COLOR; + float4 positionCS : SV_POSITION; + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + + }; + + + Varyings LitPassVertex(Attributes input) + { + + Varyings output = (Varyings)0; + + UNITY_SETUP_INSTANCE_ID (input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + output.uv = input.uv; + output.vertexColor = input.vertexColor; + + #if defined(UNITY_DOTS_INSTANCING_ENABLED) + + #ifdef N_F_DDMD_ON + + float4 _LBS_CD_Position = input.positionOS; + float3 _LBS_CD_Normal = input.normalOS; + //float4 _LBS_CD_Tangent = input.tangentOS; //not currently needed + + #else + + float4 _LBS_CD_Position = 0; + float3 _LBS_CD_Normal = 0; + float4 _LBS_CD_Tangent = 0; + +DOTS_LiBleSki(input.indices, input.weights, input.positionOS.xyz, input.normalOS.xyz, input.tangentOS.xyz, (float3)_LBS_CD_Position, _LBS_CD_Normal, (float3)_LBS_CD_Tangent);//DOTS_LiBleSki_OL +//DOTS_CompDef(input.vertexID, (float3)_LBS_CD_Position, _LBS_CD_Normal, (float3)_LBS_CD_Tangent);//DOTS_CompDef_OL + + #endif + + #else + float4 _LBS_CD_Position = input.positionOS; + float3 _LBS_CD_Normal = input.normalOS; + //float4 _LBS_CD_Tangent = input.tangentOS; //not currently needed + #endif + + VertexPositionInputs vertexInput = GetVertexPositionInputs(_LBS_CD_Position.xyz); + + output.normalWS = TransformObjectToWorldNormal(input.normalOS); + output.posWorld = float4(vertexInput.positionWS, 1.0); + + float4 objPos = mul ( GetObjectToWorldMatrix(), float4(0.0,0.0,0.0,1.0) ); + + + //RT_SE + #if N_F_SE_ON + input.positionOS = RT_SE(vertexInput.positionWS, input.positionOS); + _LBS_CD_Position = input.positionOS; + #endif + //== + + + half RTD_OB_VP_CAL = distance(objPos.rgb,_WorldSpaceCameraPos); + + //** + half RTD_OL_VCRAOW_OO; + if (!_VertexColorBlueAffectOutlineWitdh) + { + RTD_OL_VCRAOW_OO = _OutlineWidth; + } + else + { + RTD_OL_VCRAOW_OO = _OutlineWidth * (1.0 - output.vertexColor.b); + } + //** + + + //** + half RTD_OL_OLWABVD_OO; + if (!_OutlineWidthAffectedByViewDistance) + { + RTD_OL_OLWABVD_OO = RTD_OL_VCRAOW_OO; + } + else + { + RTD_OL_OLWABVD_OO = clamp(RTD_OL_VCRAOW_OO * RTD_OB_VP_CAL, RTD_OL_VCRAOW_OO, _FarDistanceMaxWidth); + } + //** + + + #if defined(SHADER_API_GLES) + half4 _OutlineWidthControl_var = tex2Dlod(_OutlineWidthControl, float4(TRANSFORM_TEX(output.uv, _OutlineWidthControl), 0.0, 0)); //replace soon + #else + half4 _OutlineWidthControl_var = SAMPLE_TEXTURE2D_LOD(_OutlineWidthControl, sampler_OutlineWidthControl, TRANSFORM_TEX(output.uv, _OutlineWidthControl), 0.0); + #endif + + #if N_F_DNO_ON + + float4 _3726 = _Time; + float _8530_ang = _3726.g; + float _8530_spd = 0.002; + float _8530_cos = cos(_8530_spd * _8530_ang); + float _8530_sin = sin(_8530_spd * _8530_ang); + float2 _8530_piv = float2(0.5, 0.5); + half2 _8530 = (mul(output.uv - _8530_piv, float2x2(_8530_cos, -_8530_sin, _8530_sin, _8530_cos)) + _8530_piv); + + half2 RTD_OL_DNOL_OO = _8530; + + #else + + half2 RTD_OL_DNOL_OO = output.uv; + + #endif + + + half2 _8743 = RTD_OL_DNOL_OO; + float2 _1283_skew = _8743 + 0.2127+_8743.x*0.3713*_8743.y; + float2 _1283_rnd = 4.789*sin(489.123*(_1283_skew)); + half _1283 = frac(_1283_rnd.x*_1283_rnd.y*(1+_1283_skew.x)); + + + //** + float3 _OEM = float3(0.0, 0.0, 0.0); + if (!_OutlineExtrudeMethod) + { + _OEM = _LBS_CD_Normal; + } + else + { + _OEM = normalize(_LBS_CD_Position.xyz); + } + //** + + + half RTD_OL = ( RTD_OL_OLWABVD_OO*0.01 ) * _OutlineWidthControl_var.r * lerp(1.0,_1283,_NoisyOutlineIntensity); + + + //RT_PA + #if N_F_PA_ON + output.positionCS = mul(RT_PA(vertexInput.positionWS), float4( (_LBS_CD_Position.xyz + _OutlineOffset.xyz * 0.01) + _OEM * RTD_OL, 1.0) ); + #else + output.positionCS = mul(GetWorldToHClipMatrix(), mul(GetObjectToWorldMatrix(), float4( (_LBS_CD_Position.xyz + _OutlineOffset.xyz * 0.01) + _OEM * RTD_OL,1.0) ) ); + #endif + //== + + + #if defined(SHADER_API_GLCORE) || defined(SHADER_API_GLES) || defined(SHADER_API_GLES3) + output.positionCS.z += _OutlineZPostionInCamera * 0.0005; + #else + output.positionCS.z -= _OutlineZPostionInCamera * 0.0005; + #endif + + float fogFactor = ComputeFogFactor(vertexInput.positionCS.z); + output.positionWSAndFogFactor = float4(vertexInput.positionWS, fogFactor); + output.projPos = ComputeScreenPos (output.positionCS); + + return output; + + } + + void LitPassFragment( + Varyings input + , out half4 outColor : SV_Target0 + #ifdef _WRITE_RENDERING_LAYERS + , out float4 outRenderingLayers : SV_Target1 + #endif + ) + { + + UNITY_SETUP_INSTANCE_ID (input); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input); + + float3 positionWS = input.positionWSAndFogFactor.xyz; + float4 objPos = mul ( GetObjectToWorldMatrix(), float4(0.0,0.0,0.0,1.0) ); + float2 sceneUVs = (input.projPos.xy / input.projPos.w); + half RTD_OB_VP_CAL = distance(objPos.rgb,_WorldSpaceCameraPos); + half2 RTD_VD_Cal = (float2((sceneUVs.x * 2.0 - 1.0)*(_ScreenParams.r/_ScreenParams.g), sceneUVs.y * 2.0 - 1.0).rg*RTD_OB_VP_CAL); + + #ifdef LOD_FADE_CROSSFADE + LODFadeCrossFade(input.positionCS); + #endif + + half3 color = (half3)1.0; + + //** + half2 RTD_TC_TP_OO; + if (!_TexturePatternStyle) + { + RTD_TC_TP_OO = input.uv; + } + else + { + RTD_TC_TP_OO = RTD_VD_Cal; + } + //** + + + #ifdef N_F_TP_ON + half4 _MainTex_var = RT_Tripl_Default(_MainTex, sampler_MainTex, positionWS, input.normalWS); + #else + half4 _MainTex_var = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, TRANSFORM_TEX(RTD_TC_TP_OO, _MainTex)); + #endif + + + //RT_TRANS_CO + half RTD_TRAN_OPA_Sli; + half RTD_CO; + half3 GLO_OUT; + RT_TRANS_CO(input.uv, _MainTex_var, _MainTex_var.a, RTD_TRAN_OPA_Sli, RTD_CO, positionWS, input.normalWS, input.positionCS.xy, GLO_OUT); + + #if N_F_TRANS_ON + #ifndef N_F_CO_ON + clip(RTD_TRAN_OPA_Sli - 0.5); + #endif + #endif + // + + + //========/ + //========/ + Light mainLight = GetMainLight(); + + #ifdef N_F_LLI_ON + half3 mainliCol = clamp(mainLight.color.rgb,_LLI_Min,_LLI_Max); + #else + half3 mainliCol = mainLight.color.rgb; + #endif + + #ifndef N_F_OFLMB_ON + half3 lightColor = mainliCol; + #else + half3 lightColor = (half3)1.0; + #endif + //========/ + //========/ + + + uint meshRenderingLayers = GetMeshRenderingLayer(); + + + //========/ + //========/ + #ifndef N_F_OFLMB_ON + #ifdef _ADDITIONAL_LIGHTS + #if N_F_EAL_ON + + uint pixelLightCount = GetAdditionalLightsCount(); + + #if USE_FORWARD_PLUS + + InputData inputData = (InputData)0; + inputData.positionWS = positionWS; + inputData.normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(input.positionCS); + + for (uint lightIndex = 0; lightIndex < min(URP_FP_DIRECTIONAL_LIGHTS_COUNT, MAX_VISIBLE_LIGHTS); lightIndex++) + { + Light light = GetAdditionalLight(lightIndex, input.posWorld.xyz, (float4)1.0); + + #ifdef _LIGHT_LAYERS + if (IsMatchingLightLayer(light.layerMask, meshRenderingLayers)) + #endif + { + #ifdef N_F_LLI_ON + lightColor += clamp(light.color,_LLI_Min,_LLI_Max) * light.distanceAttenuation; + #else + lightColor += light.color * light.distanceAttenuation; + #endif + } + } + #endif + + LIGHT_LOOP_BEGIN(pixelLightCount) + Light light = GetAdditionalLight(lightIndex, positionWS); + + #ifdef _LIGHT_LAYERS + if (IsMatchingLightLayer(light.layerMask, meshRenderingLayers)) + #endif + { + #ifdef N_F_LLI_ON + lightColor += clamp(light.color,_LLI_Min,_LLI_Max) * light.distanceAttenuation; + #else + lightColor += light.color * light.distanceAttenuation; + #endif + } + LIGHT_LOOP_END + + #endif + #endif + #endif + //========/ + //========/ + + + float fogFactor = input.positionWSAndFogFactor.w; + + + // + #ifdef UNITY_COLORSPACE_GAMMA + _OutlineColor = float4(LinearToGamma22(_OutlineColor.rgb), _OutlineColor.a); + #endif + // + + + //** + half3 RTD_MMTTO_OO; + if (!_MixMainTexToOutline) + { + RTD_MMTTO_OO = _OutlineColor.rgb; + } + else + { + + RTD_MMTTO_OO = _OutlineColor.rgb * _MainTex_var.rgb; + } + //** + + + //** + half3 RTD_OL_LAOC_OO; + if (!_LightAffectOutlineColor) + { + RTD_OL_LAOC_OO = RTD_MMTTO_OO; + } + else + { + + RTD_OL_LAOC_OO = lerp(half3(0.0, 0.0, 0.0), RTD_MMTTO_OO, lightColor.rgb); + } + //** + + + half3 finalRGBA = RTD_OL_LAOC_OO; + + + //RT_NFD + #ifdef N_F_NFD_ON + RT_NFD(input.positionCS.xy); + #endif + //== + + + color = MixFog(finalRGBA, fogFactor); + + + #if defined(N_F_TRANS_ON) & !defined(N_F_CO_ON) + outColor = half4(color, RTD_TRAN_OPA_Sli); + #else + #if N_F_ATC_ON + outColor = half4(color, _MainTex_var.a); + #else + outColor = half4(color, 1.0); + #endif + #endif + + #ifdef _WRITE_RENDERING_LAYERS + uint renderingLayers = GetMeshRenderingLayer(); + outRenderingLayers = float4(EncodeMeshRenderingLayer(renderingLayers), 0, 0, 0); + #endif + + } + + ENDHLSL + } + +} + +FallBack "Hidden/InternalErrorShader" +CustomEditor "RealToon.GUIInspector.RealToonShaderGUI_URP_SRP" + +} diff --git a/RealToon/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader.meta b/RealToon/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader.meta new file mode 100644 index 0000000..6570444 --- /dev/null +++ b/RealToon/RealToon/RealToon Shaders/Version 5/URP/Default/D_Default_URP.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 6459b2db96a08ca41b0f9b39dc7ad59e +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/RealToon/RealToon/RealToon Tools.meta b/RealToon/RealToon/RealToon Tools.meta new file mode 100644 index 0000000..cefc344 --- /dev/null +++ b/RealToon/RealToon/RealToon Tools.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8503504c0d606ac44a6f11bc845e085b +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/RealToon/RealToon/RealToon Tools/CustomShadowResolution.cs b/RealToon/RealToon/RealToon Tools/CustomShadowResolution.cs new file mode 100644 index 0000000..9e65f93 --- /dev/null +++ b/RealToon/RealToon/RealToon Tools/CustomShadowResolution.cs @@ -0,0 +1,58 @@ +//RealToon - Custom Shadow Resolution +//MJQStudioWorks +//©2025 + +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace RealToon.Script +{ + [ExecuteInEditMode] + [RequireComponent(typeof(Light))] + [AddComponentMenu("RealToon/Tools/Custom Shadow Resolution")] + public class CustomShadowResolution : MonoBehaviour + { + [Header("Custom Shadow Resolution V1.0.0")] + [Header("Note: Higher Shadow Resolution = More GPU RAM Usage.")] + [Header("For RealToon Built-In RP Only")] + + [Space(10)] + + [SerializeField] + [Tooltip("Input value")] + public int Value = 2048; + + [SerializeField] + [Tooltip("Final Resolution (Value * 2)")] + public int FinalResolution = 4096; + + [Space(10)] + + [SerializeField] + [Tooltip("Reset to default value")] + public bool Reset = false; + + void Update() + { + this.GetComponent().shadowCustomResolution = FinalResolution; + FinalResolution = Value * 2; + + if (Reset == true) + { + Value = 2048; + FinalResolution = 4096; + Reset = false; + } + + if (Value < 0) + { + + Value = 0; + FinalResolution = 0; + + } + } + + } +} diff --git a/RealToon/RealToon/RealToon Tools/CustomShadowResolution.cs.meta b/RealToon/RealToon/RealToon Tools/CustomShadowResolution.cs.meta new file mode 100644 index 0000000..97cf860 --- /dev/null +++ b/RealToon/RealToon/RealToon Tools/CustomShadowResolution.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ef184494de3501f4ca1c8d8839a36f11 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/RealToon/RealToon/RealToon Tools/FrameByFrameRendering.meta b/RealToon/RealToon/RealToon Tools/FrameByFrameRendering.meta new file mode 100644 index 0000000..716f0c6 --- /dev/null +++ b/RealToon/RealToon/RealToon Tools/FrameByFrameRendering.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: faeff1c229edd844db97efa9068e8296 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/RealToon/RealToon/RealToon Tools/FrameByFrameRendering/FrameByFrameRendering_Default.cs b/RealToon/RealToon/RealToon Tools/FrameByFrameRendering/FrameByFrameRendering_Default.cs new file mode 100644 index 0000000..9cd899a --- /dev/null +++ b/RealToon/RealToon/RealToon Tools/FrameByFrameRendering/FrameByFrameRendering_Default.cs @@ -0,0 +1,237 @@ +//RealToon - Frame By Frame Rendering V1.0.0 +//MJQStudioWorks +//©2025 + +using UnityEngine; +using System.Collections; + +namespace RealToon.Tools.FrameByFrameRendering +{ + [AddComponentMenu("RealToon/Tools/Frame By Frame Rendering/Frame By Frame Rendering (Default)")] + public class FrameByFrameRendering_Default : MonoBehaviour + { + [Header("(Frame By Frame Rendering V1.0.0)")] + [Header("Click 'Play' button to start render.")] + + [Space(20)] + + [Header("==============================")] + [Header("(Settings)")] + + [Space(5)] + + [SerializeField] + [Tooltip("Example Path: C:/TheNameOfTheFolder (Default folder name is Rendered Files and it will be created to your unity root project folder if this set to empty.")] + public string PathFolder = "Rendered Files"; + + [SerializeField] + [Tooltip("PNG File Name")] + public string PNGFileName = "Frame"; + + [Space(15)] + + [SerializeField] + [Tooltip("Frame Rate (Set this to 24 if you want Film Style framerate.")] + public int FrameRate = 24; + + [SerializeField] + [Tooltip("Start frame to start rendering.")] + public int StartFrame = 0; + + [SerializeField] + [Tooltip("End frame to end rendering.")] + public int EndFrame = 100; + + [Space(15)] + + [SerializeField] + [Tooltip("Render single frame or single image only, For Illustration or Art use.")] + public bool SingleFrameRenderingMode = false; + + [Header("==============================")] + + [Header("(Information [Display Only] )")] + + [Space(5)] + [Tooltip("Display the current frame of your scene/play. (Display Only)")] + public int CurrentFrame = 0; + + [Tooltip("Display the information of the operation or rendering. (Display Only)")] + public string info = string.Empty; + + private bool StartRendering = false; + private bool StartFrameCheck = false; + private string CurrentRenderedFile = string.Empty; + private int StartFrameCont = 0; + private int EndFrameCont = 100; + private int FrameRateCont = 24; + private string PathFolderCont = "Rendered Files"; + private string PNGFileNameCont = "Frame"; + private bool SingleFrameRenderingCont = false; + + private System.IO.DirectoryInfo DirInfo; + + + void Start() + { + + if (StartFrameCont <= -1) + { + StartFrameCheck = false; + StartRendering = false; + info = "Rendering has not started because 'Start Frame' value is less than 0."; + Debug.LogError(info); + } + + if (EndFrameCont <= 0) + { + StartFrameCheck = false; + StartRendering = false; + info = "Rendering has not started because 'End Frame' value is 0 or less than 0."; + Debug.LogError(info); + } + + if (FrameRateCont <= 0) + { + StartFrameCheck = false; + StartRendering = false; + info = "Rendering has not started because 'Frame Rate' value is 0 or less than 0."; + Debug.LogError(info); + } + + if (PNGFileName == string.Empty) + { + PNGFileName = "Frame"; + info = "File Name set to 'Frame' because the field is not set or empty."; + Debug.LogError(info); + } + + if (PathFolder == string.Empty) + { + PathFolder = "Rendered Files"; + info = "Folder Path set to 'Rendered Files' and will be created to your UNITY ROOT PROJECT FOLDER because the field is not set or empty."; + Debug.LogError(info); + } + + Time.captureFramerate = FrameRate; + StartFrameCont = StartFrame; + EndFrameCont = EndFrame; + FrameRateCont = FrameRate; + SingleFrameRenderingCont = SingleFrameRenderingMode; + PathFolderCont = PathFolder; + PNGFileNameCont = PNGFileName; + + DirInfo = new System.IO.DirectoryInfo(PathFolder); + + if (!System.IO.Directory.Exists(PathFolder)) + { + System.IO.Directory.CreateDirectory(PathFolder); + info = "Folder '" + PathFolder + "' Has Been Created To Your Root Project Folder."; + Debug.LogWarning(info); + } + + + if (SingleFrameRenderingMode == false) + { + info = "Video/Animation Mode"; + Debug.LogWarning(info); + + if (DirInfo.GetFiles().Length != 0) + { + StartFrameCheck = false; + StartRendering = false; + info = "(Video/Animation Mode) Rendering not started because there are already rendered frames or files in this folder ('" + PathFolder + "'), Please empty this folder or make another folder by changing the Path Folder."; + Debug.LogError(info); + } + else + { + StartFrameCheck = true; + StartRendering = true; + } + } + else + { + StartFrameCheck = true; + StartRendering = true; + info = "Picture or Single Frame Rendering Mode"; + Debug.LogWarning(info); + EndFrameCont = 1; + } + + } + + void Update() + { + CurrentFrame = Time.frameCount - 1; + StartFrame = StartFrameCont; + EndFrame = EndFrameCont; + SingleFrameRenderingMode = SingleFrameRenderingCont; + PathFolder = PathFolderCont; + PNGFileName = PNGFileNameCont; + + if (PathFolder == string.Empty) + { + PathFolder = "Rendered Files"; + } + + else + { + + if (StartFrameCheck == true) + { + + if (CurrentFrame == StartFrameCont) + { + info = "Rendering Has Started."; + Debug.LogWarning(info); + StartRendering = true; + } + + if (StartRendering == true) + { + if (SingleFrameRenderingMode == false) + { + string fname = string.Format("{0}/" + PNGFileNameCont + " {1:D04}.png", PathFolderCont, CurrentFrame); + CurrentRenderedFile = fname; + info = fname; + +#if UNITY_2017_1_OR_NEWER + ScreenCapture.CaptureScreenshot(fname); +#endif + +#if UNITY_5_6 + Application.CaptureScreenshot(fname); +#endif + + } + else + { + string fname = string.Format("{0}/" + PNGFileNameCont + " " + System.DateTime.Now.ToString("hh_mm_ss") + ".png", PathFolderCont, CurrentFrame); + CurrentRenderedFile = fname; + info = fname; + +#if UNITY_2017_1_OR_NEWER + ScreenCapture.CaptureScreenshot(fname); +#endif + +#if UNITY_5_6 + Application.CaptureScreenshot(fname); +#endif + + } + + + if (CurrentFrame == EndFrame) + { + info = "Rendering Has Ended." + " [Last Rendered File: " + CurrentRenderedFile + "]"; + Debug.LogWarning(info); + StartRendering = false; + StartFrameCheck = false; + } + } + } + } + } + } + +} \ No newline at end of file diff --git a/RealToon/RealToon/RealToon Tools/FrameByFrameRendering/FrameByFrameRendering_Default.cs.meta b/RealToon/RealToon/RealToon Tools/FrameByFrameRendering/FrameByFrameRendering_Default.cs.meta new file mode 100644 index 0000000..c00a259 --- /dev/null +++ b/RealToon/RealToon/RealToon Tools/FrameByFrameRendering/FrameByFrameRendering_Default.cs.meta @@ -0,0 +1,20 @@ +fileFormatVersion: 2 +guid: 38f2863825408a940b834eb29e4811b4 +timeCreated: 1527622178 +licenseType: Store +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 65518 + packageName: RealToon (Pro Anime/Toon Shader) + packageVersion: 5.0.8p8 + assetPath: Assets/RealToon/RealToon Tools/FrameByFrameRendering/FrameByFrameRendering_Default.cs + uploadId: 629436 diff --git a/RealToon/RealToon/RealToon Tools/FrameByFrameRendering/FrameByFrameRendering_Manual.cs b/RealToon/RealToon/RealToon Tools/FrameByFrameRendering/FrameByFrameRendering_Manual.cs new file mode 100644 index 0000000..f3605dc --- /dev/null +++ b/RealToon/RealToon/RealToon Tools/FrameByFrameRendering/FrameByFrameRendering_Manual.cs @@ -0,0 +1,178 @@ +//RealToon - Frame By Frame Rendering V1.0.0 +//MJQStudioWorks +//©2025 + +using UnityEngine; +using System.Collections; + +namespace RealToon.Tools.FrameByFrameRendering +{ + [AddComponentMenu("RealToon/Tools/Frame By Frame Rendering/Frame By Frame Rendering (Manual)")] + public class FrameByFrameRendering_Manual : MonoBehaviour + { + [Header("(Frame By Frame Rendering V1.0.0)")] + [Header("Click 'Play' & 'Render' button to start render one by one.")] + + [Space(20)] + + [SerializeField] + [Tooltip("Current Frame Number")] + public int FrameNumber = 0; + + [Space(5)] + + [SerializeField] + [Tooltip("Start Render")] + public bool Render = false; + + [Header("==============================")] + [Header("(Settings)")] + + [Space(5)] + + [SerializeField] + [Tooltip("Example Path: C:/TheNameOfTheFolder (Default folder name is Rendered Files and it will be created to your unity root project folder if this set to empty.")] + public string PathFolder = "Rendered Files"; + + [SerializeField] + [Tooltip("PNG File Name")] + public string PNGFileName = "Frame"; + + [Space(15)] + + [SerializeField] + [Tooltip("Render single frame or single image only, For Illustration or Art use.")] + public bool PictureMode = false; + + [Header("==============================")] + + [Header("(Information [Display Only] )")] + + [Space(5)] + + [Tooltip("Display the information of the operation or rendering. (Display Only)")] + public int LastRenderedFrame = 0; + public string info = string.Empty; + + private string CurrentRenderedFile = string.Empty; + private string PathFolderCont = "Rendered Files"; + private string PNGFileNameCont = "Frame"; + private int FrameNumberCont = 0; + private bool PictureModeCont = false; + private bool PreventRender = false; + + private System.IO.DirectoryInfo DirInfo; + + + void Start() + { + + if (PNGFileName == string.Empty) + { + PNGFileName = "Frame"; + info = "File Name set to 'Frame' because the field is not set or empty."; + Debug.LogError(info); + } + + if (PathFolder == string.Empty) + { + PathFolder = "Rendered Files"; + info = "Folder Path set to 'Rendered Files' and will be created to your UNITY ROOT PROJECT FOLDER because the field is not set or empty."; + Debug.LogError(info); + } + + PictureModeCont = PictureMode; + PathFolderCont = PathFolder; + PNGFileNameCont = PNGFileName; + FrameNumberCont = FrameNumber; + + DirInfo = new System.IO.DirectoryInfo(PathFolder); + + if (!System.IO.Directory.Exists(PathFolder)) + { + System.IO.Directory.CreateDirectory(PathFolder); + info = "Folder '" + PathFolder + "' Has Been Created To Your Root Project Folder."; + Debug.LogWarning(info); + } + + + if (PictureMode == false) + { + info = "Frame by Frame Rendering Mode"; + Debug.LogWarning(info); + + if (DirInfo.GetFiles().Length != 0) + { + PreventRender = true; + Render = false; + info = "(Frame by Frame Mode) Rendering not started because there are already rendered frames or files in this folder ('" + PathFolder + "'), Please empty this folder or make another folder by changing the Path Folder."; + Debug.LogError(info); + } + } + else + { + info = "Picture or Single Frame Rendering Mode"; + Debug.LogWarning(info); + } + + } + + void Update() + { + PictureMode = PictureModeCont; + PathFolder = PathFolderCont; + PNGFileName = PNGFileNameCont; + LastRenderedFrame = FrameNumberCont; + + if (FrameNumber <= 0) + { + FrameNumber = FrameNumberCont; + } + + if (PreventRender == false) + { + if (Render == true) + { + if (PictureMode == false) + { + string fname = string.Format("{0}/" + PNGFileNameCont + " {1:D04}.png", PathFolderCont, FrameNumber); + CurrentRenderedFile = fname; + +#if UNITY_2017_1_OR_NEWER + ScreenCapture.CaptureScreenshot(fname); +#endif + +#if UNITY_5_6 + Application.CaptureScreenshot(fname); +#endif + + + FrameNumber += 1; + FrameNumberCont = FrameNumber; + + info = CurrentRenderedFile; + Debug.LogWarning(info); + Render = false; + } + else + { + string fname = string.Format("{0}/" + PNGFileNameCont + " " + System.DateTime.Now.ToString("hh_mm_ss") + ".png", PathFolderCont, FrameNumber); + CurrentRenderedFile = fname; + +#if UNITY_2017_1_OR_NEWER + ScreenCapture.CaptureScreenshot(fname); +#endif + +#if UNITY_5_6 + Application.CaptureScreenshot(fname); +#endif + info = CurrentRenderedFile; + Debug.LogWarning(info); + Render = false; + } + } + } + } + } + +} \ No newline at end of file diff --git a/RealToon/RealToon/RealToon Tools/FrameByFrameRendering/FrameByFrameRendering_Manual.cs.meta b/RealToon/RealToon/RealToon Tools/FrameByFrameRendering/FrameByFrameRendering_Manual.cs.meta new file mode 100644 index 0000000..cb039a7 --- /dev/null +++ b/RealToon/RealToon/RealToon Tools/FrameByFrameRendering/FrameByFrameRendering_Manual.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 9f51a2cb54804064b8fc03edfef062fb +timeCreated: 1527764313 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 65518 + packageName: RealToon (Pro Anime/Toon Shader) + packageVersion: 5.0.8p8 + assetPath: Assets/RealToon/RealToon Tools/FrameByFrameRendering/FrameByFrameRendering_Manual.cs + uploadId: 629436 diff --git a/RealToon/RealToon/RealToon Tools/PerspectiveAdjustmentController.cs b/RealToon/RealToon/RealToon Tools/PerspectiveAdjustmentController.cs new file mode 100644 index 0000000..fa62ccc --- /dev/null +++ b/RealToon/RealToon/RealToon Tools/PerspectiveAdjustmentController.cs @@ -0,0 +1,404 @@ +//RealToon - Perspective Adjustment [Helper] +//MJQStudioWorks +//2025 + +using UnityEngine; + +namespace RealToon.Script +{ + + [ExecuteAlways] + [AddComponentMenu("RealToon/Tools/Perspective Adjustment - Controller")] + public class PerspectiveAdjustmentController : MonoBehaviour + { + [HideInInspector] + [SerializeField] + Transform[] SubTran; + + [HideInInspector] + [SerializeField] + Material[] Mat; + + [HideInInspector] + [SerializeField] + Transform[] attac; + + [Header("Note: Perspective Adjustment feature will be automatically enable\nOn the materials of the object/model that uses RealToon Shader.")] + [Header("It is recommend to set the Clipping Planes - Near of the camera\nto 0.01 to prevent slicing when near.")] + + [Space(25)] + + [SerializeField] + [Tooltip("This will change the perspective of an object to 2D or 3D or FOV stretch look.\nFor 2d toon/anime look, set it to 0.5 or 0.")] + public float Perspective = 1; + + [SerializeField] + [Tooltip("This will change the clipping on the object.\nChange this if the object is overlapping front or back.")] + public float Clip = 0; + + [Space(15)] + + [SerializeField] + [Tooltip("This will adjust the size of the object when the camera is closer.")] + public float CloseUpSize = 0; + + [SerializeField] + [Tooltip("How smooth the transition of the sizing.")] + public float CloseUpSizeSmoothTransition = 1; + + [SerializeField] + [Tooltip("Distance transition from the camera to the object.")] + public float CloseUpSizeDistance = 0; + + [Space(15)] + + [SerializeField] + [Tooltip("Can animate the values/properties or create keyframe.")] + public bool CanAnimateIt = true; + + int coun_obj_wi_ralsha = 0; + int coun_obj_mat = 0; + int coun_obj_mat_arr = 0; + + string RT_Sha_Nam_URP = "Universal Render Pipeline/RealToon/Version 5/Default/Default"; + string RT_Sha_Nam_HDRP = "HDRP/RealToon/Version 5/Default"; + + string RT_Sha_Nam_BiRP_DD = "RealToon/Version 5/Default/Default"; + string RT_Sha_Nam_BiRP_DFT = "RealToon/Version 5/Default/Fade Transparency"; + string RT_Sha_Nam_BiRP_DR = "RealToon/Version 5/Default/Refraction"; + string RT_Sha_Nam_BiRP_TDD = "RealToon/Version 5/Tessellation/Default"; + string RT_Sha_Nam_BiRP_TDFT = "RealToon/Version 5/Tessellation/Fade Transparency"; + string RT_Sha_Nam_BiRP_TDR = "RealToon/Version 5/Tessellation/Refraction"; + string RT_Sha_Nam_BiRP_DDL = "RealToon/Version 5/Lite/Default"; + string RT_Sha_Nam_BiRP_DFTL = "RealToon/Version 5/Lite/Fade Transparency"; + + [HideInInspector] + [SerializeField] + bool checkstart = true; + + void Start() + { + if (checkstart == true) + { + InitStart(); + checkstart = false; + } + } + + void LateUpdate() + { + if (Mat != null) + { + if (CanAnimateIt == true) + { + foreach (Material Mate in Mat) + { + if (Mate != null) + { + if (Mate.shader.name == RT_Sha_Nam_URP || + Mate.shader.name == RT_Sha_Nam_HDRP || + Mate.shader.name == RT_Sha_Nam_BiRP_DD || + Mate.shader.name == RT_Sha_Nam_BiRP_DFT || + Mate.shader.name == RT_Sha_Nam_BiRP_DR || + Mate.shader.name == RT_Sha_Nam_BiRP_TDD || + Mate.shader.name == RT_Sha_Nam_BiRP_TDFT || + Mate.shader.name == RT_Sha_Nam_BiRP_TDR || + Mate.shader.name == RT_Sha_Nam_BiRP_DDL || + Mate.shader.name == RT_Sha_Nam_BiRP_DFTL) + { + Set_Shad_Prop(Mate); + } + } + } + } + } + } + + void OnValidate() + { + if (Mat != null) + { + foreach (Material Mate in Mat) + { + if (Mate != null) + { + if (Mate.shader.name == RT_Sha_Nam_URP || + Mate.shader.name == RT_Sha_Nam_HDRP || + Mate.shader.name == RT_Sha_Nam_BiRP_DD || + Mate.shader.name == RT_Sha_Nam_BiRP_DFT || + Mate.shader.name == RT_Sha_Nam_BiRP_DR || + Mate.shader.name == RT_Sha_Nam_BiRP_TDD || + Mate.shader.name == RT_Sha_Nam_BiRP_TDFT || + Mate.shader.name == RT_Sha_Nam_BiRP_TDR || + Mate.shader.name == RT_Sha_Nam_BiRP_DDL || + Mate.shader.name == RT_Sha_Nam_BiRP_DFTL) + { + Set_Shad_Prop(Mate); + } + } + } + } + } + + /* Remove Later + void OnDestroy() + { + Res_Shad_Prop(); + foreach (Material Mate in Mat) + { + if (Mate != null) + { + if (Mate.shader.name == RT_Sha_Nam_URP || Mate.shader.name == RT_Sha_Nam_HDRP) + { + Mate.SetFloat("_N_F_PA", 0.0f); + Mate.DisableKeyword("N_F_PA_ON"); + } + } + } + } + */ + + void Reset() + { + if (Mat != null) + { + checkstart = true; + Res_Shad_Prop(); + + foreach (Material Mate in Mat) + { + if (Mate != null) + { + if (Mate.shader.name == RT_Sha_Nam_URP || + Mate.shader.name == RT_Sha_Nam_HDRP || + Mate.shader.name == RT_Sha_Nam_BiRP_DD || + Mate.shader.name == RT_Sha_Nam_BiRP_DFT || + Mate.shader.name == RT_Sha_Nam_BiRP_DR || + Mate.shader.name == RT_Sha_Nam_BiRP_TDD || + Mate.shader.name == RT_Sha_Nam_BiRP_TDFT || + Mate.shader.name == RT_Sha_Nam_BiRP_TDR || + Mate.shader.name == RT_Sha_Nam_BiRP_DDL || + Mate.shader.name == RT_Sha_Nam_BiRP_DFTL) + { + Set_Shad_Prop(Mate); + } + } + } + + coun_obj_wi_ralsha = 0; + coun_obj_mat = 0; + coun_obj_mat_arr = 0; + InitStart(); + + } + } + + #region Init + + void InitStart() + { + if (attac == null || attac.Length == 0) + { + attac = this.gameObject.GetComponentsInChildren(); + } + + int x = 0; + foreach (Transform Trans in attac) + { + + Debug.Log("yes"); + + if (Trans.GetComponent() == true) + { + if (Trans.GetComponent().sharedMaterial != null) + { + if (Trans.GetComponent().sharedMaterial.shader.name == RT_Sha_Nam_URP || + Trans.GetComponent().sharedMaterial.shader.name == RT_Sha_Nam_HDRP || + Trans.GetComponent().sharedMaterial.shader.name == RT_Sha_Nam_BiRP_DD || + Trans.GetComponent().sharedMaterial.shader.name == RT_Sha_Nam_BiRP_DFT || + Trans.GetComponent().sharedMaterial.shader.name == RT_Sha_Nam_BiRP_DR || + Trans.GetComponent().sharedMaterial.shader.name == RT_Sha_Nam_BiRP_TDD || + Trans.GetComponent().sharedMaterial.shader.name == RT_Sha_Nam_BiRP_TDFT || + Trans.GetComponent().sharedMaterial.shader.name == RT_Sha_Nam_BiRP_TDR || + Trans.GetComponent().sharedMaterial.shader.name == RT_Sha_Nam_BiRP_DDL || + Trans.GetComponent().sharedMaterial.shader.name == RT_Sha_Nam_BiRP_DFTL) + { + coun_obj_wi_ralsha++; + coun_obj_mat += Trans.GetComponent().sharedMaterials.Length; + } + } + + } + + if (Trans.GetComponent() == true) + { + if (Trans.GetComponent().sharedMaterial != null) + { + if (Trans.GetComponent().sharedMaterial.shader.name == RT_Sha_Nam_URP || + Trans.GetComponent().sharedMaterial.shader.name == RT_Sha_Nam_HDRP || + Trans.GetComponent().sharedMaterial.shader.name == RT_Sha_Nam_BiRP_DD || + Trans.GetComponent().sharedMaterial.shader.name == RT_Sha_Nam_BiRP_DFT || + Trans.GetComponent().sharedMaterial.shader.name == RT_Sha_Nam_BiRP_DR || + Trans.GetComponent().sharedMaterial.shader.name == RT_Sha_Nam_BiRP_TDD || + Trans.GetComponent().sharedMaterial.shader.name == RT_Sha_Nam_BiRP_TDFT || + Trans.GetComponent().sharedMaterial.shader.name == RT_Sha_Nam_BiRP_TDR || + Trans.GetComponent().sharedMaterial.shader.name == RT_Sha_Nam_BiRP_DDL || + Trans.GetComponent().sharedMaterial.shader.name == RT_Sha_Nam_BiRP_DFTL) + { + coun_obj_wi_ralsha++; + coun_obj_mat += Trans.GetComponent().sharedMaterials.Length; + } + + } + } + + } + + SubTran = new Transform[coun_obj_wi_ralsha]; + + foreach (Transform Trans in attac) + { + if (Trans.GetComponent() == true) + { + if (Trans.GetComponent().sharedMaterial != null) + { + if (Trans.GetComponent().sharedMaterial.shader.name == RT_Sha_Nam_URP || + Trans.GetComponent().sharedMaterial.shader.name == RT_Sha_Nam_HDRP || + Trans.GetComponent().sharedMaterial.shader.name == RT_Sha_Nam_BiRP_DD || + Trans.GetComponent().sharedMaterial.shader.name == RT_Sha_Nam_BiRP_DFT || + Trans.GetComponent().sharedMaterial.shader.name == RT_Sha_Nam_BiRP_DR || + Trans.GetComponent().sharedMaterial.shader.name == RT_Sha_Nam_BiRP_TDD || + Trans.GetComponent().sharedMaterial.shader.name == RT_Sha_Nam_BiRP_TDFT || + Trans.GetComponent().sharedMaterial.shader.name == RT_Sha_Nam_BiRP_TDR || + Trans.GetComponent().sharedMaterial.shader.name == RT_Sha_Nam_BiRP_DDL || + Trans.GetComponent().sharedMaterial.shader.name == RT_Sha_Nam_BiRP_DFTL) + { + SubTran[x] = Trans; + x++; + } + + } + + } + + if (Trans.GetComponent() == true) + { + if (Trans.GetComponent().sharedMaterial != null) + { + if (Trans.GetComponent().sharedMaterial.shader.name == RT_Sha_Nam_URP || + Trans.GetComponent().sharedMaterial.shader.name == RT_Sha_Nam_HDRP || + Trans.GetComponent().sharedMaterial.shader.name == RT_Sha_Nam_BiRP_DD || + Trans.GetComponent().sharedMaterial.shader.name == RT_Sha_Nam_BiRP_DFT || + Trans.GetComponent().sharedMaterial.shader.name == RT_Sha_Nam_BiRP_DR || + Trans.GetComponent().sharedMaterial.shader.name == RT_Sha_Nam_BiRP_TDD || + Trans.GetComponent().sharedMaterial.shader.name == RT_Sha_Nam_BiRP_TDFT || + Trans.GetComponent().sharedMaterial.shader.name == RT_Sha_Nam_BiRP_TDR || + Trans.GetComponent().sharedMaterial.shader.name == RT_Sha_Nam_BiRP_DDL || + Trans.GetComponent().sharedMaterial.shader.name == RT_Sha_Nam_BiRP_DFTL) + { + SubTran[x] = Trans; + x++; + } + } + } + } + + + Mat = new Material[coun_obj_mat]; + + + foreach (Transform Trans in SubTran) + { + if (Trans.GetComponent() == true) + { + if (Trans.GetComponent().sharedMaterial != null) + { + if (Trans.GetComponent().sharedMaterial.shader.name == RT_Sha_Nam_URP || + Trans.GetComponent().sharedMaterial.shader.name == RT_Sha_Nam_HDRP || + Trans.GetComponent().sharedMaterial.shader.name == RT_Sha_Nam_BiRP_DD || + Trans.GetComponent().sharedMaterial.shader.name == RT_Sha_Nam_BiRP_DFT || + Trans.GetComponent().sharedMaterial.shader.name == RT_Sha_Nam_BiRP_DR || + Trans.GetComponent().sharedMaterial.shader.name == RT_Sha_Nam_BiRP_TDD || + Trans.GetComponent().sharedMaterial.shader.name == RT_Sha_Nam_BiRP_TDFT || + Trans.GetComponent().sharedMaterial.shader.name == RT_Sha_Nam_BiRP_TDR || + Trans.GetComponent().sharedMaterial.shader.name == RT_Sha_Nam_BiRP_DDL || + Trans.GetComponent().sharedMaterial.shader.name == RT_Sha_Nam_BiRP_DFTL) + { + for (int i = 0; i < Trans.GetComponent().sharedMaterials.Length; i++) + { + Mat[coun_obj_mat_arr] = Trans.GetComponent().sharedMaterials[i]; + coun_obj_mat_arr++; + } + } + + } + + } + + if (Trans.GetComponent() == true) + { + if (Trans.GetComponent().sharedMaterial != null) + { + if (Trans.GetComponent().sharedMaterial.shader.name == RT_Sha_Nam_URP || + Trans.GetComponent().sharedMaterial.shader.name == RT_Sha_Nam_HDRP || + Trans.GetComponent().sharedMaterial.shader.name == RT_Sha_Nam_BiRP_DD || + Trans.GetComponent().sharedMaterial.shader.name == RT_Sha_Nam_BiRP_DFT || + Trans.GetComponent().sharedMaterial.shader.name == RT_Sha_Nam_BiRP_DR || + Trans.GetComponent().sharedMaterial.shader.name == RT_Sha_Nam_BiRP_TDD || + Trans.GetComponent().sharedMaterial.shader.name == RT_Sha_Nam_BiRP_TDFT || + Trans.GetComponent().sharedMaterial.shader.name == RT_Sha_Nam_BiRP_TDR || + Trans.GetComponent().sharedMaterial.shader.name == RT_Sha_Nam_BiRP_DDL || + Trans.GetComponent().sharedMaterial.shader.name == RT_Sha_Nam_BiRP_DFTL) + { + + for (int i = 0; i < Trans.GetComponent().sharedMaterials.Length; i++) + { + Mat[coun_obj_mat_arr] = Trans.GetComponent().sharedMaterials[i]; + coun_obj_mat_arr++; + } + } + } + } + + } + + foreach (Material Mat in Mat) + { + if (Mat != null) + { + Set_Shad_Prop(Mat); + } + } + } + + #endregion + + void Set_Shad_Prop(Material Mat) + { + if (Mat.IsKeywordEnabled("N_F_PA_ON") == true) + { + Mat.SetFloat("_PresAdju", Perspective); + Mat.SetFloat("_ClipAdju", Clip); + Mat.SetFloat("_PASize", CloseUpSize); + Mat.SetFloat("_PASmooTrans", CloseUpSizeSmoothTransition); + Mat.SetFloat("_PADist", CloseUpSizeDistance); + } + else if (Mat.IsKeywordEnabled("N_F_PA_ON") != true) + { + Mat.EnableKeyword("N_F_PA_ON"); + Mat.SetInt("_N_F_PA", 1); + } + } + + void Res_Shad_Prop() + { + Perspective = 1.0f; + Clip = 0.0f; + CloseUpSize = 0.0f; + CloseUpSizeSmoothTransition = 1.0f; + CloseUpSizeDistance = 0.0f; + } + + } + +} \ No newline at end of file diff --git a/RealToon/RealToon/RealToon Tools/PerspectiveAdjustmentController.cs.meta b/RealToon/RealToon/RealToon Tools/PerspectiveAdjustmentController.cs.meta new file mode 100644 index 0000000..7284157 --- /dev/null +++ b/RealToon/RealToon/RealToon Tools/PerspectiveAdjustmentController.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1d88305a8ddd7fd4e96cb2d8311ee035 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/RealToon/RealToon/RealToon Tools/ShadowTSDFModeHelper.cs b/RealToon/RealToon/RealToon Tools/ShadowTSDFModeHelper.cs new file mode 100644 index 0000000..0baca6a --- /dev/null +++ b/RealToon/RealToon/RealToon Tools/ShadowTSDFModeHelper.cs @@ -0,0 +1,142 @@ +//RealToon - ShadowT SDF Mode [Helper] +//MJQStudioWorks +//2025 + +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace RealToon.Script +{ + [ExecuteAlways] + [AddComponentMenu("RealToon/Tools/ShadowT SDF Mode - Helper")] + public class ShadowTSDFModeHelper : MonoBehaviour + { + [Header("Note: ShadowT feature and SDF Mode will be automatically enable\nWhen you put a material that uses RealToon Shader on the Material slot.")] + + [Space(25)] + + [Space(10)] + [SerializeField] + [Tooltip("A material that uses 'RealToon - ShadowT' feature and enabled 'SDF Mode'.")] + public Material Material = null; + + [SerializeField] + [Tooltip("An object to follow the position.")] + public Transform ObjectToFollow = null; + + [Space(10)] + + [SerializeField] + [Tooltip("The amount of light.")] + float LightThreshold = 200.0f; + + [Space(10)] + + [SerializeField] + [Tooltip("Invert the Foward/Front position of the object.")] + bool ForwardInverted = false; + + [Tooltip("Invert the Right position of the object.")] + [SerializeField] + bool RightInverted = false; + + [HideInInspector] + [SerializeField] + bool checkstart = true; + + string RT_Sha_Nam_URP = "Universal Render Pipeline/RealToon/Version 5/Default/Default"; + string RT_Sha_Nam_HDRP = "HDRP/RealToon/Version 5/Default"; + + string RT_Sha_Nam_BiRP_DD = "RealToon/Version 5/Default/Default"; + string RT_Sha_Nam_BiRP_DFT = "RealToon/Version 5/Default/Fade Transparency"; + string RT_Sha_Nam_BiRP_DR = "RealToon/Version 5/Default/Refraction"; + string RT_Sha_Nam_BiRP_TDD = "RealToon/Version 5/Tessellation/Default"; + string RT_Sha_Nam_BiRP_TDFT = "RealToon/Version 5/Tessellation/Fade Transparency"; + string RT_Sha_Nam_BiRP_TDR = "RealToon/Version 5/Tessellation/Refraction"; + + void LateUpdate() + { + + if (Material == null || ObjectToFollow == null) + { } + else + { + if (Material.shader.name == RT_Sha_Nam_URP || + Material.shader.name == RT_Sha_Nam_HDRP || + Material.shader.name == RT_Sha_Nam_BiRP_DD || + Material.shader.name == RT_Sha_Nam_BiRP_DFT || + Material.shader.name == RT_Sha_Nam_BiRP_DR || + Material.shader.name == RT_Sha_Nam_BiRP_TDD || + Material.shader.name == RT_Sha_Nam_BiRP_TDFT || + Material.shader.name == RT_Sha_Nam_BiRP_TDR) + { + Material.SetFloat("_ShadowTLightThreshold", LightThreshold); + + if (ForwardInverted != true) + { + Material.SetVector("_ObjectForward", ObjectToFollow.transform.forward); + } + else + { + Material.SetVector("_ObjectForward", -ObjectToFollow.transform.forward); + } + + if (RightInverted != true) + { + Material.SetVector("_ObjectRight", ObjectToFollow.transform.right); + } + else + { + Material.SetVector("_ObjectRight", -ObjectToFollow.transform.right); + } + } + } + + } + + void OnValidate() + { + if (Material == null) + { + checkstart = true; + } + else if (Material != null) + { + if (Material.shader.name == RT_Sha_Nam_URP || + Material.shader.name == RT_Sha_Nam_HDRP || + Material.shader.name == RT_Sha_Nam_BiRP_DD || + Material.shader.name == RT_Sha_Nam_BiRP_DFT || + Material.shader.name == RT_Sha_Nam_BiRP_DR || + Material.shader.name == RT_Sha_Nam_BiRP_TDD || + Material.shader.name == RT_Sha_Nam_BiRP_TDFT || + Material.shader.name == RT_Sha_Nam_BiRP_TDR) + { + if (checkstart == true) + { + if ( (Material.IsKeywordEnabled("N_F_ST_ON") == false && Material.IsKeywordEnabled("N_F_STSDFM_ON") == false) || + (Material.IsKeywordEnabled("N_F_ST_ON") == true && Material.IsKeywordEnabled("N_F_STSDFM_ON") == false) || + (Material.IsKeywordEnabled("N_F_ST_ON") == false && Material.IsKeywordEnabled("N_F_STSDFM_ON") == true) ) + { + Material.EnableKeyword("N_F_ST_ON"); + Material.SetFloat("_N_F_ST", 1.0f); + + Material.EnableKeyword("N_F_STSDFM_ON"); + Material.SetFloat("_N_F_STSDFM", 1.0f); + checkstart = false; + } + } + } + } + } + + void Reset() + { + Material = null; + ObjectToFollow = null; + checkstart = true; + } + + } + +} diff --git a/RealToon/RealToon/RealToon Tools/ShadowTSDFModeHelper.cs.meta b/RealToon/RealToon/RealToon Tools/ShadowTSDFModeHelper.cs.meta new file mode 100644 index 0000000..e78f55d --- /dev/null +++ b/RealToon/RealToon/RealToon Tools/ShadowTSDFModeHelper.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 95fa5deb8c924354ca0134d1af35c289 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/RealToon/RealToon/RealToon Tools/SmearEffectHelper.cs b/RealToon/RealToon/RealToon Tools/SmearEffectHelper.cs new file mode 100644 index 0000000..f8c8336 --- /dev/null +++ b/RealToon/RealToon/RealToon Tools/SmearEffectHelper.cs @@ -0,0 +1,315 @@ +//RealToon - Smear Effect [Helper] +//MJQStudioWorks +//2025 + +using UnityEngine; +using System.Collections.Generic; + +namespace RealToon.Script +{ + + [ExecuteAlways] + [AddComponentMenu("RealToon/Tools/Smear Effect - Helper")] + + public class SmearEffectHelper : MonoBehaviour + { + Queue recentPositions = new Queue(); + + [HideInInspector] + [SerializeField] + Transform[] SubTran; + + [HideInInspector] + [SerializeField] + Material[] Mat; + + [HideInInspector] + [SerializeField] + Transform[] attac; + + [Header("Note: Smear Effect feature will be automatically enable\nOn the materials of the object/model that uses RealToon Shader.")] + + [Space(25)] + + [SerializeField] + [Tooltip("An object to control the smear effect.")] + public Transform SmearController; + + [Space(10)] + + [SerializeField] + [Tooltip("How long the distorted line trails stays on the previous position.")] + int Delay = 15; + + [SerializeField] + [Tooltip("How large/small the trailing noise.")] + float NoiseSize = 100; + + [SerializeField] + [Tooltip("How tall/short the trailing noise.")] + float TrailSize = 1.5f; + + [Space(10)] + + [SerializeField] + [Tooltip("Pause the current smear effect.")] + bool PauseSmear = false; + + int coun_obj_wi_ralsha = 0; + int coun_obj_mat = 0; + int coun_obj_mat_arr = 0; + + [HideInInspector] + [SerializeField] + bool checkstart = true; + + string RT_Sha_Nam_URP = "Universal Render Pipeline/RealToon/Version 5/Default/Default"; + string RT_Sha_Nam_HDRP = "HDRP/RealToon/Version 5/Default"; + + void Start() + { + if (checkstart == true) + { + InitStart(); + checkstart = false; + } + } + + void LateUpdate() + { + if (SmearController != null) + { + if (PauseSmear != true) + { + if (Mat != null) + { + foreach (Material mate in Mat) + { + if (mate != null) + { + mate.SetVector("_ObjPosi", SmearController.position); + recentPositions.Enqueue(SmearController.position); + + if (recentPositions.Count > Delay) + mate.SetVector("_PrevPosition", recentPositions.Dequeue()); + + Set_Shad_Prop(mate); + + } + + } + } + } + } + } + void Reset() + { + if (Mat != null) + { + foreach (Material mate in Mat) + { + if (mate != null) + { + mate.SetVector("_ObjPosi", new Vector4(0, 0, 0, 0)); + mate.SetVector("_PrevPosition", new Vector4(0, 0, 0, 0)); + } + } + recentPositions.Dequeue(); + recentPositions.Clear(); + checkstart = true; + coun_obj_wi_ralsha = 0; + coun_obj_mat = 0; + coun_obj_mat_arr = 0; + Res_Shad_Prop(); + InitStart(); + checkstart = false; + } + } + + void OnDisable() + { + recentPositions.Dequeue(); + foreach (Material mate in Mat) + { + if (mate != null) + { + mate.SetVector("_ObjPosi", new Vector4(0, 0, 0, 0)); + mate.SetVector("_PrevPosition", new Vector4(0, 0, 0, 0)); + } + } + } + + /* Remove Later + void OnDestroy() + { + recentPositions.Clear(); + Res_Shad_Prop(); + foreach (Material Mate in Mat) + { + if (Mate != null) + { + if (Mate.shader.name == RT_Sha_Nam_URP || Mate.shader.name == RT_Sha_Nam_HDRP) + { + Mate.SetVector("_ObjPosi", new Vector4(0, 0, 0, 0)); + Mate.SetVector("_PrevPosition", new Vector4(0, 0, 0, 0)); + Mate.SetFloat("_N_F_SE", 0.0f); + Mate.DisableKeyword("N_F_SE_ON"); + } + } + } + } + */ + + #region Init + + void InitStart() + { + if (attac == null || attac.Length == 0) + { + attac = this.gameObject.GetComponentsInChildren(); + } + + if (SmearController == null) + { + SmearController = this.gameObject.transform; + } + + int x = 0; + foreach (Transform Trans in attac) + { + + if (Trans.GetComponent() == true) + { + if (Trans.GetComponent().sharedMaterial != null) + { + if (Trans.GetComponent().sharedMaterial.shader.name == RT_Sha_Nam_URP || Trans.GetComponent().sharedMaterial.shader.name == RT_Sha_Nam_HDRP) + { + coun_obj_wi_ralsha++; + coun_obj_mat += Trans.GetComponent().sharedMaterials.Length; + } + } + + } + + if (Trans.GetComponent() == true) + { + if (Trans.GetComponent().sharedMaterial != null) + { + if (Trans.GetComponent().sharedMaterial.shader.name == RT_Sha_Nam_URP || Trans.GetComponent().sharedMaterial.shader.name == RT_Sha_Nam_HDRP) + { + coun_obj_wi_ralsha++; + coun_obj_mat += Trans.GetComponent().sharedMaterials.Length; + } + + } + } + + } + + SubTran = new Transform[coun_obj_wi_ralsha]; + + foreach (Transform Trans in attac) + { + if (Trans.GetComponent() == true) + { + if (Trans.GetComponent().sharedMaterial != null) + { + if (Trans.GetComponent().sharedMaterial.shader.name == RT_Sha_Nam_URP || Trans.GetComponent().sharedMaterial.shader.name == RT_Sha_Nam_HDRP) + { + SubTran[x] = Trans; + x++; + } + + } + + } + + if (Trans.GetComponent() == true) + { + if (Trans.GetComponent().sharedMaterial != null) + { + if (Trans.GetComponent().sharedMaterial.shader.name == RT_Sha_Nam_URP || Trans.GetComponent().sharedMaterial.shader.name == RT_Sha_Nam_HDRP) + { + SubTran[x] = Trans; + x++; + } + } + } + } + + + Mat = new Material[coun_obj_mat]; + + + foreach (Transform Trans in SubTran) + { + if (Trans.GetComponent() == true) + { + if (Trans.GetComponent().sharedMaterial != null) + { + if (Trans.GetComponent().sharedMaterial.shader.name == RT_Sha_Nam_URP || Trans.GetComponent().sharedMaterial.shader.name == RT_Sha_Nam_HDRP) + { + for (int i = 0; i < Trans.GetComponent().sharedMaterials.Length; i++) + { + Mat[coun_obj_mat_arr] = Trans.GetComponent().sharedMaterials[i]; + coun_obj_mat_arr++; + } + } + + } + + } + + if (Trans.GetComponent() == true) + { + if (Trans.GetComponent().sharedMaterial != null) + { + if (Trans.GetComponent().sharedMaterial.shader.name == RT_Sha_Nam_URP || Trans.GetComponent().sharedMaterial.shader.name == RT_Sha_Nam_HDRP) + { + + for (int i = 0; i < Trans.GetComponent().sharedMaterials.Length; i++) + { + Mat[coun_obj_mat_arr] = Trans.GetComponent().sharedMaterials[i]; + coun_obj_mat_arr++; + } + } + } + } + + } + + foreach (Material Mat in Mat) + { + if (Mat != null) + { + Set_Shad_Prop(Mat); + } + } + + } + + #endregion + + void Set_Shad_Prop(Material Mat) + { + if (Mat.IsKeywordEnabled("N_F_SE_ON") == true) + { + Mat.SetFloat("_NoiseSize", NoiseSize); + Mat.SetFloat("_TrailSize", TrailSize); + } + else if (Mat.IsKeywordEnabled("N_F_SE_ON") != true) + { + Mat.EnableKeyword("N_F_SE_ON"); + Mat.SetInt("_N_F_SE", 1); + } + } + void Res_Shad_Prop() + { + NoiseSize = 100; + TrailSize = 1.5f; + Delay = 15; + } + + } + +} \ No newline at end of file diff --git a/RealToon/RealToon/RealToon Tools/SmearEffectHelper.cs.meta b/RealToon/RealToon/RealToon Tools/SmearEffectHelper.cs.meta new file mode 100644 index 0000000..b1f538f --- /dev/null +++ b/RealToon/RealToon/RealToon Tools/SmearEffectHelper.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 70edf0dcaad695848aedb4f363c11b43 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/RealToon/RealToon/RealToon Tools/SmoothObjectNormalHelper.cs b/RealToon/RealToon/RealToon Tools/SmoothObjectNormalHelper.cs new file mode 100644 index 0000000..44e3405 --- /dev/null +++ b/RealToon/RealToon/RealToon Tools/SmoothObjectNormalHelper.cs @@ -0,0 +1,129 @@ +//RealToon - SmoothObjectNomal [Helper] +//MJQStudioWorks +//©2025 + +using UnityEngine; + +namespace RealToon.Script +{ + [ExecuteAlways] + [AddComponentMenu("RealToon/Tools/Smooth Object Normal - Helper")] + public class SmoothObjectNormalHelper : MonoBehaviour + { + [Header("Note: Smooth Object Normal feature will be automatically enable\nWhen you put a material that uses RealToon Shader on the Material slot.")] + + [Space(25)] + + [SerializeField] + [Range(0f, 1f)] + [Tooltip("The amount of Smoothed Object Normal.")] + public float Intensity = 0; + + [Space(10)] + [SerializeField] + [Tooltip("A material that uses 'RealToon - Smooth Object Normal' feature.")] + public Material Material = null; + + [SerializeField] + [Tooltip("An object to follow the position.")] + public Transform ObjectToFollow = null; + + [Space(10)] + [SerializeField] + [Tooltip("Show object normal.")] + public bool ShowNormal = false; + + [HideInInspector] + [SerializeField] + bool checkstart = true; + + string RT_Sha_Nam_URP = "Universal Render Pipeline/RealToon/Version 5/Default/Default"; + string RT_Sha_Nam_HDRP = "HDRP/RealToon/Version 5/Default"; + + string RT_Sha_Nam_BiRP_DD = "RealToon/Version 5/Default/Default"; + string RT_Sha_Nam_BiRP_DFT = "RealToon/Version 5/Default/Fade Transparency"; + string RT_Sha_Nam_BiRP_DR = "RealToon/Version 5/Default/Refraction"; + string RT_Sha_Nam_BiRP_TDD = "RealToon/Version 5/Tessellation/Default"; + string RT_Sha_Nam_BiRP_TDFT = "RealToon/Version 5/Tessellation/Fade Transparency"; + string RT_Sha_Nam_BiRP_TDR = "RealToon/Version 5/Tessellation/Refraction"; + + string RT_Sha_Nam_BiRP_LD = "RealToon/Version 5/Lite/Default"; + string RT_Sha_Nam_BiRP_LFT = "RealToon/Version 5/Lite/Fade Transparency"; + + void LateUpdate() + { + + if (Material == null || ObjectToFollow == null) + { } + else + { + if (Material.shader.name == RT_Sha_Nam_URP || + Material.shader.name == RT_Sha_Nam_HDRP || + Material.shader.name == RT_Sha_Nam_BiRP_DD || + Material.shader.name == RT_Sha_Nam_BiRP_DFT || + Material.shader.name == RT_Sha_Nam_BiRP_DR || + Material.shader.name == RT_Sha_Nam_BiRP_TDD || + Material.shader.name == RT_Sha_Nam_BiRP_TDFT || + Material.shader.name == RT_Sha_Nam_BiRP_TDR || + Material.shader.name == RT_Sha_Nam_BiRP_LD || + Material.shader.name == RT_Sha_Nam_BiRP_LFT) + { + Vector3 ObjPos = ObjectToFollow.gameObject.transform.position; + Material.SetVector("_XYZPosition", ObjPos); + Material.SetFloat("_SmoothObjectNormal", Intensity); + } + } + + } + + void OnValidate() + { + if (Material == null) + { + checkstart = true; + } + else if (Material != null) + { + if (Material.shader.name == RT_Sha_Nam_URP || + Material.shader.name == RT_Sha_Nam_HDRP || + Material.shader.name == RT_Sha_Nam_BiRP_DD || + Material.shader.name == RT_Sha_Nam_BiRP_DFT || + Material.shader.name == RT_Sha_Nam_BiRP_DR || + Material.shader.name == RT_Sha_Nam_BiRP_TDD || + Material.shader.name == RT_Sha_Nam_BiRP_TDFT || + Material.shader.name == RT_Sha_Nam_BiRP_TDR || + Material.shader.name == RT_Sha_Nam_BiRP_LD || + Material.shader.name == RT_Sha_Nam_BiRP_LFT) + { + if (checkstart == true) + { + if (Material.IsKeywordEnabled("N_F_SON_ON") == false) + { + Material.EnableKeyword("N_F_SON_ON"); + Material.SetFloat("_N_F_SON", 1.0f); + checkstart = false; + } + } + + switch(ShowNormal) + { + case true: + Material.SetFloat("_ShowNormal", 1.0f); + break; + case false: + Material.SetFloat("_ShowNormal", 0.0f); + break; + } + } + } + } + + void Reset() + { + Material = null; + ObjectToFollow = null; + checkstart = true; + } + + } +} diff --git a/RealToon/RealToon/RealToon Tools/SmoothObjectNormalHelper.cs.meta b/RealToon/RealToon/RealToon Tools/SmoothObjectNormalHelper.cs.meta new file mode 100644 index 0000000..6ef7fde --- /dev/null +++ b/RealToon/RealToon/RealToon Tools/SmoothObjectNormalHelper.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 81bb1f0a42687e64bbbb9942add38b86 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/RealToon/RealToon/What's New.txt b/RealToon/RealToon/What's New.txt new file mode 100644 index 0000000..331265e --- /dev/null +++ b/RealToon/RealToon/What's New.txt @@ -0,0 +1,51 @@ +What's New to RealToon V5.0.13 (June 2025) +===================================== + +[New] +- VRC Light Volumes Support (VRChat) (Built-In/BiRP) +*VRC Light Volumes packages is needed to be able to use this. + +- Anti - Aliasing Softness (New Companion Option for Anti - Aliasing Affect Cutout) (URP) +*This will adjust the Anti - Aliasing Softness/Hardness Cutout. + +- Stencil: Pass (New Option For Outline) (URP) +*Use it to resolve 'Mask UI' and other assets like weather and fog overlap issues. +*Use 'Keep' for Mask UI while 'Invert' for other assets like weather and fog. + +- Limit Light Intensity (New Option For Lighthing) (Built-In/BiRP, URP & HDRP) +*To limit light intensity, minimum and maximum intensity value. + +- RealToon Resources (New Folder Added) +*Some resource for you to use on your objects/models that uses RealToon Shader. + +- A new Improved RealToon Welcome Screen +*You can just click a button to import the right RealToon Shader package. +*Information section about your project including SRP version and Unity Versions, +You don't need to go to package manager to see the versions. + +- Map Mode (New Option For Self Lit) +*This will allow you to use Emission Maps. + +- Lightmap Support (RealToon Shader - Default Lite) (Built-In/BiRP) +- WebGPU support (URP) (Unity 6 to Later) +- Nintendo Switch 2 support (URP & HDRP) + + +[Changes] +- Change RealToon Reflection Roughtness shader variable "_ReflectionRoughtness" to "_Smoothness". (URP) +*Changed so that other assets affects RealToon's Reflection roughtness value. + +[Fixed] +- 'Cutout' does not affect Depth. (URP) +- 'Anisotropic Highlights' does not work. (URP) (Deferred and Deferred+) (Unity 6.1) +- 'UI Mask' overlap issues, resolve by setting the added new outline option 'Stencil: Pass' to 'Keep'. (URP) +- 'Gloss Texture Follow Light' not working properly. (URP) +- Raytracing doubled declared punctual light function. (HDRP) + +==================================== + +#Read the "Change - Fix Log.txt." file for previous updates. +#This update supports Unity 5, 2017, 2018, 2019, 2020, 2022, 2023, Unity 6 and future unity versions. + +[Other Notes] +* If you encounter some problems or need help just contact by email. \ No newline at end of file diff --git a/RealToon/RealToon/What's New.txt.meta b/RealToon/RealToon/What's New.txt.meta new file mode 100644 index 0000000..f2d42cf --- /dev/null +++ b/RealToon/RealToon/What's New.txt.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: c26904c71091b8245b97cc178a3802dc +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/RealToon/package.json b/RealToon/package.json new file mode 100644 index 0000000..20cab50 --- /dev/null +++ b/RealToon/package.json @@ -0,0 +1,8 @@ +{ + "name": "realtoon", + "displayName": "RealToon", + "version": "5.0.13", + "unity": "2018.3", + "keywords": [], + "category": "Unity" +} diff --git a/RealToon/package.json.meta b/RealToon/package.json.meta new file mode 100644 index 0000000..d8aa884 --- /dev/null +++ b/RealToon/package.json.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 499dede7cae51224aa8f215b63a4d149 +PackageManifestImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: