Is it possible to generate individual ice floes from cylinderGeometry

I’m trying to generate individual ice floes for a small low-poly game. I thought I could do this based on a cylinder, but unfortunately I don’t have the experience to know what values ​​I need to use.

Or is there a better way?

let icefloeGeometry = new THREE.CylinderGeometry(0.3, 0.3, 0.5);

// some code to deform???

// 
let icefloeMaterial = new THREE.MeshStandardMaterial({ color: 0xdfe0f2, shading: THREE.FlatShading,});
let icefloeBase = new THREE.Mesh(icefloeGeometry, icefloeMaterial);
icefloeBase.position.y = 0.25;
let icefloe = new THREE.Object3D();
icefloe.add(icefloeBase);

A cylinder is a good starting point. You might want to modify its vertices in order to make it more irregular.

It could work like this, it doesn’t have to be interactive, but you can define the points.

WallBuilding

from the Collection of examples from discourse.threejs.org

1 Like

Where can I find an introduction to vertices? I’m not sure which coordinates I would need to edit to, for example, pull a point slightly outward.

let icefloeGeometry = new THREE.CylinderGeometry(0.3, 0.3, 0.5,12,12);
let vertices = icefloeGeometry.attributes.position.array;
for(let i=0;i<vertices.length;i++)
   vertices[i]+=(Math.random()*.1)-.05;  //Add some randomness to all verts

icefloeGeometry.computeVertexNormals();

I have visualized the numbering of the vertices/faces of the standard geometries.

directly NumberingHelperExamples

1 Like

I’m not sure whether there are tutorials, maybe there are some somewhere. Most people learn by experimenting. Later on, I might draft a quick demo with the cylinder. Meanwhile, it might be possible to use convex geometry instead of cylinder.

Edit: here it is with a cylinder, the low-poliness can be controlled by LOW_POLY_COUNT in line 44:

https://codepen.io/boytchev/full/YPzJpZj

image

thank you very much, I will look into it in more detail