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

Correct timing when GI is added #35

Merged
merged 3 commits into from Mar 20, 2019
Merged

Correct timing when GI is added #35

merged 3 commits into from Mar 20, 2019

Conversation

ghost
Copy link

@ghost ghost commented Feb 4, 2019

問題

  • Lambertと同じシェーディングになるようなマテリアルの設定を行っても、同じ見た目にならない
  • GIの光がDirectionalLightの方向に影響を受けてしまう
    • 影色に黒が設定されていたとき、影の部分については「黒色」としてサンプルされてしまっている
    • 環境光はlitとしてサンプルされている挙動を想定していた

設定例

  • Lit Colorを白、Shade Colorを黒に設定
  • Shading Shiftを0に設定
  • Shading Toonyを0に設定
  • LightColor Attenuationを0に設定
  • GI Intensityを1に設定

snapcrab_noname_2019-2-4_12-42-51_no-00

実際の見た目

snapcrab_noname_2019-2-4_12-46-1_no-00

想定していた見た目

snapcrab_noname_2019-2-4_12-45-31_no-00

キャラクターの場合の参考画像

Lambert(リファレンス)

snapcrab_noname_2019-2-4_13-3-40_no-00

従来の挙動(GI Intencity = 1)

snapcrab_noname_2019-2-4_13-2-34_no-00

このPRでの挙動

snapcrab_noname_2019-2-4_15-33-35_no-00

@ghost ghost closed this Feb 4, 2019
@ghost ghost reopened this Feb 4, 2019
@@ -162,7 +162,7 @@ float4 frag_forward(v2f i) : SV_TARGET
half4 shade = _ShadeColor * tex2D(_ShadeTexture, mainUv);
half4 lit = _Color * mainTex;
half3 col = lerp(shade.rgb, lit.rgb, lightIntensity);
col *= lighting;
col = col * lighting + indirectLighting * lit;
Copy link
Author

@ghost ghost Feb 4, 2019

Choose a reason for hiding this comment

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

DirectionalLightの影響を受けないように、IndirectLightはlitをサンプルするように変更しました
従来の挙動ではDirectionalLightの影響を受けてしまいます

@ghost
Copy link
Author

ghost commented Mar 18, 2019

遅れてすみません。
良いと思います!
ただ1点、直していただきたい箇所があります。
indirectLighting に対しても
lighting = lerp(lighting, max(0.001, max(lighting.x, max(lighting.y, lighting.z))), _LightColorAttenuation); // color atten
の光源彩度補正を入れていただけますか?

@ghost
Copy link
Author

ghost commented Mar 18, 2019

↑ も含めて 150 行目の宣言は 160 行目くらいに // GI とか区切って書いてもらってもいいかも

@ghost
Copy link
Author

ghost commented Mar 20, 2019

対応しました 👍

@Santarh
Copy link
Owner

Santarh commented Mar 20, 2019

LGTM

@Santarh Santarh merged commit 0cac417 into Santarh:master Mar 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant