OpenGL图形管线中的NURBS [英] NURBS in the OpenGL Graphics Pipeline

查看:128
本文介绍了OpenGL图形管线中的NURBS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很好奇NURBS是如何在GPU的/OpenGL图形管道中渲染的.我知道OpenGL和GLUT中有各种各样的调用,可以使用glMap和glMapGrid从编码的角度轻松呈现NURBS对象,但是我不明白的是OpenGL经过的过程. NURBS背后的想法是使用曲线定义曲面,而图形管线似乎围绕三角形栅格化和三角形网格构建,而NURBS则基于弯曲的贝塞尔曲线.

I'm curious about how NURBS are rendered in GPU's / the OpenGL graphics pipeline. I understand there are various calls within OpenGL and GLUT for easily rendering NURBS objects from a coding perspective using glMap and glMapGrid, but what I don't get is the process OpenGL goes through to do this. The idea behind NURBS is using curves to define surfaces, whereas the graphics pipeline appears to be build around triangle rasterization and triangle meshes, whereas NURBS are based around Bezier Curves, which are curved.

那么从(高级)管道的角度来看,NURBS是如何实际呈现的?

So how are NURBS actually rendered, from a (high-level) pipeline perspective?

推荐答案

简单的答案是,它们不是在OpenGL管道中处理的,而是必须转换为GL管道的内容可以处理.通用的方法可能是先将实时性更高的原语(例如bezier补丁)转换为原语,然后在运行时将其细分为三角形.

The simple answer, is that they are not dealt with in the OpenGL pipeline, but must be converted to something that the GL pipeline can process. The general approach would probably be to first convert to a primitive a little more real-time friendly, such as bezier patches, and then tesselate these at runtime into triangles.

镶嵌法可以是规则的,可以将网格映射到面片上,也可以基于曲率,在方差较大的地方将面片细分得更多.无论哪种方式,都只能在某些顶点上真正评估表面,然后将其渲染为平面多边形(尽管可以使用着色器来创建适当平滑变化的法线,等等).

Tessellation could be regular, mapping a grid onto the patch, or could be based on curvature, subdividing the patch more where there is higher variance. Either way the surface is only truly evaluated at some vertices, and rendered as flat polygons (though shaders can be used to create appropriately smoothly varying normals, etc.)

glMap() et-al(以前用于帮助渲染bezier补丁等),并且在现代OpenGL API中不再存在.如今,您将使用着色器来处理镶嵌.

glMap() et-al (which were previously used to help render bezier patches, etc.) are deprecated and no longer present in the modern OpenGL API. Nowadays you would use shaders to deal with tessellation.

这篇关于OpenGL图形管线中的NURBS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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