Add lm_bounce and lm_ao to ZDRayInfo
Make vktool ignore the existing lightmap lump Ignore the lightmapper cvars in vktool
This commit is contained in:
parent
df125c3916
commit
d8d1742d0a
7 changed files with 34 additions and 10 deletions
|
|
@ -136,6 +136,8 @@ public:
|
|||
FVector3 SunDirection = FVector3(0.0f, 0.0f, -1.0f);
|
||||
FVector3 SunColor = FVector3(0.0f, 0.0f, 0.0f);
|
||||
float SunIntensity = 1.0f;
|
||||
bool AmbientOcclusion = true;
|
||||
bool LightBounce = true;
|
||||
|
||||
TArray<LevelMeshPortal> Portals;
|
||||
|
||||
|
|
|
|||
|
|
@ -26,9 +26,9 @@ CVAR(Int, lm_max_updates, 128, CVAR_NOSAVE);
|
|||
CVAR(Float, lm_scale, 1.0, CVAR_NOSAVE);
|
||||
CVAR(Bool, lm_sunlight, true, CVAR_ARCHIVE);
|
||||
CVAR(Bool, lm_blur, true, CVAR_ARCHIVE);
|
||||
CVAR(Bool, lm_ao, false, CVAR_NOSAVE);
|
||||
CVAR(Bool, lm_ao, true, CVAR_ARCHIVE);
|
||||
CVAR(Bool, lm_softshadows, true, CVAR_ARCHIVE);
|
||||
CVAR(Bool, lm_bounce, false, CVAR_NOSAVE);
|
||||
CVAR(Bool, lm_bounce, true, CVAR_ARCHIVE);
|
||||
CVAR(Bool, lm_dynamic, true, CVAR_ARCHIVE);
|
||||
|
||||
VkLightmapper::VkLightmapper(VulkanRenderDevice* fb) : fb(fb)
|
||||
|
|
@ -592,14 +592,20 @@ void VkLightmapper::CreateShaders()
|
|||
|
||||
int VkLightmapper::GetRaytracePipelineIndex()
|
||||
{
|
||||
// When running as the baking tool we don't care about the CVAR or hardware preferences and only want to act on what the map specified.
|
||||
bool userSoftshadows = RunningAsTool || (lm_softshadows && useRayQuery);
|
||||
bool userAO = RunningAsTool || (lm_ao && useRayQuery);
|
||||
bool userSunlight = RunningAsTool || lm_sunlight;
|
||||
bool userBounce = RunningAsTool || lm_bounce;
|
||||
|
||||
int index = 0;
|
||||
if (lm_softshadows && useRayQuery)
|
||||
if (userSoftshadows)
|
||||
index |= 1;
|
||||
if (lm_ao && useRayQuery)
|
||||
if (mesh->AmbientOcclusion && userAO)
|
||||
index |= 2;
|
||||
if (lm_sunlight && mesh->SunColor != FVector3(0.0f, 0.0f, 0.0f))
|
||||
if (mesh->SunColor != FVector3(0.0f, 0.0f, 0.0f) && userSunlight)
|
||||
index |= 4;
|
||||
if (lm_bounce)
|
||||
if (mesh->LightBounce && userBounce)
|
||||
index |= 8;
|
||||
return index;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -475,8 +475,10 @@ public:
|
|||
TArray<int> LightmapTiles;
|
||||
FVector3 SunDirection;
|
||||
FVector3 SunColor;
|
||||
float SunIntensity;
|
||||
uint16_t LightmapSampleDistance;
|
||||
float SunIntensity = false;
|
||||
uint16_t LightmapSampleDistance = 0;
|
||||
bool LightBounce = false;
|
||||
bool AmbientOcclusion = false;
|
||||
|
||||
// Portal information.
|
||||
FDisplacementTable Displacements;
|
||||
|
|
|
|||
|
|
@ -2964,7 +2964,7 @@ void MapLoader::InitLevelMesh(MapData* map)
|
|||
}
|
||||
}
|
||||
|
||||
if (map->Size(ML_LIGHTMAP))
|
||||
if (map->Size(ML_LIGHTMAP) && !RunningAsTool)
|
||||
{
|
||||
// Arbitrary ZDRay limit. This will break lightmap lump loading if not enforced.
|
||||
Level->LightmapSampleDistance = std::clamp((int)Level->LightmapSampleDistance, LIGHTMAP_GLOBAL_SAMPLE_DISTANCE_MIN, LIGHTMAP_GLOBAL_SAMPLE_DISTANCE_MAX);
|
||||
|
|
@ -3025,7 +3025,7 @@ void MapLoader::InitLevelMesh(MapData* map)
|
|||
|
||||
bool MapLoader::LoadLightmap(MapData* map)
|
||||
{
|
||||
if (!Level->lightmaps || !map->Size(ML_LIGHTMAP) || ignorelightmaplump)
|
||||
if (RunningAsTool || !Level->lightmaps || !map->Size(ML_LIGHTMAP) || ignorelightmaplump)
|
||||
return false;
|
||||
|
||||
FileReader fr;
|
||||
|
|
@ -3205,6 +3205,8 @@ void MapLoader::LoadLevel(MapData *map, const char *lumpname, int position)
|
|||
Level->SunIntensity = gameinfo.defaultSunIntensity;
|
||||
Level->LightmapSampleDistance = gameinfo.defaultLightmapSampleDistance;
|
||||
Level->lightmaps = gameinfo.forceEnableLightmaps;
|
||||
Level->LightBounce = true;
|
||||
Level->AmbientOcclusion = true;
|
||||
|
||||
// note: most of this ordering is important
|
||||
ForceNodeBuild = gennodes;
|
||||
|
|
|
|||
|
|
@ -844,6 +844,14 @@ public:
|
|||
Level->LightmapSampleDistance = CheckInt(key);
|
||||
break;
|
||||
|
||||
case NAME_lm_bounce:
|
||||
Level->LightBounce = CheckBool(key);
|
||||
break;
|
||||
|
||||
case NAME_lm_ao:
|
||||
Level->AmbientOcclusion = CheckBool(key);
|
||||
break;
|
||||
|
||||
default:
|
||||
CHECK_N(Zd | Zdt)
|
||||
if (0 == strnicmp("user_", key.GetChars(), 5))
|
||||
|
|
|
|||
|
|
@ -870,6 +870,8 @@ xx(lm_sampledist_ceiling)
|
|||
xx(lm_dynamic)
|
||||
xx(lm_suncolor)
|
||||
xx(lm_sunintensity)
|
||||
xx(lm_bounce)
|
||||
xx(lm_ao)
|
||||
|
||||
// Light keywords
|
||||
xx(light_softshadowradius)
|
||||
|
|
|
|||
|
|
@ -211,6 +211,8 @@ DoomLevelMesh::DoomLevelMesh(FLevelLocals& doomMap)
|
|||
SunDirection = doomMap.SunDirection;
|
||||
SunIntensity = doomMap.SunIntensity;
|
||||
Lightmap.SampleDistance = doomMap.LightmapSampleDistance;
|
||||
LightBounce = doomMap.LightBounce;
|
||||
AmbientOcclusion = doomMap.AmbientOcclusion;
|
||||
|
||||
// HWWall and HWFlat still looks at r_viewpoint when doing calculations,
|
||||
// but we aren't rendering a specific viewpoint when this function gets called
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue