44 lines
2.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: ToonShaderModel
date: 2023-12-18 10:00:34
excerpt:
tags:
rating: ⭐
---
# ToonStandardCel打底
## Diffuse
```c++
//Lighting.Diffuse *= AreaLight.FalloffColor * (Falloff * HalfLambert);
//TODO:添加阴影过渡效果。
//ToonShadow添加类型1.PBR(只能调整过渡颜色) Lighting.Diffuse = DiffuseColor * (1 / PI) * AreaLight.FalloffColor * (Falloff * HalfLambert); 2.ShadowColorTexture兼容RampTexture效果也就是原神的效果还需要添加ShadowColorIntensity后需要改成曝光相关额东西。Lighting.Diffuse = DiffuseColor * (1 / PI);
//ToonLighting添加类型1.PBR多光源模式2.主光有效针对cel。
//---------------------------------------------------------
//Specular
//ToonSpecular添加类型1.PBR 2. 各项异性defaultLit3. 各项异性头发 4. 自定义高光大小与过渡效果 https://zhuanlan.zhihu.com/p/361918341 5.自定义高光形状贴图 https://zhuanlan.zhihu.com/p/640258070 https://github.com/AnCG7/URPShaderCodeSample/blob/891034b3fa6e838e2b231390755479f0f649f181/Assets/Shaders/NPR/Cartoon/Stylized%20Highlight%20(Transform).shader#L2
```
**ToonShadow**
再实现阴影偏移以及阴影羽化效果的基础上。
1. PBR兼容UE默认阴影效果。只能调节阴影过渡颜色。使用的公式为 `Lighting.Diffuse = DiffuseColor * (1 / PI) * AreaLight.FalloffColor * (Falloff * HalfLambert);`
2. ShadowColorTexture用于定义ShadowColor使用贴图指定ShadowColor
**ToonLighting**
1. PBRUE默认光照多光源模式。
2. 仅主光有效针对cel。
## Specular
**ToonSpecular**
1. PBRUE默认高光效果。
2. 各项异性defaultLitUE默认的各向异性高光效果。
3. 各项异性头发 **Kajiya-Kay**高光模型。
4. 自定义高光大小与过渡效果https://zhuanlan.zhihu.com/p/361918341
5. 自定义高光形状贴图https://zhuanlan.zhihu.com/p/640258070 https://github.com/AnCG7/URPShaderCodeSample/blob/891034b3fa6e838e2b231390755479f0f649f181/Assets/Shaders/NPR/Cartoon/Stylized%20Highlight%20(Transform).shader#L2
## 罪恶装备渲染效果还原
- https://zhuanlan.zhihu.com/p/513598386
- https://zhuanlan.zhihu.com/p/493802718
## 蓝色协议
# 厚涂 ShaderModel通过修改预积分ShaderModel