Jump to content

  • Log In with Google      Sign In   
  • Create Account


YuemariSan

Member Since 30 Oct 2012
Offline Last Active Nov 12 2012 05:51 PM
-----

Topics I've Started

Unity CG Shader, further explanation please!

07 November 2012 - 10:46 AM

Hi, I got a question about a shader I´ve found at Unity forums, I´m starting to get involve in the world of shaders and computer graphics, but
can´t find any guides to understand why this shader gets that effect:
The vertex shader:
v2f vert (appdata_base v)
{
v2f o;
// The vertex position in view-space (camera space)
float4 vPos = mul (UNITY_MATRIX_MV, v.vertex);
// Get distance from camera and scale it down with the global _Dist parameter
float zOff = vPos.z/_Dist;
// Add the offset with a quadratic curve to the vertex position
vPos += _QOffset*zOff*zOff;
o.pos = mul (UNITY_MATRIX_P, vPos);
o.uv = v.texcoord;
return o;
}

Could someone explain the part of the quadratic curve?, its the part that I really don´t get it.
Here is the link to the forum post:
http://answers.unity...ook-curved.html
Thanks in advance for any references or guides to understand the effect, so I can try a shader of this sort on my own.

Unity CG shader question

31 October 2012 - 01:17 AM

Hi, I got a question about a shader I´ve found at Unity forums, I´m starting to get involve in the world of shaders and computer graphics, but
can´t find any guides to understand why this shader gets that effect:

The vertex shader:

v2f vert (appdata_base v)
{
v2f o;
// The vertex position in view-space (camera space)
float4 vPos = mul (UNITY_MATRIX_MV, v.vertex);
// Get distance from camera and scale it down with the global _Dist parameter
float zOff = vPos.z/_Dist;
// Add the offset with a quadratic curve to the vertex position
vPos += _QOffset*zOff*zOff;
o.pos = mul (UNITY_MATRIX_P, vPos);
o.uv = v.texcoord;
return o;
}


Could someone explain the part of the quadratic curve?, its the part that I really don´t get it.

Here is the link to the forum post:

http://answers.unity...ook-curved.html

Thanks in advance for any references or guides to understand the effect, so I can try a shader of this sort on my own.

PARTNERS