You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Trade::MeshData WorldPrimitiveGenerator::debugLine(Magnum::Math::Vector3<float> a, Magnum::Math::Vector3<float> b) {
constexpr Trade::MeshAttributeData AttributeData3DWireframe[]{
Trade::MeshAttributeData{Trade::MeshAttribute::Position, VertexFormat::Vector3,
0, 0, sizeof(Vector3)}
};
constexpr UnsignedInt points = 11;
Containers::Array<char> vertexData{points*sizeof(Vector3)};
auto positions = Containers::arrayCast<Vector3>(vertexData);
Vector3 delta = b-a;
delta /= float(points)-1;
Vector3 pos = a;
for (int i = 0; i < points; ++i) {
positions[i] = pos+delta*i;
}
return MeshTools::copy(Trade::MeshData{MeshPrimitive::LineStrip, Utility::move(vertexData),
Trade::meshAttributeDataNonOwningArray(AttributeData3DWireframe), UnsignedInt(positions.size())});
}
In terms of scale: The lines themselves are 2 units long (-1.0 to 1.0 on their respective axes). They are parented to an Object3D that has a scale factor of 100 in all dimensions. That Object3D is parented to another object that has a scale factor of 0.05. The overall hierarchy is:
The camera projection matrix is defined by .setProjectionMatrix(Matrix4::perspectiveProjection(35.0_degf, 1.0f, 0.1f, 1000.0f))
I tried increasing my near plane from 0.1f to 1.0f since I read this helps with z-buffer artifacts, and it doesn't eliminate the issue, just changes it:
Is there something I'm doing wrong with using the shader? I've tried changing the number of points / line (ideally I'd just use 2, but I tried varying it in case it made a difference. Here I'm using 11 points.)
The text was updated successfully, but these errors were encountered:
Hello -- I already replied on Gitter, but replying here as well to not make it look like I'm ignoring this.
Artifacts with the near clip plane are a problem I'm aware of and on my list of things to fix. Enabling GL::Renderer::Feature::DepthClamp should help with that, at least in most cases. I looked around and discovered that it's now also available on WebGL, so with bb4064b you should be able to use it there as well.
I'll comment here once I get back to investigating this.
I toyed around with the LineGL3D shader to render a simple debug grid:
The trouble is, when I zoom in close to the grid, the window gets filled with some artifacts:
I am just using the default LineGL3D shader with no special config.
Below is the code that generates the line objects and attaches the drawables:
And the drawable itself:
Generator for the debug line mesh:
In terms of scale: The lines themselves are 2 units long (-1.0 to 1.0 on their respective axes). They are parented to an Object3D that has a scale factor of 100 in all dimensions. That Object3D is parented to another object that has a scale factor of 0.05. The overall hierarchy is:
[scene manipulator] <- [world object (0.05x)] <- [debug lines object (100x)] <- [the lines]
The camera projection matrix is defined by
.setProjectionMatrix(Matrix4::perspectiveProjection(35.0_degf, 1.0f, 0.1f, 1000.0f))
I tried increasing my near plane from 0.1f to 1.0f since I read this helps with z-buffer artifacts, and it doesn't eliminate the issue, just changes it:
Is there something I'm doing wrong with using the shader? I've tried changing the number of points / line (ideally I'd just use 2, but I tried varying it in case it made a difference. Here I'm using 11 points.)
The text was updated successfully, but these errors were encountered: