This commit is contained in:
parent
9cf8f73e18
commit
5cc94805f1
17 changed files with 670 additions and 237 deletions
34
src/pipelines/diffusion/diffuse.wgsl
Normal file
34
src/pipelines/diffusion/diffuse.wgsl
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
struct VertexOutput {
|
||||
@builtin(position) Position : vec4<f32>,
|
||||
@location(0) fragUV : vec2<f32>,
|
||||
}
|
||||
|
||||
@vertex
|
||||
fn vertex(@builtin(vertex_index) i : u32) -> VertexOutput {
|
||||
var pos = array<vec2<f32>, 4>(
|
||||
vec2(-1.0, 1.0),
|
||||
vec2(-1.0, -1.0),
|
||||
vec2(1.0, 1.0),
|
||||
vec2(1.0, -1.0),
|
||||
);
|
||||
|
||||
var output : VertexOutput;
|
||||
output.Position = vec4<f32>(pos[i], 0.0, 1.0);
|
||||
output.fragUV = output.Position.xy * 0.5 + 0.5;
|
||||
return output;
|
||||
}
|
||||
|
||||
|
||||
@group(0) @binding(0) var mySampler: sampler;
|
||||
@group(0) @binding(1) var TargetTexture : texture_2d<f32>;
|
||||
|
||||
|
||||
@fragment
|
||||
fn fragment(@location(0) fragUV: vec2<f32>) -> @location(0) vec4<f32> {
|
||||
// return vec4(1.0, 0.0, 0.0, 1.0);
|
||||
return mix(
|
||||
vec4(textureSample(TargetTexture, mySampler, fragUV).rgb, 0.1),
|
||||
vec4(1.0, 1.0, 1.0, 1.0),
|
||||
0.01
|
||||
);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue