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

Make MToon10's fog work. #1237

Merged
merged 1 commit into from
Sep 21, 2021
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
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ struct Varyings
half4 tangentWS : TEXCOORD3;
#endif
float3 viewDirWS : TEXCOORD4;
UNITY_FOG_COORDS(6)
UNITY_LIGHTING_COORDS(7,8)
UNITY_FOG_COORDS(5)
UNITY_LIGHTING_COORDS(6,7)
float4 pos : SV_POSITION; // UnityCG macro specified name. Accurately "positionCS"
UNITY_VERTEX_INPUT_INSTANCE_ID
UNITY_VERTEX_OUTPUT_STEREO
Expand All @@ -38,4 +38,4 @@ struct FragmentInput
MTOON_FRONT_FACE_TYPE facing : MTOON_FRONT_FACE_SEMANTIC;
};

#endif
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,12 @@ half4 MToonFragment(const FragmentInput fragmentInput) : SV_Target
mtoonInput.viewDirWS = normalize(input.viewDirWS);
mtoonInput.litColor = litColor.rgb;
mtoonInput.alpha = alpha;
const half4 col = GetMToonLighting(unityLighting, mtoonInput);
half4 col = GetMToonLighting(unityLighting, mtoonInput);
Copy link
Contributor Author

@Santarh Santarh Sep 24, 2021

Choose a reason for hiding this comment

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

const ついてたから、フォグのマクロ内で変更できずにコンパイルエラーになっていた


UNITY_APPLY_FOG(i.fogCoord, col);
// Apply Fog
UNITY_APPLY_FOG(fragmentInput.varyings.fogCoord, col);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

i はそもそも存在しないのでコンパイルエラーになっていた


return col;
}

#endif
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ Varyings MToonVertex(const Attributes v) // v is UnityCG macro specified name.
output.tangentWS = half4(UnityObjectToWorldDir(v.tangentOS), tangentSign);
#endif

UNITY_TRANSFER_FOG(output, output.positionWS);
UNITY_TRANSFER_FOG(output, output.pos);
UNITY_TRANSFER_LIGHTING(output, v.texcoord1.xy);

return output;
}

#endif
#endif