Sign in to follow this  

The lightmapping thing

This topic is 4206 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm not really sure how lightmapping is exactly done. Let me get this straight: There are generated textures They have shadows and shading on them Each texture belongs to a triangle? (wouldn't there be thousands of textures?) When you load a scene you load all these textures, seperately? Each individual triangle has to be rendered with his own texture? How would draw a lightmapping for a directx mesh? What about small faces in a scene, like the corner of a table. Thanx!

Share this post


Link to post
Share on other sites
Your understanding is correct, except that we don't necesserarily have to use one texture for each face. We can "pack" all the lightmaps into a big texture and have the triangle vertices use texture coordinates to index the correct texels. For example, this is a lightmap of a whole level:

Image Hosted by ImageShack.us

All the triangles of the level just use the correct texcoords to sample the correct regions of the lightmap. Of course, along with the lightmap itself, the lightmap generation tool will also have to provide the correct texture coordinates for each triangle.

Share this post


Link to post
Share on other sites
Quote:
Original post by TheC00L1
Cool, so for very large levels, i would split the the triangls, and have like 2 or 3 light maps in total, 1 for each part.


Yes, although most cards today can handle textures up to 4096x4096. So unless the level is really huge, or the desired detail of the lightmap is also really high, or the lightmapper itself have some limitations, just 1 texture of those dimensions should be enough. Writing a lightmapper isn't an easy task though. If you're not doing this for educational purposes, you'll be better off just using an existing lightmapper(FSRAD is a free one, and I believe most 3D modelling suites have tools for generating lightmaps for models).

Share this post


Link to post
Share on other sites
Wow, 4096x4096, yeah, that's plenty, i thought, like 512 was the max.


For lightmap creation, don't you just use raytracing, and/or raycasting for radiosity?

I'm sure it's difficult, and when i was designing a raytracer, it was by no means, fast.

where is FSRAD's main site?

Share this post


Link to post
Share on other sites
Fluid Studios Homepage

It comes with full source code. Note that FSRAD reads and writes the geometry to specific file formats, so your application has either to support them, or you'll have to edit the FSRAD source and write your own importer/exporter for your custom format. It's not that difficult, you just have to figure out some parts.

As for speed, radiosity map generation is relatively slow of course(depends on the detail you want to achieve), but it only has to be done once, so it doesn't really matter that much.

Share this post


Link to post
Share on other sites

This topic is 4206 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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