Jump to content
  • Advertisement
Sign in to follow this  
shumi12321

Pixel Shader resolution question

This topic is 2477 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

Hi,
I created quite an exhausting pixel shader which takes a long time to process per pixel (about 2-3 sec for one frame).

Since my pixel shader does very simple transformation operations (but iterated about hundred times), they cannot be more optimized.

So only solution to me is to reduce number of points for which pixel shader will call my procedure.

Is there a way to control that in Direct3D?
Is there a way to know for which points will Direct3D call my pixel shader procedure?

I'm using now Direct3D9 with pixel shader 3.0.

Thanks,
Lisur

Share this post


Link to post
Share on other sites
Advertisement
The pixel shader is called (on the best case) once per frame. So if you want the pixel shader to be called fewer times per frame you just have to reduce the render target size (be aware that you will lose quality).

Can you tell what does the pixel shader do? 2-3 secs per frame is A LOT...

Share this post


Link to post
Share on other sites
I want my pixel shader to be called only once per frame, but for fewer number of points so reducing the quality is exactly what I want.
I'm doing some nasty raymarching (100 samples per pixel).

Can you tell me how to reduce target size in D3D9?

Thanks :)

Share this post


Link to post
Share on other sites

Can you tell me how to reduce target size in D3D9?


You can specify the size of the back buffer in D3DPRESENT_PARAMETERS structure used to create the D3DDevice (in the BackBufferWidth and BackBufferHeight members of the structure).

Share this post


Link to post
Share on other sites
Hmmm...

So TiagoCosta says pixel shader is called once for every pixel projected on screen and Matias Goldberg says pixel shader is called once for every texel projected on rendered surface.

Can anyone confirm which one is right?

Surface on which my pixel shader is applied is made of quad (4 vertices) with only position and texture coordinates on vertices.

Thanks,
Lisur

Share this post


Link to post
Share on other sites
I said IN THE BEST CASE the pixel shader is called once per pixel on screen (that is size of the render target you're rendering to). But that is only true if there is no overdraw (for example when you draw a full screen triangle) so each pixel is only drawn once per frame. In your case, since your drawing a full screen quad there will be some pixel overdraw in the triangles side where the two triangles meet.

If your rendering to the back buffer you have to reduce the size of the back buffer, on the other hand, if your rendering to a different render target you have to reduce the size of the render target your rendering too. Edited by TiagoCosta

Share this post


Link to post
Share on other sites
Whattttt??????????? When did I say that?
Are you rendering a fullscreen quad?

What do you mean with "iterated about hundred times"?
You mean you have something like "for( i=0; i<100; ++i)" in your shader?

And what do you mean with "So only solution to me is to reduce number of points for which pixel shader will call my procedure."?
If you have a render target that is 512x512, it will process 4x less pixels than a 1024x1024 render target.

We're just trying to pin-point your cryptic post.

Share this post


Link to post
Share on other sites
Sorry for misunderstanding :(

Yes, you could say I'm rendering a fullscreen quad (quad is rendered a bit in front of near clipping plane).

What I'm trying to do is implement rendering of volumetric smoke as similar to chapter 30.3. Volumetric rendering on http://http.developer.nvidia.com/GPUGems3/gpugems3_ch30.html .
But it has to render only volumetrics without scenery.

So what I do is create a volumetric texture with smoke and a huge quad with texture coordinates.

Pixel shader is called when rendering quad and in every point pixel shader is called, I do raymarching trough volumetric texture and output resulting color to quad surface.

Yes, by iterating I meant for loop.

So what I want is reduce number of points where pixel shader routine will be called.

Proposed methods were reducing backbuffer dimensions and reducing texture dimensions so that's where misunderstanding happened.

Thanks,
Lisur

Share this post


Link to post
Share on other sites
After speed-reading that article I think you should reduce the number of samples you take... Do you loose that much quality doing so? Whats the size of the 3D texture your sampling? Maybe you can post your shader...

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!