Reputation:
Here is a gist of a very simple setup: https://gist.github.com/ichbinadrian/4758155
My basic plan is to color the fragments in relation to the distance they have to the lowest or highest vertex. Like a mountain range. How can I save a value in the shader which I can use for later rounds of processing. Because the vertices will change position over time.
At least that is the plan. Because I can't figure out how to update the vertices and faces after I changed the values in attributes. It worked well when I changed the vertices position outside the shader and set xNeedUpdate = true.
Shaders logic are not that easy.
Upvotes: 2
Views: 825
Reputation: 104833
If you do this in your render loop:
attributes.displacement.needsUpdate = true;
your gist will work.
Upvotes: 2