[HLSL+DX10] Sharp distort texture causes low fps

Started by
2 comments, last by n3Xus 15 years, 8 months ago
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??
Advertisement
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?
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?

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

This topic is closed to new replies.

Advertisement