help with map range nodes

Question Animation

hey guys, so I've been trying to get a light trail to follow a path and the values in the map range are confusing me.

basically I'm using an emissive principled bsdf shader with a gradient to get the effect. The x vector value is deciding where the light trail is at any given time and I want to use a map range node to tell it that it should start at 0 and end with 1 instead of -.55 and .55 or whatever it is now. so basically turning the value into a 0-100% bar. When I tried using the map range node with a combine xyz it just didnt work properly it started at like 0.05 and then ended at -0.08 and if I clamp it because of that it wont even go past the halfway point of the path.

Am I just using it wrong or completely using the wrong node I swear I've watched like 5 tutorials now on how to use it and still don't get it.

Also even when I controlled it by just keyframing the vector x location the line moved at a different pace than an object which is following the curve object this shader is on. just keyframing where it starts and ends with out ranging looks good but it keeps jumping ahead and falling behind i think cause of the vectoring being UV based. 

Start and End point

What I'm trying to do (except I want to have the line matching the pace of the cyclinder)

Shader setup


Start Map Range

End Map range value

1 love
Reply
  • Dwayne Savage(dillenbata3) replied

    I could be wrong, but your from min is higher than your from max. If you need it to flow opposite direction I believe you need to swap the to min and max. As for your description of when you manually animate it, it sounds like you have an easing issue. Either change the handles to vector(v->vector) or change the F curve to linier. I don't remember the hotkey but I believe it's Ctrl+e. You can probably guess which method I prefer 🤗

    1 love
  • Sam Edgar(AngelAzrael) replied

    Unfortunately neither idea worked. The map range node needed to be in that order to flow the correct way. I still dont get if was wrong in my use though cause all I want with that is to get it to change the values to 0 and 1 so I can just clamp it and have it complete the whole loop at 1. 

    Changing the easing and vector handles didn't work either unfortunately. they were already that way it seems 😔

    1 love
  • Dwayne Savage(dillenbata3) replied
    I just realized you are using the UV texture coordinate system. This is more Martin's area of expertise, but I believe you need to change the type on the mapping node to Texture instead of Point. Using Texture will start at the left side of the UV map and 1 will be the right side of the UV map. The only other thing I can think of, without opening blender, is maybe using To Min/Max of either 0/2 or 1/2. I don't remember the exact numbers. Basically, point works backwards from what most people expect, and texture works in the inverse of point. So, point is Scale, Rotation, and Location. X on location makes the image move to the left on a plane. When you switch to Texture, X on location will make the image move to the right. That is what I remember. you can double check it or I can when I get home from work. 
    1 love
  • Martin Bergwerf replied

    Hi Sam,

    The Min and Max in the MapRange Node are badly named. Min can be larger than Max. I always think of it as From A to A and From B to B.

    In your upper Screenshot of your Nodes, for instance, your Input is 1.6:

    Map Range.png

    In the Map Range, you go from 0.8 to  0 and from -0.8 to 1. This means that the Input Value of 1.6 becomes and Output Value of -0.5.

    (If you would turn on Clamp in the Map Range Node, that would be clamped to the [To Min, To Max] range, meaning it then would be 0.0)

    The Color Ramp however Clamps its Input to a [0, 1] range, meaning -0.5 becomes 0.


    2 loves
  • Martin Bergwerf replied

    But as to what you're trying to do, I am not sure exactly what you're trying nad doing, but Dwayne is probably right, in that you might not want to use UV Coordinates.

    1 love
  • Dwayne Savage(dillenbata3) replied

    OMG! I just now saw the video. I didn't even notice that the text "What I'm trying to do" is a link. Okay, the easiest way in my opinion would be to use dynamic paint. It's been awhile, I don't remember if it's called wetness or drying. Either way it's an option in Dynamic paint. You set the B as the canvas. Add a mesh object to be the brush. For this I'd use a cube or maybe a sphere or another cylinder to give more character to the painting(AKA mask). Then parent the brush object to the cylinder so that it follows the cylinder. In outliner, click the camera icon next to the brush object so that it isn't rendered. 

    For more info on dynamic paint see chapter 6 of CORE: physics course

    https://cgcookie.com/lessons/adding-dynamic-paint-to-an-object-canvas-brush

    2 loves
  • Dwayne Savage(dillenbata3) replied

    You can also use the UV Warp modifier, but that is a bit tricky to setup. 

    2 loves
  • Sam Edgar(AngelAzrael) replied

    oops forgot to come back to this. at this point I've gotten closer by adjusting the texture setup and using the curve data but it's still screwed the way I'm trying to do it cause it's using uv to tell the light trail where to go. And obviously UV isn't going to work properly with curves. I shall try the dynamic paint method next, its just too bad that the current setup is a bit skippy with the fading effect cause if the fading followed the pace of the start and end mapping it would be perfect😭

    how I wish it would go but with light fade

    How it's actually going - close but nah (jumps through certain portions of the curve)

    1 love
  • Martin Bergwerf replied

       "And obviously UV isn't going to work properly with curves"

    UV can work perfectly with Curves, as they have UVs by default:

    Curves.png

    You will probably need to do a sort of re-sample of the Curve: Convert > Mesh, switch to Edit Mode, Loop Tools > Space. Back to Object Mode, Convert > Curve.

    But for what you are trying to achieve, Dynamic Paint might be the best and simplest solution.

    2 loves
  • Sam Edgar(AngelAzrael) replied

    So I tried using dynamic paint using a baked image sequence (Cause the rest of the mesh isn't set up for subd) and I'm getting that effect.

    only problem now is that the line is too thick and is blobby. I tried decreasing the brush size to thin it out and then increase the resolution and substeps to avoid quality issues but it just resulted in a dotted line that I can't figure out how to fix. Can't really find enough documentation or detail in tutorials to work with it since most people just use super sub-d surfaces in vertex mode.

    anyone know how to get a thinner and higher quality line without the brush size causing that dotting? 

    (Also I do need to look at it this close up. I'm planning closeup camera shots)

    Original result (close but too thick and blobby):


    Result after increasing substeps from 5 to 10 and resolution from 2048 to 3000 and decreasing brush size by half:

    1 love
  • Martin Bergwerf replied

    Okay,

    So Dynamic Paint depends on Resolution...

    Maybe go back to your original idea. Use the X (the U) of the UV's of the Curve and do some Math on it. The basic idea could be something like this:

    Curve_00.png

    Make sure that the Curve's Resolution is even, through the method I described above (Convert to Mesh, Loop Tools, Convert to Curve), because the default Resolution is the Resolution between neighboring Control Points, and those are in general not evenly distributed along the Curve.

    2 loves
  • Sam Edgar(AngelAzrael) replied
    I think this is probably an impossible task at my level unfortunately😭 I'm just not very good at utilising math nodes and regardless there's like 20 of these curves to work through and with the no. of verts needed to make it work through curves It's probably be easier to just make a super dense mesh and dynamic paint through vert mode. I'll give that a try but I might just have to give up on this dream if it doesn't work😪
    1 love
  • Martin Bergwerf replied

    Well you don't need a lot Vertices, when using Curves (just make sure they're distubuted evenly).

    But anyway, if you can't get it to work, there's no shame in laying it to rest and try again later, when you've leveled up a bit; it doesn't have to be a "Do it now, or never speak of it again." situation😉

    1 love
  • Dwayne Savage(dillenbata3) replied

    I think we've made this more complicated than it needs to be. 1. You could use object coordinate and an empty.  2. Use an animated decal piece. This object would be the light that moves. Just have it follow the curve and then parent the cylinder to the decal object. Personally I think option 1 is easier. The material nodes would look something like this:

    026-08-08 110606.png

    You can use the map range node for advanced animations and adjustment or use the color ramp. The empty would be parented to the cylinder. You can keyframe the x location on the mapping node if you want to move the gradient off of the curve. Here is a quick render of this. 


    1 love
  • Sam Edgar(AngelAzrael) replied

    I thought to do the same thing at the start of all this but the problem was I couldn't get that trail effect. I can mask for a circular area but I couldn't achieve the long trail behind it really.


    1 love
  • Dwayne Savage(dillenbata3) replied

    Then it might be easier to do a shuttle piece. Basically, a mesh object that has a follow path constraint on it. There are 2 things that need to be check. Something like follow and curve radius. Sorry, I don't remember the exact wording. By checking those the mesh will deform around the curves of the curve. use it to create the light and tail. then you can parent the cylinder to the shuttle piece. I'd recommend checking fixed position as well. That allows you to keyframe the constraints offset. 0 will be the start of the curve and 1 will be the end of the curve. If you don't check this it will use the animation path settings of the curve, which by default is 100 frames. 0 being the beginning of the curve and 100 being the end. You can still keyframe the constraint. If it doesn't move, then you will need to click the animate path button. Note: I don't know the technical term for this. I used it once to create an effect of data moving along a cable. We started calling it a shuttle piece, because without the textures it looked like a shuttle riding along the tube. 

    2 loves
  • Sam Edgar(AngelAzrael) replied
    Solution

    tried doing it but just couldn't get a smooth setup unfortunately I think any of the methods described could work with either properly made geometry or probably with a better knowhow of a few different concepts but I'm just not there yet. Someone on blender stack exchange helped me out with a geonodes setup although it's pretty noodley and confusing for somoene with not so much geonodes experience. Will have to do some more geonodes courses. see attatched. I think if I combine all my paths together and find a way to tell the node setup what order to run through the letters then it will work. Credit to Chris Patton for his help with this. 

    Geonodes laser cut setup

    1 love