|
Post by krotus on Apr 4, 2020 7:09:49 GMT
This isn't really any kind of ray tracing enhancement, but just a way to track time for rendering images. Doing time calculations and formatting, from my limited experience, pretty much sucks. However, I like to know how long a render might take in case I want to go have a beer, take out the trash, visit the head, etc. So I added a progress bar with a label to show the percentage of the render completed, the elapsed time of the render and the estimated time to completion. I'm writing my ray tracer in VB.NET using Visual Studio Enterprise 2017 but I'll post the timing code if anyone is interested.
|
|
|
Post by chrisd on Apr 5, 2020 18:38:35 GMT
What formula are you calculating the time remaining?
Your time remaining calculation should be something like this:
time_remaining = pixels_remaining / rate_pps
Then the question is how do you compute the rate (in pixels per second). I can think of 3 alternatives.
just calculate all pixels rendered by the time taken so far: pixels_rendered / time_since_start moving average - break the time into sampling periods, with the last n sampling periods determining the rate use some percentage of the last calculated rate (e.g. 90%) plus the remainder (10%) of the most recent rate (or 80%/20%, or 95%/5%)
All of these would give better results if you randomly sampled the pixels in the image so your estimate wouldn't be skewed by portions of the image that were particularly quick or slow to render.
|
|
|
Post by krotus on Apr 9, 2020 19:03:50 GMT
What formula are you calculating the time remaining?
Your time remaining calculation should be something like this:
time_remaining = pixels_remaining / rate_pps
Then the question is how do you compute the rate (in pixels per second). I can think of 3 alternatives.
just calculate all pixels rendered by the time taken so far: pixels_rendered / time_since_start moving average - break the time into sampling periods, with the last n sampling periods determining the rate use some percentage of the last calculated rate (e.g. 90%) plus the remainder (10%) of the most recent rate (or 80%/20%, or 95%/5%)
All of these would give better results if you randomly sampled the pixels in the image so your estimate wouldn't be skewed by portions of the image that were particularly quick or slow to render. That's the formula I used. I used #1 to get an average of pixel render time. Even if some pixels take significantly longer than others, the estimated time remaining is always based on the average time of the pixels that have been calculated. It's accurate enough, even on large images.
|
|