Skip to content

Add utility class for generating AO Map #33

@gkjohnson

Description

@gkjohnson

Related to #32. Something like the following:

const uvGenerator = new UVGenerator();
uvGenerator.attributeName = 'uv2';
uvGenerator.generate( targetMeshes );

const aoGenerator = new AOMapGenerator();
aoGenerator.samples = 1000;
aoGenerator.attributeName = 'uv2';

const targetMeshes = [ ... ];
const texture = await aoGenerator.generate( renderer, targetMeshes, aoBvh );

Untested UV unwrapping logic using xatlas is here:

https://github.com/gkjohnson/three-gpu-pathtracer/blob/main/src/utils/UVUnwrapper.js

Originally from this Mozilla Spoke commit:

Hubs-Foundation/Spoke@9701d64

TODO

  • Write uv generator and ao map generator utilities
  • AO map must be flooded between triangles to avoid seams
  • Update example to show mesh with unwrapped UVs and live generating ao map
  • Update example to show 2d projection of ao map
  • Update example to take target map resolution

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions