3D Text's transparent areas will occlude objects drawn behind it afterwards. #29804
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
4 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#29804
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Category: Rendering
%%%So the issue is following in the file attached:
Texts write depth and have depth test on. This means texts drawn behind another text will be occluded by the transparent part and at certain angles letters in same text to have z-fighting issues where they overlap (should occur between T and e).
One solution would be to disable blending when drawing 3d text in bge and enable opengl's alpha test to only allow alpha == 1.0 or alpha > limit.
Another way is to draw texts with other transparents ordered back to front; can be done without depth write so no z-fighting between letters in same text and can use blending on.
Changed status to: 'Open'
%%%Meh, I was probably overthinking this by a mile. True, after alphatest the remaining transparent areas will suffer from blending against wrong colors but in the end it is just the edge pixels and most visible when the text is being magnified. This can be minimized by using a higher alpha to test against which will only leave the texture pixels that influence the resulting color more.
Index: source/gameengine/BlenderRoutines/KX_BlenderGL.cpp
+++ source/gameengine/BlenderRoutines/KX_BlenderGL.cpp (working copy)
@@ -147,8 +147,15 @@
/* Use alphatest to prune transparent areas */
glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_GREATER, 0.5f);
BLF_draw(fontid, (char *)text, strlen(text));
glDisable(GL_ALPHA_TEST);
BLF_disable(fontid, BLF_MATRIX|BLF_ASPECT);
}
%%%
%%%Hi Juha,
GL_ALPHA_TEST is explicitly disabled in the DisableText routine.
This was added in revision 15867. Log here for convenience:
Game Engine: alpha blending and sorting
Alpha blending + sorting was revised, to fix bugs and get it to work more predictable.
The regular alpha routine in BGE is handled inside the GPU_set_material_alpha_blend%%%
%%%That said, it seems safe to set whatever opengl flag we need.
Alpha rendering always make sure the proper flags are set (see gpu_set_alpha_blend in ^/source/blender/gpu/intern/gpu_draw.c).%%%
Hello,
Yep, KX_BlenderGL.cpp file was remove in the cleanup. I tracked down the commit (point by Dalai) and found the DisableForText function.
So far using GL_ALPHA_TEST and GL_GREATER works fine, but should not this check if GL_ALPHA_TEST is not already enable ?
In the example file, GL_ALPHA_TEST is disable when the text is render, but if that is not the case, the GL_ALPHA_TEST will be disable when the RenderText3D call return.
I'm not sure how much will impact this in the GE (add a glIsEnable(GL_ALPHA_TEST at the start).
The patch looks like:
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp
index 1227fe8..caf5186 100644
- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp
+++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp
@@ -1401,10 +1401,15 @@ void RAS_OpenGLRasterizer::applyTransform(double* oglmatrix,int objectdrawmode )
static void DisableForText()
{
@@ -1427,6 +1432,9 @@ static void DisableForText()
}
void RAS_OpenGLRasterizer::RenderBox2D(int xco,
@dfelinto any comment ?
Changed status from 'Open' to: 'Archived'