Tag Info

Hot answers tagged

12

There's a number of pieces to this puzzle, each of which will provide a deep and interesting rabbit hole of exploration. Some of them are: Level of Detail -- automatically (or "manually") choosing detailed or simplified models, or even sprites or just dots, or for objects as they are further away. Culling -- choosing to only draw what's needed. This might ...


7

Yes, you can discard in the fragment shader to avoid writing the pixel. Here's a random example I dug up from Google. Note that this may not actually stop the fragment shader from processing (as the GPU tends to process fragments in blocks; only discarding from all fragments in a block will abandon the processing). But the fragment won't be written to the ...


7

This is based on my speculation and skimming through Celestia's source code. Celestia allows you to fly around a planet and zoom out to see the whole galaxy. I browsed its source code and found it used an octree, a structure to recursively divide space into 8 octants. The renderer would render the environment by traversing the octree, and don't traverse ...


2

Usually bloom is done with HDR rendering where you use a floating point (usually 16 bits per channel) texture for rendering to. Things that are brighter than 1.0 get bloom applied. Things that are 1.0 or less don't get any bloom. You render everything to the same texture, and remove anything that's not bright enough to bloom when you start processing the ...


2

Firstly, texture filtering and anti aliasing are two different ways of improving image quality. You can apply them both independently. Anti aliasing is primarily done to smooth the joins where two separate triangles overlap. Depending on how it's done it can also benefit texturing quality indirectly too. Texture filtering is done to improve the image ...


2

Viewports and Clipping (Direct3D 9) is a good overview that, while specific to D3D9, is relevant to all APIs. The viewport defines an additional transformation that occurs before rasterization: Direct3D uses the viewport location and dimensions to scale the vertices to fit a rendered scene into the appropriate location on the target surface. Internally, ...


2

The discard statement comes in handy. You didn't say too much about your decision path, so I'll offer an example using a simple texture lookup: void main() { gl_FragColor = texture2D(u_texture, v_uv) * u_color; if (gl_FragColor.a <= 0.0) discard; } (That's from some sample code I wrote before I learned about alpha blending.)


2

Anything that is either hierarchical and/or sparse should help you out here. There's a lot of empty space, so not having to use storage to represent empty space is a must. A typical hierarchical approach would be something like an Oct tree which recursively subdivides space into 8 smaller cubes, and you can store objects in the smallest cube that they can ...


2

When you resize your game resolution you need to update every single rectangle in your game (every button, etc) and multiply it by a proper scale, so that the "hitboxes" would work, which would be a lot of work. So, a smarter way of achieving the same result is simply by multiplying your mouse position by a Vector2 scale = new Vector2(originalWidth / width, ...


1

Yes, you can easily do it. Modern video drivers (almost) always come with OpenGL support. DirectX 11 requires same hardware as OpenGL 4, so you will probably get at least OpenGL 4.3. Based on these statistics, and this information about equivalence of hardware requirements between different OpenGL and DirectX versions, we have approximately these numbers: ...


1

I have a couple of suggestions Avoid Allocations and Copies A lot of your code has unnecessary allocations and copies. Instead of filling a vector with push_back, try pre-allocating the vector and setting the data there. You have a fixed maximum number of intersection points, so pre-allocate a vector of that size. Do a Simple Broadphase Before you do ...


1

I use MRT rendering for this; I render everything into both a diffuse map and a glow map. I then blur the glow map into a bloom-like effect, and add it back on top of the diffuse map as a post-processing effect. This way I can make objects that glow (by drawing their diffuse color into both the diffuse and the glow map), objects that don't glow (by ...



Only top voted, non community-wiki answers of a minimum length are eligible