How VERTEX.y work?

There is code: VERTEX.x += sin(TIME5.0 + VERTEX.y10.0) * 0.02;

why it distort shape? how it make difference from top to bottom?

The reason this causes distortion is because of what you’re adding into the equation for this test vs. the previous test.

  • VERTEX.x += sin(TIME) makes the entire sphere shift position uniformly. This is because every vertex is having exactly the same value added to it (its delta). Every vertex’s delta is the same, so the end result looks exactly like the start result, just shifted.
  • <previous> + VERTEX.y) makes the sphere shift in a non-uniform way because each vertex’s delta is now dependent on the Y value of that given vertex. Because we’re doing this with a sine wave, the result you get reflects that sine wave. Replace sin with some other mathematical function, and the result will look like that (depending on what it is of course; you might have to tweak the formula, but the point still stands).

If you were to write something like VERTEX.x = <formula> instead of +=, you might see a little more clearly how this works because you’re now doing the same thing in 2D, having scaled the sphere down to 0 on the X axis by doing this. Hope this makes sense =)

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms