diff --git a/.github/workflows/core.yml b/.github/workflows/core.yml
new file mode 100644
index 0000000..87db032
--- /dev/null
+++ b/.github/workflows/core.yml
@@ -0,0 +1,40 @@
+# The renderer core without Houdini (NOVA_CORE_ONLY, cmake/NovaStandalone.cmake):
+# nova_core and its Catch2 unit tests on Linux, built with GCC against system
+# libraries. The Hydra delegate, the Houdini package, nova_cli and the GPU
+# backend need Houdini on Windows and are not built here.
+name: core
+
+on:
+ push:
+ branches: [main]
+ pull_request:
+
+permissions:
+ contents: read
+
+concurrency:
+ group: core-${{ github.ref }}
+ cancel-in-progress: true
+
+jobs:
+ linux:
+ name: Linux, GCC (${{ matrix.preset }})
+ runs-on: ubuntu-24.04
+ timeout-minutes: 60
+ strategy:
+ fail-fast: false
+ matrix:
+ preset: [core, core-sanitize]
+ steps:
+ - uses: actions/checkout@v4
+ - name: Install Embree, oneTBB, OpenSubdiv and Catch2
+ run: |
+ sudo apt-get update
+ sudo apt-get install -y --no-install-recommends ninja-build libembree-dev libtbb-dev libosd-dev catch2
+ # The NanoVDB 32.6 headers are fetched by the configure step.
+ - name: Configure
+ run: cmake --preset ${{ matrix.preset }}
+ - name: Build
+ run: cmake --build --preset ${{ matrix.preset }}
+ - name: Test
+ run: ctest --preset ${{ matrix.preset }}
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 12df6d2..27e3c2d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,8 +1,21 @@
cmake_minimum_required(VERSION 3.26)
+# NOVA_CORE_ONLY builds the renderer without Houdini: nova_core, its unit tests
+# (nova_tests) and nova_bsdf_precompute, against system libraries (Embree 4,
+# oneTBB, OpenSubdiv, NanoVDB, Catch2; see cmake/NovaStandalone.cmake). The
+# Hydra delegate, the Houdini package, nova_cli and the GPU backend need
+# Houdini and Windows; they are the full build. It is the default away from
+# Windows, where the full build does not exist.
+if(CMAKE_HOST_WIN32)
+ set(_nova_core_only_default OFF)
+else()
+ set(_nova_core_only_default ON)
+endif()
+option(NOVA_CORE_ONLY "Build only nova_core, its unit tests and nova_bsdf_precompute, without Houdini" ${_nova_core_only_default})
+
# vcpkg provides Embree 4 and Catch2 (see vcpkg.json). Static libraries with
# the dynamic CRT keep extra DLLs out of the Houdini process.
-if(NOT DEFINED CMAKE_TOOLCHAIN_FILE)
+if(NOT DEFINED CMAKE_TOOLCHAIN_FILE AND NOT NOVA_CORE_ONLY)
# Prefer a regular vcpkg clone. Visual Studio developer prompts point
# VCPKG_ROOT at VS's bundled, read-only vcpkg (it has vcpkg-bundle.json),
# which resolves packages differently.
@@ -18,16 +31,23 @@ if(NOT DEFINED CMAKE_TOOLCHAIN_FILE)
set(CMAKE_TOOLCHAIN_FILE "${_nova_vcpkg_root}/scripts/buildsystems/vcpkg.cmake" CACHE FILEPATH "vcpkg toolchain")
endif()
endif()
-set(VCPKG_TARGET_TRIPLET "x64-windows-static-md" CACHE STRING "vcpkg triplet")
+if(NOT NOVA_CORE_ONLY)
+ set(VCPKG_TARGET_TRIPLET "x64-windows-static-md" CACHE STRING "vcpkg triplet")
+endif()
-# Houdini only ships release libraries, so Debug builds are not supported.
+# Houdini only ships release libraries, so Debug builds are not supported
+# (a core-only build has no such limit).
if(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Build type" FORCE)
endif()
-set(CMAKE_CONFIGURATION_TYPES "Release;RelWithDebInfo" CACHE STRING "Build configurations" FORCE)
+if(NOT NOVA_CORE_ONLY)
+ set(CMAKE_CONFIGURATION_TYPES "Release;RelWithDebInfo" CACHE STRING "Build configurations" FORCE)
+endif()
project(Nova VERSION 0.1.0 LANGUAGES CXX)
-message(STATUS "Nova: vcpkg toolchain ${CMAKE_TOOLCHAIN_FILE}")
+if(NOT NOVA_CORE_ONLY)
+ message(STATUS "Nova: vcpkg toolchain ${CMAKE_TOOLCHAIN_FILE}")
+endif()
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
@@ -36,11 +56,25 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreadedDLL")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
-include(NovaHoudini)
-include(NovaOptiX)
+if(NOVA_CORE_ONLY)
+ include(NovaStandalone)
+ set(NOVA_HAS_OPTIX OFF) # the GPU backend and the OptiX denoiser load NVIDIA's Windows DLLs
+else()
+ include(NovaHoudini)
+ include(NovaOptiX)
+endif()
find_package(embree 4 CONFIG REQUIRED)
+if(NOVA_CORE_ONLY)
+ # A system Embree: the features vcpkg.json asks for, as far as Embree's
+ # package config reports them (not the instance geometry).
+ foreach(_nova_embree_feature RAY_MASK FILTER_FUNCTION RAY_PACKETS GEOMETRY_TRIANGLE GEOMETRY_QUAD GEOMETRY_CURVE
+ GEOMETRY_POINT GEOMETRY_USER)
+ if(NOT EMBREE_${_nova_embree_feature})
+ message(FATAL_ERROR "Nova needs an Embree built with EMBREE_${_nova_embree_feature}=ON (${embree_DIR}).")
+ endif()
+ endforeach()
# A second TBB or an Embree DLL inside the Houdini process must not happen.
-if(NOT EMBREE_STATIC_LIB OR NOT EMBREE_TASKING_SYSTEM STREQUAL "INTERNAL" OR NOT EMBREE_RAY_MASK)
+elseif(NOT EMBREE_STATIC_LIB OR NOT EMBREE_TASKING_SYSTEM STREQUAL "INTERNAL" OR NOT EMBREE_RAY_MASK)
message(FATAL_ERROR "Nova needs a static Embree with INTERNAL tasking and ray masks (got static=${EMBREE_STATIC_LIB}, "
"tasking=${EMBREE_TASKING_SYSTEM}, ray_mask=${EMBREE_RAY_MASK}). Check vcpkg.json and the triplet.")
endif()
@@ -49,8 +83,10 @@ set(NOVA_INSTALL_DIR "${CMAKE_SOURCE_DIR}/dist" CACHE PATH "Houdini package outp
option(NOVA_BUILD_TESTS "Build unit tests" ON)
add_subdirectory(core)
-add_subdirectory(hydra)
-add_subdirectory(houdini)
+if(NOT NOVA_CORE_ONLY)
+ add_subdirectory(hydra)
+ add_subdirectory(houdini)
+endif()
add_subdirectory(tools)
if(NOVA_BUILD_TESTS)
diff --git a/CMakePresets.json b/CMakePresets.json
index 406d7d3..72c2965 100644
--- a/CMakePresets.json
+++ b/CMakePresets.json
@@ -24,12 +24,30 @@
"inherits": "base",
"generator": "Ninja",
"cacheVariables": { "CMAKE_BUILD_TYPE": "RelWithDebInfo" }
+ },
+ {
+ "name": "core",
+ "displayName": "Core only, without Houdini (Ninja, Release; system libraries)",
+ "generator": "Ninja",
+ "binaryDir": "${sourceDir}/build/${presetName}",
+ "cacheVariables": { "NOVA_CORE_ONLY": "ON", "CMAKE_BUILD_TYPE": "Release" }
+ },
+ {
+ "name": "core-sanitize",
+ "displayName": "Core only with AddressSanitizer and UBSan, float casts included (GCC or Clang)",
+ "inherits": "core",
+ "cacheVariables": {
+ "CMAKE_BUILD_TYPE": "RelWithDebInfo",
+ "CMAKE_CXX_FLAGS": "-fsanitize=address,undefined,float-cast-overflow -fno-sanitize-recover=all -fno-omit-frame-pointer"
+ }
}
],
"buildPresets": [
{ "name": "release", "configurePreset": "vs2022", "configuration": "Release" },
{ "name": "relwithdebinfo", "configurePreset": "vs2022", "configuration": "RelWithDebInfo" },
- { "name": "ninja", "configurePreset": "ninja" }
+ { "name": "ninja", "configurePreset": "ninja" },
+ { "name": "core", "configurePreset": "core" },
+ { "name": "core-sanitize", "configurePreset": "core-sanitize" }
],
"testPresets": [
{
@@ -42,6 +60,16 @@
"name": "ninja",
"configurePreset": "ninja",
"output": { "outputOnFailure": true }
+ },
+ {
+ "name": "core",
+ "configurePreset": "core",
+ "output": { "outputOnFailure": true }
+ },
+ {
+ "name": "core-sanitize",
+ "configurePreset": "core-sanitize",
+ "output": { "outputOnFailure": true }
}
]
}
diff --git a/README.md b/README.md
index 53fca51..664c852 100644
--- a/README.md
+++ b/README.md
@@ -74,8 +74,11 @@ Nova was built milestone by milestone. The plan's milestones M0 to M10 ([`docs/P
Karma-compatibility milestone M11 ([`docs/design/M11.md`](docs/design/M11.md)) are complete, with a design note per
milestone in [`docs/design/`](docs/design/). About 690 automated tests cover it: unit
tests, husk and command-line renders, statistical comparisons against Karma references, and isolated Houdini
-sessions. Known differences from Karma and remaining limitations are documented in the design notes and in
-[`docs/bug-audit-2026-11.md`](docs/bug-audit-2026-11.md).
+sessions. The current limitations are listed in [`docs/limitations.md`](docs/limitations.md); known differences
+from Karma are documented in the design notes and in [`docs/bug-audit-2026-11.md`](docs/bug-audit-2026-11.md).
+
+The renderer core (`nova_core`) and its unit tests also build on Linux without Houdini
+([Core only, without Houdini](#core-only-without-houdini)); the Hydra delegate and Nova XPU do not yet.
Requirements at run time:
@@ -133,7 +136,32 @@ MSVC toolchain.
See [`tools/installer/README.md`](tools/installer/README.md).
-**Tests.** The husk, reference and Houdini tests run Houdini in an isolated environment with an empty preference
+### Core only, without Houdini
+
+`nova_core`, its Catch2 unit tests (`nova_tests`) and `nova_bsdf_precompute` build against system libraries, with
+GCC on Linux; neither Houdini, Windows nor vcpkg is needed. This is the default configuration away from Windows
+(`-DNOVA_CORE_ONLY=ON`, [`cmake/NovaStandalone.cmake`](cmake/NovaStandalone.cmake)). On Ubuntu 24.04:
+
+```sh
+sudo apt install cmake ninja-build g++ libembree-dev libtbb-dev libosd-dev catch2
+cmake --preset core
+cmake --build --preset core
+ctest --preset core
+```
+
+- **Libraries:** Embree 4, oneTBB, OpenSubdiv and Catch2 3 from the system. The NanoVDB 32.6 headers (the version
+ Houdini 22.0 ships) are fetched from the OpenVDB repository at configure time; `-DNOVA_NANOVDB_INCLUDE_DIR=
`
+ names existing ones and `-DNOVA_FETCH_NANOVDB=OFF` turns the download off.
+- **Not built:** the Hydra delegate, the Houdini package, `nova_cli`, `nova_imgcmp` and the GPU backend. Their
+ tests, and the unit tests that need a GPU, do not run.
+- **Sanitizers:** `cmake --preset core-sanitize` builds the same targets with AddressSanitizer and UBSan (float
+ casts included; a finding stops the test).
+- **Continuous integration:** [`.github/workflows/core.yml`](.github/workflows/core.yml) runs both presets on every
+ pull request.
+
+### Tests
+
+The husk, reference and Houdini tests run Houdini in an isolated environment with an empty preference
directory, so installed packages never interfere and a running Houdini session is never touched. Regenerating the
Karma reference images needs a Karma license. See [`docs/reference.md`](docs/reference.md#tests) and
[`tests/reference/README.md`](tests/reference/README.md).
@@ -150,6 +178,8 @@ Karma reference images needs a Karma license. See [`docs/reference.md`](docs/ref
| `tests/` | Catch2 unit tests, husk and CLI test scenes, the Karma reference scenes and images, Houdini UI tests |
| `docs/` | The plan, design notes per milestone, research notes, benchmarks, the bug audit, the [reference](docs/reference.md) |
| `third_party/` | NVIDIA FLIP (header only) and the Hošek–Wilkie sky model data |
+| `cmake/` | Where the libraries come from: Houdini (`NovaHoudini.cmake`), CUDA and OptiX (`NovaOptiX.cmake`), or the system in a core-only build (`NovaStandalone.cmake`) |
+| `.github/workflows/` | Continuous integration: the core-only build and its unit tests on Linux |
## Documentation
@@ -157,7 +187,8 @@ Karma reference images needs a Karma license. See [`docs/reference.md`](docs/ref
features of each milestone with their measured differences to Karma, tools and tests.
- [`docs/design/`](docs/design/): design notes per milestone. M11 covers Karma's Solaris nodes, one note per package.
- [`docs/benchmarks.md`](docs/benchmarks.md): performance measurements, CPU and GPU.
-- [`docs/bug-audit-2026-11.md`](docs/bug-audit-2026-11.md): audits, fixes and remaining limitations.
+- [`docs/limitations.md`](docs/limitations.md): the current limitations in one place.
+- [`docs/bug-audit-2026-11.md`](docs/bug-audit-2026-11.md): audits, fixes and the limitations they left.
- [`docs/PLAN.md`](docs/PLAN.md): the original milestone plan, in German.
## License
diff --git a/cmake/NovaHoudini.cmake b/cmake/NovaHoudini.cmake
index 3c22182..f3066b5 100644
--- a/cmake/NovaHoudini.cmake
+++ b/cmake/NovaHoudini.cmake
@@ -6,6 +6,8 @@
# HFS Houdini installation root
# Houdini::* imported targets from $HFS/toolkit/cmake/HoudiniConfig.cmake
# Nova::TBB Houdini's oneTBB without the rest of the HDK
+# Nova::OpenSubdiv Houdini's OpenSubdiv (osdCPU)
+# Nova::NanoVDB Houdini's header-only NanoVDB
# Nova::OIIO Houdini's OpenImageIO (namespace HOIIO_*, not part of HoudiniConfig)
# Nova::MaterialX Houdini's MaterialX Core + Format (not part of HoudiniConfig)
@@ -35,6 +37,18 @@ target_include_directories(nova_tbb SYSTEM INTERFACE "${HFS}/toolkit/include")
target_link_libraries(nova_tbb INTERFACE Houdini::Dep::tbb)
target_compile_definitions(nova_tbb INTERFACE __TBB_NO_IMPLICIT_LINKAGE=1)
+# OpenSubdiv 3.7 comes from Houdini as a static /MD archive (libosdCPU_md.lib,
+# declared as Houdini::Dep::osdCPU) and NanoVDB 32.6 as headers; both have
+# their headers in $HFS/toolkit/include. A core-only build takes them from the
+# system instead (NovaStandalone.cmake).
+add_library(nova_opensubdiv INTERFACE)
+add_library(Nova::OpenSubdiv ALIAS nova_opensubdiv)
+target_include_directories(nova_opensubdiv SYSTEM INTERFACE "${HFS}/toolkit/include")
+target_link_libraries(nova_opensubdiv INTERFACE Houdini::Dep::osdCPU)
+add_library(nova_nanovdb INTERFACE)
+add_library(Nova::NanoVDB ALIAS nova_nanovdb)
+target_include_directories(nova_nanovdb SYSTEM INTERFACE "${HFS}/toolkit/include")
+
# OpenImageIO ships with Houdini (OpenImageIO_sidefx.dll in $HFS/bin) but has
# no target in HoudiniConfig. Its headers need Imath, which does.
foreach(_lib OpenImageIO OpenImageIO_Util)
diff --git a/cmake/NovaStandalone.cmake b/cmake/NovaStandalone.cmake
new file mode 100644
index 0000000..ad24e27
--- /dev/null
+++ b/cmake/NovaStandalone.cmake
@@ -0,0 +1,87 @@
+# The libraries of a build without Houdini (NOVA_CORE_ONLY): nova_core, its
+# unit tests and nova_bsdf_precompute against system packages. It defines the
+# same targets NovaHoudini.cmake does for the core:
+#
+# Nova::TBB oneTBB (find_package(TBB))
+# Nova::OpenSubdiv OpenSubdiv's osdCPU (3.5 or newer)
+# Nova::NanoVDB the header-only NanoVDB 32.6 or newer of ABI 32 (OpenVDB 11), the version Houdini 22.0 ships
+#
+# NanoVDB comes from NOVA_NANOVDB_INCLUDE_DIR or the system; when that is
+# missing or older, the headers are fetched from the OpenVDB repository
+# (-DNOVA_FETCH_NANOVDB=OFF turns the download off).
+
+find_package(TBB CONFIG REQUIRED)
+add_library(nova_tbb INTERFACE)
+add_library(Nova::TBB ALIAS nova_tbb)
+target_link_libraries(nova_tbb INTERFACE TBB::tbb)
+
+# OpenSubdiv's own package config names static archives that distributions
+# leave out (it then fails the configure), so the library is located by hand.
+find_path(NOVA_OPENSUBDIV_INCLUDE_DIR opensubdiv/version.h)
+find_library(NOVA_OPENSUBDIV_LIBRARY NAMES osdCPU)
+if(NOT NOVA_OPENSUBDIV_INCLUDE_DIR OR NOT NOVA_OPENSUBDIV_LIBRARY)
+ message(FATAL_ERROR "Nova: OpenSubdiv (osdCPU) not found. Install it (Debian/Ubuntu: libosd-dev) or set "
+ "NOVA_OPENSUBDIV_INCLUDE_DIR and NOVA_OPENSUBDIV_LIBRARY.")
+endif()
+add_library(nova_opensubdiv INTERFACE)
+add_library(Nova::OpenSubdiv ALIAS nova_opensubdiv)
+target_include_directories(nova_opensubdiv SYSTEM INTERFACE "${NOVA_OPENSUBDIV_INCLUDE_DIR}")
+target_link_libraries(nova_opensubdiv INTERFACE "${NOVA_OPENSUBDIV_LIBRARY}")
+
+option(NOVA_FETCH_NANOVDB "Fetch the NanoVDB headers if no usable version is installed" ON)
+set(NOVA_NANOVDB_FETCH_TAG "v11.0.0" CACHE STRING "Tag of github.com/AcademySoftwareFoundation/openvdb to fetch (NanoVDB 32.6)")
+
+# Sets _nova_nanovdb_ok when dir/nanovdb/NanoVDB.h is version 32.6 or a later
+# version of ABI 32 (the grids' binary layout, core/volume/grid.h).
+function(_nova_check_nanovdb dir)
+ set(_nova_nanovdb_ok OFF PARENT_SCOPE)
+ if(NOT EXISTS "${dir}/nanovdb/NanoVDB.h")
+ return()
+ endif()
+ file(STRINGS "${dir}/nanovdb/NanoVDB.h" _lines REGEX "^#define NANOVDB_(MAJOR|MINOR|PATCH)_VERSION_NUMBER [0-9]+")
+ foreach(_part MAJOR MINOR PATCH)
+ set(_${_part} 0)
+ foreach(_line IN LISTS _lines)
+ if(_line MATCHES "^#define NANOVDB_${_part}_VERSION_NUMBER ([0-9]+)")
+ set(_${_part} "${CMAKE_MATCH_1}")
+ endif()
+ endforeach()
+ endforeach()
+ set(NOVA_NANOVDB_VERSION "${_MAJOR}.${_MINOR}.${_PATCH}" PARENT_SCOPE)
+ # util/CreateNanoGrid.h and util/GridBuilder.h (the tests) moved in 32.7.
+ if(_MAJOR EQUAL 32 AND _MINOR GREATER_EQUAL 6 AND EXISTS "${dir}/nanovdb/util/CreateNanoGrid.h")
+ set(_nova_nanovdb_ok ON PARENT_SCOPE)
+ endif()
+endfunction()
+
+find_path(NOVA_NANOVDB_INCLUDE_DIR nanovdb/NanoVDB.h)
+_nova_check_nanovdb("${NOVA_NANOVDB_INCLUDE_DIR}")
+if(NOT _nova_nanovdb_ok)
+ if(NOVA_NANOVDB_INCLUDE_DIR)
+ message(STATUS "Nova: NanoVDB ${NOVA_NANOVDB_VERSION} at ${NOVA_NANOVDB_INCLUDE_DIR} is not 32.6 or newer of ABI 32")
+ endif()
+ if(NOT NOVA_FETCH_NANOVDB)
+ message(FATAL_ERROR "Nova: no NanoVDB 32.6 headers. Set NOVA_NANOVDB_INCLUDE_DIR to the directory that holds "
+ "nanovdb/NanoVDB.h (OpenVDB 11's nanovdb/ directory), or configure with -DNOVA_FETCH_NANOVDB=ON.")
+ endif()
+ include(FetchContent)
+ # Headers only: SOURCE_SUBDIR names no CMakeLists.txt, so OpenVDB's own
+ # build is never configured.
+ FetchContent_Declare(nova_openvdb
+ GIT_REPOSITORY https://github.com/AcademySoftwareFoundation/openvdb.git
+ GIT_TAG "${NOVA_NANOVDB_FETCH_TAG}"
+ GIT_SHALLOW ON
+ SOURCE_SUBDIR nova-headers-only)
+ FetchContent_MakeAvailable(nova_openvdb)
+ set(NOVA_NANOVDB_INCLUDE_DIR "${nova_openvdb_SOURCE_DIR}/nanovdb" CACHE PATH "NanoVDB include directory" FORCE)
+ _nova_check_nanovdb("${NOVA_NANOVDB_INCLUDE_DIR}")
+ if(NOT _nova_nanovdb_ok)
+ message(FATAL_ERROR "Nova: the fetched NanoVDB (${NOVA_NANOVDB_FETCH_TAG}) is not 32.6 or newer of ABI 32.")
+ endif()
+endif()
+add_library(nova_nanovdb INTERFACE)
+add_library(Nova::NanoVDB ALIAS nova_nanovdb)
+target_include_directories(nova_nanovdb SYSTEM INTERFACE "${NOVA_NANOVDB_INCLUDE_DIR}")
+
+message(STATUS "Nova: core-only build without Houdini (TBB ${TBB_VERSION}, OpenSubdiv at ${NOVA_OPENSUBDIV_LIBRARY}, "
+ "NanoVDB ${NOVA_NANOVDB_VERSION} at ${NOVA_NANOVDB_INCLUDE_DIR})")
diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt
index b67784d..a77a596 100644
--- a/core/CMakeLists.txt
+++ b/core/CMakeLists.txt
@@ -48,12 +48,11 @@ add_library(nova_core STATIC
target_include_directories(nova_core PUBLIC "${PROJECT_SOURCE_DIR}")
target_compile_features(nova_core PUBLIC cxx_std_20)
-# OpenSubdiv 3.7 comes from Houdini as a static /MD archive (libosdCPU_md.lib,
-# declared as Houdini::Dep::osdCPU); its headers are in $HFS/toolkit/include,
-# which Nova::TBB already adds.
+# TBB, OpenSubdiv and NanoVDB come from Houdini (cmake/NovaHoudini.cmake) or,
+# in a core-only build, from the system (cmake/NovaStandalone.cmake).
target_link_libraries(nova_core
- PUBLIC Nova::TBB
- PRIVATE embree Houdini::Dep::osdCPU
+ PUBLIC Nova::TBB Nova::NanoVDB
+ PRIVATE embree Nova::OpenSubdiv
)
if(NOVA_HAS_OPTIX)
target_link_libraries(nova_core PRIVATE Nova::OptiX)
@@ -114,4 +113,12 @@ if(MSVC)
# Generated tables: 9-digit literals round-trip to the stored floats.
set_source_files_properties(bsdf/tables/bsdf_tables.cpp PROPERTIES COMPILE_OPTIONS /wd4305)
target_compile_definitions(nova_core PUBLIC NOMINMAX _USE_MATH_DEFINES)
+elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(x86_64|AMD64|amd64)$")
+ # GCC and Clang: the instruction sets of /arch:AVX2 (the SIMD shading VM
+ # is in headers, hence PUBLIC), and no FMA contraction, as MSVC's
+ # /fp:precise and the GPU kernels' --fmad=false: one image on every build.
+ target_compile_options(nova_core PUBLIC -march=haswell -mtune=generic -ffp-contract=off)
+ target_compile_options(nova_core PRIVATE -Wall)
+else()
+ message(FATAL_ERROR "Nova: nova_core needs an x86-64 CPU with AVX2 (CMAKE_SYSTEM_PROCESSOR=${CMAKE_SYSTEM_PROCESSOR}).")
endif()
diff --git a/core/bake/bake.cpp b/core/bake/bake.cpp
index b4635ad..825e82d 100644
--- a/core/bake/bake.cpp
+++ b/core/bake/bake.cpp
@@ -140,10 +140,13 @@ void Baker::Surface::index(Vec2f origin) {
}
if (!(hi[0] >= 0.0f && hi[1] >= 0.0f && lo[0] <= 1.0f && lo[1] <= 1.0f))
return false;
- x0 = std::clamp(int(std::floor(lo[0] * float(g))), 0, g - 1);
- y0 = std::clamp(int(std::floor(lo[1] * float(g))), 0, g - 1);
- x1 = std::clamp(int(std::floor(hi[0] * float(g))), 0, g - 1);
- y1 = std::clamp(int(std::floor(hi[1] * float(g))), 0, g - 1);
+ // Clamped as floats: a corner far outside the tile (uv of 1e7, or
+ // infinite) is beyond int's range, and the triangle still covers
+ // every cell up to the tile's edge.
+ x0 = clampToInt(std::floor(lo[0] * float(g)), 0, g - 1);
+ y0 = clampToInt(std::floor(lo[1] * float(g)), 0, g - 1);
+ x1 = clampToInt(std::floor(hi[0] * float(g)), 0, g - 1);
+ y1 = clampToInt(std::floor(hi[1] * float(g)), 0, g - 1);
return true;
};
for (const Tri &t : tris) {
diff --git a/core/bsdf/surface.cpp b/core/bsdf/surface.cpp
index be5304b..09d0edf 100644
--- a/core/bsdf/surface.cpp
+++ b/core/bsdf/surface.cpp
@@ -1,6 +1,7 @@
#include "core/bsdf/surface.h"
#include
+#include
namespace nova {
diff --git a/core/geometry/subdiv.cpp b/core/geometry/subdiv.cpp
index 0178818..550d88f 100644
--- a/core/geometry/subdiv.cpp
+++ b/core/geometry/subdiv.cpp
@@ -415,7 +415,7 @@ bool tessellateSubdiv(const SubdivMeshDesc &d, int rate, MeshDesc &out, const Te
out.points.assign(numPoints * steps, Vec3f{0.0f, 0.0f, 0.0f});
out.normals.assign(numPoints * steps, Vec3f{0.0f, 0.0f, 0.0f});
out.indices.assign(numTris * 3, 0u);
- std::vector copySource(size_t(copyStart[size_t(numFaces)]), -1);
+ std::vector copySource(static_cast(copyStart[size_t(numFaces)]), -1);
// The output attributes, one per usable primvar, in the same order.
out.attributes.clear();
for (const Primvar &p : primvars) {
diff --git a/core/integrator/material_eval.cpp b/core/integrator/material_eval.cpp
index 1c9d4dc..9fe56e0 100644
--- a/core/integrator/material_eval.cpp
+++ b/core/integrator/material_eval.cpp
@@ -28,8 +28,8 @@ void fillAndRun(const Scene &scene, MaterialId material, const MaterialRecord &r
};
// Attribute bindings of the lanes (primvars and the tangent uv set).
- const AttributeRef *refs[N];
- const uint32_t *triangles[N];
+ const AttributeRef *refs[N] = {};
+ const uint32_t *triangles[N] = {};
if (!p.primvarBindings.empty() || p.tangentUv >= 0) {
for (int l = 0; l < N; ++l) {
const SurfaceHit &hit = hits[lane(l)];
@@ -221,7 +221,7 @@ float evaluateOpacity(const Scene &scene, MaterialId material, const SurfaceHit
Spectrum opacity = rec.resolved.c(surface_field::opacity);
float threshold = rec.resolved.f(surface_field::opacityThreshold);
for (const shading::OutputBinding &o : op->outputs) {
- float v[4];
+ float v[4] = {};
for (int k = 0; k < o.width; ++k)
v[k] = o.uniform ? rec.opacityUniforms[o.index + size_t(k)] : rows[o.index + size_t(k)];
if (o.field == surface_field::opacity)
diff --git a/core/integrator/renderer.cpp b/core/integrator/renderer.cpp
index 5004807..bfa47d8 100644
--- a/core/integrator/renderer.cpp
+++ b/core/integrator/renderer.cpp
@@ -863,7 +863,14 @@ bool Renderer::loadCheckpoint(const uint8_t *data, size_t size) {
return false;
const size_t n = m_film.pixelCount();
const bool oracle = progress[4] != 0 && m_settings.adaptive;
- if (oracle && (active.size() != n || checked.size() != n || half.size() != n || lumAlpha.size() != n))
+ // The oracle indexes each of its arrays by pixel (initOracle): a file
+ // with a shorter one is refused, not read past its end.
+ if (oracle)
+ for (const size_t size : {active.size(), evaluated.size(), noisy.size(), checked.size(), half.size(),
+ halfAlpha.size(), dsq.size(), lum.size(), dsqAlpha.size(), lumAlpha.size()})
+ if (size != n)
+ return false;
+ if (progress[3] == 0 || progress[3] > 65536u) // the fill stride: hosts divide by it
return false;
if (!m_film.load(film.data(), film.size()))
return false;
diff --git a/core/lights/lights.cpp b/core/lights/lights.cpp
index 9897770..72bf63d 100644
--- a/core/lights/lights.cpp
+++ b/core/lights/lights.cpp
@@ -147,6 +147,9 @@ LightData buildLightData(const LightDesc &desc) {
d.area = kTwoPi * radial * 2.0f * length(d.axisU);
break;
}
+ case LightType::Triangle: // the scene builds these itself (emissive triangles, volume emission)
+ case LightType::Volume:
+ break;
}
setupShaping(desc, d);
diff --git a/core/math/common.h b/core/math/common.h
index c2ef860..00ed1d1 100644
--- a/core/math/common.h
+++ b/core/math/common.h
@@ -50,4 +50,17 @@ constexpr uint32_t kInvalidId = 0xFFFFFFFFu;
NOVA_FORCEINLINE float fmin(float a, float b) { return (b < a || a != a) ? b : a; }
NOVA_FORCEINLINE float fmax(float a, float b) { return (b > a || a != a) ? b : a; }
+// float -> int with a defined result for every input. The plain conversion is
+// undefined beyond int's range and for NaN, and the devices disagree there:
+// x86 gives INT_MIN, CUDA saturates and turns NaN into 0.
+//
+// toInt truncates and gives INT_MIN wherever x86 did (out of range, NaN), so
+// shading on values run wild (a noise position of 1e12, an infinite octave
+// count) stays what the CPU rendered and is the same on the GPU.
+NOVA_FORCEINLINE int toInt(float x) {
+ return (x >= -2147483648.0f && x < 2147483648.0f) ? int(x) : (-2147483647 - 1);
+}
+// clampToInt truncates x clamped to [lo, hi]; a NaN gives lo.
+NOVA_FORCEINLINE int clampToInt(float x, int lo, int hi) { return x >= float(hi) ? hi : (x > float(lo) ? int(x) : lo); }
+
} // namespace nova
diff --git a/core/scene/scene.cpp b/core/scene/scene.cpp
index c8016f0..c1d3b4c 100644
--- a/core/scene/scene.cpp
+++ b/core/scene/scene.cpp
@@ -1400,15 +1400,6 @@ bool Scene::commit() {
namespace {
-// The inverse of the affine point map p -> x p.x + y p.y + z p.z + t
-// (Cramer's rule on the cofactors).
-Vec3f inversePoint(const Affine3f &a, Vec3f q) {
- const Vec3f d = q - a.t;
- const float det = a.determinant();
- const float inv = det != 0.0f ? 1.0f / det : 0.0f;
- return Vec3f{dot(d, cross(a.y, a.z)), dot(d, cross(a.z, a.x)), dot(d, cross(a.x, a.y))} * inv;
-}
-
Affine3f toAffine(const Xform34 &x) {
Affine3f a;
a.x = {x.c[0][0], x.c[0][1], x.c[0][2]};
diff --git a/core/shading/noise.h b/core/shading/noise.h
index f65d3fd..3b4c7bb 100644
--- a/core/shading/noise.h
+++ b/core/shading/noise.h
@@ -14,7 +14,11 @@
namespace nova::shading::noise {
-NOVA_INLINE int floorInt(float x) { return int(std::floor(x)); }
+// Defined for every x (toInt): INT_MIN beyond int's range and for NaN.
+NOVA_INLINE int floorInt(float x) { return toInt(std::floor(x)); }
+// The neighbour cell X + offset as the float the cell hashes take. A 64-bit
+// sum: X is INT_MIN for positions beyond int's range.
+NOVA_INLINE float cellCoord(int X, int offset) { return float(int64_t(X) + int64_t(offset)); }
NOVA_INLINE float floorFrac(float x, int &i) {
i = floorInt(x);
return x - float(i);
@@ -263,7 +267,7 @@ NOVA_INLINE void worley(Vec2f p, float jitter, float d[3], Vec2f &minpos) {
minpos = {0.0f, 0.0f};
for (int x = -1; x <= 1; ++x)
for (int y = -1; y <= 1; ++y) {
- const Vec3f t = cellV3(Vec2f{float(x + X), float(y + Y)});
+ const Vec3f t = cellV3(Vec2f{cellCoord(X, x), cellCoord(Y, y)});
const Vec2f c{float(x) + ((t.x - 0.5f) * jitter + 0.5f), float(y) + ((t.y - 0.5f) * jitter + 0.5f)};
const Vec2f diff = c - local;
const float dist = dot(diff, diff);
@@ -288,7 +292,7 @@ NOVA_INLINE void worley(Vec3f p, float jitter, float d[3], Vec3f &minpos) {
for (int x = -1; x <= 1; ++x)
for (int y = -1; y <= 1; ++y)
for (int z = -1; z <= 1; ++z) {
- const Vec3f t = cellV3(Vec3f{float(x + X), float(y + Y), float(z + Z)});
+ const Vec3f t = cellV3(Vec3f{cellCoord(X, x), cellCoord(Y, y), cellCoord(Z, z)});
const Vec3f c{float(x) + ((t.x - 0.5f) * jitter + 0.5f), float(y) + ((t.y - 0.5f) * jitter + 0.5f),
float(z) + ((t.z - 0.5f) * jitter + 0.5f)};
const Vec3f diff = c - local;
@@ -358,7 +362,7 @@ NOVA_INLINE Vec3f hsvToRgb(Vec3f hsv) {
if (s < 0.0001f)
return {v, v, v};
h = 6.0f * (h - std::floor(h));
- const int hi = int(std::trunc(h));
+ const int hi = toInt(std::trunc(h)); // a NaN hue: INT_MIN, the default case
const float f = h - float(hi);
const float p = v * (1.0f - s), q = v * (1.0f - s * f), t = v * (1.0f - s * (1.0f - f));
switch (hi) {
diff --git a/core/shading/ops.h b/core/shading/ops.h
index fa5ce11..ec5c9b6 100644
--- a/core/shading/ops.h
+++ b/core/shading/ops.h
@@ -319,7 +319,8 @@ NOVA_INLINE void evalProcedural(Op op, uint32_t imm, const float *a, const float
}
return;
case Op::Fractal: {
- const int octaves = int(b[0]) < 0 ? 0 : (int(b[0]) > 32 ? 32 : int(b[0]));
+ const int count = toInt(b[0]); // defined for a NaN or infinite input (INT_MIN: no octave)
+ const int octaves = count < 0 ? 0 : (count > 32 ? 32 : count);
const float lac = c[0], dimish = c[1];
auto f = [&](bool shifted) {
return dim == 2 ? fractal(shifted ? p2 + Vec2f{19.0f, 193.0f} : p2, octaves, lac, dimish)
diff --git a/core/texture/memory_sampler.cpp b/core/texture/memory_sampler.cpp
index 8b10097..99a0be1 100644
--- a/core/texture/memory_sampler.cpp
+++ b/core/texture/memory_sampler.cpp
@@ -85,13 +85,13 @@ void MemorySampler::sample2D(const TexSampler &sampler, const TexQuery &q, float
// Texel space: x right, y down from the top row.
const float x = s * float(tex.width), y = (1.0f - t) * float(tex.height);
if (slot.filter == TexFilter::Closest) {
- const int ix = int(std::floor(x)), iy = int(std::floor(y));
+ const int ix = toInt(std::floor(x)), iy = toInt(std::floor(y));
for (int c = 0; c < channels; ++c)
out[size_t(c) * q.count + l] = texel(ix, iy, c);
continue;
}
const float fx = x - 0.5f, fy = y - 0.5f;
- const int x0 = int(std::floor(fx)), y0 = int(std::floor(fy));
+ const int x0 = toInt(std::floor(fx)), y0 = toInt(std::floor(fy));
const float ax = fx - float(x0), ay = fy - float(y0);
for (int c = 0; c < channels; ++c) {
const float top = texel(x0, y0, c) * (1.0f - ax) + texel(x0 + 1, y0, c) * ax;
diff --git a/core/volume/volume_point.h b/core/volume/volume_point.h
index 78c3262..a87789e 100644
--- a/core/volume/volume_point.h
+++ b/core/volume/volume_point.h
@@ -38,7 +38,10 @@ NOVA_INLINE VolumePoint volumePointOf(const VolumeInputs &in, uint32_t depth) {
out.scattering = nonNegative(in.c(volume_field::scattering));
out.absorption = nonNegative(in.c(volume_field::absorption));
out.emission = in.c(volume_field::emission);
- const int start = int(std::lround(in.f(volume_field::modifierStartLevel)));
+ // The level is clamped before the conversion: lround is undefined out of
+ // range and for NaN (level 0 here), as is the level difference below.
+ const float level = in.f(volume_field::modifierStartLevel);
+ const int start = level != level ? 0 : int(std::lround(clampTo(level, -1048576.0f, 1048576.0f)));
if (int(depth) >= start) {
const float m = in.f(volume_field::extinctionModifier), e = m < 0.0f ? 0.0f : m;
if (e > 0.0f) {
diff --git a/docs/bug-audit-2026-11.md b/docs/bug-audit-2026-11.md
index 5990595..62f0c62 100644
--- a/docs/bug-audit-2026-11.md
+++ b/docs/bug-audit-2026-11.md
@@ -235,3 +235,22 @@ Also found: tests that compare light and BSDF sampling under a constant dome can
- The regression tests were run on the old code first: all fail there but V-3's (not real); V-1's scene crashed the test process (seen in its XPU test, which renders it on the CPU first). V-6's test also fails with its fix reverted in place.
- Golden check (nova_cli, 16 samples): all 38 reference scenes bit-identical to the pre-fix build (no reference scene has several suns on a shadowed atmosphere ground, volumes at the ground, a Pndc-dependent shadow, constrain-roughness with fake caustics, shadow-invisible surfaces with volumes or shells of more than 32 crossings).
- Tests after merging main (1152bfe): ctest 686/686 (`reference_cli_karma_atmosphere` skipped by design), `[gpu]` 49 test cases (6251 assertions) pass.
+
+## 9. Sanitizer pass on the core-only build
+
+The core builds without Houdini with GCC on Linux (`cmake --preset core`, the README's "Core only, without Houdini"). Its unit tests were run there for the first time under a second compiler, and under AddressSanitizer and UBSan with float-cast checks (`cmake --preset core-sanitize`); the checkpoint loader and the light path expression compiler were read and fuzzed for malformed input.
+
+- GCC 13, Release, before any change to the code: 392 test cases, 387 pass, the 5 that need a GPU skip. No test depends on MSVC's library or on its code generation.
+- AddressSanitizer and LeakSanitizer: no finding in those test cases. UBSan: the conversions of S-1, nothing else.
+- After the fixes, with the 6 new test cases: `ctest --preset core` and `ctest --preset core-sanitize` run 398 tests, 393 pass and 5 skip.
+- Light path expressions: 210 000 random expressions through `lpe::compile` and `lpe::matches` under the sanitizers, no finding.
+
+| ID | Severity | Defect | Fix | Regression test |
+|---|---|---|---|---|
+| S-1 | medium | Floats were converted to int beyond int's range or as NaN, which is undefined: x86 gives INT_MIN, CUDA saturates and turns NaN into 0, so CPU and GPU could shade such values differently. Sites: the noise cell of a position (`floorInt`), Worley's neighbour cells (`INT_MIN - 1` also overflowed), `hsvToRgb`'s hue sector, the fractal opcode's octave count, the volume shader's multiple-scattering start level (`lround`), `MemorySampler`'s texel coordinates (`core/shading/noise.h`, `core/shading/ops.h`, `core/volume/volume_point.h`, `core/texture/memory_sampler.cpp`) | `toInt` (`core/math/common.h`): truncation, INT_MIN out of range and for NaN, what the CPU gave. Worley sums its neighbour cells in 64 bits. The start level is clamped before `lround` (NaN: level 0). In-range values convert as before. | "toInt and clampToInt are defined for every float", "Noise is defined for positions beyond int's range", "fractal noise with an infinite or NaN octave count has no octave", "The multiple-scattering start level is defined for every float"; the `core-sanitize` run of "Random programs agree bit for bit in every executor" |
+| S-2 | medium | The Texture Baker's lookup grid converted a triangle's cell range to int before clamping it: a UV corner past 2^31 grid cells (u = 1e9 with 17 triangles, from u = 1e6 with the full 2048 grid) became cell 0, the range was empty and the triangle was in no cell, so texels inside it found nothing (`core/bake/bake.cpp`, `Baker::Surface::index`) | Clamped as a float first (`clampToInt`). | "Bake: a triangle with a corner far outside the tile is still found" (fails before the fix) |
+| S-3 | low | `Renderer::loadCheckpoint` checked four of the adaptive sampler's ten per-pixel arrays against the pixel count; a file with a shorter `evaluated`, `noisy`, `halfAlpha`, `dsq`, `lum` or `dsqAlpha` array loaded and the oracle read past its end. A fill stride of 0 loaded too (`core/integrator/renderer.cpp`) | All ten arrays must have one value per pixel; a stride of 0 or beyond 65536 is refused. | "Checkpoints with a short adaptive-sampling array are refused" (the old loader accepts 6 of the 10 shortened files and the zero stride) |
+
+Portability fixes GCC needed: a vector constructor in `core/geometry/subdiv.cpp` that GCC parses as a function declaration, and `` in `core/bsdf/surface.cpp`.
+
+Not covered by this pass: the GPU kernels and the Windows build. `toInt` and `clampToInt` are plain inline functions in a kernel-side header, but neither `kernels.cu` nor the MSVC build was compiled here, and no `[gpu]` test ran. The Hydra delegate, the bridges and the installer were not built or run under a sanitizer.
diff --git a/docs/design/M10.md b/docs/design/M10.md
index 215858f..31bfb2e 100644
--- a/docs/design/M10.md
+++ b/docs/design/M10.md
@@ -105,6 +105,7 @@ Each step builds, passes the full `ctest`, renders and is tested against the CPU
- `core/integrator/material_lane.h`: the per-hit inputs of shading programs (globals, the tangent frame, primvar fetches) as host+device functions; `fillAndRun` (the CPU's 8/16/32-lane evaluation) calls them.
- `tests/cuda/kernel_headers.cu` compiles the light headers (sampling, the tree, emissive triangles, the light queries of BSDF rays), the subsurface walk, the hit reconstruction on views and the material lane functions as device code. Found on the way: `std::isfinite` in the rect light's spherical sampling, `std::min` in `appendClosure` and `MajorantLayout::index` were not device code.
- The reference scenes render bit-identically before and after (33 scenes, every AOV part, 16 samples; scratch `golden.ps1`).
+- **Float-to-int conversions (after M11, bug audit S-1):** a plain cast of a float beyond int's range or of a NaN is undefined, and the devices differ there (x86: INT_MIN; CUDA: the saturated value, 0 for NaN), which D11's "the same decisions" did not cover. Shared code converts with `toInt` (INT_MIN, the CPU's result) or `clampToInt` (`core/math/common.h`): noise cells, the hue sector, octave counts, the volume modifiers' start level. Found by UBSan on the core-only build; the kernels were not compiled or run in that pass.
### G1 First GPU image
diff --git a/docs/design/M11-P6.md b/docs/design/M11-P6.md
index 6a238a9..f9027f3 100644
--- a/docs/design/M11-P6.md
+++ b/docs/design/M11-P6.md
@@ -99,7 +99,11 @@ finished render.
Nova (`hydra/products.{h,cpp}`, `renderDelegate.cpp`, `Renderer::saveCheckpoint/loadCheckpoint`,
`Film::save/load`): the file holds a header with a signature (camera matrices, seed), the film (every plane) and the
-progress (passes, level, the adaptive oracle's state). The placeholder var is not warned about.
+progress (passes, level, the adaptive oracle's state). The placeholder var is not warned about. A file is read only
+if it fits the render: the signature, the adaptive setting, the film's size, its LPE outputs and every plane's key,
+each of the oracle's ten per-pixel arrays with one value per pixel, and a fill stride from 1 to 65536 (bug audit
+S-3: six of the arrays and the stride were not checked). Any other file is refused with a message and the render
+starts over.
## 6. Deep camera maps (measured)
diff --git a/docs/design/M11-P8.md b/docs/design/M11-P8.md
index 0ec5da1..47053f4 100644
--- a/docs/design/M11-P8.md
+++ b/docs/design/M11-P8.md
@@ -113,7 +113,9 @@ others.
- **Core, `core/bake/`.** `Baker` prepares the bake meshes in world space (their first instance at the frame):
triangles with positions, normals, texture coordinates, per-point bias/maximum distance and tangent frames, and a
- grid over the tile's texture space. `generate()` turns a wave's pixel samples (the pixel filter's offsets, the
+ grid over the tile's texture space (a triangle is in every cell its texture-space bounds touch; the bounds are
+ clamped to the tile as floats, so a corner far outside it, u = 1e9, keeps the triangle in the cells up to the
+ tile's edge: bug audit S-2). `generate()` turns a wave's pixel samples (the pixel filter's offsets, the
render's Sobol sampler) into low points and shading points (trace rays as measured; cage offset, topology and UV
cages; UV Match through the high meshes' own grid; Single), `accumulate()` adds the maps to the film's utility
planes, which in a bake hold per-sample sums (new `UtilityKind::Bake*` kinds; the plain utilities, primvars and
diff --git a/docs/design/M3.md b/docs/design/M3.md
index 6f3786d..f18dcdf 100644
--- a/docs/design/M3.md
+++ b/docs/design/M3.md
@@ -36,7 +36,7 @@ document wins.
| K11 | **Network source:** read `HdMaterialSchema` from the terminal scene index (keeps `colorSpace`/`typeName`, terminal output names, `nodeTypeInfo`), `GetMaterialResource` as fallback. Context chain per material `nova → kma → mtlx → ""` (universal); `vex` joins in M5. | all three; without `kma` the Karma Material Builder renders nothing |
| K12 | **All numeric primvars are uploaded** as generic mesh attributes (and instance attributes), remapped per (mesh slot, material) at commit. GeomSubsets give per-triangle material slots. Material edits never touch meshes or the BLAS. | all three; `HdMaterialNetwork::primvars` is always empty, material edits never re-sync meshes |
| K13 | **All ωo-dependent factors** (layer albedos, compensation, thin-film albedo, lobe picks) are computed once in `buildSurfaceClosure`; `evalClosure`/`sampleClosure` need no LUT lookups. | gpu-perf |
-| K14 | **GPU guard from the start:** a compile-only `nvcc` target (label `cuda`) includes every kernel-side header (`core/math`, `core/bsdf`, `core/shading/{program,ops,vm_lane,noise}.h`, `core/texture`). Kernel-side code has no STL containers, virtuals, exceptions, recursion, host statics or `double`; fixed sizes only (8 lobes, ≤ 4 texture channels, bounded extension words). | gpu-perf; enforces PLAN.md's GPU rule continuously |
+| K14 | **GPU guard from the start:** a compile-only `nvcc` target (label `cuda`) includes every kernel-side header (`core/math`, `core/bsdf`, `core/shading/{program,ops,vm_lane,noise}.h`, `core/texture`). Kernel-side code has no STL containers, virtuals, exceptions, recursion, host statics or `double`; fixed sizes only (8 lobes, ≤ 4 texture channels, bounded extension words). A float that a shader or the scene drives is converted to an int with `toInt` or `clampToInt` (`core/math/common.h`), never with a plain cast: out of int's range and for NaN the cast is undefined, and x86 (INT_MIN) and CUDA (saturation, NaN to 0) disagree there (bug audit S-1). | gpu-perf; enforces PLAN.md's GPU rule continuously |
| K15 | **Register file:** rows of floats, `R[row·32 + lane]`. `CompileOptions::maxRows` = 1024 on the CPU; the compiler warns above 256 ("exceeds the M10 GPU limit"). Overflow → next context, else default material, with a warning. | fidelity + incremental (gpu-perf: hard 256) |
| K16 | **Energy LUTs** (~680 KB, float32): `ggxE` 32², `ggxEavg` 32, `ggxABC` 32²×3, `dielRT`/`dielRTinv`/`dielR` 32³, `fAvgDiel` 64, `charlieE` 32², thin-walled sheet `thinRT` (E_R' + E_T') / `thinR` (E_R') 32³. Generated offline by `tools/nova_bsdf_precompute` from the runtime sampling code (double accumulation, Owen-scrambled Sobol, TBB), committed with a generator hash. Layering albedo of a compensated dielectric R = `E_R/E_RT`. Delta when `max(αx, αy) < 1e-3`. | all three (conflicts resolved as in plan-incremental §0) |
| K17 | **Shade stage:** per bounce a stable counting sort of hits by `MaterialId`, then 32-lane chunks per material; `runLane` for groups of ≤ 2; varying-free materials skip the VM. Samples depend only on (pixel, index, stream), so sorting never changes images. | all three |
@@ -309,7 +309,7 @@ Each step builds, passes the full `ctest`, leaves the renderer working and adds
| **M3.11 Opacity** | `opacityCode`, accel filter hook, per-mesh enable, first-hit seeds, `opacityThreshold` | opacity 0.5 sphere → color/alpha 0.75 (3e-3); checker cut-out exact coverage; shadow of a 0.5 plane = 0.5; repeated filter calls agree; opaque scenes: rays/s unchanged (±3 %) |
| **M3.12 UsdPreviewSurface, references, performance, docs** | `SurfaceModel::UsdPreview`, `mtl_diffuse`, `mtl_kma_context`, `gen_albedo_ref.py`, `karma_albedo_probe.py`, performance report, README, final Solaris check | Preview (0.5139, 0.2733, 0.1530) and 0.2062 ± 2 %; auto-generated preview of a VEX-builder material renders; albedo probes vs `albedo_ref.json` 0.3 % abs; performance gates (section 8) |
-Notes on M3.7 as built: the procedurals (`Noise`, `Fractal`, `CellNoise`, `Worley`, HSV) run per lane in every executor (a gather/scatter around one scalar implementation), so the batch executors are bit-identical to `execute<1>` by construction. An AVX2 noise kernel is left to the M3.12 performance step, if the benchmarks call for it. The `mtl_nodes` probe grid is deterministic in both renderers (Nova point filter, Karma box filter at scale 1e-6) and compares per pixel (`nova_imgcmp --pixel-tol`, 32-bit reference): 24 tiles, worst pixel at 0.28 of the allowed difference. `rgbtohsv` gets saturated input colors there, because the hue is ill-conditioned near grey (an ulp of noise moves it by 1e-4).
+Notes on M3.7 as built: the procedurals (`Noise`, `Fractal`, `CellNoise`, `Worley`, HSV) run per lane in every executor (a gather/scatter around one scalar implementation), so the batch executors are bit-identical to `execute<1>` by construction. An AVX2 noise kernel is left to the M3.12 performance step, if the benchmarks call for it. A position beyond int's range, or a NaN, has the cell INT_MIN on every device (`floorInt` through `toInt`; Worley sums its neighbour cells in 64 bits), and an infinite or NaN octave count gives no octave: what the CPU rendered before these conversions were defined (bug audit S-1, `docs/bug-audit-2026-11.md` section 9). The `mtl_nodes` probe grid is deterministic in both renderers (Nova point filter, Karma box filter at scale 1e-6) and compares per pixel (`nova_imgcmp --pixel-tol`, 32-bit reference): 24 tiles, worst pixel at 0.28 of the allowed difference. `rgbtohsv` gets saturated input colors there, because the hue is ill-conditioned near grey (an ulp of noise moves it by 1e-4).
Notes on M3.8 as built:
- **VM:** `Tex2D` (a = uv, b = footprint derivatives from M3.9 or none, c = fallback; imm = slot) is always varying and never folds. The translator gives every distinct (texture request, sampler state) its own slot. The slot states (wrap s/t, filter, channels) are structure; the files are values (`MaterialDesc::textures`, one `TextureId` per slot). The batch executor calls `ITextureSampler::sample2D` once per instruction and chunk, and per-lane status selects the fallback.
diff --git a/docs/design/M8.md b/docs/design/M8.md
index d94089a..a45d524 100644
--- a/docs/design/M8.md
+++ b/docs/design/M8.md
@@ -152,7 +152,7 @@ Notes on M8.3 as built:
- `flyMedia` (`volume_media`): B3 as designed (survival biasing, throughput-weighted averages of σs and |σ̄ - σt| as probabilities, emission at every tentative collision, |·| and sign for violations). Its roulette is trackMedia's (below 0.1 of the start, survival 10·max|w| but at least 1e-3) instead of D8's fixed 0.5: the same code for both trackers, the weight then stays at 0.1. Camera rays also ratio-track the alpha transmittance over the whole segment from the same tentative collisions (continued past an event, with roulette of its own).
- `traceMedia`: rays that may scatter (not light-only, below the path length) fly; the rest ratio-track without emission (Karma measured: light-only rays gather lights only). An event ends the segment: pass A gathers the lights in front of it, a surface behind is not reached, alpha is the camera segment's (1 where a surface or visible environment is behind). The events go to **pass C' `shadeVolumes`** after pass C: one light sample with the phase function (MIS with its pdf; `light.diffuse` multiplies), the continuation sampled from the phase function (class Volume, `diffuseShare` 1, `afterDiffuse` set, cone spread as diffuse), Russian roulette as surfaces, the Volume limit from the volume (`VolumeDesc::volumeLimit`: `nova:object:volumeLimit`, else `karma:object:volumelimit` primvars) or the render settings (`karma:object:volumelimit` stands in for Nova's while that is at its default 0). `eventCounts` is 64 bits (a byte per limit class, Volume the fifth).
- LPE: `V` (ScatterNone, the volume's tag: `karma:object:lpetag` or its material's), A after V with the event's weight (`CVA` = the alpha of a white medium, as Karma). Volume emission stays an untagged `O` event (one emission sum per segment over all volumes).
-- **Karma's modifiers** (D10), measured and reproduced: from the start level on (levels count the events before a ray; camera rays 0), the extinction is scaled by exp(-e·(level - start + 1)) and the albedo by c (`VolumeEvaluator`, both only lower the extinction, so the majorants hold; e ≥ 0, c in [0, 1]). The light an event gathers sees the volume at the event's level: its shadow ray (depth = the event's), its light-only continuation (one level lower than the ray) and, where a volume is level-dependent (`VolumeRecord::levelDependent`: modifiers on or the shader reads `RayDepth`; `Scene::anyLevelDependentVolume`), the lights a full continuation gathers: those get a ratio-tracked transmittance of their own over the whole segment (`lightT`, stream `mediumLight`), whether or not the flight scattered, while the flight decides the next event at the ray's own level. Without that split Nova was 10-18 % brighter than Karma at volume limit ≥ 1 with e = 0.5; with it the whole table agrees within 1.8 %. Scenes without level-dependent volumes keep the single flight.
+- **Karma's modifiers** (D10), measured and reproduced: from the start level on (levels count the events before a ray; camera rays 0), the extinction is scaled by exp(-e·(level - start + 1)) and the albedo by c (`VolumeEvaluator`, both only lower the extinction, so the majorants hold; e ≥ 0, c in [0, 1]). The light an event gathers sees the volume at the event's level: its shadow ray (depth = the event's), its light-only continuation (one level lower than the ray) and, where a volume is level-dependent (`VolumeRecord::levelDependent`: modifiers on or the shader reads `RayDepth`; `Scene::anyLevelDependentVolume`), the lights a full continuation gathers: those get a ratio-tracked transmittance of their own over the whole segment (`lightT`, stream `mediumLight`), whether or not the flight scattered, while the flight decides the next event at the ray's own level. Without that split Nova was 10-18 % brighter than Karma at volume limit ≥ 1 with e = 0.5; with it the whole table agrees within 1.8 %. Scenes without level-dependent volumes keep the single flight. The start level is a shader output: it is clamped to ±2^20 before it is rounded to an int (a NaN is level 0), so a runaway value neither converts out of range nor overflows the level difference (bug audit S-1).
- **Deviation (D12):** volumes stay transparent to Nova's first-hit AOVs. Karma takes the sampled volume event as the hit and averages it with what lies behind (P, distance; N = 0); Nova's first-hit AOVs are one exact ray per pixel centre (M6), where a sampled event would dither. Alpha and the LPE planes include volumes.
- Karma comparison (ctest `houdini_volume_karma`, three cubes per render, 256 samples): furnace limit 0 bare/Pyro/MaterialX 0.3742/0.3649/0.3783 vs 0.3755/0.3664/0.3761, limit 64 0.626/0.630/0.631 vs 0.634/0.630/0.629; distant light 0.0308/0.0306/0.0310 vs 0.0312/0.0311/0.0312 (Karma's single scattering is about 1.3 % above the analytic value, research H 4.2, Nova matches the quadrature); lobes g = 0.5 0.0165 vs 0.0168, mixes 0.0200/0.0274 vs 0.0203/0.0276; modifiers at limits 0, 1, 64 within 1.8 %.
- Pyro references: `pyro_bare` and `pyro_bare_vl4` are reference scenes (`tests/reference`, the research's sim from `tests/data/volumes/pyro.vdb`, Karma CPU 2 x 2048 samples): Nova at 256 test samples is -0.09 % / +0.22 % globally with no 8x8 block outside its bound, through husk and `nova_cli`. At the default 64 test samples three nearly empty blocks (thin wisps, values about 1e-5) failed: the test pair's spread underestimates rare hits there, so these scenes test at 256. `pyro_mat` and `pyro_mat_vl4` (the recipe's Karma Pyro Material, generated at run time) are compared live in `houdini_volume_karma`: image means within 0.14 % and 0.32 %.
diff --git a/docs/limitations.md b/docs/limitations.md
new file mode 100644
index 0000000..d62dcc8
--- /dev/null
+++ b/docs/limitations.md
@@ -0,0 +1,112 @@
+# Known limitations
+
+The current limitations of Nova 0.1.0 in one place. Each entry names what happens instead and where the behaviour
+comes from (the warning in the code, or the design note that deferred it). The per-milestone "Not yet" lines in
+[`reference.md`](reference.md) and the "Deferred" tables in [`design/`](design/) describe the state at the end of
+their milestone; where a later milestone delivered an item (holdout LPEs, light filters, mesh-bounded media,
+`ray:hituv`, deep and checkpoint products), it is not listed here.
+
+The list was compiled from the warnings the code prints (`HD_NOVA_WARN`, `warnOnce` and the core's `[Nova]`
+messages) and from the design notes, each checked against the code.
+
+## Platform and build
+
+| Limitation | What happens instead |
+|---|---|
+| The Hydra delegate, the Houdini package, `nova_cli`, `nova_imgcmp` and the installer build on **Windows x64 with Houdini 22.0** only (`cmake/NovaHoudini.cmake` names Houdini's Windows import libraries). | The renderer core, its unit tests and `nova_bsdf_precompute` build without Houdini on Linux (`cmake --preset core`, see the README). |
+| Nova XPU needs an **RTX 50 series** GPU: the kernels are compiled for `sm_120` only (`core/CMakeLists.txt`, `CUDA_ARCHITECTURES "120"`). The CUDA driver and OptiX are loaded through Windows' loader (`core/gpu/cuda_api.cpp`). | Other GPUs and machines without one render on the CPU, with one message. |
+| A CPU with **AVX2** is required (the SIMD shading VM). | No fallback. |
+| Debug configurations do not exist in the full build, because Houdini ships release libraries only. | Release and RelWithDebInfo; the core-only build has no such limit. |
+| The husk, reference and Houdini tests need a Houdini installation, some a license or a GUI; regenerating the Karma references needs a Karma license. | Continuous integration (`.github/workflows/core.yml`) covers the core's unit tests only. |
+
+## Nova XPU (GPU)
+
+| Limitation | What happens instead | Source |
+|---|---|---|
+| GPU and CPU do not render together; one GPU is used. | The GPU renders alone; the CPU is the fallback. | `design/M10.md` D15, 2.2 |
+| Textures are not loaded on demand. | Past the GPU texture budget the finest MIP levels of the largest textures are left out, with a message. | `core/gpu/gpu_renderer.cpp` |
+| VEX materials do not run on the GPU. | Grey stand-ins with one warning, as in Karma XPU. | `core/gpu/gpu_renderer.cpp` |
+| Ray queries from shading (`kma_ao`, distance, curvature, rounded edges) do not trace on the GPU. | Their default values. | `design/M10.md` |
+| Shadow-link categories beyond the 7th are not separated on the GPU. | Every object shadows those lights, with a message. | `core/gpu/gpu_renderer.cpp` |
+| Materials and volume shaders that need more rows than the device VM has. | The GPU uses their uniform inputs (volumes: density only), with a message. | `core/gpu/gpu_renderer.cpp` |
+| The Texture Baker does not bake on the GPU. | Nova XPU bakes on the CPU. | `design/M11-P8.md` |
+| The OptiX denoiser does not work on the renderer's GPU memory. | Its images go through host memory. | `reference.md` (M10) |
+
+## Lights
+
+| Limitation | What happens instead | Source |
+|---|---|---|
+| At most **64 light-link and 64 shadow-link categories** (distinct link collections) per scene. | Lights of further categories light, or are shadowed by, every object; one message. | `Scene::computeLinks`, `core/scene/scene.cpp` |
+| Dome texture formats other than `latlong` (`mirroredBall`, `angular`, `cubeMapVerticalCross`). | Read as latlong, with a warning. | `hydra/light.cpp` |
+| Ellipsoid lights (a non-uniformly scaled sphere light). | A sphere of the mean radius, with a warning. | `hydra/light.cpp` |
+| IES profiles (`shaping:ies:file`) and `treatAsLine`. | Ignored: the light keeps its plain distribution; a line light renders as a cylinder. | not read in `hydra/light.cpp` |
+| Moving or deforming emissive meshes are not light sources. | They stay plain emitters (found by BSDF sampling only), with a message. | `core/scene/scene.cpp` |
+| Emission of VEX materials is never sampled as a light. | Plain emitter. | `design/M9.md` |
+| A volume whose size changes over the shutter is not a light source (bug audit R1-36). | Its emission is collected unbiased along the rays. | `core/volume/build.cpp` |
+| Heavily instanced emissive meshes have no two-level light tree. | Flattened to one light per triangle and instance; a message above the budget. | `design/M9.md` 2.2 |
+| Light filters other than Karma's blocker; filter spaces other than world. | Ignored with a warning; world space. | `hydra/lightFilter.cpp` |
+| `misbias`, `activeradius`, `pointradius` and `contribs` light properties. | Ignored. | `design/M9.md` 2.2 |
+
+## Materials
+
+| Limitation | What happens instead | Source |
+|---|---|---|
+| Karma Hair `coat`; Karma Fur's medulla and second R lobe. | Rendered without them, with a warning. | `hydra/material/translator.cpp` |
+| `sss_traceset` (walks across objects that share a name). | Walks stay inside their object. | `design/M9.md` D10 |
+| `surfacematerial`'s `backsurfaceshader`. | The front shader on both sides, with a warning. | `hydra/material/translator.cpp` |
+| Retroreflective lobes. | Reflect normally, with a warning. | `hydra/material/translator.cpp` |
+| Dispersion. | Ignored, with a warning (it needs spectral rendering). | `hydra/material/translator.cpp` |
+| Six of MaterialX 1.39's 746 node definitions, and nodes outside it. | The node's default outputs, with a warning. | `hydra/material/translator.cpp` |
+| String or filename `geompropvalueuniform` (a texture file per prim, face or instance). | The image's default, with a warning. | `design/M4.md` |
+| Trace sets and object-space distances of the ray-query nodes; `scope:self` of rounded edges. | All objects, world space, with a warning. | `hydra/material/translator.cpp` |
+| Principled Shader: packed colour, the `vdisp` input, noise displacement, dispersion, rounded edges, `opdef:` textures. | Ignored with a warning. | `hydra/material/principled.cpp` |
+| VEX materials: AOV exports other than the mapped `export_*` names, fake caustics through them, ray-tracing VEX (`trace`, `gather`, `illuminance`), light, lens, fog and volume VEX shaders. | Opaque to fake-caustic rays; a shader that traces fails to compile and the preview material renders; the other shader kinds are ignored with a warning. | `design/M5.md` |
+| UDIM sets inside packages (`.usdz`). | The texture fails to load, with an error. | `hydra/textureConvert.cpp` |
+
+## Geometry
+
+| Limitation | What happens instead | Source |
+|---|---|---|
+| Indexed curves. | Rendered with their points in order, with a warning. | `hydra/curves.cpp` |
+| `nurbsCurves` prims. | Not rendered (Houdini's SOP Import never authors them). | `design/M9.md` |
+| Authored normals on subdivided meshes; subdivision of bilinear meshes and UsdGeom implicit prims. | Normals come from the limit surface; those prims stay polygonal. | `reference.md` |
+| Long round linear curves (bug audit R1-11). | Reprojected onto the tube, leaving with an error-bounded offset. | `bug-audit-2026-11.md` |
+| Two exactly coplanar overlapping surfaces. | Which one a ray reports follows the accelerator's traversal and can change between runs. | `bug-audit-2026-11.md` section 7 |
+| `motion:blurScale`, `motion:nonlinearSampleCount` and `motion:velocityScale` (UsdGeomMotionAPI). | Ignored. | `design/M8.md` |
+
+## Volumes
+
+| Limitation | What happens instead | Source |
+|---|---|---|
+| `volumefilter` other than a box of width 1; tricubic lookups. | Box/trilinear, with a warning. | `hydra/volume.cpp` |
+| Karma CPU's lattice-deformation velocity blur. | Velocity blur as a lookup offset. | `design/M8.md` |
+| Instanced media bounded by surfaces. | Render nothing, with a warning. | `hydra/mesh.cpp`, `hydra/sphere.cpp` |
+| Field prims other than VDB and Houdini volumes; VDB grids of value types other than the scalar and vector ones the bridge converts. | The field is skipped, with a warning. | `hydra/field.cpp`, `houdini/volume_bridge/bridge.cpp` |
+| Cryptomatte ids for volumes. | Volumes have no cryptomatte coverage. | `design/M8.md` 2.2 |
+| Karma's step-rate settings (`volumesteprate`, `volumeshadowsteprate`, `volumequality`, `volumesamplingchannel`). | Ignored: Nova tracks without bias at any setting; fire is slower than Karma at its default step rate. | `design/M8.md` D16 |
+
+## Output and baking
+
+| Limitation | What happens instead | Source |
+|---|---|---|
+| Karma render settings without a Nova equivalent. | One warning per stage that names them: "the image differs from Karma's". | `hydra/renderDelegate.cpp` |
+| Utility path expressions other than `CO` (`aov:karma:utilitypathexpression`). | The values of the camera hit, with a warning. | `hydra/aov.cpp` |
+| AOV sources Nova does not know; render product types other than raster, `karma:deep` and `karma:checkpoint`. | The plane keeps its clear value; the product is skipped; each with a warning. | `hydra/aov.cpp`, `hydra/renderDelegate.cpp` |
+| Temporal denoising. | Each frame is denoised by itself. | `design/M7.md` D9 |
+| Texture Baker: textures for trace bias, trace max distance and trace skew; bake trace sets; some image filters. | The global values; every visible object; the filter is skipped; each with a warning. | `hydra/bake.cpp` |
+
+## Removed since this list was started
+
+- **The core built only with MSVC against a Houdini installation.** It also builds with GCC on Linux against
+ system libraries, without Houdini (`NOVA_CORE_ONLY`, `cmake/NovaStandalone.cmake`); all of its unit tests pass
+ there.
+- **No continuous integration.** `.github/workflows/core.yml` builds the core and runs its unit tests on every pull
+ request, also under AddressSanitizer and UBSan.
+- **Shading on values beyond int's range depended on the device.** A noise position past 2^31, an infinite octave
+ count or a NaN hue was converted to int with undefined behaviour: INT_MIN on x86, a saturated value or 0 on the
+ GPU. The conversions are defined now (`toInt`, `core/math/common.h`) and give what the CPU gave.
+- **The Texture Baker lost triangles with a UV corner far outside the tile** (from u = 1e6 with a full lookup
+ grid): they were in no cell of the grid.
+- **A checkpoint with a short adaptive-sampling array loaded** and was then read past its end.
+
+The last three are described in [`bug-audit-2026-11.md`](bug-audit-2026-11.md), section 9.
diff --git a/docs/reference.md b/docs/reference.md
index 0aa9401..5bde31b 100644
--- a/docs/reference.md
+++ b/docs/reference.md
@@ -104,6 +104,9 @@ Light properties (on UsdLux lights, Karma's names; Nova's own `inputs:nova:light
## Features by milestone
+The "Not yet" lines below describe each milestone as it ended; later milestones delivered some of those items.
+`docs/limitations.md` lists what is missing now.
+
After M10 a bug audit fixed 71 verified defects across the renderer, Hydra, the bridges and the installer; the findings, fixes, tests and remaining limitations are in `docs/bug-audit-2026-11.md`.
Karma's Solaris nodes (M11, `docs/design/M11.md`, one design note per package `docs/design/M11-P1.md` ... `M11-P9c.md`): scenes built with the twelve visible Karma LOP types render in Nova as in Karma, on CPU and XPU, each feature measured against Karma CPU first and checked by a `tests/husk/check_karma_*.py` test:
@@ -262,7 +265,9 @@ Geometry, lights and sampling (M2):
## Tests
-Tests (`ctest --preset release`):
+Tests (`ctest --preset release`), by label. A build without Houdini (`cmake --preset core`, see the README) has only
+the unit tests of the first row (`ctest --preset core`; `ctest --preset core-sanitize` runs them under
+AddressSanitizer and UBSan), and those that need a GPU report as skipped.
| Label | Contents |
|---|---|
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index e2912e5..3c41530 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -72,6 +72,16 @@ if(MSVC)
target_compile_options(nova_tests PRIVATE /W4 /permissive- /Zc:__cplusplus /utf-8)
endif()
+include(Catch)
+# A core-only build (NOVA_CORE_ONLY) ends here: the Hydra, CVEX, volume-bridge,
+# husk and Houdini tests below need Houdini.
+if(NOVA_CORE_ONLY)
+ # Catch2 exits with 4 when the one test it ran skipped itself (the tests
+ # that need a GPU): skipped for ctest, not failed.
+ catch_discover_tests(nova_tests DISCOVERY_MODE PRE_TEST PROPERTIES SKIP_RETURN_CODE 4)
+ return()
+endif()
+
# CUDA compile check (docs/design/M3.md K14): the kernel-side core headers
# must build as device code, so a host-only construct breaks the build now and
# not only in M10. Never run; skipped without a CUDA compiler.
@@ -112,7 +122,6 @@ add_custom_command(TARGET nova_hydra_tests POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "$")
# tbb12.dll and the pxr DLLs come from Houdini's bin directory.
-include(Catch)
catch_discover_tests(nova_tests
DISCOVERY_MODE PRE_TEST
DL_PATHS "${HFS}/bin"
diff --git a/tests/test_bake.cpp b/tests/test_bake.cpp
index 94e5bde..e27806b 100644
--- a/tests/test_bake.cpp
+++ b/tests/test_bake.cpp
@@ -178,6 +178,41 @@ TEST_CASE("Bake: quads split along their second and fourth corners", "[bake]") {
CHECK(p.P.x == Approx(1.0125f).margin(1e-4));
}
+TEST_CASE("Bake: a triangle with a corner far outside the tile is still found", "[bake]") {
+ // The lookup grid's cell range of a triangle was converted to int before
+ // it was clamped: a corner at u = 1e9 (grid coordinate 4e9, beyond int)
+ // became cell 0, the range was empty and the triangle was in no cell.
+ Scene scene;
+ MeshDesc low;
+ std::vector st;
+ const auto triangle = [&](Vec3f p0, Vec3f p1, Vec3f p2, Vec2f t0, Vec2f t1, Vec2f t2) {
+ const uint32_t base = uint32_t(low.points.size());
+ low.points.insert(low.points.end(), {p0, p1, p2});
+ low.indices.insert(low.indices.end(), {base, base + 1, base + 2});
+ low.normals.insert(low.normals.end(), 3, Vec3f{0, 0, 1});
+ st.insert(st.end(), {t0.x, t0.y, t1.x, t1.y, t2.x, t2.y});
+ };
+ triangle({0, 0, 0}, {1, 0, 0}, {0, 1, 0}, {0.6f, 0.1f}, {1e9f, 0.1f}, {0.6f, 0.9f});
+ for (int i = 0; i < 16; ++i) { // 17 triangles: a 4 x 4 grid
+ const float u = 0.02f + 0.03f * float(i);
+ triangle({u, 0, 5}, {u + 0.01f, 0, 5}, {u, 0.01f, 5}, {u, 0.01f}, {u + 0.01f, 0.01f}, {u, 0.02f});
+ }
+ low.attributes.push_back({"st", AttributeRate::Vertex, 2, st});
+ const MeshId id = scene.createMesh();
+ scene.updateMesh(id, low);
+ scene.commit();
+ BakeSettings s;
+ s.low = {id};
+ Baker baker;
+ baker.build(scene, s);
+ BakePoint p;
+ REQUIRE(baker.lookup({0.8f, 0.3f}, p)); // inside the far-reaching triangle, in grid cell (3, 1)
+ CHECK(p.P.y == Approx(0.25f).margin(1e-3));
+ CHECK(p.P.z == Approx(0.0f).margin(1e-6));
+ REQUIRE(baker.lookup({0.025f, 0.012f}, p)); // a small triangle
+ CHECK(p.P.z == Approx(5.0f));
+}
+
TEST_CASE("Bake: texture-space lookup, UDIM tiles and the trace maps", "[bake]") {
Scene scene;
// Low: the unit square at z = 0 in UDIM 1002 (u in [1, 2]), hidden.
diff --git a/tests/test_math.cpp b/tests/test_math.cpp
index 79e201c..8457fc0 100644
--- a/tests/test_math.cpp
+++ b/tests/test_math.cpp
@@ -7,6 +7,8 @@
#include
#include
+#include
+
using namespace nova;
using Catch::Matchers::WithinAbs;
using Catch::Matchers::WithinRel;
@@ -77,3 +79,29 @@ TEST_CASE("Ray origin offset moves to the normal side", "[math]") {
CHECK(length(q - p) < 1e-2f * std::fmax(1.0f, maxComponent(absolute(p))));
}
}
+
+TEST_CASE("toInt and clampToInt are defined for every float", "[math]") {
+ const float nan = std::numeric_limits::quiet_NaN(), inf = std::numeric_limits::infinity();
+ const int intMin = std::numeric_limits::min();
+ // In range: truncation, as the plain conversion.
+ CHECK(toInt(0.0f) == 0);
+ CHECK(toInt(-0.0f) == 0);
+ CHECK(toInt(2.9f) == 2);
+ CHECK(toInt(-2.9f) == -2);
+ CHECK(toInt(2147483520.0f) == 2147483520); // the largest float below 2^31
+ CHECK(toInt(-2147483648.0f) == intMin);
+ // Out of range and NaN: INT_MIN (what x86's conversion gives).
+ for (float x : {2147483648.0f, 3.0e9f, -3.0e9f, 1e30f, -1e30f, inf, -inf, nan})
+ CHECK(toInt(x) == intMin);
+
+ CHECK(clampToInt(3.7f, 0, 10) == 3);
+ CHECK(clampToInt(-0.5f, 0, 10) == 0);
+ CHECK(clampToInt(-5.0f, -3, 10) == -3);
+ CHECK(clampToInt(10.0f, 0, 10) == 10);
+ CHECK(clampToInt(1e12f, 0, 2047) == 2047);
+ CHECK(clampToInt(-1e12f, 0, 2047) == 0);
+ CHECK(clampToInt(inf, 0, 2047) == 2047);
+ CHECK(clampToInt(-inf, 0, 2047) == 0);
+ CHECK(clampToInt(nan, 5, 2047) == 5);
+ CHECK(clampToInt(3.0e9f, 0, std::numeric_limits::max()) == std::numeric_limits::max());
+}
diff --git a/tests/test_noise.cpp b/tests/test_noise.cpp
index 5543a84..13ea531 100644
--- a/tests/test_noise.cpp
+++ b/tests/test_noise.cpp
@@ -15,6 +15,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -169,3 +170,77 @@ TEST_CASE("Voronoi distances and seed points (kma_voronoinoise)", "[noise]") {
CHECK(nova::length(pts[0] - p) == Catch::Approx(d[0]).margin(1e-5));
}
}
+
+TEST_CASE("Noise is defined for positions beyond int's range", "[noise]") {
+ // A position of 1e12 (a runaway multiply in a shader graph), an infinity
+ // or a NaN has no int cell. The cell is INT_MIN there on every device
+ // (toInt), and the lattice arithmetic around it does not overflow.
+ const float nan = std::numeric_limits::quiet_NaN(), inf = std::numeric_limits::infinity();
+ const int intMin = std::numeric_limits::min();
+ for (float x : {2147483648.0f, 3.0e9f, -3.74721e9f, 1e30f, -1e30f, inf, -inf, nan})
+ CHECK(noise::floorInt(x) == intMin);
+ CHECK(noise::floorInt(-2147483648.0f) == intMin);
+ CHECK(noise::floorInt(2147483520.5f) == 2147483520);
+ CHECK(noise::floorInt(-1.5f) == -2);
+ // The neighbour of the lowest cell stays the lowest cell.
+ CHECK(noise::cellCoord(intMin, -1) == -2147483648.0f);
+ CHECK(noise::cellCoord(intMin, 1) == -2147483648.0f); // rounds to the same float
+ CHECK(noise::cellCoord(5, -1) == 4.0f);
+ CHECK(noise::cellCoord(16777216, 1) == float(16777217)); // as float(X + offset)
+
+ // Every out-of-range position is the same cell, so cell noise and Worley
+ // agree for all of them, and are what the finite cell INT_MIN gives.
+ const float big[] = {3.0e9f, -3.74721e9f, 1e30f, -1e30f};
+ const float cellRef = noise::cell(Vec2f{-2147483648.0f, 0.25f});
+ for (float x : big)
+ CHECK(noise::cell(Vec2f{x, 0.25f}) == cellRef);
+ CHECK(noise::cell(Vec2f{inf, 0.25f}) == cellRef);
+ CHECK(noise::cell(Vec2f{nan, 0.25f}) == cellRef);
+ for (float x : big) {
+ float d2[3], d3[3];
+ Vec2f m2;
+ Vec3f m3;
+ noise::worley(Vec2f{x, 0.5f}, 1.0f, d2, m2);
+ noise::worley(Vec3f{0.5f, x, -x}, 1.0f, d3, m3);
+ for (int k = 0; k < 3; ++k) {
+ CHECK(std::isfinite(d2[k]));
+ CHECK(std::isfinite(d3[k]));
+ }
+ // Perlin's fade of the huge fraction is not finite there; the calls
+ // are here for the sanitizer build (no overflow, no undefined cast).
+ (void)noise::perlin(Vec2f{x, 0.5f});
+ (void)noise::perlin(Vec3f{x, -x, 0.5f});
+ (void)noise::perlinV3(Vec3f{x, -x, 0.5f});
+ }
+ // A NaN hue takes the switch's default case; nothing is read out of range.
+ const Vec3f rgb = noise::hsvToRgb({nan, 0.5f, 0.75f});
+ CHECK(rgb.x == 0.75f);
+}
+
+TEST_CASE("fractal noise with an infinite or NaN octave count has no octave", "[shading][noise][vm]") {
+ // The octave count is a float input; its conversion to an int is defined
+ // (toInt): out of range and NaN give no octave, a count above 32 gives 32.
+ const float nan = std::numeric_limits::quiet_NaN(), inf = std::numeric_limits::infinity();
+ const auto fractalAt = [](float octaves) {
+ IrGraph g;
+ IrBuilder b(g);
+ const Ref uv = b.swizzle(b.global(Global::P), 0, 1);
+ b.output(0, 1, b.fractal(uv, b.newParam(1), b.constant(2.0f), b.constant(0.5f), 1));
+ const float params[1] = {octaves};
+ const float P[3] = {0.37f, 1.21f, -0.6f};
+ const float *globals[int(Global::Count)] = {};
+ globals[int(Global::P)] = P;
+ const float *primvars[2] = {nullptr, nullptr};
+ std::vector values;
+ evaluateGraph(g, params, globals, primvars, values);
+ return values[size_t(g.outputs[0].value) * 4];
+ };
+ const Vec2f p{0.37f, 1.21f};
+ CHECK(fractalAt(3.0f) == noise::fractal(p, 3, 2.0f, 0.5f));
+ CHECK(fractalAt(1000.0f) == noise::fractal(p, 32, 2.0f, 0.5f));
+ CHECK(fractalAt(-4.0f) == 0.0f);
+ CHECK(fractalAt(inf) == 0.0f);
+ CHECK(fractalAt(-inf) == 0.0f);
+ CHECK(fractalAt(nan) == 0.0f);
+ CHECK(fractalAt(1e12f) == 0.0f);
+}
diff --git a/tests/test_sample_aovs.cpp b/tests/test_sample_aovs.cpp
index 6ab6090..7bd1979 100644
--- a/tests/test_sample_aovs.cpp
+++ b/tests/test_sample_aovs.cpp
@@ -323,6 +323,67 @@ TEST_CASE("A resumed checkpoint equals the uninterrupted render", "[render][chec
CHECK(!resumed.loadCheckpoint(bytes.data(), bytes.size() - 1));
}
+// The adaptive sampler's state is ten arrays of one value per pixel. A
+// checkpoint in which any of them has another size is refused: the oracle
+// would index it by pixel.
+TEST_CASE("Checkpoints with a short adaptive-sampling array are refused", "[render][checkpoint]") {
+ EdgeScene s;
+ RenderSettings settings = baseSettings(64);
+ settings.adaptive = true;
+ const auto setup = [&](Renderer &r) {
+ r.setScene(&s.scene);
+ r.setSettings(settings);
+ r.setCamera(s.camera);
+ r.resize(12, 12);
+ };
+ Renderer first;
+ setup(first);
+ for (int pass = 0; pass < 3; ++pass)
+ first.renderPass({});
+ std::vector bytes;
+ first.saveCheckpoint(bytes);
+ {
+ Renderer resumed;
+ setup(resumed);
+ REQUIRE(resumed.loadCheckpoint(bytes.data(), bytes.size()));
+ }
+ // The file: an 8-byte magic, 8 uint32 of progress, then arrays (a uint64
+ // count and the elements): the film, three of bytes, one of uint32, one
+ // of Spectrum, five of float; then the guiding trailer.
+ const size_t elementSize[11] = {1, 1, 1, 1, 4, sizeof(Spectrum), 4, 4, 4, 4, 4};
+ size_t offset[11], count[11];
+ size_t at = 8 + 8 * sizeof(uint32_t);
+ for (int a = 0; a < 11; ++a) {
+ uint64_t n = 0;
+ REQUIRE(at + sizeof(n) <= bytes.size());
+ std::memcpy(&n, bytes.data() + at, sizeof(n));
+ offset[a] = at;
+ count[a] = size_t(n);
+ at += sizeof(n) + size_t(n) * elementSize[a];
+ }
+ REQUIRE(at <= bytes.size());
+ for (int a = 1; a < 11; ++a) {
+ REQUIRE(count[a] == 144); // the oracle is on: one value per pixel
+ // The same file with array a one element short.
+ std::vector shortened = bytes;
+ const uint64_t n = count[a] - 1;
+ std::memcpy(shortened.data() + offset[a], &n, sizeof(n));
+ const auto last = shortened.begin() + std::ptrdiff_t(offset[a] + sizeof(n) + size_t(n) * elementSize[a]);
+ shortened.erase(last, last + std::ptrdiff_t(elementSize[a]));
+ Renderer resumed;
+ setup(resumed);
+ INFO("array " << a);
+ CHECK(!resumed.loadCheckpoint(shortened.data(), shortened.size()));
+ }
+ // A fill stride of 0 (hosts divide by it) is refused too.
+ std::vector stride = bytes;
+ const uint32_t zero = 0;
+ std::memcpy(stride.data() + 8 + 3 * sizeof(uint32_t), &zero, sizeof(zero));
+ Renderer resumed;
+ setup(resumed);
+ CHECK(!resumed.loadCheckpoint(stride.data(), stride.size()));
+}
+
// A checkpoint resumes only into the same planes: a plane of the same kind
// but another source (a primvar's name, an LPE output, holdout prefixes, the
// default value, a cryptomatte's primvar, the deep map's settings) is
diff --git a/tests/test_volume_shader.cpp b/tests/test_volume_shader.cpp
index eb033f9..edd0d36 100644
--- a/tests/test_volume_shader.cpp
+++ b/tests/test_volume_shader.cpp
@@ -22,6 +22,7 @@
#include
#include
+#include
#include
using Catch::Matchers::WithinAbs;
@@ -396,3 +397,27 @@ TEST_CASE("Time-driven volume shaders are bounded at the render's frame", "[volu
CHECK(*std::max_element(rec.majorant.begin(), rec.majorant.end()) < 1.01f * time * 1.8f);
}
}
+
+TEST_CASE("The multiple-scattering start level is defined for every float", "[volume][shader]") {
+ // The level is a shader output: its conversion to an int is clamped, so
+ // an infinite or NaN level neither converts out of range nor overflows
+ // the level difference (volume_point.h).
+ const float nan = std::numeric_limits::quiet_NaN(), inf = std::numeric_limits::infinity();
+ VolumeInputs in = volumeDefaults();
+ in.set(volume_field::scattering, Spectrum{1.0f, 1.0f, 1.0f});
+ in.set(volume_field::extinctionModifier, 0.5f);
+ const auto scatteringAt = [&](float level, uint32_t depth) {
+ in.set(volume_field::modifierStartLevel, level);
+ return volumePointOf(in, depth).scattering.x;
+ };
+ CHECK(scatteringAt(1.0f, 0) == 1.0f); // before the start level
+ CHECK_THAT(scatteringAt(1.0f, 1), WithinRel(std::exp(-0.5f), 1e-6f));
+ CHECK_THAT(scatteringAt(1.0f, 3), WithinRel(std::exp(-1.5f), 1e-6f));
+ CHECK_THAT(scatteringAt(1.4f, 1), WithinRel(std::exp(-0.5f), 1e-6f)); // rounds to level 1
+ CHECK_THAT(scatteringAt(-2.0f, 0), WithinRel(std::exp(-1.5f), 1e-6f));
+ CHECK(scatteringAt(inf, 1000) == 1.0f); // never starts
+ CHECK(scatteringAt(1e30f, 1000) == 1.0f);
+ CHECK(scatteringAt(-inf, 0) == 0.0f); // started long ago: exp(-0.5 * 2^20)
+ CHECK(scatteringAt(-1e30f, 0) == 0.0f);
+ CHECK_THAT(scatteringAt(nan, 0), WithinRel(std::exp(-0.5f), 1e-6f)); // level 0
+}
diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt
index 3ac0e3e..0d83b1a 100644
--- a/tools/CMakeLists.txt
+++ b/tools/CMakeLists.txt
@@ -2,6 +2,9 @@
# nova_cli renders a .usd scene to EXR without husk, the HDK or a license (tests, CI)
# nova_imgcmp statistical comparison of noisy renders plus HDR-FLIP (tests/reference)
# nova_bsdf_precompute integrates the BSDF energy tables (target nova_bsdf_tables)
-add_subdirectory(nova_cli)
-add_subdirectory(nova_imgcmp)
+# A core-only build (NOVA_CORE_ONLY) has neither USD nor Houdini's OpenImageIO.
+if(NOT NOVA_CORE_ONLY)
+ add_subdirectory(nova_cli)
+ add_subdirectory(nova_imgcmp)
+endif()
add_subdirectory(nova_bsdf_precompute)
diff --git a/tools/nova_bsdf_precompute/CMakeLists.txt b/tools/nova_bsdf_precompute/CMakeLists.txt
index 995f3ad..3099e7d 100644
--- a/tools/nova_bsdf_precompute/CMakeLists.txt
+++ b/tools/nova_bsdf_precompute/CMakeLists.txt
@@ -7,6 +7,8 @@ target_link_libraries(nova_bsdf_precompute PRIVATE Nova::TBB)
if(MSVC)
target_compile_options(nova_bsdf_precompute PRIVATE /W4 /permissive- /Zc:__cplusplus /utf-8 /arch:AVX2)
target_compile_definitions(nova_bsdf_precompute PRIVATE NOMINMAX _USE_MATH_DEFINES _CRT_SECURE_NO_WARNINGS)
+else()
+ target_compile_options(nova_bsdf_precompute PRIVATE -march=haswell -mtune=generic -ffp-contract=off)
endif()
# Regenerates core/bsdf/tables/bsdf_tables.cpp (minutes of CPU time; not
@@ -21,8 +23,14 @@ set(_nova_table_inputs
"${PROJECT_SOURCE_DIR}/core/bsdf/diffuse.h"
"${PROJECT_SOURCE_DIR}/core/bsdf/sheen.h"
"${CMAKE_CURRENT_SOURCE_DIR}/main.cpp")
+# Houdini's TBB is in $HFS/bin; a core-only build finds the system's by itself.
+if(NOVA_CORE_ONLY)
+ set(_nova_table_env)
+else()
+ set(_nova_table_env ${CMAKE_COMMAND} -E env "PATH=${HFS}/bin;$ENV{PATH}")
+endif()
add_custom_target(nova_bsdf_tables
- COMMAND ${CMAKE_COMMAND} -E env "PATH=${HFS}/bin;$ENV{PATH}"
+ COMMAND ${_nova_table_env}
$ -o "${PROJECT_SOURCE_DIR}/core/bsdf/tables/bsdf_tables.cpp"
--hash-inputs ${_nova_table_inputs}
DEPENDS nova_bsdf_precompute