Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

Hassanbasil

Member Since 04 Mar 2010
Offline Last Active Mar 04 2013 04:38 AM
-----

Topics I've Started

Terrain streaming

02 August 2012 - 07:05 PM

Hello everyone,

I'm working on a terrain engine that implements the geometry clipmaps, the thing is, i'm wondering what is the best way to build up the height/diffuse/normal maps? currently I have a separate thread reading my files to build the maps, which are only height and diffuse, then re-creating the ID3D11Texture2D every time, I have 2 copies of each map to swap between them while one is being filled, and my normal are generated in the pixel shader from the height map (taking 4 samples for each pixel).

now the question is, should it be done like that? should I be calling some ID3D11Device::CreateTexture2D and their SRV's every while? would it be more efficient to have my textures dynamic and have the thread only read the file and fills in some memory then the main threads Maps and Unmaps the textures according to the read data? and how about the normal map, should it be extracted from the height map in the pixel shader or at the clipmap update?

Finally, since i'm using D3D11, is the tessellated terrain a better implementation to go with? I tried a sample by NVidia by looks like it's not as fast as it should be - I had around 50 FPS with only the terrain on screen so I supposed it was disappointing.

Thank you for your time,
Hasan

PIX and VS11 beta breaks on IDXGISwapChain::Present

09 June 2012 - 08:13 AM

Hello everyone,

I'm running into trouble debugging my application, when i run it, it's fine, but when i use the visual studio graphics debugger or PIX, it breaks on swap chain's present call, with the following error in VS:
"Unhandled exception at 0x6249D61F (d2d1.dll) in HasX11 Engine.exe: 0xC0000005: Access violation reading location 0x00000000."
and PIX gives the following:
"Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention."

I'm not sure what is the problem, i'm not using d2d at all, not even included, yet the error is in d2d1.dll, also - when i attach VS11 debugger for PIX it breaks on present too.

I am running windows 8 consumer preview, with visual studio 11 beta, i had directX SDK june 2010 installed, is it causing conflicts? i tried to rename the install directory of the sdk to make sure it's not linking with it (since i realized windows 8 has the libs and headers built in) but with the same result, i dont really feel like uninstalling the dxsdk just to make sure since i lost its installer, could there be something else causing this?
also note that it happens with both dirext3D 11 and 11.1.

Thank you for your time,
Hasan

Environment-interactive animation

28 March 2012 - 09:11 AM

Hello everybody,

First off I'm not really sure if this is the right board but let's hope it is Posted Image

I'm working on animation for my engine, basically i'm planning to make 3 types: normal keyframed animation, skeletal animation (pre-defined frames of bones) and the environment-interactive skeletal animation.
So basically, my API will have a set of functions responsible for moving bones depending on the environment, for example, if there's a wall on the character's right, i can call hxSkeleton::SetBoneChainTarget ( baseRightArmBone, rightHandBone, wallPosition ); so it tries to move all bones between baseRightArmBone and rightHandBone so that rightHandBone touches the "wallPosition", same thing with legs, which can give better results while moving up stairs, for example.
The question is, has this been done before? where can i read more about it? would be better than starting all over from scratch, also is it practical? Is it better than pre-defined frames?

failed to create device with feature level 11

03 February 2012 - 03:33 PM

Hello,

I've bought a new laptop with an nVidia Geforce GT540M card, which supports DX11, for some reason i can't seem to be able to create a device with feature level 11.0, i looked at the device caps and feature level 11 is listed there, i have the nVidia latest driver, though, there's a problem that the dxdiag (dx diagnostic tool) dialog shows info about intel HD graphics - so i'm somewhat confused, in the system tab it shows "DirectX Version: DirectX 11", but the Display tab shows the intel driver information.

is the problem from the hardware side or my code? here's how i create my device:
D3D_FEATURE_LEVEL level;
  D3D_FEATURE_LEVEL desiredLevels[1] = { D3D_FEATURE_LEVEL_11_0 };
  HX_PRINTERR_HR ( D3D11CreateDevice ( __Impl__->DXGIPrimaryAdapter, D3D_DRIVER_TYPE_UNKNOWN, NULL, __Impl__->registerDesc->deviceLayers,
   desiredLevels, 1, D3D11_SDK_VERSION, &__Impl__->D3DDevice, &level, &__Impl__->D3DDeviceContext ), HX_UNABLETOCREATEDEVICE );

this fails with no errors from the debug layer, also, if i leave the feature levels to NULL, it works but the returned "level" is 10.1, what is the problem?

Thanks for your time.

light pre-pass

25 December 2011 - 01:05 PM

Hello everyone,

I've been trying to implement light pre-pass recently, following this tutorial, i'm using Direct3D11 (shader model 4)
my problem is getting the pixel position in my pixel shader, here's the code (light map building shader):

float2 PostProjToScreen ( float4 position )
{
  float2 screenPos = position.xy / position.w;
  return 0.5f * ( float2 ( screenPos.x + 1, 1 - screenPos.y ) );
}

float2 HalfPixel ( void )
{
	return float2 ( 0.5f / screenSize.x, 0.5f / screenSize.y );
}

VS_OUT VS ( VS_IN input )
{
	VS_OUT output;
	output.position = mul ( float4 ( input.position, 1.0f ), gWVP );
	output.tex = ((output.position.xy + float2(1.0f,1.0f))/2.0f);
	output.tex.y = 1.0f - output.tex.y;
	return output;
}
float4 PS ( VS_OUT input ) : SV_TARGET
{
	float2 texC = input.tex; //PostProjToScreen ( input.position ) + HalfPixel ( ); doesn't work
	
	float z = depthMap.Sample ( gSampler, texC );
	float x = texC.x * 2.0f - 1.0f;
	float y = (1.0f - texC.y) * 2.0f - 1.0f;
	float4 vProjectedPos = float4 ( x, y, z, 1.0f );
	float4 vPositionVS = mul ( vProjectedPos, gProjMatrixInverse );
	
	float3 pixelPosition = vPositionVS.xyz / vPositionVS.w; //littile problems with this variable also
	float3 pixelNormal = normalMap.Sample ( gSampler, texC );
	
	float3 lDir = -normalize ( gLightDir );
	float nl = 1.0f / dot ( pixelNormal, lDir );
	
	float3 camDir = normalize ( gEyePosW - pixelPosition );
	
	// Calculate specular term
	float3 h = normalize ( lDir + camDir );
	float spec = pow ( saturate ( dot ( pixelNormal, h ) ), gSpecPower );
	
	return float4 ( gLightColor * nl, spec );
}

so here's the whole thing: "PostProjToScreen ( input.position ) + HalfPixel ( )" line didn't work at all, it changed when my rendered shape changed which means it's not the real coords of the pixel (am i right? :D), so i took it out and replaced it with the texcoords from the vertex shader, this only works when i render a fullscreen quad (to implement directional light, for example), but i wan't a more "general" solution so that it could work with other primitives/types of light

now the second thing is: the pixel z position is not being calculated correctly: i tested (with working texcoords from vertex shader) x and y and they seem to be fine, but the z seems to be buggy, im not sure how to debug this because im a little confused about it so i would appreciate some help.

note: the depth map is automatically generated by hardware, i didn't output it myself (i tried doing it myself, the depth map looked weird, alot of big flickers everywhere, even the model depth is screwed up)

Thank you for your time.

PARTNERS