Skip to content
项目

关于

使用 Shader Graph 为 Unity 打造的角色向卡通着色器。

游戏与模拟器

这些数字如何统计

可以做什么

  • Supports multiple light sources and types.
  • Adjustable shading bands.
  • Beautiful gloss and Fresnel effects.
  • Shade detection with Raycasting ("faking" reciving shadows on an unlit material).

实测星标增长

24小时
-3
7天
-3
15天
-3
1个月
正在收集历史

各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。

README.md

原文

Awesome Toon Shader

A character focused Toon Shader for Unity using Shader Graph. Using a C# helper script on the object to supply lighting data to the material, making it flexible and programmable. While it's not the most optimised and ideal approach for every scenario, it's a different take on toon shading and passing lighting data.

Improvements, forks and pull requests are welcome. Be sure to check out the tutorial to follow the process of building this shader from scratch.

Tutorial

How to build this shader from scratch:

Awesomeness & Features

  • Supports multiple light sources and types.
  • Adjustable shading bands.
  • Beautiful gloss and Fresnel effects.
  • Shade detection with Raycasting ("faking" reciving shadows on an unlit material).

Drawbacks

  • Not ideal for enviroment shading (In it's current configuration, could be repurposed to work better).
  • Doesn't receive shadows directly, but fakes it by turning light sources off/on, by testing visibility with raycasting.
  • Lighting is relative to the mesh center rather than the mesh surface position. This difference is usually not noticable, apart from when you are standing on top of a light source.

How to use

  1. Apply the AwesomeToonHelper script to your character (On the Game object with the Mesh renderer)
  2. Create a material with the AwesomeToon shader, and set this as the SourceMaterial input on the Awesome Toon Helper component.
  3. On the material set a Shading Gradient to one of the gradients in this repo, or make your own.
  4. Play around!

Material instancing (Sharing material between many characters)

By default the script will take a copy of your material and apply it to the model. Any changes to this copy (instance) will not be retained, this allows many characters to share the same source material and have individual lighting data. If you are making changes to the source material, uncheck instance material temporarily.

Troubleshoot

Error: Could not find Sub Graph...

If the Awesome Toon Sub node is not found in the Awesome Toon shader, delete it and add it back in again, then save.

Everything looks bright and washedout

Depending on the lighting setup of your scene, you might have to delete the "Baked GI" node for things to look right.

Shade detection doesn't work

Raycasts need a mask to work, set it to Default and add other relevant layers to the mark for it to detect if light sources are obstructed.

探索相关项目

加载中…