import os
def create_technique_resource(material, resources):
+ # This operates on a Blender material, not a custom object
from .datafile import Resource, Statement
tech_res = Resource(material.name+".tech", "technique")
vec3 k_spec = fresnel_schlick(halfway, light, base_color, metalness);
vec3 k_diff = (1.0-k_spec)*(1.0-metalness);
- float denom = max(4.0*max(dot(normal, -look), 0.0)*max(dot(normal, light), 0.0), 0.001);
- return max(dot(normal, light), 0.0)*light_color*(k_diff*lambert_diffuse(base_color)+k_spec*ndist*geom/denom);
+ float spec_denom = max(4.0*max(dot(normal, -look), 0.0)*max(dot(normal, light), 0.0), 0.001);
+ return max(dot(normal, light), 0.0)*light_color*(k_diff*lambert_diffuse(base_color)+k_spec*ndist*geom/spec_denom);
}
vec3 cooktorrance_lighting(vec3 normal, vec3 look, vec3 base_color, float metalness, float roughness)
{
if(b<=0 || b>1)
throw invalid_argument("ColorCurve::set_brightness_response");
+ // Calculate an offset value to obtain a derivative of 1 at zero intensity.
float t = (b<1 ? pow(b, 1/(1-b)) : 0.0f);
shdata.uniform("brightness_response", b, t, pow(t, b));
}
image, negative values darken it. Zero is neutral. */
void set_exposure_adjust(float);
- /** Sets the exponent of the */
+ /** Sets the exponent of the brightness response curve. It must be greater
+ than zero and at most one. A value of one gives a linear response; closer
+ to zero results in a more gentle curve. */
void set_brightness_response(float);
/** Sets the gamma value used for mapping output colors. Allowed range is
EnvironmentMap(Resources &, unsigned size, Renderable &rend, Renderable &env);
void set_depth_clip(float, float);
+
+ /** Sets the interval in frames between environment map updates. A value of
+ 0 means an update is only done when manually requested. */
void set_update_interval(unsigned);
+
+ /** Request that the environment map is updated on the next frame. */
void queue_update();
virtual void setup_frame(Renderer &);
Id zero_id = get_constant_id(get_id(elem), 0.0f);
for(unsigned i=0; i<n_columns; ++i)
{
- column_ids[i] = begin_expression(OP_COMPOSITE_CONSTRUCT, col_type_id, n_rows);;
+ column_ids[i] = begin_expression(OP_COMPOSITE_CONSTRUCT, col_type_id, n_rows);
for(unsigned j=0; j<n_rows; ++j)
writer.write(j==i ? argument_ids[0] : zero_id);
end_expression(OP_COMPOSITE_CONSTRUCT);