The Science Of CG


The benefit of using RAW would be that if you’re using a camera like the Red1 footage can be brought in directly to the RAW workflow that the Red1 uses.

I would imagine that it could be hard to deal with even a relatively small image sequence of HDR/EXR images.
Depending on what you’re doing, rendering to EXR would add time to the render with no real benefit unless the intended output supports it.
So then rendering to RAW would possibly shave some time off the render but still offer a measure of control beyond that of a basic bitmap image.

I also notice that when you open an HDR/EXR image in photoshop you don’t get all the same options as with standard images.
Which isn’t the case with RAW.


Rendering to EXR shouldn’t take any longer than rendering to any other image format. If it does your renderer is f*cked.

Photoshop doesn’t support many of its features for floating-point images but you can get them back by switching the bit depth.


If you switch the bit-depth, doesn’t that negate the benefit of using EXR though?


Yes, switching the bit depth leads you back to a ‘normal’ image. It’s best to do all the things that have advantages of a higher bit depth (like for example level control, exposure and so on) before switching the bit depth down (to enable some filters which don’t work at float point or 16 bit depth).


big thanks to the contributors for their sharing.


No, there would be no benefit. RAW is good for only one thing, and that is storing data directly from a camera sensor. The output you get from a renderer is very different than what a camera sensor gives you and converting the renderer’s output to something similar to camera data would most likely reduce the quality.

Besides, there is no real standardized RAW format - every camera vendor stores it differently, even different camera models from the same manufacturer can have different interpretations of RAW. RAW does not store direct images, it stores just raw sensor data and nothing else.

OpenEXR so far fulfills all the typical needs in a digital pipeline.


This is an awesome thread gents. You have saved me hours of wikipedia research. Thanks!


I just hit the “make it not suck” button


“There is also an air perspective:objects dim with distance because air contains small particles of dust etc. It should be present in realistic outdoor scenes as long as it is physically-based.”

Oh that’s the one I need badly to learn how to do


I have difficulties currently keeping the physically accurate route, because I have limited lighting knowledge. It’s not about shaders but about keeping them of needed brightness\reflectivity. Keeping the physical accuracy is the sign of maturity and experienced cg artist to me. First of all, it requires certain, deeper understanding of lighting than just the renderer settings. To say that in real life they don’t use hacks is not true, they do, but it’s the last resort as is in cg. Let’s say somebody lights a highly reflective mirror-like thing but there is a small details which just won’t reflect whatever you try. You then spray it with some kind of substance that makes it more glossy and therefore it reacts to light more readily, Though if you spray all over the object it may show your inability to light mirror-like objects.
In cg. for example you light watches. You have your reflection part and diffuse part. What if you have your reflection of needed exposure but the diffuse looks too dark? The worst thing is to tweak the diffuse value itself. But if you know the physical laws, you know that reflection brightness does not change with distance. So you can simply move the light closer to the subject or increase its size.
Knowing this fact you can use a reflective bounce card and when moving the main light source away keeping the fill light approximately of the same intensity, because it’s a reflective caustics.
The artist which introduced to me the real life lighting techniques is Christopher Nichols. He has very interesting demonstration of using bounce cards and such stuff fully utilizing GI and raytracing. Before this I thought “hm, why to study real life lighting if we are cg artists? We don’t use this cumbersome stuff and we are completely different” I was so much wrong. When I asked him what could he suggest to read he suggested me a book which opened my eyes how much more vast the subject is than just cg tools. Those books can really improve the general approach to cg lighting and lead to sophisticated lighting approach, keeping the physically accurate route. I only wish that GI and raytracing techniques would be cheaper in terms of time than they are today.


I personally think that the answer to that question is easy… just “not ‘obvious.’”

Let’s face it: when the (virtual…) dust finally settles, what we are actually being required to produce is either… [ol]
[li] An image on cinema-sized film, or… [*] An image on a video screen. [/ol] We are not being asked to produce “physical reality.”
We know that our audience (each member of which is equipped with a stunningly-amazing biological data-processor known as “a human brain”…) will instantaneously correlate whatever-we-show-them with (their version of…) “physical reality.”

Therefore, we are ‘off the hook!’ :surprised

We “merely” need to produce “an image that looks good,” in whatever medium we are being asked to employ. We need to produce the image “by deadline,” and we need to spend as few physical-dollars as possible doing it. But, beyond that, we are both “free” and “encouraged” to ‘cheat.’ :slight_smile:

The tornado in Wizard of Oz was basically panty-hose. The alien-architecture in Star Trek was made from repainted cast-offs from “Mission: Impossible.” And nobody cared. It was cheap, it was fast, it was good-enough, and it was “Cut! Print it!”


I agree, but the question is in cheating quality. If you use cg tricks, you complicate the scene setup. Also in real life you already have a realistic scene. In cg you work from the opposite, and each time you break the rules you bias the rendering to the unrealistic result. In photography you start cheating from light position, light blocking and camera settings. Then you manage reflections and diffuse values by adjusting light blockers, changing the environment and camera position\settings. Anyone who is passed this scene on will have no troubles tweaking ti further. From another point, they use polariser fitlers to get rid of reflections, block lighting from producing speculars, spray with dulling or increasing specularity sprays, “paint with light” using long exposure to put the lightsource into the camera visible range but not visible in the final image, and even combine different exposures to make something like a collage. But not vice-versa. It looks like that there must be clearly defined workflow establishing what is more physically correct and less, and work from there.

Quality (imo) cheats:
by changing the light position and size of the lightsources
light blocking using gobos and adjusting the environment
managing reflections using gobos, camera position and environment
light diffusion using translucent, reflective planes(any substitutes imo are ok, like using mapped planes)
specular gobos

Those cheats are a bit “cheap” in cg:
light blocking using including\excluding from light
increasing\decreasing reflectivity of shaders even if you know it’s correct
tweaking the diffuse even if you know it’s quite balanced
turning off “visible to camera”(though “painting with light” technique can use lighting of a source withing the camera view, but it’s not visible due to long exposure, but for stills)

Many people are interested in “unbiased” renderer Maxwell. I didn’t use it, but from what I know it limits you to real life setups.
Probably using only cg tricks or completely omitting them in lighting is wrong, both are the extremes. Cg tricks are quite often possible in photography as photographers exist for a long time and developed their own arsenal of tricks to be free in artistic choices (up to retouching). But let’s work from the ground up:
breaking physical laws is wrong. Those have been discussed already, but I will revise and reorganise the information soon.
If you can keep the physically correct route, keep it, but if you inevitably (debatable) need to hack, you can either:
use cg techniques
use photography hack techniques

Both require knowledge and experience, and perhaps only experience can tell what is more appropriate. But knowing both ways is a plus.


hi guys,

thanks for the GREAT info. i have a question regarding the setup of materials in engines like vray. as an example, i will use a PAPER material. in an earlier post in this thread, it is claimed that a sheet of paper is 80% reflective.

assuming this is correct, how should i set up diffuse and reflective parameters (for simplicity, let us assume that no light is transmitted)? if reflection is 80%, does that mean that diffuse should only be 20%? if i render this way, the paper sheet comes out too dark…

a lot of times i see material setups on various websites and they have diffuse and reflection both set to 100%! surely this is incorrect?

any advice?



Your diffuse should not be more than 80% of brightness, but also your reflection must be very low and diffuse (for paper). This brings up an interesting thing: both diffuse and reflection are actually the same kind of parameter, but treated differently for the sake of speed. So saying that reflection overrides diffuse is just how cg software treats it as it should keep it no more than 1, that’s why it overrides it. indeed it’s the same reflection in nature, either diffuse, or glossy or specular. But as long as it’s the same parameter, either should not be more than 80%.
In vray setting both to 100% doesn’t make sense as if you set your reflection to 100% it doesn’t matter what your diffuse value is as it’s fully overriden. If it’s less than 100%, than it mixes with diffuse, so if it dffers from black it interfers with your reflection (either for good or for bad, it’s up to you).


thanks for the reply mister3d, but i’m still unsure on something.

but if paper is 80% reflective:

then shouldn’t i set the reflection parameter to 80% (glossy reflections of course) and set the diffuse to 20%. OR do i ignore the ‘sum of light absorbed/reflected/transmitted = 1’ rule and set reflection and diffuse BOTH to 80% (but therefore sum of light = 1.6)?


I think you can set your reflection to 80%, but it must be pure raytraced reflection then. DIffuse value is fake, because it’s not raytraced. Create a vraymaterial(or mental ray arch&design) and set its diffuse to 0%, then reflectivity to 80% and glosinness to 0,2(20%). This is the true raytraced diffuse.
It cannot be 1.6 in total, it’s locked to be no more than 1(unless you tweak in the difuse map parameters without clamping). But for paper raytraced reflection is not as important as for chrome, that’s why you kind of mix the true reflection onto fake diffuse value, at least how I understand it.


No, your total reflection should be no more then 80%. So ‘diffuse’ + ‘reflection’ ≤ 0.8. Also in the case of paper diffuse and reflection are different parameters, both in 3D and in reality, it’s not a speed issue.

    What goes in must come out in some way, either (in the case of dielectrics...non-metals... paper) being absorbed or bounced back out of the subsurface or the surface layers. Subsurface being the part that gives the colour to the bounced light.... the 'diffuse' part. The surface part is dependent on how rough the surface is, ranging from mirror-like to diffuse (lambert) reflection at the extremes... the 'reflection' part.
     See it this way, with dielectrics part of the light coming in gets absorbed, it's gone as far as CG is concerned. 
     The second part gets scattered in the subsurface of the material and actually makes it back out. Certain wavelengths get absorbed giving the colour to the material, like blue plastic. It's close enough to being perfect diffuse to get away with treating it as a lambert function. 
     The third part is the part that gets bounced off the surface of the material while almost the complete spectrum is being bounced back. 
 With metals light either gets absorbed or gets reflected off the surface. The amount light bouncing around under the surface and coming back out is so little it can be ignored. Also with metals there's much more absorbance of certain wavelengths with the surface reflection. That's why you can have coloured specular reflections with metals that you can't have with dielectrics.

 So for your shaders you should have the following.
 - First part gets absorbed.
 - Second part gets bounced off of the surface, which can be rough or smooth resulting in resp. diffuse or specular reflection. A large part of the spectrum can be absorbed here resulting in a coloured reflection.
 - First part gets absorbed, I guess most of it in the subsurface layer.
 - Second part gets bounced around in the subsurface layer which is inherently rough, so diffuse. Here part of the spectrum can be absorbed resulting in coloured light.
 - Third part gets bounced off of the surface, which can be rough or smooth... diffuse or specular. The spectrum stays pretty much how it is here, so white light stays white light.
 Now the [i]ratio[/i] (!) between the subsurface and surface parts is determined by the fresnel rule. In the case of a smooth blue plastic in a white environment making the object look more white at low angles and more blue at high angles. As it's a ratio between the two you can see how it can't be larger than one.
 Something like a town with white rooftops and blue streets. Viewed from a road some distance away you'll seen only the white rooftops while flying over the town you'll seen a lot more of the blue streets, but the amout of rooftops and streets stays the same.
 The fresnel rule also applies to metals, but make sure you use the full equation, not the simplified one used to speed up calculations for dielectrics. Here it gives you the ratio between reflected and absorbed light. Most shaders don't use the complex fresnel function.

So… assuming most light gets absorbed in the subsurface layer of paper you should set your vray diffuse colour to 80% white for perfect white paper. Set your reflection colour to 100% white but make sure you use the fresnel option in vray and use an IOR of around 1.4 I guess. Without the fresnel option it’ll look like crap. Vray correctly uses the fresnel number as a ratio and so the visible light won’t exceed one.
Now what’s left is the roughness value, change it to get either diffuse or specular reflection.
Use maps for the diffuse colour and for the roughness as well to make it look more real. Don’t make the paper perfecly smooth, so subtle maps for bump and roughness will work really well, even for high-gloss paper.

   Actually the names 'diffuse' and 'reflection' are a bit confusing as they're both reflected or bounced light. However with paper the 'diffuse' part is always a diffuse reflection and the 'reflection' part can range between diffuse and specular reflection depending on how rough the surface is.

Hope this helps!


The name ‘reflection’ used as a shader parameter is an absolute nightmare, since as Rens said ‘diffuse’ reflection is still reflection, it’s just diffuse as opposed to specular. It’s all needlessly confusing.

Rens’s explanation of what’s going on in the paper case is very good. One thing I would add though is that you can’t just use a fresnel function out of the box with rough surfaces. The reason is that the fresnel function only really works with perfectly specular surfaces. I believe maxwell gets around this by changing the frensel result with a curve depending on surface roughness. This curve is user-controlled. This is similar to what we do here: just reduce the ‘strength’ of the fresnel function for rough surfaces. As far as I am aware, there is no BRDF that simulates this effect in any meaningful (much less phsyically accurate) way. I’m not sure what parameters you might have in vray for being able to achieve the same thing.


those are great explanations - thanks to all of you.

i am a bit confused so i’ll have to read this all again and try some materials out to see how they look.

in layman’s terms:

i give the paper material an 80% white diffuse - because no material is 100% reflective

i give the paper 100% glossy fresnel reflection - because the level of reflection is greater when the angle of incidence is lower

when the angle of incidence is lowest (and therefore reflection is highest) the renderer will calculate that since reflection is so high, diffuse is not relevant and therefore the ‘sum of light = 1’ rule is preserved. similarly, when the angle of incidence is higher and reflection is lower, the renderer then takes into account a higher diffuse value.

when reflection is high, the fact that the reflection is so glossy means that the material will reflect back its own colour??? this is the bit i don’t understand (or one of the bits!)

in vray, AFAIK, fresnel is applied either as a setting in the reflection panel - simple on/off and adjustable IOR, or it can be applied as a map with user adjustable reflection levels and ‘roughness’ curve


Good point there. So of course one way a lot of renderers are simulating rough surface reflections is by shooting tons of rays at the objects and offsetting each angle. Would having specular ‘micro-facets’ and also a fresnel calculation for each ray be a correct but slow way of simulating rough surfaces? Or are there some other factors that need to be considered in this case?

Not sure I quite follow what you mean here. But if you’re asking what happens when a material has a rough surface then the fresnel effect will not be as visible, it’ll seem to spread out as the material gets rougher. In the case of rough paper the surface part of the reflected light, or ‘reflection’, will still leave the spectrum as it is, it still won’t tint it like the subsurface part would. It’ll just be added more uniformly on top, with not much of the fresnel edge effect being visible.