Jump to content

  • Log In with Google      Sign In   
  • Create Account

Shadow map Texture format


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
5 replies to this topic

#1 andyhansen   Members   -  Reputation: 105

Like
0Likes
Like

Posted 05 August 2011 - 01:52 PM

I'm currently working on implementing shadow mapping. I'm using DirectX 11 at feature level 9.1 since that is what my laptop supports. It seems the texture formats supported as render targets at this feature level is pretty limited.

The table here shows what is supported.
http://msdn.microsoft.com/en-us/library/ff471324%28v=vs.85%29.aspx

R8G8B8A8_UNORM
R8G8B8A8_UNORM_SRGB

These seem to be the only supported render target formats. This means that I can only store 8 bits of depth precision, rather than using the full 32. What would be ideal is if I could use R32_FLOAT.
Is there a way I can somehow use R8G8B8A8_UNORM or R8G8B8A8_UNORM_SRGB, but use all 32 bits to store a single value, rather than only 8 bits?

Sponsor:

#2 Tournicoti   Prime Members   -  Reputation: 684

Like
0Likes
Like

Posted 05 August 2011 - 02:29 PM

Hello

Did you effectively try to create your map with R32_FLOAT format ?
It seems odd that you can't use this format with DX11 : I use this format for my shadow map with DX10

Here's the HW support for DX11 (the page you mentioned is about DX10 formats, not DX11)

:)

#3 andyhansen   Members   -  Reputation: 105

Like
0Likes
Like

Posted 05 August 2011 - 02:34 PM

Hello

Did you effectively try to create your map with R32_FLOAT format ?
It seems odd that you can't use this format with DX11 : I use this format for my shadow map with DX10

Here's the HW support for DX11 (the page you mentioned is about DX10 formats, not DX11)

:)


I wasn't able to create a texture with R32_FLOAT, it would give me an error saying that that format was only supported for data buffers at feature level 9_1.

#4 MJP   Moderators   -  Reputation: 11761

Like
1Likes
Like

Posted 05 August 2011 - 02:54 PM

He's using FEATURE_LEVEL_9_1, which is a very limited subset of DX9 functionality.

Anway, it is possible to pack a single float value into multiple components of an R8G8B8A8 texture. Something like this should work for you:
float3 PackFloat(in float f)
{
	float3 packed;
	f *= 256.0f;
	packed.x = floor(f);
	f = (f - packed.x) * 256.0f;
	packed.y = floor(f);
	packed.z = f - packed.y;
	packed.xy *= 1.0f/ 256.0f
	return packed;
}

float UnpackFloat(float3 packed)
{
	const float3 conversion = float3(1.0f, 1.0f / 256.0f, 1.0f / (256.0f * 256.0f));
	return dot(packed, conversion);
}


#5 Tasty Texel   Members   -  Reputation: 1361

Like
0Likes
Like

Posted 06 August 2011 - 06:07 AM

@MJP: But shouldn´t it be 255.f instead of 256.f?

#6 andyhansen   Members   -  Reputation: 105

Like
0Likes
Like

Posted 06 August 2011 - 09:18 AM

Thanks for the quick replies guys! That's exactly the type of thing I was looking for. I was just wondering, would I not want to pack it into a float4, rather than a float3?




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