Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 14 Mar 2008
Offline Last Active Dec 26 2014 07:15 AM

#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.

#5098937 extrusion and dir

Posted by eppo on 05 October 2013 - 08:03 AM

My understanding is that the z-axis transformed by the matrix becomes the extrusion vector.


If you want a matrix that is the result of a series of rotations around the z (roll), x (pitch) and y (yaw)-axes: http://www.flipcode.com/documents/matrfaq.html

This page also shows how to set up a matrix that rotates the extrusion from its original z-orientation towards a second vector on the plane formed by the two vectors.

#5098909 extrusion and dir

Posted by eppo on 05 October 2013 - 04:43 AM

Not sure what you are trying to accomplish, but it seems to me you are extruding a shape along the z-axis and want to then orient it in the direction of some secondary vector? Does the image show a top-down view of what you are trying to do? If you want to rotate around the Y-axis on the XZ-plane, you can use the following matrix (with v being the normalized "extrusion direction"):


[v.z, 0, -v.x]

[0, 1, 0]

[v.x, 0, v.z]

#5098904 Depth stencil state issue

Posted by eppo on 05 October 2013 - 04:14 AM

- dsDesc.DepthFunc needs to be D3D11_COMPARISON_LESS.

- make sure you have set the correct culling mode in the rasterizer state (seems alright).

- make sure you bind the depth-stencil surface with OMSetRenderTargets().

dsDesc.StencilEnable can be set to false, unless you have some reason to use stencil-ops.

- enable the debug-layer.