Jump to content

Z-sorting Bug


Recommended Posts

Ive had a quick look through the bugs but cant find a report for this (could have missed it though), there is also a possibility this isnt a bug but i cant figure a way around it.

 

If i have a model and mat with an alpha, the "alpha" part seems to only let CSG stuff though and not other models through, if i move the camera around sometimes they appear other times they dont.

 

Thanks

Andy

The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do.

 

Leadwerks Game-Ready 3D Models:https://sellfy.com/gib3d

Link to comment
Share on other sites

So you have multiple layers of alpha blending? Set the depth mask to 0. Beyond that, I can't tell without an actual example I can run.

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

Set the depth mask to 0. Beyond that, I can't tell without an actual example I can run.

 

Can this be done in the editor? I asked previously what actual files do you need, map, models, whole project?

 

Andy

The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do.

 

Leadwerks Game-Ready 3D Models:https://sellfy.com/gib3d

Link to comment
Share on other sites

The problem is you have multiple layers of alpha blending within one surface, and z-sorting does not work on a per-polygon basis. We normally use alpha masking for vegetation, not alpha blending.

  • It's faster to render.
  • It avoid z-sorting issues like this.

Disable z-sorting in your material. Set the blend mode to solid.

 

You then need a shader that does a discard if the alpha value is below 0.5. You can copy the shader you are using, then add this in the fragment shader source:

//Modulate blend with diffuse map
outcolor *= texture2D(texture0,ex_texcoords0);
if (outcolor.a<0.5) discard; // ADD THIS LINE

 

I will add some more shaders into the official SDK soon, including one for this purpose.

 

Leadwerks 2 had an alpha mask setting, but we no longer support this because the functionality was dropped in OpenGL 3.2+. It's supposed to be done with a shader, now, and we want to be future proof.

  • 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...