Re: [Patch] Sun Shading
I was working to an update to my code while I saw yours, and they're very similar. I too did change the polygon color directly (instead of multiply by 1.5 the lightIntensity) however it's a bit more elaborated than that.
After some testing with various step 1.5 games I found that these conditions need a dedicated math (and only for step 1.5):
1) fixed shaded luminous polygons without textures (check the gun calibration test menu of Lost World)
2) luminous polygons without textures (too many...)
3) textured luminous polygons (Fires in Scud's cave level)
4) textured fixed shaded luminous polygons (Virtua Striker 2 step 1.5 Billboard light bulbs, Scud skydome, walls, etc.)
So this is the updated light model:
After some testing with various step 1.5 games I found that these conditions need a dedicated math (and only for step 1.5):
1) fixed shaded luminous polygons without textures (check the gun calibration test menu of Lost World)
2) luminous polygons without textures (too many...)
3) textured luminous polygons (Fires in Scud's cave level)
4) textured fixed shaded luminous polygons (Virtua Striker 2 step 1.5 Billboard light bulbs, Scud skydome, walls, etc.)
So this is the updated light model:
- Code: Select all
// Pseudo-code
if (fixedShading) {
sunFactor = fsFixedShade;
}
else {
sunFactor = dot(sunVector, fsViewNormal);
}
if (!lightEnabled) {
if(hardwareStep==0x15 && texEnable) {
if(fixedShading) {
colour.rgb *= vec3(1.0 + fsFixedShade + lighting[1].y);
}
else {
colour.rgb *= vec3(1.5);
}
}
sunFactor = 1.0;
diffuse = 1.0;
ambient = 0.0;
}
lightIntensity = vec3(diffuse * sunFactor + ambient); // diffuse + ambient
switch (m_stepping) {
case (0x10):
intensityClamp = true;
break;
case (0x15):
intensityClamp = false;
break;
case (0x20):
case (0x21):
intensityClamp = false;
break;
}
if(intensityClamp) {
lightIntensity = min(lightIntensity,1.0);
}


