- Joined
- Aug 2, 2015
- Messages
- 63
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
yes, i did by delete some geoset in the modelDid you solve this yet?
i interested to how delete a group or reduce group like the video you provide. but i don't get it how to do itThis video explains what is wrong with your model. The groups limit was reduced from 256 to 255, so you need to delete a group.
yes,that look good but i think it is darker than before?Does this one look any good? It's really hard for me to test without the texture
I am more interested in the sub optimal approach and how it differed from the optimal one.But I was using a dynamic length texture buffer to pass the matrices. Maybe if Blizzard uses a fixed size memory structure of size 256 then that would explain it.
Matrices { 29, 39 },
Matrices { 14, 29 },
Matrices { 34, 40 },
Matrices { 40, 41 },
Matrices { 34 },
Matrices { 33, 38 },
Matrices { 38, 39 },
Matrices { 33 },
Matrices { 35, 42 },
${shaders.instanceId}
${shaders.boneTexture}
uniform mat4 u_mvp;
attribute vec3 a_position;
attribute vec3 a_normal;
attribute vec2 a_uv;
attribute vec4 a_bones;
attribute float a_boneNumber;
attribute float a_teamColor;
attribute vec4 a_vertexColor;
attribute vec4 a_geosetColor;
attribute float a_layerAlpha;
attribute vec4 a_uvTransRot;
attribute vec3 a_uvScaleSprite;
varying vec3 v_normal;
varying vec2 v_uv;
varying float v_teamColor;
varying vec4 v_vertexColor;
varying vec4 v_geosetColor;
varying vec4 v_uvTransRot;
varying vec3 v_uvScaleSprite;
void transform(inout vec3 position, inout vec3 normal, float boneNumber, vec4 bones) {
// For the broken models out there, since the game supports this.
if (boneNumber > 0.0) {
mat4 b0 = fetchMatrix(bones[0], a_InstanceID);
mat4 b1 = fetchMatrix(bones[1], a_InstanceID);
mat4 b2 = fetchMatrix(bones[2], a_InstanceID);
mat4 b3 = fetchMatrix(bones[3], a_InstanceID);
vec4 p = vec4(position, 1);
vec4 n = vec4(normal, 0);
position = vec3(b0 * p + b1 * p + b2 * p + b3 * p) / boneNumber;
normal = normalize(vec3(b0 * n + b1 * n + b2 * n + b3 * n));
}
}
void main() {
vec2 uv = a_uv;
vec3 position = a_position;
vec3 normal = a_normal;
transform(position, normal, a_boneNumber, a_bones);
v_uv = a_uv;
v_uvTransRot = a_uvTransRot;
v_uvScaleSprite = a_uvScaleSprite;
v_normal = normal;
v_teamColor = a_teamColor;
v_vertexColor = a_vertexColor;
// Is the alpha here even correct?
v_geosetColor = vec4(a_geosetColor.rgb, a_layerAlpha);
// Definitely not correct, but the best I could figure so far.
if (a_geosetColor.a < 0.75 || a_layerAlpha < 0.1) {
gl_Position = vec4(0.0);
} else {
gl_Position = u_mvp * vec4(position, 1);
}
}
#version 450 core
//in int gl_VertexID;
//in int gl_InstanceID;
layout (location = 0) in vec3 vPosition;
layout (location = 1) in vec2 vUV;
layout (location = 2) in mat4 vInstance;
layout (location = 6) in uint vVertexGroup; // use to index into matrices list
layout (location = 7) uniform mat4 VP; // changed from 4, DO NOT forget
layout (location = 8) uniform usamplerBuffer u_groupIndexing; // index by VertexGroup
layout (location = 9) uniform samplerBuffer u_nodeMatrices; // index from groupIndexing
layout (location = 10) uniform int u_nodeCount;
layout (location = 11) in float layer_alpha;
layout (location = 12) in vec3 geoset_color;
out vec2 UV;
out vec4 vertexColor;
mat4 fetchMatrix(int nodeIndex) {
return mat4(
texelFetch(u_nodeMatrices, int(gl_InstanceID*u_nodeCount*4 + nodeIndex*4)),
texelFetch(u_nodeMatrices, int(gl_InstanceID*u_nodeCount*4 + nodeIndex*4 + 1)),
texelFetch(u_nodeMatrices, int(gl_InstanceID*u_nodeCount*4 + nodeIndex*4 + 2)),
texelFetch(u_nodeMatrices, int(gl_InstanceID*u_nodeCount*4 + nodeIndex*4 + 3)));
}
void main() {
uvec4 groupIndexData = texelFetch(u_groupIndexing, int(vVertexGroup));
uint boneNumber = groupIndexData[0];
vec3 position = vPosition;
vec4 p = vec4(position, 1);
if( boneNumber > 0 ) {
mat4 b0 = fetchMatrix(int(groupIndexData[1]));
mat4 b1 = fetchMatrix(int(groupIndexData[2]));
mat4 b2 = fetchMatrix(int(groupIndexData[3]));
// TODO handle N size groupIndexData, like war3, instead of size 3
position = vec3(b0 * p + b1 * p + b2 * p) / float(boneNumber);
// TODO normal
// compute p again now after position is updated:
p = vec4(position, 1);
}
gl_Position = VP * vInstance * p;
UV = vUV;
vertexColor = vec4(geoset_color, layer_alpha);
if(vertexColor.a <= 0.75) {
gl_Position = vec4(0); // got this idea from something ghostwolf did, it's super hack
}
}
Not possible because there was no concept of "Shader" during production of Warcraft III. Shaders were only added to graphic APIs while Warcraft III was already in development, so had extremely limited hardware support (latest GPUs only). Instead they used the old fixed function pipelines.Maybe Blizzard was always using bone index zero as an optimization since the year 2000. I don't really know.
