Skip to content

Commit 78e5392

Browse files
authored
feat: Modify testrender to work with triangle meshes (#1865)
testrender was originally envisioned as a tiny example renderer that should only handle spheres/planes. Over time several groups have expressed the wish for it to handle arbitrary geometry instead. This PR replaces the sphere and quad primitives with triangle meshes. I am making use of the (embedded) rapidobj library to load models in the .obj format. The original .xml scene format remains, so that you can combine several models together as well as declare and assign the osl shader networks you want to these meshes. For backwards compatibility, spheres and planes are still supported via tessellation (you specify how many subdivisions you want). In the case of .obj scenes, the shader assignment can be done either by the mesh name or the material name. I am submitting this to get the review kickstarted. The history of commits includes some fairly large test scenes that should be squashed away to go into the main repo. Files over 50Mb are recommended to use git lfs, but we probably want to figure that out as a different task (possibly handle it via a separate repo). The handling of derivatives is not totally correct yet, but the behavior is compatible with the previous (incorrect) handling of derivatives we had before. --------- Signed-off-by: Chris Kulla <[email protected]>
1 parent 709c5ff commit 78e5392

File tree

82 files changed

+16340
-437
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+16340
-437
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ build
1010
*.log
1111
.vscode
1212
.envrc
13-
13+
.DS_Store

src/cmake/testing.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ macro ( TESTSUITE )
127127
# Run the test unoptimized, unless it matches a few patterns that
128128
# we don't test unoptimized (or has an OPTIMIZEONLY marker file).
129129
if (NOT _testname MATCHES "optix"
130+
AND NOT _testname MATCHES "render"
130131
AND NOT EXISTS "${_testsrcdir}/NOSCALAR"
131132
AND NOT EXISTS "${_testsrcdir}/BATCHED_REGRESSION"
132133
AND NOT EXISTS "${_testsrcdir}/OPTIMIZEONLY")
@@ -137,6 +138,7 @@ macro ( TESTSUITE )
137138
# services keeping unoptimized, unless it matches a few patterns that
138139
# we don't test unoptimized (or has an OPTIMIZEONLY marker file).
139140
if (NOT _testname MATCHES "optix"
141+
AND NOT _testname MATCHES "render"
140142
AND NOT EXISTS "${_testsrcdir}/NOSCALAR"
141143
AND NOT EXISTS "${_testsrcdir}/BATCHED_REGRESSION"
142144
AND NOT EXISTS "${_testsrcdir}/OPTIMIZEONLY"
@@ -159,6 +161,7 @@ macro ( TESTSUITE )
159161
# optimization, triggered by setting TESTSHADE_OPT env variable.
160162
# Skip OptiX-only tests and those with a NOOPTIMIZE marker file.
161163
if (NOT _testname MATCHES "optix"
164+
AND NOT _testname MATCHES "render"
162165
AND NOT EXISTS "${_testsrcdir}/NOSCALAR"
163166
AND NOT EXISTS "${_testsrcdir}/BATCHED_REGRESSION"
164167
AND NOT EXISTS "${_testsrcdir}/NOOPTIMIZE"
@@ -350,6 +353,7 @@ macro (osl_add_all_tests)
350353
raytype raytype-reg raytype-specialized regex-reg
351354
reparam reparam-arrays reparam-string testoptix-reparam
352355
render-background render-bumptest
356+
render-bunny
353357
render-cornell render-furnace-diffuse
354358
render-mx-furnace-burley-diffuse
355359
render-mx-furnace-oren-nayar

src/testrender/CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,12 @@
66
set (testrender_srcs
77
shading.cpp
88
simpleraytracer.cpp
9+
scene.cpp
10+
bvh.cpp
911
testrender.cpp)
1012

13+
find_package(Threads REQUIRED)
14+
1115
if (OSL_USE_OPTIX)
1216
list (APPEND testrender_srcs optixraytracer.cpp)
1317
set (testrender_cuda_srcs
@@ -69,7 +73,8 @@ add_executable (testrender ${testrender_srcs})
6973
target_link_libraries (testrender
7074
PRIVATE
7175
oslexec oslquery
72-
pugixml::pugixml)
76+
pugixml::pugixml
77+
Threads::Threads)
7378

7479
osl_optix_target (testrender)
7580

0 commit comments

Comments
 (0)