Browse files

Some work on background world. Fixed auto_threads.

  • Loading branch information...
1 parent 635675a commit a88b5c39915de1cdf12eea2686b7ec586e4f839c @exvion committed Aug 24, 2010
Showing with 272 additions and 58 deletions.
  1. +30 −9 su2yafaray.rb
  2. +1 −1 su2yafaray/YafarayMaterial.rb
  3. +15 −4 su2yafaray/YafaraySettings.rb
  4. +25 −3 su2yafaray/YafaraySettingsEditor.rb
  5. +201 −41 su2yafaray/settings.html
View
39 su2yafaray.rb
@@ -21,7 +21,7 @@
# SU2KT by Tomasz Marek, Stefan Jaensch, Tim Crandall,
# SU2POV by Didier Bur and OGRE exporter by Kojack
# Usage : Copy script to PLUGINS folder in SketchUp folder, run SU, go to Plugins\Yafaray exporter
-# Date : 2010-08-17
+# Date : 2010-06-29
# Type : Exporter
# Version : 0.1 alpha
@@ -280,23 +280,44 @@ def SU2YAFARAY.export_background(yi)
yi.paramsSetString("type", "constant")
elsif (@ys.background_type=="gradientback")
p "gradientback"
- #elsif (@ys.background_type=="path")
elsif (@ys.background_type=="sunsky")
- yi.paramsSetFloat("a_var",1.30)
+ yi.paramsSetFloat("a_var",Float(@ys.a_var))
yi.paramsSetBool("add_sun",true)
- yi.paramsSetFloat("b_var",0.5)
+ yi.paramsSetFloat("b_var",Float(@ys.b_var))
yi.paramsSetBool("background_light",true)
- yi.paramsSetFloat("c_var",1)
- yi.paramsSetFloat("d_var",1)
- yi.paramsSetFloat("e_var",1)
+ yi.paramsSetFloat("c_var",Float(@ys.c_var))
+ yi.paramsSetFloat("d_var",Float(@ys.d_var))
+ yi.paramsSetFloat("e_var",Float(@ys.e_var))
yi.paramsSetPoint("from",sun_direction.x,sun_direction.y,sun_direction.z)
yi.paramsSetInt("light_samples",16)
yi.paramsSetFloat("power",0.75)
yi.paramsSetFloat("sun_power",1)
yi.paramsSetFloat("turbidity",3)
yi.paramsSetString("type", "sunsky")
elsif (@ys.background_type=="darksky")
- p "gradientback"
+ p "darksky"
+ yi.paramsSetPoint("from",sun_direction.x,sun_direction.y,sun_direction.z)
+ yi.paramsSetFloat("turbidity",Float(@ys.turbidity))
+ yi.paramsSetFloat("altitude",Float(@ys.altitude))
+ yi.paramsSetFloat("a_var",Float(@ys.a_var))
+ yi.paramsSetFloat("b_var",Float(@ys.b_var))
+ yi.paramsSetFloat("c_var",Float(@ys.c_var))
+ yi.paramsSetFloat("d_var",Float(@ys.d_var))
+ yi.paramsSetFloat("e_var",Float(@ys.e_var))
+ yi.paramsSetBool("clamp_rgb", false)
+ yi.paramsSetBool("add_sun", true)
+ yi.paramsSetFloat("sun_power", 1)
+ yi.paramsSetBool("background_light",true)
+ yi.paramsSetBool("with_caustic", false)
+ yi.paramsSetBool("with_diffuse", false)
+ yi.paramsSetInt("light_samples",16)
+ yi.paramsSetFloat("power",0.75)
+ yi.paramsSetFloat("bright", 1)
+ yi.paramsSetBool("night", false)
+ yi.paramsSetFloat("exposure", 1)
+ yi.paramsSetBool("gamma_enc", true)
+ yi.paramsSetString("color_space", "CIE (E)")
+ yi.paramsSetString("type", "darksky")
end
#yi.paramsSetPoint("from", 100, 100, 100)
#yi.paramsSetFloat("turbidity", 3)
@@ -958,7 +979,7 @@ def SU2YAFARAY.get_editor(type)
#####################################################################
#####################################################################
def SU2YAFARAY.about
- UI.messagebox("SU2Yafaray version 0.1 alpha 17th August 2010
+ UI.messagebox("SU2Yafaray version 0.1 alpha 29th June 2010
SketchUp Exporter to Yafaray
Author: Alexander Smirnov (aka Exvion)
E-mail: exvion@gmail.com
View
2 su2yafaray/YafarayMaterial.rb
@@ -23,7 +23,7 @@ class YafarayMaterial
@@options=
{
'type'=>"shinydiffusemat",
- 'IOR'=>"1.0",
+ 'IOR'=>"1.51",
'diffuse_brdf'=>"lambert",
'diffuse_reflect'=>"1",
'emit'=>'0',
View
19 su2yafaray/YafaraySettings.rb
@@ -76,9 +76,20 @@ class YafaraySettings
#camera
'camera_type'=>'perspective',
- #background
- 'background_type'=>'sunsky'
-
+ ######background
+ 'background_type'=>'darksky',
+ 'a_var'=>'1',
+ 'add_sun'=>false,
+ 'b_var'=>'1',
+ 'background_light'=>false,
+ 'c_var'=>'1',
+ 'd_var'=>'1',
+ 'e_var'=>'1',
+ 'light_samples'=>'16',
+ 'power'=>'1',
+ 'sun_power'=>'1',
+ 'turbidity'=>'3',
+ 'altitude'=>'0'
}
def initialize
@@ -95,4 +106,4 @@ def initialize
end
end
-end #end class YafaraySettings
+end #end class YafaraySettings
View
28 su2yafaray/YafaraySettingsEditor.rb
@@ -71,6 +71,7 @@ def initialize
when "auto_threads"
@ys.auto_threads=true if value=="true"
@ys.auto_threads=false if value=="false"
+ setValue("threads",@ys.threads)
when "threads"
@ys.threads=value
#output settings
@@ -150,6 +151,18 @@ def initialize
#background
when "background_type"
@ys.background_type=value
+ when "turbidity"
+ @ys.turbidity=value
+ when "a_var"
+ @ys.a_var=value
+ when "b_var"
+ @ys.b_var=value
+ when "c_var"
+ @ys.c_var=value
+ when "d_var"
+ @ys.d_var=value
+ when "e_var"
+ @ys.e_var=value
end
} #end action callback param_generatate
@@ -268,7 +281,7 @@ def SendDataFromSketchup()
setCheckbox("clayrender",@ys.clayrender)
setCheckbox("z_channel",@ys.z_channel)
setCheckbox("transpShad",@ys.transpShad)
- setValue("threads",@ys.threads)
+ p @ys.auto_threads
setCheckbox("auto_threads",@ys.auto_threads)
setValue("gamma",@ys.gamma)
@@ -307,6 +320,15 @@ def SendDataFromSketchup()
#camera
setValue("camera_type",@ys.camera_type)
setValue("background_type",@ys.background_type)
+
+ ##########background
+ #sunsky
+ setValue("a_var",@ys.a_var)
+ setValue("b_var",@ys.a_var)
+ setValue("c_var",@ys.a_var)
+ setValue("d_var",@ys.a_var)
+ setValue("e_var",@ys.a_var)
+ setValue("turbidity",@ys.turbidity)
end
def setValue(id,value)
@@ -335,7 +357,7 @@ def change_aspect_ratio(aspect_ratio)
def setCheckbox(id,value)
- if value==true
+ if value
cmd="$('##{id}').attr('checked', 'checked'); $('##{id}').change();"
else
cmd="$('##{id}').removeAttr('checked'); $('##{id}').change();"
@@ -363,4 +385,4 @@ def change_aspect_ratio(aspect_ratio)
end
-end #end class YafaraySettingsEditor
+end #end class YafaraySettingsEditor
View
242 su2yafaray/settings.html
@@ -10,6 +10,7 @@
<script type="text/javascript" src="js/jquery.selectbox.js"></script>
<script type="text/javascript" src="js/jquery.slider.js"></script>
<script type="text/javascript" src="js/jquery.mycolorpicker.js"></script>
+<script type="text/javascript" src="js/firebug-lite.js"></script>
<script type="text/javascript" src="js/jquery.collapsibleCheckboxTree.js"></script>
<!--<script type="text/javascript" src="https://getfirebug.com/firebug-lite.js"></script>-->
<link rel="stylesheet" href="css/jquery.collapsibleCheckboxTree.css" type="text/css" />
@@ -22,6 +23,55 @@
$(document).ready(
function()
{
+ $('#background_type').change(function () {
+ //alert("background_type change");
+ $('#background_options>div').hide();
+ if (this.value=='constant') {
+ $('#bg_color').parent('div').parent('div').show();
+ $('#use_IBL').parent('div').parent('div').show();
+ $("label[for='ibl_samples']").parent('div').parent('div').show();
+ $("label[for='power']").parent('div').parent('div').show();
+ }
+ if (this.value=='gradientback') {
+ $("label[for='horizon_color']").parent('div').parent('div').show();
+ $('#horizon_ground_color').parent('div').parent('div').show();
+ $('#zenith_color').parent('div').parent('div').show();
+ $('#zenith_ground_color').parent('div').parent('div').show();
+ $('#use_IBL').parent('div').parent('div').show();
+ $('#ibl_samples').parent('div').parent('div').show();
+ $('#power').parent('div').parent('div').show();
+
+ }
+ if (this.value=='sunsky') {
+ $("label[for='turbidity']").parent('div').parent('div').show();
+ $("label[for='a_var']").parent('div').parent('div').show();
+ $("label[for='b_var']").parent('div').parent('div').show();
+ $("label[for='c_var']").parent('div').parent('div').show();
+ $("label[for='d_var']").parent('div').parent('div').show();
+ $("label[for='e_var']").parent('div').parent('div').show();
+ }
+ if (this.value=='darksky') {
+ $("label[for='turbidity']").parent('div').parent('div').show();
+ $("label[for='a_var']").parent('div').parent('div').show();
+ $("label[for='b_var']").parent('div').parent('div').show();
+ $("label[for='c_var']").parent('div').parent('div').show();
+ $("label[for='d_var']").parent('div').parent('div').show();
+ $("label[for='e_var']").parent('div').parent('div').show();
+ $("label[for='altitude']").parent('div').show();
+ $("label[for='night']").parent('div').show();
+ $("label[for='bright']").parent('div').show();
+ $("label[for='exposure']").parent('div').show();
+ $("label[for='sun_power']").parent('div').show();
+ $("label[for='light_samples']").parent('div').show();
+ $("label[for='power']").parent('div').show();
+ $("label[for='with_caustic']").parent('div').show();
+ $("label[for='with_diffuse']").parent('div').show();
+ $("color_space").parent('div').show();
+ }
+ });
+
+
+
$('#light_type').change(function () {
$('#list div').hide();
$('#' + this.value).show();
@@ -58,9 +108,47 @@
window.location = 'skp:param_generate@' + this.id+'='+this.value;
});
+ setCheckboxOnOff=function($this){
+if ($this.attr('checked'))
+ {
+ if ($this.is('#auto_threads'))
+ {
+ $('#threads').closest("div").hide();
+ }
+ if ($this.is('#transpShad'))
+ {
+ $('#shadowDepth').closest("div").show();
+ }
+ $this.closest("div").removeClass("checkboxOff");
+ $this.closest("div").addClass("checkboxOn");
+ $this.next("label").css('color','#FFFFFF');
+ }
+ else
+ {
+ if ($this.is('#transpShad'))
+ {
+ $('#shadowDepth').closest("div").hide();
+ }
+ if ($this.is('#auto_threads'))
+ {
+ $('#threads').closest("div").show();
+ }
+ $this.closest("div").removeClass("checkboxOn");
+ $this.closest("div").addClass("checkboxOff");
+ $this.next("label").css('color','#000000');
+ }
+
+}
+
+$("input:checkbox").parent("div").addClass("checkboxOff");
+
+
$(":checkbox").click(function() {
window.location = 'skp:param_generate@' + this.id + '=' + $(this).attr('checked');
});
+ $(":checkbox").change(function() {
+ window.location = 'skp:param_generate@' + this.id + '=' + $(this).attr('checked');
+ });
$.spin.imageBasePath = 'img/spin/';
@@ -101,44 +189,24 @@
$('#search').spin({min:1,max:10000});
$('#pm_caustic_mix').spin({min:1,max:10000});
+ //background_world
+ //constant
$('#bg_color').mycolorpicker();
+ $('#ibl_samples').spin();
+ $('#power').spin();
+ //darksky
+ $('#turbidity').spin();
+ $('#a_var').spin();
+ $('#b_var').spin();
+ $('#c_var').spin();
+ $('#d_var').spin();
+ $('#e_var').spin();
+ $('#altitude').spin();
+
+ $(":checkbox").click(function(){setCheckboxOnOff($(this));});
+ $(":checkbox").change(function(){setCheckboxOnOff($(this));});
-$("input:checkbox").parent("div").addClass("checkboxOff");
-
-setCheckboxOnOff=function($this){
-if ($this.attr('checked'))
- {
- if ($this.is('#auto_threads'))
- {
- $('#threads').closest("div").hide();
- }
- if ($this.is('#transpShad'))
- {
- $('#shadowDepth').closest("div").show();
- }
- $this.closest("div").removeClass("checkboxOff");
- $this.closest("div").addClass("checkboxOn");
- $this.next("label").css('color','#FFFFFF');
- }
- else
- {
- if ($this.is('#transpShad'))
- {
- $('#shadowDepth').closest("div").hide();
- }
- if ($this.is('#auto_threads'))
- {
- $('#threads').closest("div").show();
- }
- $this.closest("div").removeClass("checkboxOn");
- $this.closest("div").addClass("checkboxOff");
- $this.next("label").css('color','#000000');
- }
-}
-
-$(":checkbox").click(function(){setCheckboxOnOff($(this));});
-$(":checkbox").change(function(){setCheckboxOnOff($(this));});
$(".columns").each(function (i) {
var colWrap = $(this).width();
@@ -534,7 +602,6 @@
<div><label title='Gamma correction applied to input' for="gamma_input">Gamma input:</label>
<input type='text' id="gamma_input"/></div>
</div>
- </div>
<div class="columns">
<div><input type='checkbox' id="clamp_rgb"/><label title='' for="clamp_rgb">Clamp RGB</label></div>
<div><input type='checkbox' id="premult"/><label title='' for="premult">Premultiply Alpha</label></div>
@@ -586,23 +653,116 @@
<div><select id="background_type">
<option value="constant">Single Color</option>
<option value="gradientback">Gradient</option>
- <!--<option value="path">Texture</option>-->
<option value="sunsky">SunSky</option>
<option value="darksky">DarkTide's SunSky</option>
</select></div>
<div></div>
</div>
+ <div id="background_options">
<div class="columns">
<div><label for="bg_color">BG Color:</label>
<input type='text' id="bg_color" value="FF0000"/></div>
</div>
<div class="columns">
+ <div><label for="horizon_color">horizon_color:</label>
+ <input type='text' id="horizon_color" value="FF0000"/></div>
+ </div>
+ <div class="columns">
+ <div><label for="horizon_ground_color">horizon_ground_color:</label>
+ <input type='text' id="horizon_ground_color" value="FF0000"/></div>
+ </div>
+ <div class="columns">
+ <div><label for="zenith_color">zenith_color:</label>
+ <input type='text' id="zenith_color" value="FF0000"/></div>
+ </div>
+ <div class="columns">
+ <div><label for="zenith_ground_color">zenith_ground_color:</label>
+ <input type='text' id="zenith_ground_color" value="FF0000"/></div>
+ </div>
+
+ <div class="columns">
<div><input type='checkbox' id="use_IBL"/><label title='' for="use_IBL">Use IBL</label></div>
+ </div>
<div class="columns">
- <!--<div><label for="bg_color">BG Color:</label>
- <input type='text' id="bg_color" value="FF0000"/></div>
- <div><label for="bg_color">BG Color:</label>
- <input type='text' id="bg_color" value="FF0000"/></div>-->
+ <div><label for="ibl_samples">ibl_samples:</label>
+ <input type='text' id="ibl_samples"/></div>
+ </div>
+
+ <div class="columns">
+ <div><label for="turbidity">turbidity:</label>
+ <input type='text' id="turbidity"/></div>
+ </div>
+ <div class="columns">
+ <div><label for="a_var">Brightness of horizon gradint:</label>
+ <input type='text' id="a_var"/></div>
+ </div>
+ <div class="columns">
+ <div><label for="b_var">Luminance of horizon:</label>
+ <input type='text' id="b_var"/></div>
+ </div>
+ <div class="columns">
+ <div><label for="c_var">Solar region intensity:</label>
+ <input type='text' id="c_var"/></div>
+ </div>
+ <div class="columns">
+ <div><label for="d_var">Width of circumsolar region:</label>
+ <input type='text' id="d_var"/></div>
+ </div>
+ <div class="columns">
+ <div><label for="e_var">Backscattered light:</label>
+ <input type='text' id="e_var"/></div>
+ </div>
+ <div class="columns">
+ <div><label for="altitude">Altitude:</label><input type='text' id="altitude"/></div>
+ </div>
+ <div class="columns">
+ <div><select id="color_space">
+ <option value="CIE (E)">CIE (E)</option>
+ <option value="CIE (D50)">CIE (D50)</option>
+ <option value="sRGB (D50)">sRGB (D50)</option>
+ <option value="sRGB (D60)">sRGB (D60)</option>
+ </select></div>
+ <div></div>
+ </div>
+ <div class="columns">
+ <div><input type='checkbox' id="night"/><label title='' for="night">Night</label></div>
+ </div>
+ <div class="columns">
+ <div><label for="bright">Brightness:</label>
+ <input type='text' id="bright"/></div>
+ </div>
+ <div class="columns">
+ <div><label for="exposure">exposure:</label>
+ <input type='text' id="exposure"/></div>
+ </div>
+
+ <div class="columns">
+ <div><label for="light_samples">light_samples:</label>
+ <input type='text' id="light_samples"/></div>
+ </div>
+ <div class="columns">
+ <div><label for="sun_power">sun_power:</label>
+ <input type='text' id="sun_power"/></div>
+ </div>
+ <div class="columns">
+ <div><input type='checkbox' id="background_light"/><label title='' for="background_light">skylight</label></div>
+ </div>
+ <div class="columns">
+ <div><input type='checkbox' id="add_sun"/><label title='' for="add_sun">add_sun</label></div>
+ </div>
+ <div class="columns">
+ <div><label for="power">power:</label><input type='text' id="power"/></div>
+ </div>
+ <div class="columns">
+ <div><input type='checkbox' id="gamma_encoding"/><label title='' for="background_light">skylight</label></div>
+ </div>
+ <div class="columns">
+ <div><input type='checkbox' id="dwith_diffuse"/><label title='' for="with_diffuse">diffuse photons</label></div>
+ </div>
+ <div class="columns">
+ <div><input type='checkbox' id="with_caustic"/><label title='' for="with_caustic">caustic photons</label></div>
+ </div>
+
</div>
</ul>
</li>

0 comments on commit a88b5c3

Please sign in to comment.