Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Stockner <lukas.stockner@freenet.de>2018-05-24 04:50:16 +0300
committerLukas Stockner <lukas.stockner@freenet.de>2018-05-24 17:43:47 +0300
commit5505ba8d4753ee6b3c0101ba3e4abf337546a1b0 (patch)
tree1c0fdbed36127f670e8aa0d49a53f72988cc34c5 /release
parente8c8ff4f86c276e4dca884ff1a411fcbbf003fed (diff)
Cycles/Eevee: Implement disk and ellipse shapes for area lamps
The implementation is pretty straightforward. In Cycles, sampling the shapes is currently done w.r.t. area instead of solid angle. There is a paper on solid angle sampling for disks [1], but the described algorithm is based on simply sampling the enclosing square and rejecting samples outside of the disk, which is not exactly great for Cycles' RNG (we'd need to setup a LCG for the repeated sampling) and for GPU divergence. Even worse, the algorithm is only defined for disks. For ellipses, the basic idea still works, but a way to analytically calculate the solid angle is required. This is technically possible [2], but the calculation is extremely complex and still requires a lookup table for the Heuman Lambda function. Therefore, I've decided to not implement that for now, we could still look into it later on. In Eevee, the code uses the existing ltc_evaluate_disk to implement the lighting calculations. [1]: "Solid Angle Sampling of Disk and Cylinder Lights" [2]: "Analytical solution for the solid angle subtended at any point by an ellipse via a point source radiation vector potential" Reviewers: sergey, brecht, fclem Differential Revision: https://developer.blender.org/D3171
Diffstat (limited to 'release')
-rw-r--r--release/scripts/startup/bl_ui/properties_data_lamp.py8
-rw-r--r--release/scripts/startup/bl_ui/space_view3d.py2
2 files changed, 5 insertions, 5 deletions
diff --git a/release/scripts/startup/bl_ui/properties_data_lamp.py b/release/scripts/startup/bl_ui/properties_data_lamp.py
index 1d7e5807b34..2e3dae25197 100644
--- a/release/scripts/startup/bl_ui/properties_data_lamp.py
+++ b/release/scripts/startup/bl_ui/properties_data_lamp.py
@@ -136,9 +136,9 @@ class DATA_PT_EEVEE_lamp(DataButtonsPanel, Panel):
elif lamp.type == 'AREA':
sub = sub.column(align=True)
sub.prop(lamp, "shape", text="")
- if lamp.shape == 'SQUARE':
+ if lamp.shape in {'SQUARE', 'DISK'}:
sub.prop(lamp, "size")
- elif lamp.shape == 'RECTANGLE':
+ elif lamp.shape in {'RECTANGLE', 'ELLIPSE'}:
sub.prop(lamp, "size", text="Size X")
sub.prop(lamp, "size_y", text="Size Y")
@@ -228,9 +228,9 @@ class DATA_PT_area(DataButtonsPanel, Panel):
col.row().prop(lamp, "shape", expand=True)
sub = col.row(align=True)
- if lamp.shape == 'SQUARE':
+ if lamp.shape in {'SQUARE', 'DISK'}:
sub.prop(lamp, "size")
- elif lamp.shape == 'RECTANGLE':
+ elif lamp.shape in {'RECTANGLE', 'ELLIPSE'}:
sub.prop(lamp, "size", text="Size X")
sub.prop(lamp, "size_y", text="Size Y")
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index 1edee555eb6..2ebea02ed21 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -1591,7 +1591,7 @@ class VIEW3D_MT_object_specials(Menu):
props.data_path_item = "data.size"
props.header_text = "Lamp Size X: %.3f"
- if lamp.shape == 'RECTANGLE':
+ if lamp.shape in {'RECTANGLE', 'ELLIPSE'}:
props = layout.operator("wm.context_modal_mouse", text="Size Y")
props.data_path_iter = "selected_editable_objects"
props.data_path_item = "data.size_y"