Skip to content

Commit dbb7199

Browse files
Release v23.07 (#139)
* OGSMOD-2545: Port latest Platform code to Aurora (#76) * OGSMOD-2545: Port latest Oxide code to hdAurora (#77) * OGSMOD-3172: Implement image processing via custom resolver (#78) * OGSMOD-3264: Ensure image nodes are parsed correctly (#79) * OGSMOD-3171: Set camera projection in render pass (#81) * OGSMOD-3281: Aurora build failed to find Boost (if USD does not build with Python) and miniz (case issue on Linux) * OGSMOD-3294: Fixed the Linux build * OGSMOD-3048: fix Inventor crash when switching to RRR (#89) * OGSMOD-3171: Support Linerization of LDR images (#91) * OGSMOD-2529: Speed up compile times (#84) * OGSMOD-3343: Add normal to BSDF inputs (#92) * OGSMOD-3324: Add version numbers for DLLs (#90) * OGSMOD-1391: Support multiple distant lights (#93) * OGSMOD-3410: Support half float input in ImageProcessingResolver (#94) * OGSMOD-3406: fix performance regression caused by bug in resource tracker (#97) * OGSMOD-3406: fix performance regression caused by building TLAS every frame * OGSMOD-3405: Fix crash on material changes (#98) * Add debug normals test * OGSMOD-3414: Rename the DLLs to match USD case conventions (#96) * OGSMOD-3434: Avoid empty bounds in HdAurora (#104) * OGSMOD-3435: Accept vec3 opacity from Hydra UsdPreviewSurface (#105) * OGSMOD-3436: Disable tangents in HdAurora (#107) * OGSMOD-3451 Fixed the broken debug build of OpenImageIO and USD * OGSMOD-3444: Use transfer buffers for CPU-GPU transfers (#108) * OGSMOD-3528: Don't use transfer buffers for Alias Maps (#112) * OGSMOD-3539: Use D3D12_RESOURCE_STATE_COPY_DEST for transfer buffers (#115) * OGSMOD-3579: Implement material emission specified with a color (#118) * OGSMOD-3340: Ensure right toolset is used for VS2022 (#121) * OGSMOD-3580: Implement material emission specified with an image (#119) * OGSMOD-3696: Add clang-format pre-commit hook to Aurora (#124) * OGSMOD-3340: Update build instructions to mention Visual Studio 2022 (#122) * OGSMOD-3581: Implement material emission with denoising enabled (#125) * OGSMOD-3301: Generate material accessors + struct in test (#128) * OGSMOD-3301: Fix HGI backend (#130) * OGSMOD-3531: Ensure tangent actually disabled in all cases (#131)
1 parent 5ad8c8a commit dbb7199

File tree

237 files changed

+11083
-3835
lines changed

Some content is hidden

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

237 files changed

+11083
-3835
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
# Ignore build directories.
22
Build/
3+
Build.*/
34
_build/
45
Externals/
56
_externals/
67

78
# Ignore script generated files
89
Scripts/cmake/externalsConfig.cmake
9-
10+
__pycache__
1011

1112
# Ignore IDE cache folders
1213
.vs/

.pre-commit-config.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# clang-format pre-commit hook configuration file.
2+
# Should be activated before commiting code to the Aurora repository, see Doc\CodingStandards.md for more details.
3+
repos:
4+
- repo: https://github.com/pre-commit/mirrors-clang-format
5+
rev: v16.0.6
6+
hooks:
7+
- id: clang-format
8+
exclude: Source/DirectX/DirectXHeaders/d3dx12.h
9+

Applications/Plasma/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ add_executable(${PROJECT_NAME}
3030
"SceneContents.h"
3131
)
3232

33-
# Set custom ouput properties.
33+
# Set custom output properties.
3434
set_target_properties(${PROJECT_NAME} PROPERTIES
3535
FOLDER "Applications"
3636
RUNTIME_OUTPUT_DIRECTORY "${RUNTIME_OUTPUT_DIR}"

Applications/Plasma/Camera.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2022 Autodesk, Inc.
1+
// Copyright 2023 Autodesk, Inc.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

Applications/Plasma/Camera.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2022 Autodesk, Inc.
1+
// Copyright 2023 Autodesk, Inc.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

Applications/Plasma/Libraries.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2022 Autodesk, Inc.
1+
// Copyright 2023 Autodesk, Inc.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

Applications/Plasma/Loaders.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2022 Autodesk, Inc.
1+
// Copyright 2023 Autodesk, Inc.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

Applications/Plasma/OBJLoader.cpp

Lines changed: 85 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2022 Autodesk, Inc.
1+
// Copyright 2023 Autodesk, Inc.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -13,11 +13,14 @@
1313
// limitations under the License.
1414
#include "pch.h"
1515

16+
#include "Aurora/Foundation/Geometry.h"
1617
#include "Loaders.h"
1718
#include "SceneContents.h"
1819

1920
uint32_t ImageCache::whitePixels[1] = { 0xFFFFFFFF };
2021

22+
#define PLASMA_HAS_TANGENTS 0
23+
2124
// A simple structure describing an OBJ index, which has sub-indices for vertex channels: position,
2225
// normal, and texture coordinates.
2326
struct OBJIndex
@@ -120,7 +123,8 @@ bool loadOBJFile(Aurora::IRenderer* /*pRenderer*/, Aurora::IScene* pScene, const
120123
{
121124
transmissionColor = vec3(1.0f);
122125
}
123-
vec3 opacity = vec3(1.0f); // objMaterial.dissolve (see NOTE above)
126+
vec3 emissionColor = ::sRGBToLinear(make_vec3(objMaterial.emission));
127+
vec3 opacity = vec3(1.0f); // objMaterial.dissolve (see NOTE above)
124128

125129
// Load the base color image file from the "map_Kd" file path.
126130
// NOTE: Set the linearize flag, as these images typically use the sRGB color space.
@@ -132,6 +136,11 @@ bool loadOBJFile(Aurora::IRenderer* /*pRenderer*/, Aurora::IScene* pScene, const
132136
Aurora::Path specularRoughnessImage =
133137
imageCache.getImage(objMaterial.roughness_texname, pScene, false);
134138

139+
// Load the emission color image file from the "map_Ke" file path.
140+
// NOTE: Set the linearize flag, as these images typically use the sRGB color space.
141+
Aurora::Path emissionColorImage =
142+
imageCache.getImage(objMaterial.emissive_texname, pScene, true);
143+
135144
// Load the opacity image file from the "map_d" file path.
136145
// NOTE: Don't set the linearize flag, as these images typically use the linear color space.
137146
Aurora::Path opacityImage = imageCache.getImage(objMaterial.alpha_texname, pScene, false);
@@ -144,17 +153,33 @@ bool loadOBJFile(Aurora::IRenderer* /*pRenderer*/, Aurora::IScene* pScene, const
144153
: objMaterial.normal_texname;
145154
Aurora::Path normalImage = imageCache.getImage(normalFilePath, pScene, false);
146155

147-
Aurora::Path materialPath = filePath + ":OBJFileMaterial-" + to_string(mtlCount++);
156+
// Set emission (the actual light emitted) to 1.0 if there is an emission color image or the
157+
// emission color has any positive components.
158+
float emission = (!emissionColorImage.empty() || emissionColor.length()) ? 1.0f : 0.0f;
148159

149160
// Create an Aurora material, assign the properties, and add the material to the list.
150-
pScene->setMaterialProperties(materialPath,
151-
{ { "base_color", (baseColor) }, { "metalness", metalness },
152-
{ "specular_color", (specularColor) }, { "specular_roughness", specularRoughness },
153-
{ "specular_IOR", specularIOR }, { "transmission", transmission },
154-
{ "transmission_color", (transmissionColor) }, { "opacity", (opacity) },
155-
{ "base_color_image", baseColorImage },
156-
{ "specular_roughness_image", specularRoughnessImage },
157-
{ "opacity_image", opacityImage }, { "normal_image", normalImage } });
161+
// clang-format off
162+
Aurora::Properties properties =
163+
{
164+
{ "base_color", baseColor },
165+
{ "metalness", metalness },
166+
{ "specular_color", specularColor },
167+
{ "specular_roughness", specularRoughness },
168+
{ "specular_IOR", specularIOR },
169+
{ "transmission", transmission },
170+
{ "transmission_color", transmissionColor },
171+
{ "emission", emission },
172+
{ "emission_color", emissionColor },
173+
{ "opacity", opacity },
174+
{ "base_color_image", baseColorImage },
175+
{ "specular_roughness_image", specularRoughnessImage },
176+
{ "emission_color_image", emissionColorImage },
177+
{ "opacity_image", opacityImage },
178+
{ "normal_image", normalImage }
179+
};
180+
// clang-format on
181+
Aurora::Path materialPath = filePath + ":OBJFileMaterial-" + to_string(mtlCount++);
182+
pScene->setMaterialProperties(materialPath, properties);
158183
lstMaterials.push_back(materialPath);
159184
};
160185

@@ -178,8 +203,10 @@ bool loadOBJFile(Aurora::IRenderer* /*pRenderer*/, Aurora::IScene* pScene, const
178203
}
179204
hasMesh = true;
180205

181-
Aurora::Path sceneInstancePath = filePath + ":OBJFileInstance-" + to_string(objectCount);
182-
Aurora::Path geomPath = filePath + ":OBJFileGeom-" + to_string(objectCount);
206+
Aurora::Path sceneInstancePath =
207+
filePath + "-" + shape.name + ":OBJFileInstance-" + to_string(objectCount);
208+
Aurora::Path geomPath =
209+
filePath + "-" + shape.name + ":OBJFileGeom-" + to_string(objectCount);
183210
objectCount++;
184211

185212
SceneGeometryData& geometryData = sceneContents.addGeometry(geomPath);
@@ -247,6 +274,32 @@ bool loadOBJFile(Aurora::IRenderer* /*pRenderer*/, Aurora::IScene* pScene, const
247274
}
248275
}
249276

277+
// Calculate the vertex count.
278+
uint32_t vertexCount = static_cast<uint32_t>(positions.size()) / 3;
279+
280+
// Do we have tangents ? Default to false.
281+
bool bHasTangents = false;
282+
283+
// Create normals if they are not available.
284+
if (!bHasNormals)
285+
{
286+
normals.resize(positions.size());
287+
Foundation::calculateNormals(
288+
vertexCount, positions.data(), indexCount / 3, indices.data(), normals.data());
289+
}
290+
291+
// Create tangents if texture coordinates are available.
292+
#if PLASMA_HAS_TANGENTS
293+
auto& tangents = geometryData.tangents;
294+
if (bHasTexCoords)
295+
{
296+
tangents.resize(normals.size());
297+
Foundation::calculateTangents(vertexCount, positions.data(), normals.data(),
298+
tex_coords.data(), indexCount / 3, indices.data(), tangents.data());
299+
bHasTangents = true;
300+
}
301+
#endif
302+
250303
Aurora::GeometryDescriptor& geomDesc = geometryData.descriptor;
251304
geomDesc.type = Aurora::PrimitiveType::Triangles;
252305
geomDesc.vertexDesc.attributes[Aurora::Names::VertexAttributes::kPosition] =
@@ -255,11 +308,15 @@ bool loadOBJFile(Aurora::IRenderer* /*pRenderer*/, Aurora::IScene* pScene, const
255308
Aurora::AttributeFormat::Float3;
256309
geomDesc.vertexDesc.attributes[Aurora::Names::VertexAttributes::kTexCoord0] =
257310
Aurora::AttributeFormat::Float2;
258-
geomDesc.vertexDesc.count = static_cast<uint32_t>(positions.size()) / 3;
311+
if (bHasTangents)
312+
geomDesc.vertexDesc.attributes[Aurora::Names::VertexAttributes::kTangent] =
313+
Aurora::AttributeFormat::Float3;
314+
geomDesc.vertexDesc.count = vertexCount;
259315
geomDesc.indexCount = indexCount;
260-
geomDesc.getAttributeData = [geomPath, &sceneContents](Aurora::AttributeDataMap& buffers,
261-
size_t /* firstVertex*/, size_t /* vertexCount*/,
262-
size_t /* firstIndex*/, size_t /* indexCount*/) {
316+
geomDesc.getAttributeData = [geomPath, bHasTangents, &sceneContents](
317+
Aurora::AttributeDataMap& buffers, size_t /* firstVertex*/,
318+
size_t /* vertexCount*/, size_t /* firstIndex*/,
319+
size_t /* indexCount*/) {
263320
SceneGeometryData& geometryData = sceneContents.geometry[geomPath];
264321

265322
buffers[Aurora::Names::VertexAttributes::kPosition].address =
@@ -276,6 +333,17 @@ bool loadOBJFile(Aurora::IRenderer* /*pRenderer*/, Aurora::IScene* pScene, const
276333
buffers[Aurora::Names::VertexAttributes::kTexCoord0].size =
277334
geometryData.texCoords.size() * sizeof(float);
278335
buffers[Aurora::Names::VertexAttributes::kTexCoord0].stride = sizeof(vec2);
336+
337+
// Fill in the tangent data, if we have them.
338+
if (bHasTangents)
339+
{
340+
buffers[Aurora::Names::VertexAttributes::kTangent].address =
341+
geometryData.tangents.data();
342+
buffers[Aurora::Names::VertexAttributes::kTangent].size =
343+
geometryData.tangents.size() * sizeof(float);
344+
buffers[Aurora::Names::VertexAttributes::kTangent].stride = sizeof(vec3);
345+
}
346+
279347
buffers[Aurora::Names::VertexAttributes::kIndices].address =
280348
geometryData.indices.data();
281349
buffers[Aurora::Names::VertexAttributes::kIndices].size =

Applications/Plasma/PerformanceMonitor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2022 Autodesk, Inc.
1+
// Copyright 2023 Autodesk, Inc.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

Applications/Plasma/Plasma.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2022 Autodesk, Inc.
1+
// Copyright 2023 Autodesk, Inc.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -64,7 +64,7 @@ Plasma::Plasma(HINSTANCE hInstance, unsigned int width, unsigned int height)
6464
::SetWindowTextW(_hwnd, Foundation::s2w(report.str()).c_str());
6565
});
6666
}
67-
#else //! INTERACTIVE_PLASMA
67+
#else //! INTERACTIVE_PLASMA
6868
// Application constructor.
6969
Plasma::Plasma(unsigned int width, unsigned int height)
7070
{
@@ -554,6 +554,8 @@ bool Plasma::initialize()
554554
_camera.fit(_sceneContents.bounds, kDefaultDirection);
555555
}
556556

557+
_pDistantLight = _pScene->addLightPointer(Aurora::Names::LightTypes::kDistantLight);
558+
557559
// Get the environment map file path from the env argument.
558560
if (arguments.count("env"))
559561
{
@@ -753,7 +755,11 @@ void Plasma::updateLighting()
753755
{ Aurora::Names::EnvironmentProperties::kBackgroundTransform, transform } });
754756

755757
// Update the directional light.
756-
_pScene->setLight(lightIntensity, value_ptr(lightColor), value_ptr(_lightDirection));
758+
_pDistantLight->values().setFloat(Aurora::Names::LightProperties::kIntensity, lightIntensity);
759+
_pDistantLight->values().setFloat3(
760+
Aurora::Names::LightProperties::kColor, value_ptr(lightColor));
761+
_pDistantLight->values().setFloat3(
762+
Aurora::Names::LightProperties::kDirection, value_ptr(_lightDirection));
757763
}
758764

759765
void Plasma::updateGroundPlane()
@@ -1647,7 +1653,7 @@ int WINAPI wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE /*hPrevInstance
16471653

16481654
return result ? 0 : -1;
16491655
}
1650-
#else //! INTERACTIVE_PLASMA
1656+
#else //! INTERACTIVE_PLASMA
16511657
int main(int argc, char* argv[])
16521658
{
16531659
// Create an application object on the stack, and run it. The run() function returns when

0 commit comments

Comments
 (0)