question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to use polygonOffset solving Z-fighting poblems

See original GitHub issue

I see that THREE.scene.overrideMaterial defines the polygonOffset parameters and THREE.WebGLRenderer calls glPolygonOffset(). but there are some errors when running
console.error( _gl.getShaderInfoLog( shader ) );

I use FireFox 16.0 and My code likes this:

            var material1 = new THREE.Material();
        material1.polygonOffset = true;
        material1.depthTest = true;
        material1.polygonOffsetFactor = 1;
        material1.polygonOffsetUnits = 0.1;
        _scene.overrideMaterial= material1;

How to use polygonOffset correctly.

Thanks,

http://en.wikipedia.org/wiki/Z-fighting

Issue Analytics

  • State:closed
  • Created 11 years ago
  • Reactions:3
  • Comments:24 (18 by maintainers)

github_iconTop GitHub Comments

github_iconTop Results From Across the Web

Z fighting & polygon offset - threejs - Google Sites
OpenGL (and WebGL) has a simple solution for Z-fighting problems: polygon offset. It provides a facility to adjust the depth values of polygon...
Read more >
How to solve Z-fighting - Graphics and GPU Programming
You need to offset exactly one of the two polygons, or they'll end up still having the same Z value. Cancel Save ...
Read more >
three.js: What is more efficient to layer and resolve z-fighting
I have found two solutions that work for me. First: polygonOffset: true, polygonOffsetUnits: 1, polygonOffsetFactor: -rectCount. where rectCount ...
Read more >
Avoiding z-fighting with coincident surfaces
One possible solution is to not use the Z-buffer at all. Rather you can use the Painter's Algorithm. Granted, this comes with all...
Read more >
Sylvain Lesage on Twitter: "I just discovered "polygon offset ...
I just discovered "polygon offset" which solves Z-fighting. It's ~ like the z-index in CSS. Until now, I was manually moving the meshes, ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found