The input text isn't loading on the model

hi guy

I’m new to babylonjs

and I’ve been working in an project which looks like this

therefore i’m doing this with 3d rotation

here is my output which looks like

i need that text to be on beer bottle

please can any one figure it out

We won’t be able to help much without looking at the running code. And your problem isn’t clear from your description, please try to explain it more.

hi, carolhmj

thank you for your respond

here is my code

what’s my expectation is, I need the text contain which I give in the input to be on the model like this
(take a look at this link thank you)

As per @carolhmj comment, hard to give you best input with so little information.
Though if I understand correctly, what you want to do is draw text on your bottle AND you want to draw this text based on user input, yes?

If so, part of the answer you can get from the doc on how to use a dynamicTexture
You will apply this texture/material to your beer bottle for step1.
Next, all that remains to be done is to generate an update of the dynamicTexture and render it upon new user input/update (if this is really what you want?).

As often with BJS, there is more than one way. Another way I can think of would be to use the advancedDynamicTexture for mesh (part of the BJS GUI). In this case scenario, you would create the advancedDynamicTexture for your beer bottle mesh. You would next update the .text of the GUI control based on the inputText control.

PGs are available for something similar in case you need more help.

But then, first, let us know if this is really what you are looking for?
Meanwhile, have a great day :sunglasses:

Linked to: How to give input and then take that value to the object in babylon js

You’ll then need to assign the DynamicTexture to the material, being mindful of its uv mapping to control where the texture will be on the model. I’ve done something a bit similar before (wanted to add text to a model of a whiteboard), and found out the easiest way was to “cut out” a part of the mesh as the assigned “drawing” area. I did this in Blender by separating the object:

modifying the UVs of the separate plane (I unwrapped the object and scaled the UVs by -1 on the vertical direction only):

and then exporting to GLB, which will result in two meshes:

You’ll retrieve the mesh corresponding to the “label” region, create a material for it, and then apply the Dynamic Texture:

1 Like

Definitely the way to go if you ask me. Not to mention that by actually duplicating it (instead of cutting) and keeping it on top, just slightly offseted from the full beer bottle mesh, you can still have your underlying beer bottle texture not affected by the dynamicTexture.

Thank you mawa and carolhmj

I really appreciate you’re response towards this

check out this

thank you

I answered a method (of course, not the only one) of doing that on my previous post. Decals | Babylon.js Documentation ( could be another option too.

1 Like