0

for a university project I created a threecsg subtract in ThreeJS. I want to apply a texture for this mesh. But the missing uv coordinates after the processing is causing me some trouble. This needs to be a threecsg, because this a project requirement.

This is how the mesh looks like now: screenshot link

I found some code here: THREE.js generate UV coordinate

And it did get me closer to the solution. The side faces are now facing the applied texture in the right way: screenshot link

The upside has many weird faces. I tried to use the THREE.SimplifyModifier to get fewer faces so I might be able to calculate and set the uv-coordinates by myself, but I failed.

I thought it might be a solution to "just iterate" over the up- and downside and to kinda "cut of" the texture at the border, like it would be if the mesh were a cube. The mesh has about 350 Faces, I probably could be able to set the corner vertices but it would be nice if the uv-coordinates of the vertices in between could be calculated - but I have no idea how to to this. I do not mind about the side where cylinder is cut off, because you will not see it at the end.

thank you so much!

  • Please include code demonstrating what you've tried to reproduce a minimal example of your problem. https://stackoverflow.com/help/minimal-reproducible-example – M - Jun 19 '20 at 23:04

1 Answers1

0

The CSG library I'm maintaining preserves UV coordinates from cut geometry.

https://github.com/manthrax/THREE-CSGMesh

http://vectorslave.com/csg/CSGDemo.html

http://vectorslave.com/csg/CSGShinyDemo.html

@JonasOe

manthrax
  • 4,918
  • 1
  • 17
  • 16