Text archives Help
- From: "Thiago Ize" <
>
- To:
- Subject: [Manta] r2284 - trunk/Engine/Renderers
- Date: Sat, 7 Jun 2008 19:28:32 -0600 (MDT)
Author: thiago
Date: Sat Jun 7 19:28:31 2008
New Revision: 2284
Modified:
trunk/Engine/Renderers/KajiyaPathtracer.cc
trunk/Engine/Renderers/KajiyaPathtracer.h
Log:
Engine/Renderers/KajiyaPathtracer:
-Replaced total_attenuation with RayPacket's importance.
This does the same thing, and shouldn't cause any
conflicts with the previous way importance was used.
Modified: trunk/Engine/Renderers/KajiyaPathtracer.cc
==============================================================================
--- trunk/Engine/Renderers/KajiyaPathtracer.cc (original)
+++ trunk/Engine/Renderers/KajiyaPathtracer.cc Sat Jun 7 19:28:31 2008
@@ -118,8 +118,6 @@
Packet<Color> result;
result.fill(rays.begin(), rays.end(), Color::black());
- Packet<Color> total_attenuation;
- total_attenuation.fill(rays.begin(), rays.end(), Color::white());
Packet<Color> reflectance;
Packet<int> permute;
@@ -140,13 +138,13 @@
PreSortMode psm = depth >=
static_cast<int>(presort_mode.size())?presort_mode[presort_mode.size()-1]:presort_mode[depth];
switch(psm){
case PreSortOrigin:
- presort_origin(context, rays, result, total_attenuation, permute);
+ presort_origin(context, rays, result, permute);
break;
case PreSortDirection:
- presort_direction(context, rays, result, total_attenuation, permute);
+ presort_direction(context, rays, result, permute);
break;
case PreSort5D:
- presort_5d(context, rays, result, total_attenuation, permute);
+ presort_5d(context, rays, result, permute);
break;
case PreSortNone:
default:
@@ -165,14 +163,14 @@
MatlSortMode msm = depth >=
static_cast<int>(matlsort_mode.size())?matlsort_mode[matlsort_mode.size()-1]:matlsort_mode[depth];
switch(msm){
case MatlSortSweep:
- matlsort_sweep(context, rays, result, total_attenuation, reflectance,
permute);
+ matlsort_sweep(context, rays, result, reflectance, permute);
break;
case MatlSortFull:
- matlsort_full(context, rays, result, total_attenuation, permute);
+ matlsort_full(context, rays, result, permute);
break;
case MatlSortBackgroundSweep:
default:
- matlsort_bgsweep(context, rays, result, total_attenuation, permute);
+ matlsort_bgsweep(context, rays, result, permute);
break;
}
if(rays.begin() == rays.end())
@@ -195,7 +193,7 @@
// Propagate reflectance
for(int i=rays.begin();i<rays.end();i++){
for(int j=0;j<3;j++)
- total_attenuation.colordata[j][i] *= reflectance.colordata[j][i];
+ data->importance[j][i] *= reflectance.colordata[j][i];
}
rays.flags &= ~(RayPacket::HaveCornerRays |
RayPacket::HaveInverseDirections | RayPacket::HaveSigns);
@@ -227,7 +225,7 @@
// TODO(boulos): Replace this with BSDFEval
const double weight=Dot(normal, light_dir);
const Color light_color = shadowRays.getColor(i);
- result.set(i, result.get(i) + total_attenuation.get(i) *
light_color * weight);
+ result.set(i, result.get(i) + rays.getImportance(i) * light_color
* weight);
}
}
} while(!shadowState.done());
@@ -242,7 +240,7 @@
switch(rrm){
case RussianRouletteFull:
if(depth != maxdepth-1)
- russian_roulette_full(context, rays, result, total_attenuation,
reflectance, permute);
+ russian_roulette_full(context, rays, result, reflectance, permute);
break;
case RussianRouletteNone:
default:
@@ -279,7 +277,7 @@
for(int i = rays.begin(); i < rays.end(); i++){
for(int j=0;j<3;j++)
- result.colordata[j][i] += data->color[j][i] *
total_attenuation.colordata[j][i];
+ result.colordata[j][i] += data->color[j][i] * data->importance[j][i];
}
}
@@ -289,7 +287,7 @@
context.scene->getBackground()->shade(context, subPacket);
for(int i=originalBegin;i<rays.begin();i++){
for(int j=0;j<3;j++)
- result.colordata[j][i] += data->color[j][i] *
total_attenuation.colordata[j][i];
+ result.colordata[j][i] += data->color[j][i] * data->importance[j][i];
}
}
@@ -306,7 +304,6 @@
void KajiyaPathtracer::matlsort_full(const RenderContext& context,
RayPacket& rays,
Packet<Color>& result,
- Packet<Color>& total_attenuation,
Packet<int>& permute)
{
// Sort the rays based on the material that they hit
@@ -368,10 +365,6 @@
for(int k=0;k<3;k++)
swap(result.colordata[k], i, j);
- // Move total attenuation
- for(int k=0;k<3;k++)
- swap(total_attenuation.colordata[k], i, j);
-
// Move permute
swap(permute.data, i, j);
}
@@ -386,7 +379,6 @@
void KajiyaPathtracer::russian_roulette_full(const RenderContext& context,
RayPacket& rays,
Packet<Color>& result,
- Packet<Color>&
total_attenuation,
Packet<Color>& reflectance,
Packet<int>& permute)
{
@@ -440,11 +432,6 @@
for(int j=0;j<3;j++)
swap(reflectance.colordata[j], i, newEnd);
- // Move total attenuation
- // Look at one-way move optimization
- for(int j=0;j<3;j++)
- swap(total_attenuation.colordata[j], i, newEnd);
-
// Move rr
// Look at one-way move optimization
swap(rr.data, i, newEnd);
@@ -464,24 +451,23 @@
for(int j=0;j<3;j++)
reflectance.colordata[j][i] *= scale;
for(int j=0;j<3;j++)
- total_attenuation.colordata[j][i] *= scale;
+ rays.data->importance[j][i] *= scale;
}
rays.resize(rays.begin(), newEnd+1);
}
-void KajiyaPathtracer::presort_origin(const RenderContext&, RayPacket&,
Packet<Color>&, Packet<Color>&, Packet<int>&)
+void KajiyaPathtracer::presort_origin(const RenderContext&, RayPacket&,
Packet<Color>&, Packet<int>&)
{
NOT_FINISHED("KajiyaPathtracer::traceEyeRays");
}
void KajiyaPathtracer::matlsort_sweep(const RenderContext& context,
RayPacket& rays,
Packet<Color>& result,
- Packet<Color>& total_attenuation,
Packet<Color>& reflectance,
Packet<int>& permute)
{
- matlsort_bgsweep(context, rays, result, total_attenuation, permute);
+ matlsort_bgsweep(context, rays, result, permute);
// Sort the rays into two groups - those that hit an object
// and those that hit the background. The background rays should
// be first, so those are processed first by the bgsweep.
@@ -551,10 +537,6 @@
for(int k=0;k<3;k++)
swap(result.colordata[k], i, j);
- // Move total attenuation
- for(int k=0;k<3;k++)
- swap(total_attenuation.colordata[k], i, j);
-
// Move permute
swap(permute.data, i, j);
i++;
@@ -568,19 +550,18 @@
}
}
-void KajiyaPathtracer::presort_direction(const RenderContext&, RayPacket&,
Packet<Color>&, Packet<Color>&, Packet<int>&)
+void KajiyaPathtracer::presort_direction(const RenderContext&, RayPacket&,
Packet<Color>&, Packet<int>&)
{
NOT_FINISHED("KajiyaPathtracer::presort_direction");
}
-void KajiyaPathtracer::presort_5d(const RenderContext&, RayPacket&,
Packet<Color>&, Packet<Color>&, Packet<int>&)
+void KajiyaPathtracer::presort_5d(const RenderContext&, RayPacket&,
Packet<Color>&, Packet<int>&)
{
NOT_FINISHED("KajiyaPathtracer::presort_5d");
}
void KajiyaPathtracer::matlsort_bgsweep(const RenderContext&, RayPacket&
rays,
Packet<Color>& result,
- Packet<Color>& total_attenuation,
Packet<int>& permute)
{
// Sort the rays into two groups - those that hit an object
@@ -640,10 +621,6 @@
// Move result
for(int k=0;k<3;k++)
swap(result.colordata[k], i, newBegin);
-
- // Move total attenuation
- for(int k=0;k<3;k++)
- swap(total_attenuation.colordata[k], i, newBegin);
// Move permute
swap(permute.data, i, newBegin);
Modified: trunk/Engine/Renderers/KajiyaPathtracer.h
==============================================================================
--- trunk/Engine/Renderers/KajiyaPathtracer.h (original)
+++ trunk/Engine/Renderers/KajiyaPathtracer.h Sat Jun 7 19:28:31 2008
@@ -47,22 +47,21 @@
bool do_ambient_on_maxdepth;
void presort_origin(const RenderContext& context, RayPacket& rays,
Packet<Color>& result,
- Packet<Color>& total_attenuation, Packet<int>&
permute);
+ Packet<int>& permute);
void presort_direction(const RenderContext& context, RayPacket& rays,
Packet<Color>& result,
- Packet<Color>& total_attenuation, Packet<int>&
permute);
+ Packet<int>& permute);
void presort_5d(const RenderContext& context, RayPacket& rays,
Packet<Color>& result,
- Packet<Color>& total_attenuation, Packet<int>& permute);
+ Packet<int>& permute);
void matlsort_sweep(const RenderContext& context, RayPacket& rays,
Packet<Color>& result,
- Packet<Color>& total_attenuation, Packet<Color>&
reflectance, Packet<int>& permute);
+ Packet<Color>& reflectance, Packet<int>& permute);
void matlsort_bgsweep(const RenderContext& context, RayPacket& rays,
Packet<Color>& result,
- Packet<Color>& total_attenuation, Packet<int>&
permute);
+ Packet<int>& permute);
void matlsort_full(const RenderContext& context, RayPacket& rays,
Packet<Color>& result,
- Packet<Color>& total_attenuation, Packet<int>&
permute);
+ Packet<int>& permute);
void russian_roulette_full(const RenderContext& context, RayPacket&
rays, Packet<Color>& result,
- Packet<Color>& total_attenuation,
Packet<Color>& reflectance,
- Packet<int>& permute);
+ Packet<Color>& reflectance, Packet<int>&
permute);
};
}
- [Manta] r2284 - trunk/Engine/Renderers, Thiago Ize, 06/07/2008
Archive powered by MHonArc 2.6.16.