Tag Info

Hot answers tagged

9

This seems like a big misunderstanding on your part, and I think the comparison doesn't make much sense because in general they serve different purposes: Vertex shaders are executed once for every vertex in the geometry, and are used to modify or add new information to those vertices. For example, they can be used to slightly modify the position of the ...


7

Yes; the feature that does this is called "stream-out". For D3D10, the documentation can be found here. It captures the geometry shader output to a vertex buffer you specify, which can then be re-used. For OpenGL, the same functionality exists under the name "transform feedback". The relevant OpenGL spec can be found here.


4

I don't believe OpenGL supports geometry shaders which output multiple types of primitives. I'm actually surprised that your second code block compiled... Perhaps it just overwrote the configuration? You will have to create multiple shaders and switch between them, at least for triangles/lines and points. There's actually a trick you can do with a ...


4

The bound textures in a single draw call cannot be changed. This means that your geometry shader cannot select arbitrarily between different textures. The solution is to use either texture atlasing or array textures. In either case, for each cube face you generate both new positions and new texture coordinates. The C++ code must still bind the correct ...


4

You cannot do this with the out-of-the-box functionality provided by your GPU. The GPU only understands triangles. No amount of tweaking API configuration, clever use of degenerate triangles, or geometry shaders will change that fact. If you want to render an collection of outlined quads, as is often done in 3D modeling programs that support quad-based ...


4

The fact that something is rendered when you use your "simple method" and the geometry can be seen in Nsight led me to guess that the triangles were being back-faced culled. This is because the winding order of the vertices you create disagrees with the culling mode you are using (to put it another way, all your triangles are now facing away from the ...


3

You don't need to perform backface culling manually in the geometry shader. (It's possible it could be an optimization to do so, if culling allows you to skip some expensive work in the rest of the geometry shader. But that seems unlikely to be the case.) Triangles can't have incomplete adjacency information. The vertex buffer for GL_TRIANGLE_ADJACENCY ...


3

Probably the simplest way to modify your code to get rotation (roll) is to modify the calculation of upVector. Specifically, upVector should be rotated around the planeNormal axis by the desired roll angle; then the calculation of rightVector and all the vertex positions will incorporate the rotation, too. A convenient formula for this is Rodrigues' ...


3

Surface RT is indeed FEATURE_LEVEL_9_1, so hardware geometry shaders are unsupported. The Windows software rasterizer, WARP, does support it though. This could be what Morten is referring to. To create a WARP device, use D3D_DRIVER_TYPE_WARP in your call to D3D11CreateDevice. Note that on Surface RT, the performance of geometry shaders on WARP will not ...


3

No, there is not. Geometry shaders, like most shader stages, are separate from one another. What you seem to want, since you specified DX11, is tessellation. That allows you to take a "patch" and subdivide it. A "patch" could be a string of points of some arbitrary length, which you would "subdivide" into multiple subdivisions.


3

I've decided to go with a fragment shader approach via discontinuity filtering of the depth buffer. Reasons for this are: World vertex count is very, very high due to immense view distances, even with mesh LoD; I am doing a number of other fragment shader operations, such as DoF blur which can benefit by the same structures (box or gaussian ...


3

Once you call DrawIndexedWithCustomEffect with a non-null geometry shader, that shader is bound to the device and it remains bound until you either bind another one or until you unbind it (by calling GSSetShader with a null pointer). Consequently, if you call DrawIndexedWithCustomEffect and pass it a non-null geometry shader, and then you call your sprite ...


2

Do directx geometry shaders offer anything over the opengl ones? No. What are the oldest cards which support opengl 3.2 and the geometry shaders on there? What are the oldest cards which support opengl 2.0 and the geometry shader plugin? Geometry shaders are geometry shaders, regardless of the API you use to access them. They are supported on ...


2

Modern OpenGL defines only points, lines or triangles; there are no 4-vertex primitive types, so you can't draw a quad without triangles. Using a Geometry Shader won't even allow this as the only valid outputs are points, line-strip or triangle-strip; there's no quad output. You can emulate a quad with a triangle strip (using the 4th vertex to complete the ...


2

It's all just perspective. The hardware only operates on triangles. It renders what you give it to render: If you want to create quads, you simply need to make sure that all four vertices shared by each such pair of triangles, are co-planar. Then any normals-based lighting algorithm running on the hardware is going to render them as a single, ...


2

Your code looks like it wants to output 9 triangles each consisting of a discreet three vertex triangle strip, not 27 triangles. However you have set max_vertices to 3 in the layout statement at the top of the shader so it only emits one triangle before it hits that limit. (The limit is for the whole shader, not per-primitive, otherwise 3 would have been ...


1

The Direct3D 11 Tessellation stage is designed to be a bit generic so that applications can implement different approaches. There have been a number of presentations on this topic over the years at various conferences. I have links to them at this blog post. This topic is covered in a number of Direct3D 11 books. See this blog post for a list of ...


1

You can't do this if you want smooth shading. Calculating per-vertex normals involves calculating per-triangle normals, then averaging those normals (optionally giving each a weight) for each triangle that shares a given vertex. So you need additional information that you just don't have: which triangles share each vertex. As you will see from a diagram ...


1

A guy nicknamed "unbird" at Gamedev.net found the problem. Here's the link to the solution. "There's also a constant buffer for the tex-coords (cbFixed), filled with default values. These only work with the effect framework, so you have to fill it manually and set it to the correct slot, just like the other constant buffers. For this particular case I for ...


1

Your vec4 pos[3] variable in your geometry shader doesn't appear to be getting set, unless you didn't post the code for that. If it's being initialized to zero and never set, that could be why nothing shows up. If you want the geometry shader to get the positions output from the vertex shader, you need to use the built-in variable gl_PositionIn[] for that. ...


1

It isn't possible to create a program with geometry shaders that handle multiple primitive types. That being said, you don't have to do a whole lot of work to support multiple primitive types. Thanks to ARB_separate_shader_objects, you no longer have to link all of your shader stages together. You can have one vertex-only program, one fragment-only program, ...


1

It is possible in some sense. If you use a primitive type with adjacency information (D3D_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ) you can construct quads that fit together nicely, even if they aren't technically in the same strip. I've used this technique with some success myself. Please excuse the awesome ASCII art; '.' are points, and '|' and '\' are edges. In ...



Only top voted, non community-wiki answers of a minimum length are eligible