1 registered members (AndrewAMD),
962
guests, and 7
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
How do I get the pixel's coords.
#418622
02/27/13 15:09
02/27/13 15:09
|
Joined: Jun 2009
Posts: 2,210 Bavaria, Germany
Kartoffel
OP
Expert
|
OP
Expert
Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
|
Hi, I've got a simple question:
How do I calculate / get the screen-space coordinates of a pixel in an object shader?
POTATO-MAN saves the day! - Random
|
|
|
Re: How do I get the pixel's coords.
[Re: Slin]
#418654
02/27/13 21:14
02/27/13 21:14
|
Joined: Jun 2009
Posts: 2,210 Bavaria, Germany
Kartoffel
OP
Expert
|
OP
Expert
Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
|
Thans a lot, vPos does the job:
float4 screenSpace : vPos // input semantic
float2 texSS = screenSpace.xy / vecViewPort.xy; // screenspace coordinates
POTATO-MAN saves the day! - Random
|
|
|
Re: How do I get the pixel's coords.
[Re: Kartoffel]
#418656
02/27/13 21:22
02/27/13 21:22
|
Joined: Mar 2006
Posts: 2,252
Hummel
Expert
|
Expert
Joined: Mar 2006
Posts: 2,252
|
Dont forget the half-pixel offset! That's what I use:
float2 calc_ScreenPos(float4 pPos)
{
return (float2(pPos.x,-pPos.y)/pPos.w+vecViewPort.zw)*0.5+0.5;
}
|
|
|
Re: How do I get the pixel's coords.
[Re: Hummel]
#418659
02/27/13 21:25
02/27/13 21:25
|
Joined: Jun 2009
Posts: 2,210 Bavaria, Germany
Kartoffel
OP
Expert
|
OP
Expert
Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
|
I just noticed some strange aliasing and found it out myself Again, thank you very much!
POTATO-MAN saves the day! - Random
|
|
|
Re: How do I get the pixel's coords.
[Re: Hummel]
#418685
02/28/13 15:48
02/28/13 15:48
|
Joined: Jun 2009
Posts: 2,210 Bavaria, Germany
Kartoffel
OP
Expert
|
OP
Expert
Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
|
But now I've got the problem that I need to render the deferred lights into a specific texture, not the camera's .bmap Does anyone know a good method to do this?
POTATO-MAN saves the day! - Random
|
|
|
|