Line renderer it’s overlapping with itself [URP][Unity 2020.3.24f1]

huangapple go评论60阅读模式
英文:

Line renderer it's overlapping with itself [URP][Unity 2020.3.24f1]

问题

我的目标是将贝塞尔曲线和LineRenderer曲线结合起来,以展示气流。出现的问题是:LineRenderer在自身重叠,但不在其他部分重叠。我已尝试修改LineRenderer材质的ShaderGraph。我还查看了LineRenderer提供的选项,但未获得期望的结果。

LineRenderer如下所示:
Line renderer it’s overlapping with itself [URP][Unity 2020.3.24f1]

使用的ShaderGraph如下:
Line renderer it’s overlapping with itself [URP][Unity 2020.3.24f1]

我不知道问题是在ShaderGraph、LineRenderer还是URP设置中。有什么线索可以解决这个问题吗?

URP版本:10.7.0
Unity版本:2020.3.24f1

英文:

My goal is to combine Bezier and LineRenderer curves to illustrate air flows. The problem that has come up is the following: The LineRenderer overlaps on itself, but not on the rest of LineRenderer. I have tried to modify the ShaderGraph of the material that the LineRenderer has. I have also consulted the options offered by LineRenderer but have not achieved the desired result.

The LineRenderer looks like this:
Line renderer it’s overlapping with itself [URP][Unity 2020.3.24f1]

The ShaderGraph used is as follows:
Line renderer it’s overlapping with itself [URP][Unity 2020.3.24f1]

I don't know if the problem is in the ShaderGraph, in the LineRenderer or in the URP settings. Any clue that could solve the problem?

URP Version: 10.7.0
Unity Version: 2020.3.24f1

答案1

得分: 0

根据您的截图,您遇到了材质透明的问题。LineRenderer 创建一个单独的网格。在渲染透明对象时,通常不会写入深度缓冲区。因此,在渲染组成LineRenderer的三角形时(这不一定是从前到后发生的),从您的角度看,背面的三角形可能会绘制在之前已经渲染过的三角形之上。

在您的情况下,鉴于箭头本身是不透明的,您可能只需使用带有Alpha切割的不透明材质。这应该可以正常渲染。

英文:

Judging from your screenshot, you're running into issues with your material being transparent. The Linerenderer creates a single mesh. When rendering transparent objects, depth is usually not written to the depth buffer. So when rendering the triangles making up your Linerenderer (which doesn't necessarily happen back to front), your triangles at the back from your point of view may be drawn over the triangles which have already been rendered before.

In your case, given that the arrow itself is opaque, you might simply want to use an opaque material with an alpha cutout. This should render fine.

huangapple
  • 本文由 发表于 2023年3月7日 20:55:17
  • 转载请务必保留本文链接:https://go.coder-hub.com/75662246.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定