Fix issue in with multiple importance sampling in recent code refactor.
This commit is contained in:
@@ -233,7 +233,9 @@ void LightManager::device_update_distribution(Device *device, DeviceScene *dscen
|
|||||||
/* count triangles */
|
/* count triangles */
|
||||||
if(have_emission) {
|
if(have_emission) {
|
||||||
for(size_t i = 0; i < mesh->triangles.size(); i++) {
|
for(size_t i = 0; i < mesh->triangles.size(); i++) {
|
||||||
Shader *shader = scene->shaders[mesh->shader[i]];
|
int shader_index = mesh->shader[i];
|
||||||
|
Shader *shader = (shader_index < mesh->used_shaders.size()) ?
|
||||||
|
mesh->used_shaders[shader_index] : scene->default_surface;
|
||||||
|
|
||||||
if(shader->use_mis && shader->has_surface_emission)
|
if(shader->use_mis && shader->has_surface_emission)
|
||||||
num_triangles++;
|
num_triangles++;
|
||||||
@@ -303,7 +305,9 @@ void LightManager::device_update_distribution(Device *device, DeviceScene *dscen
|
|||||||
}
|
}
|
||||||
|
|
||||||
for(size_t i = 0; i < mesh->triangles.size(); i++) {
|
for(size_t i = 0; i < mesh->triangles.size(); i++) {
|
||||||
Shader *shader = scene->shaders[mesh->shader[i]];
|
int shader_index = mesh->shader[i];
|
||||||
|
Shader *shader = (shader_index < mesh->used_shaders.size()) ?
|
||||||
|
mesh->used_shaders[shader_index] : scene->default_surface;
|
||||||
|
|
||||||
if(shader->use_mis && shader->has_surface_emission) {
|
if(shader->use_mis && shader->has_surface_emission) {
|
||||||
distribution[offset].x = totarea;
|
distribution[offset].x = totarea;
|
||||||
|
@@ -62,7 +62,9 @@ bool MeshManager::displace(Device *device, DeviceScene *dscene, Scene *scene, Me
|
|||||||
|
|
||||||
for(size_t i = 0; i < mesh->triangles.size(); i++) {
|
for(size_t i = 0; i < mesh->triangles.size(); i++) {
|
||||||
Mesh::Triangle t = mesh->triangles[i];
|
Mesh::Triangle t = mesh->triangles[i];
|
||||||
Shader *shader = scene->shaders[mesh->shader[i]];
|
int shader_index = mesh->shader[i];
|
||||||
|
Shader *shader = (shader_index < mesh->used_shaders.size()) ?
|
||||||
|
mesh->used_shaders[shader_index] : scene->default_surface;
|
||||||
|
|
||||||
if(!shader->has_displacement)
|
if(!shader->has_displacement)
|
||||||
continue;
|
continue;
|
||||||
@@ -146,7 +148,9 @@ bool MeshManager::displace(Device *device, DeviceScene *dscene, Scene *scene, Me
|
|||||||
Attribute *attr_mP = mesh->attributes.find(ATTR_STD_MOTION_VERTEX_POSITION);
|
Attribute *attr_mP = mesh->attributes.find(ATTR_STD_MOTION_VERTEX_POSITION);
|
||||||
for(size_t i = 0; i < mesh->triangles.size(); i++) {
|
for(size_t i = 0; i < mesh->triangles.size(); i++) {
|
||||||
Mesh::Triangle t = mesh->triangles[i];
|
Mesh::Triangle t = mesh->triangles[i];
|
||||||
Shader *shader = scene->shaders[mesh->shader[i]];
|
int shader_index = mesh->shader[i];
|
||||||
|
Shader *shader = (shader_index < mesh->used_shaders.size()) ?
|
||||||
|
mesh->used_shaders[shader_index] : scene->default_surface;
|
||||||
|
|
||||||
if(!shader->has_displacement)
|
if(!shader->has_displacement)
|
||||||
continue;
|
continue;
|
||||||
|
Reference in New Issue
Block a user