All Questions
3,963
questions
13
votes
2
answers
2k
views
Sub-pixel antialiasing rules
I recently had an issue with sub-pixel anti-aliasing of text, which produces very harsh colours and made me wonder how it is meant to be done properly:
I've drawn some cases of a black tile ...
43
votes
2
answers
48k
views
What is Ray Marching? Is Sphere Tracing the same thing?
A lot of ShaderToy demos share the Ray Marching algorithm to render the scene, but they are often written with a very compact style and i can't find any straightforward examples or explanation.
So ...
15
votes
1
answer
243
views
How can I model distant rain?
Close up, rain can be modeled as transparent balls of water with appropriate motion blur. This seems impractical for large volumes, which would be necessary for scenes of rain in the distance.
At ...
12
votes
1
answer
397
views
Which effects do I need to take into account for the iris of the eye?
The iris (the colourful ring surrounding the pupil of the eye) is covered in a layer of water, and appears to have opaque elements embedded in transparent and translucent elements. What effects do I ...
9
votes
3
answers
1k
views
How can I create a bounding volume hierarchy for constantly moving objects?
I'd like to be able to render a large population of small independently moving objects in real time. They may move in a swarm-like manner, but their relative positions will not be coherent - their ...
16
votes
2
answers
14k
views
How to implement a trackball in OpenGL?
After so much reading about transformations it is time to implement a trackball for my app.
I understand I have to create a vector from the origin to where the mouse is clicked and then another from ...
15
votes
1
answer
2k
views
How does state of the art real time hair rendering work?
It is common knowledge that hair simulation and rendering is particularly challenging and in fact rare are the examples in games that propose believable hairs. It is pretty easy to imagine how hard it ...
10
votes
1
answer
628
views
How do I accurately compute coverage of overlapping analytical curves?
Antialiasing of 2D shapes boils down to computing the fraction of a pixel that is covered by the shape. For simple non-overlapping shapes, this is not too difficult: clip the shape against the pixel ...
12
votes
1
answer
3k
views
What is the performance tradeoff between forward and deferred rendering?
Forward rendering is the process of computing a radiance value for a surface fragment directly from input geometry and lighting information. Deferred rendering splits that process into two steps: ...
12
votes
1
answer
399
views
Volumetric rendering fundamental concepts and terminology
Literature on rendering volumetric materials and effects tends to use a lot of mathematical physics terminology. Let's say that I have a decent handle on the concepts involved in surface rendering. ...
16
votes
4
answers
5k
views
When should quaternions be used to represent rotation and scaling in 3D?
Quaternions (a four-dimensional extension of complex numbers) can used to represent rotation and scaling of a 3D vector, and the application of a quaternion onto a 3D vector involves two quaternion ...
10
votes
1
answer
892
views
Trying to implement Microfacet BRDF but my result images are wrong
I am trying to implement microfacet BRDF model. I am reading Sebastien Lagarde's slides. I implemented formulas to my code but i think result image is wrong.
Yellow is base color of material. ...
11
votes
1
answer
2k
views
Efficient rendering with many light sources
To render a scene with a single light source using phong shading, one can calculate the final color of each fragment passed into the fragment shader based on the ambient/diffuse/specular components of ...
14
votes
4
answers
752
views
How can I raytrace a scene that does not fit into memory?
If the scene to be raytraced cannot be stored in memory, then without adding more RAM to the machine it seems unrealistic to render it in a practical time span, due to the need to load different parts ...
7
votes
2
answers
119
views
Can I parallelise the scene for a raytraced image, rather than just the pixels?
Raytracing an image can be performed in parallel by calculating the colour of different pixels on different machines. However, this still requires each machine to have access to the entire scene to be ...
9
votes
1
answer
542
views
Rendering fog underneath water
I'm aware of glFog, which blends between the fog and surface colour based on distance to the camera, like this:
The equations are even given in the docs.
But the fog is applied immediately in front ...
8
votes
2
answers
323
views
How can I detect edges between different colours of the same brightness?
I'm looking for an algorithm that can identify edges across which colour is changing sharply, rather than just finding changes in brightness.
Is this just a matter of using a different colour space ...
16
votes
3
answers
6k
views
What are some methods to render transparency in OpenGL
Alpha blending can be turned on to make surfaces transparent, like so:
...
12
votes
2
answers
7k
views
How does temporal reprojection work?
Temporal anti aliasing (and other temporal algorithms) work by matching pixels this frame with pixels from the last frame and then using that information.
I get that you can use the last and current ...
7
votes
1
answer
316
views
How to do a color separation with more than 3 primary colors
How would one do a color separation if there are more than 3 color primaries, or the primaries are nonstandard. In Standard CMYK conversion K is relatively easy conceptually to figure out. Its just a ...
10
votes
1
answer
514
views
Do you need to use a lowpass filter before downsizing an image?
Apparently bicubic pixel interpolation is good for scaling up or down an image (in real time or not).
Is it recommended to use a lowpass filter before downsizing though, or does the bicubic sampling ...
40
votes
4
answers
22k
views
Sharing code between multiple GLSL shaders
I often find myself copy-pasting code between several shaders. This includes both certain computations or data shared between all shaders in a single pipeline, and common computations which all of my ...
9
votes
2
answers
2k
views
Is long term continuous use of GPGPU safe for my GPU?
I'm looking to use my GPU for non-graphical calculations (artificial life simulations) but ideally I would like to leave this running for weeks at a time, 24 hours a day.
Is there anything I should ...
71
votes
6
answers
51k
views
How can I debug GLSL shaders?
When writing non-trivial shaders (just as when writing any other piece of non-trivial code), people make mistakes.[citation needed] However, I can't just debug it like any other code - you can't just ...
31
votes
3
answers
7k
views
Avoiding z-fighting with coincident surfaces
When rendering two overlapping co-planar surfaces, a common issue is "z-fighting", where the renderer can't decide which of the two surfaces is closer to the camera, giving visual artifacts in the ...
10
votes
1
answer
2k
views
Is it possible to alpha blend multiple render targets using a specified alpha?
Say I have render targets 0 through N and RT 0 happens to have in its fourth component an alpha channel specified by a material or mask or something.
Is it possible to have the hardware compositor ...
8
votes
1
answer
230
views
Can I use several GPUs for a grid multi screen image?
Is it realistic to render a super-high resolution image over an array of 3 by 3 or 5 by 5 (for example) stacked screens? Could I do this by combining several different GPUs, or would the only way be ...
10
votes
1
answer
898
views
Modelling Young's double slit experiment
Young's double slit experiment is very simple to set up and simple to explain, but it is an example of both diffraction and interference, neither of which are modelled by conventional raytracing.
It ...
12
votes
1
answer
351
views
Polarising reflection and refraction for a wrap around water surface
I want to render realistic images of water in an orbiting space habitat. The image does not need to be generated in real time, although I wouldn't want it to take weeks either. I'm looking for an ...
3
votes
2
answers
304
views
Can I accelerate rendering an image from a ray cloud using a GPU?
Start with a precalculated "ray cloud" - the starting point and direction of a large number of rays, most of which will not contribute to the image. The image plane's position and orientation are then ...
11
votes
1
answer
2k
views
Algorithms for down sampling an image?
Bicubic sampling is pretty good for up sampling an image and making it larger, but is it a good choice for down sampling as well? Are there better choices?
8
votes
1
answer
386
views
Brightness and contrast VS Gamma, is it possible to identify the gamma "correction amount"?
Trichoplax question aroused my curiosity and the answers in this question also reminded me why I sometimes use different gamma "amounts" to enhance images.
Therefore, is it possible to determine the ...
19
votes
2
answers
3k
views
What is the "dipole approximation" for subsurface scattering?
If you read papers about subsurface scattering, you'll frequently come across references to something called the "dipole approximation". This term seems to go back to the paper A Practical Model for ...
10
votes
2
answers
187
views
Is depth of field incongruous in a 3D still image?
If rendering an image in 2D, adding depth of field effects (blurring objects further from the focal distance) adds realism and draws the eye to the object of the image. With a 3D (i.e. stereo) image, ...
17
votes
2
answers
594
views
Is gamma still important to take into account?
Do different monitors (including mobile screens) still use significantly different gamma functions when displaying colour images? Is there a standardised way to represent colour that can then be ...
12
votes
2
answers
2k
views
Could a hexagonal pixel array store an image more efficiently?
Most computer monitors and televisions have a rectangular array of pixels arranged on a square (or nearly square) lattice. Would a hexagonal lattice give better image quality for the same number of ...
12
votes
1
answer
4k
views
How is Depth of Field Implemented?
I know that depth of field involves blurring.
There's some great information about how to do a Gaussian blur in the question How is Gaussian Blur Implemented?
But, other than that, how is depth of ...
10
votes
3
answers
765
views
What is the optimal radius of gaussian distribution for determining pixel colour?
Using a gaussian distribution of points on an image plane to calculate a pixel value, what radius/standard deviation will give the most information in the final image? Too large a radius gives a ...
27
votes
2
answers
18k
views
What is fwidth and how does it work?
The OpenGL documentation states that fwidth returns the sum of the absolute value of derivatives in x and y.
What does this mean in less mathematical terms, and is ...
9
votes
1
answer
119
views
What are the side effects of biasing brightness in continuous spectrum raytracing?
I want to model rays with a continuous range of frequencies so that I can get raytraced images with colour separation on refraction. I can model a light source with a specified frequency distribution ...
12
votes
3
answers
525
views
How can I concentrate points in areas of higher curvature?
How can I distribute points over an implicit surface, to concentrate them more densely in areas of higher curvature?
I've considered adding points randomly and rejecting points not required based on ...
14
votes
1
answer
2k
views
When to disable perspective correct interpolation ( noperspective )
In GLSL, perspective correct interpolation of vertex attributes is the default setting - one can disable it for specific vertex attributes by using the noperspective qualifier. Other than in post-...
59
votes
3
answers
35k
views
When is a compute shader more efficient than a pixel shader for image filtering?
Image filtering operations such as blurs, SSAO, bloom and so forth are usually done using pixel shaders and "gather" operations, where each pixel shader invocation issues a number of texture fetches ...
17
votes
1
answer
4k
views
How can I generate procedural noise on a sphere?
I would like to generate procedural noise on the surface of a sphere (e.g. to procedurally generate planets or marble-textured balls). Of course, I could just take a standard noise algorithm and map ...
10
votes
1
answer
2k
views
Asset creation for signed distance field rendering?
In traditional computer graphics, most 3D models are rendered by rasterizing or ray tracing against a subdivided mesh of primitives, usually triangles or quads. More recently, some real-time ...
16
votes
3
answers
2k
views
What is "Scanline Racing"
I've heard a lot of people working on VR talk about scanline racing and that it's supposed to help improve latency for motion-to-photon. However, it isn't clear to me how this can be done with OpenGL....
51
votes
5
answers
73k
views
How is Gaussian Blur Implemented?
I've read that blur is done in real time graphics by doing it on one axis and then the other.
I've done a bit of convolution in 1D in the past but I am not super comfortable with it, nor know what to ...
19
votes
1
answer
1k
views
Data structures for tile-based (deferred) rendering
Tiled rendering is used in modern mobile GPU architectures to increase the coherency of memory access by subdividing image space into a regular grid of small (e.g., 32x32 pixel) tiles. Information is ...
36
votes
2
answers
13k
views
What is the cost of changing state?
Programmers are supposed to have a fairly good idea of the cost of certain operations: for example the cost of an instruction on CPU, the cost of a L1, L2, or L3 cache miss, the cost of a LHS.
When ...
11
votes
3
answers
3k
views
Why do Vertex Buffer Objects improve performance?
From my basic understanding, a Vertex Buffer Object works something like this (pseudo code):
Normally, if one wanted to say, draw a square, one could issue line drawing commands.
...