• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.

Archived

This topic is now archived and is closed to further replies.

TM

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

11 posts in this topic

Suppose we have (r1,r2) in [0..1,0..1]. How do you map (r1,r2) uniformly to a triangulated light source?
0

Share this post


Link to post
Share on other sites
You need to explain your question, or be more specific. I can read this question 3-4 different ways, each with a different answer.
0

Share this post


Link to post
Share on other sites
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
0

Share this post


Link to post
Share on other sites
"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
0

Share this post


Link to post
Share on other sites
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?
0

Share this post


Link to post
Share on other sites
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?
0

Share this post


Link to post
Share on other sites
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.
0

Share this post


Link to post
Share on other sites
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!
0

Share this post


Link to post
Share on other sites
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.
0

Share this post


Link to post
Share on other sites
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.
0

Share this post


Link to post
Share on other sites
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!
0

Share this post


Link to post
Share on other sites
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
0

Share this post


Link to post
Share on other sites