The Stack Overflow podcast is back! Listen to an interview with our new CEO.
12

When shading a point on an opaque surface, you need to gather incoming light and weight it with the bidirectional reflectance distribution function (BRDF) of the material. The naive approach is to distribute samples equally over the hemisphere and probe all directions equally for incoming light. This is called uniform sampling (Fig. 1). While this works in ...


10

You always need to multiply by the cosine term indeed (that's part of the rendering equation). Though when you do indirect diffuse using ray-tracing and thus monte-carol integration (which is the most common technique in this case), you have to divide the contribution of each sample by your PDF. This is well exampled here. Note also that in the mentioned ...


9

From a signal processing point of view, you're sampling a continuous-domain signal, and you need to filter it to get rid of frequencies beyond the Nyquist limit. It's that filtering that leads to integrating over the pixel area—or more generally, integrating over the support of your antialiasing kernel (which need not be a box). Consider your rendering ...


7

Sample locations with a uniform pattern will create aliasing in the output, whenever there are geometric features of size comparable to or smaller than the sampling grid. That's the reason why "jaggies" exist: because images are made of a uniform square pixel grid, and when you render (for example) an angled line without antialiasing, it crosses rows/columns ...


7

I'm not sure that there's a truly optimal radius—it's going to be a subjective matter based on what the image looks like. As you say, too large a radius results in blurring and too small a radius results in aliasing. I like to set sigma = 0.5 px, so that the overall radius is about 1.5 px (since the Gaussian has the majority of its weight within ±3 ...


6

The texture is probably generated by picking a random angle per pixel, and populating the image with its sine and cosine, remapped into [0, 1]: $$\theta \sim [0, 2\pi] \quad \to \quad \begin{bmatrix} \tfrac{1}{2} \cos \theta + \tfrac{1}{2} \\ \tfrac{1}{2} \sin \theta + \tfrac{1}{2} \\ 0 \end{bmatrix}$$ I did a quick test and generated something that looks ...


6

Monte Carlo methods rely on the law of large numbers, which states that the average of a random event repeated a large number of times converges toward the expected value (if you flip a coin a gazillion times, on average you will obtain each side half the time). Monte Carlo integration uses that law to evaluate an integral by averaging a large number of ...


6

In theory, it is possible to stuff every sample distribution into a texture to "pre-bake" it for fast access. The question is whether any of the results might be useful. For blue noise, this makes a lot of sense, as blue noise distributions have global influence and are hard to evaluate at runtime. Uniform random sampling, on the other hand, is so simple ...


5

This is not a full answer, I would just like to share the knowledge I obtained by studying two of the papers mentioned in the question: Steerable Importance Sampling and Practical Product Importance Sampling for Direct Illumination. Steerable Importance Sampling In this paper they propose a method for sampling the product of the clamped cosine component ...


5

Since you want to downsample the image by a factor of 2 along each axis, a simple and easy thing to do is just average a 2×2 box of source pixels to generate each destination pixel. In pseudocode this would look like: for dest_y = 0 to 540 src_y = dest_y*2 for dest_x = 0 to 960 src_x = dest_x*2 average = 0.25 * (src[src_y][...


5

It sounds like you're trying to do adaptive subdivision on the surface of a hemisphere. This has indeed been tried before, although perhaps not in the exact way you're thinking. Usually for hemispheric integration, people use some well-distributed, pre-defined sampling density over the hemisphere and forget about adaptive subdivision. But you may be ...


4

Imagine that one is rendering a picture of a flat floor with a uniform black and white checkerboard pattern that extends to the horizon; the checkers are large enough that they should be clearly visible at points near the camera but not large enough to be distinguishable near the horizon. Near the horizon, the floor should simply appear as uniform gray. ...


4

You are in fact doing both things. You are integrating the area and because your result is still discrete samples you are reconstructing the signal to make it continious function. Therefore the higher order filtering. (Also human eye is a discrete sampler so it also reconstructs the signal) It took me a considerable amount of time to come into terms with ...


4

You can of course, as you suggested, map (u, v) to (φ, θ). Unfortunately, it does not solve the problem for 5 points: I've changed Holger Dammertz' code a bit (switched u and v), and you see that the problem still persists. For a higher number of points, it really doesn't seem to make a (visual) difference. The Hammersley point set is a way to very quickly ...


4

I'm not sure I've correctly understood the question, but here goes. You're trying to sample directions uniformly, so you've got $p(\omega)$, which is the probability of getting a particular direction. But what is a direction? You actually need your probability distribution to produce numbers in some representation, and the easiest representation to deal ...


4

The missing link between sample locations and the greyscale noise texture is "ordered dithering". Ordered dithering is a list of pixel locations with a "rank" (order) for each pixel. If you have a white background and want to add two black dots, you add them at the locations for the two pixels rank 0 and rank 1. Choosing how to rank the order of the pixels ...


4

If your bunny is purely specular, then sampling the light directly at the shade point would give no contribution since the specular BSDF is a delta BSDF. It generally evaluates to zero for any direction other than the mirror direction. If it was a glossy BSDF, then it might be possible that the pdf value could be very small so that the monte-carlo estimator $...


3

With a good-quality upscaling filter (bicubic, for example), there's no particular importance to the 3:2 ratio. Starting from a higher-resolution source will produce a better-looking final image. It's true that if you're programming the upscaler from scratch, making one for a fixed ratio like 3:2 is much simpler than making one that handles arbitrary ratios....


3

The general idea for sampling half vector based distributions is that you generate $H$ and then compute $w_i$ by reflecting $w_o$ about $H$. This is so $H$ will be the half vector of your $w_i$ and $w_o$ pair. It is standard reflection: $$w_i = -w_o + 2(w_o\cdot H)H $$ How you generate $H$ depends on the specific distribution. Generally, it is done in polar ...


3

It's not that hard. If you have just planar or angular light sources, you can think of them as one light source split into multiple chunks and the only thing to deal with is how to sample this multi-light and how to compute the PDF of the resulting samples. Picking probability First, you need to setup the picking probability $P(l)$ for each light source $l$...


3

Based on your linked question, the problem appears to be that you don't get enough samples in highly curved areas of the surface. You could increase the sample density everywhere, but then you oversample the flatter areas and it becomes too slow. So, you need to increase the sample density locally in areas where it's needed. A conceptually simple algorithm ...


3

Only one path per sample. If you had 64 bounces per first hit and 64 per second hit and so forth you'd never get an image. Edit: And that's why you need to sample each pixel so many times (easily more than 1024 samples) in order to get it to converge, ie get rid of the noise. As per 2) (from comment below) The 64 primary rays will not hit the same object ...


3

I can find two possible reasons for the image not converging. #1. Every sample is the same For every sample, you generate random rays. You do that when you shoot the ray through a pixel (for anti-aliasing and DoF) and when you sample the hemisphere (for a new indirect bounce). The problem would be if for every sample, it would generate the same direction, ...


3

It looks like you're clamping all your samples to 0-1 in line 215. Apply clamping only when displaying the image, not when accumulating samples.


2

Disclaimer: I have no idea what is the state of the art in the environmental map sampling. In fact, I have very little knowledge about this topic. So this will not be complete answer but I will formulate the problem mathematically and analyze it. I do this mainly for myself, so I make it clear for my self but I hope that OP and others will find it useful. $$...


2

The output of an LCD or other display is continuous by virtue of its being a physical device, with pixels that have some size and shape, and emit some physical spectrum of light. from Apple Retina Display by Bryan Jones My guess as to what's meant by the comment that "the sampled representation is converted into a continuous one by the video hardware" is ...


2

In my opinion and experience i don't think there exists an univocal answer... since basically in literature you can easily find example of adaptive filters too (i.e. of variable size). I think the actual answer should be related to the both context of applications (i.e. hardware or sofware, real time or not) and kind of scene you're going to synthesize (...


2

The problem turned out to be that you don't do the same number of candidates per point, but that if you have $n$ points already, you should generate $m*n$ candidates for the next point. $m$ is a tuneable parameter where in general higher values of $m$ will take longer to calculate, but will result in higher quality sampling. The reason that the candidate ...


2

Another very simple, easy to implement, algorithm to generate a Poisson-disk/blue noise point distribution is the following one [ 1 ]: Decide a radius r, and therefore the expected number N of samples per area (use the formula for maximum packing density of k disks distributed on a toroidal domain see [ 2 ]) Generate 10~20 x N samples in your area using a ...


2

I think the formula at the top only makes sense if $n$ and $m$ are pixel indices, i.e. row and column numbers from 0 to $H - 1$ and 0 to $W - 1$. This way, for the four surrounding pixels, the weight varies from 0 to 1. As a representation of the algorithm it's unnecessarily opaque, because you don't actually want to look at every pixel of the image and ...


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