Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 19 May 2008
Offline Last Active Today, 02:45 AM

Posts I've Made

In Topic: Compiling Hlsl - Shaders In Vs 2013

10 August 2016 - 10:00 PM

Unfortunately, VS2013's hlsl vertex/pixel shader compiling is a one input to one output file thing only. I solved this via writing a batch file to run fxc.exe on my input files and then setting it to run it as a postbuild event in the project's settings (ie. writing my own shader build system). Here's a few lines of batch file code to compile a simple vertex shader.


set shadercompile="%DXSDK_DIR%\Utilities\bin\x64\fxc.exe"

set entryfuncName=VS

%shadercompile% input_hlsl.hlsl /E"%entryfuncName%" /Fo"output.cso" /Tvs_4_0 /nologo


Then all you have to do for a "compile on modifying shader source code" feature is to create a file after the process, check if input files are modified later than that lock file, then compile if true.

In Topic: [D3D11]Any explanation for a temporary performance hit on binding a 4k by 4k...

02 July 2016 - 04:56 AM

Are you sure your GPU has enough memory? System will silently transfer data between GRAM and RAM.

Your explanation reminds me of situation I had in a game I played: I had 60 FPS with static scene but whenever I turned camera it dropped to 10 FPS only because PC didn't have enough GRAM to fit all textures at once.


It should have enough, gtx650 has 1gb of dedicated ram and I have very few assets in gpu(~20-30 textures, most of them 256x256). But to confirm, is there a way to find out how much memory is left in GRAM?

In Topic: Assimp loading a skinned model and animation-only fbx file seperately, then m...

15 June 2016 - 10:14 AM

yup. the generated nodes are pivots that are not representable directly in assimp. Thanks for the help, I'm just looking for information on how people usually handle this case. I mean, merging animations and skinned models through assimp shouldn't be that rare a task right?

In Topic: triangle culling in close proximity to other triangles?

29 April 2016 - 10:54 PM

ah ok. fixed the problem. turned out to be a frontface winding issue

In Topic: triangle culling in close proximity to other triangles?

29 April 2016 - 09:33 AM

At first I ruled out Depth Buffer issue, because as Hodge mentioned, Depth testing occurs at a per pixel level, not a per primitive level, so back face culling shouldn't be involved. 

However, in the picture you just posted I do see what seems to be Z Fighting on your last rock.


A few questions,


1. Can we see your depth buffer creation code, preferably all the way up to you bind it to the Output Merger. 


2. Are the Rock Models completely perpendicular to the ground model, or is the camera pitched at a 45d (0.78 in radians), or is the camera looking straight down the Y-Axis?


Marcus Hansen



/************** Setup ************/
// Create depth stencils
  D3D11_TEXTURE2D_DESC descDepth;
  ZeroMemory(&descDepth, sizeof(D3D11_TEXTURE2D_DESC));
  descDepth.Width = texture2ddesc.Width;
  descDepth.Height = texture2ddesc.Height;
  descDepth.MipLevels = 1;
  descDepth.ArraySize = 1;
  descDepth.Format = DXGI_FORMAT_D24_UNORM_S8_UINT; //24 bits for depth, 8 bits for stencil
  descDepth.SampleDesc.Count = 1;
  descDepth.SampleDesc.Quality = 0;
  descDepth.Usage = D3D11_USAGE_DEFAULT;
  descDepth.BindFlags = D3D11_BIND_DEPTH_STENCIL;
  descDepth.CPUAccessFlags = 0;
  descDepth.MiscFlags = 0;

  //maincontext->mDepthStencilTexture is of type ID3D11Texture2D*
  hr = GetDevice()->CreateTexture2D(&descDepth, NULL, &maincontext->mDepthStencilTexture);
  if (hr != S_OK)
    ASSERTLOGC(0, "Failed to create DepthStencil for swap chain");
    return false;

  // Create the depth stencil view
  ZeroMemory(&descDSV, sizeof(D3D11_DEPTH_STENCIL_VIEW_DESC));
  descDSV.Format = descDepth.Format;
  descDSV.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2D;
  descDSV.Texture2D.MipSlice = 0;
  //maincontext->mDepthStencilView ID3D11DepthStencilView
  hr = GetDevice()->CreateDepthStencilView(maincontext->mDepthStencilTexture, &descDSV, &maincontext->mDepthStencilView);
  if(hr != S_OK)
    ASSERTLOGC(0, "Failed to create DepthStencilView for swap chain");
    return false;

/************** Binding code ************/
mContext->OMSetRenderTargets(1, &mFrameBufferRT, mDepthStencilView);

2) My camera is not looking straight down, but slight downwards. the rock models are on a flat xz plane.


Also, the rocks flicker a little as I zoom the camera in and out, so it's probably z-fighting like you guys said.