# How to create a custom geometry of a sloped corner?

if you won’t be able to see the inside faces you could just use a folded plane (on the right), it will save you some processing power, or alternatively give the full geometry on the left one final try…

1 Like

I do intend to optimize by having the engine create planes for the shapes via a logic matrix - this is exactly what I needed as well, but didn’t want to bother you on it

Texture fits perfectly onto the geometry but there seems to be a lighting issue that wasn’t there in the previous code

I generated the geometry from 3 planes and merged them so maybe the normals are getting messed up in the merge, you can try it in the following way and add all 3 meshes to one object, but again your using 2 meshes that’ll never be seen…

``````let pl = new THREE.Mesh(p, material)
p.rotateX(90*Math.PI/180)
p.translate(0,-0.5,0)

let pl1 = new THREE.Mesh(p1, material)
p1.rotateZ(Math.PI)
p1.attributes.position.array[8] -= 1
p1.attributes.position.array[10] -= 1
p1.attributes.position.array[11] -= 1
p1.translate(0.5,0.5,0.5)
pl1.position.set(-0.5,-0.5,0)
pl1.updateMatrix()
p1.applyMatrix4(pl1.matrix)
pl1.position.set(0,0,0)

let pl2 = new THREE.Mesh(p2, material)
p2.attributes.position.array[0] += 1
p2.attributes.position.array[1] -= 1
p2.attributes.position.array[2] += 0.5
p2.attributes.position.array[9] -= 1
p2.attributes.position.array[5] -= 0.5
p2.attributes.position.array[6] += 1
p2.attributes.position.array[8] -= 0.5
p2.attributes.position.array[11] -= 0.5

``````
1 Like

Ohh I just realized what you were saying. Yes it seems the inside faces will not ever be seen since it will always be against another object

I tried your plane folding method as well, which is the preferred method, but the lighting seems worse

i’ve just updated the pen, the normals and uv’s should now be correct for both the full geometry and the simpler folded plane…

2 Likes

Works like a charm, thank you!

1 Like

perfect, did you end up going with the folded plane or the entire geometry block?

1 Like

I went with the folded plane. Albeit I will keep the entire geometry block as well, just in case

1 Like

even just knowing blender basics will open a lot of doors in threejs. i struggled with this as well because it seems so complicated. there are a couple of tutorials i enjoyed like this one Blender 3 - Complete Beginners Guide - Part 1 - YouTube

with minor understanding you can already make simple models yourself, arrange scenes, and prepare models for the web.