[Particles] Triplanar on local space

Node-based Shader Editor

[Particles] Triplanar on local space

Postby cAyou » Mon Oct 29, 2018 7:16 pm

Hi there !
I want to make a particle effect to use a triplanar shading, but not in world space, more in local space, relative to the particle position.
The documentation says that Vertex Position is on local space, but it seems that it doesn't work correctly when using particles.
I've tried to substract Vertex Position to World Position, but it doesn't give me the result I wanted.
Is there anyway to get the vertex position in local space relative to the particle position?
I've looked to the custom data a particle can send, see if I can grab the position, but I don't think I understand how to use custom data with ASE.

Thanks !
cAyou
 
Posts: 39
Joined: Mon Oct 29, 2018 7:12 pm

Re: [Particles] Triplanar on local space

Postby Amplify_Borba » Tue Oct 30, 2018 11:52 am

Hey there, thank you for getting in touch and for your support!

You can find more information regarding custom vertex streams in Unity's Documentation, and there's an example in this post on how to use / access them in ASE.

To elaborate on the example shared in that post, in order to pass the AnimBlend (TexCoord1.x) to the shader:

Image

You will need to use a Vertex TexCoord node with its UV Channel set to 2, since the UV Channel set to 1 corresponds to the TexCoord0, and then use the U output port, which holds the data for the TexCoord1.x, while the V port would hold the data from TexCoord1.y in case it was present.

Image

Regarding your particle effect, could you elaborate on what you're trying to achieve so that we may best help you?
A screenshot or video of the effect you have in mind would be great!
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

Re: [Particles] Triplanar on local space

Postby cAyou » Tue Oct 30, 2018 8:17 pm

Thanks for your quick answer !
I'm trying to achieve good looking smoke that is coming out of the tailpipe of a car, without transparency.
So I've started by creating a sphere in blender from a cube, to have a better vertex layout than the sphere from Unity.
But I had trouble making a good UV on it (I'm kinda noob in blender), so I had the idea to go with triplanar shading for the noise alphacut texture.
This texture will determine the alphacut during the particle lifetime. I'm already using the vertex color from the particles to handle the cutout animation.
The issue with triplanar (either the built-in node or my implementation) is that it will be based on world vertex positions.
It makes the noise staying in world position while the particles are moving up, which is a pretty bad result for me. So I wanted to have object space triplanar mapping instead of world.
Which came to the issue I had with world particle position, so I can subtract by it to obtain object local position.

The result will be quite similar to this:
https://simonschreibt.de/gat/stylized-vfx-in-rime/#update14
But with triplanar noise mapping, because I can't make correct UVs :roll:

And I've always wanted to understand how to retrieve custom data from the particle system, so it's a good way to learn from it :)

Thanks again, will post the progress/result if any.
cAyou
 
Posts: 39
Joined: Mon Oct 29, 2018 7:12 pm

Re: [Particles] Triplanar on local space

Postby Amplify_Borba » Wed Oct 31, 2018 10:21 am

Glad to know that the shared information helped!

I'm not entirely sure on what to suggest for the method you're going for, using the Vertex Position might not work but you could try to pass the particle center position in the vertex stream and subtract from the emitter position to get a position offset.

Please let us know if this helps and if you come across any issues with ASE, we'll be happy to assist.
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

Re: [Particles] Triplanar on local space

Postby cAyou » Wed Oct 31, 2018 2:35 pm

Ok I've managed to perform a basic triplanar with offset tiling and local particles mapping options (see attachement).
The only thing I had to do was to enable custom vertexstream, add the center on the list and them use the Vertex TexCoord (float3) to retrieve the value. Easy !

Now I have a proper noise texture that is moving accordingly to the particle center, with triplanar mapping.
I will post the result if I manage to do anything with that.
Thanks again for your support !
Attachments
triplanar_particle_localspace.jpg
triplanar node
triplanar_particle_localspace.jpg (208.01 KiB) Viewed 1458 times
cAyou
 
Posts: 39
Joined: Mon Oct 29, 2018 7:12 pm

Re: [Particles] Triplanar on local space

Postby Amplify_Borba » Wed Oct 31, 2018 3:24 pm

Thank you for sharing your progress, looking forward to see what you build!
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 0 guests