szellmann / visionaray

A C++-based, cross platform ray tracing library

Home Page:https://vis.uni-koeln.de/visionaray.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Canonical way to get normal during surface assembly

szellmann opened this issue · comments

Provide a canonical way to obtain a surface (or vertex) normal when assembling surfaces. This would enable real user-defined geometry.

Partially addressed by commit 21cc07a. Some primitives have precalculated normals, some don't. get_surface() should probably be adapted so that the following versions of the get_normal() customization point are valid:

get_normal(hit_rec, prim);
get_normal(normlas, hit_rec, Primitive{});
get_normal(normals, hit_rec, Primitive{}, NormalBinding{});

Similar considerations apply to get_tex_coord().

63c20cf and address adf5861 this. I'm keeping the issue open because we should also get rid of the NormalBinding parameter in cases where this does not apply.

Solved via cebec90

Interface is now:

get_normal(hit_rec, prim);
get_normal(normals, hit_rec, Primitive{}, NormalBinding{});

i.e. with precalculated normals around, specifying the normal binding is mandatory.