Sign in to follow this  
n3Xus

[HLSL+DX10] Sharp distort texture causes low fps

Recommended Posts

I've encountered a bizzare problem-if I use a non-blurred normal map to make fullscreen distortion I get low fps-but if I use a blurred texture (both are the same size) I don't get low fps??? Here is the hlsl code that offsets the UV coords based on the distortion (I must warn you that I am a beginner so I didn't look up at how "the pros" do this, but I think this is more or less it(?) )
// This will hold the UV offset once it will be retrived from the distortion texture
float2 uvOffset;
// Distortion multiplier
float offsetPower=0.1f;
// Here the distortion is retrived from the texture
float4 uvOffPower=2.0f*distMap.Sample(sampler1,input.texcoord)-1.0f;
// Distortion is scaled down a bit
uvOffPower*=offsetPower;
// Here the final UV coords are comuputed by adding the distortion to the original texcoords
uvOffset=float2(uvOffPower[0],uvOffPower[1])+input.texcoord;

Here is the image I use (if the entire image is like the left part I get low fps, but not if it is like the right part) Shrani.si Why??

Share this post


Link to post
Share on other sites
It’s hard to say from this shader code fragment and the screenshot. It may be related to the sampler settings you use to read from your texture. Do you have activated the anisotropic filter there?

Share this post


Link to post
Share on other sites
One possiblity:
The blurred texture is probably using the texture cache better. Since the Normalmap is blurred the UV's will tend to be more closer to each other and more likely to be in cache.

A run through PIX would probably verify this.

The textures are the same size but are they saved in the same format? DXT3, RGB, DXT5NM?

Share this post


Link to post
Share on other sites
I'll have a look into it with PIX.

I've changed the sampler from Anisotropic to min_mag_mip_linear and I don't get low fps anymore :P

Thanks for suggestions

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