TUTORIAL/DIAGRAM: How Portals work and how to use them

Post, discuss and share handy resources like textures, models and HDRI maps in this forum.
Forum rules
Please do not post any material that is copyrighted or restricted from public use in any way. OTOY NZ LTD and it's forum members are not liable for any copyright infringements on material in this forum. Please contact us if this is the case and we will remove the material in question.

TUTORIAL/DIAGRAM: How Portals work and how to use them

Postby radiance » Sun Jul 10, 2011 4:08 am

Hi all,

I decided to write a detailed post with some schematics to explain how portals work and how to use them.
Please read this post carefully to learn what you need to know about them.

portal_graph.png


Imagine the following situation. (please look at the diagram image attached, I will explain what's on it here)

You have an interior scene, with one small window.
In this simplified scenario, we have a simple cube, with one small window/opening, and a camera inside,
simulating a very simple interior setup.

The way pathtracing algorithms work (not directlighting/ambient occlusion),
is that a ray is traced, starting to the camera, which is sent into the room,
and arrives at the first intersection, being a point on a wall.

At this point, we need to trace a shadow ray to the sky, and if the ray is unoccluded (eg there is nothing blocking/in between),
the sky is visible on that location in the direction of the shadow ray, and we can include the environment light.

The orange lines are the rays of the path. The orange discs are the points where they intersect with the scene,
in almost all cases these will be locations on a wall of the cube, inside.

A path bounces around multiple times, so we can determine the full global illumination / reflections for the path.
You will usually get anything between 2 to 16 bounces (depends on maxdepth setting)
like this per path (eg this will be the path length).

To compute if the intersection points (orange discs) have any skylight arriving on them,
we need to randomly shoot a ray from the intersection point into a random direction,
and then, if that ray has nothing in between (eg it's not occluded), it will find the sky,
and we can include the skylight arriving from that direction.
If it's occluded, eg there is something in between, like a wall, the point does not receive any skylight from that direction.

As you can see in the left diagram, most of the bounces cannot find any skylight,
as most of the time, all the random shadow rays will be occluded, eg there is nearly always a wall between it and the sky.

Only when we actually, by chance, go through the small window, will the skylight be found, giving light.
As you can see in the diagram, a lot of computation is lost, as most rays contribute nothing.
This is very inefficient, eg it will converge slowly (you will require a lot more samples per pixel to get a clean render).


The diagram on the right gives a simplified picture of what happens when a portal is used.

A portal is placed in the window, eg a simple plane is placed in the window/opening, which covers the whole opening.
The normal of the portal must face inwards of the room, so the engine can know how to determine if it's going inside or outside (which we want).

As you can see, the intersections here do not shoot shadow rays into random directions anymore,
but, instead, they are shot through the portal.
Eg, we fire the shadow rays through a random location on the portal geometry (being a plane here).

It's pretty obvious that with this scenario, we provide help to the engine and nearly all of our shadow rays will find skylight now,
giving a much improved convergence, and less samples will be needed to get a clean render.

Using a propperly configured scene with portals, you can get a large speed up, sometimes 2 to 4x as fast.


I hope this explains things fully, if you have any questions, feel free to ask.
Here are a few additional things you need to know about when using portals.

* Portals are new in OctaneRender and are not %100 optimized and fully tested in the recently released 2.48 TEST.
Don't use these for production work, and please support us by posting your test results and any issues.


* Portals can only be used for scenes where you render geometry inside a space. (for now, this might change soon)

* If you use portals, you MUST cover all openings, eg if you only place portals on one of multiple windows,
the engine will always shoot rays through the window with the portal, giving incorrect results as the other windows will not pass light through.

* It's important that the normal is on the correct side, eg the engine will always shoot light towards portals,
when it can shoot the ray into the normal of the portal, eg the normals must point inwards.

* Currently, although this will change soon, you cannot place portals in openings which are not open,
eg a window with a portal cannot contain glass at this time.

* In some complex scenes and situations, portals might slow down the render, so a bit of experimentation with/without should be done.

* Portals only apply to pathtracing type kernels, eg pathtracing and PMC. (not directlighting/ambient occlusion)

* It is best to try to use the least amount of geometry for portals, eg only a few simple rectangular planes are best,
the more geometry your portals contain, the slower the engine might become.

* sometimes it is better to place one large portal over many small windows due to the above.
It's ok to make a portal larger than the opening, just make sure it closes/covers all opening(s).
A portal which is unnecessarily large will end up slowing down the efficiency, as some of the rays through the covered parts of the portal will not go outside the space.

* Portals, when defined with the portal material, will not show up in your render, eg this will be invisible geometry.


I hope this explains things for all the users who have not had any experience with portals in unbiased engines.
Note that updates to octane coming out during the next week will improvide portal performance/behaviour.


Radiance
Win 7 x64 & ubuntu | 2x GTX480 | Quad 2.66GHz | 8GB
User avatar
radiance
OctaneRender Team
OctaneRender Team
 
Posts: 7633
Joined: Wed Oct 21, 2009 2:33 pm

Re: TUTORIAL/DIAGRAM: How Portals work and how to use them

Postby matej » Sun Jul 10, 2011 7:27 am

Nice & detailed explanation. I like it because it's technical (and so it lets you to understand why are you doing something, not only how to do it)
SW: Octane 3.05 | Linux Mint 18.1 64bit | Blender 2.78 HW: EVGA GTX 1070 | i5 2500K | 16GB RAM Drivers: 375.26
cgmo.net
User avatar
matej
Licensed Customer
Licensed Customer
 
Posts: 2083
Joined: Fri Jun 25, 2010 7:54 pm
Location: Slovenia

Re: TUTORIAL/DIAGRAM: How Portals work and how to use them

Postby teecee2107 » Sun Jul 10, 2011 8:03 am

Thanks for the explanations, Radiance. Very useful and handy for newbies (like me ...)
Core 2 Quad Q9400 | 8Gb | Zotac 580 GTX 3 Gb | Windows 7 64bits | Octane 1.11 | Nvidia Driver 310.70
User avatar
teecee2107
Licensed Customer
Licensed Customer
 
Posts: 209
Joined: Thu Oct 28, 2010 6:45 pm
Location: Liège - Belgium

Re: TUTORIAL/DIAGRAM: How Portals work and how to use them

Postby ribrahomedesign » Sun Jul 10, 2011 8:05 am

thanks radiance ,very good explanation .
Windows 7 , 64 b / GTX 590 / Archicad 15 , 64 b / Cinema 4D R 13 studio , 64b /Intel(R)Core(TM)Extreme3,20Ghz /always latest Octane.
ribrahomedesign
Licensed Customer
Licensed Customer
 
Posts: 409
Joined: Fri Mar 05, 2010 9:32 am

Re: TUTORIAL/DIAGRAM: How Portals work and how to use them

Postby OctaneFX » Mon Jul 11, 2011 5:34 pm

Thanks to take a bit of your time. ;)
Win Vista Integral x64 | 2 x GTX 460 | Quad 2,4 GHz | 8 GB
User avatar
OctaneFX
Licensed Customer
Licensed Customer
 
Posts: 48
Joined: Wed Sep 08, 2010 10:47 am
Location: FRANCE

Re: TUTORIAL/DIAGRAM: How Portals work and how to use them

Postby ROUBAL » Wed Jul 13, 2011 5:23 pm

Yes, useful advices. Thank you Radiance !
French Blender user - CPU : intel Quad QX9650 at 3GHz - 8GB of RAM - Windows 7 Pro 64 bits. Display GPU : GeForce GTX 480 (2 Samsung 2443BW-1920x1600 monitors). External GPUs : two EVGA GTX 580 3GB in a Cubix GPU-Xpander Pro 2. NVidia Driver : 368.22.
User avatar
ROUBAL
Licensed Customer
Licensed Customer
 
Posts: 2199
Joined: Mon Jan 25, 2010 5:25 pm
Location: FRANCE

Re: TUTORIAL/DIAGRAM: How Portals work and how to use them

Postby Diogo Moita » Fri Jul 15, 2011 12:36 pm

Good material!
i7 930, 12Gb, 2x GTX470
http://www.3dm.com.br
User avatar
Diogo Moita
Licensed Customer
Licensed Customer
 
Posts: 58
Joined: Tue Jan 26, 2010 4:20 pm
Location: Brazil

Re: TUTORIAL/DIAGRAM: How Portals work and how to use them

Postby Lutze » Fri Jul 15, 2011 1:27 pm

Thanks Radiance for your work with this. Comes very handy.
_________________
System: AMD X4, 2x GTX470, 8GB Ram, Win7-64Bit
User avatar
Lutze
Licensed Customer
Licensed Customer
 
Posts: 101
Joined: Sat May 08, 2010 6:02 pm

Re: TUTORIAL/DIAGRAM: How Portals work and how to use them

Postby r4ytrace » Sat Jul 16, 2011 7:06 pm

the keeping everything sealed part of this reminds me of my QuakeIII mapping days :D
User avatar
r4ytrace
Licensed Customer
Licensed Customer
 
Posts: 172
Joined: Thu Jan 20, 2011 12:42 am

Re: TUTORIAL/DIAGRAM: How Portals work and how to use them

Postby p3taoctane » Sun Jul 17, 2011 7:32 pm

How does one increase the portals strength.
I have a box with one opening and a portal which is a single plane and it covers the opening. What controls the strength of the portal? Is it the strength of whatever light one uses... i.e if you increase daylight strength does it essentially go "through" the portal and increase it's "powers" to act as you described in the diagram?

Thanks

Peter
Windows 7 Pro_SP 1_64 bit_48 GB Ram_Intel Xeon X5660 2.80 GHZ x2_6 580GTX_1 Quadra 4800
p3taoctane
Licensed Customer
Licensed Customer
 
Posts: 1332
Joined: Mon Jan 25, 2010 12:53 am
Next

Return to Resources and Sharing


Who is online

Users browsing this forum: No registered users and 2 guests

Thu Mar 30, 2017 6:34 pm [ UTC ]