Skip to content

Z-fighting in LineRenderer #419

@vorg

Description

@vorg

Because our helpers now use one geometry there is a lot of z-fighting between e.g. bounding box of a floor and grid or axes and grid helpers.

Image

One solution would be to offset axes or grid on Y axis or use polygon offset but they would need to be seperate draw calls

//polygon offset example
const gl = ctx.gl
gl.enable(gl.POLYGON_OFFSET_FILL);
gl.polygonOffset(-i * 10, 1);
ctx.submit({
  name: "drawLineGeometryCmd",
  pipeline,
  attributes,
  count: (instanceRoundRound.length + resolution * 18) / 3,
  instances: entity.geometry.positions[0].length
    ? entity.geometry.positions.length / 2
    : entity.geometry.positions.length / 6,
  uniforms,
});
gl.disable(gl.POLYGON_OFFSET_FILL);

I would love to disable depthWrite in all line materials for helper as that produces cleanest renders but then our skybox is erasing lines

Image

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions