How to create light maps at runtime?
-
- Posts: 59
- Joined: Thu May 01, 2008 1:20 am
- Location: New Caledonia (France - Pacific)
- Contact:
How to create light maps at runtime?
Let's say I have a mesh (with multiple mesh buffers) created dynamically at runtime.
I'd like it to be nicely illuminated, so a nice way would be to use a light map texture. I can't use IrrEdit to create the light map texture, because the mesh is created dynamically.
Is there a way to create light maps at runtime?
Thank you.
I'd like it to be nicely illuminated, so a nice way would be to use a light map texture. I can't use IrrEdit to create the light map texture, because the mesh is created dynamically.
Is there a way to create light maps at runtime?
Thank you.
lightmaps are pre-calculated, basically a snapshot in time of a given moment. light values are baked into a texture which later on get blended into colormaps.
that's what lightmaps are for.
what you really want is something done in real-time, and that's not how lightmaps work.
try looking into SSAO or realtime radiosity. that may be what you are looking for.
on the other hand, shenmue II has that kind of feature, though. the lightmaps react to the time of day.
that's what lightmaps are for.
what you really want is something done in real-time, and that's not how lightmaps work.
try looking into SSAO or realtime radiosity. that may be what you are looking for.
on the other hand, shenmue II has that kind of feature, though. the lightmaps react to the time of day.
-
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
You could buy the sources of irrEdit and apply the algorithms to your dynamically created mesh. Or you implement such stuff on your own. Another option is to write the dynamically generated mesh to a file (using the mesh writer interface) and load them into irrEdit, do the lightmaps, and load those back in your app.
Yeah presumably, to save paying $300 or whatever for the irrEdit source, you can just google light map generation and find out an algorithm for creating them and just implement that yourself.
Or you could just use shadow mapping (a few shaders for that in the projects forum) which will give you real-time shadows at a good speed, does it HAVE to be light maps? If so, why?
Or you could just use shadow mapping (a few shaders for that in the projects forum) which will give you real-time shadows at a good speed, does it HAVE to be light maps? If so, why?
-
- Posts: 117
- Joined: Sat Apr 19, 2008 10:14 am
-
- Posts: 59
- Joined: Thu May 01, 2008 1:20 am
- Location: New Caledonia (France - Pacific)
- Contact:
JP, are you talking about the thread called XEffects - (Indoor Soft-Shadows + Post-Processing)? I'll have a look at it... looks like what I'm after.Or you could just use shadow mapping (a few shaders for that in the projects forum) which will give you real-time shadows at a good speed, does it HAVE to be light maps? If so, why?
To answer your question, I only know about light maps for creating static shadows, but any other solution such as shaders would do.
I understand, but I can't do that as the mesh is changing very often. I have a big tile-based world (up to 10,000 x 10,000 tiles), but of course I can't render such a big world, so I create a mesh that only shows a small portion of the world (eg 10x10 tiles). Each time another part of the world must be displayed, the mesh is recreated.Another option is to write the dynamically generated mesh to a file (using the mesh writer interface) and load them into irrEdit, do the lightmaps, and load those back in your app.
Well, I don't need dynamic shadows, I need static shadows for the environment (walls and corridors).what you really want is something done in real-time, and that's not how lightmaps work.
I need more dramatic shadows than those ambient occlusion creates.try looking into SSAO or realtime radiosity.
Thank you all for your kind replies
it looks like you're still searching for a solution.
hope you find them soon.
in my case, giles for static lightmaps and xeffects for shadowmapping are the ones i use.
i just finished reading one chapter in gpu gems 2 about ambient occlusion(ao), and it looks like ao will also work. codewise, there's no code, though the book described the procedure how shadows get calculated. it uses disks having position, normal and area to project shadows down to other disks.
See chapter 14 found in this page: http://developer.nvidia.com/object/gpu_gems_2_home.html
hmm, the code for chapter 14 is here: http://http.download.nvidia.com/develop ... Index.html
hope you find them soon.
in my case, giles for static lightmaps and xeffects for shadowmapping are the ones i use.
i just finished reading one chapter in gpu gems 2 about ambient occlusion(ao), and it looks like ao will also work. codewise, there's no code, though the book described the procedure how shadows get calculated. it uses disks having position, normal and area to project shadows down to other disks.
See chapter 14 found in this page: http://developer.nvidia.com/object/gpu_gems_2_home.html
hmm, the code for chapter 14 is here: http://http.download.nvidia.com/develop ... Index.html
-
- Posts: 1638
- Joined: Mon Apr 30, 2007 3:24 am
- Location: Montreal, CANADA
- Contact:
dlangdev is giving you the path to follow. You NEED dynamic shadow, not because your meshes does not move but your scene change dynamicaly.
real time ambient occlusion and shadow mapping are used in next-gen games to create the environnement using generated meshes. You will rely a lot on shaders power and next gen equipment to that and is the way to go if you want a look to rival CRYSIS or FAR CRY II.
You should take note that those technique will require a beefy PC to run the application and you surely will have to use multithreading effectively to make that happen (so will require at least a dual core CPU to run your application with thoses features)
The only other (less CPU/GPU expensive) solution would be to pre-render some lightmaps for some meshes that are placed "dynamicaly" (Like Hellgate London). But your will need to create parts and create the lightmaps inside the application. It will not look as good, but with some good planning (and really thinking were you place you lighting) you could achieve a nice look.
real time ambient occlusion and shadow mapping are used in next-gen games to create the environnement using generated meshes. You will rely a lot on shaders power and next gen equipment to that and is the way to go if you want a look to rival CRYSIS or FAR CRY II.
You should take note that those technique will require a beefy PC to run the application and you surely will have to use multithreading effectively to make that happen (so will require at least a dual core CPU to run your application with thoses features)
The only other (less CPU/GPU expensive) solution would be to pre-render some lightmaps for some meshes that are placed "dynamicaly" (Like Hellgate London). But your will need to create parts and create the lightmaps inside the application. It will not look as good, but with some good planning (and really thinking were you place you lighting) you could achieve a nice look.
I'm trying to understand you piiichan, but it's kind of hard to understand. From what I have read, about your tiled world, and the need to re-create your mesh, it appears as though you only want to generate lightmaps for the terrain dynamically? If this is true, then why not just store the lightmap textures along with their associated tile, and then load those. That may be a little memory intensive on the HD considering you have 10,000x10,000 tiles though I guess.
So next, I will recommend this algorithm. It has been implemented with Ogre3D, but the concept is there for you to implement with Irrlicht: Realtime Terrain Lightmapping. It took 1.4 seconds to generate a 2048x2048 lightmap for a terrain on his system, so I would check that thread.
So next, I will recommend this algorithm. It has been implemented with Ogre3D, but the concept is there for you to implement with Irrlicht: Realtime Terrain Lightmapping. It took 1.4 seconds to generate a 2048x2048 lightmap for a terrain on his system, so I would check that thread.
TheQuestion = 2B || !2B
-
- Posts: 59
- Joined: Thu May 01, 2008 1:20 am
- Location: New Caledonia (France - Pacific)
- Contact:
dlangdev, I've downloaded the PDF of GPU Gems chap 14 (by the way, I'm impressed it is freely available online ). What I exactly want is shown in the first row, fig.14-8, p.232. So thanks for the link
I've heard about xeffects, but what is giles?
christianclavet, thanks for your advice and techniques, I'll take them into account. I will also have a thought on the technique you last mention... I was surely mistaken when I wrote that ambient occlusion is not a good solution for what I want. Can it generate sharp, direct shadows from point light sources?
Halifax, I'm doing a diablo-like game. The world is generated randomly when the level is loading. That means I allocate up to 10,000 by 10,000 tiles, set each of them to a particular type, eg grass, gravel, wall, door, stone, tree etc... For each type of tile, I know how to generate the corresponding mesh and associate the corresponding texture. Now, with the main character standing in the middle of the screen, there are about 10 by 10 visible tiles. Some tile types should be sources of light, eg a wall with a torch attached to it, a lava tile, or a magic crystal tile. These tiles should consequently affect the texture on surrounding tiles that are also part of the same mesh.
What I'd like to do is compute the lightmap only for the displayed mesh, ie for the 10x10 tiles.
I'll have a look at the link you provide, thx!
From what all of you told me, I see the problem I am tackling is not trivial. I now have plenty of links and ideas you kindly provided, thx again.
My game is simple and I do it only for the fun of doing it. I'd like it to be cute and pretty (all of us I believe would like that) with nice colored lights and shadows, but the gameplay is the number 1 priority for me. If I feel things get too hard and require too much time, I'll just use simple light nodes.
I've heard about xeffects, but what is giles?
christianclavet, thanks for your advice and techniques, I'll take them into account. I will also have a thought on the technique you last mention... I was surely mistaken when I wrote that ambient occlusion is not a good solution for what I want. Can it generate sharp, direct shadows from point light sources?
Halifax, I'm doing a diablo-like game. The world is generated randomly when the level is loading. That means I allocate up to 10,000 by 10,000 tiles, set each of them to a particular type, eg grass, gravel, wall, door, stone, tree etc... For each type of tile, I know how to generate the corresponding mesh and associate the corresponding texture. Now, with the main character standing in the middle of the screen, there are about 10 by 10 visible tiles. Some tile types should be sources of light, eg a wall with a torch attached to it, a lava tile, or a magic crystal tile. These tiles should consequently affect the texture on surrounding tiles that are also part of the same mesh.
What I'd like to do is compute the lightmap only for the displayed mesh, ie for the 10x10 tiles.
I'll have a look at the link you provide, thx!
From what all of you told me, I see the problem I am tackling is not trivial. I now have plenty of links and ideas you kindly provided, thx again.
My game is simple and I do it only for the fun of doing it. I'd like it to be cute and pretty (all of us I believe would like that) with nice colored lights and shadows, but the gameplay is the number 1 priority for me. If I feel things get too hard and require too much time, I'll just use simple light nodes.
you can also read more shading effect from valve's, here's the link to the pdf...
they call it "radiosity normal mapping"
http://www2.ati.com/developer/gdc/D3DTu ... hading.pdf
they call it "radiosity normal mapping"
http://www2.ati.com/developer/gdc/D3DTu ... hading.pdf
found another good article, you might want to check this out. probably one of the complete detailed discussion about the subject.
http://freespace.virgin.net/hugo.elias/ ... iosity.htm
http://freespace.virgin.net/hugo.elias/ ... iosity.htm
Ok, I'm quoting this.I've heard about xeffects, but what is giles?
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net