1
0
Fork 0

Change tree texture format from a 8x4 block to 32x1 to avoid UV bleeding problems.

This commit is contained in:
Stuart Buchanan 2013-05-10 20:04:18 +01:00
parent 9b19d5e20e
commit 5689d76dca
18 changed files with 11 additions and 14 deletions

View file

@ -11,10 +11,9 @@ void main() {
// Texture coordinates
float numVarieties = gl_Normal.z;
float texFract = floor(fract(gl_MultiTexCoord0.x) * numVarieties) / numVarieties;
texFract += floor(gl_MultiTexCoord0.x) / numVarieties;
gl_TexCoord[0] = vec4(texFract, gl_MultiTexCoord0.y, 0.0, 0.0);
gl_TexCoord[0].y = gl_TexCoord[0].y + 0.5 * season;
float texFract = floor(fract(gl_MultiTexCoord0.x) * numVarieties) / (numVarieties * 4.0);
texFract += floor(gl_MultiTexCoord0.x) / (numVarieties * 4.0);
gl_TexCoord[0] = vec4(texFract + 0.5 * season, gl_MultiTexCoord0.y, 0.0, 0.0);
// Position and scaling
vec3 position = gl_Vertex.xyz * gl_Normal.xxy;

View file

@ -75,19 +75,18 @@ void main()
// this code is copied from tree.vert
float numVarieties = gl_Normal.z;
float texFract = floor(fract(gl_MultiTexCoord0.x) * numVarieties) / numVarieties;
texFract += floor(gl_MultiTexCoord0.x) / numVarieties;
float texFract = floor(fract(gl_MultiTexCoord0.x) * numVarieties) / (numVarieties * 4.0);
texFract += floor(gl_MultiTexCoord0.x) / (numVarieties * 4.0);
// Determine the rotation for the tree. The Fog Coordinate provides rotation information
// to rotate one of the quands by 90 degrees. We then apply an additional position seed
// so that trees aren't all oriented N/S
float sr = sin(gl_FogCoord + gl_Color.x);
float cr = cos(gl_FogCoord + gl_Color.x);
gl_TexCoord[0] = vec4(texFract, gl_MultiTexCoord0.y, 0.0, 0.0);
// Determine the y texture coordinate based on whether it's summer, winter, snowy.
gl_TexCoord[0].y = gl_TexCoord[0].y + 0.25 * int(gl_Color.z > snow_level) + 0.5 * season;
// Shift texture to account for snow level and seasons
gl_TexCoord[0] = vec4(texFract + 0.25 * int(gl_Color.z > snow_level) + 0.5 * season, gl_MultiTexCoord0.y, 0.0, 0.0);
// scaling
vec3 position = gl_Vertex.xyz * gl_Normal.xxy;

View file

@ -17,16 +17,15 @@ uniform int season;
void main(void)
{
float numVarieties = gl_Normal.z;
float texFract = floor(fract(gl_MultiTexCoord0.x) * numVarieties) / numVarieties;
texFract += floor(gl_MultiTexCoord0.x) / numVarieties;
float texFract = floor(fract(gl_MultiTexCoord0.x) * numVarieties) / (numVarieties * 4.0);
texFract += floor(gl_MultiTexCoord0.x) / (numVarieties * 4.0);
// Determine the rotation for the tree. The Fog Coordinate provides rotation information
// to rotate one of the quands by 90 degrees. We then apply an additional position seed
// so that trees aren't all oriented N/S
float sr = sin(gl_FogCoord + gl_Color.x);
float cr = cos(gl_FogCoord + gl_Color.x);
gl_TexCoord[0] = vec4(texFract, gl_MultiTexCoord0.y, 0.0, 0.0);
gl_TexCoord[0].y = gl_TexCoord[0].y + 0.5 * season;
gl_TexCoord[0] = vec4(texFract + 0.5 * season, gl_MultiTexCoord0.y, 0.0, 0.0);
// scaling
vec3 position = gl_Vertex.xyz * gl_Normal.xxy;

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 102 KiB

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 94 KiB

After

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 KiB

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 100 KiB

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 89 KiB

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 96 KiB

After

Width:  |  Height:  |  Size: 26 KiB