Questions regarding UV-coordinates, camera lock, environment light and sticker customisation

Hey all,

We are building a configurator for a bags & accessories brand. We’re providing our own 3D model and textures. The aim is to create a configurator where you can exchange the colour of the bag (body + belt) and also add a graphic to the front of the bag.

Here’s an example of our WIP. The graphics will change later.

Hoping the community here can help us get further. The answer to the following questions would help us get to the next step:

  1. We have a problem with the UV-coordinates between the Asset and Draft modes. In the Asset mode it works, but not in Draft. Is there a way to activate the UV-coordinates in the Draft mode?
  2. Is there a way to lock the camera to not go lower than our horizontal position? We don’t want to see the bottom of the object.
  3. We need to control Environment light. We need to brighten or darken the entire model and Environment reflection to metal elements.
  4. For the sticker/graphic customisation on our bags we would ideally want the customer to be able to scale them and position it themselves. Is there a technique to solve this?
  5. Also we need to understand how a second sticker works together with the other stickers. We can add a second sticker but we cannot move it.

Looking forward to your response :slight_smile:

Hi @Bos,

Thank you for using our forum. Please find my answers below:

  1. UV coordinates
    You can activate the Babylon.js inspector in the top right corner within the Control Panel. This is pretty helpful as you can go through every setting for each mesh, material and texture in your scene.


    Setting the vScale to -1 should to the trick in your case. So instead of Viewer3D.materialParameter("body", "paintable", newStiker.Value.ToText() ) please try Viewer3D.materialParameter("body", "paintable", { src: newStiker.Value.ToText(), uScale: 1, vScale: -1 }.ToText()) (see 3d viewer control)

  2. Limit camera angles
    Restricting the camera is currently not possible without using custom JavaScript. Please see the following page on how to use custom JavaScript: 3d viewer control with custom JS). When you’ve set up your custom JS project and injected the Viewer, it’s just setting the Upper beta limit of your active camera.

let camera = /** @type {ArcRotateCamera} */ (viewer.scene.activeCamera);
camera.upperBetaLimit = Math.PI / 2;
  1. Environment light
    Here’s how to use a different Environment URL: 3d viewer control
    The following link describes how you can create a .env file based on a .hdr or .dds file. Using An HDR Environment For PBR | Babylon.js Documentation
    For changing properties like intensity or rotation of your environment, please use custom JS.

  2. Scale and position
    There is currently no built-in functionality to scale or move paintables directly in 3D. However, you could use a Graphic component which allows the user to move, scale and rotate the stickers in a 2D canvas. The value of the Graphic Component can then be used as the texture for your paintable parameter. (see 1.)

  3. Second sticker
    Given that you go with the suggested Graphic Component approach (see 4.), you can have as many stickers, logos, image uploads etc. as you like.

I hope this helps!

David

Hey David,

Thanks so much for the answers. We’re looking into it now but noticed your interface is different than ours. (see screenshot)

It seems like you’re using some sort of app or different workspace? Is that correct?

Many thanks,
Bos

Hi @Bos,

your Screenshot show the editor whereas my screenshots show the Preview. The Babylon.js inspector can only be activated in the Preview but not in the editor.

By the way, you can open the Preview by clicking on the “Preview” link on the top left corner within the editor.

Hope this helps.

David

Hey @LEI

Thanks, that makes sense. Now our only trouble is that we have limited knowledge of Javascript, and not likely to use it for other purposes in the near future.

So that raises a new question. Is there a tutorial or a possibility to get one about how to work with the JS coding, regarding our first set of questions? What windows to open and where to insert the code? Is there a straightforward solution for this with no programming involved?

Thanks a bunch!

Hi @Bos,

please have a look at the following GitHub repository which you can use as starting point for you project: GitHub - Combeenation/custom-js-template.
Further information on how to use custom-js in your project can be found here: Custom JS

Regards,
David