1. A concise explanation of the problem you’re experiencing.
I was trying to modify the model shader in the example: http://localhost:8080/Apps/Sandcastle/index.html?src=3D%20Models.html&label=Showcases. I change the code in Model.js like this:
var tmpVS = ‘precision highp float; \n’ +
‘attribute vec3 a_position; \n’ +
‘attribute vec3 a_normal; \n’ +
‘varying vec3 v_normal; \n’ +
‘uniform mat3 u_normalMatrix; \n’ +
‘uniform mat4 u_modelViewMatrix; \n’ +
‘uniform mat4 u_projectionMatrix; \n’ +
‘attribute vec2 a_texcoord0; \n’ +
‘varying vec2 v_texcoord0; \n’ +
‘varying vec4 v_color; \n’ +
‘void main() { \n’ +
‘vec4 pos = u_modelViewMatrix * vec4(a_position,1.0); \n’ +
‘v_normal = u_normalMatrix * a_normal; \n’ +
‘v_texcoord0 = a_texcoord0; \n’ +
‘v_color = pos; \n’ +
‘pos.z = sin(5.0*pos.x)*0.25; \n’ +
‘gl_Position = u_projectionMatrix * pos; \n’ +
‘}’;
var tmpFS = ‘precision highp float; \n’ +
‘varying vec4 v_color; \n’ +
‘void main() { \n’ +
‘gl_FragColor = v_color; \n’ +
‘}’;
}
model._rendererResources.programs[id] = ShaderProgram.fromCache({
context : context,
vertexShaderSource : tmpVS,
fragmentShaderSource : tmpFS,
attributeLocations : attributeLocations
});
But the model “Cesium_Air” was invisible if I ran the code. I don’t know what’s the mistake in the code?
4. The Cesium version you’re using, your operating system and browser.
Cesium 1.41