With cordite in the air, splintered steel, shell casings and powder burns, there’s only one explanation...
For all you mappers out there!

Moderators: Pardner, Joe Kari, TheDoctor, Breli

Using hi-resolution external lightmap

Postby Pardner » Tue Jan 06, 2009 5:16 pm

EDIT: Thread split from Joe Kari's tutorial. Pardner 10/14/09


Wow Joe! Those look great. Maybe I will give this a try on NNC just to see how it works and then use it on any up coming maps I may do :D
Last edited by Pardner on Thu Oct 15, 2009 5:00 am, edited 1 time in total.

Image
Image
User avatar
Pardner
SG Team
 
Posts: 1786
Joined: Fri Nov 18, 2005 5:48 am
Location: MD, USA



Postby L3th4l » Tue Jan 06, 2009 8:12 pm

That's pretty impressive Joe. I had seen this in a few posts before searching for other things and never got around to trying it. Does it effect frame rates at all?
User avatar
L3th4l
Smokin' Amigo!
 
Posts: 1948
Joined: Sat Jun 18, 2005 8:06 am
Location: Binghamton, NY. USA



Postby Joe Kari » Wed Jan 07, 2009 7:43 am

@ L3th4l: I haven't investigate too much for instance, just got it to work 2 days ago, and for instance, I haven't notice any performance issue. As long as you have got enough memory on you video card, it should not affect framerate ;)
I will know that next time Alamo will be compiled with VIS.

However, I'm not sure regular lightmap are affected by picmip, but since external lightmap are just like others textures, they are reduced if user set textures details to medium or low.
User avatar
Joe Kari
SG Team
 
Posts: 878
Joined: Sun Sep 16, 2007 8:44 pm
Location: France



Postby Joe Kari » Sat Jan 17, 2009 7:17 pm

Good news: I have made a final compile of Alamo today, and I have got exactly the same framerate everywhere as it use to be. This doesn't affect performance ;)
Last edited by Joe Kari on Sat Jan 17, 2009 9:25 pm, edited 1 time in total.
User avatar
Joe Kari
SG Team
 
Posts: 878
Joined: Sun Sep 16, 2007 8:44 pm
Location: France



Postby ChainLightnin' » Sat Jan 17, 2009 9:04 pm

Amazing! Do we get to see?!!
Well...Mr. Chain Blue Lightnin' hisself..heh, heh!
User avatar
ChainLightnin'
Gunslinger
 
Posts: 389
Joined: Fri Jun 09, 2006 4:09 am
Location: Montana



Postby L3th4l » Sat Jan 17, 2009 9:39 pm

Joe Kari wrote:Good news: I have made a final compile of Alamo today, and I have got exactly the same framerate everywhere as it use to be. This doesn't affect performance ;)


Awesome news.. 8)
User avatar
L3th4l
Smokin' Amigo!
 
Posts: 1948
Joined: Sat Jun 18, 2005 8:06 am
Location: Binghamton, NY. USA



Postby ReD NeCKersoN » Thu Sep 17, 2009 2:58 am

To keep this thread clean, I deleted the posts from the last few days. I resolved my problem, which was a stupid oversight on my part. :wink:

However, I'm not getting the desired results. Here is the generated image for HeH in it's orignal size, but converted to jpg for this thread. (Click on thumbnail.)
Image
As you can see, the relevant data is very small in the upper left portion of the image. Is this normal?
So then I tried cropping the image to what I thought it should look like, and resized it just so you can see the crappy level of detail.
Image
Here is my shader for the terrain in HeH.
Code: Select all
textures/reds/dirt_sand_blend_hrl
{
   q3map_lightimage textures/sg_sand/sand_elpaso3.tga
   qer_editorimage textures/sg_blend/dirt_to_sand.tga
    surfaceparm dust
   q3map_tcGen ivector ( 256 0 0 ) ( 0 256 0 )
   q3map_lightmapAxis z       
   q3map_lightmapSize 1024 1024
    q3map_lightmapBrightness 2.0
    {       
      map textures/sg_sand/sand_elpaso3.tga     
      rgbGen identity   
   }   
   {
      map textures/sg_dirt/dirt_brown1.tga
      blendFunc GL_SRc_ALPHA GL_ONE_MINUS_SRc_ALPHA
      rgbGen identity
      alphaGen oneminusvertex
   }
   {
      tcgen lightmap
       map $lightmap
       rgbGen identity
   }
}

And here is the generated shader by q3map2.
Code: Select all
// Custom shader file for dm_hangemhigh.bsp
// Generated by Q3Map2 (ydnar)
// Do not edit! This file is overwritten on recompiles.

dm_hangemhigh/072A527275DD6B1D625FD9226D9D8167
{
   q3map_lightimage textures/sg_sand/sand_elpaso3.tga
   qer_editorimage textures/sg_blend/dirt_to_sand.tga
   surfaceparm dust
   q3map_tcGen ivector ( 256 0 0 ) ( 0 256 0 )
   q3map_lightmapAxis z
   q3map_lightmapSize 1024 1024
   q3map_lightmapBrightness 2.0
   {
      map textures/sg_sand/sand_elpaso3.tga
      rgbGen identity
   }
   {
      map textures/sg_dirt/dirt_brown1.tga
      blendFunc GL_SRc_ALPHA GL_ONE_MINUS_SRc_ALPHA
      rgbGen identity
      alphaGen oneminusvertex
   }
   {
      tcgen lightmap
      map maps/dm_hangemhigh/lm_0000.tga
      rgbGen identity
   }
}


I am guessing that this could be the problem, but don't I need this for the texture blending?
Code: Select all
q3map_lightimage textures/sg_sand/sand_elpaso3.tga
Image
User avatar
ReD NeCKersoN
SG Team
 
Posts: 3245
Joined: Wed Mar 27, 2002 6:22 am
Location: VA, USA



Postby Coup'George » Thu Sep 17, 2009 3:49 am

Maybe you need to change the " _lightmapscale " to a lower value in radiant. In Alamo, it is 0.25, and the default value is 1.0.
User avatar
Coup'George
Smokin' Amigo!
 
Posts: 7
Joined: Tue Oct 16, 2007 5:30 am



Postby ReD NeCKersoN » Thu Sep 17, 2009 4:26 am

You may be onto something there. After adding this value to the worldspawn I get an image like this:
Image
That photo is unmodified. Still no visible effect in the map though. I'll keep experimenting.

NOTE: It might be worth mentioning in the tutorial that a "_lightmapscale" key is needed in the worldspawn & that the value may need to be tweaked.
User avatar
ReD NeCKersoN
SG Team
 
Posts: 3245
Joined: Wed Mar 27, 2002 6:22 am
Location: VA, USA



Postby Coup'George » Thu Sep 17, 2009 6:17 am

Woops, I had not seen, you need to add "blendFunc filter" in the last stage, so in your shader in the lightmap stage, like that :


Code: Select all
textures/reds/dirt_sand_blend_hrl
{
   q3map_lightimage textures/sg_sand/sand_elpaso3.tga
   qer_editorimage textures/sg_blend/dirt_to_sand.tga
    surfaceparm dust
   q3map_tcGen ivector ( 256 0 0 ) ( 0 256 0 )
   q3map_lightmapAxis z       
   q3map_lightmapSize 1024 1024
    q3map_lightmapBrightness 2.0
    {       
      map textures/sg_sand/sand_elpaso3.tga     
      rgbGen identity   
   }   
   {
      map textures/sg_dirt/dirt_brown1.tga
      blendFunc GL_SRc_ALPHA GL_ONE_MINUS_SRc_ALPHA
      rgbGen identity
      alphaGen oneminusvertex
   }
   {
      tcgen lightmap
       map $lightmap
       rgbGen identity
       blendFunc filter
   }
}
User avatar
Coup'George
Smokin' Amigo!
 
Posts: 7
Joined: Tue Oct 16, 2007 5:30 am



Postby Joe Kari » Thu Sep 17, 2009 1:24 pm

Good eyes brother ;)
Yes, if your lightmap stage come not first, you need to add a "blendfunc filter"... In my example I forget to mention that, cause in standard shader (those who have not texture blending), the lighmap stage come first, so the "blendfunc filter" is inserted in the 2nd.

About the poor detailed result of your lightmap, like my bro' said, you can change the _lightmapscale of the worldspawn. You can use in conjunction:
q3map_lightmapSampleSize N
in your shader, a value of 4 should give you a good result.

I should mention that in the tutorial... ... ...
User avatar
Joe Kari
SG Team
 
Posts: 878
Joined: Sun Sep 16, 2007 8:44 pm
Location: France



Postby ReD NeCKersoN » Thu Sep 17, 2009 3:30 pm

Changing the _lightmapscale to .125 yielded an even better image, but trying .0625 didn't seem to fill the frame any further. Have I hit a wall? Maybe I need to try different values for the q3map_lightmapSize?

Before I left for work this morning, I did a quick compile with blendFunc filter & q3map_lightmapSampleSize 4 added to the shader. The result still doesn't look any different than if I weren't trying this technique at all.
My guess is that the generated images must fill the 1024x1024 frame for this to work. So maybe that's my problem? I'll try some more experiments tonight if I can.

PS. Did you have to crop your images with photoshop?
User avatar
ReD NeCKersoN
SG Team
 
Posts: 3245
Joined: Wed Mar 27, 2002 6:22 am
Location: VA, USA



Postby Joe Kari » Thu Sep 17, 2009 4:51 pm

Setting lightmapscale to 0.0625 is not necessary (and I'm not sure this is supported by q3map2).
You should NOT crop or edit the image !!! Your texture coordinate are calculated for the generated image.
And don't forget that this image, like all image in OpenGL context, should be power of 2 sized.

No problem if the generated images doesn't fill the 1024x1024 frame for this to work.
If you don't want to waste texture memory for nothing, you can eventually, like I have done in alamo, use a shader of this type in other place, until all your image is filled. The same image could be shared between as many shader you want. If you use it too much, it will simply create 2 external lightmap instead of one (I don't recommand that, since two 1024x1024 tex = eight 512x512 tex).

If you have trouble, you can send me your package, I will look at it when I'll be back at home tonight. I give you an email adress in pm where I hope have enough room for big files.
User avatar
Joe Kari
SG Team
 
Posts: 878
Joined: Sun Sep 16, 2007 8:44 pm
Location: France



Postby ReD NeCKersoN » Sun Sep 20, 2009 1:32 am

Thanks to Coup'George & Joe Kari for all of their help! Here you can see how much nicer the shadows are in Hang'em High with this method.
Image
But I noticed that the compiler ignores certain entities when calculating the light image. Notice the closed door in this next image. Of course, it would be correct when the door is open.
Image
User avatar
ReD NeCKersoN
SG Team
 
Posts: 3245
Joined: Wed Mar 27, 2002 6:22 am
Location: VA, USA



Postby Ugly » Sun Sep 20, 2009 9:18 am

Will the shadows generated by the watchtower and the wooden palisade remain on Alamo after they've been blown up?
User avatar
Ugly
Pistolero
 
Posts: 38
Joined: Fri Jan 02, 2009 7:55 pm



Next

Return to Level Editing

Show Sidebar
Show Sidebar

User Control Panel