make colormap respect color
This commit is contained in:
parent
059e98c3e3
commit
ca460bc0d9
|
|
@ -14,9 +14,10 @@ struct Varying {
|
|||
|
||||
@group(0) @binding(0) var<uniform> look: LookParams;
|
||||
|
||||
fn colormap(light: f32) -> vec3f {
|
||||
let brightness = 3. * (1. - 1. / (1. + light));
|
||||
return vec3(brightness, brightness - 1., brightness - 2.);
|
||||
fn colormap(light: vec3f) -> vec3f {
|
||||
let avg = dot(light, vec3f(1. / 3.));
|
||||
let scale = 1. / (1. + avg);
|
||||
return scale * light;
|
||||
}
|
||||
|
||||
@vertex
|
||||
|
|
@ -28,5 +29,5 @@ fn on_vertex(in: Vertex) -> Varying {
|
|||
|
||||
@fragment
|
||||
fn on_fragment(in: Varying) -> @location(0) vec4f {
|
||||
return vec4f(colormap(in.color.x), 1.0);
|
||||
return vec4f(colormap(in.color.rgb), in.color.a);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user