# Fresnel shader not updating to cameras perspective?

**URL:** <https://discourse.threejs.org/t/fresnel-shader-not-updating-to-cameras-perspective/33654>\
**Category:** Questions\
**Tags:** camera-controls, glsl, shaders\
**Created:** [January 15, 2022, 2:24am UTC](https://discourse.threejs.org/t/fresnel-shader-not-updating-to-cameras-perspective/33654 "2022-01-15T02:24:26Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![vin-ni](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/vin-ni/32/5013_2.png) [@vin-ni](https://discourse.threejs.org/u/vin-ni)\
**Post date:** [January 16, 2022, 2:31pm UTC](https://discourse.threejs.org/t/fresnel-shader-not-updating-to-cameras-perspective/33654/4 "2022-01-16T14:31:21Z")

</div>

Is it possible, that there is a logical error in this part of the shader? That it maybe doesn’t calculate the right viewing direction if the camera and the object is offset?  
`vec3 viewDirectionW = normalize(cameraPosition - vPositionW);`  
When I set it to `vec3 viewDirectionW = vec3(0, 0, 1);` the shader is also just fixed. Maybe this calculation is not adapting to the cameras perspective?

Maybe one needs to pass `modelViewMatrix` to the shader because of the offset?

---

_[View the full topic](https://discourse.threejs.org/t/fresnel-shader-not-updating-to-cameras-perspective/33654)._
