Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

GuyWithBeard

Member Since 04 May 2006
Offline Last Active Today, 11:44 AM
-----

Topics I've Started

Coefficients for bezier curves

15 May 2013 - 01:34 AM

I have been working with Cubic and Quadratic bezier curves for the past week, and one thing that I am still not sure about is how to get the polynomial coefficients from the control points. For example, a cubic bezier has the formula A*t^3 + B*t^2 + C*t + D and a quadratic one has A*t^2 + B*t + C. The cubic bezier is defined by the end points P0 and P3, and the control points P1 and P2. The quadratic one is just P0, P1 and P2. http://floris.briolas.nl/floris/2009/10/bounding-box-of-cubic-bezier/ says that the coefficients for the cubic bezier can be calculated like:
 
m_DX = m_P0.x;
m_CX = 3.0f * ( m_P1.x - m_P0.x );
m_BX = ( 3.0f * m_P2.x ) - ( 6.0f * m_P1.x ) + ( 3.0f * m_P0.x );
m_AX = m_P3.x - ( 3.0f * m_P2.x ) + ( 3.0f * m_P1.x ) - m_P0.x;
 
These coefficients can be plugged into the formula A*t^3 + B*t^2 + C*t + D and it works, so they seem to be okay. I am not sure how those coefficients were derived though. Can anyone explain this to me? Also, I would need to calculate the same coefficients for a quadratic bezier.
 
Thanks!

Confused by the input to FXAA

15 April 2013 - 04:10 AM

Hi,

I am looking at using FXAA in my game. However, I am confused about what to actually give the FXAA shader. In the example that comes with FXAA the VS looks like this:

FxaaVS_Output FxaaVS(uint id : SV_VertexID)
{
FxaaVS_Output Output;
Output.Tex = float2((id << 1) & 2, id & 2);
Output.Pos = float4(Output.Tex * float2(2.0f, -2.0f) + float2(-1.0f, 1.0f), 0.0f, 1.0f);
return Output;
}

I have always worked with vertex shaders that have taken some vertex format as input. What am I supposed to set as input layout (ie. with IASetInputLayout()) before drawing using FXAA? Also I am pretty sure I am supposed to draw a fullscreen quad when using this, but I though I would check with you just in case I am not. And, if I am indeed supposed to draw a fullscreen quad, should the VS not transform the coordinates, or at least pass them on to the next stage in the pipeline?

Thanks!

Visual Studio 2012 graphical debugger and offscreen buffers

09 April 2013 - 12:32 AM

Hi,

 

Using the new VS2012 graphical debugger it is very easy to take a snapshot of a frame (eg. by pressing Print Screen), and getting the contents of the back buffer into the debugger where you can inspect the pixel history etc. However, I have several offscreen buffers the content of which I would like to inspect in the same way. My engine renders the scene something like:

 

1. Render all shadow maps

2. Render the view space normals and depth to a buffer for SSAO use

3. Calculate the SSAO

4. Render the main scene.

 

What if I wanted to inspect one of the shadow maps or the SSAO normal/depth map? How do I get those buffers into the debugger?

 

Thanks!


Shadow mapping and high-up objects

19 February 2013 - 06:40 AM

Hi,

 

I have cascaded shadow maps setup and working pretty well in my engine. I have large outdoor scenes and currently only one light (the sun) casting shadows. The problem is that when objects are high up, eg. right above the camera, it is outside the closest, highest detail cascade, and thus does not cast any shadows. My camera usually looks a bit down, since it's a third-person game I am making. How should I go about fixing this? Should I just make the cascades big enough to contain all objects in the scene? This, of course, would mean that the resolution of the cascades goes down.

 

The high-up objects are mostly static. Should I look into doing some sort of offline precalculated shadow data for these objects?


Best way to downscale a heightmap during runtime

21 January 2013 - 02:44 AM

Hi,

 

I am working on a game with large outdoor terrains, and I have a heightmap-based terrain system set up. The heightmaps are generally quite detailed, eg 2049x2049 (for 2048x2048 quads), and I do dynamic LOD on the GPU. However, for the physics this detail is not always a good idea. My players (vehicles) get stuck on small bumps etc. and the terrain physics are quite heavy. This is why I would like to scale down the original heightmap to something like half the resolution, or a fourth of the resolution or whatever the level in question works best with, and use this lower detail heightmap for the physics mesh.

 

What algorithm should I use for something like this? I should be fast enough so that I can run it when the level loads, and generally "work well" for terrain physics meshes. Do I just calculate the average over the nearby vertices or is there some better way to do it?

 

Thanks!


PARTNERS