Geometry-Shader Object

转载 2015年11月18日 20:37:39

Geometry-Shader Object

A geometry-shader object processes entire primitives. Use the following syntax to declare a geometry-shader object.

[maxvertexcount(NumVerts)]void ShaderName (  PrimitiveType DataType Name [ NumElements ],  inout StreamOutputObject  );

 

Parameters

[maxvertexcount(NumVerts)]

[in] Declaration for the maximum number of vertices to create.

  • [maxvertexcount()] - required keyword; brackets and parenthesis are required characters for correct syntax.
  • NumVerts - An integer number representing the number of vertices.
ShaderName

[in] An ASCII string that contains a unique name for the geometry-shader function.

PrimitiveType DataType Name [ NumElements ]

PrimitiveType - Primitive type, which determines the order of the primitive data.

Primitive Type Description
point Point list
line Line list or line strip
triangle Triangle list or triangle strip
lineadj Line list with adjacency or line strip with adjacency
triangleadj Triangle list with adjacency or triangle strip with adjacency

 

DataType - [in] An input data type; can be any HLSL data type.

Name - Argument name; this is an ASCII string.

NumElements - Array size of the input, which depends on the PrimitiveType as shown in the following table.

Primitive Type NumElements
point

[1]

You operate on only one point at a time.

line

[2]

A line requires two vertices.

triangle

[3]

A triangle requires three vertices.

lineadj

[4]

A lineadj has two ends; therefore, it requires four vertices.

triangleadj

[6]

A triangleadj borders three more triangles; therefore, it requires six vertices.

 

StreamOutputObject

The declaration of the stream-output object.

Return Value

None

Remarks

The following diagram shows the various primitive types for a geometry shader object.

Illustration of the various primitive types for a geometry shader object

The following diagram shows geometry shader invocations.

Illustration of geometry shader invocations

Examples

This example is from exercise 1 from the Direct3D 10 Shader Model 4.0 Workshop.

[maxvertexcount(3)]
void GSScene( triangleadj GSSceneIn input[6], inout TriangleStream<PSSceneIn> OutputStream )
{	
    PSSceneIn output = (PSSceneIn)0;

    for( uint i=0; i<6; i+=2 )
    {
        output.Pos = input[i].Pos;
        output.Norm = input[i].Norm;
        output.Tex = input[i].Tex;
		
        OutputStream.Append( output );
    }
	
    OutputStream.RestartStrip();
}


Minimum Shader Model

This object is supported in the following shader models.

Shader Model Supported
Shader Model 4 and higher shader models yes

基于几何着色器的模型“爆炸”效果(Geometry Shader)【OpenGL】【GLSL】

先贴个效果图先挖个坑,以后再详细填

Unity5 Compute && Geometry Shader

Compute ShaderCompute Shader技术是微软DirectX 11 API新加入的特性,在Compute Shader的帮助下,我们可以直接利用GPU的并行运算能力进行大量数据的运...
  • winchyy
  • winchyy
  • 2016年11月04日 15:29
  • 753

OpenGL学习脚印:几何着色器(geometry shader)

写在前面 一直以来我们使用了顶点着色器(vertex shader)和片元着色器(fragment shader),实际上OpenGL还提供了一个可选的几何着色器(geometry shad...

OpenGL 几何着色器 Geometry Shader 初探

在顶点和片段着色器之间有一个可选的着色器,叫做几何着色器(Geometry Shader)。几何着色器以一个或多个表示为一个单独基本图形(primitive)的顶点作为输入,比如可以是一个点或者三角形...
  • yulinxx
  • yulinxx
  • 2016年12月26日 00:35
  • 625

Geometry Shader

Geometry Shader(几何元着色器)是继Vertex Shader和Fragment Shader之后,由Shader Model 4(第四代显卡着色架构)正式引入的第三个着色器。在Open...

Geometry Shader Concepts & Examples

From http://www.cnblogs.com/Jedimaster/archive/2007/06/26/796107.html 前言:Shader Model 4给我们带...

Geometry Shader 几何着色渲染

前言:Shader Model 4给我们带来了Geometry Shader这个玩意儿。其实这个东西早就在一些3D动画制作软件中存在了,比如Maya 8。我参考了以前DX10的哪一篇Preview与C...

【OpenGL4.0】GLSL-几何着色器详解和实例(GS:Geometry Shader)

一、什么是几何着色器(GS:Geometry Shader) Input Assembler(IA)从顶点缓冲区上的输入流中接收顶点数据,并且把数据项转换为规范的格式。vertex shad...

Geometry Shader 概念和实例

前言:Shader Model 4给我们带来了Geometry Shader这个玩意儿。其实这个东西早就在一些3D动画制作软件中存在了,比如Maya 8。我参考了以前DX10的哪一篇Preview与C...

OpenGL学习:几何着色器(geometry shader)

除了顶点着色器(vertex shader)和片元着色器(fragment shader),实际上OpenGL还提供了一个可选的几何着色器(geometry shader)。几何着色器位于顶点和片元着...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:Geometry-Shader Object
举报原因:
原因补充:

(最多只允许输入30个字)