• Advertisement
Sign in to follow this  

In Pixel shader

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

Is there a way to know what are the values of the pixel i am gonna render to, inside the pixel shader( ) method, without using a shader resource or effect variable?

Share this post


Link to post
Share on other sites
Advertisement
Only if you are using the pixel shader with an unordered access view, and not in a render target view. Otherwise, the only way that the pixel value is read by the pipeline is in the output merger before it does the blending function. What type of algorithm are you trying to get set up?

Share this post


Link to post
Share on other sites
in a 1D texture numObjects X 1, a pixel has the values that determine the position by time of the objecto only in one dimension,
so pixel.x =aceleration | pixel.y=velocity | pixel.z=initial position | pixel.z=mass
Then after some code of doing somethings... I have to modify those variables of an object(that means pixel), so i need to render to a pixel and know what are the values that that pixel had and another pixel of the texture too.

Share this post


Link to post
Share on other sites
Have you considered keeping the data in a structured buffer, and using the compute shader to do the updating? That might make it easier to work with the data, instead of trying to fit it all to the paradigm of the pixel shader.

Share this post


Link to post
Share on other sites
textures are often source of data for pixel shaders but the general technique is to bind this data as a texture sampler of the shader that reads them, and generating this data to texture is done by offscreen render target shader in a less recent pass.
If you realy need to have rendering to a target behave on the target content right away, only option I can think of is stencil buffer, but that is rather restricted and in your case it wouldn't apply.

Share this post


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

  • Advertisement