Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

A very simple toon lit shader example, for you to learn writing custom lit shader in Unity URP

License

NotificationsYou must be signed in to change notification settings

ColinLeung-NiloCat/UnityURPToonLitShaderExample

Repository files navigation

This repository does NOT contain the full version of NiloToonURP.
Instead, it includes a simple, short and easy-to-read URP toon shader example for Unity2022.3LTS, which is intended for shader coding tutorial purposes. The shader example is licensed under the MIT license, giving you the freedom to use the code as you wish. If you'd like to retain the current tutorial shader, we recommend forking it or downloading a copy now, as it may be removed in the future.

*this README also shows photos and information about the NiloToonURP(full version)

NiloToonURP(full version)'s rendering

screenshotscreenshotshader ONscreenshotshader OFFscreenshotshader ONscreenshotshader OFFscreenshotshader ONscreenshotshader OFFscreenshot

screenshotOutline options(1/2/3)
screenshotscreenshotscreenshotscreenshotscreenshotshader ONscreenshotshader OFFscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshot

We are now developing an 'easy-to-use, high-performance, and cross-platform (including mobile, VR, and WebGL)' closed-source toon shader package—NiloToonURP—to assist Unity URP users in achieving high-quality anime/toon-like rendering.

NiloToonURP is supporting:

  • Unity 2021.3LTS(URP 12.x)
  • Unity 2022.3LTS(URP 14.x)
  • Unity 2023.2 (URP 16.x)
  • Unity6 (URP 17.x)

Download NiloToonURP PC .exe demo (2021.3.17LTS build):

Download NiloToonURP Android .apk demo (2021.3.17LTS build):

NiloToonURP's demo runtime video:

NiloToonURP's UI preview:

How to get NiloToonURP full source code?

If you or your company/organization/team needs:

  • latest full source code (with all detail comments and notes, NOT Obfuscated code, NOT .dll)
  • latest user document
  • perpetual royalty-free commercial license
  • every future update
  • NiloToon's tech support
  • (optional) we set up your character models's rendering in the best way possible for you, using NiloToonURP
  • (optional) your project-specific customization and support

of NiloToonURP for your URP project, please send the following info tonilotoon@gmail.com

  • name (your personal name or your company/organization/team's name)
  • a google account email for gaining permission to download all NiloToonURP files in google drive
  • any public website that shows your/your company/organization/team's work or public media (e.g. personal website/company website/youtube/bilibili/twitter...)

NiloToonURP user's creations (public media, not NDA content)

*we only provided NiloToonURP's download permission + tech support, we didn't work on these creations directly

Genshin Impact MV - When The Stars Align (Genshin Impact website ->http://genshin.hoyoverse.com)

screenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshot

キラッとプリ⭐︎チャン (https://twitter.com/pretty_vlive)

screenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshot

VSPO!(ぶいすぽっ!) - 空澄セナ -Asumi Sena- (https://www.youtube.com/@asumi_sena)

screenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshot

Suisei Channel - hololive (https://www.youtube.com/@HoshimachiSuisei)

screenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshot

WAKTAVERSE - 이세계아이돌/IsegyeIdol (https://www.youtube.com/@waktaverse)

screenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshot

VSPO!(ぶいすぽっ!) - 胡桃のあ (https://www.youtube.com/@963Noah)

screenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshot

VVV MUSIC LIVE 公式(ブイスリー) (https://twitter.com/VVVMusicLive)

screenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshot

screenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshot

hololive ホロライブ - VTuber Group (https://www.youtube.com/@hololive)

screenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshot

杏仁ミル Annin Miru Channel (https://www.youtube.com/@AnninMiru)

screenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshot

Nakiri Ayame Ch. 百鬼あやめ (https://www.youtube.com/@NakiriAyame)

screenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshot

ISEGYE IDOL (이세계아이돌) - 주르르 JURURU (https://www.youtube.com/@JU_RURU)

screenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshot

ぶいごまチャンネル V後藤真希 (https://www.youtube.com/@V_GOTO_MAKI)

screenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshot

VSPO!(ぶいすぽっ!) - 小森めと (https://www.youtube.com/@Met_Komori)

screenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshot

screenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshot

Starseed:Asnia Trigger / 스타시드: 아스니아 트리거 (starseed.com2us.com)

screenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshot

Neo-Porte(ネオポルテ)- 天帝フォルテ / Tentei Forte (https://www.youtube.com/@tenteiforte4631)

screenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshot

screenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshot

Watame Ch. 角巻わため (https://www.youtube.com/@TsunomakiWatame)

screenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshot

VirtuaReal / Nijisanji CN - 七海Nana7mi (https://space.bilibili.com/434334701)

screenshotscreenshotscreenshotscreenshot

vα-liv公式📣ヴイアラ (https://x.com/valiv_official)

screenshot

사탄의 부러진 뿔 (https://www.youtube.com/@geumjaBBul)

screenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshot

Neo-Porte(ネオポルテ)- 夜絆ニウ / yozuna niu (https://www.youtube.com/@niu_yozuna)

screenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshot

ISEGYE IDOL (이세계아이돌) - 주르르 JURURU (https://www.youtube.com/@JU_RURU)

screenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshot

screenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshot

すいみゃ / suimya (https://www.youtube.com/@suimya)

screenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshot

StelLive - 아라하시 타비 ARAHASHI TABI (https://www.youtube.com/@arahashitabi)

screenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshot

Stargazer Official @ 스타게이저 @ スターゲイザー (https://twitter.com/StargazerCoLtd)

screenshot

VSPO!(ぶいすぽっ!) - 花芽すみれ (https://www.youtube.com/@KagaSumire)

screenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshot

VirtuaReal Star - hanser (https://space.bilibili.com/11073)

screenshotscreenshotscreenshotscreenshot

Gawr Gura Ch. hololive-EN (https://www.youtube.com/@GawrGura):

screenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshot

Neo-Porte(ネオポルテ)-緋月ゆい / Hizuki Yui

screenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshot

VSPO!(ぶいすぽっ!【公式】) (https://www.youtube.com/@Vspo77)

screenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshot

Takanashi Kiara Ch. hololive-EN (https://www.youtube.com/@TakanashiKiara)

screenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshot

screenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshot

IRyS Ch. hololive-EN (https://www.youtube.com/@IRyS)

screenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshot

VSPO!(ぶいすぽっ!【公式】) (https://www.youtube.com/@Vspo77)

screenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshot

阿梓从小就很可爱 (https://space.bilibili.com/7706705/)

screenshotscreenshotscreenshotscreenshotscreenshot

screenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshot

VSPO!(ぶいすぽっ!) - 夜乃くろむ (https://www.youtube.com/@YanoKuromu)

screenshot

hololive - Shion Ch. 紫咲シオン (https://www.youtube.com/@MurasakiShion)

screenshotscreenshotscreenshotscreenshot

  • 【holo27 MV】紫咲シオン x ラプラス・ダークネス - リップシンク【ホロライブ x DECO27】 ->https://youtu.be/NjtIAuZQN_E

VSPO!(ぶいすぽっ!【公式】) (https://www.youtube.com/@Vspo77)

screenshotscreenshotscreenshotscreenshotscreenshotscreenshot

screenshotscreenshotscreenshot

VSPO!(ぶいすぽっ!) - 八雲べに (https://www.youtube.com/@yakumo_beni)

screenshotscreenshotscreenshotscreenshotscreenshot

Moona Hoshinova hololive-ID (https://www.youtube.com/@MoonaHoshinova):

screenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshot

AIChannel中国绊爱 (https://space.bilibili.com/484322035)

screenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshot

史黛菈 埃蕾諾亞 / Stella Eleanor Ch. (https://www.youtube.com/@NKStellaEleanor)

screenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshot

screenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshot

懶貓子 & 杏仁ミル

screenshotscreenshot

Rumi ch. 懶貓子 (https://youtu.be/Zlef92wDMnA):

screenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshot

エルセ/ Else (https://x.com/Else_PJblue)

screenshotscreenshotscreenshotscreenshotscreenshot

Nijisanji & bilibili - VirtuaReal (https://www.nijisanji.jp/talents?filter=virtuareal):

screenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshot

ISEGYE IDOL (이세계아이돌) - 비챤 VIichan (https://www.youtube.com/@viichan116)

screenshotscreenshotscreenshotscreenshot

screenshotscreenshotscreenshotscreenshotscreenshotscreenshot

崩坏学园2-灵依娘desu (https://space.bilibili.com/133934):

screenshotscreenshotscreenshotscreenshotscreenshotscreenshot

screenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshot

screenshotscreenshotscreenshotscreenshot

screenshotscreenshotscreenshotscreenshotscreenshotscreenshot

screenshotscreenshotscreenshotscreenshotscreenshot

screenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshot

psplive - 白神遥Haruka (https://space.bilibili.com/477332594)

screenshotscreenshotscreenshotscreenshotscreenshot

screenshot

screenshotscreenshotscreenshotscreenshotscreenshot

screenshotscreenshotscreenshot

screenshotscreenshotscreenshotscreenshot

screenshotscreenshot

screenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshot

Warudo on Steam(supporting NiloToonURP) (https://store.steampowered.com/app/2079120/Warudo/)

screenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshot

screenshot

  • Kanauru MV | CapSule - Mori Calliope x Hoshimachi Suisei

screenshotscreenshotscreenshot

screenshot

screenshotscreenshotscreenshotscreenshotscreenshot

VSPO!(ぶいすぽっ!) - 英リサ.Hanabusa Lisa (https://www.youtube.com/@lisahanabusa)

screenshotscreenshotscreenshotscreenshot

myer gugu(崩坏的栗子_108番) (https://www.artstation.com/myergugu)

screenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshot

screenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshot

Nijisanji & bilibili - VirtuaReal (https://www.nijisanji.jp/talents?filter=virtuareal):

screenshotscreenshotscreenshotscreenshot

screenshotscreenshotscreenshotscreenshotscreenshot(after clicking the link below, it will require you to press enter on the link again in your browser)

screenshot(after clicking the link below, it will require you to press enter on the link again in your browser)

screenshotscreenshotscreenshotscreenshotscreenshot

screenshotscreenshot

screenshotscreenshotscreenshot

screenshotscreenshotscreenshot

screenshot

screenshot

screenshot

screenshotscreenshotscreenshotscreenshot

screenshotscreenshotscreenshot

screenshot

screenshot

screenshot

screenshotscreenshotscreenshotscreenshotscreenshotscreenshot

VirtuaReal Star - hanser (https://space.bilibili.com/11073)

screenshotscreenshot

screenshot

screenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshot

screenshotscreenshotscreenshot

screenshotscreenshot

screenshotscreenshotscreenshotscreenshot

screenshotscreenshotscreenshot(you need to enter the link to the browser again in order to play it)

Other NiloToonURP's images (gallery)

screenshot

shader ONscreenshotshader OFFscreenshot

screenshot

shader ONscreenshotnormal debugscreenshotshader OFFscreenshot

screenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshotscreenshot


SHADER ONscreenshotscreenshotBEFOREscreenshotAFTER:screenshotsee it in motion->https://youtu.be/D9ocVzGJfI8


3D enviroment model TEST
screenshotscreenshotsee it in motion->https://youtu.be/GcW0pNo-zus

湊 あくあ(みなと あくあ,Minato Aqua) model TESTscreenshotscreenshotscreenshotsee it in motion->https://youtu.be/7zICgzdxuGg

Auto Phong tessellation

(shader off, no tessellation)screenshot(shader on, no tessellation)screenshot(shader on, enable tessellation! Phong tessellation can make your model smooth without changing your .fbx)screenshotsee it in motion->https://youtu.be/D-MxyBa0nJE

Kawaii model TEST (@ganbaru_sisters)screenshotscreenshot

SHADER ONscreenshotSHADER OFFscreenshotHDscreenshot

shader ONscreenshotshader OFFscreenshot


BEFOREscreenshotAFTERscreenshotsee it in motion->https://youtu.be/KpRkxPnHuK0

BEFOREscreenshotAFTERscreenshot(more shadow from trees)screenshot

BEFOREscreenshotAFTER:screenshotsee it in motion->https://youtu.be/hUWacEQH6js

BEFORE

screenshot

AFTER:

screenshot

BEFORE

screenshot

AFTER:

screenshot

add 2D hair shadow & rim light

screenshot


BEFOREscreenshotAFTER:screenshot


BEFOREscreenshotAFTER:Sunny + StreetLight ONscreenshotSunny + StreetLight OFFscreenshotNight + StreetLight ONscreenshotNight + StreetLight OFFscreenshotsee it in motion ->https://youtu.be/jDSnJmZrKPw

BEFOREscreenshotAFTERscreenshot

BEFOREscreenshotAFTERscreenshotsee it in motion ->https://youtu.be/ZfSZOHTBypc

BEFOREscreenshotAFTERscreenshotsee it in motion ->https://youtu.be/EgxiWPk-vaE


BEFOREscreenshotAFTERscreenshotsee it in motion ->https://youtu.be/Ty4DXLFqqDo

BEFOREscreenshotAFTERscreenshotsee it in motion ->https://youtu.be/cebGl_MaWnI

BEFOREscreenshotAFTERscreenshotsee it in motion ->https://youtu.be/nl5z0r8a9vk

screenshotscreenshotscreenshotsee it in motion ->https://youtu.be/uVI_QOioER4

Fake Skin SSS & specularscreenshotscreenshot

BEFOREscreenshotAFTERscreenshot

What is included in this simplified tutorial example toon-lit shader repository?

This repository only contains a very simple toon-lit URP tutorial shader example, to help people write their first custom toon-lit shader in URP.

This example shader's default result(without editing material params) = the following picturescreenshot

Because this example toon lit shader aims to help people learn shader writing in URP, it is an extremely simplified version. This repository only contains ~3% of the NiloToonURP(full version)'s code, which only contains the most basic & easily understandable sections, to make sure everyone can understand the shader code easily.

It is actually a "How to write your first custom toon-lit shader in URP?" example, instead of a good-looking toon-lit shader (lots of toon-lit tricks are not included in this example shader, for tutorial reasons).

Why create this "simplified version" toon lit shader?

Lots of my shader friends are looking for a toon-lit example shader in URP (not Shader Graph), I want them to switch to URP(instead of still staying in built-in RP), so I decided to provide a simple enough URP toon-lit shader example in URP.

How to try this simplified toon-lit example shader in my URP project?

  1. Clone all .shader & .hlsl files into your URP project.
  2. Put these files inside the same folder.
  3. Change your character's material's shader to "SimpleURPToonLitExample(With Outline)"
  4. make sure at least _BaseMap(albedo) is assigned
  5. setup DONE, you can now test your character with light probe/directional light/point light/spot light
  6. edit the material properties to see how the render result changes
  7. Most important: open these shader files, and spend some time reading them, you will understand how to write custom lit shaders in URP very quickly
  8. Most important: open "SimpleURPToonLitOutlineExample_LightingEquation.hlsl", edit it, and experiment with your own toon lighting equation ideas, which is the key part of toon lit shader!

I see the shader is working now, but the outline is broken?

For this tutorial shader, you can let Unity calculate smoothed normal for you, which can produce a better outline,but doing this will make the lighting slightly incorrect.

  1. click your character's .fbx
  2. In the model tab
  3. edit "Normals" to Calculate
  4. edit "Smoothing Angle" to 180

screenshot
before calculating smooth normal (print screen of the tutorial shader, not NiloToonURP)
screenshot
after calculating smooth normal (print screen of the tutorial shader, not NiloToonURP)screenshot

*NiloToonURP(full version) contains many editor/runtime C# scripts, some of them are for producing correct lighting and perfect outline together automatically.

What is NOT included in this simplified tutorial shader?

For simplicity reasons, most of the features from the NiloToonURP(full version) are removed, or else for beginners, this simple tutorial example shader will be way too complex for reading & learning. Some of the removed features are:

  • face anime lighting (auto-fix face ugly lighting due to vertex normal without modifying .fbx, very important)
  • smooth outline normal auto baking (auto-fix ugly outlines without modifying .fbx and lighting normal, very important)
  • auto 2D hair shadow on the face (very important, it is very difficult to produce good-looking shadow results on the face using URP's shadow map)
  • constant width rim light (similar to the method of Blue Protocol / Genshin Impact)
  • tricks to render eye/eyebrow over hair (ZOffset, stencil, and renderer redraw helpers)
  • PBR specular lighting (GGX)
  • all kinds of MatCap features(additive/multiply/shadow/replace...)
  • "HSV,tint,texture tint,texture override" shadow & outline color control
  • almost all the extra texture input options like roughness, specular, normal map, detail map, parallax, occlusion, emission...
  • LOTS of sliders to control lighting style, shadow color, final color, outline, rim light...
  • per character "dither fade inout / rim light / color control / extra outline / dissolve / ..." control script
  • volume override control of global "rim light / shadow / color control..."
  • special bloom post-process volume that can control the param of character/non-character area separately. Usually to prevent character over-bloom, or make the character emitting bloom on allowed areas only
  • anime postprocessing volume
  • shadow control volume
  • perspective removal per character, to avoid character's 3D distorted by high FOV camera
  • shader stripping editor script, to keep runtime shader memory usage and build time lower
  • (lots of other features)
  • just too much for me to write all the removed features here, the NiloToonURP(full version) and this simple tutorial shader example are two totally different products already

How to get a test character model?

The easiest way to get a character model is by downloading Unity-Chan in the Unity AssetStore.

Also, here are some websites where you can download models(If the creator allows it)

if you downloaded a .pmx file, use MMD4Mecanim to convert it to .fbx & prefab directly inside unityhttp://stereoarts.jp/

if you downloaded a .vrm file, use UniVRM to convert it to prefab directly inside Unityhttps://github.com/vrm-c/UniVRM

Editor version requirement

  • Unity 2022.3

Apply our shader to another model (2020-2 early version screenshots)https://youtu.be/uVI_QOioER4

screenshotscreenshotscreenshotscreenshotscreenshotscreenshot

More old screenshots from the Full version shader:

screenshothttps://youtu.be/IP293mAmBCk

screenshotscreenshotscreenshot

screenshotscreenshot

different Background image TESTscreenshotscreenshotscreenshotscreenshotscreenshot

Credits

model's creator in shader demo image/video:

About

A very simple toon lit shader example, for you to learn writing custom lit shader in Unity URP

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp