locked
Billboard texture question

    Question

  • I want to implement billboard in win8.But when I set texture coordinate in gs where I expand a point to a quad. The texture show me a blended picture. it is to say, the color of the texture was blended with the texture file's pixels. What am I missed?

    I have uploaded my project:

    http://sdrv.ms/J9gLEs

    Any guide will be appreciated.



    • Edited by halcyons Thursday, December 12, 2013 9:25 AM
    Thursday, December 12, 2013 9:19 AM

Answers

  • In SimpleGeometryShader.hlsl, at line 10, make it:

        static const float2 gTexC[4] =

    instead of "float2 gTexC[4] = "

    That will get the texture displaying.

    You will also need to create an ID3D11BlendState and set it on the device using ID3D11DeviceContext::OMSetBlendState before rendering if you want something other than the default blend state (e.g. if you want alpha blending instead of opaque drawing).

    If you download Visual Studio 2013 Express for Windows (or if you have a non-Express version of VS 2012 or 2013), you can use the built-in Graphics Diagnostics to help you find and fix errors like this. See: http://msdn.microsoft.com/en-us/library/hh315751.aspx .


    Visual C++ MVP | Website | Blog | @mikebmcl | Windows Store DirectX Game Template

    • Marked as answer by halcyons Sunday, December 15, 2013 8:28 AM
    Friday, December 13, 2013 10:02 PM

All replies

  • I found that it just map a few texels to the 3d surface. It seems that there's something wrong with texture filters. But I have not found the problem.

    • Edited by halcyons Friday, December 13, 2013 10:06 AM
    Friday, December 13, 2013 10:02 AM
  • In SimpleGeometryShader.hlsl, at line 10, make it:

        static const float2 gTexC[4] =

    instead of "float2 gTexC[4] = "

    That will get the texture displaying.

    You will also need to create an ID3D11BlendState and set it on the device using ID3D11DeviceContext::OMSetBlendState before rendering if you want something other than the default blend state (e.g. if you want alpha blending instead of opaque drawing).

    If you download Visual Studio 2013 Express for Windows (or if you have a non-Express version of VS 2012 or 2013), you can use the built-in Graphics Diagnostics to help you find and fix errors like this. See: http://msdn.microsoft.com/en-us/library/hh315751.aspx .


    Visual C++ MVP | Website | Blog | @mikebmcl | Windows Store DirectX Game Template

    • Marked as answer by halcyons Sunday, December 15, 2013 8:28 AM
    Friday, December 13, 2013 10:02 PM
  • Thank you very much :)

    Sunday, December 15, 2013 8:29 AM
  • Remember that the GS-based billboard techniques requires a Feature Level 10.0+ Direct3D hardware device, so you have to have a fallback for Feature Level 9.x. Using GS to implement point-sprites also only tends to perform better than a traditional 'draw a quad' method if rendering many tens-of-thousands of points (say a starfield), not when rendering a few dozen or hundreds of sprites. For this reason, DirectXTK implements a classic quad-draw rather than GS-based rendering solution for SpriteBatch.

    Monday, December 16, 2013 1:06 AM
  • Thank you for your reply. I'll follow your suggestion. :)

    However, I feel not really understand your "Using GS" and "traditional 'draw a quad' method". Which method i'm using ? Sorry that I' m just new in DX. Looking forward to your reply.

    • Edited by halcyons Wednesday, December 18, 2013 3:48 AM
    Wednesday, December 18, 2013 3:41 AM