Skip to main content
added 4 characters in body
Source Link
concept3d
  • 12.8k
  • 4
  • 46
  • 57

why does the vector from the light to the surface dependent on fragment position, but the vector from the camera to the surface is independent on the fragment?

The point is, because of the lighting equation. What you need is the vector from the light to the vertex, in other words the light direction relative to the vertex position. This is needed in order to take the dot product between the normal vector and the L vector. This is called the diffuse term and is calculated

float diffuseTerm = (N.L); Where N is the normal vector. L is the light direction. In case of directional light (infinitly far) L will be constant for all the vertices. If the light is not L will be calculated relative to each vertex.

Regarding the camera vector you are in the eye space, which means the camera position is (0,0,0) you can actually think of this

normalized(-fragment_eyespace_position) As this normalized

As this

normalized( (0,0,0)-fragment_eyespace_position)

Because in eye space the camera is actually (0,0,0)

why does the vector from the light to the surface dependent on fragment position, but the vector from the camera to the surface is independent on the fragment?

The point is, because of the lighting equation. What you need is the vector from the light to the vertex, in other words the light direction relative to the vertex position. This is needed in order to take the dot product between the normal vector and the L vector. This is called the diffuse term and is calculated

float diffuseTerm = (N.L); Where N is the normal vector. L is the light direction. In case of directional light (infinitly far) L will be constant for all the vertices. If the light is not L will be calculated relative to each vertex.

Regarding the camera vector you are in the eye space, which means the camera position is (0,0,0) you can actually think of this

normalized(-fragment_eyespace_position) As this normalized( (0,0,0)-fragment_eyespace_position)

Because in eye space the camera is actually (0,0,0)

why does the vector from the light to the surface dependent on fragment position, but the vector from the camera to the surface is independent on the fragment?

The point is, because of the lighting equation. What you need is the vector from the light to the vertex, in other words the light direction relative to the vertex position. This is needed in order to take the dot product between the normal vector and the L vector. This is called the diffuse term and is calculated

float diffuseTerm = (N.L); Where N is the normal vector. L is the light direction. In case of directional light (infinitly far) L will be constant for all the vertices. If the light is not L will be calculated relative to each vertex.

Regarding the camera vector you are in the eye space, which means the camera position is (0,0,0) you can actually think of this

normalized(-fragment_eyespace_position)

As this

normalized( (0,0,0)-fragment_eyespace_position)

Because in eye space the camera is actually (0,0,0)

added 228 characters in body
Source Link
concept3d
  • 12.8k
  • 4
  • 46
  • 57

why does the vector from the light to the surface dependent on fragment position, but the vector from the camera to the surface is independent on the fragment?

The point is, because of the lighting equation. What you need is the vector from the light to the vertex, in other words the light direction relative to the vertex position. This is needed in order to take the dot product between the normal vector and the L vector. This is called the diffuse term and is calculated

float diffuseTerm = (N.L); Where N is the normal vector. L is the light direction. In case of directional light (infinitly far) L will be constant for all the vertices. If the light is not L will be calculated relative to each vertex.

TheRegarding the camera vector onyou are in the other handeye space, which means the camera position is independent(0,0,0) you can actually think of any vertex.this

normalized(-fragment_eyespace_position) As this normalized( (0,0,0)-fragment_eyespace_position)

Because in eye space the camera is actually (0,0,0)

why does the vector from the light to the surface dependent on fragment position, but the vector from the camera to the surface is independent on the fragment?

The point is, because of the lighting equation. What you need is the vector from the light to the vertex, in other words the light direction relative to the vertex position. This is needed in order to take the dot product between the normal vector and the L vector. This is called the diffuse term and is calculated

float diffuseTerm = (N.L); Where N is the normal vector. L is the light direction. In case of directional light (infinitly far) L will be constant for all the vertices. If the light is not L will be calculated relative to each vertex.

The camera vector on the other hand is independent of any vertex.

why does the vector from the light to the surface dependent on fragment position, but the vector from the camera to the surface is independent on the fragment?

The point is, because of the lighting equation. What you need is the vector from the light to the vertex, in other words the light direction relative to the vertex position. This is needed in order to take the dot product between the normal vector and the L vector. This is called the diffuse term and is calculated

float diffuseTerm = (N.L); Where N is the normal vector. L is the light direction. In case of directional light (infinitly far) L will be constant for all the vertices. If the light is not L will be calculated relative to each vertex.

Regarding the camera vector you are in the eye space, which means the camera position is (0,0,0) you can actually think of this

normalized(-fragment_eyespace_position) As this normalized( (0,0,0)-fragment_eyespace_position)

Because in eye space the camera is actually (0,0,0)

Source Link
concept3d
  • 12.8k
  • 4
  • 46
  • 57

why does the vector from the light to the surface dependent on fragment position, but the vector from the camera to the surface is independent on the fragment?

The point is, because of the lighting equation. What you need is the vector from the light to the vertex, in other words the light direction relative to the vertex position. This is needed in order to take the dot product between the normal vector and the L vector. This is called the diffuse term and is calculated

float diffuseTerm = (N.L); Where N is the normal vector. L is the light direction. In case of directional light (infinitly far) L will be constant for all the vertices. If the light is not L will be calculated relative to each vertex.

The camera vector on the other hand is independent of any vertex.