doc icon indicating copy to clipboard operation
doc copied to clipboard

Mesh component property for setting textures is wrong

Open Jhonnyg opened this issue 1 year ago • 1 comments

The doc (https://defold.com/manuals/mesh/#mesh-properties) says the texture property is called "tex0", but it should be "texture0" ... "texture7".

Jhonnyg avatar Jan 20 '25 17:01 Jhonnyg

Hi, I think the doc is kind of correct but should be improved, I struggled a lot to understand what comes from where for mesh component. As I understand it:

  • the "tex0" properties name depends on the material definition. "tex0" is the name of a texture sampler defined in the chosen material. If you change this name or add other samplers, these will show up right here:
Image then Image
  • then "tex0" or "myimage" can be used in the fragment shader as sampler2D:
uniform mediump sampler2D tex0;
    uniform mediump sampler2D myimage;

Talking about shaders, the different stream that can be used and appear in "position stream" are defined by the .buffer file:

Image Image and can then be used in the vertex shader: Image

Theses must be "forwarded" to the fragment shader by passing out variables (like "var_texcoord0" here, that forward the texcoord0 from vertex shader to fragment shader (it the UV stream to be used with the tex0 sampler2D) )

I think all of these information should be in the mesh component page, just to be able to "connect the dots"

mathias-a-la-basse avatar Mar 15 '26 20:03 mathias-a-la-basse