Help Modifying a shader to work on Love 11.2
Posted: Mon Nov 18, 2019 10:39 pm
Hey guys. So I have been trying to get 3d skeletal animation working for my game for the last week, with no avail.
I trying to use the same technique for skeletal animation used here https://github.com/excessive/love3d-dem ... mation.lua but when I try to render the model it ends up looking very strange and out of place. The original project was written for love 10.2, so I am wondering if it is something caused by a version change, because the project works fine on 10.2, but not 11.2.
Here is the shader code:
I checked all through anim9 and the .Iqm loader to find any issues and didn't see anything.
Anyone know why this is happening? Could it be caused by a change in shader code between love 10.2 and 11.2?
The project folder is included below.
Thanks.
I trying to use the same technique for skeletal animation used here https://github.com/excessive/love3d-dem ... mation.lua but when I try to render the model it ends up looking very strange and out of place. The original project was written for love 10.2, so I am wondering if it is something caused by a version change, because the project works fine on 10.2, but not 11.2.
Here is the shader code:
Code: Select all
local shader = love.graphics.newShader [[
varying vec3 v_normal;
#ifdef VERTEX
attribute vec4 VertexWeight;
attribute vec4 VertexBone;
attribute vec3 VertexNormal;
uniform mat4 u_model, u_viewproj;
uniform mat4 u_pose[100];
vec4 position(mat4 _, vec4 vertex) {
mat4 skeleton = u_pose[int(VertexBone.x*255.0)] * VertexWeight.x +
u_pose[int(VertexBone.y*255.0)] * VertexWeight.y +
u_pose[int(VertexBone.z*255.0)] * VertexWeight.z +
u_pose[int(VertexBone.w*255.0)] * VertexWeight.w;
mat4 transform = u_model * skeleton;
v_normal = mat3(transform) * VertexNormal;
return u_viewproj * transform * vertex;
}
#endif
#ifdef PIXEL
uniform vec3 u_light;
vec4 effect(vec4 color, Image tex, vec2 uv, vec2 sc) {
float shade = max(0, dot(v_normal, u_light)) + 0.25;
return vec4(vec3(shade) * color.rgb, 1.0);
}
#endif
]]
I checked all through anim9 and the .Iqm loader to find any issues and didn't see anything.
Anyone know why this is happening? Could it be caused by a change in shader code between love 10.2 and 11.2?
The project folder is included below.
Thanks.