[Bf-cycles] Problem with light setup

Philipp Korablev korablevph at gmail.com
Tue May 3 20:25:41 CEST 2016

Hi there

I am not sure that this is the right place for the question, but
nevertheless. I have the following problem with cycles renderer light
system. I try to create the scene and render it by code. The problem with
lights. I add the light to the scene by the following code:
//Create light shader and add it to the scene
    ccl::Light *light = new ccl::Light();
    ccl::Shader *shader = new ccl::Shader();
    shader->name = "lightShader";
    ShaderGraph *graph = new ShaderGraph();
    ShaderNode *emNode = graph->add(new EmissionNode());
    emNode->input("Color")->value = make_float3(1.0, 1.0, 1.0);
    emNode->input("Strength")->value.x = 100;
    ShaderNode *out = graph->output();
    graph->connect(emNode->output("Emission"), out->input("Surface"));
    light->shader = scene->shaders.size() - 1;
//Next set light object properties
    light->type = LightType::LIGHT_POINT;
    light->samples = 50;
    light->size = 0.1;
    light->cast_shadow = true;
    light->use_mis = true;
    light->max_bounces = true;
    light->use_diffuse = true;
    light->use_glossy = true;
    light->use_transmission = true;
    light->use_scatter = true;
//Set position and direction
    light->dir = make_float3(1.0, 1.0, 1.0);
    light->co = make_float3(0.0, 0.0, 3.0);
    Transform tfm = transform_identity();
    light->co = transform_point(&tfm, light->co);
//Add light to the scene

But when I start the render, the result is completely black. If I add the
background to the scene with some color, then I see the objects on the
scene (with some simple bsdf shader), illuminated by background. And there
is no effect from the light.

So, the question: how properly setup lights for rendering in cycles?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.blender.org/pipermail/bf-cycles/attachments/20160503/283a542e/attachment.htm 

More information about the Bf-cycles mailing list