- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
最佳答案
制作“UV”bmesh
给定上面带有 UV 的网格对象,根据 uv 制作一个 bmesh
uv.x, uv.y, 0
处向新的 bmesh 添加顶点测试脚本,以对象模式运行
import bpy
import bmesh
context = bpy.context
ob = context.object
me = ob.data
bm = bmesh.new()
bm.from_mesh(me)
uvbm = bmesh.new()
uv_layer = bm.loops.layers.uv.verify()
vert_index = uvbm.verts.layers.int.new("index")
face_index = uvbm.faces.layers.int.new("index")
# adjust uv coordinates
for face in bm.faces:
fverts = []
for loop in face.loops:
uv = loop[uv_layer].uv
v = uvbm.verts.new((uv.x, uv.y, 0))
v[vert_index] = loop.vert.index
fverts.append(v)
f = bmesh.ops.contextual_create(uvbm, geom=fverts)["faces"].pop()
f[face_index] = face.index
# remove doubles
bmesh.ops.remove_doubles(uvbm, verts=uvbm.verts, dist=1e-7)
'''
# ignore face indices of original if using any option here
# optionally disolve non boundary edges
bmesh.ops.dissolve_edges(uvbm,
edges=[e for e in uvbm.edges if not e.is_boundary],
)
# optionally remove faces
faces = uvbm.faces[:]
while faces:
uvbm.faces.remove(faces.pop())
'''
#make an object to see it
me = bpy.data.meshes.new("UVEdgeMesh")
uvbm.to_mesh(me)
ob = bpy.data.objects.new("UVEdgeMesh", me)
bpy.context.collection.objects.link(ob)
ob.show_wire = True
# make a LUT based on verts of original
from collections import defaultdict
edge_pairs = defaultdict(list)
boundary_edges = [e for e in uvbm.edges if e.is_boundary]
for e in boundary_edges:
key = tuple(sorted(v[vert_index] for v in e.verts))
edge_pairs[key].append(e)
# print result, add text object to show matching edges
# Make sure to remove code below before running on detailed UV as in question,
# adding that many text objects via operator
# will slow code down considerably.
uvbm.verts.ensure_lookup_table()
for key, edges in edge_pairs.items():
print(key, [e.index for e in edges])
for e in edges:
if not e.is_boundary:
continue
f = e.link_faces[0]
p = (e.verts[0].co + e.verts[1].co) / 2
p += (f.calc_center_median() - p) / 4
bpy.ops.object.text_add(radius=0.04, location=p)
bpy.context.object.data.body = f"{key}"
创建一个bmesh,这里转成mesh
“UV”bmesh 的 xy
坐标是 UV 坐标。唯一的边是 uv 边界边。使用数据转换为像素坐标。
使用此处的方法使用此处的方法将verts与original相关联https://blender.stackexchange.com/a/70729/15543将原始顶点/边缘的索引存储在“UV”bmesh 的数据层中。
上面示例的输出。第一行,由原始网格的顶点 0 和 1 构成的两条边是“UV”bmesh 中的边 0 和 14。
(0, 1) [0, 14]
(0, 2) [1, 17]
(2, 3) [2, 4]
(1, 3) [3, 22]
(2, 6) [5, 16]
(6, 7) [6, 8]
(3, 7) [7, 23]
(4, 6) [9, 19]
(4, 5) [10, 12]
(5, 7) [11, 20]
(0, 4) [13, 18]
(1, 5) [15, 21]
编辑:为了进一步可视化这一点,从每个边向每个面添加一个文本对象。例如,查看由顶点 (i, j) 构成的边在两个面上的匹配位置。每个文本对象都位于从边缘中心到面中心的四分之一处。
请记住,uvbmesh 在 UV 坐标中映射到 U 和 V 中的实数范围 [0, 1]。像素坐标只是将其映射到基于图像维度的离散整数范围。
关于python - 如何在 UV 贴图边缘获取数据并进行编辑?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60713817/
每当我尝试使用 AndroidStudio 生成一个新的 Android 项目时,它总是隐藏文件夹“drawables”。这以前从未发生在我身上。我环顾四周,发现它生成了这个名为“mipmap”的文件
因此,我试图使 native map 在EXPO应用程序中工作,文档页面显示“在EXPO应用程序中无需使用设置” https://docs.expo.io/versions/latest/sdk/ma
摘要 我正在尝试将位移贴图(高度贴图)应用于一个相当简单的对象(六角形平面),并且得到了一些意想不到的结果。我使用的是灰度,因此,我的印象是我的高度图应该只影响网格的 Z 值。然而,我创建的置换贴图在
我目前正在对three.js 进行一些试验,我想使用自发光贴图。我曾尝试将纹理加载到 phong Material 的自发光属性中,但不幸的是,它并没有像那样工作。这是我的代码: var params
我是地理编码方面的新手,所以我希望你能给我一些提示,告诉我如何获得以下内容: 我想用 D3 或传单制作一张 map ,上面有一些标记。如果单击标记,信息应弹出/显示在 map 旁边。有点像这个例子:h
我正在使用jvector maps客户网站上的 map ,他们知道希望我将其转换为 Concrete5,以便他们可以自行编辑。一切都很顺利,直到我尝试重新创建我使用 jVector map 的页面。当
这会导致疯狂的编译时间:~20 秒。请注意,它创建了 global-s9e3ed7fd2e.png 图像 5 次,而不是移动设备一次和桌面一次。 我只看到 @import "sprites/globa
我想创建一个 STL map 来查找一个项目是否足够接近 3 维空间中的另一个项目。到目前为止,我的“less-than-functor”工作得很好,粘贴到以下链接。 现在这个问题不完全是“最近邻”问
在初始化 map 时直接给出标记和多边形似乎可以工作,但是在调用 setState 方法时不会添加多边形和标记。 我不知道我似乎错过了什么, 以下是我迄今为止尝试过的。 有人可以帮助解决我所缺少的 m
我想弄清楚如何在盒子的正面和背面使用两种不同的纹理。每当我缩放我的盒子 (ExtrudeGeometry) 时,UV 贴图似乎都没有更新。因此,我为盒子的正面和背面定义了自己的 UV 贴图。 要定义我
我正在尝试正确映射 UV 纹理,但失败了... 我的应用程序中有下一个结果: 结果不是我在等待。我想要下一个描述的 View : 源代码在这里: http://pastebin.com/aDg981B
我正在尝试创建一个 Material 对话框以使用 AGM( Angular 谷歌地图)捕获用户位置。我的主页上有一个工作示例,但是当对话框打开时,它只会在 map 应该显示的位置显示一个空白区域。当
尝试将 UV 坐标映射到球体时遇到以下问题 这是我用来获取 UV 坐标的代码 glm::vec2 calcUV( glm::vec3 p) { p = glm::normalize(p);
我需要找到一种方法来解决在不使用设计工具的情况下为非凸多面体生成纹理贴图的问题。具体来说,我将模拟结果数据映射到 3D 表面上。也就是说,在代码中(最好是 C# 或 VB,因为我的目标是 WPF 3D
尝试添加 infoWindows 时,我收到 Unable to get gMarker frommarkerScope! (在 Angular map 中: https://github.com/a
这是一个非常简单的 Three.JS 草图,生成以下渲染: 正如您可能看到的,这个 THREE.BufferGeometry 是一个 8x8 矩阵,通过以这种方式设置 UV: for(var i =
我在使用 UV 贴图渲染 3D 对象时遇到问题。 首先,我的对象在 Wavefront 模型中。我使用一个解析器将整个文件拆分为顶点、法线、面和纹理坐标。解析 file.obj 后,我拥有了所有这些。
在 RStudio 中使用传单会在查看器中生成空白 map 。只能看到标记。在控制台中看不到任何警告或错误消息。当我使用 shiny 时,它在 RStudio 查看器中是一样的,但可以通过在 shin
在互联网上多次搜索后我找不到答案.. 情况如何?我是(比利时)大学计算机科学专业的学生,我必须使用图形库 LibGdx 用 Java 制作塔防。 问题是什么?在LibGdx中,有一个名为“Ti
如何将多个参数传递给通过 pool.map 调用的函数? 我的代码: import gevent from gevent.pool import Pool def process(param1, pa
我是一名优秀的程序员,十分优秀!