-
-
Notifications
You must be signed in to change notification settings - Fork 957
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP][Rendering] Blendshapes (on behalf of Noa7/Noah7071) #2136
base: master
Are you sure you want to change the base?
Conversation
Will try to take some time to review some things on Thursday/tomorrow :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -332,7 +332,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Stride.NuGetResolver", "..\ | |||
EndProject | |||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "NuGetResolver", "NuGetResolver", "{158087CF-AF74-44E9-AA20-A6AEB1E398A9}" | |||
EndProject | |||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Stride.Core.Presentation", "..\sources\presentation\Stride.Core.Presentation\Stride.Core.Presentation.csproj", "{0C63EF8B-26F9-4511-9FC5-7431DE9657D6}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Best to roll this change back, afaict it is not necessary
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's actually correct but since it isn't related to the changes of this PR, let's revert it indeed. Otherwise it might conflict later with changes on the editor.
sources/engine/Stride.Rendering/Rendering/BlendShape/TransformationBlendShape.sdsl
Outdated
Show resolved
Hide resolved
sources/engine/Stride.Rendering/Rendering/BlendShape/TransformationBlendShape.sdsl.cs
Outdated
Show resolved
Hide resolved
Position = new Vec4[value.Length]; | ||
for (int i = 0; i < value.Length; i++) | ||
{ | ||
Position[i] = value[i] * .01f; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's this multiplier about ? Is that because of how fbx scales things ? Is there a way to apply that on import through the fbx importer ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. I too was also not sure about this. The weight data in .FBX ranges 0-100. I normalized to 0-1 as more intuitive ranging to developers. but can remove the multiplier and keep it as it is. Please let me know what you think!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, okay, that makes sense. Can you move the scaling to the importer code, that way if we have other formats that support blend shapes in the future they won't have this fbx-specific scaler ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
[DataContract] | ||
public class Vec4 | ||
{ | ||
public float x { get; set; } | ||
|
||
|
||
public float y { get; set; } | ||
|
||
public float z { get; set; } | ||
|
||
public float w { get; set; } | ||
|
||
public Vec4() | ||
{ | ||
|
||
} | ||
|
||
public static implicit operator Vector4(Vec4 v) | ||
{ | ||
return new Vector4(v.x, v.y, v.z, v.w); | ||
} | ||
|
||
public static implicit operator Vec4(Vector4 v) | ||
{ | ||
return new Vec4() { x = v.X, y = v.Y, z = v.Z, w = v.W }; | ||
} | ||
|
||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This struct seems unnecessary ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. It's gone. Done!
|
||
goto label_force_compile; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will have to remove that before merge, just something to keep in mind
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Roger!
@@ -655,7 +669,7 @@ public ref class MeshConverter | |||
auto buffer = buildMesh->buffer; | |||
auto vertexBufferBinding = VertexBufferBinding(GraphicsSerializerExtensions::ToSerializableVersion(gcnew BufferData(BufferFlags::VertexBuffer, buffer)), gcnew VertexDeclaration(vertexElements->ToArray()), buildMesh->polygonCount * 3, 0, 0); | |||
|
|||
auto drawData = gcnew MeshDraw(); | |||
//auto drawData = gcnew MeshDraw(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small cleanup here and further below
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
<ProjectReference Include="..\..\engine\Stride.Rendering\Stride.Rendering.csproj"> | ||
<Project>{ad4fdc24-b64d-4ed7-91aa-62c9eda12fa4}</Project> | ||
</ProjectReference> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what's going on here, can you quickly go over why you had to remove the <Private>False</Private>
here ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had to manually update reference in Importer .vcxproj to the project Stride.Redenring vcproj. Each time I update the Stride.Redenring vcproj, removing the reference and adding back in .vcxproj. It should be auto update but for some reason it was not. I will roll back so this goes to merge!
Dictionary<int, Vector3> mappings = new Dictionary<int, Vector3>(); | ||
foreach (var tup_id_vec in Draw.VCPOLYIN) | ||
{ | ||
if (!mappings.ContainsKey(tup_id_vec.Item2)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use the new TryAdd of the dictionary to avoid double lookup in the dictionary
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
@ykafia Thanks Youness. Look forward to your feedback! |
for(int i=0;i<MAX_MORPH_TARGETS;i++) | ||
{ | ||
float4 morphedShape=BSHAPEDATA[i* MAX_VERTICES+ vID][0]; | ||
blendPos=+float4(morphedShape[0]+BasisKeyWeight,morphedShape[1], morphedShape[2] , pos[3])*morphedShape[3]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did you mean to write blendPos+=float4...
instead of blendPos=+float4...
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, error on my part, fixed to standard a= a+b format in latest
Thanks a lot for the work, I'll try to have a look at it next week. |
Thanks @tebjan, Look forward to your feedback! |
<AnalyzersNotToRemove Include="@(Analyzer)" Condition="$([System.String]::Copy(%(FullPath)).Contains('Stride'))" /> | ||
<AnalyzersNotToRemove Include="@(Analyzer)" Condition="$(FullPath.Contains('Stride'))" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Revert that. It looks like you had a conflict but resolved it the wrong way.
It would otherwise conflict with #2105
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right now the build is fairly fragile wrt those lines - let's wait until the PR is finalized and revert only then that way Noah can keep working on this.
<AnalyzersNotToRemove Include="@(Analyzer)" Condition="$([System.String]::Copy(%(FullPath)).Contains('Generator'))" /> | ||
<AnalyzersNotToRemove Include="@(Analyzer)" Condition="$([System.String]::Copy(%(FullPath)).Contains('SourceGeneration'))" /> | ||
<AnalyzersNotToRemove Include="@(Analyzer)" Condition="$(FullPath.Contains('Generator'))" /> | ||
<AnalyzersNotToRemove Include="@(Analyzer)" Condition="$(FullPath.Contains('SourceGeneration'))" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same.
<AnalyzersToRemove Include="@(Analyzer)" Exclude="@(AnalyzersNotToRemove)" /> | ||
<Analyzer Remove="@(AnalyzersToRemove)"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same
Thanks for your work. For anime styled 3D games this will be essential as those rely fully on blendshapes for facial expressions. |
Sorry for delayed response, was away. Will review this and get back next few days |
@noa7 / @Noah7071 has issues opening pull requests, I'm opening this one on his behalf with his approval
PR Details
Adds blendshape/morphtarget support for models, see #339
Related Issue
Fix #339
Types of changes
Checklist
If @tebjan and/or @ykafia could take a look at this one too that would be great :)