# Is it possible to create a torus-/ring-shaped light? If so, how?

As the title says. I’ve been searching Google, but I can’t get my head around it.

It sounds like what you want is not “A LIGHT FITTING” (like “a chandelier”)

What you want is like “SOME LIGHT FALLING ON STUFF”

In other words if I pointed a spotlight on a floor, that would be a “circle of light” on the floor – what you want is a “donut of light”

Is that correct?

If you look at blob shadows, that is exactly what a projector is.

In your project, look around for the free standard assets that unity gives you.

Add a projector, blob shadow. In fact, ther eis indeed one that is a “shadow” (it’s dark) and there is one that is a “light blob” … which is exactly what you are asking for, I believe.

the only difference is you want a particular shape (a donut) rather than just a circle.

From here, you will have to do the work to figure out how to make it your own custom shape! I hope, that helps!

If you don’t need the light to move in the scene, make a mesh torus, give it a light emitting material and bake it with the lightmapper. If you do need the light to change in the scene, give it a point light in the middle. An area based light is too complicated to run at runtime (at the very least without some complicated shader-fu)

Is this what you want? If so, you can add a circle cookie to the point light 2D, that makes a ring light.
The cookie is a texture I generated with R script.

``````library(png)

N = 128
Nhalf = N/2

tab <- array(0, c(N, N, 2))

f <- function(i, j) {
return(clamp((sqrt((i - Nhalf + 0.5)^2 + (j - Nhalf + 0.5)^2) - InnerRadius)/OuterRadius, lower=0, upper=1))
}

for(x in (1:N)){
for(y in (1:N)){
tab[x, y, 1] = f(x, y)
tab[x, y, 2] = 1 - f(x, y)
}
}

png::writePNG(image = tab, target="C:\\Users\\YOUR_USER_HERE\\Desktop\\image.png")
``````

Set N to be the size of your sprite, then InnerRadius to be the radius of the no-light ring in the center, and OuterRadius where unity’s point light takes full effect. Both in pixels as well.,

Is what you want something like this? If so, it can be achieved in 2D by using a Point Light with a cookie.
The cookie will be a grayscale image with alpha, which I generated via an R script.

Here is the following R code. You want N to be the size of your sprite, and InnerRadius and OuterRadius also in pixels. Try a few different values until you find one to your liking.

``````library(png)

N = 128
Nhalf = N/2

tab <- array(0, c(N, N, 2))

f <- function(i, j) {
return(clamp((sqrt((i - Nhalf + 0.5)^2 + (j - Nhalf + 0.5)^2) - InnerRadius)/OuterRadius, lower=0, upper=1))
}

for(x in (1:N)){
for(y in (1:N)){
tab[x, y, 1] = f(x, y)
tab[x, y, 2] = 1 - f(x, y)
}
}

png::writePNG(image = tab, target="C:\\PATH\\TO\\SOMETHING\\image.png")
``````

Also make sure the png package is installed: `install.packages(png)`

Not really sure how you’d achieve the same thing in 3d.