what's the fastest way to blend two big texture?

Started by
11 comments, last by ET3D 17 years, 10 months ago
I have two textures of the same size: 1024*1024*32bit, on the same object, and want to blend it with an alpha changing from 0 to 1, so the object looks like changing it's texture gradually from one to another. What's the best way to do this? I tried pixelshader 2.0a, the compiled shader just include 2 texld and 1 lrp, but on my Nvidia 5200 this short code already limits the speed down to 52fps. It runs on 1280*1024 fullscreen. Is "lrp" instruction really so costy?
Advertisement
The GeForce 5200 cards are not very fast. But as every GeForce 5XXX they will slow down even more if you use is full precession 2.0 pixel shader on it. You should try it with a 1.1 pixel shader.
Great! After setting the compile target to ps 1.4, the "lrp" instruction is
broke into some adds and muls, and it runs faster than ps 2.0!

But, after adding two more insturctions, ps 1.4 runs slower than ps 2.0.

Isn't there any cheaper way to do this texture blending?
Render stage?
Is that cheap to update alpha in every frame?
There is going to be little, if any, difference in performance between the fixed-function texture operators and a pixel shader. The driver is likely to translate both into similar GPU-specific microcode, so the GPU is essentially doing the same thing either way you choose to express it [smile]

Does it absolutely have to be a 1024x1024? Can you not drop it back to a 512 or 256? Dynamically scale it on those cards that lack the grunt to do the job properly?

hth
Jack

<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>

If possible try PS 1.1. This is the fastest way that a GF 5200 knows.
I'd be curious if there was any advantage to doing a simple operation like this with the fixed function pipeline?



I second jollyjeffers thought.
drop the main screen resolution to something like 1024x768.
and drop your texture resolution to 512 or 256.
Quote:Original post by don
I'd be curious if there was any advantage to doing a simple operation like this with the fixed function pipeline?

I think that the only advantage would be a programming one. If you're familiar with the FFP then using D3DTOP_BLENDFACTORALPHA might be a bit more convenient than a shader. In terms of performance I think than FFP and PS 1.1 will work the same. But it won't hurt to try.
I just tried FFP. It works! And fast enough.
But now I can't use pixel shader and FFP in the same drawprimitive().
Maybe they are using the same part of the hardware.
Someone said in mordern cards FFP is infact implemented in pixel shader.
But for my 5200, it seems that FFP is better.
Quote:Original post by raytracer03
I just tried FFP. It works! And fast enough.
But now I can't use pixel shader and FFP in the same drawprimitive().
Maybe they are using the same part of the hardware.
Someone said in mordern cards FFP is infact implemented in pixel shader.
But for my 5200, it seems that FFP is better.

Pixel shader and FFP do the same thing with different syntaxes. What do you mean about using them in the same drawprimitive?

As for texture stages vs. pixel shader on the 5200, I think that they should work at the same speed if you use ps1.1. However, it's possible that the code generated by the HLSL compiler isn't fully optimised, which could make the FFP faster.

This topic is closed to new replies.

Advertisement