How can I know what pixel is currently being computed in PS2.0 (HSLS) ?

Started by
4 comments, last by Metron 19 years, 6 months ago
How can I know what pixel is currently being computed in PS2.0 (HSLS) ? I want to sampler a color in screen-aligned texture , so I need a location of pixel that is being computed. Thank you.
Advertisement
You could pass the screen position through to the ps by adding a field to the VS_OUTPUT structure.
----------------------------------------http://www.sidema.be----------------------------------------
As far as I know, in HLSL you can not know. Every pixel is processed by the pixelshader, so in your HLSL code is must be a question of doing a test against the current pixel color and doing "whatever you want" if the test == true.

Correct me if I'm wrong ..
www.pokersniffer.org
You can always calculate the screen coordinates in the vertex shader and then pass them in to the pixel shader.
Donavon KeithleyNo, Inky Death Vole!
Sometimes it will be hard to calculate current coordinate exactly due to limited precision.
I wrote about it here.
Quote:Original post by Donavon Keithley
You can always calculate the screen coordinates in the vertex shader and then pass them in to the pixel shader.


That's what I meant and said ;)
----------------------------------------http://www.sidema.be----------------------------------------

This topic is closed to new replies.

Advertisement