TheCherno / RayTracing

YouTube ray tracing series
MIT License
366 stars 71 forks source link

m_AccumulationData of 'Renderer' class will not initialize to a value of 0 #7

Closed pan199612 closed 1 year ago

pan199612 commented 1 year ago

Background

In my PC (CPU I5-8400), debug mode m_AccumulationData of 'Renderer' class will not initialize to a value of 0

Process

The first 'Renderer::OnResize' event is not a problem: Because the value of 'm_FrameIndex' is 1, 'memset' will be called to initialize image

The second call to 'Renderer::OnResize' will not call memset because 'm_FrameIndex' is not equal to 1, resulting in 'm_AccumulationData' being all is a negative number: image

Thanks

LilyIsTrans commented 1 year ago

I think I've noticed this problem; everything goes black whenever you resize the window with accumulation turned on. I fixed the issue by adding a call to ResetFrameIndex() to the end of Renderer::OnResize.