Hi, I’m trying to use a texture on an imported mesh but it just seems to change the color of the mesh. The texture works on an internally created box. What am I missing?
Here is a playground example, the skull is a green similar to the texture but the box actually shows the bitmap details:
https://www.babylonjs-playground.com/debug.html#RNXANA#7
Hi G! https://www.babylonjs-playground.com/debug.html#RNXANA#9
Look at line 18 and what is reported at console. null, right? The skull model has no UV data… and UV data is used to “map” a texture onto a model.
SO, yeah, some models have UV data, some don’t. For texturing, it is best to have some UV data.
I think it is the lack of UV data… that makes the mesh APPEAR TO change color. I think we are seeing a few pixels of the texture… being stretched across the entire skull. (pretend that the texture is a mile tall/wide, and so, only 3 pixels in the lower left corner of the texture… are painted upon the skull. The rest of the texture misses the skull.)
Hi W!,
So this is a an issue to deal with when I make a model. I made an icosphere in blender and had the same issue, I guess I need to do some research on how to add a uv map in blender… thanks
Yeah. And there’s some help, here. Blender - Babylon.js Documentation
What version of Blender? 2.80 could be wobbly/different. I’ve heard rumors… that textures are being treated a bit differently in 2.80. Perhaps some web reading about that… is wise, especially if the tested .blender file was created with earlier Blender versions.
There’s a few ways to view the JSON .babylon file that Blender exporter produces. When everything is right, you should see the UVS array inside that file… right along-side positions, indices, normals, etc.
Here’s something I found in the Blender manual.
https://docs.blender.org/manual/en/latest/editors/uv_image/index.html#editors-uv-image-index
Perhaps swanky, uptown modeling pro @gryff …will visit, and tell us what he knows. He will want to know the Blender version you are using, too. Good luck. Teach us things you learn, please.
Hi,
I found that it was fairly simple to create a UV Map in blender, there are default selections to create some, though without some skilled work choosing seams the defaults probably wouldn’t be usable for any project reliant on a well mapped texture.