Closed janhohenheim closed 1 year ago
It does make a difference.
mix(c1,c2,lambda)
internally is just calculated as (lambda c1 + (1-lambda) c2).
If lambda is outside of the range of (0,1), the resulting color can be weird, as it is not in between the colors.
Look at the alternative mesh in swap_grass_mesh
where points of the mesh can be lower than in the default mesh.
You'll see that the bottom part will becomes black. ( even though the bottom color is dark green)
Ah, I see. Could one then divide by the grass blade height to normalize it?
Yes, already tried that. The problem is that we don't know the highest point of the grass mesh. (at least when a custom mesh is used)
However you are right. The color gradient should be normalized over the blade
Aaaah I see!
Also, minor point I just noticed: the code right now colors over the y axis. This wouldn't work in a game like Super Mario Galaxy, where we have round planets. This is why generally in my 3D code, I pass an up
vector that is defaulted to Vec3::Y
instead :)
But that is quite a niche demand.
Closing this PR because of the discussion above
I see. This is true, however when using heightmaps in the future there is no way we could support round planets anyway ( I guess) If you see something like that you can also open a small issue, this way we can keep track of things like that for the future. (I tend to always forget something like that after a couple of days :smile: )
Hope I'm not missing anything here, otherwise I'm glad to learn :) The examples at least look the same to me, but I didn't check all of them.