Hello
I program a 3d waveform,
So i build my 3d waveform :

``````
for(int i=0;i<waveForms.size()-1;i++){
if(i%2==0){
for(int j=0;j<waveForms[i].size();j++){
ofVec3f vec0(waveForms[i][j].x,waveForms[i][j].y,i*20);
ofVec3f vec1(waveForms[i+1][j].x,waveForms[i+1][j].y,(i+1)*20);
}
}else {

for(int j=waveForms[i].size()-1;j>0;j--){
ofVec3f vec0(waveForms[i][j].x,waveForms[i][j].y,i*20);
ofVec3f vec1(waveForms[i+1][j].x,waveForms[i+1][j].y,(i+1)*20);
}
}

``````

So one time i go to left to right and after to right to left.
I use some polyline for my coordinate ( a vector called waveForms )
My problem is when i render my mesh, i obtain a totally white 3d, without any shadow ( i added a light , and the brightness of my mesh change when i move my easycam, so the light affect the mesh ). But i got any relief…
What i miss for obtain a shadowed mesh ?

you’ll have to add normals, so your mesh renders correctly. Normals are used to compute the shading for a specific vertice.

HTH,
Stephan

ok thanks.
So i added normal, i placed it on the middle of hypothenus of my vertices triangles ( center of my face )

But i obtain something strange, like if i had both mesh, one shadowed and other bright, covering one by other , depend of angle i look my mesh.
Do you see where is my problem ?

Have you added a normal per vertex? Can you post a screenshot?

and how i add normal to my vertices :

``````
for(int i=0;i<waveForms.size()-1;i++){
// if odd, go to left to right
if(i%2==0){
for(int j=0;j<waveForms[i].size();j++){
ofVec3f vec0(waveForms[i][j].x,waveForms[i][j].y,i*20);
ofVec3f vec1(waveForms[i+1][j].x,waveForms[i+1][j].y,(i+1)*20);
ofVec3f vec2(waveForms[i][j+1].x,waveForms[i][j+1].y,i*20);
ofVec3f vecN((vec1+vec2)/2);
}
// if even go to right to left
}else {

for(int j=waveForms[i].size()-1;j>0;j--){
ofVec3f vec0(waveForms[i][j].x,waveForms[i][j].y,i*20);
ofVec3f vec1(waveForms[i+1][j].x,waveForms[i+1][j].y,(i+1)*20);
ofVec3f vec2(waveForms[i][j-1].x,waveForms[i][j-1].y,i*20);
ofVec3f vecN((vec1+vec2)/2);
}
}
}

``````

Hi,