Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 04 Mar 2011
Offline Last Active Dec 10 2014 10:00 AM

Topics I've Started

Questions about billboards

24 October 2014 - 08:33 PM

I'm at the point in my project where I have to implement some basic spherical billboards. I have dabbled with billboards in the past and I've never been able to get controllable results, always having things flip backwards or upside down or really just always the opposite of what I was trying to do.


I have been googling the problem and it seems like there have been many ways to do it over the years, and I'm wondering how it should be done these days with DX11. Most of the examples I have found use the geometry shader to generate a quad, but whenever I have used geometry shaders, I get massive framerate hits just by having a pass-through geometry shader in my pipline. It seems like it could also be done with the tessellation pipeline instead.


Can anyone point me toward some modern hlsl shader code that implements a basic spherical billboard? My grasp of the theory behind it is a bit shaky, so I'm hoping some actual working code will show me what I'm missing.


I would also like to implement a particle system in the future, but I need to get billboards down first.

Ugliness on different hardware (solved)

27 June 2014 - 09:46 PM

I'm trying a project I've been working on on a different computer than I usually use, and I'm getting extreme artifacts on this machine.


My usual computer is an older Windows 7 computer with a really bad, built in Intel vid card. My application works exactly like it is supposed to on that machine. I'm not doing anything out of the ordinary with my shaders, they are very simple solid color outputs and simple vertex adjustments. I haven't yet checked the reference device on that machine because I haven't had any problems.


This new machine is a Windows 8 machine with a much better NVidia vid card, however, in the screenshot you can see that certain parts of the screen are garbled and mixed together. They flash like crazy when the camera moves. This same problem is also evident when I use the reference device. I have ruled out problems with my texture generation by disabling the sampling in the pixel shader. The problem exists even when I don't use textures.


Attached File  HexDemoProblem.jpg   224.51KB   1 downloads


How should I go about solving this problem?


EDIT: Also, I forgot to mention I'm using SharpDX and VS2012 Express.

Question about depth bias.

23 June 2014 - 09:16 AM

I recently used the depth bias field in the rasterizer state description to get rid of some z-fighting issues that I had. I drew some stuff, then changed the rasterizer state to a depth bias of -10, then drew other stuff. This eliminated any z fighting perfectly.


I have a question though. My next step will involving some more co-planer drawing, and I could simplify some things if I could allow these quads to overlap in places. Does the depth bias apply only to reads of the depth buffer? I'm not sure how to formulate this question... let me express what I want to do.


Can I, in the same draw call of many, possibly overlapping instanced quads, ensure that whatever is drawn after, or before, always wins the depth test? I just need one quad or the other to always win. It could be those drawn first or those drawn last. I'm unsure of exactly how the depth bias works.

Animation timing. (SharpDX)

04 June 2014 - 09:09 AM

Ok, I am doing a project using SharpDX that has evolved over time from XNA, to SlimDX and now SharpDX. For my FPS counter, I have been using the System.DateTime.Now.Ticks property to get a measure of time passed. I can't remember when I first implemented my FPS counter, but it always seemed to work. When performance was low I got low numbers and when performance was high I got high numbers.


Recently I have been trying to use the same mechanism to do some color animation, and it is painfully obvious that the System.DateTime class updates itself in a very sporadic way that is not suitable for animation. For example, it seems to give accurate measures of time, but frequently stops for half seconds at a time, more or less.


Where can I get a better measure of time so I can do animations and other camera control movements that are de-coupled from my framerate?

Getting a DXGI Surface from a Texture2D

07 May 2014 - 01:30 PM

Ok, I am using SharpDX with DirectX 11.1. 


I need to draw some text onto some textures for use on some 3D objects, not every frame, just upon initialization. I currently have debugging text (FPS counter etc.) working in my app that obtains a dxgi surface from my swap chain like so:

            surface = swapChain.GetBackBuffer<dxgi.Surface>(0);

Now, to get a surface from a blank texture for text drawing, as far as I can tell I would do this:

            surface = texture.QueryInterface<dxgi.Surface>();

However, since Texture2Ds can have mip levels and even texture arrays this seems rather ambiguous. Does QueryInterface merely assume the top level mip and top index of the array? I don't even know if I'm on the right track here.