• Advertisement
  • Popular Tags

  • Popular Now

  • Advertisement
  • Similar Content

    • By lucky6969b
      I want to calculate the position of the camera, but I always get a vector of zeros.

      D3DXMATRIX viewMat; pDev->GetTransform(D3DTS_VIEW, &viewMat); D3DXMatrixInverse(&viewMat, NULL, &viewMat); D3DXVECTOR3 camPos(viewMat._41, viewMat._42, viewMat._43); log->Write( L"Camera Position: %f %f %f\n", camPos.x, camPos.y, camPos.z);

      Could anyone please shed some lights on this?
    • By bsudheer
      Leap Leap Leap! is a fast-paced, endless running game where you leap from rooftop to rooftop in a computer simulated world.

      This is a free run game and get excited by this fabulous computer simulated world of skyscrapers and surreal colors in parallax effect. On your way, collect cubes and revival points as many as you can to make a long run.

      Features of Leap Leap Leap:
      -Option of two themes: Black or White.
      -Simple one touch gameplay.
      -Attractive art.
      -Effective use of parallax.
      To Download the game:
      Playstore: https://play.google.com/store/apps/details?id=com.avakaigames.leap
      Appstore: https://itunes.apple.com/us/app/leap-leap-leap/id683764406?mt=8

    • By isu diss
      I'm following rastertek tutorial 14 (http://rastertek.com/tertut14.html). The problem is, slope based texturing doesn't work in my application. There are plenty of slopes in my terrain. None of them get slope color.
      float4 PSMAIN(DS_OUTPUT Input) : SV_Target { float4 grassColor; float4 slopeColor; float4 rockColor; float slope; float blendAmount; float4 textureColor; grassColor = txTerGrassy.Sample(SSTerrain, Input.TextureCoords); slopeColor = txTerMossRocky.Sample(SSTerrain, Input.TextureCoords); rockColor = txTerRocky.Sample(SSTerrain, Input.TextureCoords); // Calculate the slope of this point. slope = (1.0f - Input.LSNormal.y); if(slope < 0.2) { blendAmount = slope / 0.2f; textureColor = lerp(grassColor, slopeColor, blendAmount); } if((slope < 0.7) && (slope >= 0.2f)) { blendAmount = (slope - 0.2f) * (1.0f / (0.7f - 0.2f)); textureColor = lerp(slopeColor, rockColor, blendAmount); } if(slope >= 0.7) { textureColor = rockColor; } return float4(textureColor.rgb, 1); } Can anyone help me? Thanks.

    • By elect
      ok, so, we are having problems with our current mirror reflection implementation.
      At the moment we are doing it very simple, so for the i-th frame, we calculate the reflection vectors given the viewPoint and some predefined points on the mirror surface (position and normal).
      Then, using the least squared algorithm, we find the point that has the minimum distance from all these reflections vectors. This is going to be our virtual viewPoint (with the right orientation).
      After that, we render offscreen to a texture by setting the OpenGL camera on the virtual viewPoint.
      And finally we use the rendered texture on the mirror surface.
      So far this has always been fine, but now we are having some more strong constraints on accuracy.
      What are our best options given that:
      - we have a dynamic scene, the mirror and parts of the scene can change continuously from frame to frame
      - we have about 3k points (with normals) per mirror, calculated offline using some cad program (such as Catia)
      - all the mirror are always perfectly spherical (with different radius vertically and horizontally) and they are always convex
      - a scene can have up to 10 mirror
      - it should be fast enough also for vr (Htc Vive) on fastest gpus (only desktops)

      Looking around, some papers talk about calculating some caustic surface derivation offline, but I don't know if this suits my case
      Also, another paper, used some acceleration structures to detect the intersection between the reflection vectors and the scene, and then adjust the corresponding texture coordinate. This looks the most accurate but also very heavy from a computational point of view.

      Other than that, I couldn't find anything updated/exhaustive around, can you help me?
      Thanks in advance
    • By drcrack
      It is a combination of fundamental RPG elements and challenging, session-based MOBA elements. Having features such as creating your unique build, customizing your outfit and preparing synergic team compositions with friends, players can brave dangerous adventures or merciless arena fights against deadly creatures and skilled players alike.

      This time with no grinding and no pay to win features.

      We're still looking for:
      1) 3D Character Artist
      2) 3D Environment Artist
      3) Animator
      4) Sound Designer
      5) VFX Artist

      Discord https://discord.gg/zXpY29V or drcrack#4575
  • Advertisement
  • Advertisement
Sign in to follow this  

3D MSAA and alpha-to-coverage

Recommended Posts

I am a bit confused of the difference between transparency/alpha blending and alpha-to-coverage, since Frank D. Luna put both techniques in one section of 3D Game Programming with DirectX 11, letting it appear that the latter technique is superior. I have some questions:

I guess the superiorness is only related to the smoothing of blocky edges and not to the handling of transparency?

Since the alpha in alpha-to-coverage technique is used as coverage instead of the coverage determined at the polygon level:

  • should opaque geometry be rendered without alpha-to-coverage, since we will otherwise have always 100% coverage (killing the purpose of MSAA in the first place)?
  • do you loose quality for transparent geometry (which have a texture with an alpha channel), since the coverage determined at the polygon level is not used? (as opposed to MSAA with alpha blending)

Transparency/alpha blending requires sorting and rendering back-to-front.

  • Is this the case for alpha-to-coverage as well?
  • Suppose the alpha of a fragment is 50%, what happens with the source (fragment) and destination color? Is there still some kind of blending with the background or is the color intensity reduced by half?

Share this post

Link to post
Share on other sites

Alpha to coverage shouldn't be used for opaque or alpha-blended objects; it's useful for alpha-tested objects. Normally alpha-tested objects gain no benefit whatsoever from MSAA, because the pixel shader runs at pixel-frequency (not sample-frequency) so either the pixel is rejected (no samples written) or the pixel is accepted (all samples written if it's a polygon interior / some samples written if it's a polygon edge).

A2C allows those pixels that are in the interior of a polygon but the edge of an alpha-cutout to only write to a fraction of the samples, which approximates the same effect as a real MSAA polygon edge (which would require super high polygon meshes instead of alpha mask textures), or the same effect as if you'd used an alpha-blended edge (which would require back-to-front sorting).

Share this post

Link to post
Share on other sites
44 minutes ago, Hodgman said:

but the edge of an alpha-cutout to only write to a fraction of the samples

And how is determined which of the subpixels will be covered and which will not be covered in case of an 0 < alpha < 1?

I also assume that the normal coverage mask is not used with alpha-to-coverage. So when using alpha-to-coverage you need to chose between AA and transparency for alpha-tested objects (e.g. texture with alpha channel that is opaque at its edges)?

Share this post

Link to post
Share on other sites

The regular MSAA sample mask from the rasterizer is AND'ed with the A2C sample mask. The A2C sample mask is created using some kind of implementation defined algorithm that quantizes the alpha and enables a corresponding portion of the samples.
e.g. for 4x MSAA, maybe 87-100% uses 1111, 62-87% uses 0111, 37-62% uses 0011, 12-37% uses 0001 and 0-12% uses 0000.

On very modern GPU's, you can actually compute a sample coverage mask yourself in your pixel shader instead of using "fixed function" A2C modes to do it for you.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Advertisement