[Bf-cycles] Problem with light setup

Nathan Letwory nathan at mcneel.com
Mon May 9 10:04:40 CEST 2016


Are you sure your light isn't inside geometry you have added?

/Nathan

On 5/3/2016 9:25 PM, Philipp Korablev wrote:
> 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"));
>     shader->set_graph(graph);
>     shader->tag_update(scene);
>     scene->shaders.push_back(shader);
>     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
>     light->tag_update(scene);
>     scene->lights.push_back(light);
> 
> 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?
> 
> 
> _______________________________________________
> Bf-cycles mailing list
> Bf-cycles at blender.org
> https://lists.blender.org/mailman/listinfo/bf-cycles
> 


-- 
Nathan Letwory

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
Url : http://lists.blender.org/pipermail/bf-cycles/attachments/20160509/946af850/attachment.pgp 


More information about the Bf-cycles mailing list