Skip to content

Commit

Permalink
Merge pull request #185 from Dgzt/splat-transparent-layer
Browse files Browse the repository at this point in the history
Fix for transparent layer in texture splatting for the terrain texture #183
  • Loading branch information
JamesTKhan authored Jun 4, 2023
2 parents 1b4b18e + e1a41b6 commit 6ac57fd
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,17 +110,21 @@ void main(void) {
#ifdef splatFlag
vec4 splat = texture2D(u_texture_splat, v_splatPosition);
#ifdef splatRFlag
gl_FragColor = mix(gl_FragColor, texture2D(u_texture_r, v_texCoord0), splat.r);
vec4 colorR = texture2D(u_texture_r, v_texCoord0);
gl_FragColor = mix(gl_FragColor, mix(gl_FragColor, colorR, splat.r), colorR.a);
#endif
#ifdef splatGFlag
gl_FragColor = mix(gl_FragColor, texture2D(u_texture_g, v_texCoord0), splat.g);
vec4 colorG = texture2D(u_texture_g, v_texCoord0);
gl_FragColor = mix(gl_FragColor, mix(gl_FragColor, colorG, splat.g), colorG.a);
#endif
#ifdef splatBFlag
gl_FragColor = mix(gl_FragColor, texture2D(u_texture_b, v_texCoord0), splat.b);
#endif
vec4 colorB = texture2D(u_texture_b, v_texCoord0);
gl_FragColor = mix(gl_FragColor, mix(gl_FragColor, colorB, splat.b), colorB.a);
#endif
#ifdef splatAFlag
gl_FragColor = mix(gl_FragColor, texture2D(u_texture_a, v_texCoord0), splat.a);
#endif
vec4 colorA = texture2D(u_texture_a, v_texCoord0);
gl_FragColor = mix(gl_FragColor, mix(gl_FragColor, colorA, splat.a), colorA.a);
#endif

#ifdef normalTextureFlag
vec3 splatNormal = vec3(0.0);
Expand Down
1 change: 1 addition & 0 deletions editor/CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
- Fix terrain brush tools for rotated and scaled terrain
- Refactor tool selection
- Custom properties component addable to game objects
- Fix transparent layer in texture splatting for the terrain texture

[0.4.2] ~ 10/24/2022
- Fix shader compilation error for Terrain when using normal maps
Expand Down
1 change: 1 addition & 0 deletions gdx-runtime/CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
- Fix water reflections when camera is rotated
- Removed selected field from SceneGraph class
- Added custom properties option to game objects
- Fix transparent layer in texture splatting for the terrain texture

[0.4.0] ~ 10/12/2022
- [BREAKING CHANGE] The loadScene method for the runtime has changed. A ModelBatch is no longer required to be passed in.
Expand Down

0 comments on commit 6ac57fd

Please sign in to comment.