Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/kernel/kernel_subsurface.h
| Show First 20 Lines • Show All 422 Lines • ▼ Show 20 Lines | for (int bounce = 0; bounce < BSSRDF_MAX_BOUNCES; bounce++) { | ||||
| float sample_sigma_t = kernel_volume_channel_get(sigma_t, channel); | float sample_sigma_t = kernel_volume_channel_get(sigma_t, channel); | ||||
| float t = -logf(1.0f - rdist) / sample_sigma_t; | float t = -logf(1.0f - rdist) / sample_sigma_t; | ||||
| ray->t = t; | ray->t = t; | ||||
| scene_intersect_local(kg, ray, ss_isect, sd->object, NULL, 1); | scene_intersect_local(kg, ray, ss_isect, sd->object, NULL, 1); | ||||
| hit = (ss_isect->num_hits > 0); | hit = (ss_isect->num_hits > 0); | ||||
| if (hit) { | if (hit) { | ||||
| #ifdef __KERNEL_OPTIX__ | |||||
| /* t is always in world space with OptiX. */ | |||||
| t = ss_isect->hits[0].t; | |||||
| #else | |||||
| /* Compute world space distance to surface hit. */ | /* Compute world space distance to surface hit. */ | ||||
| float3 D = ray->D; | float3 D = ray->D; | ||||
| object_inverse_dir_transform(kg, sd, &D); | object_inverse_dir_transform(kg, sd, &D); | ||||
| D = normalize(D) * ss_isect->hits[0].t; | D = normalize(D) * ss_isect->hits[0].t; | ||||
| object_dir_transform(kg, sd, &D); | object_dir_transform(kg, sd, &D); | ||||
| t = len(D); | t = len(D); | ||||
| #endif | |||||
| } | } | ||||
| /* Advance to new scatter location. */ | /* Advance to new scatter location. */ | ||||
| ray->P += t * ray->D; | ray->P += t * ray->D; | ||||
| /* Update throughput. */ | /* Update throughput. */ | ||||
| float3 transmittance = volume_color_transmittance(sigma_t, t); | float3 transmittance = volume_color_transmittance(sigma_t, t); | ||||
| float pdf = dot(channel_pdf, (hit) ? transmittance : sigma_t * transmittance); | float pdf = dot(channel_pdf, (hit) ? transmittance : sigma_t * transmittance); | ||||
| ▲ Show 20 Lines • Show All 57 Lines • Show Last 20 Lines | |||||