Richard Baker Posted January 18, 2022 Share Posted January 18, 2022 Hello again. I am trying to determine the level sets of light intensity due to a spotlight cast on a flat surface. I am only taking into account the diffused lighting and no specular and no reflections for simplicity. I figure the light intensity due to the spotlight equals the following: (normal vector to the plane) dot product (unit vector from origin to the point in question) times (ray intensity function) times (ray dispersion function). The ray intensity function is a function of the angle between the center of the spotlight to the point in question. The ray dispersion function is a function of the distance from the origin to the point in question. For example a point light that emits light equally in all directions the ray intensity function is a constant and the ray dispersion function follows the inverse square law. What I want to do is find rif and rdf such that the level sets of light intensity are an elementary function such as an ellipse or a hyperbola so that I can construct the shape of the spotlight. Thank you Link to comment Share on other sites More sharing options...

Richard Baker Posted January 19, 2022 Author Share Posted January 19, 2022 I decided that the effects of the distance and the cosine of the angle are negligible so I can just trace out a conic section but I am having trouble for the hyperbolic and parabolic cases. In particular, what is the maximum and the minimum angle for the hyperbola or parabola in terms of the variables already stated? Thank you. Link to comment Share on other sites More sharing options...

Sensei Posted January 20, 2022 Share Posted January 20, 2022 Why is it in physics? Sounds like a Computer Science topic, Ray-Tracing, to me.. https://en.wikipedia.org/wiki/Ray_tracing_(graphics) In simulations of real world, we usually have light sources with different types: distant, point, spotlight, area, environment, dome, IES. The main difference between them is the direction vector of the light sample. The distant light type has a uniform vector of light sample direction. It is used to simulate sunlight that is nearly parallel (due to the great distance between the Sun and Earth). The point light type has the light sample direction vector is calculated by the formula: Normalize( hit_position - light_position ) The spotlight type is a compilation of the point light type with the distant light type. You have a vector like in distant type and calculate a vector like in point type (both must be normalized!) and if you will do a dot-product between them you will get a cosine, use arc-cosine to get the angle in radians/degrees, and pass to the gradient function which will return 0 for no light in that direction, or 1 for full intensity, and 0...1 for a smooth transition between the two extremes. When you have both the surface normal vector and the light sample direction vector calculated, you do -dot_product( surface_normal, light_sample_direction ) (note: MINUS!). Then you should get rid of the negatives by max(x,0). Repeat the procedure with more samples from the same light (for multi-sample lights like IES, dome, environment, area), and iterate through all the lights in the scene. To have shadows in backward ray-tracing, the programmer should cast the ray from the hit_position in the direction REVERSE to the direction of the light sample (as in the point light type). If the ray-cast function hits another object before reaching the light position, the evaluated spot is in shadow, and the light sample has no effect on that spot. I hope it will help a bit. Link to comment Share on other sites More sharing options...

Richard Baker Posted January 20, 2022 Author Share Posted January 20, 2022 Thanks for the response. No ray-tracing this time, actually. Right now I am working with a platform that has limited resources. And I decided that for fast, live graphics processing it would be advantageous to render concentric polygons in the shape of level sets of light intensity starting with the outermost level sets and working my way inwards drawing over the inner part of each polygon not unlike the painter's algorithm. In theory these polygons approximate the ellipse, parabola, or hyperbola. The light from the spotlight forms a cone. The surface the spotlight shines upon is a plane, the intersection of a cone and a plane is one of the three conic sections. Hence, what I need here is the formula for each curve. I think the eccentricity equals cosine (angle of spotlight) divided by (unit vector from origin to center of spotlight dot product the normal vector of the surface). But I need to find the focus and the semi-lattice rectum (pardon my Latin, LOL). I have to cut corners here for increased performance so for now I am ignoring the effects of distance and dot product of the ray vector and unit normal. If it is possible to split or deform these conic sections so that it would approximate the effects that would be great. But right now I am having trouble finding the proper shape parameters for the conic sections. Link to comment Share on other sites More sharing options...

Sensei Posted January 24, 2022 Share Posted January 24, 2022 (edited) Experimenting with simulated spotlight inside a 3D application (for a quick check of results): The mathematical equation is rather self-explanatory. Edited January 24, 2022 by Sensei Link to comment Share on other sites More sharing options...

## Recommended Posts

## Create an account or sign in to comment

You need to be a member in order to leave a comment

## Create an account

Sign up for a new account in our community. It's easy!

Register a new account## Sign in

Already have an account? Sign in here.

Sign In Now