Home Technical Talk

Lightmaps

greentooth
Offline / Send Message
Noors greentooth
Hi Polycount Community :]
Sorry in advance for my awful english, I'm a frog :poly136:

I try to have some decent results while generating lightmaps with 3ds max via Vray.

First I tried without hlsl shader. The final RT engine (virtools) has some basic blend modes.

I used the multiply mode, but then, lightmaps only darken the model, so textures have to be over lightened.

I used what i think is called "modulate 2x". Here, average grey don't do any modification. Dark color darken the under texture, light color burn the under texture. So it's already more realistic than multiply mode, but all gradients are dirty, because the lighting range is divided by 2 : 128 levels to darken, 128 to lighten.
(hope i make sense :s)

So, since I'm not in real time industry and have to find all tips by myself, I wonder what kind of blending modes hlsl shaders in video games are using. Coz it looks far better than what i have. And how cgartist can light there scenes, control them with some renders, and be sure that the result will be what they get into the engine. So how u guys generate ur lightmaps when u have no editor such as UE3 ?

Thanks to light my candel !

Replies

  • Eric Chadwick
    Modulate 2x is a great way to do this, although it depends on what performs well on your target hardware.
  • Noors
    Offline / Send Message
    Noors greentooth
    Well i don't have a specific target hardware. I just want to make smthing nice.
    Modulate 2x is almost good, except those awful artefacts due to the divided range. And well i don't see that kind of thing in games.

    I wonder how to make a nice static lighting on a RT scene like I've seen here.

    http://boards.polycount.net/showthread.php?t=56421&highlight=lightmap

    Ofc, here it's a quite complex hlsl shader, with normal/specu/env maps. i guess i have to study the code deeply to understand all blending modes. It scares me a bit.

    I was asking for some tips. Dunno, lightmaps seems like a mystery to me.
    thnx anyway :poly121:
  • CrazyButcher
    Offline / Send Message
    CrazyButcher polycounter lvl 20
    the lightmapping technique used in todays top engines is often directional based. Ie its not the classic type of "blend color ontop" lightmap. But it stores lighting contributions of multiple directions, so that normalmaps can be fully used.

    Look for "radiosity normal mapping" by valve (half-life 2), similar technique is used in Unreal3 as well. However it requires dedicated support of the lightmap generator and of course some custom shadercode.

    ---

    the screenshot you've shown very likely uses cubemaps for lighting. and maybe some image based ramping.
    here is a shader for 3dsmax that supports this
    http://www.luxinia.de/index.php/ArtTools/3dsmaxFX#genbrdf

    Characters or moving objects wont use pre-generated lightmaps
  • Noors
    Offline / Send Message
    Noors greentooth
    Oh thank you, u give me a starting point.Techniques used to fake reality are quite fascinating. I guess the technique i tried was the best without hlsl shader, but, yeah, really limited.
  • multivac
    I use virtools too,and I just used HLSL to do lightmaps,it goes something like that:

    finalcol=(finalcol*LightLayer* 2.0f);
    clamp(finalcol,0,1);
    finalcol = (finalcol)*(diffuselighting*2.0f);
    finalcol *=lightColor*0.8f* burn;

    Last line is for depth shadow maps,but otherwise its modulate2x i guess,and i haven't really seen this banding of gradients,mind posting a screen?
  • Noors
    Offline / Send Message
    Noors greentooth
    Nope.
    Here are 2 screens from virtools. It's a very basic scene. No hlsl shader, just full illuminated materials. Lightmap material is set to sourcecolor/destcolor.

    It took me hours to discover how i should setup lightmaps to have same results between vray renders and virtools gah :poly142:

    So well, it's not that bad with a average lighting :
    ab788bfc432563f6bc4e843d8b401.jpg

    but when lightmap is darker, i start to have some color artefacts and dirty gradients. I blured my lightmap a bit in ps, so it's a bit better. The problem is just that modulate 2* accentuate imperfections of the lightmap. I guess there are some issues with color clamping too.

    Also this scene is pretty basic and doesn't need an extraordinary lighting, but i'm thinkin about more serious project in future too.
    a9d8acbe2c476ab7161b738f3b9f6.jpg
Sign In or Register to comment.