Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions .github/tests/HostedUnityReviewContracts.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -729,9 +729,15 @@ Describe 'Hosted Unity review contracts' {
ForEach-Object { $_.Trim() }
)
$artifactRoot = '${{ runner.temp }}\PureBase-Release-Validation-${{ github.run_id }}-${{ github.run_attempt }}'
$pathLines.Count | Should -Be 2
$pathLines | Should -Contain "$artifactRoot\validated-package"
$pathLines | Should -Contain "$artifactRoot\repository-state.json"
$expectedPathLines = @(
"$artifactRoot\validated-package"
"$artifactRoot\repository-state.json"
"$artifactRoot\ReleaseConsumer-*\**\runtime-readbacks.json"
"$artifactRoot\ReleaseConsumer-*\**\library-reset.json"
"$artifactRoot\ReleaseConsumer-*\**\*summary.json"
"$artifactRoot\ReleaseConsumer-*\**\*.log"
)
$pathLines | Should -Be $expectedPathLines
($pathLines -join "`n") | Should -Not -Match '\.\.'
}

Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/release-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,10 @@ jobs:
path: |
${{ runner.temp }}\PureBase-Release-Validation-${{ github.run_id }}-${{ github.run_attempt }}\validated-package
${{ runner.temp }}\PureBase-Release-Validation-${{ github.run_id }}-${{ github.run_attempt }}\repository-state.json
${{ runner.temp }}\PureBase-Release-Validation-${{ github.run_id }}-${{ github.run_attempt }}\ReleaseConsumer-*\**\runtime-readbacks.json
${{ runner.temp }}\PureBase-Release-Validation-${{ github.run_id }}-${{ github.run_attempt }}\ReleaseConsumer-*\**\library-reset.json
${{ runner.temp }}\PureBase-Release-Validation-${{ github.run_id }}-${{ github.run_attempt }}\ReleaseConsumer-*\**\*summary.json
${{ runner.temp }}\PureBase-Release-Validation-${{ github.run_id }}-${{ github.run_attempt }}\ReleaseConsumer-*\**\*.log
if-no-files-found: error
retention-days: 14
compression-level: 0
Expand Down
11 changes: 11 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
2026/08/11
Ver. 0.2.0-beta.2
https://github.com/Penguin-Repository/Pure-Base/releases#release-0.2.0-beta.2

- Added the module-free Toon host's stable direct-plus-SH direction and bright/dark SH-band behavior while preserving Shader-Core lightmap input and ForwardBase/ForwardAdd ownership.
- Documented that Hybrid retains its existing PBR path, binary direct diffuse, Unity Standard indirect GI, reflection probes, and direct GGX specular without Toon SH direction or banding.
- Preserved the public property ABI so existing materials need no migration.
- Added Daily lighting-contract coverage for Toon direction and SH bands, lightmaps, ForwardAdd isolation, and Hybrid PBR boundaries.
- Added lilToon 2.3.4 MIT and OpenLit 1.0.2 CC0 concept provenance without implying endorsement or contributor participation.
- Updated the package version and release download identity to `0.2.0-beta.2`.

2026/08/11
Ver. 0.2.0-beta.1
https://github.com/Penguin-Repository/Pure-Base/releases#release-0.2.0-beta.1
Expand Down
18 changes: 15 additions & 3 deletions Docs/pure-base-shader-contract.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ The package publishes exactly these shader paths:
| Shader path | Contracted model |
| --- | --- |
| `PureBase/Unlit` | Ignores host direct and indirect lighting in the final output, except for module effects. |
| `PureBase/Toon` | Uses binary direct diffuse response with ambient and lightmap lighting. |
| `PureBase/Toon` | Uses binary direct diffuse with a stable direct-plus-SH direction, bright/dark SH bands, and Shader-Core lightmap input. |
| `PureBase/PBR` | Uses a continuous direct metallic BRDF with Unity Standard indirect GI and reflection probes. |
| `PureBase/Hybrid` | Replaces only the PBR direct diffuse response with Toon-style binary diffuse while sharing PBR specular and IBL. |

Expand Down Expand Up @@ -149,15 +149,27 @@ Unlit returns the base surface without host direct, baked, ambient, or environme

### Toon

Toon evaluates a binary direct diffuse response from the surface normal and light direction. `ForwardBase` combines the direct result with ambient and baked lightmap lighting. `ForwardAdd` contributes direct light only.
Toon evaluates a binary direct diffuse response from the surface normal and light direction. Its `ForwardBase` direction combines the Shader-Core direct aggregate with the first-order SH direction, and its ambient result selects a fixed bright or dark SH band from that direction. Shader-Core continues to provide the lightmap input; when Shader-Core supplies the lightmap aggregate, Toon does not synthesize an additional baked-light contribution. `ForwardAdd` contributes direct light only.

### PBR

PBR evaluates a continuous metallic BRDF for direct lighting. Its `ForwardBase` also evaluates Unity Standard indirect GI and reflection probes. Its `ForwardAdd` evaluates only the additional direct BRDF contribution.

### Hybrid

Hybrid uses the PBR metallic, specular, and indirect IBL implementation, but replaces only its direct diffuse response with the Toon-style binary response. It retains the PBR `ForwardBase` and `ForwardAdd` ownership rules.
Hybrid preserves the mathematically identical binary direct-diffuse equation in its existing PBR path, but does not use Toon SH banding. Toon SH never feeds Hybrid's lighting direction. Hybrid retains Unity Standard indirect GI, reflection probes, the PBR direct-light direction, and direct GGX specular, together with the PBR `ForwardBase` and `ForwardAdd` ownership rules.

## Toon Lighting Classification and Compatibility

The following boundary is fixed for the module-free Toon host:

| Classification | Lighting concepts |
| --- | --- |
| Host-essential | Binary diffuse, stable direct-plus-SH scene direction, bright/dark SH bands, Shader-Core lightmap input, and `ForwardBase`/`ForwardAdd` separation. |
| Shader-Core module-owned | Configurable shadow bands, colors, and masks; direction overrides; lighting limits; monochrome and as-unlit controls; and other optional artistic controls. |
| Out of scope | SRP or platform integrations, APV/LPPV, light volumes, LTCGI, and unrelated lilToon effects. |

The fixed host behavior adds no public property, keyword, pass, variant, or dependency. The public property ABI is unchanged, so existing materials require no migration and receive the fixed Toon host behavior automatically.

## Module Boundary

Expand Down
14 changes: 12 additions & 2 deletions Docs/technical-information.ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Pure Base は Shader-Core を動かすための最小構成の土台です。多
| シェーダー名 | 特徴 |
| --- | --- |
| `PureBase/Unlit` | ライティングの影響を受けない基本色表示 |
| `PureBase/Toon` | 明暗をはっきり分けるトゥーン表示 |
| `PureBase/Toon` | 直接光とSHから安定した方向を作り、明暗2帯のSHとライトマップを使うトゥーン表示 |
| `PureBase/PBR` | Unity 標準に近い物理ベース表示 |
| `PureBase/Hybrid` | トゥーンの拡散反射と物理ベースの反射表現を組み合わせた表示 |

Expand Down Expand Up @@ -111,11 +111,21 @@ Pure Base は Shader-Core を動かすための最小構成の土台です。多

リムライト、MatCap、デカール、細部用テクスチャ、発光、ディゾルブ、距離によるフェード、視差表現、髪向け反射、クリアコート、グリッター、特定環境専用の連携などは、別の Shader-Core モジュールで追加する想定です。Pure Base 本体には含めません。

## Toon ライティングの境界とマテリアル互換性

追加モジュールなしの Toon ホストは、直接光を2値化する拡散反射、直接光の集計と SH から作る安定したシーン光方向、明るい帯と暗い帯に分けた SH、Shader-Core が渡すライトマップ入力、既存の `ForwardBase` と `ForwardAdd` の分離を担当します。設定できる影の帯・色・マスク、方向の上書き、ライティングの上限と下限、モノクロ・unlit 化の制御、その他の任意の演出的な制御は Shader-Core モジュールの担当です。

SRP またはプラットフォーム固有の連携、APV/LPPV、ライトボリューム、LTCGI、lilToon の無関係な効果は Pure Base ホストの対象外です。Toon は既存の Shader-Core ライトマップ集計を使い、焼き込み光をもう一度加算しません。`ForwardAdd` はこれまでどおり追加の直接光だけを加算します。

Hybrid は PBR の経路の中にある既存の2値化直接拡散反射の式をそのまま維持します。Toon の SH 帯は Hybrid のライティング方向へ渡しません。Hybrid は引き続き Unity Standard の間接 GI、反射プローブ、PBR の直接光方向、直接 GGX 鏡面反射を使用します。

この固定されたホスト動作によって、公開項目、キーワード、パス、バリアント、依存関係は増えません。公開プロパティ ABI は変わらないため、既存のマテリアルを移行する必要はなく、自動的にこの動作を受け取ります。

## 公開の準備と実行

`package.json` が、公開名と版番号を決める唯一の情報源です。

現在のパッケージ版は `0.2.0-beta.1` です。
現在のパッケージ版は `0.2.0-beta.2` です。

手動の `Release` ワークフローへ渡す `version` は、すでにパッケージへ記載されている版番号と一致するかを確認するためだけに使われます。版番号の書き換えやコミットは行いません。

Expand Down
14 changes: 12 additions & 2 deletions Docs/technical-information.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Pure Base is a minimal Shader-Core host. It is not intended to become a feature-
| Shader path | Lighting model |
| --- | --- |
| `PureBase/Unlit` | Base color output without host lighting |
| `PureBase/Toon` | Binary direct diffuse with ambient and lightmap support |
| `PureBase/Toon` | Binary direct diffuse with a stable direct-plus-SH direction, bright/dark SH bands, and Shader-Core lightmap support |
| `PureBase/PBR` | Continuous metallic BRDF with Unity Standard indirect GI and reflection probes |
| `PureBase/Hybrid` | Toon-style binary direct diffuse with the PBR specular and IBL path |

Expand Down Expand Up @@ -111,11 +111,21 @@ The shared standard phase ABI is executed in this order:

Optional visual features belong in separate Shader-Core modules. Pure Base does not include rim lighting, MatCap, decals, detail textures, emission, dissolve, distance fade, parallax, hair or anisotropic specular, clear coat, glitter, or platform-specific integrations.

## Toon lighting boundary and material compatibility

The module-free Toon host owns a binary direct-diffuse response, a stable scene-light direction formed from the direct aggregate and SH, bright/dark SH bands, Shader-Core lightmap input, and the existing `ForwardBase`/`ForwardAdd` separation. Shader-Core modules own configurable shadow bands, colors, and masks; direction overrides; lighting limits; monochrome and as-unlit controls; and other optional artistic controls.

SRP or platform integrations, APV/LPPV, light volumes, LTCGI, and unrelated lilToon effects are outside the Pure Base host scope. Toon uses the existing Shader-Core lightmap aggregate and does not add a second baked-light contribution. `ForwardAdd` remains additional direct light only.

Hybrid retains its unchanged binary direct-diffuse equation inside the PBR path. Toon SH banding never supplies Hybrid's lighting direction. Hybrid continues to use Unity Standard indirect GI, reflection probes, its PBR direct-light direction, and direct GGX specular.

This fixed host behavior adds no public property, keyword, pass, variant, or dependency. The public property ABI is unchanged, so existing materials need no migration and receive the behavior automatically.

## Release preparation and publication

`package.json` is the sole release identity and version declaration.

The current package release is `0.2.0-beta.1`.
The current package release is `0.2.0-beta.2`.

The `version` input of the manual `Release` workflow verifies the exact version already present in the checked-out package. It does not write or commit a version.

Expand Down
37 changes: 37 additions & 0 deletions NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,40 @@ lil: An amazing Shader-Core (https://github.com/lilxyzw/Shader-Core) developer (
License
This project is licensed under the Apache-2.0 License - see the LICENSE file for details

Third-Party Lighting Concept Provenance
PureBase's minimal Toon lighting helper is a narrow adapted/reimplemented use of the identified lilToon 2.3.4/OpenLit 1.0.2 lighting concepts, including the corresponding SH bright/dark constants and operation structure. It is not a broad lilToon or OpenLit integration or a full upstream code copy. This acknowledgement does not imply endorsement, sponsorship, contributor status, or participation by lilToon or OpenLit developers.

Inspected lilToon sources

- `Shader/Includes/openlit_core.hlsl`: `ComputeLightDirection`, `ShadeSH9ToonDouble`, and `ComputeLights`
- `Shader/Includes/lil_common_functions.hlsl`: SH direction and bright/dark decomposition
- `Shader/Includes/lil_common_macro.hlsl`: ForwardAdd and lightmap ownership context

lilToon
Version inspected: 2.3.4
Copyright (c) 2020-2024 lilxyzw

MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

OpenLit
Version inspected: 1.0.2
License: [CC0 1.0 Universal](https://creativecommons.org/publicdomain/zero/1.0/)
OpenLit is used here as provenance for the lilToon 2.3.4 BIRP integration concepts named above. This acknowledgement does not imply endorsement, sponsorship, contributor status, or participation by OpenLit developers.
6 changes: 3 additions & 3 deletions README.ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ limitations under the License.
[![Release validation](https://github.com/Penguin-Repository/Pure-Base/actions/workflows/release-validation.yml/badge.svg)](https://github.com/Penguin-Repository/Pure-Base/actions/workflows/release-validation.yml)
[![Release](https://github.com/Penguin-Repository/Pure-Base/actions/workflows/release.yml/badge.svg)](https://github.com/Penguin-Repository/Pure-Base/actions/workflows/release.yml)

Pure Base `0.2.0-beta.1` は、Shader-Core で使える4種類の基本シェーダーをまとめた Unity 向けパッケージです。
Pure Base `0.2.0-beta.2` は、Shader-Core で使える4種類の基本シェーダーをまとめた Unity 向けパッケージです。

複雑な機能を最初から大量に備えるのではなく、必要な機能を Shader-Core の追加モジュールで組み合わせて使うための、軽くて分かりやすい土台を目指しています。

> [!IMPORTANT]
> Pure Base は、Shader-Core、NonToon、lilToon とは別に作られている非公式プロジェクトです
> Pure Base は独立して開発されている非公式プロジェクトです。lilToon の開発者は Pure Base の開発に参加しておらず、Pure Base は lilToon の後継、継続、または派生パッケージではありません
>
> 開発には生成AIを使用しています。

Expand Down Expand Up @@ -87,7 +87,7 @@ https://lilxyzw.github.io/vpm-repos/vpm.json
3. 追加する版を選び、プロジェクトへ導入します。
4. Shader-Core 0.1.9 が一緒に導入されることを確認します。

このREADMEが対象とするパッケージ版は `0.2.0-beta.1` です。
このREADMEが対象とするパッケージ版は `0.2.0-beta.2` です。

## 基本的な使い方

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ Language: [日本語](README.ja.md)
[![Release validation](https://github.com/Penguin-Repository/Pure-Base/actions/workflows/release-validation.yml/badge.svg)](https://github.com/Penguin-Repository/Pure-Base/actions/workflows/release-validation.yml)
[![Release](https://github.com/Penguin-Repository/Pure-Base/actions/workflows/release.yml/badge.svg)](https://github.com/Penguin-Repository/Pure-Base/actions/workflows/release.yml)

Pure Base `0.2.0-beta.1` is a Unity package that provides four base shaders for Shader-Core.
Pure Base `0.2.0-beta.2` is a Unity package that provides four base shaders for Shader-Core.

Instead of including a large collection of optional effects, it provides a small and understandable foundation that can be extended with Shader-Core modules when needed.

> [!IMPORTANT]
> Pure Base is an unofficial project developed independently from Shader-Core, NonToon, and lilToon.
> Pure Base is an unofficial, independent project. lilToon developers did not participate in its development, and Pure Base is not a lilToon successor, continuation, or derivative package.
>
> Generative AI is used during development.

Expand Down Expand Up @@ -85,7 +85,7 @@ https://lilxyzw.github.io/vpm-repos/vpm.json
3. Select the version you want and add it to the project.
4. Confirm that Shader-Core 0.1.9 is installed with it.

The package version described here is `0.2.0-beta.1`.
The package version described here is `0.2.0-beta.2`.

## Basic use

Expand Down
19 changes: 16 additions & 3 deletions Shaders/Common/birp_host.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@

#include "Packages/jp.penguin.purebase/Shaders/Common/rendering_mode.hlsl"

#ifndef SCModelSelectAggregateLightDirection
#define SCModelSelectAggregateLightDirection(directAggregateDirection, shAr, shAg, shAb) (dot(directAggregateDirection, directAggregateDirection) == 0 ? half3(0, 0, 0) : normalize(directAggregateDirection))
#endif

/// <summary>Accumulates a BIRP light after the Shader-Core per-light phase.</summary>
void SCCalculateLight(inout SCLightData lightSum, inout SCShadingData sd, inout SCCustomData cd, SCVertexData vertex, SCLightData light)
{
Expand All @@ -38,8 +42,17 @@ void SCCalculateLight(inout SCLightData lightSum, inout SCShadingData sd, inout
/// <summary>Publishes the aggregate light direction and applies the selected model's ambient SH response.</summary>
void SCCalculateEnvironmentLight(inout SCLightData lightSum, inout half3 env, inout SCShadingData sd, inout SCCustomData cd, SCVertexData vertex, half4 shAr, half4 shAg, half4 shAb, half4 shBr, half4 shBg, half4 shBb, half4 shC)
{
sd.L = dot(lightSum.direction, lightSum.direction) == 0 ? half3(0, 0, 0) : normalize(lightSum.direction);
env += SCModelEvaluateAmbient(sd, shAr, shAg, shAb, shBr, shBg, shBb, shC);
#if defined(PUREBASE_TOON_MODEL_INCLUDED) && !defined(LIGHTMAP_ON)
sd.L = SCModelSelectAggregateLightDirection(lightSum.direction, unity_SHAr, unity_SHAg, unity_SHAb);
#if !defined(UNITY_PASS_FORWARDADD)
env += SCModelEvaluateAmbient(sd, unity_SHAr, unity_SHAg, unity_SHAb, unity_SHBr, unity_SHBg, unity_SHBb, unity_SHC);
#endif
#else
sd.L = SCModelSelectAggregateLightDirection(lightSum.direction, shAr, shAg, shAb);
#if !defined(UNITY_PASS_FORWARDADD)
env += SCModelEvaluateAmbient(sd, shAr, shAg, shAb, shBr, shBg, shBb, shC);
#endif
#endif
Comment thread
PenguinDOOM marked this conversation as resolved.
}

#include "Packages/jp.lilxyzw.shadercore/ShaderLibrary/birp_lighting.hlsl"
Expand Down Expand Up @@ -68,11 +81,11 @@ half4 frag(v2f input, bool isFront : SV_IsFrontFace) : SV_Target
cd.mainLightAttenuation = saturate(mainLightAttenuation);
cd.mainLightDirection = half3(0, 0, 0);
SCCalculateAllLights(lightSum, env, sd, cd, vertex, input, SCModelSelectVertexLighting(SCVertexLighting(vertex.position)));
env = SCModelSelectEnvironmentLighting(env);

#if defined(UNITY_PASS_FORWARDADD)
sd.lightColor = lightSum.color;
#else
env = SCModelSelectEnvironmentLighting(env);
sd.lightColor = lightSum.color + env;
#endif

Expand Down
Loading