Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change (MToon): add implementation note about the possibility of NaN. #418

Merged
merged 2 commits into from Dec 1, 2022

Conversation

Santarh
Copy link
Contributor

@Santarh Santarh commented Nov 29, 2022

fix #414

Add implementation note about the possibility of NaN in MToon.
Also add to implementation example.

@Santarh Santarh requested a review from 0b5vr November 29, 2022 07:34
@@ -539,10 +543,12 @@ let worldViewY: Vector3 = cross( V, x )

let matcapUv: Vector2 = Vector2( dot( x, N ), dot( y, N ) ) * 0.495 + 0.5

let epsilon: Number = 0.00001;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0.00001 は既存の UniVRM の実装例に基づいており、なんらか論理的な根拠は無い。

@@ -510,6 +510,10 @@ The color of the parametric rim lighting is stored in `parametricRimColorFactor`
The shape of parametric rim lighting is controlled by values `parametricRimFresnelPowerFactor` and `parametricRimLiftFactor` defined by the MToon extension.
The shape is obtained by the formula `pow( saturate( 1.0 - dot( N, V ) + parametricRimLiftFactor ), parametricRimFresnelPowerFactor )`.

> The expression maybe results NaN if given `parametricRimFresnelPowerFactor` is zero.
> The implementation should avoid NaN depending on the environment.
> ex. `parametricRimFresnelPowerFactor = max(parametricRimFresnelPowerFactor, epsilon)`
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

英語が良い感じかどうかはちょっと曖昧です。

Copy link
Contributor

@0b5vr 0b5vr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

厳密には parametricRimFresnelPowerFactor が0の場合の値を1と定義したほうが良いような気もしますが、そうするとepsilonで対処することができなくなっちゃいますし、一旦このまま曖昧な書き方で良いと思います。
突っ込まれたら対処する感じで行きましょう。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
3 participants