[RELEASED] Cloth Dynamics

Next week I will upload a Unity2019 version!

2 Likes

Hi, I am using Unity 2020.3.6f1 HDRP My system
AMD RX480 RedDevil / Xeon X5650 6/12 / 24Gb I can’t see clothes on the scenes from the examples. I do not see any errors either during playback or in shader compilation. Maybe I’m doing something wrong, what could be the problem?

Are you using HDRP? You can select the cloth objects in the hierarchy and apply normal Lit materials to them. When you hit run the system should replace them. Check if the shaders are imported correctly. Sometimes shadergraph shaders do not get imported right. Just select them and press reimport. Also a screenshot with the selected cloth and the material would be more helpful. (Search for the Shaders folder and reimport them, see my long video tutorial)

If this does not help write me a PM and I will try to figure it out, thanks! And sorry there might be still some bugs I will try to collect and fix them all next week with a new update!

Same here. And I have tried everything you said. Shows in editor but not runtime.
Unity 2020.3.6f1; HDRP; AMD 5700XT
I believe it has something to do with the mesh and not the material.
I believe it is the GPU Cloth Dynamics Script. If I disable it and run I am able to see mesh. With SimpleShapes Scene.

The GPU Skinning (Script) also I believe.

Wish I had a RTX 3090 and test it perhaps it is AMD cards.

I noticed that when I run it. The check mark in the box for ‘Render’ in the GPU Skinning (Script) get’s unchecked at run time. Could that have anything to do with it?
I am not a programmer but I believe for sure the problem is in ‘GPU Skinning (Script)’

Great, that’s very helpful! Nope, admittedly haven’t tried the demo build yet. Good to hear there’s no CPU readback for the rendering. I see that the shaders are integrated into HDRP Lit shaders - would it be feasible for this to be packed into a shader graph node?

@julesd is the demo build running on your sytem, when it works it should also work in unity. Can you please select a cloth material in playmode and make a screenshot of the complete unity editor? Thanks!

Yes that might be the problem, can you try and turn on “use custom voxel center”, I think the GPUReadback does not work correctly with AMD cards, I have to further investigate this. If you can’t see the green bounding box it might not work correctly.
7097281--845611--upload_2021-5-1_15-37-24.png

They are shadergraph shaders, but I can also make a sub graph if you prefer this.

1 Like

No still does not render mesh.

No still does not render mesh to screen. While performing simulation.

Yes, that would be great because I have a custom clothing shader setup :slight_smile:

@julesd and @kalinins1998 I will run a test with my old AMD laptop, maybe I can figure it out.

If any one else has a AMD card and Cloth Dynamics for unity could you please post your results with Cloth Dynamics?

@julesd & @kalinins1998 :
Good news, I could test it on my old AMD laptop and also the cloth gets invisible in URP (HDRP is not working on this laptop). I switched to builtin and it works! So it must be some issue with the shadergraph shader. Can you please try the builtin content (please delete the HDRP content first) and see if that works. Thx!

1 Like

Of course I will now try to fix the issue in URP and try to transfer the results to HDRP. But please let me know if builtin works for you, so that we are on the same page.

Ok, so here is the fix ( I will upload it in my next version 1.2):

go to:
Assets\ClothDynamics\Resources\Shaders\SRP
open:
ClothFunc.hlsl

and rewrite this:

Buffer<float3> positionsBuffer;
Buffer<float3> normalsBuffer;

into this:

StructuredBuffer<float3> positionsBuffer;
StructuredBuffer<float3> normalsBuffer;

reimport the shadergraphs or open the shaders in the graph and save them. Thats it.

So, I uploaded the changes, should be available in two days in the store.

Thanks.

I found a minor bug happening only with android, you need to replace following line in GPUClothDynamicsEditor.cs to fix it:

#if UNITY_ANDROID || UNITY_IPHONE
                                EditorGUILayout.LabelField("This feature doesn't work on mobile devices!", s);
#endif

to

#if UNITY_ANDROID || UNITY_IPHONE
                                EditorGUILayout.LabelField("This feature doesn't work on mobile devices!", orangeStyle);
#endif