Blender Git Loki

Git Commits -> Revision c7bcf80

September 8, 2020, 11:56 (GMT)
Use DrawManager for Image/UV Editor

This project moves the current UV/Image editor drawing to the draw manager. Why would we do this:

Current implementation would draw each texel per time. Multiple texels could be drawn per pixel what would overwrite the previous result. You can notice this when working with large textures. Repeat image drawing made this visible by drawing for a small period of time and stop drawing the rest. Now the rendering is fast and all repeated images are drawn.

**Alpha drawing**:
Current implementation would draw directly in display space. Giving incorrect results when displaying alpha transparent images.


This addresses {T52680}, {T74709}, {T79518}

The image editor now can show emission only colors.

**Current Limitations**

Using images that are larger than supported by your GPU are resized (eg larger than 16000x16000 are resized to 8k). This leaves some blurring artifacts. It is a low priority to add support back of displaying individual pixels of huge images. There is a design task {T80113} with more detail.

**Implementation overview**
Introduced an Image Engine in the draw module. this engine is responsible for drawing the texture in the main area of the UV/Image editor. The overlay engine has a edit_uv overlay which is responsible to draw the UV's, shadows and overlays specifically for the UV Image editor. The background + checker pattern is drawn by the overlay_background.

The patch will allow us to share overlays between the 3d viewport and UV/Image editor more easily. In most cases we just need to switch the `pos` with the `u` attribute in the vertex shader.

The project can be activated in the user preferences as experimental features. When support of huge textures is implemented we can switch over.

**Future developments**
* Support huge texture sizes. {T80113}
* Share overlay shaders between 3d view and image editor, makes it possible to render certain overlays in both editors.
* Connect smooth wire to `USER_GPU_FLAG_OVERLAY_SMOOTH_WIRE`.
* Move overlay options to a pop-over and other UI improvements.
* Replace the unavailability shader with the overlay grid.

Maniphest Tasks: T67530

Differential Revision:

Commit Details:

Full Hash: c7bcf80e46cb8dd11a3a4f56b641211ffb2b87ee
Parent Commit: ab6f59f
Lines Changed: +2273, -149

17 Added Paths:

/source/blender/draw/engines/image/image_engine.c (+304, -0) (View)
/source/blender/draw/engines/image/image_engine.h (+25, -0) (View)
/source/blender/draw/engines/image/image_private.h (+69, -0) (View)
/source/blender/draw/engines/image/image_shader.c (+77, -0) (View)
/source/blender/draw/engines/image/shaders/engine_image_frag.glsl (+91, -0) (View)
/source/blender/draw/engines/image/shaders/engine_image_vert.glsl (+29, -0) (View)
/source/blender/draw/engines/overlay/overlay_edit_uv.c (+391, -0) (View)
/source/blender/draw/engines/overlay/shaders/common_overlay_lib.glsl (+5, -0) (View)
/source/blender/draw/engines/overlay/shaders/edit_uv_edges_frag.glsl (+77, -0) (View)
/source/blender/draw/engines/overlay/shaders/edit_uv_edges_geom.glsl (+60, -0) (View)
/source/blender/draw/engines/overlay/shaders/edit_uv_edges_vert.glsl (+27, -0) (View)
/source/blender/draw/engines/overlay/shaders/edit_uv_faces_vert.glsl (+22, -0) (View)
/source/blender/draw/engines/overlay/shaders/edit_uv_face_dots_vert.glsl (+18, -0) (View)
/source/blender/draw/engines/overlay/shaders/edit_uv_stretching_vert.glsl (+98, -0) (View)
/source/blender/draw/engines/overlay/shaders/edit_uv_tiled_image_borders_vert.glsl (+12, -0) (View)
/source/blender/draw/engines/overlay/shaders/edit_uv_verts_frag.glsl (+33, -0) (View)
/source/blender/draw/engines/overlay/shaders/edit_uv_verts_vert.glsl (+41, -0) (View)

31 Modified Paths:

/release/datafiles/userdef/userdef_default_theme.c (+1, -0) (Diff)
/release/scripts/startup/bl_ui/ (+1, -0) (Diff)
/source/blender/blenkernel/intern/image_gpu.c (+11, -1) (Diff)
/source/blender/blenloader/intern/versioning_userdef.c (+2, -0) (Diff)
/source/blender/compositor/operations/COM_ViewerOperation.cpp (+1, -1) (Diff)
/source/blender/draw/CMakeLists.txt (+16, -0) (Diff)
/source/blender/draw/DRW_engine.h (+4, -0) (Diff)
/source/blender/draw/engines/overlay/overlay_background.c (+5, -2) (Diff)
/source/blender/draw/engines/overlay/overlay_engine.c (+44, -0) (Diff)
/source/blender/draw/engines/overlay/overlay_grid.c (+43, -10) (Diff)
/source/blender/draw/engines/overlay/overlay_private.h (+60, -0) (Diff)
/source/blender/draw/engines/overlay/overlay_shader.c (+150, -0) (Diff)
/source/blender/draw/engines/overlay/shaders/background_frag.glsl (+6, -1) (Diff)
/source/blender/draw/engines/overlay/shaders/grid_vert.glsl (+5, -2) (Diff)
/source/blender/draw/intern/draw_common.c (+4, -1) (Diff)
/source/blender/draw/intern/draw_common.h (+3, -1) (Diff)
/source/blender/draw/intern/draw_manager.c (+283, -31) (Diff)
/source/blender/draw/intern/draw_manager_text.c (+80, -50) (Diff)
/source/blender/draw/intern/draw_view.c (+62, -0) (Diff)
/source/blender/draw/intern/draw_view.h (+1, -0) (Diff)
/source/blender/draw/intern/DRW_render.h (+5, -3) (Diff)
/source/blender/draw/intern/shaders/common_globals_lib.glsl (+2, -0) (Diff)
/source/blender/draw/tests/ (+20, -0) (Diff)
/source/blender/editors/render/render_internal.c (+1, -0) (Diff)
/source/blender/editors/space_image/image_draw.c (+22, -9) (Diff)
/source/blender/editors/space_image/image_intern.h (+1, -0) (Diff)
/source/blender/editors/space_image/space_image.c (+43, -34) (Diff)
/source/blender/makesdna/DNA_image_defaults.h (+2, -0) (Diff)
/source/blender/makesdna/DNA_image_types.h (+4, -2) (Diff)
/source/blender/makesdna/DNA_userdef_types.h (+2, -1) (Diff)
/source/blender/makesrna/intern/rna_userdef.c (+10, -0) (Diff)
Tehnyt: Miika HämäläinenViimeksi päivitetty: 07.11.2014 14:18MiikaH:n Sivut a.k.a. MiikaHweb | 2003-2021