Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!

1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!

mind in a box

Member Since 20 Apr 2010
Offline Last Active Mar 03 2015 02:31 PM

#5107513 How to make object always face upward ?

Posted by mind in a box on 06 November 2013 - 01:50 PM

Simplest way of doing this would be taking the cross-product of the world-up-vector (or whatever direction you want it to turn to) and your planes up vector.

Multiply that with the deltaTime and a strength factor (I use 500 for example) and apply that as torque to the plane.


I hope this will work well for your problem.

#4888407 [DX11] Rendering to multiple windows

Posted by mind in a box on 28 November 2011 - 07:26 AM

I'll give you the keyword: "Swapchains".

When you create one, it gets attached to a window and gives you a rendertarget for that window, which you can simply set and render to as you would do usually.

#4885923 overhead of wrapper struct

Posted by mind in a box on 20 November 2011 - 12:19 PM

Also, I'm not sure how to do in depth profiling. Currently I'm just measuring the amount of time taken for a certian part of the program using QueryPerformanceCounter

Try some code analysis-tool like "VerySleepy". It will tell you where the most time in your application is spend.

#4876775 Win32 Client Area Problem

Posted by mind in a box on 25 October 2011 - 09:09 AM

My desktop resolution is 1366x768, so is this stopping my 1024x768 window from being created with the requested size?

Exactly this. Try to resize any window larger than this. Just put some window half outside the screen and then try to drag the border to the other side.
It will stop when the windows size has reached your resolution.

You can create your window with the WS_POPUP style to have a window without borders which can fill out the whole screen resolution. Or, if you are using DirectX or something your can create a fullscreen swapchain.

#4864777 [DirectX11] Color addition problem in shaders

Posted by mind in a box on 22 September 2011 - 11:54 AM

Probably you should be using this to initialize your floats:

float4 Color = float4(0.1f, 0.1f, 0.1f, 1.0f);
(Notice the second "float4" in front of the brackets)

#4859066 DirectX11 DXUT11 GUI Showing french character

Posted by mind in a box on 08 September 2011 - 09:03 AM

Someone made a cool little library that uses Direct2D/DirectWrite to render glyphs but for the life of me I cannot remember what it was called, or how to find it. That would probably be a much better place to start.

Here you go: http://fw1.codeplex.com/

#4847922 Ambient occlusion simulation for AAA projects

Posted by mind in a box on 11 August 2011 - 03:12 PM

What it changes if i'll do photorealistic demo and developers ignore that the same way as now?

If your technique really works as you described and at the same quality you have shown, and even at a decent speed, then you created something awesome, indeed.

Can't you simply publish a paper and send this to some of the companies?
Wouldn't it be nice to have a few projects listened at the bottom where it has been used already?
Maybe some cool indie-game catches it up and those AAA-Devs get so see it in action just in time?

I've been monitoring this thread since your very first post. But I do not get your point.

Are you afraid that someone makes your technique "better" than you got it?
Think of the Crysis' SSAO. Everybody knows that this was the first in-game implementation, even though there are so many more now.

What it changes if i'll do photorealistic demo and developers ignore that the same way as now?

Who said that all developers ignore you? They're just angry because you're saying pretty much this to them:
"I have that awesome tech, but I won't tell you little guys how it works :)"

That makes the interested people kind of angry, don't you think?

#4832019 Why Did All My Programs Minimize At Once?

Posted by mind in a box on 06 July 2011 - 05:40 PM

Probably you're long dogging "Wut7" where hard catting one wut space pipes all the others?

#4824811 [XNA] [HLSL] Ambient light doesn't mix with point lighting

Posted by mind in a box on 18 June 2011 - 09:15 AM

Edit: I should have read TiagoCosta's posting more properly. Damn :)

If you enabled blending and you are running the shadercode you posted on a normal scene-mesh you may get problems with your lighting texture.

You can give this a try:
output.Colour.rgb = tex2D(colorSampler, input.TextureCoordinates).rgb * (AmbientLight.rgb + tex2D(lightSampler, input.TextureCoordinates).rgb);
output.Colour.a = 1;

#4819541 seamless blur

Posted by mind in a box on 04 June 2011 - 03:51 PM

In my Gaussian Blur I use for Blooming I have a parameter called "Deviation". Most Gaussian- If you put this higher, the effect gets wider. It won't give the best quality for blooming (Gets Box-Shaped), but since you want to blur a whole image one should only barely see any difference.

Here's my code in case you didn't implement that parameter:
HRESULT PostFXBase::GetSampleOffsets_Bloom(DWORD dwD3DTexSize,
                                            	float afTexCoordOffset[15],
                                            	float* avColorWeight,
                                            	float fDeviation, float fMultiplier )
	int i=0;
	float tu = 1.0f / (float)dwD3DTexSize;

	// Fill the center texel
	float weight = 1.0f * GaussianDistribution( 0, 0, fDeviation );
	avColorWeight[7] =  weight;

	afTexCoordOffset[7] = 0.0f;
	// Fill the right side
	for( i=1; i < 8; i++ )
    	weight = fMultiplier * GaussianDistribution( (float)i, 0, fDeviation );
    	afTexCoordOffset[7-i] = i * tu;

    	avColorWeight[7-i] = weight;

	// Copy to the left side
	for( i=8; i < 15; i++ )
    	avColorWeight[i] = avColorWeight[14-i];
    	afTexCoordOffset[i] = -afTexCoordOffset[14-i];

	return S_OK;

float PostFXBase::GaussianDistribution( float x, float y, float rho )
	float g = 1.0f / sqrtf( 2.0f * D3DX_PI * rho * rho );
	g *= expf( -(x*x + y*y)/(2*rho*rho) );

	return g;

#4811473 DX11 and compatibility with "old" graphic cards

Posted by mind in a box on 16 May 2011 - 09:55 AM

The Samples in the DirectX SDK don't specify the feature level 9, they use either 10, 10.1 or 11.

You should try to modify the sample so that it uses feature level 9. You can't simply change the 11 to a 9, you'll also have to modify some of the code, like the shader model of the loaded shaders.
Of course you can't use things like the shader model 4 or 5, or some other D3D10 or 11 features.

But if you use only the features available to D3D9 it should run just as fine as it ran with a D3D9-Card, even though you are using the D3D11 API.

Your best bet at maintaining compatibility with these old cards is to leave in the DX9 renderer.

You only need to leave in the D3D9-Renderer when you want compatibility with Windows XP. For everything else you can use the feature-levels.

#4770364 Jailbreaking iPod touch 4

Posted by mind in a box on 06 February 2011 - 05:29 AM

I've Jailbroken a few iPods/iPhones so far, so I can may answer some of your questions.

1. If you are lucky there is a jailbreak available for 4.2.1. All what you have to do is to google it.

2. If you use RedSn0w to jailbreak it you will have to completely restore your iPod with the Jailbroken firmware. AFAIK there was a tool called blackra1n which could to the jailbreak without loosing any of the data, but it was only available for version 3.x. Also there is a website called Jailbreakme.com for version 4.0 which you could open directly from your device. But those won't work with newer firmwares, so you have to restore it.
Maybe you can save your data somehow.

3.Don't know.

4. The only problem you will have is indeed if Apple releases an update. You can either leave your jailbroken older firmware on your device, or wait for the new one to be able to jailbreak and then restore your device again with it.

Hope that helps!

#4766637 Reconstructing view-space position from depth

Posted by mind in a box on 29 January 2011 - 08:48 AM

I've been trying to get SSAO working as well, also with reconstruction from depth. The results are looking pretty equal to yours...

Here's my reconstruction code ( Got it from here: http://mynameismjp.w...n-from-depth-3/)
// Screen quad vertex shader
PixelShaderInput wtVertexShader_quad_FrustumRay(VertexShaderInput Input )
	PixelShaderInput Output;


	float3 positionVS = mul(float4(Input.Pos, 1), invProj ).xyz;
	Output.Data = float4(positionVS.xy / positionVS.z, 1.0f, 1.0f);
	return Output;

float3 getPosition(float2 uv, PixelShaderInput Input)
	float Depth = TexUV(LightBuffer, uv).r;

	// Clamp the view space position to the plane at Z = 1
	float3 viewRay = Input.Data.xyz;

	float ProjectionA = Color.r;
	float ProjectionB = Color.g;

	float linearDepth = ProjectionB / (Depth - ProjectionA);
	return viewRay * linearDepth;

Edit: I got it working by using this function:
float3 VSPositionFromDepth(float Depth, float2 vTexCoord)
	// Get the depth value for this pixel
	float z = Depth; 
	// Get x/w and y/w from the viewport position
	float x = vTexCoord.x * 2 - 1;
	float y = (1 - vTexCoord.y) * 2 - 1;
	float4 vProjectedPos = float4(x, y, z, 1.0f);
	// Transform by the inverse projection matrix
	float4 vPositionVS = mul(vProjectedPos, invProjection );
	// Divide by w to get the view-space position
	return vPositionVS.xyz / vPositionVS.w;  

It is slower than the other, so I'd like to get the other one working. But you should try that code as well, as it can tell you if your depth-buffer or your reconstruction is the problem.

#579462 InputLayout creation error

Posted by mind in a box on 12 August 2010 - 02:08 PM

I'm building in instancing at the moment (My very first try) and I stumbled over an issue:


// Create our vertex input layout for the light spheres
const D3D10_INPUT_ELEMENT_DESC LightLayout[] =

V( g_pEffect10->GetTechniqueByIndex(2)->GetPassByIndex( 0 )->GetDesc( &PassDesc ) );
V( pd3dDevice->CreateInputLayout( LightLayout, sizeof(LightLayout)/sizeof(LightLayout[0]), PassDesc.pIAInputSignature,
PassDesc.IAInputSignatureSize, &g_pLightVertexLayout ) );

plus this:

LIGHT_VS_OUTPUT RenderLightVS( float4 vPos : POSITION,
float3 Normal : NORMAL,
float2 TexCoord : TEXCOORD0,
float4 LightColor_Range : LIGHT_COLOR_RANGE,
float3 LightPosition : LIGHT_POSITION,
uint InstanceId : SV_InstanceID)

complains about this:

D3D10: ERROR: ID3D10Device::CreateInputLayout: The provided input signature expects to read an element with SemanticName/Index: 'LIGHT_POSITION'/0, but the declaration doesn't provide a matching name. [ STATE_CREATION ERROR #163: CREATEINPUTLAYOUT_MISSINGELEMENT ]

It seems to find LIGHT_COLOR_RANGE, but why not LIGHT_POSITION?