Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


Narf the Mouse

Member Since 20 Apr 2006
Offline Last Active Jul 30 2013 12:55 AM

Topics I've Started

What are the valid hlsl sampler state values?

27 October 2012 - 08:28 PM

Does Microsoft even document them? Cannot find them.

Thanks.

Edit: To clarify, what can I put in sampler state filter, addressU/V, etc. - What are the valid values for each sampler state variable, or where can I find them? (Plus an explanation)

BulletSharp slow with SlimDX10?

26 October 2012 - 10:58 PM

I downloaded the BulletSharp wrapper for BulletPhysics and have been playing with it. I've also run across a problem:

When running DX10 in a test program that doesn't use BulletSharp, it gets ~120 DrawIndexed calls per ms.
When running DX10 in a test program that uses BulletSharp, it gets ~32 DrawIndexed calls per ms.

They're not the same test program, but DX9 runs perfectly fine and much faster with BulletSharp in program #2. So, that's significant.

What could be causing this and how do I fix it? Thanks.

Edit1: I should also note that DX10 is faster in every other test case.

Edit2: Profiling pinpoints the slowdown as happening in the Device.DrawIndexed() and Effect.Apply() functions. Has anyone tested DX10 and BulletSharp/BulletPhysics?

.fx file error - Box comes out blue

03 October 2012 - 08:51 AM

After some refactoring (that, among other things, added texturing by semantic), I ran my test display and the box came out blue.

Turns out, no matter what I've tried, it reads the red and green of the Material.Diffuse float4 as zero. Blue and Alpha are read properly. I'm setting the material in only one place, and commenting it out and changing the default values in the shader works exactly the same. The other colours in the in the material read properly.

The Effect file compilation code:
	SlimDX.Direct3D10.Effect.FromMemory(
		graphicsDevice.Device,
		memory,
		"fx_4_0",
#if DEBUG
		SlimDX.D3DCompiler.ShaderFlags.Debug,
#else
		SlimDX.D3DCompiler.ShaderFlags.OptimizationLevel1,
#endif
		SlimDX.D3DCompiler.EffectFlags.None) ) ;
And why does copy-pasting spaces no longer work? Makes formatting harder.

Effect file, cut down to the bare bones to show the problem (Yes, I know it's probably badly-written. I've ordered a book):
row_major matrix Projection ;
row_major matrix View ;
row_major matrix World ;
float3 CameraPosition ;

struct DrawMaterial
{
	float4 Diffuse ;
	float4 Emissive ;
	float4 Specular ;
	float4 SpecularExponent ;
} ;

cbuffer ColourSomething : register( c0 )
{
	DrawMaterial Material = { float4( 1.0, 1.0, 1.0, 1.0 ), float4( 0.0, 0.0, 0.0, 1.0 ), float4( 0.0, 0.0, 0.0, 1.0 ), float4( 0.0, 0.0, 0.0, 0.0 ) } ;
} ;

struct VSInput
{
	float4 VertexPosition : POSITION ;
	float4 VertexNormal : NORMAL ;
	float2 UV : TEXCOORD ;
};
struct VSOutput
{
	float4 ScreenPosition : SV_POSITION ;
	float4 VertexNormal : NORMAL ;
	float2 UV : TEXCOORD0 ;
	float4 WorldPosition : TEXCOORD1 ;
	float4 CameraPosition : TEXCOORD2 ;
};

VSOutput VShader( VSInput input )
{
	input.VertexNormal.w = 0 ;
	input.VertexPosition.w = 1.0 ;

	VSOutput output ;
	output.VertexNormal = mul( input.VertexNormal, World ) ;
	output.UV = input.UV ;
	output.WorldPosition = mul( input.VertexPosition, World ) ;
	output.CameraPosition = mul( mul( output.WorldPosition, View ), Projection ) ;
	output.ScreenPosition = output.CameraPosition ;
	return output ;
}

struct PSInput
{
	float4 ScreenPosition : SV_POSITION ;
	float4 WorldNormal : NORMAL ;
	float2 UV : TEXCOORD0 ;
	float4 WorldPosition : TEXCOORD1 ;
	float4 CameraPosition : TEXCOORD2 ;
} ;
struct PSOutput
{
	float4 Colour : SV_TARGET ;
	float Depth : SV_DEPTH ;
} ;

PSOutput PShader( PSInput input )
{
	PSOutput output ;

	output.Colour = float4( Material.Diffuse.rgb, 1 ) ;
	output.Colour = saturate( output.Colour ) ;


	output.Depth = input.CameraPosition.z / input.CameraPosition.w ;
	return output ;
}

technique10 Shader
{
	Pass P0
	{
		SetVertexShader( CompileShader( vs_4_0, VShader( ) ) ) ;
		SetGeometryShader( NULL ) ;
		SetPixelShader( CompileShader( ps_4_0, PShader( ) ) ) ;
	}
}

Just in case this isn't clear for anyone, have a picture of a blue box on a green screen. Why green? Because it contrasts with blue and black.

Have you made a 3D RPG game engine?

20 August 2012 - 08:20 PM

If so, will you allow me to pick your brains?

What worked?
What didn't?
What architecture choices did you make and why?
What would you have done differently?
What could you have done better?

Thanks.

Getting render and depth buffer targets after toggling fullscreen

20 August 2012 - 03:15 PM

How do I get the depth and render targets after they've been disposed and new ones created with .ResizeTarget()/ResizeBuffer()? SwapChain.GetBuffer( ) doesn't seem to exist in SlimDX's DirectX10 wrapper.

Thanks.

PARTNERS