Skip to content

TSL: add support for interpolation type qualifiers such as centroid #30576

@isaac-mason

Description

@isaac-mason

Description

It appears it's not currently possible to create a varying with TSL with a interpolation type qualifier, for example in GLSL, centroid.

centroid varying vec2 uvCentroid

In three.js WebGLRenderer projects I have used centroid to work around issues with texture bleeding when using texture atlases with MSAA.

Solution

Consider exposing common interpolation qualifiers via TSL.

I don't have good concrete API suggestions, but here's a simple example of how I'd use this:

const uvCentroid = uv().interpolation("centroid")
const color = texture(map, uvCentroid)

Alternatives

Some other general API for exposing common qualifiers.

Additional context

GLSL: Center or Centroid? (Or When Shaders Attack!) - https://opengl.org/pipeline/article/vol003_6
https://www.w3.org/TR/WGSL/#interpolation-sampling-centroid

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions