149 for(
S32 i = 0; i < m_batchRays->getSize()/numRaysPerPrimary; i++)
164 for (
int j = 0; j < numRaysPerPrimary; j++)
204 color *= 1.0f / (
F32)numRaysPerPrimary;
208 int tri = primaryResult.
id;
216 float coeficient = 1.0f;
218 color = pixelColor + color*coeficient;
381 if (value < minVal) value = minVal;
382 if (value > maxVal) value = maxVal;
384 float ratio = (value - minVal)/(maxVal - minVal);
386 const float MAX_COLOR_VALUE = 0.98f;
388 switch ((
int)((ratio)*3.9999
f)) {
392 val.y = ratio * 4.0f * MAX_COLOR_VALUE;
393 val.z = MAX_COLOR_VALUE;
396 FW_ASSERT( (ratio >= 0.25f) && (ratio <= 0.5f) );
398 val.y = MAX_COLOR_VALUE;
399 val.z = MAX_COLOR_VALUE * (1.0f - 4.0f*(ratio-0.25f));
402 FW_ASSERT( (ratio >= 0.5f) && (ratio <= 0.75f) );
403 val.x = (ratio-0.5f) * 4.0f * MAX_COLOR_VALUE;
404 val.y = MAX_COLOR_VALUE;
408 FW_ASSERT( (ratio >= 0.75f) && (ratio <= 1.f) );
409 val.x = MAX_COLOR_VALUE;
410 val.y = MAX_COLOR_VALUE * (1.0f - 4.0f*(ratio-0.75f));
461 if (value < minVal) value = minVal;
462 if (value > maxVal) value = maxVal;
464 float ratio = (value - minVal)/(maxVal - minVal);
466 const float minColorRed = 0.0f;
467 const float minColorGreen = 0.0f;
468 const float minColorBlue = 0.0f;
470 const float maxColorRed = 1.0f;
471 const float maxColorGreen = 1.0f;
472 const float maxColorBlue = 1.0f;
474 val.x = maxColorRed * ratio + (1.0f-ratio)*minColorRed;
475 val.y = maxColorGreen * ratio + (1.0f-ratio)*minColorGreen;
476 val.z = maxColorBlue * ratio + (1.0f-ratio)*minColorBlue;
Buffer & getTriMaterialColorBuffer(void)
Returns material color buffer.
S32 getSize() const
Gets size of the buffer (number of rays).
Array< AABB > empty_boxes
Information about boxes with no triangles inside.
S32 getIDForSlot(S32 slot) const
Gets an id for a given ray slot.
Buffer & getIDToSlotBuffer()
Gets buffer mapping ids to slots.
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value CUfunction int CUtexref hTexRef CUfunction int int grid_height CUevent unsigned int Flags CUevent hEvent CUevent hEvent CUstream unsigned int Flags CUstream hStream GLuint bufferobj unsigned int CUdevice dev CUdeviceptr unsigned int CUmodule const char name CUdeviceptr unsigned int bytesize CUdeviceptr dptr void unsigned int bytesize void CUdeviceptr unsigned int ByteCount CUarray unsigned int CUdeviceptr unsigned int ByteCount CUarray unsigned int const void unsigned int ByteCount CUarray unsigned int CUarray unsigned int unsigned int ByteCount void CUarray unsigned int unsigned int CUstream hStream const CUDA_MEMCPY2D pCopy CUdeviceptr const void unsigned int CUstream hStream const CUDA_MEMCPY2D CUstream hStream CUdeviceptr unsigned char unsigned int N CUdeviceptr unsigned int unsigned int N CUdeviceptr unsigned int unsigned short unsigned int unsigned int Height CUarray const CUDA_ARRAY_DESCRIPTOR pAllocateArray CUarray const CUDA_ARRAY3D_DESCRIPTOR pAllocateArray unsigned int CUtexref CUdeviceptr unsigned int bytes CUcontext unsigned int CUdevice device GLenum texture GLenum GLuint buffer GLenum GLuint renderbuffer GLenum GLsizeiptr const GLvoid GLenum usage GLuint shader GLenum type GLsizei const GLuint framebuffers GLsizei const GLuint renderbuffers GLuint v GLuint v GLenum GLenum GLenum GLuint GLint level GLsizei GLuint framebuffers GLuint const GLchar name GLenum GLintptr GLsizeiptr GLvoid data GLuint GLenum GLint param GLuint GLenum GLint param GLhandleARB programObj GLenum GLenum GLsizei GLsizei height GLenum GLint GLint GLsizei GLsizei GLsizei GLint GLenum GLenum const GLvoid pixels GLint GLsizei const GLfloat value GLint GLfloat GLfloat v1 GLint GLfloat GLfloat GLfloat v2 GLint GLsizei const GLfloat value GLint GLsizei GLboolean const GLfloat value GLuint program GLuint GLfloat GLfloat GLfloat z GLuint GLint GLenum GLboolean GLsizei const GLvoid pointer GLuint GLuint const GLchar name GLenum GLsizei GLenum GLsizei GLsizei height GLenum GLuint renderbuffer GLenum GLenum GLint * params
virtual bool nextBatch(void)
CPURenderer(Environment *env)
virtual int getTotalNumRays(void)
Structure holding ray statistics. Also provides print to the console. These statistics are used in a ...
const U8 * getPtr(S64 ofs=0)
Buffer & getTriShadedColorBuffer(void)
Returns shaded color buffer.
Vec4f getPseudoColor(F32 value, F32 minVal, F32 maxVal)
U8 * getMutablePtr(S64 ofs=0)
void setVec4f(const Vec2i &pos, const Vec4f &value)
virtual void updateResult(void)
Buffer & getBuffer(void) const
const Vec2i & getSize(void) const
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value CUfunction int CUtexref hTexRef CUfunction f
virtual void setParams(const Params ¶ms)
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value
const RayResult & getResultForSlot(S32 slot) const
Gets a ray result assigned to a given slot.
RayBuffer m_secondaryRays
virtual ~CPURenderer(void)
static Vec4f fromABGR(U32 abgr)
bool aoCPU(RayBuffer &orays, RayBuffer &irays, Scene &scene, int numSamples, float maxDist, bool &newBatch, U32 randomSeed=0)
Generates ao rays on the CPU. Batches rays if necessary.
Vec4f getDistanceColor(F32 value, F32 minVal, F32 maxVal)
BVH::BuildParams m_buildParams
void setNeedClosestHit(bool c)
Sets whether the closet hit is needed.
void mortonSort()
Performs morton sort.
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value CUfunction int CUtexref hTexRef CUfunction int int grid_height CUevent unsigned int Flags CUevent hEvent CUevent hEvent CUstream unsigned int Flags CUstream hStream GLuint bufferobj unsigned int CUdevice dev CUdeviceptr unsigned int CUmodule const char name CUdeviceptr unsigned int bytesize CUdeviceptr dptr void unsigned int bytesize void CUdeviceptr unsigned int ByteCount CUarray unsigned int CUdeviceptr unsigned int ByteCount CUarray unsigned int const void unsigned int ByteCount CUarray unsigned int CUarray unsigned int unsigned int ByteCount void CUarray unsigned int unsigned int CUstream hStream const CUDA_MEMCPY2D pCopy CUdeviceptr const void unsigned int CUstream hStream const CUDA_MEMCPY2D CUstream hStream CUdeviceptr unsigned char unsigned int N CUdeviceptr unsigned int unsigned int N CUdeviceptr unsigned int unsigned short unsigned int unsigned int Height CUarray const CUDA_ARRAY_DESCRIPTOR pAllocateArray CUarray const CUDA_ARRAY3D_DESCRIPTOR pAllocateArray unsigned int CUtexref CUdeviceptr unsigned int bytes CUcontext unsigned int CUdevice device GLenum texture GLenum GLuint buffer GLenum GLuint renderbuffer GLenum GLsizeiptr const GLvoid GLenum usage GLuint shader GLenum type GLsizei const GLuint framebuffers GLsizei const GLuint renderbuffers GLuint v GLuint v GLenum GLenum GLenum GLuint GLint level GLsizei GLuint framebuffers GLuint const GLchar name GLenum GLintptr GLsizeiptr GLvoid data GLuint GLenum GLint param GLuint GLenum GLint param GLhandleARB programObj GLenum GLenum GLsizei GLsizei height GLenum GLint GLint GLsizei GLsizei GLsizei GLint GLenum GLenum const GLvoid pixels GLint GLsizei const GLfloat value GLint GLfloat GLfloat v1 GLint GLfloat GLfloat GLfloat v2 GLint GLsizei const GLfloat value GLint GLsizei GLboolean const GLfloat value GLuint program GLuint GLfloat GLfloat GLfloat z GLuint GLint GLenum GLboolean GLsizei const GLvoid pointer GLuint GLuint color
bool twoTrees
Flag whether to build BVH from two separate trees.