History

Bias depth towards camera instead of away

Ada committed 7 months ago

Commit 285eb291 parent 528c9d12 files · +6 −6Browse files

Showing the changes to libraries/render-utils/src/GeometryCache.cpp (1 of 2 files). Show all

Unified · Split

libraries/render-utils/src/GeometryCache.cpp+4−4
@@ -2194,7 +2194,6 @@ void GeometryCache::useSimpleDrawPipeline(gpu::Batch& batch, bool noBlend) { · 2193 unmodified lines
2194void GeometryCache::useGridPipeline(gpu::Batch& batch, GridBuffer gridBuffer, bool transparent, bool forward) {2194void GeometryCache::useGridPipeline(gpu::Batch& batch, GridBuffer gridBuffer, bool transparent, bool forward) {
2195 if (_gridPipelines.empty()) {2195 if (_gridPipelines.empty()) {
2196 using namespace shader::render_utils::program;2196 using namespace shader::render_utils::program;
2197 const float DEPTH_BIAS = 0.001f;
2198 2197
2199 static const std::vector<std::tuple<bool, bool, uint32_t>> keys = {2198 static const std::vector<std::tuple<bool, bool, uint32_t>> keys = {
2200 std::make_tuple(false, false, grid), std::make_tuple(false, true, grid_forward), std::make_tuple(true, false, grid_translucent), std::make_tuple(true, true, grid_translucent_forward)2199 std::make_tuple(false, false, grid), std::make_tuple(false, true, grid_forward), std::make_tuple(true, false, grid_translucent), std::make_tuple(true, true, grid_translucent_forward)
@@ -2212,7 +2211,8 @@ void GeometryCache::useGridPipeline(gpu::Batch& batch, GridBuffer gridBuffer, bo · 11 unmodified lines
2212 gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA,2211 gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA,
2213 gpu::State::FACTOR_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::ONE);2212 gpu::State::FACTOR_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::ONE);
2214 state->setCullMode(gpu::State::CULL_NONE);2213 state->setCullMode(gpu::State::CULL_NONE);
2215 state->setDepthBias(DEPTH_BIAS);2214 state->setDepthBias(-1.0f);
2215 state->setDepthBiasSlopeScale(-1.0f);
2216 2216
2217 _gridPipelines[{std::get<0>(key), std::get<1>(key)}] = gpu::Pipeline::create(gpu::Shader::createProgram(std::get<2>(key)), state);2217 _gridPipelines[{std::get<0>(key), std::get<1>(key)}] = gpu::Pipeline::create(gpu::Shader::createProgram(std::get<2>(key)), state);
2218 }2218 }
@@ -2357,8 +2357,8 @@ gpu::PipelinePointer GeometryCache::getSimplePipeline(bool textured, bool transp · 138 unmodified lines
2357 }2357 }
2358 state->setDepthTest(true, !config.isTransparent(), ComparisonFunction::LESS_EQUAL);2358 state->setDepthTest(true, !config.isTransparent(), ComparisonFunction::LESS_EQUAL);
2359 if (config.hasDepthBias()) {2359 if (config.hasDepthBias()) {
2360 state->setDepthBias(1.0f);2360 state->setDepthBias(-1.0f);
2361 state->setDepthBiasSlopeScale(1.0f);2361 state->setDepthBiasSlopeScale(-1.0f);
2362 }2362 }
2363 state->setBlendFunction(config.isTransparent(),2363 state->setBlendFunction(config.isTransparent(),
2364 gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA,2364 gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA,