- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
Hello,
Please I would like to know how are we supposed to generate the u,v coordinates when generating samples for a Subdivision Mesh object.
There are algorithms to generate stratified samples for triangles and quads, but Embree Subdivision Mesh objects use special encoded u,v coordinates. When a ray hits a Subdivision Mesh, the ray u,v coordinates are already encoded and ready to be used in rtcInterpolate, but how can I manually generate stratified u,v coordinates myself that are correctly encoded to be used with rtcInterpolate in a subdivision mesh?
Also, as now there is a new Embree v3-beta0 with a different API I would please like to know whether there is a different way to do this in Embree v3?
Thanks and best regards!
- Balises:
- Game Development
- Graphics
Lien copié
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
For quadrilateral faces the UV encoding is standard. For other faces (e.g. triangles), the subdivision surfaces section of the API describes the decoding of the UV coordinates:
const unsigned int l = floorf(0.5f*U);
const unsigned int h = floorf(0.5f*V);
const unsigned int i = 4*h+l;
const float u = 2.0f*fracf(0.5f*U)-0.5f;
const float v = 2.0f*fracf(0.5f*V)-0.5f;
Here i, is the i'th quadrilateral you get when doing a Catmull Clark subdivision step and u/v are the local hit coordinates of this quadrilateral. This encoding did not change with Embree 3.
Note that the 3 quadrilateral you get after subdividing a triangle using the Catmull Clark rules have same area. Thus you can just uniformly sample a random quadrilateral i, and then uniformly sample the local u/v coordinates. Then you need to invert the above decoding to encode the uv's and pass them to rtcInterpolate:
const unsigned int h = (i >>2) & 3;
const unsigned int l = i & 3;
const float U = 2.0f*l + 0.5f*u;
const float V = 2.0f*h + 0.5f*v;
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié

- S'abonner au fil RSS
- Marquer le sujet comme nouveau
- Marquer le sujet comme lu
- Placer ce Sujet en tête de liste pour l'utilisateur actuel
- Marquer
- S'abonner
- Page imprimable