Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 01 Jun 2009
Offline Last Active May 06 2016 02:33 PM

Posts I've Made

In Topic: World, view & projection spaces

20 December 2013 - 04:51 PM

ID3D10Blob* pVertexShaderBytecode = NULL;  
ID3D10Blob* pCompileErrors = NULL;
if( pCompileErrors != NULL ) {
     OutputDebugStringA( (CHAR*)pCompileErrors->GetBufferPointer() );
     return 0;
D3DCompile(pVertexShaderCode,  lstrlenA( pVertexShaderCode ) + 1, "vertex shader", NULL, NULL, "vertex_shader", "vs_4_0", NULL, 0, &pVertexShaderBytecode, &pCompileErrors );  

Here you're checking if the shader compiled succesfully, before actually compiling the shader. If you try compiling the shader before checking the compile succeeded, this should fix this issue. smile.png

Side note: You're compiling the shader each time you call DrawSquare() (perhaps this could use a better name?). It's much more efficient to compile the shader once, and then binding this compiled shader before drawing the triangle.

In Topic: Merge tools

08 September 2013 - 05:41 PM

I'm pretty sure the perforce merge tool is free to download on its own - P4merge. I have never had any problems with this and for c# files should be more than adequate. That's what I would go for if you want a free solution.

Another vote for P4Merge from me. Though I've only ever used one other merge tool, this has the advantage of being free (within requirements). :)


You can view the original file(base), and branched versions(yours and your partners changes) for resolving conflicts - and specify which change should be used(or both), and also, if necessary, modify the result by hand in the merge window below.


(It also works for images too, and can highlight the differences.)

In Topic: How do you pronounce your image formats

27 May 2013 - 03:14 AM

Apparently, the Whitehouse declares .gif as Gif with a hard G, not Jif. 




It's nice to know they're on the same wavelength... even if that's in another country. smile.png


"Jaypeg" is often understood but not always.


I used to pronounce it like this too, but I've since changed to "jay-pee-gee".

In Topic: geometry shader sampling problem?

18 March 2013 - 12:18 PM

I'm unsure of how the D3D shader compiler / effect system works when specifying just one address mode in the sampler state.


Here, you're just applying the CLAMP state to AddressU without setting AddressV or AddressW. 

Does the effect compiler output any warnings/errors?


Searching through MSDN I found this: http://msdn.microsoft.com/en-us/library/windows/desktop/bb509644(v=vs.85).aspx
Though this doesn't really answer that question, it does give an example in "MeshTextureSampler" for trilinear sampling.


(Also, I assume the duplicated "gPointSample" is a copy/paste error?)


Hope this helps



Additionally, since you're sampling in the geometry shader, ensure you're using the correct texture access method: http://msdn.microsoft.com/en-us/library/bb509700%28v=VS.85%29.aspx. I.e Load(), SampleGrad() or SampleLevel()

In Topic: Stereo when using an infinity projection matrix

10 March 2013 - 12:55 PM

I haven't tested this with your "infinity matrix", however, this works fine with a regular good'ol non-orthograpic projection matrix:


void buildProjectionMatrixInfinityPerspectiveFovLH(f32 aspectRatio, f32 parallax)
   const f64 yScale = 1.0f / tan(45.0f / 2.0f);
   const T xScale = (T)(yScale / aspectRatio);
   const T Epsilon = 0.000001f;
   M[0] = xScale;
   M[1] = 0;
   M[2] = 0; 
   M[3] = 0;
   M[4] = 0;
   M[5] = (T)yScale;
   M[6] = 0;
   M[7] = 0;
   M[8] = 0;
   M[9] = parallax; // Parallax shift 
   M[10] = 1.0f+Epsilon;
   M[11] = 1.0f;
   M[12] = 0;
   M[13] = 0;
   M[14] = -1.0f;
   M[15] = 0;

   return *this;



So you'd obviously want two projection matrices:


f32 parallax = 0.033f; //  Real-world value: dependant on screen SIZE (not dimensions), and user's viewing distance to screen.

matrix left = buildProjectionMatrixInfinityPerspectiveFovLH(aspectRatio, -parallax);
matrix right = buildProjectionMatrixInfinityPerspectiveFovLH(aspectRatio, parallax);




Note: The parallax should match the viewer's eye seperation from their viewing distance, take into account the real-world dimensions of the screen, and account for the viewer's distance to the screen - if you want a realistic experience.

However, this is largely impossible unless you're using a head mounted display - where the viewing distance is constant.


You could just tweak the parallax value to see what feels best. :)