2009-05-08 18:17:57 +00:00
|
|
|
|
|
|
|
import bpy
|
|
|
|
|
|
|
|
class DataButtonsPanel(bpy.types.Panel):
|
2009-08-22 08:48:01 +00:00
|
|
|
__space_type__ = 'PROPERTIES'
|
|
|
|
__region_type__ = 'WINDOW'
|
2009-05-08 18:17:57 +00:00
|
|
|
__context__ = "data"
|
|
|
|
|
|
|
|
def poll(self, context):
|
2009-09-27 11:00:35 +00:00
|
|
|
return context.lamp
|
2009-06-07 11:42:13 +00:00
|
|
|
|
|
|
|
class DATA_PT_preview(DataButtonsPanel):
|
|
|
|
__label__ = "Preview"
|
|
|
|
|
|
|
|
def draw(self, context):
|
2009-09-01 00:33:39 +00:00
|
|
|
self.layout.template_preview(context.lamp)
|
2009-05-08 18:17:57 +00:00
|
|
|
|
2009-07-09 09:42:34 +00:00
|
|
|
class DATA_PT_context_lamp(DataButtonsPanel):
|
2009-07-26 03:54:17 +00:00
|
|
|
__show_header__ = False
|
2009-06-13 21:22:21 +00:00
|
|
|
|
2009-05-08 18:17:57 +00:00
|
|
|
def draw(self, context):
|
2009-06-13 21:22:21 +00:00
|
|
|
layout = self.layout
|
|
|
|
|
2009-06-07 13:36:12 +00:00
|
|
|
ob = context.object
|
2009-06-03 00:17:35 +00:00
|
|
|
lamp = context.lamp
|
2009-06-07 13:36:12 +00:00
|
|
|
space = context.space_data
|
2009-05-08 18:17:57 +00:00
|
|
|
|
2009-06-07 13:36:12 +00:00
|
|
|
split = layout.split(percentage=0.65)
|
|
|
|
|
|
|
|
if ob:
|
2009-06-23 00:19:10 +00:00
|
|
|
split.template_ID(ob, "data")
|
2009-06-07 13:36:12 +00:00
|
|
|
split.itemS()
|
|
|
|
elif lamp:
|
2009-06-23 00:19:10 +00:00
|
|
|
split.template_ID(space, "pin_id")
|
2009-06-07 13:36:12 +00:00
|
|
|
split.itemS()
|
|
|
|
|
2009-07-09 09:07:25 +00:00
|
|
|
class DATA_PT_lamp(DataButtonsPanel):
|
|
|
|
__label__ = "Lamp"
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
|
|
|
|
lamp = context.lamp
|
2009-07-20 16:39:16 +00:00
|
|
|
|
2009-07-21 00:55:20 +00:00
|
|
|
layout.itemR(lamp, "type", expand=True)
|
2009-05-08 18:17:57 +00:00
|
|
|
|
UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
This means the layout engine now works at button level, and makes it
easier to write templates. Otherwise you had to store all info and
create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
These can contain regular buttons, and can be put in a Free layout,
which means you can specify manual coordinates, but still get nested
correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
in the last added layout specifier, i.e. one level up in the layout
hierarchy. This doesn't work well in always, so now when creating things
like rows or columns it always returns a layout which you have to add
the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
required width/height of all nested layouts, and then in the second
pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
buttons).
* Moved some more space variables into Style.
2009-05-15 11:19:59 +00:00
|
|
|
split = layout.split()
|
2009-05-08 18:17:57 +00:00
|
|
|
|
2009-07-27 20:39:10 +00:00
|
|
|
col = split.column()
|
2009-07-29 13:33:14 +00:00
|
|
|
sub = col.column()
|
2009-07-28 11:04:08 +00:00
|
|
|
sub.itemR(lamp, "color", text="")
|
|
|
|
sub.itemR(lamp, "energy")
|
2009-07-30 10:11:19 +00:00
|
|
|
|
UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
This means the layout engine now works at button level, and makes it
easier to write templates. Otherwise you had to store all info and
create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
These can contain regular buttons, and can be put in a Free layout,
which means you can specify manual coordinates, but still get nested
correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
in the last added layout specifier, i.e. one level up in the layout
hierarchy. This doesn't work well in always, so now when creating things
like rows or columns it always returns a layout which you have to add
the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
required width/height of all nested layouts, and then in the second
pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
buttons).
* Moved some more space variables into Style.
2009-05-15 11:19:59 +00:00
|
|
|
if lamp.type in ('POINT', 'SPOT'):
|
2009-07-30 13:56:39 +00:00
|
|
|
sub.itemL(text="Falloff:")
|
|
|
|
sub.itemR(lamp, "falloff_type", text="")
|
2009-07-27 20:39:10 +00:00
|
|
|
sub.itemR(lamp, "distance")
|
2009-07-30 10:11:19 +00:00
|
|
|
|
2009-07-27 20:39:10 +00:00
|
|
|
if lamp.falloff_type == 'LINEAR_QUADRATIC_WEIGHTED':
|
2009-07-29 14:17:15 +00:00
|
|
|
col.itemL(text="Attenuation Factors:")
|
2009-07-27 20:39:10 +00:00
|
|
|
sub = col.column(align=True)
|
2009-07-21 01:52:05 +00:00
|
|
|
sub.itemR(lamp, "linear_attenuation", slider=True, text="Linear")
|
|
|
|
sub.itemR(lamp, "quadratic_attenuation", slider=True, text="Quadratic")
|
2009-07-29 14:17:15 +00:00
|
|
|
|
|
|
|
col.itemR(lamp, "sphere")
|
2009-05-08 18:17:57 +00:00
|
|
|
|
UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
This means the layout engine now works at button level, and makes it
easier to write templates. Otherwise you had to store all info and
create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
These can contain regular buttons, and can be put in a Free layout,
which means you can specify manual coordinates, but still get nested
correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
in the last added layout specifier, i.e. one level up in the layout
hierarchy. This doesn't work well in always, so now when creating things
like rows or columns it always returns a layout which you have to add
the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
required width/height of all nested layouts, and then in the second
pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
buttons).
* Moved some more space variables into Style.
2009-05-15 11:19:59 +00:00
|
|
|
if lamp.type == 'AREA':
|
2009-07-29 14:17:15 +00:00
|
|
|
col.itemR(lamp, "distance")
|
|
|
|
col.itemR(lamp, "gamma")
|
2009-09-01 00:33:39 +00:00
|
|
|
|
2009-07-29 14:17:15 +00:00
|
|
|
col = split.column()
|
|
|
|
col.itemR(lamp, "negative")
|
|
|
|
col.itemR(lamp, "layer", text="This Layer Only")
|
|
|
|
col.itemR(lamp, "specular")
|
|
|
|
col.itemR(lamp, "diffuse")
|
2009-07-27 20:39:10 +00:00
|
|
|
|
2009-07-21 01:52:05 +00:00
|
|
|
class DATA_PT_sunsky(DataButtonsPanel):
|
2009-09-14 13:31:58 +00:00
|
|
|
__label__ = "Sky & Atmosphere"
|
2009-05-08 18:17:57 +00:00
|
|
|
|
|
|
|
def poll(self, context):
|
2009-06-03 00:17:35 +00:00
|
|
|
lamp = context.lamp
|
|
|
|
return (lamp and lamp.type == 'SUN')
|
2009-05-08 18:17:57 +00:00
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
2009-07-27 20:39:10 +00:00
|
|
|
|
2009-06-13 21:22:21 +00:00
|
|
|
lamp = context.lamp.sky
|
2009-05-08 18:17:57 +00:00
|
|
|
|
2009-09-14 13:31:58 +00:00
|
|
|
layout.itemR(lamp, "sky")
|
2009-09-27 11:00:35 +00:00
|
|
|
|
2009-07-21 01:52:05 +00:00
|
|
|
row = layout.row()
|
|
|
|
row.active = lamp.sky or lamp.atmosphere
|
|
|
|
row.itemR(lamp, "atmosphere_turbidity", text="Turbidity")
|
|
|
|
|
2009-05-29 09:53:46 +00:00
|
|
|
split = layout.split()
|
2009-07-21 01:52:05 +00:00
|
|
|
|
2009-07-20 16:39:16 +00:00
|
|
|
col = split.column()
|
2009-07-21 01:52:05 +00:00
|
|
|
col.active = lamp.sky
|
2009-09-14 13:31:58 +00:00
|
|
|
col.itemL(text="Blending:")
|
|
|
|
sub = col.column()
|
2009-07-27 20:39:10 +00:00
|
|
|
sub.itemR(lamp, "sky_blend_type", text="")
|
|
|
|
sub.itemR(lamp, "sky_blend", text="Factor")
|
2009-07-20 16:39:16 +00:00
|
|
|
|
2009-07-21 01:52:05 +00:00
|
|
|
col.itemL(text="Color Space:")
|
2009-09-14 13:31:58 +00:00
|
|
|
sub = col.column()
|
|
|
|
sub.row().itemR(lamp, "sky_color_space", expand=True)
|
2009-07-27 20:39:10 +00:00
|
|
|
sub.itemR(lamp, "sky_exposure", text="Exposure")
|
2009-07-21 01:52:05 +00:00
|
|
|
|
2009-05-29 09:53:46 +00:00
|
|
|
col = split.column()
|
2009-07-21 01:52:05 +00:00
|
|
|
col.active = lamp.sky
|
2009-07-20 16:39:16 +00:00
|
|
|
col.itemL(text="Horizon:")
|
2009-09-14 13:31:58 +00:00
|
|
|
sub = col.column()
|
2009-07-27 20:39:10 +00:00
|
|
|
sub.itemR(lamp, "horizon_brightness", text="Brightness")
|
|
|
|
sub.itemR(lamp, "spread", text="Spread")
|
2009-07-21 01:52:05 +00:00
|
|
|
|
2009-07-20 16:39:16 +00:00
|
|
|
col.itemL(text="Sun:")
|
2009-09-14 13:31:58 +00:00
|
|
|
sub = col.column()
|
2009-07-27 20:39:10 +00:00
|
|
|
sub.itemR(lamp, "sun_brightness", text="Brightness")
|
|
|
|
sub.itemR(lamp, "sun_size", text="Size")
|
|
|
|
sub.itemR(lamp, "backscattered_light", slider=True,text="Back Light")
|
2009-07-21 01:52:05 +00:00
|
|
|
|
2009-07-27 20:39:10 +00:00
|
|
|
layout.itemS()
|
2009-07-20 16:39:16 +00:00
|
|
|
|
2009-09-14 13:31:58 +00:00
|
|
|
layout.itemR(lamp, "atmosphere")
|
|
|
|
|
2009-07-20 16:39:16 +00:00
|
|
|
split = layout.split()
|
2009-07-21 01:52:05 +00:00
|
|
|
|
|
|
|
col = split.column()
|
|
|
|
col.active = lamp.atmosphere
|
2009-09-14 13:31:58 +00:00
|
|
|
col.itemL(text="Intensity:")
|
|
|
|
col.itemR(lamp, "sun_intensity", text="Sun")
|
2009-07-21 01:52:05 +00:00
|
|
|
col.itemR(lamp, "atmosphere_distance_factor", text="Distance")
|
|
|
|
|
|
|
|
col = split.column()
|
|
|
|
col.active = lamp.atmosphere
|
|
|
|
col.itemL(text="Scattering:")
|
|
|
|
sub = col.column(align=True)
|
|
|
|
sub.itemR(lamp, "atmosphere_inscattering", slider=True, text="Inscattering")
|
|
|
|
sub.itemR(lamp, "atmosphere_extinction", slider=True ,text="Extinction")
|
|
|
|
|
2009-05-08 21:52:57 +00:00
|
|
|
class DATA_PT_shadow(DataButtonsPanel):
|
|
|
|
__label__ = "Shadow"
|
|
|
|
|
|
|
|
def poll(self, context):
|
2009-06-03 00:17:35 +00:00
|
|
|
lamp = context.lamp
|
|
|
|
return (lamp and lamp.type in ('POINT','SUN', 'SPOT', 'AREA'))
|
2009-05-08 21:52:57 +00:00
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
2009-07-27 20:39:10 +00:00
|
|
|
|
2009-06-13 21:22:21 +00:00
|
|
|
lamp = context.lamp
|
2009-07-21 00:55:20 +00:00
|
|
|
|
|
|
|
layout.itemR(lamp, "shadow_method", expand=True)
|
2009-07-20 20:34:14 +00:00
|
|
|
|
|
|
|
if lamp.shadow_method != 'NOSHADOW':
|
UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
This means the layout engine now works at button level, and makes it
easier to write templates. Otherwise you had to store all info and
create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
These can contain regular buttons, and can be put in a Free layout,
which means you can specify manual coordinates, but still get nested
correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
in the last added layout specifier, i.e. one level up in the layout
hierarchy. This doesn't work well in always, so now when creating things
like rows or columns it always returns a layout which you have to add
the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
required width/height of all nested layouts, and then in the second
pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
buttons).
* Moved some more space variables into Style.
2009-05-15 11:19:59 +00:00
|
|
|
split = layout.split()
|
2009-05-10 12:12:05 +00:00
|
|
|
|
2009-07-21 01:52:05 +00:00
|
|
|
col = split.column()
|
2009-07-23 14:35:20 +00:00
|
|
|
col.itemR(lamp, "shadow_color", text="")
|
2009-05-10 12:12:05 +00:00
|
|
|
|
2009-07-27 20:39:10 +00:00
|
|
|
col = split.column()
|
|
|
|
col.itemR(lamp, "shadow_layer", text="This Layer Only")
|
|
|
|
col.itemR(lamp, "only_shadow")
|
2009-05-10 12:12:05 +00:00
|
|
|
|
UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
This means the layout engine now works at button level, and makes it
easier to write templates. Otherwise you had to store all info and
create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
These can contain regular buttons, and can be put in a Free layout,
which means you can specify manual coordinates, but still get nested
correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
in the last added layout specifier, i.e. one level up in the layout
hierarchy. This doesn't work well in always, so now when creating things
like rows or columns it always returns a layout which you have to add
the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
required width/height of all nested layouts, and then in the second
pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
buttons).
* Moved some more space variables into Style.
2009-05-15 11:19:59 +00:00
|
|
|
if lamp.shadow_method == 'RAY_SHADOW':
|
2009-07-21 00:55:20 +00:00
|
|
|
col = layout.column()
|
|
|
|
col.itemL(text="Sampling:")
|
|
|
|
col.row().itemR(lamp, "shadow_ray_sampling_method", expand=True)
|
2009-05-08 21:52:57 +00:00
|
|
|
|
2009-05-15 16:24:08 +00:00
|
|
|
if lamp.type in ('POINT', 'SUN', 'SPOT'):
|
2009-07-21 01:52:05 +00:00
|
|
|
split = layout.split()
|
2009-07-27 20:39:10 +00:00
|
|
|
|
2009-07-30 13:56:39 +00:00
|
|
|
col = split.column()
|
2009-07-21 01:52:05 +00:00
|
|
|
col.itemR(lamp, "shadow_soft_size", text="Soft Size")
|
2009-07-27 20:39:10 +00:00
|
|
|
|
2009-07-21 01:52:05 +00:00
|
|
|
col.itemR(lamp, "shadow_ray_samples", text="Samples")
|
UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
This means the layout engine now works at button level, and makes it
easier to write templates. Otherwise you had to store all info and
create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
These can contain regular buttons, and can be put in a Free layout,
which means you can specify manual coordinates, but still get nested
correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
in the last added layout specifier, i.e. one level up in the layout
hierarchy. This doesn't work well in always, so now when creating things
like rows or columns it always returns a layout which you have to add
the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
required width/height of all nested layouts, and then in the second
pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
buttons).
* Moved some more space variables into Style.
2009-05-15 11:19:59 +00:00
|
|
|
if lamp.shadow_ray_sampling_method == 'ADAPTIVE_QMC':
|
2009-07-21 01:52:05 +00:00
|
|
|
col.itemR(lamp, "shadow_adaptive_threshold", text="Threshold")
|
2009-07-30 13:56:39 +00:00
|
|
|
col = split.column()
|
2009-05-08 21:52:57 +00:00
|
|
|
|
2009-07-28 01:06:56 +00:00
|
|
|
elif lamp.type == 'AREA':
|
2009-07-21 01:52:05 +00:00
|
|
|
split = layout.split()
|
2009-07-27 20:39:10 +00:00
|
|
|
|
2009-07-28 11:04:08 +00:00
|
|
|
col = split.column()
|
|
|
|
sub = split.column(align=True)
|
2009-07-28 01:06:56 +00:00
|
|
|
if lamp.shape == 'SQUARE':
|
2009-07-30 13:56:39 +00:00
|
|
|
col.itemR(lamp, "shadow_ray_samples_x", text="Samples")
|
2009-07-28 01:06:56 +00:00
|
|
|
elif lamp.shape == 'RECTANGLE':
|
2009-07-30 13:56:39 +00:00
|
|
|
col.itemR(lamp, "shadow_ray_samples_x", text="Samples X")
|
|
|
|
col.itemR(lamp, "shadow_ray_samples_y", text="Samples Y")
|
2009-07-28 01:06:56 +00:00
|
|
|
|
2009-07-27 20:39:10 +00:00
|
|
|
if lamp.shadow_ray_sampling_method == 'ADAPTIVE_QMC':
|
2009-07-30 13:56:39 +00:00
|
|
|
col.itemR(lamp, "shadow_adaptive_threshold", text="Threshold")
|
2009-07-28 11:04:08 +00:00
|
|
|
|
2009-07-28 01:06:56 +00:00
|
|
|
elif lamp.shadow_ray_sampling_method == 'CONSTANT_JITTERED':
|
2009-07-30 13:56:39 +00:00
|
|
|
sub.itemR(lamp, "umbra")
|
|
|
|
sub.itemR(lamp, "dither")
|
|
|
|
sub.itemR(lamp, "jitter")
|
2009-07-21 01:52:05 +00:00
|
|
|
|
2009-09-27 11:00:35 +00:00
|
|
|
elif lamp.shadow_method == 'BUFFER_SHADOW':
|
2009-07-21 01:52:05 +00:00
|
|
|
col = layout.column()
|
|
|
|
col.itemL(text="Buffer Type:")
|
|
|
|
col.row().itemR(lamp, "shadow_buffer_type", expand=True)
|
|
|
|
|
Deep Shadow Buffer
Since the deep shadow buffer summer of code project is not actively under
development anymore, I decided to build my own DSM implementation from
scratch, based on reusing as much existing shadow buffer code as possible.
It's not very advanced, but implements the basic algorithm. Just enough so
we can do shading tests with it, optimizations and other improvements can
be done later.
Supported:
* Classical shadow buffer options: filter, soft, bias, ..
* Multiple sample buffers, merged into one.
* Halfway trick to support lower bias.
* Compression with user defined threshold.
* Non-textured alpha transparency, using Casting Alpha value.
* Strand render.
Not Supported:
* Tiling disk cache, so can use a lot of memory.
* Per part rendering for lower memory usage during creation.
* Colored shadow.
* Textured color/alpha shadow.
* Mipmaps for faster filtering.
* Volume shadows.
Usage Hints:
* Use sample buffers + smaller size rather than large size.
* For example 512 size x 9 sample buffers instead of 2048 x 1.
* Compression threshold 0.05 works, but is on the conservative side.
2009-10-12 19:41:40 +00:00
|
|
|
if lamp.shadow_buffer_type in ('REGULAR', 'HALFWAY', 'DEEP'):
|
2009-07-21 01:52:05 +00:00
|
|
|
split = layout.split()
|
2009-07-27 20:39:10 +00:00
|
|
|
|
2009-07-21 01:52:05 +00:00
|
|
|
col = split.column()
|
|
|
|
col.itemL(text="Filter Type:")
|
|
|
|
col.itemR(lamp, "shadow_filter_type", text="")
|
2009-07-27 20:39:10 +00:00
|
|
|
sub = col.column(align=True)
|
|
|
|
sub.itemR(lamp, "shadow_buffer_soft", text="Soft")
|
|
|
|
sub.itemR(lamp, "shadow_buffer_bias", text="Bias")
|
2009-07-21 01:52:05 +00:00
|
|
|
|
|
|
|
col = split.column()
|
|
|
|
col.itemL(text="Sample Buffers:")
|
|
|
|
col.itemR(lamp, "shadow_sample_buffers", text="")
|
2009-07-27 20:39:10 +00:00
|
|
|
sub = col.column(align=True)
|
|
|
|
sub.itemR(lamp, "shadow_buffer_size", text="Size")
|
|
|
|
sub.itemR(lamp, "shadow_buffer_samples", text="Samples")
|
Deep Shadow Buffer
Since the deep shadow buffer summer of code project is not actively under
development anymore, I decided to build my own DSM implementation from
scratch, based on reusing as much existing shadow buffer code as possible.
It's not very advanced, but implements the basic algorithm. Just enough so
we can do shading tests with it, optimizations and other improvements can
be done later.
Supported:
* Classical shadow buffer options: filter, soft, bias, ..
* Multiple sample buffers, merged into one.
* Halfway trick to support lower bias.
* Compression with user defined threshold.
* Non-textured alpha transparency, using Casting Alpha value.
* Strand render.
Not Supported:
* Tiling disk cache, so can use a lot of memory.
* Per part rendering for lower memory usage during creation.
* Colored shadow.
* Textured color/alpha shadow.
* Mipmaps for faster filtering.
* Volume shadows.
Usage Hints:
* Use sample buffers + smaller size rather than large size.
* For example 512 size x 9 sample buffers instead of 2048 x 1.
* Compression threshold 0.05 works, but is on the conservative side.
2009-10-12 19:41:40 +00:00
|
|
|
if lamp.shadow_buffer_type == 'DEEP':
|
|
|
|
col.itemR(lamp, "compression_threshold")
|
2009-05-09 10:33:06 +00:00
|
|
|
|
2009-07-28 01:06:56 +00:00
|
|
|
elif lamp.shadow_buffer_type == 'IRREGULAR':
|
2009-07-27 20:39:10 +00:00
|
|
|
layout.itemR(lamp, "shadow_buffer_bias", text="Bias")
|
2009-05-10 12:12:05 +00:00
|
|
|
|
UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
This means the layout engine now works at button level, and makes it
easier to write templates. Otherwise you had to store all info and
create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
These can contain regular buttons, and can be put in a Free layout,
which means you can specify manual coordinates, but still get nested
correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
in the last added layout specifier, i.e. one level up in the layout
hierarchy. This doesn't work well in always, so now when creating things
like rows or columns it always returns a layout which you have to add
the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
required width/height of all nested layouts, and then in the second
pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
buttons).
* Moved some more space variables into Style.
2009-05-15 11:19:59 +00:00
|
|
|
row = layout.row()
|
|
|
|
row.itemR(lamp, "auto_clip_start", text="Autoclip Start")
|
2009-07-27 20:39:10 +00:00
|
|
|
sub = row.row()
|
|
|
|
sub.active = not lamp.auto_clip_start
|
|
|
|
sub.itemR(lamp, "shadow_buffer_clip_start", text="Clip Start")
|
|
|
|
|
UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
This means the layout engine now works at button level, and makes it
easier to write templates. Otherwise you had to store all info and
create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
These can contain regular buttons, and can be put in a Free layout,
which means you can specify manual coordinates, but still get nested
correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
in the last added layout specifier, i.e. one level up in the layout
hierarchy. This doesn't work well in always, so now when creating things
like rows or columns it always returns a layout which you have to add
the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
required width/height of all nested layouts, and then in the second
pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
buttons).
* Moved some more space variables into Style.
2009-05-15 11:19:59 +00:00
|
|
|
row = layout.row()
|
|
|
|
row.itemR(lamp, "auto_clip_end", text="Autoclip End")
|
2009-07-27 20:39:10 +00:00
|
|
|
sub = row.row()
|
|
|
|
sub.active = not lamp.auto_clip_end
|
|
|
|
sub.itemR(lamp, "shadow_buffer_clip_end", text=" Clip End")
|
2009-05-10 12:12:05 +00:00
|
|
|
|
2009-07-30 13:56:39 +00:00
|
|
|
class DATA_PT_area(DataButtonsPanel):
|
|
|
|
__label__ = "Area Shape"
|
|
|
|
|
|
|
|
def poll(self, context):
|
|
|
|
lamp = context.lamp
|
|
|
|
return (lamp and lamp.type == 'AREA')
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
|
|
|
|
lamp = context.lamp
|
|
|
|
|
|
|
|
split = layout.split()
|
|
|
|
|
|
|
|
col = split.column()
|
2009-10-03 11:19:14 +00:00
|
|
|
col.row().itemR(lamp, "shape", expand=True)
|
2009-07-30 13:56:39 +00:00
|
|
|
|
|
|
|
sub = col.column(align=True)
|
|
|
|
if (lamp.shape == 'SQUARE'):
|
|
|
|
sub.itemR(lamp, "size")
|
|
|
|
elif (lamp.shape == 'RECTANGLE'):
|
|
|
|
sub.itemR(lamp, "size", text="Size X")
|
|
|
|
sub.itemR(lamp, "size_y", text="Size Y")
|
|
|
|
|
2009-05-08 21:52:57 +00:00
|
|
|
class DATA_PT_spot(DataButtonsPanel):
|
2009-07-30 13:56:39 +00:00
|
|
|
__label__ = "Spot Shape"
|
2009-05-08 21:52:57 +00:00
|
|
|
|
|
|
|
def poll(self, context):
|
2009-06-03 00:17:35 +00:00
|
|
|
lamp = context.lamp
|
|
|
|
return (lamp and lamp.type == 'SPOT')
|
2009-05-08 21:52:57 +00:00
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
2009-07-27 20:39:10 +00:00
|
|
|
|
2009-06-13 21:22:21 +00:00
|
|
|
lamp = context.lamp
|
2009-05-08 21:52:57 +00:00
|
|
|
|
UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
This means the layout engine now works at button level, and makes it
easier to write templates. Otherwise you had to store all info and
create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
These can contain regular buttons, and can be put in a Free layout,
which means you can specify manual coordinates, but still get nested
correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
in the last added layout specifier, i.e. one level up in the layout
hierarchy. This doesn't work well in always, so now when creating things
like rows or columns it always returns a layout which you have to add
the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
required width/height of all nested layouts, and then in the second
pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
buttons).
* Moved some more space variables into Style.
2009-05-15 11:19:59 +00:00
|
|
|
split = layout.split()
|
2009-07-27 20:39:10 +00:00
|
|
|
|
2009-07-21 01:52:05 +00:00
|
|
|
col = split.column()
|
2009-10-03 11:19:14 +00:00
|
|
|
sub = col.column()
|
2009-05-21 11:10:34 +00:00
|
|
|
sub.itemR(lamp, "spot_size", text="Size")
|
2009-10-03 11:19:14 +00:00
|
|
|
sub.itemR(lamp, "spot_blend", text="Blend", slider=True)
|
2009-07-21 01:52:05 +00:00
|
|
|
col.itemR(lamp, "square")
|
2009-05-08 21:52:57 +00:00
|
|
|
|
2009-05-29 09:53:46 +00:00
|
|
|
col = split.column()
|
|
|
|
col.itemR(lamp, "halo")
|
2009-07-27 20:39:10 +00:00
|
|
|
sub = col.column(align=True)
|
|
|
|
sub.active = lamp.halo
|
|
|
|
sub.itemR(lamp, "halo_intensity", text="Intensity")
|
2009-05-29 09:53:46 +00:00
|
|
|
if lamp.shadow_method == 'BUFFER_SHADOW':
|
2009-07-27 20:39:10 +00:00
|
|
|
sub.itemR(lamp, "halo_step", text="Step")
|
2009-05-08 18:17:57 +00:00
|
|
|
|
2009-06-03 00:17:35 +00:00
|
|
|
class DATA_PT_falloff_curve(DataButtonsPanel):
|
|
|
|
__label__ = "Falloff Curve"
|
2009-07-21 01:52:05 +00:00
|
|
|
__default_closed__ = True
|
2009-06-03 00:17:35 +00:00
|
|
|
|
|
|
|
def poll(self, context):
|
|
|
|
lamp = context.lamp
|
|
|
|
|
2009-09-01 00:33:39 +00:00
|
|
|
return (lamp and lamp.type in ('POINT', 'SPOT') and lamp.falloff_type == 'CUSTOM_CURVE')
|
2009-06-03 00:17:35 +00:00
|
|
|
|
|
|
|
def draw(self, context):
|
2009-06-13 21:22:21 +00:00
|
|
|
lamp = context.lamp
|
2009-06-03 00:17:35 +00:00
|
|
|
|
2009-09-16 18:47:42 +00:00
|
|
|
self.layout.template_curve_mapping(lamp, "falloff_curve")
|
2009-06-03 00:17:35 +00:00
|
|
|
|
2009-07-09 09:42:34 +00:00
|
|
|
bpy.types.register(DATA_PT_context_lamp)
|
2009-06-07 11:42:13 +00:00
|
|
|
bpy.types.register(DATA_PT_preview)
|
2009-05-08 18:17:57 +00:00
|
|
|
bpy.types.register(DATA_PT_lamp)
|
2009-06-18 14:20:25 +00:00
|
|
|
bpy.types.register(DATA_PT_falloff_curve)
|
2009-07-30 13:56:39 +00:00
|
|
|
bpy.types.register(DATA_PT_area)
|
2009-07-21 01:52:05 +00:00
|
|
|
bpy.types.register(DATA_PT_spot)
|
|
|
|
bpy.types.register(DATA_PT_shadow)
|
2009-08-18 12:58:51 +00:00
|
|
|
bpy.types.register(DATA_PT_sunsky)
|