Jump to content

Lighting Engine distorting/crumpling rigged models


Recommended Posts

It's more glaring in my custom mesh but you can also see it in the included "crawler" mesh, Top is "textured" and bottom are "textured + lighting". When the lighting is turned on, the mesh distorts. Both of these examples are from the same exact view.

 

In the crawler you can see the neck silhouette has altered.

In mine...well it speaks for itself. Unusable levels of distortion.

I also tested the fpsautopistol mesh and it too distorts, though the distortions are not detrimental to its appearance.

 

The distortions carry over straight into the game itself.

 

I'm using the LWdemo in hopes of determining whether to purchase. If this is a demo-only issue, I would like to know. If not, I am concerned since I am a modeler/texture artist.

 

tumblr_n8uzjncBlj1rtaoeio1_1280.jpg

Link to comment
Share on other sites

Okay, looking into it further, it is directly related to materials with animations included. On the left is my mesh with the crawler mat applied to the chest and neck. On the right is no mat. What's interesting is even though the mat is different the distortion points are identical.

 

Not pictured but relevant, the test I did with a static material, looked the same as no material as far as distortions go.

 

 

tumblr_n8vcqdjY7o1rtaoeio1_1280.jpg

Link to comment
Share on other sites

That is rather odd. Looks like a small inaccuracy in the weighting equation. We did recently modify the FBX importer to deal with something like this, but I can't promise this exact issue was fixed without seeing your FBX models.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

I used a blender exporter that exports straight to leadwerks asset formats, mdls and mats. I can try the FBX exporter but I figured a direct export would be the ideal. If FBX works better and avoids this issue I will happily switch.

 

It's worth noting that some distortion occurs even with included assets like the crawler and fpsautopistol models.

Link to comment
Share on other sites

I am guessing it's an issue of the bone weights not being normalized in the vertex shader. If you can post a model that easily shows the problem I will test it.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Thanks for pointing that out. A small change in the shader fixed it. In the file "Shaders/Model/Animated/diffuse.shader" find this block of code in the vertex source:

    mat4 animmatrix = bone.matrix[vertex_boneindices[0]] * vertex_boneweights[0];
   animmatrix += bone.matrix[vertex_boneindices[1]] * vertex_boneweights[1];
   animmatrix += bone.matrix[vertex_boneindices[2]] * vertex_boneweights[2];
   animmatrix += bone.matrix[vertex_boneindices[3]] * vertex_boneweights[3];

 

Replace it with this:

    vec4 wt = vertex_boneweights;
   float m = wt[0]+wt[1]+wt[2]+wt[3];
   wt[0]/=m; wt[1]/=m; wt[2]/=m; wt[3]/=m;

   mat4 animmatrix = bone.matrix[vertex_boneindices[0]] * wt[0];
   animmatrix += bone.matrix[vertex_boneindices[1]] * wt[1];
   animmatrix += bone.matrix[vertex_boneindices[2]] * wt[2];
   animmatrix += bone.matrix[vertex_boneindices[3]] * wt[3];

 

Before:

post-1-0-34101100-1405636936_thumb.jpg

 

After:

post-1-0-04719700-1405636950_thumb.jpg

 

This fix will make it into the official build in the next update.

  • Upvote 1

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

There are three animated shaders. You must make this fix in all three. Or wait for the next update to go out, and it will be fixed for you.

  • Upvote 1

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...