• 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.
Sign in to follow this  
Followers 0
Relfos

Radiosity questions

7 posts in this topic

I'm implementing radiosity into my level editor.

I found a sample online that did it in a very simple way, so I tried to adapt it to my engine.

 

The current version is somehow limited, in the sense that it generates a lightmap texture per triangle.

The algoritm is simple, for each pixel in each triangle render the scene from the point of view of the pixel.

Repeat it 8 times, to accumulate light.

 

There are some things that are puzzling me, why doing the acumulation requires 8 passes?

I tried with less passes, the scene was too dark.

I tried with more passes (12 I think), and now, the whole scene was white.

Shouldn't the scene colors converge to a certain value instead of getting full white?

 

Either I am not understanding this correctly, or there is a bug in this implementation maybe?

 

 

0

Share this post


Link to post
Share on other sites

I remember a good source on this subject many years ago, but I never exactly remember the name.  It was a long name, like Arty Fancy Chunky Pixel Ray Tracing Page or something like that.  I did however find a document that is heavily based on that page:

 

http://www.cs.uu.nl/docs/vakken/gr/2007/slides/12-radiosity.website_annotated.pdf

 

(At least all the illustration from that page is taken from that site.)

 

On page 11, you see different examples on how a scene looks after different passes.  Here is a quote from that page:

 

"The radiosity process slowly converges on a solution. Each pass is a little less different than the last, until eventually it becomes stable. Depending on the complexity of the scene, and the lightness of the surfaces, it may take a few, or a few thousand passes. It's really up to you when to stop it, and call it done."

 

In other words, it should converge, but I guess that if you illuminate a scene enough, you might be able to produce a scene that converges to completely white too, so it is hard to tell.

 

Edit: Found the original page: http://freespace.virgin.net/hugo.elias/  -- The name was: "The good-looking textured light-sourced bouncy fun smart and stretchy page" -- So much for memory...

Edited by aregee
0

Share this post


Link to post
Share on other sites

 

Shouldn't the scene colors converge to a certain value instead of getting full white?

 

 

Yes, it should definitely converge if you're doing it right. I would suspect that you have a bug, or that you're integrating incorrectly. Are you doing hemicube rendering?

0

Share this post


Link to post
Share on other sites

I don't know much about radiosity yet. I just read about hemicube rendering, it says it requires rendering the scene to 5 viewports, no I am not doing that.

I render the scene from each patch point of view once, with a FOV of 90º

 

From what I've seen in my code, in each pass I render the scene for each patch, and add the resulting color to the patch current color.

This of course means that with enough passes, the color will accumulate to white. Maybe this is the incorrect way of doing it?

0

Share this post


Link to post
Share on other sites

To compute diffuse irradiance, you need to integrate all incoming lighting for a hemisphere around a point. A 90 degree perspective projection doesn't cover the entire hemisphere, which is why you need to render multiple times if you're using a perspective projection to capture the incoming lighting. However that should still be *mostly* okay, it just means you'd be missing lighting from grazing angles.

 

I'd suspect that your real problem is in the integration. What exactly are you doing with your data after you've rendered from the point of view of the patch? Like I said above, to get the correct irradiance you need to integrate the incoming lighting with the clamped cosine function. I would suggest reading the link that aregee posted above, or the page which it was based on. 

0

Share this post


Link to post
Share on other sites

I am using the following to calculate the integration:

 

  For i:=0 to 31 do
    For j:=0 to 31 do
      _formFactor[i,j] := 0.5 + 0.5 * Sin(i*3.14/(_RadW-1) ) * Sin( j*3.14/(_RadH-1) );

 

When rendering a patch I am using 32x32 as viewport dimensions
 

0

Share this post


Link to post
Share on other sites

 

 

Shouldn't the scene colors converge to a certain value instead of getting full white?

 

 

Yes, it should definitely converge if you're doing it right. I would suspect that you have a bug, or that you're integrating incorrectly. Are you doing hemicube rendering?

 

it doesn't have to be a bug, it can converge to something that is just brighter than what represents 'white' in that particular case. in every pass energy gets distributed further, but energy doesn't 'leak' anywhere, that's why everything just can get brighter or stay the same.

 

I would suggest to 

1. switch to floats (halfs) lightmaps for the generation time.

2. tonemap those to LDR if you want to use LDR lightmaps for visualization (you might even do that per lightmap and save the mid tone value so you could 'reconstruct' the actual brightness for HDR rendering)

3. calculate the average brightness in every pass and output it, see if the step size of 'brightening' reduces every pass, then you could even estimate how long till the error reduces to a value you want (this might be very scene dependent, sometimes 5 passes, sometimes 50 passes).

1

Share this post


Link to post
Share on other sites

Thanks for the suggestion, I'm currently using unsigned chars for the lightmap, changing to floats might help.

And the idea of checking the brightness in each pass is good, with that I might be able to automatically decide when is enough to stop doing passes

0

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0