4096?

Started by Dune, July 08, 2023, 02:33:48 AM

Previous topic - Next topic

Dune

I am making equirectangular images and wonder about the best resolution. I tend to use 'nice' numbers (even in all my TG settings), but can't find any reference or base (tried AI) as to why a number of 4096 would be preferred over say 4000 or 4100. Or 8192 as opposed to 8200...
I think it has to do with computer math (bytes etc), but why exactly? Quote from Perplexity: "1 MB is 1 million bytes. However, some systems, such as Microsoft Windows, use the definition of 1 MB as 1,048,576 bytes, which is equivalent to 1024 kilobytes (KB)"
And it what way would 4096 be better than 4100 as an image resolution (or not)? Sharper? Faster to calculate?

D.A. Bentley (SuddenPlanet)

It has to do with being a power of 2.  When I started in the game industry we were making texture maps for various platforms, like PC Games, Nintendo 64, and Xbox etc, and for whatever reason the programmers and game engines wanted bitmaps in a size that was a power of 2.  It had to do with storing them in VRAM, or Video Memory.

So if your application is non-games, like for a background, or HDRI sky for Image Based Illumination then the size being a power of 2 isn't important.

Dune

Thanks for your explanation. So I imagine a power 2 size loads/saves faster in memory, which would indeed be good for games and real-time stuff. My renders are for a 3D app; specific locations in medieval times to watch at those locations on your phone. So I guess size doesn't (really) matter (no pun intended).

KlausK

Perhaps you already read this:
https://en.wikipedia.org/wiki/Binary_prefix
Might be helpful perhaps.

CHeers, Klaus
/ ASUS WS Mainboard / Dual XEON E5-2640v3 / 64GB RAM / NVIDIA GeForce GTX 1070 TI / Win7 Ultimate . . . still (||-:-||)

Dune

Thanks Klaus, interesting read.

WAS

128^2, 256^2, 512^2 all simply comes from repeating textures. Any other size can show it's repetition easier because of constricted aspect ratio. So on flat surfaces a 1:1 texture is going to offer the most "space" to hide repetition.

This is why we have polarizing ideas like long rectangles for tree textures. The space we are dealing with isn't 1:1 and super elongated on a cylinder. Our repetition seams are mostly happening off camera or off the curve of the texture which skews texture and further hides effect of seams repeating

WinterLight

Quote from: Dune on July 09, 2023, 01:35:49 AMThanks for your explanation. So I imagine a power 2 size loads/saves faster in memory, which would indeed be good for games and real-time stuff. My renders are for a 3D app; specific locations in medieval times to watch at those locations on your phone. So I guess size doesn't (really) matter (no pun intended).

It's not so much the speed of loading and saving, but more with the way that memory is organized. Because they're based on binary logic, EVERYTHING is done in powers of two, including designing memory cells and cache blocks. 

When a modern processor loads data into its lower level caches, it does in blocks, then cache lines. If a chunk of data crosses a block boundary, then it has to load two blocks. If a 1024K block contains 2K of actual data, that's a lot of wasted cache bandwidth, and the processor still has to fetch more data. So the more closely the data aligns with cache block boundaries, the more efficiently it can use the available cache bandwidth. 

In rendering that is hugely critical to performance, rather than computation, because when the processor is waiting for data, it has nothing to compute on.

Dune

Quote from: WinterLight on July 09, 2023, 05:03:06 PMIf a 1024K block contains 2K of actual data, that's a lot of wasted cache bandwidth
Thanks very much for that explanation, now it makes sense. Efficiency. But...
Quote from: WinterLight on July 09, 2023, 05:03:06 PMIn rendering that is hugely critical to performance, rather than computation, because when the processor is waiting for data, it has nothing to compute on.
this is still a bit hazy to me. Isn't performance 'similar' to computation? What contitutes performance? In other words; is rendering an image of 4096 more efficient timewise than a render of 4090 or 4100? It will probably be milliseconds I presume? And how does that work through in viewing an equirectangular render of 4096 as opposed to a render of 4100px? Faster, sharper, less energy consumption? Sorry to keep nagging :P