Jump to content
  • Advertisement
Sign in to follow this  
raytracer03

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

This topic is 4518 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
I'd be curious if there was any advantage to doing a simple operation like this with the fixed function pipeline?



Share this post


Link to post
Share on other sites
I second jollyjeffers thought.
drop the main screen resolution to something like 1024x768.
and drop your texture resolution to 512 or 256.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!