Skip to content

Deferred rendering inaccurate UV coordinate #130

@ottoville

Description

@ottoville

When I was writing a program inspired by deferred rendering sample, I noticed that current UV mapping algorithm have minimum resolution of 2x2 pixels.

Here is how to see prove that issue:
When adding following lines at the end of "fragmentDeferredRendering.wgsl" before return statement:

    let fragCoordI=vec2<i32>(round(coord.xy));
    if(fragCoordI.x > 500) {
      result=vec3<f32>(1.0,0.0,0.0);  //red
    }
    if(fragCoordI.x > 501) {
      result=vec3<f32>(0.0,1.0,0.0);  //green
    }
    if(fragCoordI.x > 502) {
      result=vec3<f32>(0.0,0.0,1.0); //blue
    }
    if(fragCoordI.x > 503) {
      result=vec3<f32>(1.0,1.0,0.0); //yellow
    }
    if(fragCoordI.x > 504) {
      result=vec3<f32>(0.0,1.0,1.0); //cyan
    }
    if(fragCoordI.x > 505) {
      result=vec3<f32>(1.0,0.0,1.0); //pink
    }

Expected result is 1px thin red, green, blue, yellow and cyan line to be drawn and right side of image to be pink.
Here is a screenshot from actual results:
image

When zooming to very close, it is visible that only green and yellow line is visible, both being 2px wide:
image

The 2x2 pixel resolution is also clearly visible when looking aliasing of edges of the squares in the sample page
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions