CaLight not working
Posted: 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:
Visual studio solution-generated CaLight
With some breakpoints and debugging, I reached to the conclusion that:
-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:
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.
-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
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
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++;
}
}
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;