Automatic annotation creation based on center to object view

Hi Everyone.
Does anyone know how to automatically center the object, and create automatically several annotations (let’s say 11 views) based on the center object coordinates?
This will be very useful for product visualization (left, right, front, back, top, etc) without the need to do it manually, and lose consistency.
I know this link could work.
however this could be challenging with the center to object API…

X, Y, Z coordinates of the annotations - Development and API - Sketchfab Forum

Hi @guillermoaguilerarod,
you could give this a shot: https://codepen.io/klaasnienhuis/pen/zYJRegv?editors=1010
It uses the focusOnVisibleGeometries function to center the camera: Viewer API - Functions - Sketchfab

1 Like

Thank you very much @klaasnienhuis
It worked.

1 Like

Hi @klaasnienhuis Is there a way to integrate the annotation solution you sent before using the sketchfab lab screenshot page as a template Screenshots?
Basically, when choosing the 3D model in the model picker, all previously predefined annotations appear, I know that the js could be added in the home html page, however can this be integrated with the loadsketchfab model is a challenge.
The previous annotation solution uses the loadSketchfab function, how can this be replaced by the model picker, in the sketchfab screenshot experiment page?

Using screenshot viewer API use var uid= instead of loadSketchfab function which gives me some error.

Thank you again you are the best.

Hi Guillermo,
I’m not entirely clear on what you’re trying to achieve. Could you rephrase what your goal is and what you already have tried yourself to get there?

Hi @klaasnienhuis thank you again for the support.

Goal: Have a sketchfab viewer with a predefined custom annotation, screenshot integration, and a imput button for loading a 3D model directly in the HTML page.

Previous test 1: I used sketchfab screenshot experiment lab as a template to integrate a custom annotation with the already existing screenshot, 3D model loader. = unsuccessful

Previous test 2: I used the custom annotation template you sent to integrate with the screenshot viewer API = unsuccessful.

The most of the challenge is to make the scene load using a unique var uid.
There is a way to combine, custom annotation, screenshot and sketchfab model loader (HTML button.)?

I’ve updated the codepen to include rendering of the views: https://codepen.io/klaasnienhuis/pen/zYJRegv?editors=0010
That should take care of most of your requirements. You can swap out the model id in the code.
Here’s a video of me walking you through the code. I hope that helps!

Sketchfab API - Annotations and screenshots - 23 March 2023 - Watch Video

2 Likes

Thank you @klaasnienhuis you rock, this is amazing. :100:

1 Like

Hi @klaasnienhuis hope you are going great.
Do you know why when exporting the images, it does not export correctly? (Repeating the visualization) this happen only in chrome and internet explorer while in firefox its export correctly. I think it might be a bug.
Thankk you againn :100:

hm, in Chrome I have no issues. Chrome does halt downloading the images after the first one and asks me if I want to download the other ones. But when I confirm, I get all the images as they should be.
A workaround would be to keep al rendered images in memory and add them into a zip file. That would give you a single download and causes the browser to complain less.

1 Like

ok, thank you @klaasnienhuis for the support again, that workaround is a very good idea :100:

1 Like

To automatically center an object and create multiple annotations based on its coordinates, you can employ a script or program written in a scripting. First, load the object or model into your chosen application. Next calculate the center coordinates of the object by determining the average position of its vertices or utilizing appropriate algorithms for the specific file format or 3D library you are working with. Once you have the center coordinates, you can proceed to generate the desired annotations.
Regard and best wishes