Why does this happen? (part of large, flat plane missing from render)

[ATTACH=CONFIG]1415[/ATTACH]
It seems like it renders fine as long as none of the vertices are out of sight.
Also, it renders behind things it should be intersecting, though that only happens if I try to use my poorly coded perspective system rather than simple orthographic.

No-one can say why it happens if you don’t provide any information about what you’re doing.

Post code. The code for rendering a single quad shouldn’t be more than a few dozen lines.

I can’t post all of it, but I can post the tMatrix and pMatrix construction, the projection matrix, and the vertex shader.
I improved the perspective system recently, though I realised one issue I forgot to mention: that the camera appears to orbit a point one unit in front of it when it rotates.


var tMatrix = m4.scaling(object.xScale, object.yScale, object.zScale);
tMatrix = m4.xRotate(tMatrix, object.xRotation);
tMatrix = m4.yRotate(tMatrix, object.yRotation);
tMatrix = m4.zRotate(tMatrix, object.zRotation);
tMatrix = m4.translate(tMatrix, object.xPosition, object.yPosition, object.zPosition);
        
tMatrix = m4.translate(tMatrix, -camera.xPosition, -camera.yPosition, -camera.zPosition);
tMatrix = m4.zRotate(tMatrix, -camera.zRotation);
tMatrix = m4.xRotate(tMatrix, -camera.xRotation);
tMatrix = m4.yRotate(tMatrix, -camera.yRotation);
        
var pMatrix = m4.projection(gl.canvas.width, gl.canvas.height, camera.near, camera.far, camera.scale, camera.perspective);


projection: function (w, h, n, f, s, p) {
    return [
        s/((w+h)/h), 0, 0, 0,
        0, s/((w+h)/w), 0, 0,
        0, 0, 10/(f-n), p,
        0, 0, (f+n)/(n-f), 1
    ];
},


var vertexShaderGeneric3D = `#version 300 es
precision mediump float;

in vec3 vertexPosition;
uniform mat4 tMatrix;
uniform mat4 pMatrix;
out vec3 vPosition;

void main() {
    vPosition = vertexPosition;
    vec4 position = tMatrix * vec4(vertexPosition, 1.0);
    vec4 projectedPosition = pMatrix*position;
    gl_Position = vec4(projectedPosition.xy/projectedPosition.w, projectedPosition.z, 1.0);
}
`;

Also, the quad is constructed with two clockwise triangles, rendered with gl.TRIANGLES, and the way part of it fails to render depends on the angle of approach: two corners cause the missing region to be triangular like earlier pic, two corners cause the missing region to be a slice off the bottom.

Bump
10char

That’s wrong; the last element should be zero, not one.

It makes a huge mess if it’s zero, weird things happen like objects that should have passed out of sight end up moving away from the camera overhead.
I’ve fixed the problem of the camera looking like it’s orbiting by adding a camera translation into the matrix construction, so now the only problem is particular things that render oddly.

In which case you have other problems, which may be partially hidden by the incorrect projection matrix.

mega dot nz/#!l0tmjBTB!r46uFJAhygZlhxmnen58oMw4nSvnyjAM_rwF0Id8yvk
You can see it for yourself to get an idea of the problems.
The projection matrix is in WebGLEngine, vertex shader is in 3DDemo.
The matrix is constructed in drawScene and renderBuffer (WebGLEngine)