Reputation: 667
I'm creating a sphere and adding distortion to it, that's working fine. When I look at the wireframe it's like this
and with the wireframe turned of it looks like this
As you can see the are no shades and the distortion isn't visible when the wireframe is turned of.
What I'm looking for is what to place in my custom fragmentShader.
I used this
// calc the dot product and clamp
// 0 -> 1 rather than -1 -> 1
vec3 light = vec3(0.5,0.2,1.0);
// ensure it's normalized
light = normalize(light);
// calculate the dot product of
// the light to the vertex normal
float dProd = max(0.0, dot(vNormal, light));
// feed into our frag colour
gl_FragColor = vec4(dProd, dProd, dProd, 1.0);
But that just creates a very ugly false light. Any ideas anybody?
Thanks in advance, Wezy
Upvotes: 2
Views: 1226
Reputation: 3456
If you want to use Three.js' lights (and I can't think a reason why not), you need to include the corresponding shader chunks:
Upvotes: 1