The vertex shader ...

More
5 years 6 months ago #1 by Zonesystem
The vertex shader ... was created by Zonesystem
Hi,

I am rather curious about the 'standard' implementation of the vertexshader, the one that seems to produce 1 of three fixed points { (-1,1), (-1,-3) or (3,1) } depending on the vertex id. Why is it like that and how do the pixel shaders following it seem to be written to expect the texture coordinates spanning the entire screen actually get these texture coordinates, rather then just one of the three the vertex shader produces?

Or is this vertex shader just a placeholder?

I am no graphics programmer, but I have written a filter or two in HLSL for Virtualdub's gpushader plugin. I was hoping to write a 'shader' to enlarge a part of the view, namely the tiny icons of the target effect monitor in Guildwars 2.

Please Log in or Create an account to join the conversation.

More
5 years 6 months ago #2 by crosire
Replied by crosire on topic The vertex shader ...
All values you output in the vertex shader are interpolated before sent to the pixel shader (unless you add "nointerpolation" to the output parameter). The screen is defined to be between -1 and +1 in both x and y direction, so the example vertex shader creates a triangle that is bigger than the screen, filling it out. The values are chosen in a way that the interpolated texture coordinates on this triangle exactly match the desired 0 to 1 range on the visible screen range.
The following user(s) said Thank You: Zonesystem

Please Log in or Create an account to join the conversation.

More
5 years 6 months ago #3 by Zonesystem
Replied by Zonesystem on topic The vertex shader ...
I understand a little bit more now, thank you.

Please Log in or Create an account to join the conversation.