Is Defold support normal mapping?


when the model is not positive in the face of view direction, it looks fuzzy, fragment color is incorrect. what problem lead to this ? Is there no normal mapping ?


I’m not sure what you mean by normal mapping in this context?

But regarding the faces of the bricks being “fuzzy”, I think that has to do with the texture filtering. Could you try changing the “Filter min” of “tex0” in your model material to filter-mode-min-linear-mipmap-linear?

Like this:

(You might need to make a copy of the model.material from builtins if you haven’t done this already, and update the model files to point to the new copy.)


It seems to work ! But the farther away from the camera, the card looks more blurry. Is the new problem ?


Hi! These are pretty standard texture-filtering issues you are facing :slight_smile:

Ideally, you’d want to use anisotropic filtering I suppose, but that is only exposed via extensions that aren’t universally supported and thus not supported by Defold by default. With trilinear filtering you will be getting a blend of two mipmap levels based on how much the texture coordinates are changing across the surface you are rendering (aka derivatives), and since you are looking at the surfaces at a glancing angle the projected screen coordinates will change faster than when you are looking at the surface straight. Also, the number of mipmap levels are directly related to how big the texture is - a bigger texture you get more mipmap levels and a smaller will give you fewer to blend between. Now, there’s a few things you potentially could do here:

  • Simply increase the texture size of the textures that are giving you the issues. This would hopefully give you a better quality at the distance that you are facing the problems at currently.
  • Use bias in the fragment shader to shift the mipmap selection. This will kind of give you the same effect as above, but requires tweaking to get the bias value right.
  • Do manual anisotropic sampling in the fragment shader. This would probably require shader extensions and takes a bit more processing per fragment, but it might be worth if it’s a critical issue.

It’s probably easiest to just increase the texture size slightly and see if that works better for you. The other options are slightly more advanced if you aren’t familiar with glsl. I can see if I can think of something else in the meantime :slight_smile: