Skip to content

Commit

Permalink
fog density is now controlled by fog color alpha
Browse files Browse the repository at this point in the history
  • Loading branch information
mgsx-dev committed Mar 19, 2021
1 parent 6decc94 commit 98077ea
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

* upgrade to libGDX 1.9.11, you can't use older libGDX with this version.
* MeshPlus class has been removed since libGDX now supports 64k vertices meshes. If you directly used MeshPlus in your code, you can now use Mesh class instead.
* Fog density is now controlled by fog color alpha. Make sure to have fog color alpha at 1.0 in your code to keep previous behavior.

### 1.0.0

Expand Down
2 changes: 1 addition & 1 deletion gltf/src/net/mgsx/gltf/shaders/default.fs.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ void main() {
#endif //lightingFlag

#ifdef fogFlag
gl_FragColor.rgb = mix(gl_FragColor.rgb, u_fogColor.rgb, v_fog);
gl_FragColor.rgb = mix(gl_FragColor.rgb, u_fogColor.rgb, v_fog * u_fogColor.a);
#endif // end fogFlag

#ifdef blendedFlag
Expand Down
2 changes: 1 addition & 1 deletion gltf/src/net/mgsx/gltf/shaders/gdx-pbr.fs.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@ void main() {
#else
float fog = min(1.0, eyeDistance * eyeDistance * u_cameraPosition.w);
#endif
out_FragColor.rgb = mix(out_FragColor.rgb, u_fogColor.rgb, fog);
out_FragColor.rgb = mix(out_FragColor.rgb, u_fogColor.rgb, fog * u_fogColor.a);
#endif

// Blending and Alpha Test
Expand Down

0 comments on commit 98077ea

Please sign in to comment.