Topic: No lightmap information in shader.

I need some help with my shader. I think I'm doing something terribly wrong, because it isn't working.
I wanted to have a scrolling texture of sand and by searching the forums I discovered the tcMod scroll function.
It scrolls just fine but as is obvious in the image below the lightmap information is lost for some reason and the texture is "fullbright".

http://img352.imageshack.us/img352/3706/lightmapwtfplzmc7.th.jpg

The image to the far left is what my shader looks like in-game. To the far right I've used a regular texture to show how I want it to look like. And in the middle is the far left image again but with r_lightmap set to 1.
I did some googling and found something called "map $lightmap" which by the sound of it should be exactly what I was looking for. But my implementation of it didn't produce any results.
I've also failed to get surfaceparm noimpact and nonsolid to work. I thought I had figured out how shaders worked but it's apparent that I'm doing everything wrong.

This shader business is clearly above my head. Could someone with more knowledge in these matters take a look at my sorry excuse for code? smile

textures/ladelulaku/sandscroll
{
    qer_editorimage textures/ladelulaku/sandscroll.tga
    surfaceparm nonsolid
    surfaceparm noimpact
    q3map_novertexshadows
    q3map_notjunc
    {
        map $lightmap
    }
    {
        map $dlight
        blendfunc add
    }
    {
        map textures/ladelulaku/sandscroll.tga
        blendfunc blend
        tcMod scroll 0 -0.7
    }
}

Re: No lightmap information in shader.

map $lightmap means that the texture is influenced by the surrounding light, say If there is a red light near this texture, the texture will get red lighted too.
I think it doesn't work because you forgot to add blendfunc filter (lightmaps are filters)
so try it like this:

map $lightmap
blendfunc filter

hmm, noimpact and nonsolid should normally work, be sure that when you put the texture on a face of a brush that the other faces have a nonsolid texture on it like nodrawnonsolid e.g.
Or you can put it on a mesh, how I ever do.

Last edited by SolidFake (2008-08-22 13:43)

#warsow.mapping
latest mapreview: ws-aztech by Torefos
WASD - WArsow Singleplayer Development

3

Re: No lightmap information in shader.

The lightmap pass is fine. Using blending on the first pass would make the shader transparent.


I think the problem is here:

{
        map textures/ladelulaku/sandscroll.tga
        blendfunc blend
        tcMod scroll 0 -0.7
    }


BlendFunc blend masks the sandscroll texture using the alpha channel over the previous passes. A pixel where the alphamask is white will not preserve any of the things below, this is, the lightmap. You probably want to use blendfunc filter for the sandscroll pass, so the lightmap is preserved.

Besides that, I see no reason for these q3map commands to be used:
q3map_novertexshadows
    q3map_notjunc

It's not related to your problem, tho.

No pigs were harmed in the making of this game.

¡Puxa Sporting!

Re: No lightmap information in shader.

It's working perfectly now! Thank you very much, both of you. smile
I got it working using SolidFake's variant first but only after repositioning the $lightmap pass underneath the tcMod scroll part. Got some odd artifacts however and figured out after some trial and error that it was the blendfunc blend that was causing it. Then jal came and cleared things up for me and now I think I understand how things work.
noimpact and nonsolid works fine aswell with that nodrawnonsolid trick, but is it possible to make a patch mesh non-solid aswell? I tried applying my sandscroll shader to a patch mesh but it's still solid.

My code now looks like this for anyone who might be interested:

textures/ladelulaku/sandscroll
{
    qer_editorimage textures/ladelulaku/sandscroll.tga
    surfaceparm noimpact
    surfaceparm nonsolid
    {
        map $lightmap
    }
    {
        map textures/ladelulaku/sandscroll.tga
    blendfunc filter
        tcMod scroll 0 -0.7
    }
}

Re: No lightmap information in shader.

yeah it should work on a mesh too

#warsow.mapping
latest mapreview: ws-aztech by Torefos
WASD - WArsow Singleplayer Development