Permalink
Browse files

Changes to the new Material Preview Controls:

* Removed PosX,PosZ controls
* Removed Texture scale/offset controls
* Added AA Passes control for progressively refining the material rendering
* Splitted the Light power control in two: Key Light power control and Fill Lights power control
  • Loading branch information...
1 parent 90e7d31 commit 3515ee77f972aee04cae29b5b8423afc6df212f1 @DavidBluecame committed Feb 1, 2016
Showing with 38 additions and 74 deletions.
  1. +5 −1 io/yaf_light.py
  2. +2 −6 io/yaf_material.py
  3. +0 −2 io/yaf_object.py
  4. +8 −0 io/yaf_scene.py
  5. +15 −45 prop/yaf_scene.py
  6. +4 −10 ui/properties_yaf_material.py
  7. +4 −10 ui/properties_yaf_texture.py
View
@@ -94,22 +94,26 @@ def createLight(self, yi, lamp_object, matrix=None):
if name == "Lamp":
pos = (-6, -4, 8, 1.0)
power = 5
+ power *= bpy.data.scenes[0].yafaray.preview.fillLightPowerFactor
+
elif name == "Lamp.001":
pos = (6, -6, -2, 1.0)
power = 6
+ power *= bpy.data.scenes[0].yafaray.preview.fillLightPowerFactor
elif name == "Lamp.002":
pos = (-2.9123109, -7.270790733, 4.439187765, 1.0)
to = (-0.0062182024121284485, 0.6771485209465027, 1.8015732765197754, 1.0)
power = 5
+ power *= bpy.data.scenes[0].yafaray.preview.keyLightPowerFactor
elif name == "Lamp.008":
lampType = "sun"
power = 0.8
+ power *= bpy.data.scenes[0].yafaray.preview.keyLightPowerFactor
if bpy.data.scenes[0].yafaray.preview.enable:
matrix2 = mathutils.Matrix.Rotation(bpy.data.scenes[0].yafaray.preview.lightRotZ, 4, 'Z')
pos = multiplyMatrix4x4Vector4(matrix2, mathutils.Vector((pos[0], pos[1], pos[2], pos[3])))
color = bpy.data.scenes[0].yafaray.preview.lightColor
- power *= bpy.data.scenes[0].yafaray.preview.lightPowerFactor
yi.paramsClearAll()
View
@@ -191,12 +191,8 @@ def writeMappingNode(self, name, texname, mtex):
mappingCoords = switchMappingCoords.get(mtex.mapping, 'plain')
yi.paramsSetString("mapping", mappingCoords)
- if self.preview and bpy.data.scenes[0].yafaray.preview.enable:
- yi.paramsSetPoint("scale", mtex.scale[0]*bpy.data.scenes[0].yafaray.preview.textureScale[0], mtex.scale[1]*bpy.data.scenes[0].yafaray.preview.textureScale[1], mtex.scale[2])
- yi.paramsSetPoint("offset", mtex.offset[0]+bpy.data.scenes[0].yafaray.preview.textureOffset[0], mtex.offset[1]+bpy.data.scenes[0].yafaray.preview.textureOffset[1], mtex.offset[2])
- else:
- yi.paramsSetPoint("scale", mtex.scale[0], mtex.scale[1], mtex.scale[2])
- yi.paramsSetPoint("offset", mtex.offset[0], mtex.offset[1], mtex.offset[2])
+ yi.paramsSetPoint("scale", mtex.scale[0], mtex.scale[1], mtex.scale[2])
+ yi.paramsSetPoint("offset", mtex.offset[0], mtex.offset[1], mtex.offset[2])
if mtex.use_map_normal: # || mtex->maptoneg & MAP_NORM )
# scale up the normal factor, it resembles
View
@@ -455,8 +455,6 @@ def writeGeometry(self, ID, obj, matrix, pass_index, obType=0, oMat=None):
mesh.transform(matrix2)
matrix2 = mathutils.Matrix.Rotation(bpy.data.scenes[0].yafaray.preview.rotZ, 4, 'Z')
mesh.transform(matrix2)
- matrix2 = matrix2 = mathutils.Matrix.Translation(mathutils.Vector((bpy.data.scenes[0].yafaray.preview.posX, bpy.data.scenes[0].yafaray.preview.posY, bpy.data.scenes[0].yafaray.preview.posZ)))
- mesh.transform(matrix2)
pass
self.yi.paramsClearAll()
View
@@ -18,6 +18,7 @@
# <pep8 compliant>
+import bpy
def computeSceneSize(render):
sizeX = int(render.resolution_x * render.resolution_percentage * 0.01)
@@ -90,6 +91,10 @@ def exportAA(yi, scene):
yi.paramsSetFloat("AA_clamp_samples", scene.yafaray.noise_control.clamp_samples)
yi.paramsSetFloat("AA_clamp_indirect", scene.yafaray.noise_control.clamp_indirect)
+ if scene.name == "preview" and bpy.data.scenes[0].yafaray.preview.enable:
+ yi.paramsSetInt("AA_passes", bpy.data.scenes[0].yafaray.preview.previewAApasses)
+ yi.paramsSetFloat("AA_threshold", 0.01)
+
def exportRenderSettings(yi, scene):
yi.printInfo("Exporting Render Settings")
@@ -149,6 +154,9 @@ def exportRenderSettings(yi, scene):
yi.paramsSetBool("show_sam_pix", scene.gs_show_sam_pix)
+ if scene.name == "preview" and bpy.data.scenes[0].yafaray.preview.enable:
+ yi.paramsSetBool("show_sam_pix", False)
+
if scene.gs_type_render == "file" or scene.gs_type_render == "xml":
yi.paramsSetBool("premult", scene.gs_premult)
else:
View
@@ -461,33 +461,19 @@ class YafaRayMaterialPreviewControlProperties(bpy.types.PropertyGroup):
subtype="ANGLE", unit="ROTATION",
default=0.0)
- posX = FloatProperty(
+ keyLightPowerFactor = FloatProperty(
update=update_preview,
- name="posX",
- description=("Material Preview object position X"),
- min=-10.0, max=10.0, precision=2, step=50,
- default=0.0)
-
- posY = FloatProperty(
- update=update_preview,
- name="posY",
- description=("Material Preview object position Y"),
- min=-10.0, max=10.0, precision=2, step=50,
- default=0.0)
-
- posZ = FloatProperty(
- update=update_preview,
- name="posZ",
- description=("Material Preview object position Z"),
- min=-10.0, max=10.0, precision=2, step=50,
- default=0.0)
+ name="keyLightPowerFactor",
+ description=("Material Preview power factor for the key light"),
+ min=0.0, max=10.0, precision=2, step=10,
+ default=1.0)
- lightPowerFactor = FloatProperty(
+ fillLightPowerFactor = FloatProperty(
update=update_preview,
name="lightPowerFactor",
- description=("Material Preview power factor for lights"),
+ description=("Material Preview power factor for the fill lights"),
min=0.0, max=10.0, precision=2, step=10,
- default=1.0)
+ default=0.5)
lightColor = FloatVectorProperty(
update=update_preview,
@@ -499,33 +485,17 @@ class YafaRayMaterialPreviewControlProperties(bpy.types.PropertyGroup):
soft_min=0.0, soft_max=1.0,
default=(1.0, 1.0, 1.0))
- textureScale = FloatVectorProperty(
- update=update_preview,
- name="textureScale",
- description=("Material Preview texture scaling factors"),
- subtype='XYZ',
- size=2,
- step=1, precision=2,
- #min=0.0, max=1.0,
- #soft_min=0.0, soft_max=1.0,
- default=(1.0, 1.0))
-
- textureOffset = FloatVectorProperty(
- update=update_preview,
- name="textureOffset",
- description=("Material Preview texture offset values"),
- subtype='XYZ',
- size=2,
- step=1, precision=2,
- #min=0.0, max=1.0,
- #soft_min=0.0, soft_max=1.0,
- default=(0.0, 0.0))
-
previewRayDepth = IntProperty(
update=update_preview,
name="previewRayDepth",
description=("Material Preview max ray depth, set higher for better (slower) glass preview"),
- min=0, max=64, default=2)
+ min=0, max=20, default=2)
+
+ previewAApasses = IntProperty(
+ update=update_preview,
+ name="previewAApasses",
+ description=("Material Preview AA passes, set higher for better (slower) preview"),
+ min=1, max=20, default=1)
previewBackground = EnumProperty(
update=update_preview,
@@ -143,23 +143,17 @@ def draw(self, context):
col.prop(context.scene.yafaray.preview, "lightRotZ")
split = layout.split()
col = split.column()
- col.prop(context.scene.yafaray.preview, "posX")
+ col.prop(context.scene.yafaray.preview, "keyLightPowerFactor")
col = split.column()
- col.prop(context.scene.yafaray.preview, "posZ")
- split = layout.split()
- col = split.column()
- col.prop(context.scene.yafaray.preview, "textureScale")
- col = split.column()
- col.prop(context.scene.yafaray.preview, "textureOffset")
- split = layout.split()
- col = split.column()
- col.prop(context.scene.yafaray.preview, "lightPowerFactor")
+ col.prop(context.scene.yafaray.preview, "fillLightPowerFactor")
col = split.column()
col.prop(context.scene.yafaray.preview, "lightColor", text="")
split = layout.split()
col = split.column()
col.prop(context.scene.yafaray.preview, "previewRayDepth")
col = split.column()
+ col.prop(context.scene.yafaray.preview, "previewAApasses")
+ col = split.column()
col.prop(context.scene.yafaray.preview, "previewBackground", text="")
col = split.column()
col.prop_search(context.scene.yafaray.preview, "previewObject", bpy.data, "objects", text="")
@@ -157,23 +157,17 @@ def draw(self, context):
col.prop(context.scene.yafaray.preview, "lightRotZ")
split = layout.split()
col = split.column()
- col.prop(context.scene.yafaray.preview, "posX")
+ col.prop(context.scene.yafaray.preview, "keyLightPowerFactor")
col = split.column()
- col.prop(context.scene.yafaray.preview, "posZ")
- split = layout.split()
- col = split.column()
- col.prop(context.scene.yafaray.preview, "textureScale")
- col = split.column()
- col.prop(context.scene.yafaray.preview, "textureOffset")
- split = layout.split()
- col = split.column()
- col.prop(context.scene.yafaray.preview, "lightPowerFactor")
+ col.prop(context.scene.yafaray.preview, "fillLightPowerFactor")
col = split.column()
col.prop(context.scene.yafaray.preview, "lightColor", text="")
split = layout.split()
col = split.column()
col.prop(context.scene.yafaray.preview, "previewRayDepth")
col = split.column()
+ col.prop(context.scene.yafaray.preview, "previewAApasses")
+ col = split.column()
col.prop(context.scene.yafaray.preview, "previewBackground")
col = split.column()
col.prop_search(context.scene.yafaray.preview, "previewObject", bpy.data, "objects", text="")

0 comments on commit 3515ee7

Please sign in to comment.