14

Actually no, the 'job' of the geometry shader (GS) is primative evaluation. Geometry shaders can tesselate, but they are limited by a) an in-process upper bounds on the number of output elements, and b) execution within a single shader...of course shader instancing aleviates the 2nd issue, but overall geometry shaders are more effective at primative ...


12

Displacement mapping can mean (but doesn't always mean) a vector displacement at each point on the surface. Height mapping implies only a scalar displacement value, i.e. each point gets pushed along its normal. The term "displacement mapping" can also be used for scalar displacements, though, so when vector displacements are discussed, people often ...


11

Displacement mapping and height mapping are two names for "almost" the same technique, they aim to do the same effect but are used in different contexts. To explain more: Displacement Mapping: Is a technique that aims to render bumps as true geometry, in a very fine mesh. Unlike bump mapping, parallax, and relief mapping which tries to "fake" bumps using ...


6

What you're looking for is something called "seamless" textures. Here are some tutorials for popular image editing programs: Photoshop (Youtube) Photoshop Gimp


6

Do they even serve any purpose at all? Yes for the user and developer of the shader, semantics conveys information about the intended use of a parameter. So you will know that POSITION is intended to be used as vertex position, NORMAL as vertex normal etc. Think of this as in-code documentation (not strictly the same though). Do semantics carry any ...


6

When rendering terrain, for efficiency you usually want to reduce the level of detail of geometry in areas far from the camera. As the camera moves around, you would adjust the level of detail to keep the area near the camera at high detail. Geomipmapping, geometry clipmaps and suchlike are ways of managing this on the CPU. Although the GPU always does ...


5

Thanks to everyone for the advice. I spent a few minutes with a notebook and found a suitable tessellation cell for a hex grid: or, in context: Note: It doesn't really matter if this is centered on a cell - if your grid is composed of regular hexagons, you can slice it into cells this size starting anywhere you want. Hooray for tessellations. My example ...


5

Applying two normal maps is not that bad. Many games apply multiple normal maps already because they're blending between texture layers (e.g. for terrain), so having a normal map representing the larger displacements and another normal map for fine details is pretty reasonable. Check out Blending in Detail by Colin Barré-Brisebois and Stephen Hill for a ...


5

To subdivide your quad in n*n sub-quads, you create n*n sub-quads inside it. There are several ways of doing this, so there is not such thing as the subdivide function. Things get messy if you want to handle the most general case, i.e. a quad that is not necessarily a perfect square. Your illustration does not really tell us what you want. There is a whole ...


4

Create 2 variables, hdivs and vdivs. In this example, hdivs=7, vdivs=5. Now what you have to do is, compute all the points on the perimeter of quad ABCD. That means there are 20 points (including the corners) to be precomputed and stored. You then need the 7 horizontal and 5 vertical lines (including the end lines). These are the lines along which the ...


3

A hill like this could be created with the following algorithm: Start with a small circle in form of a regular n-gone (the mountain top). Create a larger "blob" on height 0 by taking the corner-vertices of the previous circle and move each one further away from the center by a random distance. every few iterations, interpolate new vertices on straight ...


3

For the sad weary soul a decade from now who stumbles upon this question wishing for it to be answered: void main(void){ vec3 p1 = mix(tcPosition[0], tcPosition[3], gl_TessCoord.x);//may have to rearrange these numbers depending on your implementation vec3 p2 = mix(tcPosition[1], tcPosition[2], gl_TessCoord.x); vec3 pos = normalize(mix(p1, p2, ...


3

Sorry for the long delay since my comment. I'd been trying to reverse-engineer the ProcWorld example and couldn't work out why the algorithm was making some of the choices it did. In any case though, here's my best idea so far, using the center block from the ProcWorld example as a guide: Start by finding an oriented bounding rectangle of the polygon. (For ...


2

They are the same concept. EDIT: Displacement can be composed of heights in more than one dimension! Don't start any semantic wars over this, but realistically, height mapping usually refers to large scale / tessellation based techniques, where displacement mapping usually refers to small scale / raytracing techniques.


2

I think phong smoothing is the easiest to implement and it is the most lightweight algorithm for this (as far as I know), though it may produce lower quality results. Implementing it is as easy as copy-pasting this code and applying it in your domain shader (that is if you already have tessellation working): struct ConstantOutputType //This is what the ...


2

Sounds like you need to create your own game object and use a custom triangulation algo to handle the detail based on some size related math. Maybe something like this could help ... http://forum.unity3d.com/threads/tessellation-algorithms-for-polygons.228051/ Others options might be to use a smarter shader and a bump map with your sprite ... vertex ...


2

In general, you should avoid asking two separate questions in one post on StackExchange. I'll focus on your second question as it's the meatier of the two, and give a quick overview of the first: How is one supposed to apply such transformation? There are a few places you can do this: Domain Shader interpolate vertex from tesselator using hull ...


1

After a couple of minutes after asking the question I was finally able to figure it out. It seems I missed to change the draw call to use patches instead of triangle primitives. For future reference to other ppl, when working with tessellation shaders, always use patches when drawing and set the amount too. Below is the fix. glPatchParameteri(...


1

It's a bug For a workaround, have a look at Post #13 The idea behind this is to use unused vertex attributes to pass your custom data through.


1

Tessellation does just that - tessellates. That means generating more triangles, typically on the interior of the original triangle / primitive. If you're looking to smooth your result, rather than just creating a higher-resolution version with the same shape, you're going to have to get fancy. If your terrain is defined via a height map, you'll want to ...


1

Taken from the Tessellation entry of Wikipedia on 9/20/2016: No general rule has been found for determining if a given shape can tile the plane or not, which means there are many unsolved problems concerning tessellations. For example, the types of convex pentagon that can tile the plane remains an unsolved problem. You code a generate & test ...


1

Quad tessellation is similar to trianlges. The difference is that instead of barycentric coordinates gl_TessCoord.xyz which define point on a triangle (tcPosition) you have 2-component coordinate gl_TessCoord.xy (they also span in [0-1] range). Hull shader (or Tessellation Control Shader in OpenGL terminology) looks pretty straightforward: #version 430 ...


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

I also tried to create my own algorithm for tessellation, but it produced micro-cracking, then found this (on AMD's site if I recall correctly), which works like a charm: cbuffer tessBuf:register(b0) { float4 g_f4Eye; //camera position in world space float4 g_f4TessFactors; //constant tessfactors (from a material for example) }; struct ...


1

I would do this by setting the displacement texture and a sampler to the domain shader, than sample that on every vertex on the appropriate mip level (done by SampleLevel in hlsl). So you have a 0.0-1.0 value on your vertex, which you offset along its normal by it (and additionaly multiplied by a scalar), like for example: pos.xyz += normal.xyz * (...


1

By evaluating T(u,v,w) you will indeed get a point. The patches are designed and optimized for the tessellation stage in modern graphics hardware. In this stage of the pipeline you are supplied with parametric values [u,v,w] and these can be used to evaluate a patch. You do not need to calculate these values yourself. I'm not quite sure what you mean about ...


1

I have solved my problem in a different way. As i was looking for my problem, it turned out to be a fairly complex one, both measured in difficulty to implement as algorithm, as algorithm complexity. If anyone is having a similar problem, these problems are classified as 'packing problems' in general, with specific problems like the 'pallet loading problem'...


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