SceneKit-删除边缘边框中的拼接线 [英] SceneKit - Remove stitching line in edges borders

查看:236
本文介绍了SceneKit-删除边缘边框中的拼接线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在多维数据集上显示纹理(请参见

有什么主意我可以摆脱它吗?输入纹理看起来像

因此,输入中存在一些不连续性.我使用的是自定义SceneKit几何图形,它仅能将此纹理映射到多维数据集.您可以找到上面提到的相关代码:

使边缘消失(假设照相机在内部).结果是裁剪了一些纹理,但这不太明显.

我以前将3 x 8顶点的位置定义为:

  let _positions = [SCNVector3(x:-halfSide,y:-halfSide,z:halfSide),SCNVector3(x:halfSide,y:-halfSide,z:halfSide),SCNVector3(x:-halfSide,y:-halfSide,z:-halfSide),SCNVector3(x:halfSide,y:-halfSide,z:-halfSide),SCNVector3(x:-halfSide,y:halfSide,z:halfSide),SCNVector3(x:halfSide,y:halfSide,z:halfSide),SCNVector3(x:-halfSide,y:halfSide,z:-halfSide),SCNVector3(x:halfSide,y:halfSide,z:-halfSide),]让位置= _位置+ _位置+ _位置 

现在我将最后一行替换为:

 让X = 0令Y = 8设Z = 16func killEdgeStitching(位置:[SCNVector3],轴:Int)->[SCNVector3] {var res = [SCNVector3]()令delta = Float(0.99)对于排名为pos的广告var newPosition = SCNVector3(x:pos.x,y:pos.y,z:pos.z)开关轴{案例X:newPosition.x * =增量案例Y:newPosition.y * =增量默认:newPosition.z * =增量}res.append(newPosition)}返回资源}让位置= killEdgeStitching(位置:_positions,轴:X)+killEdgeStitching(位置:_位置,轴:Y)+killEdgeStitching(位置:_位置,轴:Z) 

我会把它留在那儿,但希望有人能有一个真实的答案!

I'm displaying a texture on a cube (see SceneKit - Map cube texture to box) Things work well now, but the result show a light stitching line between some of the cube faces that I outlined here (you are inside the cube):

Any idea how I can get rid of that? The input texture looks like

So there is some discontinuity in the input. I'm using a custom SceneKit geometry that doesn't do much more than mapping this texture to a cube. You can find the relevant code in question mentioned above:

So that the edges disappear (assuming the camera is inside). The texture is cropped a bit as a result, but this is much less noticeable.

I used to define the position of the 3 x 8 vertices as:

let _positions = [
  SCNVector3(x:-halfSide, y:-halfSide, z:  halfSide),
  SCNVector3(x: halfSide, y:-halfSide, z:  halfSide),
  SCNVector3(x:-halfSide, y:-halfSide, z: -halfSide),
  SCNVector3(x: halfSide, y:-halfSide, z: -halfSide),
  SCNVector3(x:-halfSide, y: halfSide, z:  halfSide),
  SCNVector3(x: halfSide, y: halfSide, z:  halfSide),
  SCNVector3(x:-halfSide, y: halfSide, z: -halfSide),
  SCNVector3(x: halfSide, y: halfSide, z: -halfSide),
]
let positions = _positions + _positions + _positions

and now I'm replacing the last line by:

let X = 0
let Y = 8
let Z = 16
func killEdgeStitching(positions: [SCNVector3], axis: Int) -> [SCNVector3] {
  var res = [SCNVector3]()
  let delta = Float(0.99)
  for pos in positions {
      var newPosition = SCNVector3(x: pos.x, y: pos.y, z: pos.z)
      switch axis {
      case X:
          newPosition.x *= delta
      case Y:
          newPosition.y *= delta
      default:
          newPosition.z *= delta
      }
      res.append(newPosition)
  }
  return res
}
let positions = killEdgeStitching(positions: _positions, axis: X) +
  killEdgeStitching(positions: _positions, axis: Y) +
  killEdgeStitching(positions: _positions, axis: Z)

I'll leave that out there, but hopefully someone will have a real answer!

这篇关于SceneKit-删除边缘边框中的拼接线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆