pouët.net

Go to bottom

"Line light" is there such a thing?

category: general [glöplog]
 
I want to implement a light that comes from a line like emitter instead of a point. I could try to figure out some math but it would probably be too slow or something. Any ideas / articles?
added on the 2011-01-20 01:42:18 by xernobyl xernobyl
just use distance?
added on the 2011-01-20 01:46:42 by quisten quisten
either distance or angle, depending on whether you want absorption or not
added on the 2011-01-20 01:47:58 by Gargaj Gargaj
But... but...

the whole point of line/area/volume lights is to get soft shadows!!
added on the 2011-01-20 07:07:13 by ryg ryg
draw a white line on black background
apply hypnoglow+zoomblur

et voila
Sounds like a special case of area lights..
added on the 2011-01-20 12:25:59 by sol_hsa sol_hsa
glue some glowsticks on your screen
added on the 2011-01-20 12:33:57 by maali maali
added on the 2011-01-20 12:57:35 by rudi rudi
rudi that can be done via my pseudo code :)
this is how it is done in size antimatters:

in the fr shaders of all materials in the scene there is a pass that adds a function of the distance of the position of the texel - in w. coordinates - to the line eq. It is trivial to work out if your line falls across, say, the x coords. the function is of type sinc, or gaussian or something like that to give it a smoothness. blur + hypnoglow.
added on the 2011-01-20 13:18:33 by Navis Navis
rasmus: true. you need directional blur though :p
added on the 2011-01-20 13:28:02 by rudi rudi
it all depends on how you implement your zoom blur.
ryg: no it isn't. unless you want every light to look like
BB Image
light light, not the ever present illumination.

The light coming from this (not the best example) is not circular / radial...
BB Image

Anyway I came up with some math / drawings. I'll try to implement it and see how it looks. Step 2 is ripping size antimatters.
added on the 2011-01-20 19:20:26 by xernobyl xernobyl
I see google returns plenty of stuff for "Linear Lights" + rendering
of course you can see a linear light as many consecutive point lights.
Then if you just a kind of inverse square light intensity measure, go with point-line distance like this or this and do something like 1/d^2 or similar (or was that 1/d for linear sources...?)...
added on the 2011-01-20 19:36:03 by bdk bdk
xernobyl: you could pre-calculate the radiance into a 3d-texture.
added on the 2011-01-20 19:37:50 by kusma kusma
just put your god damn line on the x axis and do a:

gl_Color+=100.0*pow (clamp (cos(pos.y*0.1),0.0,1.0),10.0);
added on the 2011-01-20 19:52:42 by Navis Navis
(the line is wrong but yo uget the idea)
added on the 2011-01-20 19:58:14 by Navis Navis
sure, check "irradiance volumes"
You can find info about "irradiance slices" here :)
added on the 2011-01-20 20:08:28 by bdk bdk
light travels at the same speed whether its focused as a point or a line, mate!
dist to line eq.
apply falloff et cetera as you wish
added on the 2011-01-21 04:59:00 by superplek superplek
If you just want a line-shaped regular light, the math is super-simple:

Line between line_start, line_end.
Setup:
Code: float3 line_vec = line_end - line_start; float3 line_axis = line_vec * (1.0 / dot(line_vec, line_vec));


In the shader:
Code: float proj_on_line = saturate(dot(here - line_start, line_axis)); float3 closest_pt_on_line = line_start + line_vec * proj_on_line;


And then determine dir to light, attenuation etc. from there as if it was a point light.

But my point still stands, with a line light you want the appropriate soft shadows too :). This is nicest in Monte Carlo raytracing. You just sample along the light source randomly, the rest happens automatically. Or of course you can just "sample" the line light by replacing it with a number of point lights (on the line, either uniformly sampled - which will usually be visible - or stochastically, usually following some kind of Poisson distribution).
added on the 2011-01-21 05:24:33 by ryg ryg
Actually, you could use some neat matrix stuff and do what raymarching and bumpmapping shaders do. Just translate your lighting coord into light space and do what Navis said. In that space, the light could just be on the x-axis.
added on the 2011-01-21 05:38:21 by ferris ferris
line lights are very common in movies. for the implementation, what ryg just wrote.
added on the 2011-01-21 09:19:25 by iq iq

login

Go to top