wowserhq / wowser

World of Warcraft in the browser using JavaScript and WebGL
MIT License
240 stars 63 forks source link

Funky woodwork in Booty Bay #106

Closed timkurvers closed 8 years ago

timkurvers commented 8 years ago

Location: this.player.worldport(0, -14354, 518, 22)

screen shot 2016-01-18 at 23 43 40

fallenoak commented 8 years ago

Interesting! Possibly the wrong wrap settings for the texture(s)...

fallenoak commented 8 years ago

I've fixed this on my fork... I'll PR once I get some more testing in. The issue was kind of a cross between two separate issues:

1) M2Material does not need flipY on its textures WMOMaterial disables flipY, but M2Material wasn't disabling it. Instead, M2Material was doing this in its shader:

texture1Coord = vec2(uv[0], -uv[1]);
texture2Coord = vec2(uv[0], -uv[1]);

This was fairly pointless, since just setting flipY to false a la WMOMaterial would have prevented the need to do the negation in the shader.

This, in turn caused the second related issue...

2) Textures should cache and load based on texture settings Currently, the TextureLoader assumes that, for a given texture path, it will always be used with the same settings (wrapS, wrapT, flipY, etc). This isn't necessarily true, since texture settings are defined in the WMO and M2 data files, and some (probably many) textures are reused between various models.

My PR will fix both issues.

Screenshot of fixed wood texturing in Booty Bay: screen shot 2016-02-09 at 11 06 26 am

timkurvers commented 8 years ago

Awesome research, screenshot looks stellar! :+1:

timkurvers commented 8 years ago

Fixed through #113.