CaLight not working

Get technical support about the C++ source code and about Lua scripts for maps, entities, GUIs, the console, materials, etc. Also covered are the Cafu libraries and APIs, as well as compiling, linking, and the build system.
Post Reply
User avatar
BRabbit
Posts: 28
Joined: 2010-08-16, 19:26
Location: Moscow, Russia

CaLight not working

Post by BRabbit » 2010-11-22, 18:42

I have now the whole cafu code compiled with my Visual Studio solution. Every single DLL, app, and library is working, with the exception of CaLight. It 'seems' to work, in fact, and is not showing any errors or something, but it just doesn't process the lights (and compiles maps extremely fast -hinting that it isn't compiling anything) which results in completely lit maps. (Like compiling them without using CaLight).

-I'm compiling them from CaWE which is using those command line options by default -say, -fast and -StopUE 0.1.

-I'm using the /J compiler switch in every library, DLL or app of Cafu.

-CaBSP and CaPVS are proven working right, I compared the output of these against the ones of the SCons generated and is the same.

-But there are differences in the output of Calight (i pointed out them in the following code):

SCons generated CaLight:

Code: Select all


COMPLETED.                                          0: 0: 0

Map compilation: Running command 'CaLight.exe "Games\DeathMatch\Worlds\Test.cw" -gd=Games\DeathMatch\ -fast'

*** Cafu Lighting Utility, Version 3 (Nov  5 2010) ***


Warning: Failed to open ZIP archive Games/DeathMatch/Textures/TechDemo.zip
Registering archive "Games/DeathMatch/Textures/SkyDomes.zip".
Loading World 'Games\DeathMatch\Worlds\Test.cw'.

- BlockSize is 5x5.
- StopUE    is 1.000.
- I will NOT ask you for more.
- BlockSize for direct lighting is 5x5.

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

*** Initialize PatchMeshesPVS matrix ***            0: 0: 1
PatchMeshes:                                         6
Bytes allocated for PatchMeshesPVS matrix:           8

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':                  36  (100.000%)
Still 'PARTIAL' after 1st optimization pass:         30  ( 83.333%)

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

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

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

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

*** Post-Process Borders ***                        0: 0: 1
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\DeathMatch\Worlds\lala.cw

COMPLETED.                                          0: 0: 2
Visual studio solution-generated CaLight

Code: Select all



COMPLETED.                                          0: 0: 0

Map compilation: Running command 'CaLight.exe "Games\DeathMatch\Worlds\Test.cw" -gd=Games\DeathMatch\ -fast'

*** Cafu Lighting Utility, Version 3 (Nov  5 2010) ***


Warning: Failed to open ZIP archive Games/DeathMatch/Textures/TechDemo.zip
Registering archive "Games/DeathMatch/Textures/SkyDomes.zip".
Loading World 'Games\DeathMatch\Worlds\Test.cw'.

- BlockSize is 5x5.
- StopUE    is 1.000.
- I will NOT ask you for more.
- BlockSize for direct lighting is 5x5.

*** Initialize Patches ***                          0: 0: 0
# patches allocated:         0  // <- This number is different, should it be 27272 or something?
Patch coords and sunlight information calculated.
Sunlight smoothed.

*** Initialize PatchMeshesPVS matrix ***            0: 0: 0
PatchMeshes:                                         0 // <- This is modified too
Bytes allocated for PatchMeshesPVS matrix:           0 // This one

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%) // This
Still 'PARTIAL' after 1st optimization pass:          0  ( -1.#IO%) // and this one too

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

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

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

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

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

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

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

*** Saving World ***                                0: 0: 0
Games\DeathMatch\Worlds\Test.cw

COMPLETED.                                          0: 0: 0
With some breakpoints and debugging, I reached to the conclusion that:

Code: Select all

    for (unsigned long FaceNr=0; FaceNr<Map.FaceChildren.Size(); FaceNr++)
    {
        printf("%5.1f%% (f)\r", (double)FaceNr/(Map.FaceChildren.Size()+Map.OtherChildren.Size())*100.0);
        fflush(stdout);

        ArrayT< ArrayT< ArrayT<Vector3dT> > > SampleCoords;

        Map.FaceChildren[FaceNr]->CreatePatchMeshes(PatchMeshes, SampleCoords);

        for (unsigned long SampleCoordsNr=0; SampleCoordsNr<SampleCoords.Size(); SampleCoordsNr++)
        {
            InitSunlight(PatchMeshes[PatchMeshNr], SampleCoords[SampleCoordsNr], Suns, SkyFaces, CaLightWorld);

            PatchesCount+=PatchMeshes[PatchMeshNr].Patches.Size();
            PatchMeshNr++;
        }
    }
-In Init2.cpp, within the function void InitializePatches(const CaLightWorldT& CaLightWorld) this loop is executed 6 times (one for each face), which i think is OK. But the nested loop isn't executed anytime, as SampleCoords.Size() equals 0. Going behind it, SampleCoords is modified by the function void FaceNodeT::CreatePatchMeshes(ArrayT<PatchMeshT>& PatchMeshes, ArrayT< ArrayT< ArrayT<Vector3dT> > >& SampleCoords) const
which at the beginning checks the following values:

Code: Select all

    if (LightMapInfo.SizeS==0) return;
    if (LightMapInfo.SizeT==0) return;
    if (Polygon.Vertices.Size()<3) return;
The .cmap file is generated OK (i compared it too), don't know if the .cw generated by CaBSP is too, (comparing binary files is not trivial). Anyway, the maps are correctly displayed in Ca3De, without lights.
User avatar
Carsten
Site Admin
Posts: 2160
Joined: 2004-08-19, 13:46
Location: Germany
Contact:

Re: CaLight not working

Post by Carsten » 2010-11-23, 00:35

BRabbit wrote:Visual studio solution-generated CaLight

Code: Select all

*** Cafu Lighting Utility, Version 3 (Nov  5 2010) ***
Well, this looks suspicious:
If this was built with Visual Studio, it should show a different date in the banner.

Also in combination with the strange output that you get, it looks as if you somehow "mixed" modules from different compilers, different switches, etc.

I'd recommend that you run a complete, clean rebuild, i.e. compile and link everything from scratch. If there are problems, don't work around them, but fix them instead. I'm quite confident that CaLight will then work as well. :up:
Best regards,
Carsten
User avatar
BRabbit
Posts: 28
Joined: 2010-08-16, 19:26
Location: Moscow, Russia

Re: CaLight not working

Post by BRabbit » 2010-11-27, 23:10

:roll: It wasn't processing lighting because the materials I was using didn't have the

Code: Select all

lightmap    $lightmap
.
User avatar
Carsten
Site Admin
Posts: 2160
Joined: 2004-08-19, 13:46
Location: Germany
Contact:

Re: CaLight not working

Post by Carsten » 2010-11-28, 15:48

Hi,
BRabbit wrote::roll: It wasn't processing lighting because the materials I was using didn't have the

Code: Select all

lightmap    $lightmap
thanks for sharing this, but it leaves me a bit confused:
Why did the problem not occur with pristine, SCons-compiled CaLight, but only with your Visual-Studio-based edition?
(Did you use different .cw and/or .cmat files?)

And in order to reduce the risk that this (easily) happens again in the future, would it help if CaLight implemented a check for the number of materials with lightmap $lightmap, aborting (with a nice, helpful error message) if zero?
Best regards,
Carsten
User avatar
BRabbit
Posts: 28
Joined: 2010-08-16, 19:26
Location: Moscow, Russia

Re: CaLight not working

Post by BRabbit » 2010-11-28, 22:52

BRabbit wrote:Why did the problem not occur with pristine, SCons-compiled CaLight, but only with your Visual-Studio-based edition?
(Did you use different .cw and/or .cmat files?)
Yes, I was using different materials.
BRabbit wrote:And in order to reduce the risk that this (easily) happens again in the future, would it help if CaLight implemented a check for the number of materials with lightmap $lightmap, aborting (with a nice, helpful error message) if zero?
Definitely it would do help. Gonna try code it.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest