Skip to content

Commit 3082b23

Browse files
Release v24.03
* Fix URL in build docs (#151) * OGSMOD-3964: Upgrade to MtlX 1.38.7 and fix errors (#153) * OGSMOD-3972: Add some tests for UV transforms (#154) * Optionally support 23.08.01 USD (#157) * Build on PR and Abort Previous Build for PR (#156) * OGSMOD-3766: Move raytracer to non-recursive architecture (#152) * OGSMOD-3967: Implement transparent shadows in non-recusive mode (#158) * OGSMOD-3966: Ground plane works with non-recursive rendering (#160) * OGSMOD-4003: Upgrade to MaterialX 1.38.8 (#161) * Specify thread group dimensions for the accumulation and post-processing compute shaders (#30) (#162) * OGSMOD-3965: Support layers in non-recursive ray tracing (Part 1) (#164) * OGSMOD-3965: Support layers in non-recursive ray tracing (Part 2) (#165) * Update CONTRIBUTING.MD (#166) * OGSMOD-4183: Fix layer crash in inventor (#167) * Move shadow ray emission to end of loop (#168) * OGSMOD-4309: Remove erase from for light iterator loop (#169) * Don't assert if zero verts (#172) * Use default image when getData function fails (#173)
1 parent dbb7199 commit 3082b23

File tree

129 files changed

+5902
-3674
lines changed

Some content is hidden

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

129 files changed

+5902
-3674
lines changed

Applications/Plasma/Camera.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,19 @@ static constexpr vec3 kForward = vec3(0.0f, 0.0f, -1.0f);
2020
static constexpr vec3 kRight = vec3(1.0f, 0.0f, 0.0f);
2121
static constexpr vec3 kUp = vec3(0.0f, 1.0f, 0.0f);
2222

23+
#define DUMP_CAMERA_POSITION 0
24+
2325
const mat4& Camera::viewMatrix()
2426
{
2527
// Create a view matrix if it needs to be updated.
2628
if (_isViewDirty)
2729
{
28-
_viewMatrix = lookAt(_eye, _target, _up);
30+
_viewMatrix = lookAt(_eye, _target, _up);
31+
// If dev flag is set dump camera position.
32+
#if DUMP_CAMERA_POSITION
33+
AU_INFO("--eye=%0.2f,%0.2f,%0.2f --target=%0.2f,%0.2f,%0.2f", _eye.x, _eye.y, _eye.z,
34+
_target.x, _target.y, _target.z);
35+
#endif
2936
_isViewDirty = false;
3037
}
3138

Applications/Plasma/Loaders.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ class ImageCache
4747
using LoadSceneFunc = function<bool(Aurora::IRenderer* pRenderer, Aurora::IScene* pScene,
4848
const string& filePath, SceneContents& sceneContents)>;
4949

50+
// If true OBJ loader will try and load a materialX file for each OBJ material.
51+
void loadMaterialXForOBJMaterials(bool enabled);
52+
5053
// Loads a Wavefront OBJ (.obj) file into the specified renderer and scene, from the specified file
5154
// path.
5255
bool loadOBJFile(Aurora::IRenderer* pRenderer, Aurora::IScene* pScene, const string& filePath,

Applications/Plasma/OBJLoader.cpp

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
#include "Loaders.h"
1818
#include "SceneContents.h"
1919

20+
bool gEnableMaterialXMaterials = false;
21+
2022
uint32_t ImageCache::whitePixels[1] = { 0xFFFFFFFF };
2123

2224
#define PLASMA_HAS_TANGENTS 0
@@ -62,6 +64,11 @@ struct hashOBJIndex
6264
// An unordered (hash) map from an OBJIndex (with vertex channel indices) to a single index.
6365
using OBJIndexMap = unordered_map<OBJIndex, uint32_t, hashOBJIndex>;
6466

67+
void loadMaterialXForOBJMaterials(bool enabled)
68+
{
69+
gEnableMaterialXMaterials = enabled;
70+
}
71+
6572
// Loads a Wavefront OBJ file into the specified renderer and scene, from the specified file path.
6673
bool loadOBJFile(Aurora::IRenderer* /*pRenderer*/, Aurora::IScene* pScene, const string& filePath,
6774
SceneContents& sceneContents)
@@ -103,9 +110,40 @@ bool loadOBJFile(Aurora::IRenderer* /*pRenderer*/, Aurora::IScene* pScene, const
103110
int mtlCount = 0;
104111
for (auto& objMaterial : objMaterials)
105112
{
113+
// Flag is set try and load a materialX file with the OBJ material name.
114+
if (gEnableMaterialXMaterials && !objMaterial.name.empty())
115+
{
116+
// Build MaterialX file path from OBJ material name and OBJ path.
117+
std::string directory = std::filesystem::path(filePath).parent_path().u8string();
118+
string mtlxFilename = directory + "/" + objMaterial.name + ".mtlx";
119+
ifstream is(mtlxFilename, ifstream::binary);
120+
if (is.good())
121+
{
122+
// If the file exists load it into a string.
123+
string mtlString;
124+
is.seekg(0, is.end);
125+
size_t length = is.tellg();
126+
is.seekg(0, is.beg);
127+
mtlString.resize(length + 1);
128+
is.read((char*)&mtlString[0], length);
129+
130+
// Create a material from the MaterialX string, and use it in place of the OBJ
131+
// material.
132+
Aurora::Path materialPath =
133+
filePath + "-" + objMaterial.name + ":MaterialX-" + to_string(mtlCount++);
134+
pScene->setMaterialType(materialPath, Names::MaterialTypes::kMaterialX, mtlString);
135+
lstMaterials.push_back(materialPath);
136+
AU_INFO("Found materialX document %s for OBJ material %s", mtlxFilename.c_str(),
137+
objMaterial.name.c_str());
138+
continue;
139+
}
140+
}
141+
106142
// Collect material properties.
107143
// NOTE: This includes support for some of the properties in the PBR extension here:
108144
// http://exocortex.com/blog/extending_wavefront_mtl_to_support_pbr
145+
// See TinyOBJ parsing code for mapping from OBJ mtl values to ObjMaterial properties:
146+
// https://github.com/tinyobjloader/tinyobjloader/blob/ee45fb41db95bf9563f2a41bc63adfa18475c2ee/tiny_obj_loader.h#L2127
109147
// > We use the Standard Surface IOR default of 1.5 when no IOR is specified in the file,
110148
// which is parsed as 1.0.
111149
// > Transmission is derived from the "dissolve" property. This is normally intended for
@@ -178,7 +216,8 @@ bool loadOBJFile(Aurora::IRenderer* /*pRenderer*/, Aurora::IScene* pScene, const
178216
{ "normal_image", normalImage }
179217
};
180218
// clang-format on
181-
Aurora::Path materialPath = filePath + ":OBJFileMaterial-" + to_string(mtlCount++);
219+
Aurora::Path materialPath =
220+
filePath + "-" + objMaterial.name + ":OBJFileMaterial-" + to_string(mtlCount++);
182221
pScene->setMaterialProperties(materialPath, properties);
183222
lstMaterials.push_back(materialPath);
184223
};

Applications/Plasma/Plasma.cpp

Lines changed: 55 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -151,18 +151,11 @@ bool Plasma::run(int argc, char* argv[])
151151
#endif
152152

153153
// Creates a sample scene.
154-
Aurora::IScenePtr Plasma::createSampleScene(Aurora::IRenderer* pRenderer, SceneContents& contents)
154+
void Plasma::createSampleScene(Aurora::IScene* pScene, SceneContents& contents)
155155
{
156156
// Clear the result.
157157
contents.reset();
158158

159-
// Create an Aurora scene.
160-
Aurora::IScenePtr pScene = pRenderer->createScene();
161-
if (!pScene)
162-
{
163-
return nullptr;
164-
}
165-
166159
// Create sample geometry, a single triangle.
167160
const Aurora::Path kGeomPath = "PlasmaDefaultSceneGeometry";
168161

@@ -269,7 +262,7 @@ Aurora::IScenePtr Plasma::createSampleScene(Aurora::IRenderer* pRenderer, SceneC
269262
vec3 max(1.0f, 1.0f, 0.01f);
270263
contents.bounds = Foundation::BoundingBox(min, max);
271264

272-
return pScene;
265+
return;
273266
}
274267

275268
bool Plasma::getFloat3Option(const string& name, glm::vec3& value) const
@@ -360,6 +353,7 @@ void Plasma::parseOptions(int argc, char* argv[])
360353
("fov", "Camera field of view in degrees.", cxxopts::value<float>())
361354
("env", "Environment map path to load (lat-long format .HDR file)", cxxopts::value<string>())
362355
("mtlx", "MaterialX document path to apply.",cxxopts::value<string>())
356+
("loadMtlXForObj", "Try and load MaterialX documents for each OBJ material.", cxxopts::value<bool>())
363357
("h,help", "Print help");
364358
// clang-format on
365359

@@ -437,12 +431,11 @@ bool Plasma::initialize()
437431
return false;
438432
}
439433

440-
// Setup asset search paths. Including the path to the ProteinX test folder (if running within
441-
// the Github repo).
442-
// TODO: A more reliable solution would be to set based on the loaded materialX file path.
443-
_assetPaths = { "",
444-
Foundation::getModulePath() +
445-
"../../../Renderers/Tests/Data/Materials/mtlx_ProteinSubset/" };
434+
// Setup asset search paths. Including the path to the unit test assets folder (if running
435+
// within the Github repo).
436+
// TODO: A more reliable solution would be to set based on the loaded MaterialX file path.
437+
_assetPaths = { "", Foundation::getModulePath() + "../../../Tests/Assets/Materials/",
438+
Foundation::getModulePath() + "../../../Tests/Assets/Textures/" };
446439

447440
// Setup the resource loading function to use asset search paths.
448441
auto loadResourceFunc = [this](const string& uri, vector<unsigned char>* pBufferOut,
@@ -479,6 +472,12 @@ bool Plasma::initialize()
479472
};
480473
_pRenderer->setLoadResourceFunction(loadResourceFunc);
481474

475+
// The load materialX flag for OBJ loader if argument set.
476+
if (_pArguments->count("loadMtlXForObj") > 0)
477+
{
478+
loadMaterialXForOBJMaterials(true);
479+
}
480+
482481
// Set reference flag.
483482
if (_pArguments->count("reference") > 0)
484483
{
@@ -536,8 +535,14 @@ bool Plasma::initialize()
536535
// If a file was not loaded, create a sample scene.
537536
if (!bFileLoaded)
538537
{
538+
// Create new empty scene
539+
_pScene = _pRenderer->createScene();
540+
541+
// Set the scene on the renderer.
542+
_pRenderer->setScene(_pScene);
543+
539544
// Create the sample scene, and return if it not successful.
540-
_pScene = createSampleScene(_pRenderer.get(), _sceneContents);
545+
createSampleScene(_pScene.get(), _sceneContents);
541546
if (!_pScene)
542547
{
543548
return false;
@@ -605,7 +610,7 @@ bool Plasma::initialize()
605610

606611
bool Plasma::addDecal(const string& decalMtlXPath)
607612
{
608-
// Load the materialX file for decal.
613+
// Load the MaterialX file for decal.
609614
auto materialPath = loadMaterialXFile(decalMtlXPath);
610615
if (materialPath.empty())
611616
return false;
@@ -705,10 +710,6 @@ void Plasma::updateNewScene()
705710
_animationTimer.reset(!_isAnimating);
706711
_frameNumber = 0;
707712

708-
// Set the scene on the renderer, and assign the environment and ground plane. Set the ground
709-
// plane position to the bottom corner, of the scene bounds.
710-
_pRenderer->setScene(_pScene);
711-
712713
// Setup environment for new scene.
713714
_pScene->setEnvironmentProperties(
714715
_environmentPath, { { Aurora::Names::EnvironmentProperties::kBackgroundUseScreen, true } });
@@ -1003,12 +1004,30 @@ void Plasma::selectFile(
10031004
// works as desired here because the load blocks the application.
10041005
::SetCursor(::LoadCursor(nullptr, IDC_WAIT));
10051006

1006-
// Load the file.
1007+
addAssetPathContainingFile(Foundation::w2s(filePath.data()));
10071008
loadFunc(Foundation::w2s(filePath.data()));
10081009
}
10091010

10101011
#endif
10111012

1013+
void Plasma::addAssetPathContainingFile(const string& filePath)
1014+
{
1015+
string directory = filesystem::path(filePath).parent_path().u8string();
1016+
if (directory.empty())
1017+
return;
1018+
addAssetPath(directory + "/");
1019+
}
1020+
1021+
void Plasma::addAssetPath(const string& filePath)
1022+
{
1023+
for (int i = 0; i < _assetPaths.size(); i++)
1024+
{
1025+
if (_assetPaths[i].compare(filePath) == 0)
1026+
return;
1027+
}
1028+
_assetPaths.push_back(filePath);
1029+
}
1030+
10121031
// Loads an environment image file with the specified path.
10131032
bool Plasma::loadEnvironmentImageFile(const string& filePath)
10141033
{
@@ -1052,10 +1071,16 @@ bool Plasma::loadSceneFile(const string& filePath)
10521071
auto directory = filesystem::path(filePath).parent_path();
10531072
filesystem::current_path(directory);
10541073

1074+
// Create new empty scene
1075+
_pScene = _pRenderer->createScene();
1076+
1077+
// Set the scene on the renderer.
1078+
_pRenderer->setScene(_pScene);
1079+
10551080
// Create a new scene and load the scene file into it. If that fails, return immediately.
10561081
_sceneContents.reset();
1057-
Aurora::IScenePtr pScene = _pRenderer->createScene();
1058-
if (!loadSceneFunc(_pRenderer.get(), pScene.get(), filePath, _sceneContents))
1082+
addAssetPathContainingFile(filePath);
1083+
if (!loadSceneFunc(_pRenderer.get(), _pScene.get(), filePath, _sceneContents))
10591084
{
10601085
::errorMessage("Unable to load the specified scene file: \"" + filePath + "\"");
10611086

@@ -1064,7 +1089,6 @@ bool Plasma::loadSceneFile(const string& filePath)
10641089
_instanceLayers = vector<Layers>(_sceneContents.instances.size());
10651090

10661091
// Record the new scene and update application state for the new scene.
1067-
_pScene = pScene;
10681092
updateNewScene();
10691093

10701094
// Report the load time.
@@ -1139,15 +1163,15 @@ Aurora::Path Plasma::loadMaterialXFile(const string& filePath)
11391163
processedMtlXString =
11401164
regex_replace(processedMtlXString, regex(R"(\.\.\/\.\.\/\.\.)"), mtlxResourcesPath);
11411165

1142-
// Create a new material from the materialX document.
1166+
// Create a new material from the MaterialX document.
11431167
_pScene->setMaterialType(
11441168
materialPath, Aurora::Names::MaterialTypes::kMaterialX, processedMtlXString);
11451169

11461170
return materialPath;
11471171
}
11481172
bool Plasma::applyMaterialXFile(const string& filePath)
11491173
{
1150-
// Create a new material from the materialX document.
1174+
// Create a new material from the MaterialX document.
11511175
Aurora::Path materialPath = loadMaterialXFile(filePath);
11521176
if (materialPath.empty())
11531177
{
@@ -1327,6 +1351,7 @@ void Plasma::onFilesDropped(HDROP hDrop)
13271351
}
13281352
else
13291353
{
1354+
addAssetPathContainingFile(filePath);
13301355
(*funcIt).second(filePath);
13311356
}
13321357
}
@@ -1482,8 +1507,8 @@ void Plasma::onKeyPressed(WPARAM keyCode)
14821507
}
14831508
else
14841509
{
1485-
_isOpaqueShadowsEnabled = !_isOpaqueShadowsEnabled;
1486-
options.setBoolean("isOpaqueShadowsEnabled", _isOpaqueShadowsEnabled);
1510+
_isForceOpaqueShadowsEnabled = !_isForceOpaqueShadowsEnabled;
1511+
options.setBoolean("isForceOpaqueShadowsEnabled", _isForceOpaqueShadowsEnabled);
14871512
requestUpdate();
14881513
}
14891514
break;
@@ -1515,7 +1540,7 @@ void Plasma::onKeyPressed(WPARAM keyCode)
15151540
adjustUnit(+1);
15161541
break;
15171542

1518-
// W: Add decal from materialX file.
1543+
// W: Add decal from MaterialX file.
15191544
case 0x57:
15201545
if (::GetAsyncKeyState(VK_CONTROL) != 0)
15211546
{

Applications/Plasma/Plasma.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,7 @@ class Plasma
5959
#if defined(INTERACTIVE_PLASMA)
6060
static LRESULT __stdcall wndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
6161
#endif
62-
static Aurora::IScenePtr createSampleScene(
63-
Aurora::IRenderer* pRenderer, SceneContents& contentsOut);
62+
static void createSampleScene(Aurora::IScene* pRenderer, SceneContents& contentsOut);
6463

6564
/*** Private Functions ***/
6665

@@ -96,6 +95,8 @@ class Plasma
9695
void saveImage(const wstring& filePath, const uvec2& dimensions);
9796
bool applyMaterialXFile(const string& mtlxPath);
9897
Aurora::Path loadMaterialXFile(const string& filePath);
98+
void addAssetPath(const string& path);
99+
void addAssetPathContainingFile(const string& filePath);
99100

100101
void resetMaterials();
101102
bool addDecal(const string& decalMtlXPath);
@@ -139,9 +140,9 @@ class Plasma
139140
vec3 _lightDirection = normalize(vec3(1.0f, -0.5f, 0.0f));
140141
bool _isDenoisingEnabled = false;
141142
#if defined(INTERACTIVE_PLASMA)
142-
bool _isDiffuseOnlyEnabled = false;
143-
bool _isOpaqueShadowsEnabled = false;
144-
bool _isToneMappingEnabled = false;
143+
bool _isDiffuseOnlyEnabled = false;
144+
bool _isForceOpaqueShadowsEnabled = false;
145+
bool _isToneMappingEnabled = false;
145146
#endif
146147
bool _isGroundPlaneShadowEnabled = false;
147148
bool _isGroundPlaneReflectionEnabled = false;

CMakeLists.txt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,17 @@ if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
77
message(FATAL_ERROR "In-source build is not allowed!")
88
endif()
99

10+
# See if USD was built with python.
11+
find_library(USD_usdviewq_LIBRARY_RELEASE usd_usdviewq)
12+
find_library(USD_usdviewq_LIBRARY_DEBUG usd_usdviewqd)
13+
if(USD_usdviewq_LIBRARY_RELEASE OR USD_usdviewq_LIBRARY_DEBUG)
14+
# iF USDView is found, then we know USD was built with python.
15+
set(USD_BUILT_WITH_PYTHON "True")
16+
message(STATUS "USD built with Python, system Python libraries required.")
17+
endif()
18+
1019
# Set the project name and project variables
11-
project(Aurora VERSION 23.07.0.0)
20+
project(Aurora VERSION 24.03.0.0)
1221

1322
# Create a folder for the version header files
1423
set(VERSION_FOLDER "${PROJECT_BINARY_DIR}/VersionFiles")

CONTRIBUTING.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
## Contributor License Agreement #
44
Before contributing code to this project, we ask that you sign the appropriate Contributor License Agreement (CLA):
55

6-
+ [ADSKFormCorpContribAgmtForOpenSource.docx](Doc/CLA/ADSKFormCorpContribAgmtforOpenSource.docx?raw=1): please sign this one for corporate use.
7-
+ [ADSKFormIndContribAgmtForOpenSource.docx](Doc/CLA/ADSKFormIndContribAgmtforOpenSource.docx?raw=1): please sign this one if you're an individual contributor
6+
+ [ADSKFormCorpContribAgmtForOpenSource.docx](Doc/CLA/ADSKFormCorpContribAgmtforOpenSource.docx): please sign this one for corporate use.
7+
+ [ADSKFormIndContribAgmtForOpenSource.docx](Doc/CLA/ADSKFormIndContribAgmtforOpenSource.docx): please sign this one if you're an individual contributor
88

9-
The documents include instructions on where to send the completed forms. Once a signed form has been received you will be able to submit pull requests.
9+
Return the completed form to [email protected]. Once a signed form has been received you will be able to submit pull requests.
1010

1111
Contributors are expected to follow the [Contributor Covenant](CODE_OF_CONDUCT.md), which describes the code of conduct for Autodesk open source projects like this one.
1212

@@ -34,6 +34,6 @@ The Aurora project accepts and greatly appreciates contributions. The project fo
3434

3535
When contributing code, please also include appropriate tests as part of the pull request, and follow the published [coding standards](Doc/CodingStandards.md). In particular, use the same style as the code you are modifying.
3636

37-
All development should happen against the "main" (default) branch of the repository. Please make sure the base branch of your pull request is set to the "main" branch when filing your pull request.
37+
Contributor pull requests should target the latest `contrib` branch of the repository, this will have a suffix of the latest released version, so contributions based on version v23.07 should target the `contrib/v23.07`. Please make sure the base branch of your pull request is set to the correct contrib branch when filing your pull request. Contributor pull requests that are accepted will be merged into the contrib branch and then included in the next Aurora release from there. They will be merged into the main branch along with any other changes for the next release.
3838

3939
It is highly recommended that an issue be logged on GitHub before any work is started. This will allow for early feedback from other developers and will help avoid duplicate effort.

0 commit comments

Comments
 (0)