Surfaces with Alpha or Filter seethrough parts and lightmaps


(jonovic) #1

Is there a way how to use lightmaps on surfaces with parts cutted by alphafunc or blendfunc filter.

-lightmap
-alphafunc
-----> framebuffer is lightmapped and alpha cutting is done = shadows on cutted areas

  • alphafunc
  • lightmap
    ------> well cutted, but then lightmapped all surface = shadows on cutted areas

desired

  • alphafunc lightmap
  • alphafunc
    or
  • alphafunc
  • alphafunc lightmap
    ------> I need to cut lightmap, but HOW TO DO IT? :???:

(jonovic) #2

I have found the hint in another forum - using depthWrite and depthFunc.

I don’t know exactly what it does, but I suppose rendering engine writes down the index of surface triangle (depth buffer value) in alpha stage and then blend the lightmap only in fragments where index is equal to value in depth buffer.


textures/fence
{
      qer_editorimage textures/fence.tga
      q3map_forcemeta
      q3map_lightmapSampleOffset 4
      nopicmip
      {
         map textures/petra/outdoor/fence.tga
         rgbGen identity
         alphaFunc GE128
         depthWrite
      }
     {
         map $lightmap
         blendfunc filter
         rgbGen identity
        depthFunc equal
      }
 }