Lights not working. Where am I wrong?

Hi,

When I set background->use_ao= false, then this is how it is getting displayed.

When I set it to true, this is how it is getting displayed.

This is a room and the front side is open. There is a light on the ceiling.

What am I doing wrong?

Please help.

Thanks in advance.

Hi @brecht,
Any solution you can suggest me?

Thanks a lot in advance

Hi @jesterKing,

This is the only blocker I have from get going. Can you please give me any clue?

Thanks

Hi, add the .blend and the Blender version you use, please.
It is nearly impossible to help without.
You can upload Blender files up to 30 MB on Pastall.

https://pasteall.org/blend/

Cheers, mib

1 Like

@mib2berlin this is about using Cycles outside of Blender.

@Subrahmanya we can’t tell what is wrong here. Clearly the light is not working, but without information about how that light is added we can’t tell. Look at how lights are exported in standalone, in the Blender integration, check if you are missing something.

2 Likes

Hi @mib2berlin and @brecht,

Thanks for your response.

I am actually building the cycles scene with code. So, no blender file.

I have JSON representation of my scene. As the above link supports uploading only .blend files, I am pasting the content here. It is a very small scene. You need not look into the geometry part. If you look at shaders and lights, you will understand what is wrong with my scene.

Thanks in advance.

{
	"film": {
		"name": "film"
	},
	"integrator": {
		"name": "integrator"
	},
	"shaders": [{
			"name": "default_surface",
			"graph": {
				"nodes": [{
						"_type": "output",
						"name": "output"
					}, {
						"_type": "diffuse_bsdf",
						"name": "diffuse_bsdf"
					}
				],
				"flows": [{
						"from": "diffuse_bsdf",
						"out_socket": "BSDF",
						"to": "output",
						"in_socket": "Surface"
					}
				]
			}
		}, {
			"name": "default_volume",
			"graph": {
				"nodes": [{
						"_type": "output",
						"name": "output"
					}, {
						"_type": "principled_volume",
						"name": "principled_volume",
						"density_attribute": "density",
						"temperature_attribute": "temperature"
					}
				],
				"flows": [{
						"from": "principled_volume",
						"out_socket": "Volume",
						"to": "output",
						"in_socket": "Volume"
					}
				]
			}
		}, {
			"name": "default_light",
			"graph": {
				"nodes": [{
						"_type": "output",
						"name": "output"
					}, {
						"_type": "emission",
						"name": "emission",
						"strength": 0.0
					}
				],
				"flows": [{
						"from": "emission",
						"out_socket": "Emission",
						"to": "output",
						"in_socket": "Surface"
					}
				]
			}
		}, {
			"name": "default_background",
			"volume_sampling_method": "equiangular",
			"graph": {
				"nodes": [{
						"_type": "output",
						"name": "output"
					}, {
						"_type": "background_shader",
						"name": "background_shader",
						"color": [0.05, 0.05, 0.05]
					}, {
						"_type": "environment_texture",
						"name": "environment_texture",
						"tex_mapping.type": "point",
						"filename": "flower_road_8k.hdr",
						"colorspace": "Linear",
						"alpha_type": "associated"
					}
				],
				"flows": [{
						"from": "background_shader",
						"out_socket": "Background",
						"to": "output",
						"in_socket": "Surface"
					}, {
						"from": "environment_texture",
						"out_socket": "Color",
						"to": "background_shader",
						"in_socket": "Color"
					}
				]
			}
		}, {
			"name": "default_empty",
			"graph": {
				"nodes": [{
						"_type": "output",
						"name": "output"
					}
				],
				"flows": []
			}
		}, {
			"name": "WhiteWall",
			"graph": {
				"nodes": [{
						"_type": "output",
						"name": "output"
					}, {
						"_type": "principled_bsdf",
						"name": "principled_bsdf",
						"base_color": [0.875, 0.823, 0.679],
						"subsurface_radius": [1.0, 0.2, 0.1],
						"specular": 0.5,
						"roughness": 0.552,
						"ior": 1.45,
						"emission": [0.0, 0.0, 0.0]
					}, {
						"_type": "normal_map",
						"name": "normal_map",
						"color": [0.5, 0.5, 1.0]
					}
				],
				"flows": [{
						"from": "principled_bsdf",
						"out_socket": "BSDF",
						"to": "output",
						"in_socket": "Surface"
					}, {
						"from": "normal_map",
						"out_socket": "Normal",
						"to": "principled_bsdf",
						"in_socket": "Normal"
					}
				]
			}
		}, {
			"name": "lambert3",
			"graph": {
				"nodes": [{
						"_type": "output",
						"name": "output"
					}, {
						"_type": "principled_bsdf",
						"name": "principled_bsdf",
						"base_color": [0.0, 1.0, 0.0],
						"subsurface_radius": [1.0, 0.2, 0.1],
						"specular": 0.5,
						"roughness": 0.552,
						"ior": 1.45,
						"emission": [0.0, 0.0, 0.0]
					}, {
						"_type": "normal_map",
						"name": "normal_map",
						"color": [0.5, 0.5, 1.0]
					}
				],
				"flows": [{
						"from": "principled_bsdf",
						"out_socket": "BSDF",
						"to": "output",
						"in_socket": "Surface"
					}, {
						"from": "normal_map",
						"out_socket": "Normal",
						"to": "principled_bsdf",
						"in_socket": "Normal"
					}
				]
			}
		}, {
			"name": "RedWall",
			"graph": {
				"nodes": [{
						"_type": "output",
						"name": "output"
					}, {
						"_type": "principled_bsdf",
						"name": "principled_bsdf",
						"base_color": [1.0, 0.0, 0.0],
						"subsurface_radius": [1.0, 0.2, 0.1],
						"specular": 0.5,
						"roughness": 0.552,
						"ior": 1.45,
						"emission": [0.0, 0.0, 0.0]
					}, {
						"_type": "normal_map",
						"name": "normal_map",
						"color": [0.5, 0.5, 1.0]
					}
				],
				"flows": [{
						"from": "principled_bsdf",
						"out_socket": "BSDF",
						"to": "output",
						"in_socket": "Surface"
					}, {
						"from": "normal_map",
						"out_socket": "Normal",
						"to": "principled_bsdf",
						"in_socket": "Normal"
					}
				]
			}
		}, {
			"name": "shader-color-1.000000-1.000000-1.000000",
			"graph": {
				"nodes": [{
						"_type": "output",
						"name": "output"
					}, {
						"_type": "emission",
						"name": "emission",
						"color": [1.0, 1.0, 1.0],
						"strength": 100.0
					}
				],
				"flows": [{
						"from": "emission",
						"out_socket": "Emission",
						"to": "output",
						"in_socket": "Surface"
					}
				]
			}
		}
	],
	"background": {
		"name": "background",
		"ao_factor": 1.0,
		"ao_distance": 0.1,
		"use_ao": true,
		"visibility": 4125
	},
	"camera": {
		"name": "camera1",
		"shutter_curve": [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 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0.048, 0.356], [0.048, 0.01, -0.998, 6.791], [-0.0, 0.999, 0.01, 1.492], [0.0, 0.0, 0.0, 1.0]],
		"fov": 0.563,
		"fov_pre": 0.563,
		"fov_post": 0.563,
		"viewplane.left": 5.333,
		"viewplane.right": 8.888,
		"viewplane.bottom": 3.0,
		"viewplane.top": 5.0,
		"border.right": 1.0,
		"border.top": 1.0
	},
	"lights": [{
			"name": "",
			"co": [0.065, 0.222, 3.084],
			"dir": [0.0, 0.0, -0.451],
			"size": 0.009,
			"tfm": [[-0.451, -0.0, -0.0, 0.065], [0.0, -0.451, -0.0, 0.222], [0.0, -0.0, 0.451, 3.084], [0.0, 0.0, 0.0, 1.0]],
			"use_mis": true,
			"shader": "shader-color-1.000000-1.000000-1.000000"
		}, {
			"name": "light",
			"type": "background",
			"use_mis": true,
			"shader": "default_background"
		}
	],
	"geometry": [{
			"_type": "mesh",
			"name": "pCube1",
			"indices": [8, 9, 10, 8, 10, 11, 11, 10, 12, 11, 12, 13, 13, 12, 14, 13, 14, 15, 14, 12, 10, 14, 10, 9, 13, 15, 8, 13, 8, 11, 2, 4, 5, 2, 5, 3, 4, 6, 7, 4, 7, 5, 6, 0, 1, 6, 1, 7, 1, 3, 5, 1, 5, 7, 6, 4, 2, 6, 2, 0, 2, 3, 9, 2, 9, 8, 1, 0, 15, 1, 15, 14, 3, 1, 14, 3, 14, 9, 0, 2, 8, 0, 8, 15],
			"verts": [[-173.386, 0.006, 402.266], [162.354, 0.006, 402.266], [-173.386, 310.006, 402.266], [162.354, 310.006, 402.266], [-173.386, 310.006, -171.548], [162.354, 310.006, -171.548], [-173.386, 0.006, -171.548], [162.354, 0.006, -171.548], [-180.358, 316.978, 402.266], [169.326, 316.978, 402.266], [170.405, 318.056, -179.598], [-181.437, 318.056, -179.598], [170.405, -8.044, -179.598], [-181.437, -8.044, -179.598], [169.326, -6.965, 402.266], [-180.358, -6.965, 402.266]],
			"shader_indices": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0],
			"smooths": [true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true],
			"atlas_uv_attribute_name": "map1",
			"diffuse_uv_attribute_name": "map1",
			"atlas_width": -842150451,
			"atlas_height": -842150451,
			"used_shaders": ["WhiteWall", "lambert3", "RedWall"],
			"attributes": [{
					"name": "map1",
					"_type": "UV",
					"values": [[0.375, 0.25], [0.625, 0.25], [0.625, 0.5], [0.625, 0.25], [0.625, 0.5], [0.375, 0.5], [0.375, 0.5], [0.625, 0.5], [0.625, 0.75], [0.625, 0.5], [0.625, 0.75], [0.375, 0.75], [0.375, 0.75], [0.625, 0.75], [0.625, 1.0], [0.625, 0.75], [0.625, 1.0], [0.375, 1.0], [0.625, 0.0], [0.875, 0.0], [0.875, 0.25], [0.875, 0.0], [0.875, 0.25], [0.625, 0.25], [0.125, 0.0], [0.375, 0.0], [0.375, 0.25], [0.375, 0.0], [0.375, 0.25], [0.125, 0.25], [0.375, 0.25], [0.375, 0.5], [0.625, 0.5], [0.375, 0.5], [0.625, 0.5], [0.625, 0.25], [0.375, 0.5], [0.375, 0.75], [0.625, 0.75], [0.375, 0.75], [0.625, 0.75], [0.625, 0.5], [0.375, 0.75], [0.375, 1.0], [0.625, 1.0], [0.375, 1.0], [0.625, 1.0], [0.625, 0.75], [0.625, 0.0], [0.625, 0.25], [0.875, 0.25], [0.625, 0.25], [0.875, 0.25], [0.875, 0.0], [0.125, 0.0], [0.125, 0.25], [0.375, 0.25], [0.125, 0.25], [0.375, 0.25], [0.375, 0.0], [0.375, 0.25], [0.625, 0.25], [0.625, 0.25], [0.625, 0.25], [0.625, 0.25], [0.375, 0.25], [0.625, 1.0], [0.375, 1.0], [0.375, 1.0], [0.375, 1.0], [0.375, 1.0], [0.625, 1.0], [0.625, 0.25], [0.625, 0.0], [0.625, 0.0], [0.625, 0.0], [0.625, 0.0], [0.625, 0.25], [0.375, 0.0], [0.375, 0.25], [0.375, 0.25], [0.375, 0.25], [0.375, 0.25], [0.375, 0.0]]
				}
			]
		}, {
			"_type": "mesh",
			"name": "pCube2",
			"indices": [0, 1, 3, 0, 3, 2, 2, 3, 5, 2, 5, 4, 4, 5, 7, 4, 7, 6, 6, 7, 1, 6, 1, 0, 1, 7, 5, 1, 5, 3, 6, 0, 2, 6, 2, 4],
			"verts": [[-0.5, -0.5, 0.5], [0.5, -0.5, 0.5], [-0.5, 0.5, 0.5], [0.5, 0.5, 0.5], [-0.5, 0.5, -0.5], [0.5, 0.5, -0.5], [-0.5, -0.5, -0.5], [0.5, -0.5, -0.5]],
			"shader_indices": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
			"smooths": [true, true, true, true, true, true, true, true, true, true, true, true],
			"atlas_uv_attribute_name": "map1",
			"diffuse_uv_attribute_name": "map1",
			"atlas_width": -842150451,
			"atlas_height": -842150451,
			"used_shaders": ["WhiteWall"],
			"attributes": [{
					"name": "map1",
					"_type": "UV",
					"values": [[0.375, 0.0], [0.625, 0.0], [0.625, 0.25], [0.625, 0.0], [0.625, 0.25], [0.375, 0.25], [0.375, 0.25], [0.625, 0.25], [0.625, 0.5], [0.625, 0.25], [0.625, 0.5], [0.375, 0.5], [0.375, 0.5], [0.625, 0.5], [0.625, 0.75], [0.625, 0.5], [0.625, 0.75], [0.375, 0.75], [0.375, 0.75], [0.625, 0.75], [0.625, 1.0], [0.625, 0.75], [0.625, 1.0], [0.375, 1.0], [0.625, 0.0], [0.875, 0.0], [0.875, 0.25], [0.875, 0.0], [0.875, 0.25], [0.625, 0.25], [0.125, 0.0], [0.375, 0.0], [0.375, 0.25], [0.375, 0.0], [0.375, 0.25], [0.125, 0.25]]
				}
			]
		}, {
			"_type": "mesh",
			"name": "pCube3",
			"indices": [0, 1, 3, 0, 3, 2, 2, 3, 5, 2, 5, 4, 4, 5, 7, 4, 7, 6, 6, 7, 1, 6, 1, 0, 1, 7, 5, 1, 5, 3, 6, 0, 2, 6, 2, 4],
			"verts": [[-0.5, -0.5, 0.5], [0.5, -0.5, 0.5], [-0.5, 0.5, 0.5], [0.5, 0.5, 0.5], [-0.5, 0.5, -0.5], [0.5, 0.5, -0.5], [-0.5, -0.5, -0.5], [0.5, -0.5, -0.5]],
			"shader_indices": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
			"smooths": [true, true, true, true, true, true, true, true, true, true, true, true],
			"atlas_uv_attribute_name": "map1",
			"diffuse_uv_attribute_name": "map1",
			"atlas_width": -842150451,
			"atlas_height": -842150451,
			"used_shaders": ["WhiteWall"],
			"attributes": [{
					"name": "map1",
					"_type": "UV",
					"values": [[0.375, 0.0], [0.625, 0.0], [0.625, 0.25], [0.625, 0.0], [0.625, 0.25], [0.375, 0.25], [0.375, 0.25], [0.625, 0.25], [0.625, 0.5], [0.625, 0.25], [0.625, 0.5], [0.375, 0.5], [0.375, 0.5], [0.625, 0.5], [0.625, 0.75], [0.625, 0.5], [0.625, 0.75], [0.375, 0.75], [0.375, 0.75], [0.625, 0.75], [0.625, 1.0], [0.625, 0.75], [0.625, 1.0], [0.375, 1.0], [0.625, 0.0], [0.875, 0.0], [0.875, 0.25], [0.875, 0.0], [0.875, 0.25], [0.625, 0.25], [0.125, 0.0], [0.375, 0.0], [0.375, 0.25], [0.375, 0.0], [0.375, 0.25], [0.125, 0.25]]
				}
			]
		}
	],
	"objects": [{
			"name": "pCube1_0",
			"geometry": "pCube1",
			"tfm": [[-0.009, -0.0, 0.0, 0.0], [0.0, -0.0, 0.009, 0.0], [0.0, 0.009, 0.0, 0.0], [0.0, 0.0, 0.0, 1.0]]
		}, {
			"name": "pCube2_1",
			"geometry": "pCube2",
			"tfm": [[-0.859, -0.0, 0.496, -0.527], [0.496, -0.0, 0.859, 0.537], [0.0, 1.276, 0.0, 0.638], [0.0, 0.0, 0.0, 1.0]]
		}, {
			"name": "pCube3_2",
			"geometry": "pCube3",
			"tfm": [[-0.509, -0.0, 0.599, 0.632], [0.599, -0.0, 0.509, -0.343], [0.0, 2.237, 0.0, 1.118], [0.0, 0.0, 0.0, 1.0]]
		}
	]
}

Session Parameters:

  session_params->device = get_device();
  session_params->background = false;
  session_params->samples = 100;
  session_params->experimental = false;
  session_params->progressive = true;
  session_params->start_resolution = 64;
  session_params->threads = 0;
  session_params->tile_size.x = 64;
  session_params->tile_size.y = 64;
  session_params->tile_order = TileOrder::TILE_CENTER;
  session_params->use_profiling = false;
  session_params->shadingsystem = ccl::ShadingSystem::SHADINGSYSTEM_SVM;

Scene Parameters:

  scene_params->shadingsystem = ShadingSystem::SHADINGSYSTEM_SVM;
  scene_params->bvh_type = SceneParams::BVH_STATIC;
  scene_params->background = true;
  scene_params->bvh_layout = BVHLayout::BVH_LAYOUT_BVH8;
  scene_params->bvh_type = SceneParams::BVHType::BVH_STATIC;
  scene_params->num_bvh_time_steps = 0;
  scene_params->persistent_data = false;
  scene_params->texture_limit = 0;
  scene_params->use_bvh_spatial_split = false;
  scene_params->use_bvh_unaligned_nodes = true;

The problem is fixed. I was adding a normalmap node without having any normals in my geometry. This was causing the issue.