Flat Shader according to World Position (Barycentric?)
Posted: Wed Mar 20, 2019 8:33 pm
Hi,
I am currently trying to do a flat shader (low poly) for procgen meshes (no UV mapping so far) where the colour changes according to the height in World Space.
So far I've referenced the Low Poly Water example to achieve the low poly effect.
But there doesn't seem to be an easy way to interact with the World on a per-Triangle basis instead of per-Vertex.
I was looking in to Barycentric Co-ordinates, but I'm unsure how to implement it in ASE. Not a good enough coder to interpret the one thread I found that touched upon it either. (If I did, would each vertex on a triangle be able to reference the center?)
Is there a simpler way or a hack for my specific usage? If not, how would I go about implementing Barycentric co-ordinates.
current flat shader 'spilling' over in to other triangles
https://imgur.com/a/nCDFypG
I am currently trying to do a flat shader (low poly) for procgen meshes (no UV mapping so far) where the colour changes according to the height in World Space.
So far I've referenced the Low Poly Water example to achieve the low poly effect.
But there doesn't seem to be an easy way to interact with the World on a per-Triangle basis instead of per-Vertex.
I was looking in to Barycentric Co-ordinates, but I'm unsure how to implement it in ASE. Not a good enough coder to interpret the one thread I found that touched upon it either. (If I did, would each vertex on a triangle be able to reference the center?)
Is there a simpler way or a hack for my specific usage? If not, how would I go about implementing Barycentric co-ordinates.
current flat shader 'spilling' over in to other triangles
https://imgur.com/a/nCDFypG