Intel® Embree Ray Tracing Kernels
Discussion forum on the open source ray tracing kernels for fast photo-realistic rendering on Intel® CPU(s)

Displacement map

Al_N_
Beginner
837 Views
Hi, can I use triangle geometry as oppose to quads for displacement mapping? If so, is there an example anywhere? Thank you.
0 Kudos
15 Replies
SvenW_Intel
Moderator
837 Views

No, the displacement mapping is only implemented for subdivision surfaces.

0 Kudos
Al_N_
Beginner
837 Views
ok, but can a subdivision surface be triangles instead of quads? In the displacement example, it uses quads and RTC_FACE_BUFFER is set with an array of only 4s and the documentation say that it can be 3 or 4 so I assume 3 is for triangles?
0 Kudos
SvenW_Intel
Moderator
837 Views

Yes you can render each triangle mesh also as subdivision surface. However, triangle meshes sometimes have large triangle fans that the Embree subdivision implementation can currently not handle. It will drop these fans during rendering.

0 Kudos
Al_N_
Beginner
837 Views
I see. I did a test, like a cube and a sphere made of triangles but at render time, each triangles are smaller and they look more round, each triangles have 6 edges instead of 3 and there is space in between each one, none ate touching anymore. Any ideas?
0 Kudos
BenthinC_Intel
Employee
837 Views

What values did you set for the edge tessellation levels and did you specify a displacement function for the simple cube and sphere geometry?

Embree's interpolation tutorial uses also some simple triangle-based geometry, so you could double-check the tutorial code with your implementation.

If there are still artifacts visible could you post some example code so that we can quickly reproduce the issue?

 

Thanks a lot,

Carsten.

 

0 Kudos
Al_N_
Beginner
837 Views
Thanks for your answer. All I did was use your displacement tutorial and changed the values in the arrays to reflect triangles as oppose to quad (indices too and changed face from 4 to 3). I exit the displacement function just to see if the cube will show as a cube, and also set the tessellation value from 256 to 0 and still each triangles are showing with 6 sides and smaller so there is a good visible gap between each triangles. If possible, could you modify the tutorial so it include a simple triangle mesh as oppose to a quad mesh and perhaps include it in the list of tutorials?
0 Kudos
SvenW_Intel
Moderator
837 Views

In line 65 of the displacement tutorial you can switch the cube to a triangle cube.

You are right that there are some cracks at the triangles, probably caused by wrong geometry normals. We will work on that.

0 Kudos
Al_N_
Beginner
837 Views
ok thanks
0 Kudos
Al_N_
Beginner
837 Views
Does it matter if there are duplicate vertices? like 3 per triangle and for a cube, 36 vertices and 36 indices?
0 Kudos
SvenW_Intel
Moderator
837 Views

You can have duplicate vertices, this will not be a problem.

0 Kudos
Al_N_
Beginner
837 Views
ok because I'm getting weird results. Here is the cube (triangulated) rendered using rtcNewTriangleMesh and how it turns out using rtcNewSubdivisionMesh without a displacement function and levels set to 0 or 256 same result... https://www.imageupload.co.uk/images/2015/08/19/untitled1.png https://www.imageupload.co.uk/images/2015/08/19/untitled2.png
0 Kudos
SvenW_Intel
Moderator
837 Views

Ok, your cube is rendered that way because you no not have shared vertices. If the vertices are not shared you still define a valid subdivision surface, however, each triangle will get subdivided separately of the other triangles, resulting in the subdivision you see. To properly render the cube you have to share all vertices.

0 Kudos
Al_N_
Beginner
837 Views
ah, ok, thank you very much. One more question, the PrimID Embree return is based on what exactly?
0 Kudos
BenthinC_Intel
Employee
837 Views

"primID" refers to the n-th primitive in an object. "geomID" to the n-th object.

0 Kudos
Al_N_
Beginner
837 Views
Thank you.
0 Kudos
Reply