Accessing Planegeometry vertex z

geometry
#1

How to change planegeometry vertex z, given x and y?

geometry = new THREE.PlaneGeometry(100,100,100,100);
//Something like this?
//geometry[0][0].z ?
#2

Hi!
Could you explain it more clear? Why do you want it like that? It would be great to provide an explanatory picture :slight_smile:

#3

Is it even possible to access different vertices from planeGeometry?
So I can loop the x and y, and create Perlin noise with z index, then I have Terrain. :slight_smile:

I had usual geometry before, but the textures was repeating on every section of a square, so if I had 100x100 Geometry with planes, I had 100 repeated textures, but planeGeometry gave me 1 texture and I can repeat it easier if i want to.

#4

You can loop through the array of vertices, conceptually something like that:
geometry.vertices.forEach( v => { v.z = noiseFunction( v.x, v.y ); } )

Maybe this topic will be helpful: Three.js + noisejs

#5

Thanks, and cool demo! Your example works! :slight_smile: But I should still stick to my custom geometry, because looping through after already created geometry is inefficient.
1 more question, what i mentioned earlier. I explain myself better in a new question.

#6

/cc

#7

Yea, I got my answer here and deleted it. :slight_smile:

1 Like