Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!

1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Member Since 14 Mar 2008
Offline Last Active Today, 11:03 AM

#5138373 Visualising 2D Fluids (passing data to the GPU)

Posted by eppo on 12 March 2014 - 05:16 AM

You get a very obvious transition between spaces in and outside the volume, but perhaps you could do some post-process blurring and distortion like they do with volumetric cloud rendering.

#5138337 Displacement of vertex height from a grey scale texture on CPU

Posted by eppo on 12 March 2014 - 01:12 AM

A typical displacement map is sampled like any other texture: using a set of texture coordinates (like from a uv map). You can use adaptive tessellation to create additional vertices that sample this map in between the original vertices.


If you want to do a one-on-one mapping of 409 displacement values tied to 409 vertices it makes more sense to store them as a vertex-(weight-)-map and use them as a vertex shader input (next to position, uvs, etc.).

#5138097 Curve to Polygon

Posted by eppo on 11 March 2014 - 07:49 AM

Use the tangent of the curve at every keypoint transformed into screen space to determine in which direction you should offset vertices to create thick lines.


e.g. using the 2D "cross product": float2 posOffsets[] = { pos + float2(tan.y, -tan.x) * thickness, pos - float2(tan.y, -tan.x) * thickness };


If the end- and begin-points of two consecutive segments share the same calculations the quads should connect without gaps.

#5136542 Stack overflow help needed

Posted by eppo on 05 March 2014 - 10:00 AM

How deep is this ownership hierarchy? Perhaps the function isn't optimized for tail recursion and you overflow the stack.


Not sure exactly what you're trying to do, but you could probably rewrite it without using recursion:

Object* root = this;

while(root->OwnerObj) root = root->OwnerObj;


#5129322 Power of normal mapping and texture formats?

Posted by eppo on 06 February 2014 - 09:23 AM

Could I for example save alpha in normal map textures in the 'Z' channel, which is always sort of the same?


It's not always the same, but its value can be derived of the other two components.


D3D10 added the BC5_SNORM 2-channel format which lets you store the x and y channels in the normalized [-1, 1] range. The z component can then be re-calculated in-shader. This format provides high quality compression for normal maps.

#5129309 Baking a Local Thickness Map

Posted by eppo on 06 February 2014 - 08:22 AM

Tried this out in Modo. Simply flip the polygons and bake an AO map.



#5128019 fbx tree with billboard leafs, but leaf quads are already made

Posted by eppo on 01 February 2014 - 02:31 PM

If the quads are pre-oriented, you'll need to find a way to undo this transformation.


- Perhaps the orientation is stored within the mesh. Likely not, but maybe the author of the tool thought it might be useful for deformations (wind etc.).

- If the quads are uv mapped you can use that map, plus the directions of two edges on the quad to re-construct the quad's orientation (similar to what you do when normal mapping).


The quad's vertices multiplied by the inverse of the transformation (matrix) will give you the original quad. This you can then transform as a regular billboard.


Or simpler, you can take the average of the four vertices of the quad, the distance from this centroid position to one of the vertices and build a new quad.

#5125596 Some artwork associated with NATURE HATER

Posted by eppo on 22 January 2014 - 02:48 AM

Looks like you got some talented people on your team.


I don't think I can pretend to be offended by video game violence any more tongue.png, but I do feel you could come up with a a bit more inspired/subtle title for the game.

#5125158 Same vertex, but different UV?

Posted by eppo on 20 January 2014 - 03:35 PM

So smooth surfaces do not duplicate vertices at the same position? I figure the Normal must then be a blend of the 3 adjacent face normals?


Yes, for a cube specifically, that would be problematic. If you tie the SV_VertexID semantic to a vertex shader input (D3D10+), you can forego vertex buffers altogether and construct a cube in its entirety in the vertex shader based of the index value that's passed in.

#5125027 Same vertex, but different UV?

Posted by eppo on 20 January 2014 - 06:17 AM

You can indeed bind multiple vertex buffers, but you can only bind a single index buffer. You'll always read from the vertex streams with a shared index.


Mesh resolutions have become higher and thus smoother, resulting in less duplication needed, so in a way it has been addressed/minimized.

Compared to a few duplicated vertices, having multiple index buffers would only have higher demands on memory, because then every vertex is guaranteed to carry extra information (a fixed set of indices).

#5111064 Texturing Custom Meshes/Terrain

Posted by eppo on 21 November 2013 - 02:06 PM

Vertex splat-masks simply store their weight data at the vertex level (like vertex-normals, uvs etc.). They don't require uv-maps, but their drawback is the underlying vertex resolution needs to be high enough to be able to capture the desired amount of detail.


If the base-textures themselves tile, you won't have to assign each triangle its own texture space. This way more terrain doesn't linearly scale with more texture data.



#5110954 Texturing Custom Meshes/Terrain

Posted by eppo on 21 November 2013 - 04:32 AM

I would calculate all the vertex data before I'd cut the mesh into chunks, that makes it easier to generate continuous data (especially for the normals). I agree with Krohm, your chunks seem too small; I'd store at least some several thousand primitives per chunk.


Can you explain a bit more what kind of texture mapping you're trying to apply? If you use tileable textures there's no need to keep uvs in the 0 - 1 range. Since you have a uniform grid of vertices, you could also consider using vertex weight maps as splatting masks.

#5104758 How to create custom bitmap font?

Posted by eppo on 27 October 2013 - 07:32 AM

This one (http://www.nubik.com/SpriteFont/), which is oddly enough also named SpriteFont, has more features than BmFont.

#5102835 3ds max smoothing problem on the same polygons

Posted by eppo on 20 October 2013 - 07:23 AM

There should be a "normal angle" setting that lets you set the angle above which neighboring normals are unwelded.

Also make sure there are no invisible holes caused by duplicate vertices that share the same position, or degenerate faces on such vertices.

#5098993 extrusion and dir

Posted by eppo on 05 October 2013 - 12:28 PM

Yes, correct. If you want more control over the roll of the orientation you can pre-multiply it with a rotation around the z-axis.
If you were to do the same in a 3D modeling app, you would likely first extrude the shape and then orient it, though it's possible to first rotate the 2D shape and then extrude it along the matrix' z-vector component.