Forum

User posts InvisibleK
24 October 2017 12:33
Hi Community,

We're developing a product configurator, and one of the challenges is the possibility to upload a logo in a configurator and use it on defined print areas of a product.

Print areas are created as separate objects in Blender and placed to specified positions. The texture type of print areas is set to "None" and "Export Options" -> "Source Type" is set to "Canvas". I can get a CanvasRenderingContext2D object in API and then manipulate it: put the uploaded logo to UV-mapped rectangle, move the logo within a mapped area (which also moves the logo on a product) and so on.

So far so good, but all the controls for logo manipulation are out of 3D scene. Basically it is a div box with buttons "left", "right", "top", "bottom", "rotate" etc. The customer wants to get rid of these buttons and the div box. The idea is to make it possible to drag the logo directly at 3D Object, but I‘m not sure if this is possible, and if possible how complicated is the solution?

I can imagine, that I need to lock the camera controls in case of print areas configuration, and then somehow understand how far and in which direction the move was made. Probably it should nothing to do with a 3D Scene, just put some overlay on a canvas with "mouseup" and "mousedown" event handlers.

Did someone do something similar? Is it possible at all?
25 July 2017 18:06
Hi again :)

By default Blend4Web allows a user to control a camera, while object stays in fixed position.
The question: is it easily possible to make it behave different - camera is in fixed position, but user is able to rotate (with a mouse) the object itself around it's center.

I've found a transform module: https://www.blend4web.com/api_doc/module-transform.html
It allows to set rotation with all coordinates, but I need then add event listeners for mouse actions, trace the movement and then calculate the according coordinates.

But before I dive into it, I'd like to know, maybe there is already some setting, that allows such a manipulation out-of-the-box?
25 July 2017 17:54
Thank you for your answers!

Meanwhile I've found, that it is possible to get CanvasRenderingContext2D for a texture, which needs to be defined of "None" type in Blender: https://www.blend4web.com/doc/en/textures.html#special-texture-types via
m_tex.get_canvas_ctx(obj, "MaterialTexture");


Then one can render a text via CanvasRendering and apply newly rendered texture via
m_tex.update_canvas_ctx(obj, "MaterialTexture");
18 July 2017 18:03
Hi Community,

I'm new to 3D, Blender and Blend4Web, but good at programming :)
I've roughly checked documentation and API, played a bit with Blender and Blend4Web, but can't find a precise info about my requirements.

The idea is to allow a user to configure a product in a way, that user is able to upload a logo (or any other image) and apply it to some part of a product. Like here: https://www.wanzl.com/fileadmin/3d_product_visualization/online/dist/?type=el&lang=en_DE
I only can't get, how a 3D model needs to be prepared for such a manipulation: should there be an invisible object (mesh ?) with a size, limited for texture, placed above the real object. And then a texture (uploaded logo) is applied to this "fake" object (mesh ?). Or is it possible somehow to control the position of a texture, like "10% from top, 3 % from left, do not stretch"?

Or instead of logo, one should be able to insert a free text, which should be rendered in runtime on a product. Something like here: https://www.helmade.com/en/helmets/scooter/helmade-one-50-50.html (you need to click on "Signature" icon in configurator to see a text-input field).

Is this all possible. If so, can I be pointed into right documentation or examples?

Thank you in advance.