lundi 20 novembre 2017

Random error noise in Metal fragment shader

my circle got distorted, bad.

I'm writing a fragment shader to do some image transformation and I'm seeing some random error noise, not sure what's up.

I'm merging two textures, one read with .read(gid); and one read using a sampler .sample(s, uv);

I created the sampler in Swift and passed it in to the shader.

Here's how I pass in the textures to the shader:

texture2d<float, access::write> outTexture [[ texture(0) ]],
texture2d<float, access::read> inTextureA [[ texture(1) ]],
texture2d<float, access::sample> inTextureB [[ texture(2) ]]

I get the initial uv coordinates like this:

float u = float(gid.x) / float(inTextureB.get_width());

Here's what I'm seeing:

Random error noise

Anyone have any clue what's going on?




Aucun commentaire:

Enregistrer un commentaire