Skip to content

Commit

Permalink
Merge pull request #1157 from est77/master
Browse files Browse the repository at this point in the history
OSL background() fixes. Replaced test scene.
  • Loading branch information
dictoon authored Dec 13, 2016
2 parents 5caa3dd + 84c8cf7 commit 824f4d9
Show file tree
Hide file tree
Showing 9 changed files with 276 additions and 160 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,195 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- File generated by appleseed.so version 1.6.0-beta (AVX). -->
<project format_revision="13">
<scene>
<camera name="camera" model="pinhole_camera">
<parameter name="controller_target" value="3.04155 0.476162 0.0513586" />
<parameter name="film_dimensions" value="0.024892 0.018669" />
<parameter name="focal_length" value="0.035" />
<transform time="0">
<matrix>
-0.999269725598125 0.001642966393130 0.038174810601749 1.715050303872409
0.000000000000000 0.999075151126506 -0.042998167420825 -0.019262019900611
-0.038210149215207 -0.042966766959830 -0.998345552118089 -5.486060105139496
0.000000000000000 0.000000000000000 0.000000000000000 1.000000000000000
</matrix>
</transform>
</camera>
<texture name="envmap" model="disk_texture_2d">
<parameter name="color_space" value="linear_rgb" />
<parameter name="filename" value="doge2_1024.exr" />
</texture>
<texture_instance name="envmap_inst" texture="envmap">
<parameter name="addressing_mode" value="clamp" />
<parameter name="filtering_mode" value="bilinear" />
</texture_instance>
<environment_edf name="environment_edf" model="latlong_map_environment_edf">
<parameter name="radiance" value="envmap_inst" />
</environment_edf>
<environment_edf name="osl_environment_edf" model="osl_environment_edf">
<parameter name="osl_background" value="envmap_sg" />
</environment_edf>
<environment_shader name="environment_shader" model="edf_environment_shader">
<parameter name="alpha_value" value="1.0" />
<parameter name="environment_edf" value="osl_environment_edf" />
</environment_shader>
<environment name="environment" model="generic_environment">
<parameter name="environment_edf" value="osl_environment_edf" />
<parameter name="environment_shader" value="environment_shader" />
</environment>
<shader_group name="envmap_sg">
<shader type="surface" name="envmap" layer="envmap1">
<parameter name="filename" value="string doge2_1024.exr" />
</shader>
</shader_group>
<assembly name="assembly1">
<color name="dark_gray">
<parameter name="color_space" value="linear_rgb" />
<values>
0.200000 0.200000 0.200000
</values>
<alpha>
1.000000
</alpha>
</color>
<color name="light_gray">
<parameter name="color_space" value="linear_rgb" />
<values>
0.750000 0.750000 0.750000
</values>
<alpha>
1.000000
</alpha>
</color>
<bsdf name="diffuse_brdf" model="lambertian_brdf">
<parameter name="reflectance" value="light_gray" />
</bsdf>
<bsdf name="glossy_brdf" model="ashikhmin_brdf">
<parameter name="diffuse_reflectance" value="dark_gray" />
<parameter name="glossy_reflectance" value="light_gray" />
<parameter name="shininess_u" value="100" />
<parameter name="shininess_v" value="100" />
</bsdf>
<bsdf name="specular_brdf" model="specular_brdf">
<parameter name="reflectance" value="light_gray" />
</bsdf>
<bsdf name="specularbtdf" model="specular_btdf">
<parameter name="ior" value="1.5" />
<parameter name="reflectance" value="light_gray" />
<parameter name="reflectance_multiplier" value="1.0" />
<parameter name="transmittance" value="light_gray" />
<parameter name="transmittance_multiplier" value="1.0" />
</bsdf>
<surface_shader name="physical_surface_shader" model="physical_surface_shader" />
<material name="chrome_mat" model="generic_material">
<parameter name="bsdf" value="specular_brdf" />
<parameter name="surface_shader" value="physical_surface_shader" />
</material>
<material name="diffuse_mat" model="generic_material">
<parameter name="bsdf" value="diffuse_brdf" />
<parameter name="surface_shader" value="physical_surface_shader" />
</material>
<material name="glassmat" model="generic_material">
<parameter name="bsdf" value="specularbtdf" />
<parameter name="surface_shader" value="physical_surface_shader" />
</material>
<material name="glossy_mat" model="generic_material">
<parameter name="bsdf" value="glossy_brdf" />
<parameter name="surface_shader" value="physical_surface_shader" />
</material>
<object name="sphere" model="mesh_object">
<parameter name="filename" value="sphere.obj" />
</object>
<object_instance name="sphere.sphere_inst1" object="sphere.sphere">
<assign_material slot="Default" side="front" material="chrome_mat" />
<assign_material slot="Default" side="back" material="chrome_mat" />
</object_instance>
<object_instance name="sphere.sphere_inst2" object="sphere.sphere">
<transform>
<matrix>
1.000000000000000 0.000000000000000 0.000000000000000 1.000000000000000
0.000000000000000 1.000000000000000 0.000000000000000 0.000000000000000
0.000000000000000 0.000000000000000 1.000000000000000 0.000000000000000
0.000000000000000 0.000000000000000 0.000000000000000 1.000000000000000
</matrix>
</transform>
<assign_material slot="Default" side="front" material="glassmat" />
<assign_material slot="Default" side="back" material="glassmat" />
</object_instance>
<object_instance name="sphere.sphere_inst3" object="sphere.sphere">
<transform>
<matrix>
1.000000000000000 0.000000000000000 0.000000000000000 2.000000000000000
0.000000000000000 1.000000000000000 0.000000000000000 0.000000000000000
0.000000000000000 0.000000000000000 1.000000000000000 0.000000000000000
0.000000000000000 0.000000000000000 0.000000000000000 1.000000000000000
</matrix>
</transform>
<assign_material slot="Default" side="front" material="glossy_mat" />
<assign_material slot="Default" side="back" material="glossy_mat" />
</object_instance>
<object_instance name="sphere.sphere_inst4" object="sphere.sphere">
<transform>
<matrix>
1.000000000000000 0.000000000000000 0.000000000000000 3.000000000000000
0.000000000000000 1.000000000000000 0.000000000000000 0.000000000000000
0.000000000000000 0.000000000000000 1.000000000000000 0.000000000000000
0.000000000000000 0.000000000000000 0.000000000000000 1.000000000000000
</matrix>
</transform>
<assign_material slot="Default" side="front" material="diffuse_mat" />
<assign_material slot="Default" side="back" material="diffuse_mat" />
</object_instance>
</assembly>
<assembly_instance name="assembly1_inst1" assembly="assembly1">
</assembly_instance>
</scene>
<output>
<frame name="beauty">
<parameter name="camera" value="camera" />
<parameter name="color_space" value="srgb" />
<parameter name="resolution" value="640 480" />
</frame>
</output>
<configurations>
<configuration name="final" base="base_final">
<parameter name="lighting_engine" value="drt" />
<parameter name="pixel_renderer" value="uniform" />
<parameters name="adaptive_pixel_renderer">
<parameter name="enable_diagnostics" value="false" />
<parameter name="max_samples" value="64" />
<parameter name="min_samples" value="16" />
<parameter name="quality" value="3.000000" />
</parameters>
<parameters name="drt">
<parameter name="dl_bsdf_samples" value="1" />
<parameter name="dl_light_samples" value="1" />
<parameter name="enable_ibl" value="true" />
<parameter name="ibl_bsdf_samples" value="1" />
<parameter name="ibl_env_samples" value="1" />
<parameter name="max_path_length" value="0" />
<parameter name="rr_min_path_length" value="3" />
</parameters>
<parameters name="generic_tile_renderer">
</parameters>
<parameters name="pt">
<parameter name="dl_light_samples" value="1" />
<parameter name="enable_caustics" value="true" />
<parameter name="enable_dl" value="true" />
<parameter name="enable_ibl" value="true" />
<parameter name="ibl_bsdf_samples" value="1" />
<parameter name="ibl_env_samples" value="1" />
<parameter name="max_path_length" value="0" />
<parameter name="next_event_estimation" value="true" />
<parameter name="rr_min_path_length" value="3" />
</parameters>
<parameters name="uniform_pixel_renderer">
<parameter name="decorrelate_pixels" value="true" />
<parameter name="samples" value="25" />
</parameters>
</configuration>
<configuration name="interactive" base="base_interactive">
<parameter name="lighting_engine" value="drt" />
</configuration>
</configurations>
</project>
13 changes: 13 additions & 0 deletions sandbox/tests/test scenes/environment/envmap.osl
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

surface envmap(string filename = "")
{
vector dir = normalize(I);

float theta = acos(dir[1]);
float phi = atan2(dir[2], dir[0]);

float tu = (phi + M_PI) / M_2PI;
float tv = 1.0 - (theta / M_PI);
color c = texture(filename, tu, tv);
Ci = c * background();
}
55 changes: 55 additions & 0 deletions sandbox/tests/test scenes/environment/envmap.oso
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
OpenShadingLanguage 1.00
# Compiled by oslc 1.7.4
# options:
surface envmap
param string filename "" %read{10,10} %write{2147483647,-1}
global vector I %read{0,0} %write{2147483647,-1} %derivs
global closure color Ci %read{2147483647,-1} %write{12,12}
local vector dir %read{1,4} %write{0,0} %derivs
local float theta %read{8,8} %write{2,2} %derivs
local float phi %read{6,6} %write{5,5} %derivs
local float tu %read{10,10} %write{7,7} %derivs
local float tv %read{10,10} %write{9,9} %derivs
local color c %read{12,12} %write{10,10}
const int $const1 1 %read{1,1} %write{2147483647,-1}
temp float $tmp1 %read{2,2} %write{1,1} %derivs
const int $const2 2 %read{3,3} %write{2147483647,-1}
temp float $tmp2 %read{5,5} %write{3,3} %derivs
const int $const3 0 %read{4,4} %write{2147483647,-1}
temp float $tmp3 %read{5,5} %write{4,4} %derivs
const float $const4 3.1415927 %read{6,8} %write{2147483647,-1}
temp float $tmp4 %read{7,7} %write{6,6} %derivs
const float $const5 6.2831855 %read{7,7} %write{2147483647,-1}
const float $const6 1 %read{9,9} %write{2147483647,-1}
temp float $tmp5 %read{9,9} %write{8,8} %derivs
temp closure color $tmp6 %read{12,12} %write{11,11}
const string $const7 "background" %read{11,11} %write{2147483647,-1}
code ___main___
# envmap.osl:4
# vector dir = normalize(I);
normalize dir I %filename{"envmap.osl"} %line{4} %argrw{"wr"}
# envmap.osl:6
# float theta = acos(dir[1]);
compref $tmp1 dir $const1 %line{6} %argrw{"wrr"}
acos theta $tmp1 %argrw{"wr"}
# envmap.osl:7
# float phi = atan2(dir[2], dir[0]);
compref $tmp2 dir $const2 %line{7} %argrw{"wrr"}
compref $tmp3 dir $const3 %argrw{"wrr"}
atan2 phi $tmp2 $tmp3 %argrw{"wrr"}
# envmap.osl:9
# float tu = (phi + M_PI) / M_2PI;
add $tmp4 phi $const4 %line{9} %argrw{"wrr"}
div tu $tmp4 $const5 %argrw{"wrr"}
# envmap.osl:10
# float tv = 1.0 - (theta / M_PI);
div $tmp5 theta $const4 %line{10} %argrw{"wrr"}
sub tv $const6 $tmp5 %argrw{"wrr"}
# envmap.osl:11
# color c = texture(filename, tu, tv);
texture c filename tu tv %line{11} %argrw{"wrrr"} %argderivs{2,3}
# envmap.osl:12
# Ci = c * background();
closure $tmp6 $const7 %line{12} %argrw{"wr"}
mul Ci $tmp6 c %argrw{"wrr"}
end
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
114 changes: 0 additions & 114 deletions sandbox/tests/test scenes/osl/11 - background osl - ptne.appleseed

This file was deleted.

6 changes: 0 additions & 6 deletions sandbox/tests/test scenes/osl/_shaders/background.osl

This file was deleted.

Loading

0 comments on commit 824f4d9

Please sign in to comment.