Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/blender/blender_shader.cpp
| Show First 20 Lines • Show All 1,360 Lines • ▼ Show 20 Lines | else if (!new_viewport_parameters.use_scene_world) { | ||||
| graph->add(mix_scene_with_background); | graph->add(mix_scene_with_background); | ||||
| EnvironmentTextureNode *texture_environment = new EnvironmentTextureNode(); | EnvironmentTextureNode *texture_environment = new EnvironmentTextureNode(); | ||||
| texture_environment->tex_mapping.type = TextureMapping::VECTOR; | texture_environment->tex_mapping.type = TextureMapping::VECTOR; | ||||
| texture_environment->tex_mapping.rotation[2] = new_viewport_parameters.studiolight_rotate_z; | texture_environment->tex_mapping.rotation[2] = new_viewport_parameters.studiolight_rotate_z; | ||||
| texture_environment->filename = new_viewport_parameters.studiolight_path; | texture_environment->filename = new_viewport_parameters.studiolight_path; | ||||
| graph->add(texture_environment); | graph->add(texture_environment); | ||||
| MixNode *mix_intensity = new MixNode(); | |||||
| mix_intensity->type = NODE_MIX_MUL; | |||||
| mix_intensity->fac = 1.0f; | |||||
| mix_intensity->color2 = make_float3(new_viewport_parameters.studiolight_intensity, | |||||
| new_viewport_parameters.studiolight_intensity, | |||||
| new_viewport_parameters.studiolight_intensity); | |||||
| graph->add(mix_intensity); | |||||
brecht: Remove this comment and `#if 0`, fac is indeed the mixing factor and it's the two colors that… | |||||
| TextureCoordinateNode *texture_coordinate = new TextureCoordinateNode(); | TextureCoordinateNode *texture_coordinate = new TextureCoordinateNode(); | ||||
| graph->add(texture_coordinate); | graph->add(texture_coordinate); | ||||
| MixNode *mix_background_with_environment = new MixNode(); | MixNode *mix_background_with_environment = new MixNode(); | ||||
| mix_background_with_environment->fac = new_viewport_parameters.studiolight_background_alpha; | mix_background_with_environment->fac = new_viewport_parameters.studiolight_background_alpha; | ||||
| mix_background_with_environment->color1 = get_float3(b_world.color()); | mix_background_with_environment->color1 = get_float3(b_world.color()); | ||||
| graph->add(mix_background_with_environment); | graph->add(mix_background_with_environment); | ||||
| ShaderNode *out = graph->output(); | ShaderNode *out = graph->output(); | ||||
| graph->connect(texture_coordinate->output("Generated"), | graph->connect(texture_coordinate->output("Generated"), | ||||
| texture_environment->input("Vector")); | texture_environment->input("Vector")); | ||||
| graph->connect(texture_environment->output("Color"), mix_intensity->input("Color1")); | |||||
| graph->connect(light_path->output("Is Camera Ray"), mix_scene_with_background->input("Fac")); | graph->connect(light_path->output("Is Camera Ray"), mix_scene_with_background->input("Fac")); | ||||
| graph->connect(texture_environment->output("Color"), | graph->connect(mix_intensity->output("Color"), mix_scene_with_background->input("Color1")); | ||||
| mix_scene_with_background->input("Color1")); | graph->connect(mix_intensity->output("Color"), | ||||
| graph->connect(texture_environment->output("Color"), | |||||
| mix_background_with_environment->input("Color2")); | mix_background_with_environment->input("Color2")); | ||||
| graph->connect(mix_background_with_environment->output("Color"), | graph->connect(mix_background_with_environment->output("Color"), | ||||
| mix_scene_with_background->input("Color2")); | mix_scene_with_background->input("Color2")); | ||||
| graph->connect(mix_scene_with_background->output("Color"), background->input("Color")); | graph->connect(mix_scene_with_background->output("Color"), background->input("Color")); | ||||
| graph->connect(background->output("Background"), out->input("Surface")); | graph->connect(background->output("Background"), out->input("Surface")); | ||||
| } | } | ||||
| if (b_world) { | if (b_world) { | ||||
| ▲ Show 20 Lines • Show All 112 Lines • Show Last 20 Lines | |||||
Remove this comment and #if 0, fac is indeed the mixing factor and it's the two colors that are multiplied together. That's by design.