Emit material with gradient ?


I’m a noob about shaders and textures but I think the question has an answer?
I want the emitting material to be faded as in the texture. More light at the center and fading at both ends.
I suppose I must make something in the node editor with the meterial but I do not know what.


axon_mye_unmyel_03.blend (1.11 MB)

I’d use something like this if you’re attempting a tube light. Glow should come from post, so I set material pass index to 1 for filtering (not sure what happens in reflections but you have some control over sharp reflections which you don’t want to have too bright due to aliasing step artifacts - for rougher reflections those artifacts will hide itself if not the glow takes care of it already).

Not 100% what and how you want this, but the idea is as follows:

Hi CarlG,

Many nodes aren’t connected in your exemple ?
I made the glow by adding a glare node in the layers nodes.
I want the center of my light tube to be 1 and the left side and right side to be not highlighted at all 0 value (the same color as the tube).
I suppose I must add something to the left of the curves nodes and something to the right of that one too.
I want the strength of the emit node to be like as the curve and the x axis of the tube.


They’re just different optional routes to take, depending on if you want the visual control using curves or color ramp, or if you prefer object coordinates (size irrelevant to mesh geometry, origo at “the dot”) or generated coordinates (size sensitive, origo at lower left iirc), meaning that the object coords style will often contain negative values output that needs to be handled. In my case, I just do it with a simple math(abs) command. Use builtin node wrangler addon to preview the various outputs to see what is going on (I’m just remapping a single texture coordinate), for clarity you can also go via a separate xyz node and see each texture axis separately.

If you want the exact curve as the image, why not just texture map it?

That’s exactly the question I’m unable to answer.

Here are the settings I made with (pretty) good results.