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
Online Last Active Today, 12:38 PM

#5225125 Collision Detection and Camera movement. C#/Monogame

Posted by eppo on 23 April 2015 - 02:46 PM

1. Store an array of structs/classes instead of an array of integers. Every struct can contain a series of variables, including the index to the sprite, but also other properties like a boolean that tells a cell's collision condition.


2. Create a virtual camera. In this case that can simply be a pair of x, y coordinates. When you draw the playing field from bottom to top, you add these coordinates to an array indexing offset.


e.g.: for(y = 0; y < 25; ++y) for(x = 0; x < 25; ++x) cells[x + camera.x][y + camera.y].drawAt(x, y);


When moving the mouse cursor over the edge of the playing field, you can slowly increase/decrease the camera's .xy values.

#5203080 Cutting polygons by a grid.

Posted by eppo on 09 January 2015 - 07:25 AM

Simplest alternative to clipping would be to generate a triangulated volume of the boundary (if you don't already have a volumetric representation) using something like poly2tri. Then subdivide the mesh until all its edge lengths are below a certain threshold (to prevent too much distortion when you map its vertices to a sphere). If the map itself is triangulated you don't have to draw the sphere underneath it, avoiding possible intersection/z-fighting issues.

#5154069 How to draw [these kind of] splines?

Posted by eppo on 16 May 2014 - 12:01 PM

I suspect you'll be able to draw such a spline as a Hermite curve using only an outgoing and an incoming set of positions and (flat/horizontal) tangents.


You can use the Hermite routines that come with the D3DX-library.




Or you can use the cubic equations mentioned there directly.

#5152704 High Speed Quadric Mesh Simplification without problems (Resolved)

Posted by eppo on 10 May 2014 - 11:23 AM

Based on what criteria do you prioritize one contraction over the other? I don't see you (re-)sorting the list of triangles.

#5152524 Aligning a path, along a another dynamically

Posted by eppo on 09 May 2014 - 07:47 AM

This is probably easiest when the underlying road structure is defined as a network of interconnected splines. That way the center of the road and its tangent/direction are exactly defined. Also, you can do distance tests between the (tessellated) curve and surrounding points to see whether such points lie on the road. Lastly, a user-defined route becomes a simple series of (spline-)key-points.

#5151122 Having trouble with my Vertex Element Class

Posted by eppo on 03 May 2014 - 02:54 AM

What are the VertexElements you feed it with? Do elements that share the same semantic-name have individually unique indices? A name + index pair defines a unique semantic.


It would be less error sensitive if you don't have to specify a semanticIndex, but calculate it based on the number of previous occurrences of the same name.

#5149175 D3DXMatrixLookAtLH vs Custom View Matrix

Posted by eppo on 24 April 2014 - 09:26 AM

So basically the cross product for LH matrix doesnt seem to follow right hand thumb rule but rather left hand convention?


Yup. m_vecLookAtPoint faces away from you, so cross(LookAt, Up) would point to the left.

#5143499 Mapping problem onto a 2D quad

Posted by eppo on 31 March 2014 - 09:34 AM

If you specify a R16 format, the Input Assembler expects 16 bit floats. You'd have to do a manual float32-to-half16 conversion.

#5141972 Hitbox setup

Posted by eppo on 25 March 2014 - 05:51 AM

I see that whenever the boxes in the first picture align with the bones, their joints (spheres) in the rig-picture align as well.

The flat-laying boxes are the ones that seem to have axially aligned joints.

#5141679 Best way of volume selection

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

How about a two-click mechanism? The first click lets you drag a rectangle of blocks over the XZ-plane, the second click scales along the Y-axis. This allows the user to create any combination of blocks.

#5140298 Shadow Map problem

Posted by eppo on 19 March 2014 - 06:00 AM

Are youe using a custom filtering kernel? seems to me you have a bug in the depth comparison method which causes results between neighbouring pixels in the map not to match up.

#5138891 Hitbox setup

Posted by eppo on 14 March 2014 - 03:22 AM

Given the three orthogonal axes defined by a bone matrix, you could search for extreme vertices that are affected by the bone in the underlying mesh. If you search in both the positive and negative directions you'll end up with six planes that form an oriented box. This box you can then transform into world space using the same matrices as used for the bones.


Or you can transform the box by the inverse of its bone matrix if you need an AABB that's positioned at the origin. Would take up less memory.

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

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

You simply cast the mapped resource to the same type as the view that describes it.


float* elementsOnline = (float*)mappedResource.pData;




memcpy(mappedResource.pData, elements, sizeof(float) * elementsCount);

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

Posted by eppo on 12 March 2014 - 09:14 AM

What rendering API do you use?


In D3D you can read floats from a Texture Buffer Object defined as: Buffer<float> aBuffer;

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