tparisi/WebGLBook

earth-shader.js - Does not render ShaderMaterial()

Opened this issue · 1 comments

After updating my Sim.js with the objectIntersects() method call, I was able to get earth-lit.js to work, however, the next example, earth-shader.js, does not render properly. Using the custom ShaderMaterial(), it only renders the clouds. When I switch that chunk of code for a MeshPhongMaterial() as coded in earth-lit.js, I'm able to render the earth surface, of course without specularity and bump map. Something is wrong with the ShaderMaterial() setup.
earth-shader js_clouds

The book's code works if you use the older Three.js in the libs folder.
Starting from r50 upwards, it's much simpler, just set the maps as properties of MeshPhongMaterial, like this:
var material = new THREE.MeshPhongMaterial({
map: earthSurfaceMap,
normalMap: earthNormalMap,
specularMap: earthSpecularMap});
that's it, no need of uniforms or computeTangents().