keenanwoodall / deform Goto Github PK
View Code? Open in Web Editor NEWA fully-featured deformer system for Unity that lets you stack effects to animate models in real-time
License: MIT License
A fully-featured deformer system for Unity that lets you stack effects to animate models in real-time
License: MIT License
Hello! a video is better than words so here it is:
https://youtu.be/hxlDRrMjSiY
As you can see, the Black Noise stay visually still, while the deform plugin apply deformation to the mesh. (it appen when deforming, but if we move or rotate the object without deform, it works fine.
We are using a Trilanar Shader for the Black Noise. We are using shadergraph.
A triplanar shader works by creating three planes along each axis in object space (object space is important). Once we have those we want to render our texture on each of the planes. Then, we project those rendered images onto our object using the normal of the object to map things.
the question is : how to stick the texture to the surface while deforming the surface with the deform plugin (with a triplanar shader because whe also need to change some values dynamically)
Here the shader used:
Shader.zip
The sine deformer should have a limited and unlimited mode like some of the other deformers (bend, twist, twirl etc)
Hi,
If I use deforn plugin, when I quit the game by Application.Quit. The game is crash.
Could you please help me check this issue?
Thanks.
Every deformable has its dynamic mesh serialized as a unique mesh. This bloats scene file size. It's unnecessary because the dynamic mesh can be generated from the original mesh. MeshData.DynamicMesh
isn't serialized, but the target (Mesh Filter or Skinned Mesh Renderer) uses it and is serialized. Somehow the targets mesh reference needs to be overridden when serialized, to point to the original mesh. Then at runtime the dynamic mesh can be generated.
My post is more like enhancement.
In ProBuilder, when you right-click the Tab, there is "Use Icon Mode".
A similar thing can be implemented to "Creator Window" so there will be more space?
Might have big implications I can't foresee, but almost every deformer runs in worldspace and roughly follows these steps:
If every deformer is doing these transformations, we could increase perf a lot by having the Deformable transform its data into worldspace once before the deformers process it and then once more to transform back to local space after the deformers are done. That way deformers can operate on mesh data in worldspace without any overhead
Before | After |
---|---|
![]() |
![]() |
Setting a deformable's update mode to custom doesn't stop the deformable from getting updated by the deformable manager.
To Reproduce
Expected behavior
When the update mode is custom it shouldn't be processed by the deformable manager. The mesh shouldn't be changed unless the user does it manually through code.
Any chance to distribute it as a package?
I am using set of bend deformers whose angles I update in runtime to create a deformation animation sequence. It works fine in editor but on mobile devices, only certain deformable meshes are affected.
While this bug was being reproduced on android device, I checked log to find the following error being thrown repeatedly.
Cannot copy data as the managed data is invalid
While loading the scene with this deformation animation, the build also crashes sometimes.
If vertices are unchanged the bounds and normals should not need to be updated right? Gain some perf by skipping recalculation
using an fbx, it gave me errors of non writeable mesh, so i copied the mesh out, used that in the explorer, but it still wont take it, what should i do to be able to use your deform plugin in these meshes?
i tried it in the default meshes from unity and they do work
I use the first option to install this package to Unity.
Install via UPM
Navigate to your project's Packages folder and open the manifest.json file.
Add this line below the "dependencies": { line
"com.beans.deform": "https://github.com/keenanwoodall/Deform.git",
UPM should now install Deform and it's dependencies.
Don't want to use git? Just download and unzip the repository into the Packages folder.
When I installed this package, I took these errors:
Does anybody help me to fix these errors?
If a mesh does not have read/write enabled it can not be modified by Deform. Right now the Deformable will show an error help box explaining what to do. As the person who has likely used Deform the most, I still forget to enable read/write on meshes. Selecting the mesh and enabling feels tedious and I'd prefer to have a "Fix it" button on the Deformable inspector that does it for me.
(If this happens to be impossible for some reason, a good middle ground would be a button that pings the mesh asset in the project to make tracking down the easier)
I tried, to use this git-repository in an external folder and import it in unity 2019.3f5 as an package. It turns out, it goes in an endless loop trying to create the settings asset:
In the Editor.log of unity it loops through that:
`
Start importing Assets/Deform/EditorResources/DeformSettings.asset using Guid(3fd6d0f0be206104d92b623fbdfdddac) Importer(-1,00000000000000000000000000000000)
Done importing asset: 'Assets/Deform/EditorResources/DeformSettings.asset' (target hash: '004dc9a8bef873adffdb5497b92c9620') in 0.005325 seconds
Import parameters got modified during import
UnityEditor.AssetDatabase:CreateAsset(Object, String)
DeformEditor.DeformEditorResources:CreateAsset(Object, String) (at ThirdParty\Deform\Code\Editor\DeformEditorResources.cs:52)
DeformEditor.DeformEditorSettings:EnsureSettingsAsset() (at ThirdParty\Deform\Code\Editor\DeformEditorSettings.cs:16)
[C:\buildslave\unity\build\Modules/AssetDatabase/Editor/V2/AssetImportManager.cpp line 332]
(Filename: ThirdParty/Deform/Code/Editor/DeformEditorResources.cs Line: 52)
`
It seems, there are hardcoded paths, in the creation, that forces the user to use it in the Assets/Deform folder and not as a package :(
I am trying to create a breaking wave using the Twirl deformer.
Below is the current output using the Twirl deformer:
Required output:
Below are the differences between the current and the required output:
I am looking for suggestions or thoughts which can help in achieving the required output. Thank you.
If there's a Deformable component on the parent they should add themselves to it!
Different point cache file types should all be converted into a single custom point cache file type (probably a ScriptableObject
) from a custom window. It may be easier to repurpose Keijiro's importer than to write one from scratch.
The Point Cache deformer should have controls for speed, loop mode and interpolation.
Hi,
I would like to transform the position + rotation of a GameObject (a camera) along with the deformation of a mesh. Is there a way to do that?
Thank you for this ++ asset!
Steps to reproduce:
Expected: sphere exports as sphere and is able to re-import in Unity.
Probable cause: exported OBJ is written with current Locale instead of CultureInvariant.
Add ability to roll model. Like sushi.
We installed Deform as a package in both Unity 2019.2 and 2019.3. The Creator Window says "No deformers found." and throws an exception:
ReflectionTypeLoadException: Exception of type 'System.Reflection.ReflectionTypeLoadException' was thrown.
System.Reflection.Assembly.GetTypes () (at <437ba245d8404784b9fbab9b439ac908>:0)
DeformEditor.CreatorWindow+d__18.MoveNext () (at Library/PackageCache/com.beans.deform@5c7ccda4236aec3ff1e7ada04879bca945eba466/Code/Editor/CreatorWindow.cs:317)
System.Collections.Generic.EnumerableHelpers.ToArray[T] (System.Collections.Generic.IEnumerable1[T] source, System.Int32& length) (at <351e49e2a5bf4fd6beabb458ce2255f3>:0) System.Linq.Buffer
1[TElement]..ctor (System.Collections.Generic.IEnumerable1[T] source) (at <351e49e2a5bf4fd6beabb458ce2255f3>:0) System.Linq.OrderedEnumerable
1[TElement].ToArray () (at <351e49e2a5bf4fd6beabb458ce2255f3>:0)
System.Linq.Buffer1[TElement]..ctor (System.Collections.Generic.IEnumerable
1[T] source) (at <351e49e2a5bf4fd6beabb458ce2255f3>:0)
System.Linq.OrderedEnumerable1[TElement].ToList () (at <351e49e2a5bf4fd6beabb458ce2255f3>:0) System.Linq.Enumerable.ToList[TSource] (System.Collections.Generic.IEnumerable
1[T] source) (at <351e49e2a5bf4fd6beabb458ce2255f3>:0)
DeformEditor.CreatorWindow.UpdateDeformerAttributes () (at Library/PackageCache/com.beans.deform@5c7ccda4236aec3ff1e7ada04879bca945eba466/Code/Editor/CreatorWindow.cs:62)
DeformEditor.CreatorWindow.OnEnable () (at Library/PackageCache/com.beans.deform@5c7ccda4236aec3ff1e7ada04879bca945eba466/Code/Editor/CreatorWindow.cs:69)
UnityEditor.EditorWindow:GetWindow(String, Boolean)
DeformEditor.CreatorWindow:ShowWindow() (at Library/PackageCache/com.beans.deform@5c7ccda4236aec3ff1e7ada04879bca945eba466/Code/Editor/CreatorWindow.cs:56)
The Unity Editor crashes when I try to add a Deformer to a cube model.
I am using Unity 2018.3.10f1 on Windows 10 and verified I am using the same versions of the Packages in the package.json.
Editor log attached
This is a question, not an issue (I think).
Using Deformable in a prefab. When the PF is instantiated, the original mesh is briefly rendered (single frame) before the deform is applied. For example, the CylindrifyDeformer. Is there a method of forcing the initialization the Deformable before the first rendering? For example, triggered by Awake or whatever?
Thanks
Mike
Just add this to packages.json (just after the "dependencies" line):
"com.beans.deform": "https://github.com/keenanwoodall/Deform.git",
Hello. I have a Build() process in my project where I need at one point, to change the current Mesh of the GameObject (and theire is an ElasticDeformable on it. How do I do it correctly without breaking everything ?
`
Deformable deformable = gameObject.GetComponent();
deformable.ChangeMesh(ModelData.Mesh);
deformable.ResetDynamicData();
`
And it work, but then I have a lot of errors: "A Native Collection has not been disposed, resulting in a memory leak. Enable Full StackTraces to get more details."
It seems to work thought, but I don't like those errors :/
My Goal is to "Reset" the ElasticDeformable, then Change the Mesh of the MeshFilter, and then "Enable" Again the ElasticDeformable. One note thought: Doing so while enabling/Disabling the ElasticDeformable Component doesn't seams to work.
Think I found a bug! ๐
Hello, I would like to know if it's currently possible. I have a prefab with +10 mesh inside.
I saw that if I create for each child's gameObjects an Deformable Components, it obviously work if I setup for each of them the same deformer.
But I wonder if we could have an option in the Deformable to say "Apply to childs" or something. I wonder if the way I do is the good way.
Also: when I'm adding a Deformer from the Creator Window, selected on a gameObject, I would like it to add itself to EVERY deformable childs.
When typing to filter the displayed deformers in the Creator window, it would be nice to be able to press the down arrow key to select the next element in the list and up for the previous. Pressing enter would be the equivalent of clicking the selected button.
Hi,
I'm using multiple bends in one mesh in order to have an image like a cream flowing (think soft-serve ice cream). In order to have this imagery, I add one bend deformer to the mesh, move the deformer's transform with the bend angle set to some angle <90, and then set the angle to 180, and do the same move again in the opposite direction with another bend. My problem here is the second layer's bend also affects the first layer.
Would it be possible to use a Render Texture for the displacement deformer instead of a static Texture 2d?
When using a deformer on a mesh that is rotating the deformed mesh jitters. I'm trying to apply a deformer to a rolling sphere and am seeing a lot of jittering at higher angular vels. Has anyone else seen this?
The package should generate the default material somewhere in the Assets folder so that if Deform is installed via the manifest file, the user can change the shader on the default material. If possible, the generated material should detect the render pipeline and have its shader set accordingly.
For those who want to modify meshes without components in code it would be good to document the best practices. I have not done much mesh modifications without the greater component system, so perhaps the API could be cleaned up in the process.
You should be able to pause deformables and not have to update them again when entering play mode. This is a bit tough, because native arrays have to be disposed when changing between edit and play mode. A possible solution would be to serialize MeshData.dynamicManaged
and copy that into MeshData.DynamicNative
when initialized, but that would counteract any attempts at solving the mesh serialization issues (#10) and would bloat scene sizes even more.
Almost all deformers have an "Axis" property that contains the transform the deformer will perform vertex calculations relative to. "Axis" is pretty terrible name as it doesn't really describe that functionality. Unfortunately this field/property is everywhere in the project and changing the name could be a pain and potentially a breaking change. Not sure if it's worth it, but I'd like to at least try the change.
Hello.
Could someone try to make a Bevel deformer ?
I would like to use one to make objects look less blocky.
I tried to find some sample scripts, but i don't quite understand them yet.
https://github.com/nepluno/RoundCornerBox
https://answers.unity.com/questions/1007222/round-procedural-square-mesh-corners-c.html
https://stackoverflow.com/questions/50273477/smooth-dynamically-generated-mesh-in-unity
@keenanwoodall Since latest versions of Unity support Mesh.SetVertices, Mesh.SetNormals, etc with native arrays I was wondering if we still need to do this step?
From MeshData.cs:
// Copy the native data into the managed data for efficient transfer into the actual mesh.
DataUtils.CopyNativeDataToManagedData(dynamicManaged, DynamicNative, dataFlags);
I have tried bypassing it and doing this instead and it works fine, I think it might be more efficient since we can skip the managed overhead entirely?
if ((dataFlags & DataFlags.Vertices) != 0)
DynamicMesh.SetVertices(DynamicNative.VertexBuffer);
if ((dataFlags & DataFlags.Normals) != 0)
DynamicMesh.SetNormals(DynamicNative.NormalBuffer);
if ((dataFlags & DataFlags.Tangents) != 0)
DynamicMesh.SetTangents(DynamicNative.TangentBuffer);
if ((dataFlags & DataFlags.UVs) != 0)
DynamicMesh.SetUVs(0,DynamicNative.UVBuffer);
if ((dataFlags & DataFlags.Colors) != 0)
DynamicMesh.SetColors(DynamicNative.ColorBuffer);
...etc...
If not then there is separate optimization I'd like to propose/implement that will be faster than MemCpy (see bottom of this page if curious: https://jacksondunstan.com/articles/4713 where CopyFromFast
and CopyToFast
is discussed)
Just want to get some thoughts on this in case I'm missing something, otherwise I'm thinking about stripping out the managed data stuff and submitting a pull request!
Multiple variations of the deformer with different resolutions is fine (FFD2x2, FFD4x4 etc), but ideally there will be a single deformer that lets you change the number of control points on each axis.
Ideally you can also change the interpolation type.
DOTS includes:
https://github.com/keenanwoodall/Deform/blob/v1.0.2/package.json
https://github.com/keenanwoodall/Deform/blob/v1.0.1/package.json
Issue: version mismatch with tag name.
Solution: release 1.0.3
Hi! I previously commented this on a different issue but thought it deserved it's own separate issue so people can find it easier in the future.
I ran into a problem installing dependencies from git. An SSL issue can appear with a bad version of git when pulling remote from github. I was receiving an error along the lines of the one's in this thread.
Ultimately what fixed the issue for me was updating my git version from 1.9.5 to 2.21.0 and running this command:
git config --global --add http.sslVersion tlsv1.2
Hope this helps. Also thanks for your work on the project! :^)
The transform handles shouldn't get in the way of the deformable's transform handles. Controls could exist for the deformer and deformable, but a toggle between the two would be acceptable as well.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.