Generate 3D images using Stable Diffusion

Convert 2d to 3d image


 In the field of image shoots, we struggle a  lot in getting multiple angles of any product image and there are heavy costs in doing these photoshoots with different angles of any business product which takes time as well.



But not a problem, because StabilityAi has released a new model Stability Zero123 which generates multiple 3d images from a single image with just a single click in no time. 



 We are excited to share with you a straightforward tutorial on how to effortlessly rotate 3D images using the new Stability AI model. Let's dive right into it.

zero123 model github repo

If you want to download the model and use it locally then your can go to their github repo and download from there.

 These are the basic fuctionalities provided by the model:

1. Novel View Synthesis

novel view syntehsis


2. 3D reconstruction from a 2D image

3d reconstruction effect


Step-by-Step Tutorial:

If you come to the hugging face  Zero123 demo platfrom, you will get many setting for generating image which are described below:

Zero 123 Multiple setting

-Polar angle (vertical rotation in degrees)

-Azimuth angle (horizontal rotation in degrees)

-Zoom (relative distance from center)

-Number of samples to generate

In the advanced options you get these options:

-Diffusion guidance scale

-Number of diffusion inference steps

upload your image to online to remove background

background removed
1. First of all, select your image and remove its background from any website online like remove.bg.


drag and drop image into upload box hugging face

2. Open the free platform by Hugging Face.

https://huggingface.co/spaces/cvlab/zero123-live

3. Upload your background removed image by dragging and drop into the box area.

settings for viewing angle

4. After uploading, you will get various button options for getting the images from different angles. Just click on any one and you will get that side of images. There are various angles available like "View from Left", "View from right", "View from top", "View from bottom" etc.


viewing angle left
This is left view of image

viewing angle top

This is top view of image.


You can see that viewing angle of second image that is from top is not up to mark. So, we have to take in mind that the model is in new state and we have to try multiple times to get the actual output.


Lets try something else like a human face.



Image Credit : Art station

removed image background

We took this image and removed its background.

above angle view
The from above view angle

behind angle view
Behind angle view

below angle view
This is below angle view

Left angle view
Left angle view

right angle view
right angle view


Random Rotation
Random Rotation

Here are its 3d images in different angles. And these are the results we got after using all the options from different angles. As for generating human face its not up to the mark. So, its not recommended for generating a 3d human face however its definitely give good results for generating product images.


Implementing the Rotation

Now, let's break down the workflow:

 a. Single Image Rotation

    - Load your image using a checkpoint loader.

    - Utilize the Clip Vision output using Mato's notebook for incremental rotation.

    - Experiment with parameters like batch size, resolution, base elevation, and base azimuth.

    - View your rotated images or create a GIF using the Video Combine function.

b. Creating a Rotation Video

    - Similar to the single image process but with a tweak for video creation.

    - Adjust parameters to suit your preferences.

    - Combine the images into a GIF or explore other output formats.


Tips need to consider while generating image using Zero123

-If you face any error while generating images then you must use low resolution.

-Generating 3d human face is not supported.

-You can also use "Advanced options" for good and detailed results.

-Its recommended to choose low value at "Number of sample" option because model will generate probabilistic results. Range from 3-5 will be good enough for setting the generating samples.


Conclusion:

Feel free to experiment with different settings, sampling methods, and resolutions. The possibilities are vast, and you can adapt the tutorial to your specific creative needs. Zero 123 Model has made our work easy and it is really a cost-cutting model from the business perspective.

And there you have it. A simple yet powerful tutorial on 3D rotation of 2D images.