Page 1 of 1

Accessing particle Custom Data

PostPosted: Wed Aug 01, 2018 6:35 pm
by sethhall
I'm trying to figure out how to intelligently access the particles Custom Vertex Streams. If I enable Custom1 as a Vector and then expand my renderer and set Custom Vertex Streams to True, I now see everything which is being packed and presumably queryable by Amplify.

Code: Select all
Position (POSITION.xyz)
Normal (NORMAL.xyz)
Color (COLOR.xyzw)
UV (TEXCOORD0.xy)
AgePercent (TEXCOORD.z)
Custom1.xyzw (TEXCOORD0.w|xyz)


I can see that Unity is trying not to be wasteful by packing things into the empty TEXCOORD0 inputs. However where are my other inputs? How do I access them in Amplify? I know there is a Texture Coordinate node which gives me access to 1, 2, 3, 4 UV sets but how do I find out where this data is being packed and how to access it?

Thanks,

Seth

Re: Accessing particle Custom Data

PostPosted: Thu Aug 02, 2018 10:13 am
by Amplify_Borba
Hello Seth!

For Vertex Streams you are only allowed to use from TEXCOORD0 to TEXCOORD3 and each TEXCOORD has 4 channels available, and in the Custom Vertex Streams, your TEXCOORD1.xyzw would be the UV Set 2, which correspond to UV Sets 1 to 4, so TEXCOORD0 would be UV Set 1, TEXCOORD1 would be UV Set 2, and so on.

Do note that Unity, UI-wise, will warn you if you start using more than 4 Vertex Streams, so that you can re-arrange your data to fit on those available. This is subject to being changed on Unity's side in the future.

Image

To access this data, you may use the Vertex TexCoord node or the Texture Coordinates, but we recommend that you use the Vertex TexCoord as it provides the texture coordinates directly from vertex data without any further calculations.

Image

You'll need to set the Coordinates Size and indicate the UV Channel to use according to the Custom Vertex Stream data you want to access. The Coordinates Size parameter allows you to read more packed data from vertex coordinates, with sizes of Float2 to Float4, and the UV Channel, as explained above, accesses TEXCOORD0 to TEXCOORD3 as UV1 to UV4.
( Note: The Vertex TexCoord node currently display UV0 to UV3 but this is going to be changed for consistency purposes )

Please let me know if this helps, thanks!