# [0,1]^2 mapping to arbitrary light source

Started by TM, Aug 28 2001 01:53 AM

11 replies to this topic

Sponsor:

###
#2
Anonymous Poster_Anonymous Poster_*
Guests - Reputation:

Posted 28 August 2001 - 05:25 AM

You need to explain your question, or be more specific. I can read this question 3-4 different ways, each with a different answer.

###
#3
Members - Reputation: **122**

Posted 28 August 2001 - 05:40 AM

I have a point (r1,r2) located on the unit square, so r1 is in [0..1] and r2 is in [0..1]

Now I want to create a uniform mapping from the unit square (2D domain) to my light source (3D domain) which consists of triangles (for instance a triangulated sphere).

I need the mapping to generate sample points on my light source for lighting calculations.

Edited by - TM on August 28, 2001 12:41:41 PM

Edited by - TM on August 28, 2001 12:43:40 PM

Now I want to create a uniform mapping from the unit square (2D domain) to my light source (3D domain) which consists of triangles (for instance a triangulated sphere).

I need the mapping to generate sample points on my light source for lighting calculations.

Edited by - TM on August 28, 2001 12:41:41 PM

Edited by - TM on August 28, 2001 12:43:40 PM

###
#4
Members - Reputation: **169**

Posted 28 August 2001 - 06:10 AM

"I need the mapping to generate sample points on my light source for lighting calculations."

-- I''m not sure I understand this - Seems backwards to me. Don''t you need to generate points on the surface, or are you using a volume light and trying to generate shadows?

Well, I''ll assume the former first, that you''re trying to generate values for the interior points. This is very similar to interpolative shading. Seeing that you know what ranges and domains are, I''m sure you''re somewhat versed in math. Go look up Gouraud or Phong Interpolative Shading Techniques. I''ll give you a quick run down of the two here.

Polygons are only defined at their vertices. That is, they''re defined by a descrete, non-continuous collection of points. Basically, both Phong and Gouraud shading give you lighting values for interior points of a polygon.

In order to use these techniques, you must have 1) the 1, 2, or 3d coordinates of the vertices, and similarly dimensioned surface normals at those points. Surface normals are the vectors that are perpendicular the actual surface the vertices are approximating. If you''re modeling, say, a gem, each polygon represents the surface exactly, in which case the surface normals are the normals of the polygon, but if you''re modeling, say, a sphere with flat polygons, the surface normals should be the normals of the sphere, and not the normals of the polygons.

Anyway, for Gouraud shading, calculate the scalar lighting values at each of the vertices, and interpolate this value between each vertex. This will give you the values at the vertices, and the values of the bounding lines on the outside of the poly. Now just interpolate between these lines scanline by scanline, left to right.

Phong shading''s only difference is that, instead of interpolating the lighting value, you interpolate the actual normals, which means interpolating vectors instead of scalars and recomputing the lighting equation for each pixel instead of just the vertices.

Does that sound something like what you''re trying to do?

Remember - that mapping you''re doing, though tecnically (in mathematical terms) is 2d, it really is being done in 3d - those [0..1]''s are just interpolation mapping values between 3d points.

Thank you for your bandwidth,

-- Succinct

-- I''m not sure I understand this - Seems backwards to me. Don''t you need to generate points on the surface, or are you using a volume light and trying to generate shadows?

Well, I''ll assume the former first, that you''re trying to generate values for the interior points. This is very similar to interpolative shading. Seeing that you know what ranges and domains are, I''m sure you''re somewhat versed in math. Go look up Gouraud or Phong Interpolative Shading Techniques. I''ll give you a quick run down of the two here.

Polygons are only defined at their vertices. That is, they''re defined by a descrete, non-continuous collection of points. Basically, both Phong and Gouraud shading give you lighting values for interior points of a polygon.

In order to use these techniques, you must have 1) the 1, 2, or 3d coordinates of the vertices, and similarly dimensioned surface normals at those points. Surface normals are the vectors that are perpendicular the actual surface the vertices are approximating. If you''re modeling, say, a gem, each polygon represents the surface exactly, in which case the surface normals are the normals of the polygon, but if you''re modeling, say, a sphere with flat polygons, the surface normals should be the normals of the sphere, and not the normals of the polygons.

Anyway, for Gouraud shading, calculate the scalar lighting values at each of the vertices, and interpolate this value between each vertex. This will give you the values at the vertices, and the values of the bounding lines on the outside of the poly. Now just interpolate between these lines scanline by scanline, left to right.

Phong shading''s only difference is that, instead of interpolating the lighting value, you interpolate the actual normals, which means interpolating vectors instead of scalars and recomputing the lighting equation for each pixel instead of just the vertices.

Does that sound something like what you''re trying to do?

Remember - that mapping you''re doing, though tecnically (in mathematical terms) is 2d, it really is being done in 3d - those [0..1]''s are just interpolation mapping values between 3d points.

Thank you for your bandwidth,

-- Succinct

###
#5
Members - Reputation: **122**

Posted 28 August 2001 - 08:37 PM

I''m familiar with basic stuff like Gouraud and Phong shading.

I need a set of sampling locations on my light source. This source is a volume described by triangles.

Now suppose I use a pseudo-random sequence generator which generates a 2D point in the unit square (like Halton for instance). Now how do I map this 2D point to a 3D point on my light source in a uniform fashion.

So, if I would have a NxN uniform grid in the unit square, this would generate NxN uniformly distributed samples on the source.

For your information, these samples are needed for radiosity calculations.

Is this information sufficient?

I need a set of sampling locations on my light source. This source is a volume described by triangles.

Now suppose I use a pseudo-random sequence generator which generates a 2D point in the unit square (like Halton for instance). Now how do I map this 2D point to a 3D point on my light source in a uniform fashion.

So, if I would have a NxN uniform grid in the unit square, this would generate NxN uniformly distributed samples on the source.

For your information, these samples are needed for radiosity calculations.

Is this information sufficient?

###
#6
Members - Reputation: **122**

Posted 29 August 2001 - 03:22 AM

Hmm. Radiosity is usually modeled as light energy transfered between 3d ''patches'' in space, isn''t it? I''m not sure where your unit square is coming into the calculations.

From the description you just gave, your unit square is sounding like a 2d intensity map that you are trying to wrap around a polygonal model, much like a texture map. Is that what you had in mind?

From the description you just gave, your unit square is sounding like a 2d intensity map that you are trying to wrap around a polygonal model, much like a texture map. Is that what you had in mind?

###
#7
Members - Reputation: **122**

Posted 29 August 2001 - 04:04 AM

No, it has nothing to do with some kind op light mapping or mesh-based radiosity.

I use these samples as point light sources, because they can easily be rendered with hardware. It''s comparable to soft shadow computation, where point samples are taken on an area light source.

I use these samples as point light sources, because they can easily be rendered with hardware. It''s comparable to soft shadow computation, where point samples are taken on an area light source.

###
#8
Members - Reputation: **142**

Posted 29 August 2001 - 01:05 PM

Lemme get this straight. You have 2d point generated using a pseudorandom sequence. Now you want to map it to a 3d point on your light volume? Well, I''m assuming then, that your light volume is spherical (what else could it be?!), in which case you just need to find the intersection of the sphere and the ray passing through the 2d point and the center of the sphere. If you want to find a corresponding 3d point within your volume, then you have insufficiant information, unless you know the intensity of the light, in which case you can determine how far "along" the ray to travel. (what to multiply the vector by)

Of course, I may be misinterpreting what you''re saying entirely!

Of course, I may be misinterpreting what you''re saying entirely!

###
#9
Members - Reputation: **122**

Posted 29 August 2001 - 10:58 PM

I give up

I''m not talking about spherical light sources, but arbitrary shapes ones.

What the hell, maybe there''s no a clean solution to this problem. I guess you''ll always have to assume that the source is a sphere, a square, a box, or other geometry.

I''m not talking about spherical light sources, but arbitrary shapes ones.

What the hell, maybe there''s no a clean solution to this problem. I guess you''ll always have to assume that the source is a sphere, a square, a box, or other geometry.

###
#10
Anonymous Poster_Anonymous Poster_*
Guests - Reputation:

Posted 30 August 2001 - 02:49 AM

Well, there''s certainly no simple algorithm if you don''t have some sort of equation for the surface of your light source. We keep saying ''sphere'' cause it''s a common and a simple equation. Could probably get a reasonably clean solution starting from a spline surface or something as well.

Even if you got a regular arrengement of points off the light source and used them as point lights, you''d still have some icky problems to solve. 1) Hardware only supports so many lights, depending on the card. Usually in the single digits. 2) Unless the rays from the object to the point light sources are nearly the same (point lights very close to each other) your specular highlights are going to look incorrect. In the general case, you''ll end up needing more than 10 or so hardware point lights in order to avoid this. You couldn''t model a decent size flourescent light diffuser panel without hitting that kind of problem.

You might as well generate lightmaps in software, by integrating over the surface of the light source or something, rather than approximating with many point lights.

Even if you got a regular arrengement of points off the light source and used them as point lights, you''d still have some icky problems to solve. 1) Hardware only supports so many lights, depending on the card. Usually in the single digits. 2) Unless the rays from the object to the point light sources are nearly the same (point lights very close to each other) your specular highlights are going to look incorrect. In the general case, you''ll end up needing more than 10 or so hardware point lights in order to avoid this. You couldn''t model a decent size flourescent light diffuser panel without hitting that kind of problem.

You might as well generate lightmaps in software, by integrating over the surface of the light source or something, rather than approximating with many point lights.

###
#11
Members - Reputation: **142**

Posted 30 August 2001 - 04:42 AM

Then find the intersection of the ray with each polygon of your light source! But a warning: It''ll be slow as anything, since it''s really just raytracing!

But I''m still not entirely sure what you''re trying to do, so I''m functioning off of a guess!

But I''m still not entirely sure what you''re trying to do, so I''m functioning off of a guess!

###
#12
Members - Reputation: **169**

Posted 03 October 2001 - 12:05 PM

I see what he's doing. He want's to uniformly stipple (jitter) the light position sampling for a particular point using an arbitrary light volume for radiosity calcs.

How could you possibly define this? A uniform jitter of an arbitrary surface? I don't think you have enough information. You could do it if, as the AP stated, if you have an equation for the surface

****

********

**********

***********

***********

***********

***********

**********

*******Z

****Y--|

------\-|

-------\|

=======X=======

What criteria can you define that says to choose Y as a sampling point over Z? The only thing's I can say would be the following points:

1) the closest point on the light to the point

2) the collection of points defining the silhouette edge of the light relative to a projection from the point under consideration to point 1.

Not to mention all of the interior points!

How do you choose which points are more important than others? I don't see how you can for an arbitrary surface - you just plain have to know somethign about it...

Besides, I thought radiosity delt with entire surfaces, not sampled points.

Edited by - Succinct on October 4, 2001 1:10:49 PM

How could you possibly define this? A uniform jitter of an arbitrary surface? I don't think you have enough information. You could do it if, as the AP stated, if you have an equation for the surface

****

********

**********

***********

***********

***********

***********

**********

*******Z

****Y--|

------\-|

-------\|

=======X=======

What criteria can you define that says to choose Y as a sampling point over Z? The only thing's I can say would be the following points:

1) the closest point on the light to the point

2) the collection of points defining the silhouette edge of the light relative to a projection from the point under consideration to point 1.

Not to mention all of the interior points!

How do you choose which points are more important than others? I don't see how you can for an arbitrary surface - you just plain have to know somethign about it...

Besides, I thought radiosity delt with entire surfaces, not sampled points.

Edited by - Succinct on October 4, 2001 1:10:49 PM