Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add bloom to environment settings #142

Merged
merged 1 commit into from
Oct 25, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from bpy.props import FloatProperty, EnumProperty, FloatVectorProperty, PointerProperty
from bpy.props import FloatProperty, EnumProperty, FloatVectorProperty, PointerProperty, BoolProperty
from bpy.types import Image
from ...io.utils import gather_texture_property, gather_color_property
from ..hubs_component import HubsComponent
Expand Down Expand Up @@ -54,8 +54,48 @@ class EnvironmentSettings(HubsComponent):
type=Image
)

enableHDRPipeline: BoolProperty(
name="Enable HDR Pipeline",
description="Enable the new (experimental) HDR render pipeline with post processing effects and modified lighting + tonemapping model. NOTE: This checkbox is an opt-in to breaking changes. New versions of the Hubs client may break scenes with this option checked without warning and may reqquire re-export with a later Blender exporter.",
default=False
)

enableBloom: BoolProperty(
name="Bloom",
description="Add a Bloom effect to bright objects.",
default=False
)
bloomThreshold: FloatProperty(
name="Threshold", description="Values brighter than this in the final render (before tone mapping) will have bloom applied to them. The threshold is applied starting at 1, so a value of 0 will cover all 'HDR' values. You can specify a number below 0 to have bloom effect SDR values (not recommended)", default=1.0, min=0.0, soft_min=1.0)
bloomIntensity: FloatProperty(
name="Intensity", description="Scales the intensity of the bloom effect", default=1.0, min=0.0)
bloomRadius: FloatProperty(
name="Radius", description="Spread distance of the bloom effect", default=0.6, min=0.0, soft_max=1.0)
bloomSmoothing: FloatProperty(
name="Smoothing", description="Makes transition between under/over-threshold more gradual.", default=0.025, min=0.0, soft_max=1.0)

def draw(self, context, layout, panel):
layout.prop(data=self, property="enableHDRPipeline")

layout.prop(data=self, property="backgroundColor")
layout.prop(data=self, property="backgroundTexture")
layout.prop(data=self, property="envMapTexture")

layout.prop(data=self, property="toneMapping")
layout.prop(data=self, property="toneMappingExposure")

if self.enableHDRPipeline:
layout = layout.box()
top_row = layout.row()
top_row.prop(data=self, property="enableBloom")
if self.enableBloom:
layout.prop(data=self, property="bloomThreshold")
layout.prop(data=self, property="bloomIntensity")
layout.prop(data=self, property="bloomRadius")
layout.prop(data=self, property="bloomSmoothing")

def gather(self, export_settings, object):
return {
output = {
'toneMapping': self.toneMapping,
'toneMappingExposure': self.toneMappingExposure,
'backgroundColor': gather_color_property(export_settings, object, self, 'backgroundColor', 'COLOR_GAMMA'),
Expand All @@ -69,4 +109,18 @@ def gather(self, export_settings, object):
object,
self,
'envMapTexture')

}

if self.enableHDRPipeline:
output["enableHDRPipeline"] = True
if self.enableBloom:
output["enableBloom"] = True
output["bloom"] = {
"threshold": self.bloomThreshold,
"intensity": self.bloomIntensity,
"radius": self.bloomRadius,
"smoothing": self.bloomSmoothing,
}

return output