Sign in to follow this  

D3D11 - Gamedev SSAO - Implementation

Recommended Posts

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(, 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.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this