c# - 如何导出从 Grasshopper 烘焙的顶点颜色,Rhino3d 在 Unity、Unreal 等游戏引擎中或直接在 webXr 中实时分析?

标签 c# unity3d grasshopper rhino3d

我对这个社区还很陌生。

我想知道如何从 Grasshopper/Rhino 3D 导出​​ Karamba 的 Vertex 颜色、Ladybug 的分析(颜色映射)以创建 AR 应用程序(使用 unity、unreal 或其他)?

我正在尝试可视化分析,我在 Rhino 中从其他 Grasshopper 插件(如瓢虫、karamba、蜜蜂、蝴蝶)中以统一或虚幻的方式烘焙。而且,我想更深入地了解纹理、 Material 和着色器在 GPU 中的 Rhino 和 Unity 中是如何工作的。

最佳答案

Rhino6 支持导出顶点颜色, 您还可以使用 Antonello di Nunzio 的 Ladybug Texture Mixer 来完成这项工作,将颜色顶点替换为纹理和 Material 。

def makeTexture(size, colorTree):
    sb = size * 2 - 1
    bm = System.Drawing.Bitmap(size * 2, size * 2)
    bmb = System.Drawing.Bitmap(size * 4, size * 4)

    count = -1
    for x in xrange(size):
        for y in xrange(size):
            count += 1
            if count < len(colorTree):
                bm.SetPixel((x * 2) + 0, sb - ((y * 2) + 0), colorTree[count][0])
                bm.SetPixel((x * 2) + 1, sb - ((y * 2) + 0), colorTree[count][1])
               bm.SetPixel((x * 2) + 1, sb - ((y * 2) + 1), colorTree[count][2])
                bm.SetPixel((x * 2) + 0, sb - ((y * 2) + 1), colorTree[count][3])

    g = System.Drawing.Graphics.FromImage(bmb)
    g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor
   g.DrawImage(bm, 0, 0, size * 4 + 1, size * 4 + 1)

    return bmb

关于c# - 如何导出从 Grasshopper 烘焙的顶点颜色,Rhino3d 在 Unity、Unreal 等游戏引擎中或直接在 webXr 中实时分析?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50902434/

相关文章:

c# - 禁用 WPF 窗口焦点

c# - 循环遍历字符串数组以创建这些字符串的类变量

unity3d - unity - 检测已经接触的游戏对象

python - 当元素与前一个元素不同时,按整数切片列表

c# - .NET MVC 使用模型属性更新 View

c# - 什么时候应该使用 ThreadLocal 而不是 Thread.SetData/Thread.GetData?

c# - 从分隔的数据库字符串字段中选择多选列表框中的项目

c# - 从 C# 到 Php 的脚本推送不适用于应用程序

python - 按弦高划分曲线

C#:组件的输出参数索引 [i] 过高或过低