Tag Info

Hot answers tagged raytracing

16

Shapes appearing stretched in the periphery is a consequence of perspective projection. The wider the field of view (FOV) is, the stronger the stretching effect gets. To demonstrate the effect I wrote a quick example on ShaderToy: https://www.shadertoy.com/view/MltBW2 As you can see on the images below (corresponding to FOV of 40, 80 and 120; if I didn't ...

7

It is mainly personal preference, but it does have some logic behind it which would make it a better option. It should not have any big impact on your final image, though. When the discriminant is 0, then that means that there is only one solution. For a sphere, when there is only one solution, that means that the ray is tangent to the sphere. When a line ...

6

Overview Here is a short overview of the most used space representations, MLT variants and mutation strategies for these MLT variants. As you can see, there are quite some papers dating back to 2017 (e.g., three papers explore combining the Path Space and the Primary Sample Space by jumping back and forth between the two). Path Space (PS) representation, ...

4

Well I researched quite a lot after that and this paper helped a lot. "Space Subdivision algorithms" by Macdonald 1988. So just summing what I understood. Some of them are obvious reasons but after reading the paper make much more sense and I'll try to do the same here. 1) In BVH we are subdividing objects into smaller pieces. So for example a model of ...

4

The results that you are getting, are not correct. More specifically, your direct illumination ray tracer is not correct. When limiting a path tracer's bounces to only allow for any direct illumination (thus only the camera ray and one bounce ray for a total of two rays), its brightness should and will match any ray tracer doing only direct illumination. ...

4

Read up on the basics for ray-tracing here, Usually we don't mess up with viewports and stuff in raytracing, So I'm just telling you for the case where viewport equals the Image Width and Height. There are two cases when the field of view changes. Either you move the image plane back and forth or you increase the size. We choose to change $d$ ( former ...

4

If your plane has a normal of $\begin{pmatrix}0 & 0 & z\end{pmatrix}^T$, then your computation vec3 u = vec3( normal.y, -normal.x, 0 ).normalized(); vec3 v = normal.cross( u ); will result in u and v both being $\begin{pmatrix}0 & 0 & 0\end{pmatrix}^T$. A more general approach would be, for example, to compute the cross product of your ...

4

I wasn't really expecting that, no. The formula in the paper is not the most elegant - there's quite a few parentheses in there. In this case I think it's just a matter of shuffling the parentheses around a little in the get_k implementation - both terms should be divided by (1-r): float get_k(float r, float n) { return std::sqrt( 1.0/(1.0-r) * (...

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 $... 4 The space at which you transform your vertices is completely up to you, because it depends on what algorithms and kind of effects that you are trying to achieve. As of my personal experience, I usually shoot rays in world space because eventually we all need some sort of "world-space" acceleration data structure, such as a space-partition tree, that gathers ... 3 Yes, it is possible. For one however, Möller-Trumbore is not the only algorithm out there for ray triangle intersection, there exist others. However all of these rely on linear algebra vector multiplications and matrix operations. These can be combined into 4x4 tensor core operations (and each tensor core can do 4x4x4, but there are 8 cuda cores to every ... 3 I noticed three potential problems. First, this bit of code looks suspicious: Vector r = new Vector(PRNG.nextDouble(), PRNG.nextDouble(), PRNG.nextDouble()).normalize(); Vector v = r.cross(w); Vector u = v.cross(w); Vector wi = u.scale(sample.x).add(v.scale(sample.y)).add(w.scale(sample.z)); The vectors v and u are not normalized, so the construction of wi ... 3 In the paper you referenced$f$refers to the fraction of water covered by foam that modifies optical properties on the water’s surface. It is explained on page 256 in: "Oceanic Whitecaps: Their Role in Air Sea Exchange Processes" (1986), by E. Monahan and G. MacNiocaill. How could I generate the waves for a water body with whitecaps & foam and ... 3 That's just how the Reinhard operator works. If the scene has very high dynamic range important detail may be lost near the high luminance region as you found since both will map near 0.99. Reinhard is a form of global operator. There are other types of algorithms using local operators which tonemap the pixel based on the intensity of the underlying ... 2 A common interpretation of surfaces for rendering is that of a BSDF (Bidirectional Scattering Distribution Function) made up of a BRDF (R stands for Reflectance) and a BTDF (T stands for Transmittance). In such a model, the reflectance part is the light that 'bounces' off the surface, and the transmittance part is the light that penetrates the surface. ... 2 You don't need that equation. You know your focus point (point on y-axis with focus_distance as z component) and the ray origin. All that needs to be done then is to compute the ray direction from the origin through that focus point. For what it's worth, I think a camera space formulation of a thin lens makes it easier to understand the concept: float fov ... 2 PSSMT operates directly on the space of random numbers that generate valid light paths. As such, mutations in the unit hypercube lose their physical interpretation since they do not have direct knowledge of the actual light path constructed. Recent research in rendering has shown that it is possible to bridge the gap between path space (that acts directly on ... 2 Is there any 3D software that supports rendering an artificial scene to a light field image? I took a look at Myst and realMyst, and found this YouTube video: "LightField synthesis & realtime render in Unity - sneak preview (raw footage)" with accompanying background introductory information from Frooxius on Reddit. You can see the pipeline he used to ... 2 I gave it a quick look and I found several places which need attention. First of all you forgot transforming the view space to NDC space. We are working with 3 spaces. 1) The world space, which is the global reference frame. You usually define spheres in this frame. Or if you are reading model data, you might want to multiply by a model matrix to bring ... 2 First, the viewport size: $$h_x = 2*d*tan(\theta_x/2)$$ $$h_y = 2*d*tan(\theta_y/2)$$ Each pixel (from your diagram) has the following size in the eye coordinate system: $$W = h_x / (k-1)$$ $$H = h_y / (m-1)$$ Note that usually the field of view encompasses whole pixels and doesn't stop at the center of the edge pixels like your diagram shows. If$P_c$is ... 2 The normal of a given point on the height map is perpendicular to the 2 vectors defined by gx and gy. The original surface normal is not relevant to this. So in tangent space, the normal is: Vector tangent = Vector(1, 0, gx); Vector bitangent = Vector(0, 1, gy); Vector normal = normalize(cross(tangent, bitangent)); You then need to convert the normal from ... 2 So, for Uniform sampling the PDF is$1/2π$, For Cos-weighted its$cos(θ)/π$. The Lambertian BRDF has a$\pi$term as well in the denominator for energy conservation. When not optimizing things you should be dividing by$\pi$during the BRDF calculation, then dividing by the proper PDFs mentioned above. Considering all the factors into account, for uniform ... 2 That's actually incorrect. You can transform every ray of your camera if you wish (and numerous implementations do so). There are some advantages and disadvantages to each method (e.g. if your rays are more than your vertices you end up doing more transformations, however you don't incur cache misses by running over all vertices). 2 Your main idea is more or less correct. The cosine hidden in the projected area measure$dA^\perp = dA\cos(θ)$compensates the weakening of irradiance due to incident angle (the Lambert's cosine law). This makes radiance independent from the incident angle. My guess is that the main motivation was to make it more practical to work with. The cosine in the ... 1 It's a variant to projective texture mapping. The simple way to do this in the fragment shader by using the position of the fragment to decide whether it is close enough to the plane of the laser to light up. 1 There are two ways to 'translate' your object. The first is by moving each point of your object by the desired translation. The second is by translating the origin of your coordinate system. In this case it's the latter. Basically it turns out to be the same, whether you translate your object by a vector$\vec{t}$or whether you translate your origin by$-\...

1

You're simply not normalizing correctly, since you've picked the pdf for uniform to be $1$ which it is not, and for cosine to be $\cos\theta$ which it is not. The pdf for uniformly distributed points on the upper hemisphere is: $p_U(\theta, \phi) = \frac{\sin\theta}{2\pi}$. The pdf for cosine distributed points on the upper hemisphere is: \$p_C(\theta, \phi) =...

1

It'd be hell a lot easier if this were on graphicsexchange, since I can't use latex here but anyways. In the first pass of Photon Mapping you don't need to use the Flux form of rendering equation. You just divide the original flux coming from the light source among the N photons, then for each photon you use Russian Roulette to determine whether it reflects,...

1

The best algorithm depends on the condition like whether or not the square is axis aligned for example. I'm gonna discuss the more general case which can find find intersection for any arbitrary oriented square. The algorithm works by first checking the intersection of ray with the plane containing the square or rectangle etc. Then check if the ray is within ...

1

So, I figured it out. While UAV will be necessary when I start manipulating data in Compute Shaders, for the time being, SRV works fine provided the resource is read-only from the fragment shader. The two big problems were Creating an ImageTexture that was receiving the data. Note that the data copy was occurring just fine, but the texture was never used ...

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