文本生成图片和图片生成图片已经逐渐取代绘画师和设计师了,你有没有想过有一天文字和图片还可以生成3D模型?科技的发展只有我们想不到,没有AI做不到。那么对3d模型领域又会有哪些影响呢?手把手硬核AI教学,赶快收藏学习。
一、文本生成3d模型
在text to 3d(文本生成3d)和image to 3d(图片生成3d)方向比较成熟应用的有自动生成3D模型的AI应用,例如如下这个网站,可以根据图片和文字生成180度的2.5D模型


而真正目前text to 3d比较成熟的开源框架是OpenAI发布的shap-e开源模型,不仅能根据文本和图片来生成3d动画效果,而且还可以把生成的3d模型导出到3d编辑软件里进行编辑。
OpenAI Shap-e手把手硬核步骤教学
一、Shap-e介绍
github项目地址:
https://github.com/openai/shap-e

二、colab上部署Shap-e 复制并打开自动执行脚本:
https://colab.research.google.com/drive/1XvXBALiOwAT5-OaAD7AygqBXFqTijrVf?usp=sharing#scrollTo=7-fLWame0qJw按执行步骤一步步执行

三、参数修改

batch_size = 生成的数量
guidance_scale = 分辨率
prompt = 生成内容指令
四、文件下载并使用编辑器进行编辑使用
在左侧文件夹里找到生成的文件并下载使用3d编辑器即可对模型进行修改编辑
OpenAI发布的shap-e开源模型。



这就结束了?更炸裂的来了,接下来手把手演示如果通过图片提示来生成3D动画效果,上车出发
二、图片生成3d模型

请直接复制
import torchfrom shap_e.diffusion.sample import sample_latentsfrom shap_e.diffusion.gaussian_diffusion import diffusion_from_configfrom shap_e.models.download import load_model, load_configfrom shap_e.util.notebooks import create_pan_cameras, decode_latent_images, gif_widgetfrom shap_e.util.image_util import load_image
接下来找到第六步更改模型,替换图片解析模型

无脑复制代码
xm = load_model('transmitter', device=device)model = load_model('image300M', device=device)diffusion = diffusion_from_config(load_config('diffusion'))
别急,快看到终点了
准备一张图片上传到content文件夹里,图片格式.png .jpg

粘贴第四段代码到标注处

继续无脑复制如下代码
batch_size = 4guidance_scale = 3.0# To get the best result, you should remove the background and show only the object of interest to the model.image = load_image("example_data/corgi.png")latents = sample_latents(batch_size=batch_size,model=model,diffusion=diffusion,guidance_scale=guidance_scale,model_kwargs=dict(images=[image] * batch_size),progress=True,clip_denoised=True,use_fp16=True,use_karras=True,karras_steps=64,sigma_min=1e-3,sigma_max=160,s_churn=0,)
修改参数
batch_size = 生成的数量guidance_scale = 分辨率img = 图片保存路径
别走,最后一步老铁
复制如下代码到最后一步render_mode = 'nerf' # you can change this to 'stf' for mesh renderingsize = 64 # this is the size of the renders; higher values take longer to render.cameras = create_pan_cameras(size, device)for i, latent in enumerate(latents):images = decode_latent_images(xm, latent, cameras, rendering_mode=render_mode)display(gif_widget(images))
别忧虑点击执行,就会得到image to 3d模型了,照常按着以上步骤去编辑吧

just do it!

 
                         
                    
                     
                    
                     
                    
                     
                    
                     
             
  