Sign in to follow this  
gduser418

How to do simple filtering for 3D texture using Pixel Shader

Recommended Posts

I have a 3D texture and I want to filter each pixel of it. It is rather simple as I only need to read the pixel data for that pixel. So the pixel shader will like this:

 

outcolor = filter_val * input.color;

 

As this is a 3D texture, I think I need to create an object of the same size and draw triangles that will cover each pixel of the object. But this would be a lot of indices to draw with. Is this what I supposed to do with pixel shaders?

 

Is there a better way to do this? A compute shader might do this but I could not find any samples that would take a 3D texture input and output - only the buffers.

Share this post


Link to post
Share on other sites

It will be easier to do with a compute shader and binding the texture 3d as an UAV. you can even perform the update in place, while with a pixel shader and render target, you would need to generate a copy.

 

I am running on a platform that the shader model does not support UAV. Can someone help how can it be done in pixel shader? How the vertex shader can be setup? Do I have to draw a unit cube?

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