Jump to content

  • Log In with Google      Sign In   
  • Create Account


D3D11 - Gamedev SSAO - Implementation


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 Migi0027   Crossbones+   -  Reputation: 1408

Like
0Likes
Like

Posted 15 March 2013 - 12:27 PM

Hi guys!

 

In the article from Gamedev - A Simple and Pratical Approach to SSAO they show some pixel shader code, and have some few variables there set by the engine. But they never say some experimental variables, and as I have no idea how they work, I don't know how to test this. Here's my shader for the Normal and Position textures:

 

cbuffer ConstantObjectBuffer : register (b0)
{
	float4x4 final;
	float4x4 rotation;
	float _depth;
	float _normal;
	float2 _space;
	float4x4 WorldView;
};

struct VOut
{
    float4 position : SV_POSITION;
	float4 normal : NORMAL;
	float4 PosData : TEXCOORD;
	float Depth : FOG;
};

VOut VShader(float4 position : POSITION, float4 normal : NORMAL)
{
    VOut output;

    output.position = mul(final, position);

	float4 wp = mul(position, final);

	// Final stuff
	output.Depth = mul(position, WorldView).z;
	output.PosData = mul(position, WorldView);
	output.normal = mul(normal, WorldView);

    return output;
}

float4 PShader(VOut input) : SV_TARGET
{
	if (_depth == 1)
		return float4(input.PosData.xyz, 1);
	else if (_normal == 1)
	{
		float3 viewSpaceNormalizedNormals = 0.5 * normalize (input.normal) + 0.5;
		return float4(viewSpaceNormalizedNormals, 1);
	}

	return float4(0, 0, 0, 1);
}

 

Now I think that that was ok.

 

Now in the hlsl code there is this variable from the pixel input called input.uv, is this literally the texture coordinated on the mesh being drawn or what? Because I can't see the vertex shader.

 

If somebody has implemented this please do show me the variables you gave to the shader, as it would help a lot! Ohh and between, the only thing I get from the hlsl code is black.

 

Thank You - PS. If you need some more information please say.



Sponsor:

#2 mgoss   Members   -  Reputation: 201

Like
0Likes
Like

Posted 20 March 2013 - 11:56 AM

I believe it's the UV of the fullscreen quad. Since it's a post processing effect. And most post processing effects use fullscreen quads. 






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS