rozek / aframe-rounded-box-component

an A-Frame component and primitive for boxes with rounded edges
MIT License
3 stars 0 forks source link

FlatShading=false is not working as expected #1

Open Dirk-27 opened 1 year ago

Dirk-27 commented 1 year ago

The shading of the ExtrudeBufferGeometry looks always like setting flatShading to true.

Expected: The flatShading depends on the material setting. Default is "flatShading: false" and the geometry looks smooth.

We can solve this by adding one line after line 49 in /src/aframe-rounded-box-component.ts (update from Latest commit [78e78b1] on Nov 23, 2022):

line 49:           Geometry.center()
line 50:           Geometry = THREE.BufferGeometryUtils.toCreasedNormals(Geometry);

Result is on the right (left is withmaterial="flatShading: true")

image

AFrame-Version: 1.4.1

drllz commented 5 months ago

But THREE.BufferGeometryUtils.toCreasedNormals(Geometry); functionality isn't available in ThreeJS r126, (Aframe 1.5.0 is locked off at r126)

Am I missing something?

Dirk-27 commented 5 months ago

I didn't checked the past versions, but I know we added it since March 2023. Currently aframe 1.5.0 master uses Three 0.158 (or greater) and there it exist like here https://threejs.org/docs/#examples/en/utils/BufferGeometryUtils.toCreasedNormals described.

The second parameter seems to be optional (checking the funtction definition) with a default of PI/3 which is 60 degrees in gradians.

PS: https://www.drllz.com/ is cool!

drllz commented 5 months ago

The module needs to be especially imported. I'm restricted on my project in that I need to use vanilla Aframe 1.5.0 with no extra threeJS modules.

Looks like I need another solution.