-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
746 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
<img class="logo" src="../assets/logo/logo.png"> | ||
|
||
|
||
# 3D Assets | ||
|
||
|
||
## Drink can | ||
|
||
This generator creates a 3D drink can . A set of parameters | ||
control the size and the shape of the can. It is possible to | ||
generale low-poly drink-can by reducing the complexity, | ||
removing edges and using flat shading. Click on a snapshot | ||
to open it online. | ||
|
||
<p class="gallery"> | ||
|
||
<a class="style-block nocaption" href="../online/drink-can.html?canHeight=12&canSize=6&canComplexity=70&neckHeight=1.5&neckSize=5&neckLid=true&neckTag=true&edges=true&flat=false"> | ||
<img src="images/drink-can-1.png"> | ||
</a> | ||
|
||
<a class="style-block nocaption" href="../online/drink-can.html?canHeight=5&canSize=7.46&canComplexity=70&neckHeight=1.5&neckSize=6.5&neckLid=true&neckTag=true&edges=true&flat=false"> | ||
<img src="images/drink-can-2.png"> | ||
</a> | ||
|
||
<a class="style-block nocaption" href="../online/drink-can.html?canHeight=13.4&canSize=5&canComplexity=70&neckHeight=1.5&neckSize=5.9&neckLid=true&neckTag=true&edges=true&flat=false"> | ||
<img src="images/drink-can-3.png"> | ||
</a> | ||
|
||
</p> | ||
|
||
|
||
### Code example | ||
|
||
```js | ||
import { DrinkCan } from "3d-assets/drink-can.js"; | ||
|
||
var model = new DrinkCan ({ | ||
canHeight: 12, | ||
canSize: 6, | ||
canComplexity: 70, | ||
neckHeight: 1.5, | ||
neckSize: 5, | ||
neckLid: true, | ||
neckTag: true, | ||
edges: true, | ||
flat: false | ||
}); | ||
``` | ||
|
||
|
||
### Parameters | ||
|
||
#### Can parameters | ||
|
||
* `canHeight` – height of the drink can, in cm, [5, 20] | ||
* `canSize` – diameter of the drink-can, in cm, [5, 8] | ||
|
||
#### Neck parameters | ||
|
||
* `neckHeight` – desired height of the neck, in cm, [1, 3] | ||
* `neckSize` – desired size of the neck, in cm, [4, 9] | ||
* `neckLid` – if *true* the lid is textured, if *false* the lid is flat, boolean | ||
* `neckTag` – if *true* the lid has a tag, if *false* the lid has no tag, boolean | ||
|
||
#### Complexity parameters | ||
|
||
* `canComplexity` – number of faces along the drink can perimeter, as percentage, [0, 100] | ||
* `edges` – if *true* edges are rounded, if *false* edges are sharp, boolean | ||
* `flat` – if *true* flat shading is used, if *false* smooth shading is used, boolean | ||
|
||
|
||
### Online generator | ||
|
||
[online/drink-can.html](../online/drink-can.html) | ||
|
||
|
||
### Source | ||
|
||
[src/drink-can.js](https://github.com/boytchev/assets/blob/main/src/drink-can.js) | ||
|
||
|
||
<div class="footnote"> | ||
<a href="../">Home</a> | ||
</div> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Large diffs are not rendered by default.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
<!DOCTYPE html> | ||
|
||
|
||
<html> | ||
|
||
|
||
<head> | ||
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"> | ||
|
||
<link rel="shortcut icon" type="image/png" href="../assets/logo/logo.png"/> | ||
<link rel="stylesheet" href="styles.css"> | ||
|
||
<script type="importmap"> | ||
{ | ||
"imports": { | ||
"three": "https://cdn.jsdelivr.net/npm/[email protected]/build/three.module.js", | ||
"three/addons/": "https://cdn.jsdelivr.net/npm/[email protected]/examples/jsm/", | ||
"three/nodes": "https://cdn.jsdelivr.net/npm/[email protected]/examples/jsm/nodes/Nodes.js", | ||
"tsl-textures/": "https://cdn.jsdelivr.net/npm/tsl-textures@latest/src/", | ||
"assets/": "../src/" | ||
} | ||
} | ||
</script> | ||
</head> | ||
|
||
|
||
<body> | ||
<div class="footnote bottomfixed"> | ||
<a href="../">Home</a> · | ||
<a id="info" href="">Info</a> | ||
</div> | ||
|
||
<script type="module"> | ||
|
||
import * as THREE from "three"; | ||
import { install, params, model, updateModelStatistics } from "./online.js"; | ||
import { DrinkCan } from "assets/drink-can.js"; | ||
|
||
|
||
|
||
var gui = install( DrinkCan ); | ||
|
||
|
||
|
||
var guiC = gui.addFolder( '<big>Can</big>' ) | ||
|
||
guiC.add( params, 'canHeight' ) | ||
.min( 5 ).max( 20 ).step(0.01) | ||
.name( 'Height<right>cm</right>' ) | ||
.$input.classList.add( 'top' ); | ||
|
||
guiC.add( params, 'canSize' ) | ||
.min( 5 ).max( 8 ).step(0.01) | ||
.name( 'Size<right>cm</right>' ) | ||
.$input.classList.add( 'bottom' ); | ||
|
||
|
||
var guiN = gui.addFolder( '<big>Neck</big>' ) | ||
|
||
guiN.add( params, 'neckHeight' ) | ||
.min( 1 ).max( 3 ).step(0.01) | ||
.name( 'Height<right>cm</right>' ) | ||
.$input.classList.add( 'top' ); | ||
|
||
guiN.add( params, 'neckSize' ) | ||
.min( 4 ).max( 9 ).step(0.01) | ||
.name( 'Size<right>cm</right>' ); | ||
|
||
guiN.add( params, 'neckLid' ) | ||
.name( 'Lid' ); | ||
|
||
guiN.add( params, 'neckTag' ) | ||
.name( 'Tag' ); | ||
|
||
|
||
var guiT = gui.addFolder( '<big>Complexity</big><right id="model-statistics"></right>' ) | ||
|
||
guiT.add( params, 'canComplexity' ) | ||
.min( 0 ).max( 100 ) | ||
.name( 'Can<right>%</right>' ); | ||
|
||
guiT.add( params, 'edges' ) | ||
.name( 'Edges' ); | ||
|
||
guiT.add( params, 'flat' ) | ||
.name( 'Flat' ); | ||
|
||
|
||
updateModelStatistics(); | ||
|
||
</script> | ||
</body> | ||
</html> |
Oops, something went wrong.