CaLight not working

A forum about everything related to the Cafu World Editor CaWE: mapping, editing, scripting, making GUIs and fonts, using the BSP, PVS and Light compilers.
Post Reply
afgho
Posts:14
Joined:2012-06-12, 13:08
CaLight not working

Post by afgho » 2012-07-15, 02:14

Seem the same problem as: http://www.cafu.de/forum/viewtopic.php?f=8&t=814

EXCEPT the terrain material do have a lightmap defined ('lightmap $lightmap'), i use the latest SVN version and there is a sky material also

The terrain just render fine but it seem nothing is calculated, it just render the terrain plain light without shadows etc., i added a point light too but nothing was calculated too, looking at the tech demo though it look like it use a baked lightmap into the diffuse texture so not sure if its expected or not (does CaLight affect terrain?).

On others maps CaLight work fine. :?

Here is the sky material:

Code: Select all

Textures/SkyDomes/Thrawn1       // Uses the same sunlight settings as PK_BrightDay2, the other candidate for the TechDemo.cmap.
{
    AmbientShader A_SkyDome
    LightShader   none      // == noDynLight

    // The '#' in the next line is auto-replaced with the relevant suffixes (_px, _ny, ...).
    cubeMap Textures/SkyDomes/Thrawn1#.png, wrapS clampToEdge, wrapT clampToEdge

    ambientMask d           // Don't write into the z-Buffer, so that entities (like missiles) outside of the map can still be drawn.
    noShadows               // This material does not cast dynamic shadows.
    meta_sunlight (220  180  100) (100 -699 -1715)   

    meta_editorImage Textures/SkyDomes/Thrawn1_pz.png
}
Terrain material:

Code: Select all

Terrains/dhunt_terrain_texture
{
    AmbientShader A_Terrain             // Override the automatic shader selection.
    LightShader   none1234              // Override the automatic shader selection - make sure no light shader is selected.
 // noDynLight                          // Same effect as the previous line.

    diffusemap Textures/Terrains/dhunt_texture.png, wrapS clampToEdge, wrapT clampToEdge, noScaleDown, noCompression
    lightmap $lightmap
	
    lumamap    Textures/Terrains/dhunt_detail5.jpg, noScaleDown, noCompression      // "A_Terrain" takes the Luma-map as Detail-map (optional).

    shaderParamExpr fParam4             // The first eight shader parameters are taken from fParam4 to fParam11
    shaderParamExpr fParam5             // and specify the coefficients of two planes for automatic tex-coord generation.
    shaderParamExpr fParam6
    shaderParamExpr fParam7
    shaderParamExpr fParam8
    shaderParamExpr fParam9
    shaderParamExpr fParam10
    shaderParamExpr fParam11
    shaderParamExpr 200                 // Scale / Repetitions of the Detail-map.

    twoSided                            // "twosided" is required for the SOAR terrain algorithm.
}
The log in CaWE:

Code: Select all

Map compilation: Running command 'C:\devlab\Cafu-bin-r525-win32\cafusrc\build\win32\vc10\x86\release\CaBSP\CaBSP.exe "Games\DHunt\Maps\DHunt_TestMap.cmap" "Games\DHunt\Worlds\DHunt_TestMap.cw" '

*** Cafu Binary Space Partitioning Utility, Version 10a (Jul 11 2012) ***

Registering archive "Games/DeathMatch/Textures/SkyDomes.zip".

*** Load World Games\DHunt\Maps\DHunt_TestMap.cmap ***
All game entities done, processing the worldspawn entity now.
Preparing worldspawn clip data ( 0: 0:12)... done ( 0: 0:12).
Face Children    :         42    Draw World Outer Point Samples:     6
PointLights      :          0
InfoPlayerStarts :          1
Other Children   :          1
GameEntities     :          4

*** Binary Space Partitioning ***                   0: 0:12
Nodes  created      :         66
Leaves created      :         67
Faces               :         78

*** Portalization ***                               0: 0:12
Portalization       :       done
Portals             :        325

*** Fill Inside ***                                 0: 0:12
Inner Leaves        :          3
Faces               :          9

*** Chop Up Interpenetrations ***                   0: 0:12
Faces               :         17

*** Binary Space Partitioning ***                   0: 0:12
Nodes  created      :         18
Leaves created      :         19
Faces               :         23

*** Portalization ***                               0: 0:12
Portalization       :       done
Portals             :         61

*** Fill Inside ***                                 0: 0:12
Inner Leaves        :          3
Faces               :         16

*** Merge Faces ***                                 0: 0:12
Faces               :          8

*** Chop up for max LightMap size ***               0: 0:12
Faces               :          8

*** Chop up for max SHLMap size ***                 0: 0:12
Faces               :          8

*** Binary Space Partitioning ***                   0: 0:12
Nodes  created      :          8
Leaves created      :          9
Faces               :          8

*** Portalization ***                               0: 0:12
Portalization       :       done
Portals             :         23

*** Fill Inside ***                                 0: 0:12
Inner Leaves        :          3
Inner Leaves        :          3
Outer Leaves        :          6

*** Sort Faces ***                                  0: 0:12
done

*** Create Default LightMaps ***                    0: 0:12
done

*** Create zero-band SHL maps ***                   0: 0:12
done

*** Compute Draw Structures ***                     0: 0:12
T-Junction removal  :       done
Draw structures     :       done

*** Save World ***                                  0: 0:12
Games\DHunt\Worlds\DHunt_TestMap.cw

COMPLETED.                                          0: 0:13

Map compilation: Running command 'C:\devlab\Cafu-bin-r525-win32\cafusrc\build\win32\vc10\x86\release\CaPVS\CaPVS.exe "Games\DHunt\Worlds\DHunt_TestMap.cw" '

*** Cafu Potentially Visibility Set Utility, Version 05 (Jul 11 2012) ***

Registering archive "Games/DeathMatch/Textures/SkyDomes.zip".
*** Load World Games\DHunt\Worlds\DHunt_TestMap.cw ***

*** Create SuperLeaves ***
    9 SuperLeaves created from
    9 world leaves in CW file.

*** Initialize ***                                  0: 0: 2
SLs Adjacency Graph :       done
SLs Bounding Boxes  :       done
Trivial Visibility  :    1.66667
Estimated PVS       :    1.66667

*** Potentially Visibility Set ***                  0: 0: 2
Final Avg Visibility:    1.66667

*** Statistics ***
Size (bytes)        :         12
CheckSum            :        169

*** Save World ***                                  0: 0: 2
Games\DHunt\Worlds\DHunt_TestMap.cw

COMPLETED.                                          0: 0: 3

Map compilation: Running command 'C:\devlab\Cafu-bin-r525-win32\cafusrc\build\win32\vc10\x86\release\CaLight\CaLight.exe "Games\DHunt\Worlds\DHunt_TestMap.cw" -gd=Games\DHunt\ -BlockSize 3 -StopUE 0.1'

*** Cafu Lighting Utility, Version 3 (Jul 11 2012) ***

Registering archive "Games/DeathMatch/Textures/SkyDomes.zip".
Loading World 'Games\DHunt\Worlds\DHunt_TestMap.cw'.

- BlockSize is 3x3.
- StopUE    is 0.100.
- I will NOT ask you for more.
- BlockSize for direct lighting is 1x1.

*** Initialize Patches ***                          0: 0: 2
# patches allocated:         0
Patch coords and sunlight information calculated.
Sunlight smoothed.

*** Initialize PatchMeshesPVS matrix ***            0: 0: 2
PatchMeshes:                                         0
Bytes allocated for PatchMeshesPVS matrix:           0

WARNING: NON-TRIVIAL PVS INFORMATION REQUIRED FOR SENSIBLE LIGHTING!
   [You may choose to ignore this warning, but lighting will take much longer.]

# matrix elements set to 'PARTIAL':                   0  ( -1.#IO%)
Still 'PARTIAL' after 1st optimization pass:          0  ( -1.#IO%)

*** PHASE I - performing direct lighting ***        0: 0: 2
1. # area  light sources:      0
2. # point light sources:      0

*** PHASE II - performing bounce lighting ***       0: 0: 2

Info: 0 calls to RadiateEnergy() caused 0 potential divergency events.

*** Tone Reproduction (Ward97) ***                  0: 0: 2
MinBrightness:  -9.21034
MaxBrightness:  -9.21034

*** Post-Process Borders ***                        0: 0: 2
Borders completed. 0 patches modified in 2nd part.

*** Write Patch values back into LightMaps ***      0: 0: 2

*** Creating entity lightmaps ***                   0: 0: 2

*** Saving World ***                                0: 0: 2
Games\DHunt\Worlds\DHunt_TestMap.cw

COMPLETED.                                          0: 0: 2
User avatar
Carsten
Site Admin
Posts:2170
Joined:2004-08-19, 13:46
Location:Germany
Contact:

Re: CaLight not working

Post by Carsten » 2012-07-15, 23:57

afgho wrote:The terrain just render fine but it seem nothing is calculated, it just render the terrain plain light without shadows etc., i added a point light too but nothing was calculated too, looking at the tech demo though it look like it use a baked lightmap into the diffuse texture so not sure if its expected or not (does CaLight affect terrain?).
Unfortunately, your observations are right: at this time, CaLight ignores terrains. They are rendered full-bright, and any shadows in them are pre-baked.

When this was initially developed, we decided to exclude terrains from usual CaLight / lightmap processing due to their huge number of polygons and typically intensive lighting, leading to enormous processing times for casting all the rays through the world.

This is an area that definitively needs improvement. I'd be happy to do it, but I have to complete my work regarding the game / entity / networking / scripting code first. If you'd like to help, please let me know, I'll be happy to assist! :up:
Best regards,
Carsten
afgho
Posts:14
Joined:2012-06-12, 13:08

Re: CaLight not working

Post by afgho » 2012-07-16, 00:12

no problem, i'd like to help but i am not a code guru though
User avatar
Carsten
Site Admin
Posts:2170
Joined:2004-08-19, 13:46
Location:Germany
Contact:

Re: CaLight not working

Post by Carsten » 2012-07-17, 23:35

afgho wrote:no problem, i'd like to help
Ok, great to hear this!

The next steps are up to you:
A simple way to achieve quick results would be to use terrains with pre-baked lighting. For the terrains in the Cafu demo, we used Terragen to create them.

Alternatively, if you want to add CaLight / Radiosity / lightmap support to terrains, as a first step you'd have to override / implement method CreatePatchMeshes() of base class GenericNodeT for class TerrainNodeT, all of which are found in directory Libs/SceneGraph, which also has other node classes with example implementations for CreatePatchMeshes().
Best regards,
Carsten
Post Reply

Who is online

Users browsing this forum: No registered users and 12 guests