Ugly render on clouds

徘徊边缘 提交于 2019-12-01 10:40:18

Use logarithmic depth buffer instead of the linear one. This is a very simple change, just enable logarithmicDepthBuffer when you create your THREE.WebGLRenderer like so:

var renderer = new THREE.WebGLRenderer({ antialias: true, logarithmicDepthBuffer: true});

Here's an example you can have a look at: http://threejs.org/examples/#webgl_camera_logarithmicdepthbuffer

Using polygonOffset as suggested by LJ_1102 is a possibility, but it shouldn't be necessary.

What you're experiencing is z-fighting due to insufficient depth buffer resolution.

You basically have three options to counteract this:

  1. Write / use a multi-texture shader that renders all three textures on one sphere.

  2. Increase the distance between the sphere faces. / Decrease the distance between your near and far clipping planes.

  3. Use polygonOffset and the POLYGON_OFFSET_FILL renderstate to offset depth values written by your outer sphere. Read more about polygonOffset here.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!