5

As I had much fun with this (thx Chebhou) but gaussian functions are a bit too complex for me, i want my volume scatter cylinder to have simply a smaller cylinder emitting light inside it, from the same object/material. The same size all along, or why not being able to control the fading at one or both sides (why not asking :) )

It has to be done with math nodes, vectors and things like that (what I want to learn)

Something like this but in a single object enter image description here

looks like a light saber :)

Bithur
  • 8,274
  • 19
  • 56
  • related: http://blender.stackexchange.com/a/15711/1853 and http://blender.stackexchange.com/a/3640/1853 –  Feb 13 '15 at 17:11
  • @cegaton nope, i don't want a compositing or modeling answer, it has to be shader maths. I already did (long ago) a light saber but i want to learn more about math nodes and vectors in materials. I hope this is simple enough for me to understand the why and how. – Bithur Feb 13 '15 at 17:16

2 Answers2

2

use this circle equation and chose a radius "max R = 0.5" :

enter image description here

Coordinates node group : enter image description here

and for fading on the sides i used a sin function :

enter image description here

render : enter image description here

Chebhou
  • 19,533
  • 51
  • 98
2

Variation on Chebhou's answer : Origin and dimension independant :
enter image description here

Not sure the sine works exactly the same.

Bithur
  • 8,274
  • 19
  • 56