Commit 2318393
authored
UPBGE: Implement render extra attachment. (#774)
In the purpose of complex filters, data from the rendering other than the final
color or the depth could be needed in filter like space reflection or ambient
occlusion. The obvious one is the view normal, but any kind of data could be
interesting passing from the albedo or diffuse to a debug color for screen ray
cast.
To expose such feature to the user, first a list of attachments need to be
defined and secondly a way to output to these from simple material or node
material.
The attachments are to the number of 7, because the 8th is the first one
dedicated to the final color. The UI is defined in "Render" panel under
"Attachments" sub panel. A list of 7 items is exposed and the user can add an
attachment or remove one from any item, the items have four properties, the name
(only for debug), the type : either custom, normal or albedo, in case of custom
the properties size and hdr are exposed, they both select the size of data into
the attachment texture and it's precision type.
Each GPU material is now tracking 8 out links, the first one is the same as the
previous only out link and the other match the extra attachment. They are all
iterated in codegen_call_functions to generate the GLSL lines for
"gl_FragData[i] = ", a out link is registered using the function
GPU_material_output_link.
The attachment type "custom" is dedicated only for node materials where any kind
of data could be output to a special node. This node is named "Output
Attachment" and has only one input and a property for the index of the
attachment, this node is responsible of registering the output link.
The other attachment types "normal" and "abeldo" are detected in
GPU_shaderesult_set and generate link for the view normal and the material
diffuse (including vertex color and textures) multiplied by the object color.
From the game engine side, the attachment info are converted into LA_Launcher
and put inside RAS_ICanvas, this same class is now responsible of owning and
creating the offscreens, by doing this the canvas can also detect properly a
resize and recreate the offscreens. Other than that the function are equivalent,
GetOffScreen is now called from RAS_ICanvas instead of RAS_Rasterizer.
The attachments are readable form any filters defining the sampler uniform
"bgl_DataTextures[7]", this uniform is bind as well as other uniforms in
RAS_2DFilter::BindUniforms and the attachments textures in
BindTextures/UnbindTextures.
Because GPUOffScreen is not anymore used and is less flexible than hand
configuration of a frame buffer, their sources are restored to the blender ones.1 parent 9ec0894 commit 2318393
File tree
59 files changed
+986
-731
lines changed- release/scripts/startup
- bl_ui
- source
- blender
- blenkernel
- intern
- blenloader/intern
- editors
- render
- space_node
- space_view3d
- gpu
- intern
- shaders
- makesdna
- makesrna/intern
- nodes
- shader/nodes
- python/intern
- gameengine
- BlenderRoutines
- GamePlayer
- Ketsji
- Launcher
- Rasterizer
- VideoTexture
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
59 files changed
+986
-731
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| |||
462 | 462 | | |
463 | 463 | | |
464 | 464 | | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
465 | 501 | | |
466 | 502 | | |
467 | 503 | | |
| |||
1061 | 1097 | | |
1062 | 1098 | | |
1063 | 1099 | | |
| 1100 | + | |
1064 | 1101 | | |
1065 | 1102 | | |
1066 | 1103 | | |
1067 | 1104 | | |
| 1105 | + | |
1068 | 1106 | | |
1069 | 1107 | | |
1070 | 1108 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
165 | 165 | | |
166 | 166 | | |
167 | 167 | | |
| 168 | + | |
168 | 169 | | |
169 | 170 | | |
170 | 171 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
800 | 800 | | |
801 | 801 | | |
802 | 802 | | |
| 803 | + | |
803 | 804 | | |
804 | 805 | | |
805 | 806 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1879 | 1879 | | |
1880 | 1880 | | |
1881 | 1881 | | |
1882 | | - | |
| 1882 | + | |
1883 | 1883 | | |
1884 | 1884 | | |
1885 | 1885 | | |
| |||
3637 | 3637 | | |
3638 | 3638 | | |
3639 | 3639 | | |
| 3640 | + | |
3640 | 3641 | | |
3641 | 3642 | | |
3642 | 3643 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
518 | 518 | | |
519 | 519 | | |
520 | 520 | | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
521 | 527 | | |
522 | 528 | | |
523 | 529 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6305 | 6305 | | |
6306 | 6306 | | |
6307 | 6307 | | |
| 6308 | + | |
| 6309 | + | |
| 6310 | + | |
| 6311 | + | |
6308 | 6312 | | |
6309 | 6313 | | |
6310 | 6314 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2735 | 2735 | | |
2736 | 2736 | | |
2737 | 2737 | | |
| 2738 | + | |
| 2739 | + | |
| 2740 | + | |
| 2741 | + | |
| 2742 | + | |
| 2743 | + | |
2738 | 2744 | | |
2739 | 2745 | | |
2740 | 2746 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
62 | 65 | | |
63 | 66 | | |
64 | 67 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
634 | 634 | | |
635 | 635 | | |
636 | 636 | | |
637 | | - | |
| 637 | + | |
638 | 638 | | |
639 | 639 | | |
640 | 640 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
65 | 68 | | |
66 | 69 | | |
67 | 70 | | |
| |||
0 commit comments