All Questions

18
votes
1answer
1k views

Why is this conditional in my fragment shader so slow?

I have set up some FPS-measuring code in WebGL (based on this SO answer) and have discovered some oddities with the performance of my fragment shader. The code just renders a single quad (or rather ...
13
votes
1answer
554 views

Is a constant condition more costly than switching shaders?

In general, branching in shaders is not a good idea. But now I have a shader with a condition that is constant with respect to the entire draw call. So the branch that is executed is always the same ...
32
votes
4answers
1k views

Are there common materials that aren't represented well by RGB?

In graphics we use RGB and other color spaces as an approximation to the full spectrum of light wavelengths. This evidently works pretty well in general, but are there any reasonably common objects/...
23
votes
2answers
2k views

Path tracing the Cook-Torrance BRDF

-- Sorry for the long post, but I prefer to do that way because "Devil is in the details." :) I am writing a path tracer from the scratch and it is working nicely for perfectly diffuse (Lambertian) ...
11
votes
1answer
2k views

Progressive Path Tracing with Explicit Light Sampling

I understood the logic behind the importance sampling for the BRDF part. However, when it comes to sampling light sources explicitly, all becomes confusing. For example, if I have one point light ...
9
votes
2answers
715 views

Is using many texture maps bad for caching?

If I have many textures (say 5+ maps) bound to the same texture unit, does it work worse for cache than if I had only 2 or 3 textures?
14
votes
2answers
8k views

What is the simplest way to compute principal curvature for a mesh triangle?

I have a mesh and in the region around each triangle, I want to compute an estimate of the principal curvature directions. I have never done this sort of thing before and Wikipedia does not help a lot....
31
votes
2answers
3k views

How physically-based is the diffuse and specular distinction?

The classical way of shading surfaces in real-time computer graphics is a combination of a (Lambertian) diffuse term and a specular term, most likely Phong or Blinn-Phong. Now with the trend going ...
20
votes
2answers
5k views

Why is the transposed inverse of the model view matrix used to transform the normal vectors?

When rendering 3D scenes with transformations applied to the objects, normals have to be transformed with the transposed inverse of the model view matrix. So, with a normal $n$, modelViewMatrix $M$, ...
17
votes
2answers
7k 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 ...
13
votes
1answer
1k views

Choosing Reflection or Refraction in Path Tracing

I am trying to implement refraction and transmission in my path tracer and I'm a bit unsure on how to implement it. First, some background: When light hits a surface, a portion of it will reflect, ...
12
votes
2answers
456 views

What is the fundamental reasoning for anti aliasing using multiple random samples within a pixel?

In graphics, it's common to take multiple samples within the bounds of a pixel and combine them together (most commonly just doing an average) for a final sample pixel color. This has the effect of ...
14
votes
1answer
300 views

Is all grid based noise inevitably anisotropic?

I'm interested in how this applies to higher numbers of dimensions too, but for this question I will focus solely on 2D grids. I know that Perlin noise is not isotropic (direction invariant), and ...
12
votes
3answers
5k views

How is Anti Aliasing Implemented in Ray Tracing?

After reading a few articles online I am can confidently say I am clueless on how Anti-Aliasing works when Ray Tracing. All I understand is that A Single Pixel/Ray is split into 4 sub-pixels and 4 ...
10
votes
3answers
834 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. ...
10
votes
1answer
2k views

How does Texture Cache work considering multiple shader units

Modern GPUs have many parallel shading units. I'd like to know how texture cache is managed in that scenario.
8
votes
1answer
741 views

Splitting of NURBS curves

Splitting Bezier curve into two parts at some parameter t is easy thanks to De Casteljau's algorithm. Is there a similar algorithm for NURBS curves? How to split a ...
16
votes
3answers
3k views

How can I debug what is being rendered to a Frame Buffer Object in OpenGL?

I have a point cloud that is being rendered to the screen. Each point has its position and color as well as an ID. I was asked to render the IDs for each point to a texture so I created a FBO and ...
4
votes
1answer
137 views

What happened to my texture mapping?

Recently, I am writing a simple software rasterizer for self-studying and fun. But the texture mapping has problems. The texture I want to map is below: But the final image of two triangles is ...
2
votes
1answer
535 views

Building view transform matrices

For a 3D scene in the world coordinates, its View Reference Point $\mathrm{VRP}$ is at $(5,-2,1)$, and a viewer is looking towards point $A=(1,1,1)$. Construct a transform matrix which will map world ...
16
votes
2answers
415 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 ...
11
votes
2answers
378 views

How to unproject quadrilateral into rectangle?

tl;dr: Math problem in projective geometry: How does one find some 4x4 camera matrix that gives a projection as illustrated below, such that points A,B,C,D are somewhere on the edges of the unit box (...
7
votes
1answer
471 views

NURBS knot multiplicity

In Splitting of NURBS curves there the answer relied on "maximum knot multiplicity". In order not to mix-up different topics I would like to kindly ask to answer it in another question: what is this "...
5
votes
1answer
788 views

Draw angles lines in raster graphics using bresenham line algorithm

I at the moment trying to draw some angled lines using bresenham line algorithm which can circulate a 2d array of size 21x21, as a line angled from 0 - 2pi. So the idea is that the program has to ...
3
votes
2answers
456 views

Is it possible to store the plain buffer data in gltf files?

The GL Transmission Format comes along with a JSON styled main file which basicly describes the scene and binary files which contain the buffers. I'm currently writing a WebGL library and I need to ...
1
vote
0answers
128 views

Normal Artifacts On Grazing Angles

I am currently experiencing a very obvious artifact that occurs when looking at objects on very grazing angles Here is a picture of the artifact: I noticed that the issue was coming from my ...
1
vote
2answers
604 views

How to calculate the RGB intensity values at center of face using flat shading?

Consider a triangular face of three vertices A(0,2,1), B(3,0,1) and the origin, and the normal vectors at the vertices are nA=(0,0,1), nB=(1,1,0) and nO=(-1,-1,1), respectively. The incident light is ...
37
votes
4answers
21k 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 ...
28
votes
4answers
7k 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 ...
17
votes
2answers
2k 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 ...
15
votes
3answers
3k views

Is Russian Roulette really the answer?

I have seen that in some implementations of Path Tracing, an approach called Russian Roulette is used to cull some of the paths and share their contribution among the other paths. I understand that ...
20
votes
1answer
2k views

Anti-aliasing / Filtering in Ray Tracing

In ray tracing / path tracing, one of the simplest way to anti-alias the image is to supersample the pixel values and average the results. IE. instead of shooting every sample through the center of ...
10
votes
3answers
4k views

What are Spherical Harmonics & Light Probes?

What are Spherical Harmonics & Light Probes? How useful are they in computer graphics? What exactly do they do? I've heard the word spherical harmonics & Light Probes everywhere, from siggraph ...
33
votes
6answers
15k 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 ...
14
votes
6answers
492 views

How to produce simple 2D illustrations to accompany geometry answers?

In my answer about Affine Transformations I made some little illustrations to help the explanation. How do you make an upload-able PNG quickly which expresses a geometrical or mathematical idea? ...
8
votes
2answers
3k views

OpenGL - Detection of edges

I'd like to load arbitrary meshes and draw thick black lines along the edges to get a toon-shading like look. I managed to draw a black silhouette around the objects by using the stencil buffer. You ...
21
votes
3answers
5k views

What is a stencil buffer?

Wikipedia states that a stencil buffer is some arbitrary buffer a shader can use. However, it hints that it's used for clipping, or otherwise "tightly binding" the depth and pixel buffers, slightly ...
21
votes
1answer
2k views

Why does my Perlin Noise look “blocky”?

I tried to implement Perlin Noise by myself using just the theory (following flafla2.github.io/2014/08/09/perlinnoise.html). Unfortunately I was unable to achieve the look of the "original" Perlin ...
15
votes
1answer
2k 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 ...
11
votes
3answers
1k views

Correct Specular Term of the Cook-Torrance / Torrance-Sparrow Model

For a while I have been doing some research on the topic of Physically Based Rendering. One reflection model that is mentioned over and over is the Cook-Torrance / Torrance-Sparrow model. It seems ...
20
votes
1answer
4k views

What are Affine Transformations?

What are Affine Tranformations? Do they apply just to points or to other shapes as well? What does it mean that they can be "composed"?
11
votes
1answer
704 views

What is the difference between importance sampling and mutiple importance sampling?

I can't understand math equations. I'm a graphic designer. What is "importance sampling"? What is "multiple importance sampling"? Could you explain easily, using illustrations and no math equations? ...
11
votes
2answers
3k views

Physically based rendering and ray tracing

I've got a lot of confusion and I need to clarify some terminology and put together the knowledge. If I say that an engine is a ray tracer (so it uses the ray tracing algorithm to render the scene), ...
7
votes
2answers
485 views

Path Tracing & Materials

I'm wondering about the technique used when sampling a layered material for the next event in a path tracer. I have a material with three layers: a base diffuse, specular and sheen lobes. How does one ...
14
votes
4answers
377 views

What physical properties are “lacking” to keep this 3D scene from looking like a real photograph?

So I know that I'm basically asking to identify the main problem to be solved in creating realistic 3d Graphics, but as someone without much technical experience in the field, I'm curious that if ...
11
votes
4answers
943 views

Does it matter whether I learn OpenGL or Direct3D?

Are the differences between these two APIs minor implementation details that mean once I have learned one I can use it for everything? Or are there reasons for learning one rather than the other if I ...
11
votes
1answer
529 views

Path tracer - multi layered materials and importance sampling

I'm currently trying to implement a Monte Carlo path tracer. I've done some research and it seems that a common approach to materials is to use a layered model. Something like this: When light hits ...
10
votes
2answers
4k views

How to Calculate Surface Normals for Generated Geometry

I have a class that generates a 3D shape based on inputs from the calling code. The inputs are things like length, depth, arc, etc. My code generates the geometry perfectly, however I am running into ...
9
votes
1answer
856 views

Why do multiple Gaussian Blurs?

Applying multiple Gaussian blurs can result in an effect that is equivalent to a stronger Gaussian blur. For instance this question says that: Is doing multiple Gaussian blurs the same as doing one ...
9
votes
1answer
2k 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 ...

15 30 50 per page