简体   繁体   English

使用Directx11在基于Heightmap的地形上的孔

[英]Holes on Heightmap based terrain using Directx11

I'm currently working on a cylinder shaped terrain produced by a height map. 我目前正在研究由高度图生成的圆柱状地形。 What happens in the program is simple, there is a texture for the colors of the terrain that has the alpha value of regions in with i want it to be invisible and another texture ARGB with the A being the gray scale for the heights and RGB is the normal for the light. 程序中发生的事情很简单,有一个地形颜色的纹理,具有我希望它不可见的区域的alpha值,另一个纹理ARGB,其中A是高度的灰度,而RGB是正常的光。 The texture is such that the A value goes from 1 to 255 and I'm reserving the 0 for the regions with holes, meaning i don't want then to exist. 纹理是这样的,A值从1到255,并且我为带有孔的区域保留0,这意味着我不想再存在。 So in theory no problem, I'm making those regions invisible based on the first texture but on practice what's happening is that the program is considering the 0 as the minimum height and, even with the texture on top, is creating some lines towards this regions of 0, like trying to make its triangle but not getting there because i cut the next vertex by making it invisible. 因此,从理论上讲,没问题,我会根据第一个纹理使这些区域不可见,但根据实际情况,程序会将0视为最小高度,即使顶部有纹理,也为此创建了一些线条0的区域,就像试图使其三角形而不到那里,因为我通过使其不可见来切割了下一个顶点。 请注意直线到达圆柱体的中心这是我停止使那些顶点不可见时的结果

Notice the lines going to the center of the cylinder This is how it gets when i stop making those vertex invisible 请注意到达圆柱中心的线,这是我停止使那些顶点不可见时的方式

So, just to say, i used the function Clip() on the pixel shader to make it invisible. 因此,可以这么说,我在像素着色器上使用了功能Clip()使其不可见。

Basically what i need of help: Is it possible, the same way i use clip() on the pixel shader i do something like that on the vertex shader and get rid of the unwanted vertex? 基本上,我需要帮助:是否可以用与在像素着色器上使用clip()相同的方式在顶点着色器上执行类似的操作,并消除不需要的顶点? Basically, is possible to just say to ignore value 0? 基本上可以说忽略值0吗? Any ideas to fix this? 有任何解决办法吗? i thinking of making all the vertex that are 0 become the value of his neighbor, that way those lines wouldn't go to the center but to the same plane as the cylinder itself. 我想使所有为0的顶点成为其邻居的值,这样这些线将不会到达中心,而是到达圆柱体本身所在的平面。 Another thing is that we can see that the program is interpolating the values from one vertex to the next, that is why i cuts on halfway through to the invisible vertex 另一件事是,我们可以看到程序正在将值从一个顶点插入到下一个顶点,这就是为什么我在中间切入不可见顶点的原因

I'm working with Directx11 API with C++ and the program uses Tessellation. 我正在使用带有C ++的Directx11 API,并且该程序使用了Tessellation。

Thank you for your time and will be very glad with any input on this! 感谢您的宝贵时间,我们将为此感到非常高兴!

Well i did resolve a bit of this issue. 好吧,我确实解决了这个问题。 I made the texture with the height values pass through a modifier that created another texture with the zero values substituted by the side pixel with value different then zero or change for 128.0f. 我使具有高度值的纹理通过了一个修改器,该修改器创建了另一个纹理,该纹理的零值被侧面像素替换,其值不同,然后为零或更改为128.0f。 with that it made the weird lines direction be more accurate not going to the center of the cylinder but along the line. 这样一来,怪异的线条方向就更准确了,而不是到达圆柱体的中心,而是沿着直线。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM