13

Your image definitely does not look correct, and it appears that you are not correctly computing the internal path of light rays as they travel through your mesh. From the looks of it, I would say that you are computing the distance between the point where the view ray first enters the cube and where it first hits the interior wall, and using that as your ...


12

Warning: I am not a physicist. As Dan Hulme already explained, light can't travel through metals, so dealing with IOR is a lot more... complex. I will answer why that happens and how to calculate the reflection coefficient. Explanation: Metals are filled with free electrons. Those electrons react to external fields and reposition until electrostatic ...


9

The most commonly suggested method seems to be Mueller calculus, which boils down to tracking the Stokes parameters of a light ray to represent the polarization of light transmitted along that ray. A ray might be unpolarized—Stokes parameters of (1, 0, 0, 0)—or it may be circularly or linearly polarized in various directions, which is a property of light in ...


8

The box.obj file has no vertex normals, and by default Mitsuba will generate smooth normals for OBJ files that don't specify their own normals. This creates the magnification effect: the box with smooth normals forms a convex lens! By adding this line to the box object in the scene file: <boolean name="faceNormals" value="true"/> I got results that ...


7

this is an interesting question (and I am actually an author on Scratchapixel so I can maybe help on that one)). Things go as follows: you cast the primary ray into the scene the ray hits the glass which is a refractive-reflective/transparent material you compute and cast two rays from the point of intersection: a reflective ray and a refractive ray if ...


7

TL;DR Yes, you can do it like that, you just have to divide the result by the probability of choosing the direction. Full Answer The topic of sampling in path tracers allowing materials with both reflection and refraction is actually a little bit more complex. Let's start with some background first. If you allow BSDFs - not just BRDFs - in your path ...


6

Look at the refractive index of several metals. They are all complex numbers and the math does work out when you put this into the fresnel equation: you get the expected high reflectivity at all angles. There are also subtle color shifts because the index depends on wavelength. This is actually used in rendering but it is not common. The function is ...


5

You need to spawn a new ray at each IOR interface. So let's say your ray hits the surface of the glass object. You spawn a new ray from the intersection point along the new IOR direction for air->glass interfaces, this new ray is inside the glass. This ray will then either hit a solid object or the interior surface of the glass. If we hit a solid object we ...


4

Two big ones you're missing: Angle-dependent reflection. This is one possible cause of your "transparent in places and not in others" effect, and the most likely cause of the missing wetness. Ice cubes usually have air bubbles trapped inside. This shows up as a white volumetric haze denser in the center of the cube (for small bubbles) or distinct bubbles (...


4

I've found that bump mapping when calculating lighting and refraction rays can add a lot to the look of ice. It makes the ice look textured and imperfect, like a melting ice cube would look. I sort of wonder if maybe animating a bump map could help make it look wet, as water sheets / droplets ran down it's surface. The images below look pretty nice, but ...


3

But, at this point, do i apply a specular highlight to the surface that i hit from the inside? Unless you have a light source inside your object, there's no point in doing lighting on the inside surface as you'll hit the object again before you reach the light or environment. If you want to support a light in the object, then by all means do your lighting ...


3

That looks a lot like it’s based on the straight skeleton of some outline shapes drawn on the image. You can see similar structures in the middle one of these diagrams from a research page by Stefan Huber, one of the researchers who’s published a lot of work on straight skeletons:


3

According to Wikipedia, ice has a slightly lower IOR than non-frozen water, though I don't know how much that difference would affect the results. The "opaque"-looking parts of an ice cube are caused by clusters of microscopic bubbles formed during freezing. You might be able to model those using geometry, but given the scale and number I suspect that some ...


2

The refractive index is related to the speed at which light travels through the medium, and only applies to materials which are at least partially transparent. Metals are electrically conductive, so they are opaque, so light can't travel through them at any speed, so they don't have a refractive index. This is why Fresnel's law doesn't apply: it's for ...


2

See equation (16) in Microfacet Models for Refraction through Rough Surfaces : $-(\eta_i w_i + \eta_o w_o)$ which you'll probably want to normalize. $\eta$ are the two indices of refraction and $w$ the two vectors (they use $i$ and $o$ in the paper). Also look at the left part of figure 7 on the same page to see where all the vectors are pointing.


1

You need to make use of a discriminant, also when dealing with floating point comparisons it is wise to use an epsilon (small value for accommodating fp-error). Also keep in mind that it matters whether the surface normal is pointing along the ray, or against it. Below is a function which I use in my own raytracer, also based on the same book. It is written ...


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