Accessing particle Custom Data

Node-based Shader Editor

Accessing particle Custom Data

Postby sethhall » Wed Aug 01, 2018 6:35 pm

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
sethhall
 
Posts: 20
Joined: Mon Jun 25, 2018 11:09 pm

Re: Accessing particle Custom Data

Postby Amplify_Borba » Thu Aug 02, 2018 10:13 am

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!
Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
User avatar
Amplify_Borba
 
Posts: 1239
Joined: Mon Jul 24, 2017 9:50 am


Return to Amplify Shader Editor

Who is online

Users browsing this forum: No registered users and 39 guests