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

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaurice Raybaud <mauriceraybaud@hotmail.fr>2011-01-09 22:58:13 +0300
committerMaurice Raybaud <mauriceraybaud@hotmail.fr>2011-01-09 22:58:13 +0300
commit61bf934744d4ba7ffa1c89012019ed1b022dd13b (patch)
treeff8e1f0c4d344666e0553f221f568b518cbd4fe9 /render_povray
parenta4be6ab1293276fb9db0beaebbe902217468bf61 (diff)
Added Atmospheric Media and custom image gamma
fixed two typo errors and a compatibility for gamma syntax
Diffstat (limited to 'render_povray')
-rw-r--r--render_povray/__init__.py33
-rw-r--r--render_povray/render.py21
-rw-r--r--render_povray/ui.py55
3 files changed, 100 insertions, 9 deletions
diff --git a/render_povray/__init__.py b/render_povray/__init__.py
index ef8e63da..177e1a90 100644
--- a/render_povray/__init__.py
+++ b/render_povray/__init__.py
@@ -28,7 +28,7 @@ bl_addon_info = {
"wiki_url": "http://wiki.blender.org/index.php/Extensions:2.5/Py/"\
"Scripts/Render/PovRay",
"tracker_url": "https://projects.blender.org/tracker/index.php?"\
- "func=detail&aid=22717",
+ "func=detail&atid=468&aid=22717&group_id=153",
"category": "Render"}
@@ -55,6 +55,16 @@ def register():
name="Advanced Options",
description="Show advanced options",
default=False)
+ Scene.pov_media_enable = BoolProperty(
+ name="Enable Media",
+ description="Enable povrays atmospheric media",
+ default=False)
+ Scene.pov_media_samples = IntProperty(
+ name="Samples", description="Number of samples taken from camera to first object encountered along ray path for media calculation",
+ min=1, max=100, default=35)
+ Scene.pov_media_color = FloatProperty(
+ name="Media Color", description="The atmospheric media color. Grey value for now",
+ min=0.00, max=1.00, soft_min=0.01, soft_max=1.00, default=0.01)
Scene.pov_baking_enable = BoolProperty(
name="Enable Baking",
description="Enable povrays texture baking",
@@ -185,13 +195,27 @@ def register():
],
name="Refractive",
description="use fake caustics (fast) or true photons for refractive Caustics",
- default="1")#ui.py has to be loaded before render.py with this.
+ default="1")#ui.py has to be loaded before render.py with this.
+
+ ########################################################################################
+ #Custom texture gamma
+ Tex = bpy.types.Texture
+ Tex.pov_tex_gamma_enable = BoolProperty(
+ name="Enable custom texture gamma",
+ description="Notify some custom gamma for which texture has been precorrected without the file format carrying it and only if it differs from your OS expected standard (see pov doc)",
+ default=False)
+ Tex.pov_tex_gamma_value = FloatProperty(
+ name="Custom texture gamma",
+ description="value for which the file was issued e.g. a Raw photo is gamma 1.0",
+ min=0.45, max=5.00, soft_min=1.00, soft_max=2.50, default=1.00)
+
######################################EndMR#####################################
def unregister():
import bpy
Scene = bpy.types.Scene
Mat = bpy.types.Material # MR
+ Tex = bpy.types.Texture # MR
del Scene.pov_radio_enable
del Scene.pov_radio_display_advanced
del Scene.pov_radio_adc_bailout
@@ -206,6 +230,9 @@ def unregister():
del Scene.pov_radio_nearest_count
del Scene.pov_radio_normal
del Scene.pov_radio_recursion_limit
+ del Scene.pov_media_enable # MR
+ del Scene.pov_media_samples # MR
+ del Scene.pov_media_color # MR
del Scene.pov_baking_enable # MR
del Mat.pov_irid_enable # MR
del Mat.pov_mirror_use_IOR # MR
@@ -221,6 +248,8 @@ def unregister():
del Mat.pov_photons_dispersion # MR
del Mat.pov_photons_reflection # MR
del Mat.pov_refraction_type # MR
+ del Tex.pov_tex_gamma_enable # MR
+ del Tex.pov_tex_gamma_value # MR
if __name__ == "__main__":
register()
diff --git a/render_povray/render.py b/render_povray/render.py
index 1e500e91..9f1be317 100644
--- a/render_povray/render.py
+++ b/render_povray/render.py
@@ -778,11 +778,14 @@ def write_pov(filename, scene=None, info_callback=None):
for t in material.texture_slots:
if t and t.texture.type == 'IMAGE' and t.use and t.texture.image:
image_filename = path_image(t.texture.image.filepath)
+ imgGamma = ''
if image_filename:
if t.use_map_color_diffuse:
texturesDif = image_filename
colvalue = t.default_value
t_dif = t
+ if t_dif.texture.pov_tex_gamma_enable:
+ imgGamma = (" gamma %.3g " % t_dif.texture.pov_tex_gamma_value)
if t.use_map_specular or t.use_map_raymir:
texturesSpec = image_filename
colvalue = t.default_value
@@ -873,16 +876,15 @@ def write_pov(filename, scene=None, info_callback=None):
else:
mappingDif = (" translate <%.4g-0.75,%.4g-0.75,%.4g-0.75> scale <%.4g,%.4g,%.4g>" % (t_dif.offset.x / 10 ,t_dif.offset.y / 10 ,t_dif.offset.z / 10, t_dif.scale.x / 2.25, t_dif.scale.y / 2.25, t_dif.scale.z / 2.25)) #strange that the translation factor for scale is not the same as for translate. ToDo: verify both matches with blender internal.
-
if texturesAlpha !='':
mappingAlpha = (" translate <%.4g-0.75,%.4g-0.75,%.4g-0.75> scale <%.4g,%.4g,%.4g>" % (t_alpha.offset.x / 10 ,t_alpha.offset.y / 10 ,t_alpha.offset.z / 10, t_alpha.scale.x / 2.25, t_alpha.scale.y / 2.25, t_alpha.scale.z / 2.25)) #strange that the translation factor for scale is not the same as for translate. ToDo: verify both matches with blender internal.
file.write('\n\t\t\t\tpigment {pigment_pattern {uv_mapping image_map{%s \"%s\" %s}%s}' % (imageFormat(texturesAlpha),texturesAlpha,imgMap(t_alpha),mappingAlpha))
file.write('\n\t\t\t\t\tpigment_map {\n\t\t\t\t\t\t[0 color rgbft<0,0,0,1,1>]')
- file.write('\n\t\t\t\t\t\t[1 uv_mapping image_map {%s \"%s\" %s}%s]\n\t\t\t\t}' % (imageFormat(texturesDif),texturesDif,imgMap(t_dif),mappingDif))
+ file.write('\n\t\t\t\t\t\t[1 uv_mapping image_map {%s \"%s\" %s}%s]\n\t\t\t\t}' % (imageFormat(texturesDif),texturesDif,(imgGamma + imgMap(t_dif)),mappingDif))
file.write('\n\t\t\t\t}')
else:
- file.write("\n\t\t\t\tpigment {uv_mapping image_map {%s \"%s\" %s}%s}" % (imageFormat(texturesDif),texturesDif,imgMap(t_dif),mappingDif))
+ file.write("\n\t\t\t\tpigment {uv_mapping image_map {%s \"%s\" %s}%s}" % (imageFormat(texturesDif),texturesDif,(imgGamma + imgMap(t_dif)),mappingDif))
if texturesSpec !='':
file.write('finish {%s}' % (safety(material_finish, Level=1)))# Level 1 is no specular
@@ -924,17 +926,16 @@ def write_pov(filename, scene=None, info_callback=None):
file.write('finish {%s}' % (safety(material_finish, Level=2)))# Level 2 is translated specular
else:
- mappingDif = (" translate <%.4g-0.75,%.4g-0.75,%.4g-0.75> scale <%.4g,%.4g,%.4g>" % (t_dif.offset.x / 10 ,t_dif.offset.y / 10 ,t_dif.offset.z / 10, t_dif.scale.x / 2.25, t_dif.scale.y / 2.25, t_dif.scale.z / 2.25)) #strange that the translation factor for scale is not the same as for translate. ToDo: verify both matches with blender internal.
-
+ mappingDif = (" translate <%.4g-0.75,%.4g-0.75,%.4g-0.75> scale <%.4g,%.4g,%.4g>" % (t_dif.offset.x / 10 ,t_dif.offset.y / 10 ,t_dif.offset.z / 10, t_dif.scale.x / 2.25, t_dif.scale.y / 2.25, t_dif.scale.z / 2.25)) #strange that the translation factor for scale is not the same as for translate. ToDo: verify both matches with blender internal.
if texturesAlpha !='':
mappingAlpha = (" translate <%.4g-0.75,%.4g-0.75,%.4g-0.75> scale <%.4g,%.4g,%.4g>" % (t_alpha.offset.x / 10 ,t_alpha.offset.y / 10 ,t_alpha.offset.z / 10, t_alpha.scale.x / 2.25, t_alpha.scale.y / 2.25, t_alpha.scale.z / 2.25)) #strange that the translation factor for scale is not the same as for translate. ToDo: verify both matches with blender internal.
file.write('\n\t\t\t\tpigment {pigment_pattern {uv_mapping image_map{%s \"%s\" %s}%s}' % (imageFormat(texturesAlpha),texturesAlpha,imgMap(t_alpha),mappingAlpha))
file.write('\n\t\t\t\tpigment_map {\n\t\t\t\t\t[0 color rgbft<0,0,0,1,1>]')
- file.write('\n\t\t\t\t\t\t[1 uv_mapping image_map {%s \"%s\" %s}%s]\n\t\t\t\t\t}' % (imageFormat(texturesDif),texturesDif,imgMap(t_dif),mappingDif))
+ file.write('\n\t\t\t\t\t\t[1 uv_mapping image_map {%s \"%s\" %s}%s]\n\t\t\t\t\t}' % (imageFormat(texturesDif),texturesDif,(imgMap(t_dif)+imgGamma),mappingDif))
file.write('\n\t\t\t\t}')
else:
- file.write("\n\t\t\tpigment {uv_mapping image_map {%s \"%s\" %s}%s}" % (imageFormat(texturesDif),texturesDif,imgMap(t_dif),mappingDif))
+ file.write("\n\t\t\tpigment {uv_mapping image_map {%s \"%s\" %s}%s}" % (imageFormat(texturesDif),texturesDif,(imgGamma + imgMap(t_dif)),mappingDif))
if texturesSpec !='':
file.write('finish {%s}' % (safety(material_finish, Level=3)))# Level 3 is full specular
else:
@@ -1159,10 +1160,16 @@ def write_pov(filename, scene=None, info_callback=None):
#file.write('\tturb_depth 0.3\n')
file.write('\tfog_type 1\n')
file.write('}\n')
+ if scene.pov_media_enable:
+ file.write('media {\n')
+ file.write('\tscattering { 1, rgb %.3g}\n' % scene.pov_media_color)
+ file.write('\tsamples %.d\n' % scene.pov_media_samples)
+ file.write('}\n')
def exportGlobalSettings(scene):
file.write('global_settings {\n')
+ file.write('\tassumed_gamma 1.0\n')
file.write('\tmax_trace_level 7\n')
if scene.pov_radio_enable:
diff --git a/render_povray/ui.py b/render_povray/ui.py
index d1c0b769..95dc5e37 100644
--- a/render_povray/ui.py
+++ b/render_povray/ui.py
@@ -106,6 +106,17 @@ class MaterialButtonsPanel():
rd = context.scene.render
return mat and (rd.use_game_engine == False) and (rd.engine in cls.COMPAT_ENGINES)
+class TextureButtonsPanel():
+ bl_space_type = 'PROPERTIES'
+ bl_region_type = 'WINDOW'
+ bl_context = "texture"
+ # COMPAT_ENGINES must be defined in each subclass, external engines can add themselves here
+
+ @classmethod
+ def poll(cls, context):
+ tex = context.texture
+ rd = context.scene.render
+ return tex and (rd.use_game_engine == False) and (rd.engine in cls.COMPAT_ENGINES)
########################################MR######################################
class MATERIAL_PT_povray_mirrorIOR(MaterialButtonsPanel, bpy.types.Panel):
bl_label = "IOR Mirror"
@@ -289,6 +300,29 @@ class RENDER_PT_povray_radiosity(RenderButtonsPanel, bpy.types.Panel):
col = split.column()
col.prop(scene, "pov_radio_always_sample")
+class RENDER_PT_povray_media(RenderButtonsPanel, bpy.types.Panel):
+ bl_label = "Atmosphere Media"
+ COMPAT_ENGINES = {'POVRAY_RENDER'}
+
+ def draw_header(self, context):
+ scene = context.scene
+
+ self.layout.prop(scene, "pov_media_enable", text="")
+
+ def draw(self, context):
+ layout = self.layout
+
+ scene = context.scene
+ rd = scene.render
+
+ layout.active = scene.pov_media_enable
+ split = layout.split()
+
+ col = split.column()
+ col.prop(scene, "pov_media_samples", text="Samples")
+ col.prop(scene, "pov_media_color", text="Color")
+
+
class RENDER_PT_povray_baking(RenderButtonsPanel, bpy.types.Panel):
bl_label = "Baking"
COMPAT_ENGINES = {'POVRAY_RENDER'}
@@ -305,3 +339,24 @@ class RENDER_PT_povray_baking(RenderButtonsPanel, bpy.types.Panel):
rd = scene.render
layout.active = scene.pov_baking_enable
+
+class TEXTURE_PT_povray_tex_gamma(TextureButtonsPanel, bpy.types.Panel):
+ bl_label = "Image Gamma"
+ COMPAT_ENGINES = {'POVRAY_RENDER'}
+
+ def draw_header(self, context):
+ tex = context.texture
+
+ self.layout.prop(tex, "pov_tex_gamma_enable", text="")
+
+ def draw(self, context):
+ layout = self.layout
+
+ tex = context.texture
+
+ layout.active = tex.pov_tex_gamma_enable
+ split = layout.split()
+
+ col = split.column()
+ col.prop(tex, "pov_tex_gamma_value", text="Gamma Value")
+