## What values are being used in calculations?

Discussion related to the implementation of new features & algorithms to the Core Engine.

Moderators: Dade, jromang, tomb, zcott, coordinators

### What values are being used in calculations?

Sorry if this is a bit simple, but what data values are being used to perform calculations? For example, when a ray hits an object, what are the values being used to calculate where that ray goes next and how it's interpreted to create point in a pixel. Hope this makes sense. Thanks!
Motamob

Posts: 13
Joined: Wed Dec 28, 2016 10:00 am

### Re: What values are being used in calculations?

I'm just a user of Lux like you but I'm quite sure the base theory behind is this but implementing the theory is a whole another universe of course. You can also check 'Surface scattering models' section of this document, tiny sketches there tell a lot.

Good luck
Chawl

Posts: 92
Joined: Fri May 14, 2010 7:52 pm
Location: Turkey

### Re: What values are being used in calculations?

The topic is complex and quite broad. When a ray hits a surface, one of a few things may happen:

-the ray enters the surface and is transmitted (i.e. glass)
-the ray is reflected "randomly" (i.e. diffuse surfaces)
-the ray is reflected with specular angle (mirror)
-the ray is scattered multiple times inside the object, and then shot outside (sss, i.e. skin)

Each one of these interactions uses its own set of rules. For example, Snell law is used to calculate the transmitted direction, a hemisphere sampler is used to randomly select a diffuse reflection and so on. Other laws can be used in addition: beer's law helps determining how the light traveling through an object loses energy, and fresnel's law tells how much light is transmitted and how much reflected (= probability to be reflected and probability to be transmitted).

The details of each interaction, of course, depend upon surface details (i.e material, orientation -> normal) and incident light direction (and color, if spectral rendering is supported).

If you are interested in the implementation details, you could give a look to a few tutorials: http://www.flipcode.com/archives/Raytra ... tion.shtml is the one I started with a long time ago, but there are others and (I suppose) more recent ones.

If you are very initerested, though, you may want to give a look to the amazing book Physically based rendering from theory to implementation (http://www.pbrt.org/). I've got the first edition, but the third one has just been published and if I still had the time to play with raytracing and the like I would almost certainly buy it. (spoiler: it is a bit complex).
cignox1

Posts: 5
Joined: Fri Jan 21, 2011 5:14 am

### Re: What values are being used in calculations?

Thank you both for your replies. I'll look into all of it and hope I don't get too overwhelmed.
Motamob

Posts: 13
Joined: Wed Dec 28, 2016 10:00 am