user19013678
user19013678

Reputation: 147

How to apply the new vertices to the light in a graph shader

I am doing a shader to "simulate" waves on a plane. Here is my subshader for doing the curves of the waves.

enter image description here

It works well, as you can see :

enter image description here

The problem is, the light reflection isn't applied on the modified verteces. It keeps reflecting light as if it was on a plane. How can I do to make it reflect on the waves and not on the plane.

**WHAT I TRIED : **

I tried to recalculate the normals of each verteces with the solution above :

enter image description here

This shader apply the circular wave subshader for positions of my vertices. And apply the same for the normals of the vertices. I consider that every normal should be 0, 0, 1 as they are all on the same Z coordinate but on different x and y. (does it make sense?) Then i asign the normals into the my vertex normal.

This gives this result which is not so bad but definitly isn't accurate (I think) on what it should render :

enter image description here

Am i missunderstanding something ? Is there a more simple way (or correct way) to do what I am trying to achieve?

Any help is welcomed !

Upvotes: 0

Views: 27

Answers (0)

Related Questions