DX11 - Position Maps + Depth Maps

Started by
2 comments, last by Styves 10 years, 9 months ago

Hi guys,

how can you, in the most correct way, map normals and position to a texture, I'm guessing like this, but I think I'm wrong:

PS. Is depth maps the same as position maps?


VS:

output.NormalW = mul(normal, worldMatrix);
output.depthPosition = output.position;

PS:
float depth = (input.depthPosition.w / 1000.0f);
output.Depth = float4(depth, depth, depth, 1);

output.Normals = float4(input.NormalW, 1);

float depth = (input.depthPosition.w / 1000.0f);
output.Depth = float4(depth, depth, depth, 1);

When I mean, 'the correct way', I mean so that this texture can be used in e.g:

Game Dev's own: http://www.gamedev.net/page/resources/_/technical/graphics-programming-and-theory/a-simple-and-practical-approach-to-ssao-r2753

Thanks!

FastCall22: "I want to make the distinction that my laptop is a whore-box that connects to different network"

Blog about... stuff (GDNet, WordPress): www.gamedev.net/blog/1882-the-cuboid-zone/, cuboidzone.wordpress.com/

Advertisement

I'm sure you all know, but you're awfully quiet, again.

Am I doing something really stupid here? huh.png

FastCall22: "I want to make the distinction that my laptop is a whore-box that connects to different network"

Blog about... stuff (GDNet, WordPress): www.gamedev.net/blog/1882-the-cuboid-zone/, cuboidzone.wordpress.com/

output.NormalW = mul(float4(normal.xyz, 0.f), worldMatrix);

float depth = input.depthPosition.z / input.depthPosition.w;

Better to output depth linearly for better precision distribution.

float depth = input.depthPosition.w * inverseFarPlaneDistance;

This topic is closed to new replies.

Advertisement