Welcome, Guest.
Username: Password: Remember me

TOPIC: The vertex shader ...

The vertex shader ... 1 year 8 months ago #1

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.
The administrator has disabled public write access.

The vertex shader ... 1 year 8 months ago #2

  • crosire
  • crosire's Avatar
  • Offline
  • Posts: 2452
  • Thank you received: 1391
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.
Cheers, crosire =)
The administrator has disabled public write access.
The following user(s) said Thank You: Zonesystem

The vertex shader ... 1 year 8 months ago #3

I understand a little bit more now, thank you.
The administrator has disabled public write access.