Jump to content

Textures on capped faces only displays the color


Swiftwork
 Share

Recommended Posts

Hi,

I have ran into the issue that capped faces (CAP_START, CAP_END, CAP_ALL) will only display a diffuse color and not a texture http://www.babylonjs-playground.com/#RF9W9#370. The issue seems to persist at least on ExtrudedShapes and Tubes. My theory is that the face UVs aren't properly calculated. Anyone know of a solution or is this a bug?

Kind Regards

Swiftwork

Link to comment
Share on other sites

It is all to do with extrusion keeping the number of vertices to a minimum and so shared normals and uvs among vertices. The texture is displayed on the caps however because of the way the uvs are shared you do get a small area (perhaps one pixel worth) shared across the cap. These explain in more detail:

http://babylonjsguide.github.io/advanced/Custom

http://babylonjsguide.github.io/advanced/Normals

http://babylonjsguide.github.io/advanced/Facets

If you are just using cuboids then the MeshBuilder method is preferable to build your box as this creates the boxes with separate faces and hence separate uvs

For example http://www.babylonjs-playground.com/#RF9W9#372

 (Note what is being subtracted from what is swapped in line 28 - can see why this way works in my PG but not why your way round in yours?)

You might also like to check out

https://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter

https://doc.babylonjs.com/tutorials/CreateBox_Per_Face_Textures_And_Colors

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...