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
21942194 void GeometryCache::useGridPipeline(gpu::Batch& batch, GridBuffer gridBuffer, bool transparent, bool forward) {
21952195 if (_gridPipelines.empty()) {
21962196 using namespace shader::render_utils::program;
2197− const float DEPTH_BIAS = 0.001f;
21982197
21992198 static const std::vector<std::tuple<bool, bool, uint32_t>> keys = {
22002199 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
22122211 gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA,
22132212 gpu::State::FACTOR_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::ONE);
22142213 state->setCullMode(gpu::State::CULL_NONE);
2215− state->setDepthBias(DEPTH_BIAS);
2214+ state->setDepthBias(-1.0f);
2215+ state->setDepthBiasSlopeScale(-1.0f);
22162216
22172217 _gridPipelines[{std::get<0>(key), std::get<1>(key)}] = gpu::Pipeline::create(gpu::Shader::createProgram(std::get<2>(key)), state);
22182218 }
@@ -2357,8 +2357,8 @@ gpu::PipelinePointer GeometryCache::getSimplePipeline(bool textured, bool transp · 138 unmodified lines
23572357 }
23582358 state->setDepthTest(true, !config.isTransparent(), ComparisonFunction::LESS_EQUAL);
23592359 if (config.hasDepthBias()) {
2360− state->setDepthBias(1.0f);
2361− state->setDepthBiasSlopeScale(1.0f);
2360+ state->setDepthBias(-1.0f);
2361+ state->setDepthBiasSlopeScale(-1.0f);
23622362 }
23632363 state->setBlendFunction(config.isTransparent(),
23642364 gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA,