Commit Graph

41 Commits

Author SHA1 Message Date
Tommy Walton 122eef2680 GHI-7125 : Tangent generation updates (#7252)
* Add a settings registry setting for choosing the default tangent generation method. Add another setting that will force scenes to fail to process if they are impacted by GHI-7125. Fix a bug where assets that return a Failure state from the TangentGenerateComponent will still successfully process.

Signed-off-by: Tommy Walton <waltont@amazon.com>

* Update with minor pr feedback

Signed-off-by: Tommy Walton <waltont@amazon.com>

* Update Gems/SceneProcessing/Code/Source/Generation/Components/TangentGenerator/TangentGenerateComponent.cpp

Use the AZ_STRING_FORMAT and AZ_STRING_ARG macros for printing a string_view

Co-authored-by: Chris Burel <burelc@amazon.com>
Signed-off-by: Tommy Walton <waltont@amazon.com>

Co-authored-by: Chris Burel <burelc@amazon.com>
Signed-off-by: Tommy Walton <waltont@amazon.com>
2022-02-03 11:00:23 -08:00
Allen Jackson e85ec9baf8 {lyn9996} fixes for the default procedural prefab (#7354)
* {lyn9996} adding a default transform for procprefab

adding a default transform for procprefab when the DCC transform is
also a default transform. The import logic is not to create a
transform data node unless there is a delta.

Signed-off-by: Allen Jackson <23512001+jackalbe@users.noreply.github.com>

* cleaning up the code


Signed-off-by: Allen Jackson <23512001+jackalbe@users.noreply.github.com>

* adding unique optimized mesh entries using Mesh Group + Mesh Name
adding blank LOD rule to skip that logic for default proc prefab
unique mesh group names based on file name

Signed-off-by: Allen Jackson <23512001+jackalbe@users.noreply.github.com>

* updated a comment
bumped the scene builder version number
fixed up the mesh asset path for azmodel assets

Signed-off-by: Allen Jackson <23512001+jackalbe@users.noreply.github.com>

* update the proc prefab unit tests

Signed-off-by: Allen Jackson <23512001+jackalbe@users.noreply.github.com>

* fixing SceneProcessing MeshOptimizerComponentTests due to the name changes
in the mesh opt mesh group names now


Signed-off-by: Allen Jackson <23512001+jackalbe@users.noreply.github.com>
2022-02-03 09:00:58 -06:00
Esteban Papp b3ba73db3b Removing unneded include form multiple files
Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
2022-01-20 15:30:50 -08:00
Tommy Walton 7188529652 Fix for GHI-4644: mesh optimization breaking skin influences (DCO fix) (#6336)
* Average incoming skin influences when multiple vertices have been welded. This is one option which will average out the weights even if two welded vertices have differing boneIds, but we probably also need to add the influences earlier in the process and enforce a process where the vertices do not get welded if they have influences with differing boneIds

Signed-off-by: Tommy Walton <waltont@amazon.com>

* Move skin influences from MeshBuilderSkinningInfo to the vertex attribute layers so they are considered when choosing which vertices can be welded and so they are not duplicated when compatible vertices have been welded

Signed-off-by: Tommy Walton <waltont@amazon.com>

* Updating unit tests

Signed-off-by: Tommy Walton <waltont@amazon.com>

* Remove unused functions

Signed-off-by: Tommy Walton <waltont@amazon.com>

* Update based on feedback from burelc

Signed-off-by: Tommy Walton <waltont@amazon.com>
2021-12-13 13:07:04 -08:00
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
2021-08-19 11:44:28 -07:00
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>
2021-08-18 17:33:09 -06:00
Esteban Papp 1d7f690e06 missing header includes
Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
2021-08-17 18:02:49 -07:00
Benjamin Jillich 5c90bc0d58 Skip blend shapes that influence multiple meshes (#3009)
Signed-off-by: Benjamin Jillich <jillich@amazon.com>
2021-08-11 09:45:47 +02:00
pappeste 41a1cb58cf SceneProcessing
Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
2021-07-27 19:31:19 -07:00
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>
2021-07-27 09:15:26 +02:00
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>
2021-07-23 19:13:53 +02:00
Benjamin Jillich dbe6bb673e Merge pull request #2277 from aws-lumberyard-dev/burelc/LYN-4490
[MeshOptimizer] Weld nearby vertices when optimizing meshes
2021-07-22 09:42:30 -07:00
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>
2021-07-21 13:23:07 +02:00
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>
2021-07-20 09:43:14 -07:00
Benjamin Jillich 2b89d9d563 MikkT generator fills given tangent data rather than creating a new scene node
Signed-off-by: Benjamin Jillich <jillich@amazon.com>
2021-07-20 16:25:42 +02:00
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>
2021-07-19 14:37:59 -07:00
Chris Burel 7bcd4baec4 Use a bunch of temporaries in order to make position const
Signed-off-by: Chris Burel <burelc@amazon.com>
2021-07-19 14:37:57 -07:00
Chris Burel 70a8214c2d Add logging call to show mesh optimizer effect on vertex count
Signed-off-by: Chris Burel <burelc@amazon.com>
2021-07-19 14:37:55 -07:00
Chris Burel 38046bd0c9 Don't attempt to weld similar vertices if there's blendshapes
Signed-off-by: Chris Burel <burelc@amazon.com>
2021-07-19 14:37:51 -07:00
Chris Burel cbb4778ef5 Use a filter view instead of reimplementing a filter view
Signed-off-by: Chris Burel <burelc@amazon.com>
2021-07-19 14:37:50 -07:00
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>
2021-07-19 14:37:48 -07:00
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>
2021-07-16 15:25:48 -07:00
hultonha 5a0c1fab9f Merge remote-tracking branch 'upstream/development' into hultonha_LY-69118_lambda_crash
Signed-off-by: hultonha <hultonha@amazon.co.uk>
2021-07-16 10:30:37 +01:00
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>
2021-07-15 12:18:10 +02:00
hultonha 2c9922d4b5 Merge remote-tracking branch 'upstream/development' into hultonha_LY-69118_lambda_crash 2021-07-15 09:28:47 +01:00
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>
2021-07-15 08:44:40 +02:00
hultonha f8a80468ab remove structured binding from lambda to workaround msvc bug
Signed-off-by: hultonha <hultonha@amazon.co.uk>
2021-07-14 13:13:28 +01:00
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>
2021-07-07 14:28:53 +02:00
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>
2021-07-07 11:21:09 +02:00
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>
2021-07-02 07:56:54 -07:00
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>
2021-07-01 08:53:47 -07:00
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>
2021-06-30 19:51:55 -07:00
Steve Pham 70042fcdcd O3DE Copyright Updates for Linux Foundation (#1504) 2021-06-23 10:55:22 -07:00
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.
2021-05-19 13:02:31 -07:00
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.
2021-05-03 15:43:42 -07:00
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/*
2021-04-30 07:31:42 -06:00
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.
2021-04-23 21:42:17 +01:00
Chris Burel 61fd73b467 Enable the mesh optimizer (#231) 2021-04-22 09:01:55 -07:00
alexpete 1044dc3da1 Integrating github/staging through commit ab87ed9 2021-04-09 11:27:37 -07:00
alexpete c2cbd430fe Integrating up through commit 90f050496 2021-04-07 14:03:29 -07:00
alexpete 75dc720198 Integrating latest 47acbe8 2021-03-25 13:57:57 -07:00