Create an All-Over Print Tee

This guide will walk you through how to create a simple all-over print tee using the SDK. We'll load a custom image and place it on every part of the model.

INFO
Check out the Create a Design guide before this one, it has info on setting up your development environment and most of the code below, which we'll skip here.

Contents

Step 1 — The Code

In this step we'll create a new design and render it in the browser. We'll show the full snippet here so that you can get a sense of the entire process and we'll break down each part afterwards.

1import { Core3D, Material, Model } from '@core3d/sdk';
2import { Adapter } from '@core3d/sdk-adapter-three';
3
4const core3d = new Core3D({
5 apiKey: '...', // your Core3D API token
6 createAdapter: ctx => new Adapter(ctx),
7});
8
9const design = core3d.createDesign();
10const model = await core3d.loadModel(Model.Tee);
11const cotton = await core3d.loadMaterial(Material.Cotton);
+12const pattern = await core3d.loadPattern('core3d:upload:018d43a7-6826-715d-a20f-91a2eef87642');
13
14design.setModel(model);
15
16for (const mesh of design.listMeshes()) {
17 design.apply(cotton, mesh);
+18 design.apply(pattern, mesh);
19}
20
21await design.render();
22
23const scene = await core3d.loadScene({
24 layout: 'front',
25 size: [512, 512],
26 target: design,
27});
28
29scene.fit();
30scene.start();
31
32document.body.append(scene.element);

Step 2 — Breaking It Down

First, we add a new line to load a pattern.

const pattern = await core3d.loadPattern('core3d:upload:018d43a7-6826-715d-a20f-91a2eef87642');

Then we apply it to every mesh after applying the cotton material.

design.apply(pattern, mesh);

You'll have to swap in an Upload URI (core3d:upload:...) that your account has access to -- you can create an upload by using the Create Upload endpoint, an SDK method (await core3d.api.uploads.create({ file: File })), or follow the Generate An Image guide to utilize our AI features.

And the result is...

all-over print tee

Get in touch

We'd love to learn more about your vision and how we can help.

PressPrivacyTermsSupportCopyright © 2024 Core3D, Inc. All Rights Reserved.