Hi Steve,
I’m try to recreate the Linear Gradient as you’ve shared on Github repository, as that one unfortunately doesn’t work any more. I get prompted a "IO Read Error: Unknown data type encountered
Anyway, I want to make a heightmap shader. Basically a linear gradient between lowest and highest vertex of a mesh. Would you mind having a look where things go wrong? When I first compiled (saved the code) the first time it did show me a black/white display, but right after I tweaked a slider I get an error message: 1. Solution exception:Object reference not set to an instance of an object.
Heightmap.gh (6.3 KB)
Vertex
layout(location = 0) in vec3 _meshVertex;
layout(location = 1) in vec3 _meshNormal;
uniform mat4 _worldToClip;
out vec3 vertexPosition;
void main()
{
vertexPosition = _meshVertex;
gl_Position = _worldToClip * vec4(_meshVertex, 1);
}
Fragment
in vec3 vertexPosition;
out vec4 FragColor;
uniform vec3 meshMin;
uniform vec3 meshMax;
float normalizeHeight(float height, float minHeight, float maxHeight)
{
return (height - minHeight) / (maxHeight - minHeight);
}
void main()
{
float normalizedHeight = normalizeHeight(vertexPosition.z, meshMin.z, meshMax.z);
vec3 color = vec3(1.0 - normalizedHeight);
FragColor = vec4(color, 1.0);
}
I want to use a shader for it’s speed. For an extremely dense mesh the computing time using normal components is +/- 1 minute, so loking for alternative