Remove useless alpha channel

This commit is contained in:
numzero 2024-12-30 16:24:25 +03:00
parent 0767eec826
commit 750dc8d744

View File

@ -36,7 +36,7 @@ fn on_vertex(in: Vertex) -> Varying {
@fragment @fragment
fn on_fragment(in: Varying) -> @location(0) vec4f { fn on_fragment(in: Varying) -> @location(0) vec4f {
return trace_fragment(in); return vec4(trace_fragment(in), 1.);
} }
fn sqr(v: vec3f) -> f32 { fn sqr(v: vec3f) -> f32 {
@ -62,10 +62,10 @@ fn to_sphere(center: vec3f, radius: f32, t: ptr<function, f32>) -> bool {
return true; return true;
} }
fn trace_fragment(in: Varying) -> vec4f { fn trace_fragment(in: Varying) -> vec3f {
seed(in.screen); seed(in.screen);
var result = vec4(0.0, 0.0, 0.0, 0.0); var result = vec3(0.0);
var color = vec3(1.0, 1.0, 1.0); var color = vec3(1.0, 1.0, 1.0);
pos = params.eye; pos = params.eye;
let off_px = vec2(rand_float(), rand_float()) - .5; let off_px = vec2(rand_float(), rand_float()) - .5;
@ -84,13 +84,13 @@ fn trace_fragment(in: Varying) -> vec4f {
} }
if (sphere == -1) { if (sphere == -1) {
let env = textureSampleLevel(env_texture, env_sampler, ray, 0.0); let env = textureSampleLevel(env_texture, env_sampler, ray, 0.0);
result += vec4(3.0 * color * env.xyz, 0.0); result += 3.0 * color * env.xyz;
break; break;
} }
let s = spheres[sphere]; let s = spheres[sphere];
pos += t * ray; pos += t * ray;
let normal = (pos - s.center) / s.radius; let normal = (pos - s.center) / s.radius;
result += vec4(color * s.emit_color, 0.0); result += color * s.emit_color;
color *= s.reflect_color; color *= s.reflect_color;
let diffuse = normal + rand_sphere(); let diffuse = normal + rand_sphere();
let specular = reflect(ray, normal); let specular = reflect(ray, normal);