+ 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

5th Aug 2021, 3:35 PM
durian
durian - avatar
6 Answers
+ 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.
6th Aug 2021, 9:55 AM
Solo
Solo - avatar
5th Aug 2021, 4:55 PM
Solo
Solo - avatar
+ 2
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..
6th Aug 2021, 1:33 PM
durian
durian - avatar
+ 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?
6th Aug 2021, 2:11 AM
durian
durian - avatar
6th Aug 2021, 11:49 AM
Solo
Solo - avatar
0
Vasiliy fixed it...but still dont work..
6th Aug 2021, 12:03 AM
durian
durian - avatar