three.js attribute | Sololearn: Learn to code for FREE!

+3

three.js attribute

hi i try to play around with three.js,but seems like i cant get the shader working properly..can someone tell me how to get the geometry attribute properly?i believe this is how people do it but still i got black screen https://code.sololearn.com/WJpLN9nPjBDV/?ref=app

8/5/2021 3:35:54 PM

Lily Mea

6 Answers

New Answer

+1

Yes, through the .setAttribute() method we refer to the attribute of the .BoxGeometry() method called 'position'. If we want to add our own attributes, we will use the .getAttribute() method.

+2

line 63. no « , » https://code.sololearn.com/Wq46E421aB8w/?ref=app

+1

https://code.sololearn.com/WVedD2DzahRW/?ref=app now this working but this is weird..it seems like for vertex position i have to name my attribute exactly as "position" and cant declare smtg like "attribute vec3 position" in vertex shader..it works for other attributes though(like "a_colors" in this code)..but i would like to know why?is this intentional or a bug?

+1

☺️ https://code.sololearn.com/WTNi870rQWUm/?ref=app

+1

Vasiliy yeah..if i use other geometry like box geometry, the attribute working fine but buffergeometry sometimes not..well ,i just name it as position for now..at least it works👌..thanks for your help..

0

Vasiliy fixed it...but still dont work..