Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Emit Particles From Texture with Colour.

Discussion in 'Visual Effect Graph' started by andyox66, Apr 17, 2020.

  1. andyox66

    andyox66

    Joined:
    Aug 27, 2015
    Posts:
    15
    Hi, Is there a way of emitting particles from a mesh renderer, using the the colours from that mesh's material? In the standard particle system you can emit from a mesh renderer and assign a texture that is mapped to the particles using the objects UV.

    I can emit from a skinned mesh using Keijiro's skinned mesh baker, but can't work out how to colour the particles using a texture mapped to the mesh renderer UVs?
     
  2. VladVNeykov

    VladVNeykov

    Unity Technologies

    Joined:
    Sep 16, 2016
    Posts:
    550
    Hi, we are working on mesh sampling and skinned mesh sampling which will allow you to do just that.

    In the meantime, you can use the point cache bake tool (Window > Visual Effects > Utilities > Point Cache Bake Tool) and make sure you enable the UVs before you bake out the file:


    Then you can use the Point Cache operator, assing the position, and assign also the UVs somewhere (I'm being lazy here and am storing them in the Color attribute).
    Then use the stored UVs with a Sample Texture2D operator to get the colors you want from the UVs on that mesh and assign them properly now to the color attribute:


    Hope this helps!
     

    Attached Files:

    hectorfan, valarus and florianhanke like this.
  3. hectorfan

    hectorfan

    Joined:
    Feb 1, 2023
    Posts:
    8

    Hi, I know this is a old post, but I'm trying to do the similar things, I was able to realize the effect based on your method, but looks like using the point cache method would only works for 3D objects that doesn't have animation, I'm trying to make the effect that particles can emit from an animated 3D object and the particles' colors are sampled from the texture of the 3D object.

    The following screenshots are emitting particles from a static model and an animated model(I was able to emitting particles from the animated model by using the skinned mesh since the point cache wouldn't work for animated 3D model):
    pointCache-staticModel.png skinnedMesh-animatedModel.png
     
  4. OrsonFavrel

    OrsonFavrel

    Unity Technologies

    Joined:
    Jul 25, 2022
    Posts:
    128
    i've written an answer in this thread:
    Emit Particles From Animated Rig Model with Color Sampled from the Texture

    Hope it helps. Have a great day.
     
    hectorfan likes this.