Painting on a skull

I found this great example:
It shows how to ‘paint’ on a BABYLON.Mesh.CreateGroundFromHeightMap.

I am having difficulties transforming this example to paint on a model, which is gonna be an imported 3D model. Perhaps a blender model.

Here’s my adaptation so far, using the default skull for now:

I’d like to paint on that skull just as I can paint on the ground area

Any tips/help is appreciated!

1 Like

first approach : draw circles on a sphere


Interesting. And thank you for fiddling!
I’ve tinkered a bit with your code, trying to get an understanding of your sticker-approach.
Skull-import works, but I am unable to assign the decal…

dynamic texture does not work either on loaded mesh! :frowning:

there are obvious limits to the use of materials…

Hi. There is no limits. Sky is the limit :rofl:
It is not working on skull for 2 reasons.
It has color attribute and it doesn’t have uv defined
If you set the color attribute to white and add some ‘fake’ uvs, you’ll see that the texture show up, but looks messy
So I recomand you to try on other mesh, with UVs already defined, as example here


What stands ‘UV’ for?


There are also decals

1 Like

@MarianG and @Necips , thank you so far. After getting the basics right, I’ll try and add both sticker/decal option and the paint option from a selection-menu.

Now I have a single texture as well, after experimenting with different values of assetsManager.addImageTask

But I do not understand how to get rid of the ‘ground’… The painting on the ‘Dude’-model miraculously only works with "ground.actionManager.registerAction( … " enabled. Why does my code behave like this?
Please take a look at line 226 / 230 in

I commented the ground.actionManager.register… and assigned another material to the ground

Is this what you are looking for?

Thank you. Not sure why I can disable the ground in your #11 version - as opposed to the #10 version. But this works now!

So my next step is implementing an external model, including a decent UV map. Again, thanks for the reference, @MarianG … Perhaps a layered model, so I can paint on different parts/meshes (enable skin, skull, brain).

After that I’ll try and add the selection for decal || paint…

Thank you all!

1 Like

hmmm… So I now have integrated Paint & Decal:
The painting-part works, thanks to @MarianG

But when I apply the material from the sphere (aka mesh) to the dude (aka skullTask), the decal won work on it:
See lines 81, 82 & 333, 334 … What am I doing wrong / do I need to understand?

Also embedding the actionManager into the skullTask.onSuccess is not working. See ( building forward onto the suggestion of @Necips )

I am looking to understand why.

Here is with decals. chek 335 line.

Actually I didn’t understand what u wanted do in the last pg, so I cleaned it up a little bit, I hope I didn’t remove something what you wantd :sweat_smile:



The human mouth has an interesting shape: A stamp in the shape of a circle creates a rectangle!

1 Like

@MarianG You have saved me so much time and helped me so much to better understand babylonjs.