keijiro / Smrvfx

Skinned mesh sampling with VFX Graph
The Unlicense
1.08k stars 153 forks source link

id SV_DispatchThreadID #15

Closed guodan closed 4 years ago

guodan commented 4 years ago

Why don't use

int i = id.x + id.y * 512 / 8

but use

uint i = Hash(id.x + id.y * 65536) % VertexCount; the first one is so easy.Can you tell me the reason

keijiro commented 4 years ago

Reason: To randomly choose vertices to be duplicated/cut.

In most cases, the number of elements in the position map and the number of vertices in the skinned mesh don't match. We have to duplicate some vertices to fill the remainder in the position map, or we have to cut some vertices from the skinned mesh to fit the position map.

In both cases, it will introduce noticeable artifacts if we choose vertices in an ordered fashion. For example, it may only duplicate vertices on the head, or it may only cut vertices on the head.

To avoid this kind of artifacts, we fill the position map in random order. It may still duplicate or cut some vertices, but they only introduce a small amount of noise. It might be unnoticeable in most cases.

keijiro commented 4 years ago

I'm closing this issue now. Please feel free to reopen for further questions.

guodan commented 4 years ago

Thanks, I modify the map size to 64 * 64, the result is noticeable.