The spheres in this playground => https://playground.babylonjs.com/#20OAV9#7555 can accept both colour and a repeating texture (of either diffuse or bump type).
When I try to do the same to a custom mesh it doesn’t work => https://playground.babylonjs.com/#VKBJN#8
Any ideas how I can do this?
I found this on shaders => https://forum.babylonjs.com/t/how-to-use-custom-shaders-with-a-custom-mesh-to-apply-textures/13889 but I think shaders are different, plus I couldn’t get this to work either
I also found this linked in another forum, but this doesn’t seem to work either => https://www.babylonjs-playground.com/#1YIME0#2
First of all, your mesh doesn’t have any material at all.
It needs some material to put a texture on it.
For the above, you need to understand that this is not a simple custom mesh. It uses vertexData to compute indices and normals. And then, of course, as @labris says you can see there’s no texture in there so it will certainly not appear ‘automagically’
I guess the first question would be ‘Why would you want to use vertexData’ for your custom mesh? In which case, you will eventually need a shader and a texture sampler to apply a texture on it.
But then just why make things complex if there’s no need for it. If it’s a custom mesh you want, here’s one for you:
@labris @mawa Apologies, I think I failed to save my Playground (and thus update the link) before posting it. Revise link below:
The Playground example is just to work out the process, what I want to create is (very) large, mathematically generated surfaces. I looked through all the meshes in the docs and none look like they will have the freedom I would like. Ribbons would probably work fine too, but it looks like these are very similar to the custom mesh, but instead of specifying every point on every triangle, Babylon calculates these for you between the longitudinal ribbons of points.
I could split my mesh up into thousands of different meshes that use a more standard mesh type for each I guess, but I don’t know if this would be as slick, or if there would be some performance drawbacks?
If I was to create each facet individually and apply colour and texture to each, is there a way I could then make them into a single mesh or a group or something, to get all/some of the benefits of having one huge mesh.
Also, just to note, beyond the scope of what I’m doing now, but I would perhaps like to eventually do something like this => https://forum.babylonjs.com/t/curved-mesh-with-quadraticbezier-and-ribbon/11698, but I’m starting with straight vertices to get my head around the process for now.
You should have started with this. I would have told you I have no faen clue how to do it