I have a texture that is not showing up on Android. Also, on iPhone 6 and lower iPhones. It shows up fine on iPhone 7+. Though I’m not too concerned about the lower level iPhones, I am worried about the Adroid devices.
Here’s my shader code. It works fine in most places:
const textMat = new THREE.MeshStandardMaterial({
side: THREE.FrontSide,
color: 0xffffff,
wireframe: false,
});
textMat.onBeforeCompile = ( shader ) => {
shader.uniforms.time = hexUniforms.time;
shader.uniforms.globalBloom = hexUniforms.globalBloom;
shader.uniforms.instanceMatrices = textMat.userData.instanceMatrices;
shader.vertexShader = `
uniform mat4[ ${ textMatrix.length } ] instanceMatrices;
attribute float meshIdx;
attribute vec3 instColor;
attribute vec2 colorPhase;
varying vec3 vPos;
varying vec3 vInstColor;
varying vec2 vColorPhase;
${shader.vertexShader}
`.replace(
`#include <uv_vertex>`,
#include <uv_vertex>
#include <fog_vertex>`,
`mat4 instanceMatrix = instanceMatrices[ int( floor( meshIdx + 1.0 ))];
`vPos = vec3( transformed );
vInstColor = vec3( instColor2 );
vColorPhase = colorPhase;
`
).replace(
`#include <default normal_vertex>`,
`vec3 transformedNormal = objectNormal;
mat3 textMat = mat3( instanceMatrix );
transformedNormal = textMat* transformedNormal;
transformedNormal = normalMatrix * transformedNormal;
`);
shader.fragmentShader = `
uniform float time;
uniform float globalBloom;
varying vec3 vPos;
varying vec3 vInstColor;
varying vec2 vColorPhase;
${ shader.fragmentShader }`
.replace(
`#include <dithering_fragment>`,
`#include <dithering_fragment>
gl_FragColor = globalBloom > 3.5 ? vec4( 0, 0, 0, 1 ) : gl_FragColor;
float t = sin( time * PI * vColorPhase.y + vColorPhase.x ) * 0.01 + 0.01;
vec3 c = mix( gl_FragColor.rgb, vInstColor, t );
float a = smoothstep( 0.01, 0.01 + ( 0.6 - t ) * .05, abs( vPos.z ));
gl_FragColor.rgb = mix( c, gl_FragColor.rgb, a );
`);
}