Commit Graph

37 Commits (4721ef829835e1d15e413c41cc410ccfa5200ed8)

Author SHA1 Message Date
Esteban Papp 68b04fa6c1 Merge branch 'development' into cmake/AddressSanitizer
Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>

# Conflicts:
#	Code/Legacy/CryCommon/LegacyAllocator.h
4 years ago
Jeremy Ong df9b4d4a2f Deprecate profiler categories based on global enum
(to be supplanted by registered budgets in the future)

Signed-off-by: Jeremy Ong <jcong@amazon.com>
4 years ago
Esteban Papp 1d7f690e06 missing header includes
Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
4 years ago
Benjamin Jillich 5c90bc0d58
Skip blend shapes that influence multiple meshes (#3009)
Signed-off-by: Benjamin Jillich <jillich@amazon.com>
4 years ago
pappeste 41a1cb58cf SceneProcessing
Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
4 years ago
Benjamin Jillich a3712b5564
TSpace setting for MikkT tangent generation (#2386)
* Added TSpace method setting which is only visible for MikkT generation.
* Fixed a bug with generating tangents for blend shapes.
* Renamed tangent space into generation method.
* Some code cleaning

Signed-off-by: Benjamin Jillich <jillich@amazon.com>
4 years ago
Chris Burel 1e10ee61ba
[MeshOptimizer] Return the correct size from the position map when there are blendshapes (#2391)
The previous version returned the incorrect size from the position map when
blendshapes are present in the model. When there are blendshapes, the
vertex welding is disabled, and nothing is inserted into the position map.
However, the position map's size was being used to dictate how many
elements to create in the skinning info. The skinning info tries to
compensate for an incorrect max vertex index by resizing its underlying
vector when adding an influence, but that was using the index as the new
size of the vector, so it was off by one. This fixes both errors.

Signed-off-by: Chris Burel <burelc@amazon.com>
4 years ago
Benjamin Jillich dbe6bb673e
Merge pull request #2277 from aws-lumberyard-dev/burelc/LYN-4490
[MeshOptimizer] Weld nearby vertices when optimizing meshes
4 years ago
Benjamin Jillich d987c45072 MikkT tangent generation support
* Default setting when no tangents rule: MikkT tangents.
* Calculates tangents/bitangents for all available uv sets.
* Creates tangent/bitangent data in in case they are not existing yet (as in: the source scene contains tangents/bitangents)
* Overwrites the tangent/bitangent data from the source scene in case MikkT is wished.
* Added helper functions to create tangent/bitangent scene nodes, finding tangent/bitangent data for a given uv layer and calculating the number of uv layers provided by the mesh scene node.

Signed-off-by: Benjamin Jillich <jillich@amazon.com>
4 years ago
Chris Burel 2355581d79 Replace Array2D with vector<vector<>>
The thought behind Array2D was that it would be more efficient from a
memory allocation perspective to have one fixed buffer that grows than
it would be to have a vector of vectors. In reality, the runtime of
inserting into the middle of one large buffer, and shifting all the
resulting elements, ends up far outweighing any memory allocation
overhead.

In the mesh optimizer, things are added to the end of each sub-vector
one by one. It isn't known up front how many elements each sub-vector
will have. With vertex welding enabled, it is far more likely that a
given vertex will be influenced by a large number of joints. When using
the Array2D to store the influences, and a vertex with a low index has
more than 4 influences, those influences have to be inserted into close
to the front of the big vector, and all the other elements shifted.
Array2D was doing this with a linear shift, shifting the elements by 1
at a time, and not providing any exponential growth on the amount of
elements reserved by each sub-vector. The result is a linear insertion
time.

By contrast, using vector<vector<Influence>> instead gives us back the
amortized constant insertion time. Since the skin influences are just
added to the end of each sub-vector, no shifting of the elements is
necessary. And since the amount of original vertex indices is known up
front, the number of sub-vectors can still be pre-created, so the
sub-vectors themselves never need to shift.

Signed-off-by: Chris Burel <burelc@amazon.com>
4 years ago
Benjamin Jillich 2b89d9d563 MikkT generator fills given tangent data rather than creating a new scene node
Signed-off-by: Benjamin Jillich <jillich@amazon.com>
4 years ago
Chris Burel 9ea46bad83 Supply the vertex index remapping to the optimized skin weights
This ensures that the optimized skin weights use the vertex indexes from
the optimized mesh

Signed-off-by: Chris Burel <burelc@amazon.com>
4 years ago
Chris Burel 7bcd4baec4 Use a bunch of temporaries in order to make `position` `const`
Signed-off-by: Chris Burel <burelc@amazon.com>
4 years ago
Chris Burel 70a8214c2d Add logging call to show mesh optimizer effect on vertex count
Signed-off-by: Chris Burel <burelc@amazon.com>
4 years ago
Chris Burel 38046bd0c9 Don't attempt to weld similar vertices if there's blendshapes
Signed-off-by: Chris Burel <burelc@amazon.com>
4 years ago
Chris Burel cbb4778ef5 Use a filter view instead of reimplementing a filter view
Signed-off-by: Chris Burel <burelc@amazon.com>
4 years ago
Chris Burel e4e1946018 Determine the original vertex index based on the position
The Assimp library does not expose the FBX control point indices. This
change causes vertices that are close enough in their position to be
considered as coming from the same control point. This allows the mesh
optimizer to consider vertices with the same control point index (or
"original vertex index" as it is called in the code) for deduplication.

Signed-off-by: Chris Burel <burelc@amazon.com>
4 years ago
Steve Pham 38261d0800
Shorten copyright headers by splitting into 2 lines (#2213)
* Updated all copyright headers to split the longer original copyright line into 2 shorter lines

Signed-off-by: Steve Pham <spham@amazon.com>
4 years ago
hultonha 5a0c1fab9f Merge remote-tracking branch 'upstream/development' into hultonha_LY-69118_lambda_crash
Signed-off-by: hultonha <hultonha@amazon.co.uk>
4 years ago
Benjamin Jillich 0863a24490
Revert "[MeshOptimizer] Determine the original vertex index based on the position (#2008)" (#2188)
This reverts commit a077a88d3f due to assets failing on Jenkins.

Signed-off-by: Benjamin Jillich <jillich@amazon.com>
4 years ago
hultonha 2c9922d4b5 Merge remote-tracking branch 'upstream/development' into hultonha_LY-69118_lambda_crash 4 years ago
Chris Burel a077a88d3f
[MeshOptimizer] Determine the original vertex index based on the position (#2008)
* Determine the original vertex index based on the position

The Assimp library does not expose the FBX control point indices. This
change causes vertices that are close enough in their position to be
considered as coming from the same control point. This allows the mesh
optimizer to consider vertices with the same control point index (or
"original vertex index" as it is called in the code) for deduplication.

Signed-off-by: Chris Burel <burelc@amazon.com>

* Use a filter view instead of reimplementing a filter view

Signed-off-by: Chris Burel <burelc@amazon.com>

* Don't attempt to weld similar vertices if there's blendshapes

Signed-off-by: Chris Burel <burelc@amazon.com>

* Add test for the mesh optimizer's ability to weld nearby vertices

Signed-off-by: Chris Burel <burelc@amazon.com>

* Add logging call to show mesh optimizer effect on vertex count

Signed-off-by: Chris Burel <burelc@amazon.com>

* Use a bunch of temporaries in order to make `position` `const`

Signed-off-by: Chris Burel <burelc@amazon.com>

* Supply the vertex index remapping to the optimized skin weights

This ensures that the optimized skin weights use the vertex indexes from
the optimized mesh

Signed-off-by: Chris Burel <burelc@amazon.com>
4 years ago
hultonha f8a80468ab remove structured binding from lambda to workaround msvc bug
Signed-off-by: hultonha <hultonha@amazon.co.uk>
4 years ago
Benjamin Jillich 2ab2503337
Revert "[MeshOptimizer] Determine the original vertex index based on the position (#1562)" (#1902)
This reverts commit ef1f95f1d0.

Signed-off-by: Benjamin Jillich <jillich@amazon.com>
5 years ago
Chris Burel ef1f95f1d0
[MeshOptimizer] Determine the original vertex index based on the position (#1562)
* Determine the original vertex index based on the position

The Assimp library does not expose the FBX control point indices. This
change causes vertices that are close enough in their position to be
considered as coming from the same control point. This allows the mesh
optimizer to consider vertices with the same control point index (or
"original vertex index" as it is called in the code) for deduplication.

Signed-off-by: Chris Burel <burelc@amazon.com>

* Use a filter view instead of reimplementing a filter view

Signed-off-by: Chris Burel <burelc@amazon.com>

* Don't attempt to weld similar vertices if there's blendshapes

Signed-off-by: Chris Burel <burelc@amazon.com>

* Add test for the mesh optimizer's ability to weld nearby vertices

Signed-off-by: Chris Burel <burelc@amazon.com>

* Add logging call to show mesh optimizer effect on vertex count

Signed-off-by: Chris Burel <burelc@amazon.com>

* Use a bunch of temporaries in order to make `position` `const`

Signed-off-by: Chris Burel <burelc@amazon.com>
5 years ago
AMZN-stankowi 0c43493e29
FBX to Scene part 3, tangent generation rule FBX -> SourceScene (#1747)
* Tangent space FromFBX -> FromSourceScene

Signed-off-by: stankowi <4838196+AMZN-stankowi@users.noreply.github.com>
5 years ago
AMZN-stankowi 4c4be73bd5
First pass FBX -> Scene File conversion. (#1699)
This is the simple pass, minimizing code changes and focused on comments.

Signed-off-by: stankowi <4838196+AMZN-stankowi@users.noreply.github.com>
5 years ago
Steve Pham b4a2edec6a
Final update copyright headers to reference license files at the repo root (#1693)
* Final update copyright headers to reference license files at the repo root

Signed-off-by: spham <spham@amazon.com>

* Fix copyright validator unit tests to support the stale O3DE header scenario

Signed-off-by: spham <spham@amazon.com>
5 years ago
Steve Pham 70042fcdcd
O3DE Copyright Updates for Linux Foundation (#1504) 5 years ago
AMZN-stankowi f779821ac0
Helios - LYN-3250 - Fixed morph targets for meshes that had multiple … (#696)
* Helios - LYN-3250 - Fixed morph targets for meshes that had multiple materials (#374)

Fixed morph targets for meshes that had multiple materials and were split by AssImp: Recombined them into one mesh in the O3DE scene graph, so the behavior would match FBX SDK.
5 years ago
Chris Burel 7f81602fe7
Use the material id from the base mesh when optimizing blend shapes (#517)
This is cherry-picked from #311

When processing meshes with blend shapes, the mesh optimizer disables the
optimize duplicates setting, to prevent potential vertex reodering that
could cause the base mesh vertices to become out of sync with the blend
shape. However, it will still reorder vertices based on their material.
It places all triangles that use the same material in the same submesh,
grouping them together in the resulting mesh. The SceneAPI does not track
material ids for blend shapes. To ensure that the blend shape triangles are
reordered in the same way as the base shape, this change makes the blend
shape optimization use the material id from the base shape.
5 years ago
bosnichd 1d4c483e73
Red code legacy renderer (#383)
- Remove some references to gEnv->pRenderer/GetIEditor()->GetRenderer() that is now always null.
- Restore the debug console to existence.
- Stop building the following in preparation for their removal:

Code/CryEngine/Cry3DEngine/*
Code/CryEngine/RenderDll/*
Code/Tools/CryFXC/*
Code/Tools/HLSLCrossCompiler/*
Code/Tools/HLSLCrossCompilerMETAL/*
Code/Tools/RC/*
Code/Tools/ShaderCacheGen/*
Tools/CrySCompileServer/*
5 years ago
Aaron Ruiz Mora 45fbc86d2d
Fix cloth with MeshOptimization ON
- Reexport cloth assets with AssImp ON. These was necessary because AssImp collects a different name for the color streams than FbxSDK and therefore they needed to be reassigned in the cloth rule.
- Adding '_optimized' string to a global variable and using StringFunc RChop to remove it for a string.
5 years ago
Chris Burel 61fd73b467
Enable the mesh optimizer (#231) 5 years ago
alexpete 1044dc3da1 Integrating github/staging through commit ab87ed9 5 years ago
alexpete c2cbd430fe Integrating up through commit 90f050496 5 years ago
alexpete 75dc720198 Integrating latest 47acbe8 5 years ago