some lightmapper fixes

This commit is contained in:
Turanszki Janos
2018-12-05 22:58:04 +00:00
parent 721651be95
commit 1bf711f46c
6 changed files with 9 additions and 5 deletions
+1 -1
View File
@@ -20,7 +20,7 @@ float4 main(Input input) : SV_TARGET
Ray ray = CreateRay(input.pos3D + N * EPSILON, direction);
const uint bounces = 4;
for (uint i = 0; i < bounces; ++i)
for (uint i = 0; i < bounces && any(ray.energy); ++i)
{
RayHit hit = TraceScene(ray);
result += ray.energy * Shade(ray, hit, seed, uv);
+1 -1
View File
@@ -3058,6 +3058,7 @@ void GraphicsDevice_DX11::PresentEnd()
memset(prev_hs, 0, sizeof(prev_hs));
memset(prev_ds, 0, sizeof(prev_ds));
memset(prev_gs, 0, sizeof(prev_gs));
memset(prev_cs, 0, sizeof(prev_cs));
memset(prev_blendfactor, 0, sizeof(prev_blendfactor));
memset(prev_samplemask, 0, sizeof(prev_samplemask));
memset(prev_bs, 0, sizeof(prev_bs));
@@ -3581,7 +3582,6 @@ void GraphicsDevice_DX11::BindComputePSO(ComputePSO* pso, GRAPHICSTHREAD threadI
{
const ComputePSODesc& desc = pso != nullptr ? pso->GetDesc() : ComputePSODesc();
static ID3D11ComputeShader* prev_cs[GRAPHICSTHREAD_COUNT] = {};
ID3D11ComputeShader* cs = desc.cs == nullptr ? nullptr : (ID3D11ComputeShader*)desc.cs->resource;
if (cs != prev_cs[threadID])
{
+1
View File
@@ -32,6 +32,7 @@ namespace wiGraphicsTypes
ID3D11HullShader* prev_hs[GRAPHICSTHREAD_COUNT] = {};
ID3D11DomainShader* prev_ds[GRAPHICSTHREAD_COUNT] = {};
ID3D11GeometryShader* prev_gs[GRAPHICSTHREAD_COUNT] = {};
ID3D11ComputeShader* prev_cs[GRAPHICSTHREAD_COUNT] = {};
XMFLOAT4 prev_blendfactor[GRAPHICSTHREAD_COUNT] = {};
UINT prev_samplemask[GRAPHICSTHREAD_COUNT] = {};
ID3D11BlendState* prev_bs[GRAPHICSTHREAD_COUNT] = {};
+3 -2
View File
@@ -432,6 +432,7 @@ void ReloadShaders(const std::string& path)
CSFFT_512x512_Data_t::LoadShaders();
wiWidget::LoadShaders();
wiGPUSortLib::LoadShaders();
wiGPUBVH::LoadShaders();
}
Scene& GetScene()
@@ -7617,7 +7618,7 @@ void RenderObjectLightMap(ObjectComponent& object, bool updateBVHAndScene, GRAPH
cb.g_xColor = wiMath::GetHaltonSequence(object.lightmapIterationCount); // for jittering the rasterization (good for eliminating atlas border artifacts)
cb.g_xColor.x = (cb.g_xColor.x * 2 - 1) / vp.Width;
cb.g_xColor.y = (cb.g_xColor.y * 2 - 1) / vp.Height;
cb.g_xColor.z = (float)wiRandom::getRandom(1, 1000000); // random seed
cb.g_xColor.z = renderTime; // random seed
cb.g_xColor.w = 1.0f / (object.lightmapIterationCount + 1.0f); // accumulation factor (alpha)
device->UpdateBuffer(constantBuffers[CBTYPE_MISC], &cb, threadID);
device->DrawIndexedInstanced((int)mesh.indices.size(), 1, 0, 0, 0, threadID);
@@ -7659,7 +7660,7 @@ void ManageLightmapAtlas(GRAPHICSTHREAD threadID)
{
refresh = true;
// Create a GPU-side per object lighmap if there is none yet, so that copying into atlas can be done efficiently:
wiTextureHelper::CreateTexture(object.lightmap, object.lightmapTextureData.data(), object.lightmapWidth, object.lightmapHeight, RTFormat_hdr);
wiTextureHelper::CreateTexture(object.lightmap, object.lightmapTextureData.data(), object.lightmapWidth, object.lightmapHeight, FORMAT_R32G32B32A32_FLOAT);
}
if (object.lightmap != nullptr)
+2
View File
@@ -768,6 +768,8 @@ namespace wiSceneSystem
UINT data_stride = device->GetFormatStride(desc.Format);
UINT data_size = data_count * data_stride;
lightmapWidth = desc.Width;
lightmapHeight = desc.Height;
lightmapTextureData.clear();
lightmapTextureData.resize(data_size);
+1 -1
View File
@@ -9,7 +9,7 @@ namespace wiVersion
// minor features, major updates
const int minor = 24;
// minor bug fixes, alterations, refactors, updates
const int revision = 2;
const int revision = 3;
long GetVersion()