What's the frustum-to-pixels process?
Posted 14 March 2012 - 01:01 AM
As the subject line asks, what's the general process by which an engine takes the frustum coordinates (and actually, this assumes that data has already been put into -1,-1,-1 1,1,1 view box coords) and gets all the way to pixels on da screen?
Posted 14 March 2012 - 02:55 AM
Posted 14 March 2012 - 04:32 AM
I know that you have to do the viewport transform:
X = (X + 1) * Viewport.Width * 0.5 + Viewport.TopLeftX
Y = (1 - Y) * Viewport.Height * 0.5 + Viewport.TopLeftY
Z = Viewport.MinDepth + Z * (Viewport.MaxDepth - Viewport.MinDepth)
After that, I'm basically looking to understand the logic of the actual pixel-painting, if you will, so I can implement shader and lighting designs.
I know a lot of things like texture mapping and lighting and shading (obviously) enter here; I'm simply looking for an overall summation, whether or not any math is included, of the process so I can understand the conceptual logic of the "painting part".
Posted 14 March 2012 - 05:51 AM
In terms of the actual implementation of rasterization, of course determining which pixels a triangle covers isn't a trivial thing to do fast, so there are a bunch of technical details and optimizations. It sounds like that's not what you're interesting in learning about right now, though, unless I've misunderstood.
Posted 14 March 2012 - 06:10 AM
Posted 14 March 2012 - 06:27 AM
Posted 14 March 2012 - 12:15 PM
If you don't know how to speed up application, go "roarrrrrr!", hit the compiler with the club and use -O3 :D
Posted 14 March 2012 - 02:52 PM
Posted 14 March 2012 - 04:25 PM
Voxels are a completely different rendering process that is not based on triangles. GPUs do not support voxels directly, though voxel rendering can be done on the GPU, typically by drawing a single triangle that covers the whole screen and using a pixel shader to render the voxels yourself. Anyway, that's a whole other topic.
Posted 15 March 2012 - 12:02 AM
Also, I've always been curious: why are triangles the standard modus operandi, versus meshes being composed of any ol' coordinates? I assume I has something to do with the conductivity to trigonometry-type math enablement, but I'm indeed very curious. I know that there are other methods out there, be they voxels, octrees, or square polygon methodologies. I also hear that one of the major companies and their engine (forgot who and which) are looking at full octree implementation in their next engine iteration.
Posted 15 March 2012 - 02:21 AM
Triangles are mathematically one of the simplest shapes you can use to make a 3D world out of, and everything else can be reduced to triangles or approximated by triangles. It's a lot simpler and faster for graphics APIs and hardware to handle one kind of primitive than many, so they picked triangles as the one true primitive. (Actually, GPUs support line and point primitives as well, but these are rarely used in production rendering. Lines are used for wireframe views and other kinds of debugging/developer views.)
By the way, octrees are not a primitive that can be used to make 3D worlds; they are just a container - a data organization system that you can put other things into, to make certain kinds of spatial operations faster (such as finding the nearest object to a given point). Octrees can be used to organize objects in your game world, triangles, voxels, or anything else that lives in 3D space. Octrees are an example of a class of data structures called space-partitioning structures, of which other examples are bounding box trees, sphere trees, BSP trees, and kd-trees.
Posted 15 March 2012 - 05:04 AM
Btw, in regards to the various methods of space-partitioning structures you mentioned: is there a favored, or generally preferred, method from amongst those you mentioned? I'm just curious as to what is usually used in gaming, or, also, if there's a method that is growing in popularity right now. I also assume, if I can do so, that those methods can be somewhat customized in their functioning to fashion your own style of space-partitioning...?
Posted 15 March 2012 - 07:15 AM
Posted 16 March 2012 - 10:15 AM
I have a software raytracer I use a lot, when I wrote it I used a bounding volume hierarchy that uses axis-aligned bounding boxes,it uses SAH for optimal splitting.
The BVH creation is ten times slower than the renderer, but the combined effect is a raytracer that is roughly a hundred times faster than brute force
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users