Tutorial for Kray 1.7
Tutorial for Kray 1.7
This compelte tutorial in PDF can be downloaded here: TUTORIAL PDF DOWNLOAD
Hello!
I've decided I'll post this as WIP tutorial since i guess it's better to release it in pices and everyone can contribute than to wait until it's finished...
So for starters let's do some basic LW setting up for Kray.
First we need to set LW ray trace flags to work nicely with KRay's GI.
Go to render panel and check that you have following options right.
This will ensure that GI bounces correctly through transparent surface, casts proper shadows and calculates reflections right.
The next thing I usually do is add motion modifier SunSpot to my main Sun light so that I get correct position of the sun. This also places sun 1km away which we'll use later for inverse^2 distance in light panel.
Now open your lights properties and set your sunlight to Spot light with inverse square fallof of 1km (the distance from Sunspot modifier). Also increase light brightness to 150% or 200% or more depending on your taste.
Now our scene is still lacking some global illumination from sky so we'll add sky light. Hopefully you have skylight.p plugin installed which is a wonderful plugin from Denis Pontonnier (http://perso.orange.fr/dpont/plugins/Textures.htm).
Add "Textured enviroment" on The Effects>Backdrop tab and choose Skylight procedural texture for your enviroment.
I usually set my sky to values as you see in screenshot below.
Now we're all set to fire up Kray. Stay tuned!
Hello!
I've decided I'll post this as WIP tutorial since i guess it's better to release it in pices and everyone can contribute than to wait until it's finished...
So for starters let's do some basic LW setting up for Kray.
First we need to set LW ray trace flags to work nicely with KRay's GI.
Go to render panel and check that you have following options right.
This will ensure that GI bounces correctly through transparent surface, casts proper shadows and calculates reflections right.
The next thing I usually do is add motion modifier SunSpot to my main Sun light so that I get correct position of the sun. This also places sun 1km away which we'll use later for inverse^2 distance in light panel.
Now open your lights properties and set your sunlight to Spot light with inverse square fallof of 1km (the distance from Sunspot modifier). Also increase light brightness to 150% or 200% or more depending on your taste.
Now our scene is still lacking some global illumination from sky so we'll add sky light. Hopefully you have skylight.p plugin installed which is a wonderful plugin from Denis Pontonnier (http://perso.orange.fr/dpont/plugins/Textures.htm).
Add "Textured enviroment" on The Effects>Backdrop tab and choose Skylight procedural texture for your enviroment.
I usually set my sky to values as you see in screenshot below.
Now we're all set to fire up Kray. Stay tuned!
Last edited by jure on Fri Mar 02, 2007 8:49 pm, edited 3 times in total.
- Jure
Setting up KRay:
You can download WIP tutorial scene here:
http://www.vizualizacije.com/kray_tut/t ... _1.7-1.rar
When you open up kray you'll be presented with general setup screen.
First we'll do quick preview of the scene. Select "Low" preset from dropdown list which will set all presets on the other tabs to low. This should give us quick preview of light and mood.
Also make sure you selected Photon mapping and "cache irradiance" is checked. Photon mapping with cache irradiance is the fasted method to render your GI scenes and you're not likely to ever use any other mode except for testing or preview.
I've also turned Gamma parameter to 1.6 to make room a bit brighter since 1.0 makes it very contrasty.
This is what you should get in a couple of mins after you press render.
Oh yea, feel free to modify this scene to your liking and post results so we can see how all you are doing...
Next we'll go and optimize settings for a better GI.
You can download WIP tutorial scene here:
http://www.vizualizacije.com/kray_tut/t ... _1.7-1.rar
When you open up kray you'll be presented with general setup screen.
First we'll do quick preview of the scene. Select "Low" preset from dropdown list which will set all presets on the other tabs to low. This should give us quick preview of light and mood.
Also make sure you selected Photon mapping and "cache irradiance" is checked. Photon mapping with cache irradiance is the fasted method to render your GI scenes and you're not likely to ever use any other mode except for testing or preview.
I've also turned Gamma parameter to 1.6 to make room a bit brighter since 1.0 makes it very contrasty.
This is what you should get in a couple of mins after you press render.
Oh yea, feel free to modify this scene to your liking and post results so we can see how all you are doing...
Next we'll go and optimize settings for a better GI.
Last edited by jure on Fri Dec 22, 2006 10:58 am, edited 3 times in total.
- Jure
Okay, you can see in our last render that the GI solution is really smooth but it lacks a lot of contact shadows. This is due to low settings we use.
We're going to improve them step by step now.
First we're gonna setup our photons right.
Switch to precomputed mode
and make a render.
This render shows, in simplified explanation, cells where indirect light was computed (sampled). Now the cells are pretty big and the whole image doesn't look too smooth. Each cell contains bunch of photons that have been blurred together to form a cell. We will need more cells to get better accuracy in shadows.
We'll tweak that in "Photons" tab. First switch photon preset to "medium". This preset will raise number of photons and some other not so important settings.
Render out a frame.
You can see in the above render that irradiance is smoother but you cannot realy see any shadows forming under sofa for example. This means it will be hard for Kray to produce accurate shadows in Photon map mode. If you checked closely at render log it wrote something like this:
This means that 4700 cells were created for irradiance. That's quite low for a scene like this... We should be getting 30.000 cells rather or something around there...
We're gonna try to raise our cells first by turning on Auto for Gi resolution.
This effectively controls how samples are grouped together or something like that. The higher the resolution the bigger the cells will be...
When you render a frame this is what you get:
The cells look much smaller actually they're even a bit too small now, and you can clearly see shadow under the sofa. Quite a few splotches have appeared though. this is because Kray wasn't able to smooth out photons well since filter settings (N and irradiance blur) were too low.
We're gonna fix that by lowering number of photons. This way each cell will contain less photons which will filter out better. Let's try 300.000 photons instead if 600.000.
If you checked render log you saw there were about 17.000 cells created. That's quite alright. The irradiance isn't completely smooth yet but it should work alright. I'll explain how to get precompute even smoother in advanced users section. You can skip that if you want to go straight to FG.
**** ADVANCED USERS *****
To get smoother precomputed render you have couple of advanced controls in photons tab. First you have to select custom preset which unlocks all advanced features.
The most important settings are:
N - This is the number of photons that will be filtered togather - hence making smoother irradiance.
Precache blur - this just blurs irradiance making it smoother. (I like using this one instead of N since it's a little bit faster)
Precache distance: this setting will control cells size. If you increase it cells will get larger, lower it and cells will be smaller.
We're going to improve them step by step now.
First we're gonna setup our photons right.
Switch to precomputed mode
and make a render.
This render shows, in simplified explanation, cells where indirect light was computed (sampled). Now the cells are pretty big and the whole image doesn't look too smooth. Each cell contains bunch of photons that have been blurred together to form a cell. We will need more cells to get better accuracy in shadows.
We'll tweak that in "Photons" tab. First switch photon preset to "medium". This preset will raise number of photons and some other not so important settings.
Render out a frame.
You can see in the above render that irradiance is smoother but you cannot realy see any shadows forming under sofa for example. This means it will be hard for Kray to produce accurate shadows in Photon map mode. If you checked closely at render log it wrote something like this:
This means that 4700 cells were created for irradiance. That's quite low for a scene like this... We should be getting 30.000 cells rather or something around there...
We're gonna try to raise our cells first by turning on Auto for Gi resolution.
This effectively controls how samples are grouped together or something like that. The higher the resolution the bigger the cells will be...
When you render a frame this is what you get:
The cells look much smaller actually they're even a bit too small now, and you can clearly see shadow under the sofa. Quite a few splotches have appeared though. this is because Kray wasn't able to smooth out photons well since filter settings (N and irradiance blur) were too low.
We're gonna fix that by lowering number of photons. This way each cell will contain less photons which will filter out better. Let's try 300.000 photons instead if 600.000.
If you checked render log you saw there were about 17.000 cells created. That's quite alright. The irradiance isn't completely smooth yet but it should work alright. I'll explain how to get precompute even smoother in advanced users section. You can skip that if you want to go straight to FG.
**** ADVANCED USERS *****
To get smoother precomputed render you have couple of advanced controls in photons tab. First you have to select custom preset which unlocks all advanced features.
The most important settings are:
N - This is the number of photons that will be filtered togather - hence making smoother irradiance.
Precache blur - this just blurs irradiance making it smoother. (I like using this one instead of N since it's a little bit faster)
Precache distance: this setting will control cells size. If you increase it cells will get larger, lower it and cells will be smaller.
- Jure
Setting up FG
FG or Final Gathering is the final stage of "photon mapping" rendering. What it does is it computes GI only at important points in an image. This points are selected more densly by Kray on places where it is most likely for a shadow to occur.
First we need to change Diffuse model on General tab to Photon mapping with cache irradiance turned on.
Then let's turn FG preset to medium
and see what we get.
Now that's not bad at all!
Thank you for your attention and happy rendering! just kidding...
The outcome is quite good but we'll do some optimizing just to show you what you can tweak.
From here on we'll go more deeply into how to optimize KRay.
One of the most important things with FG is correct density of samples. If the samples are spread too far appart the shadows will look blurred, if they're too close you'll need more rays to get clean rendering.
We have couple of controls to control this. The most important ones are:
FG threshold FG rays min and FG max.
We will first check where Kray computes FG points. To do this we need to turn prerender to 0%, next turn on show samples "All" and just for the sake of faster rendering let's turn FG rays max to 100. Also go to sampling tab and set Antialiasing to "none".
We get this render:
[/img]
You can see how Kray places samples (the pink dots) at "strategic" places where it expects shadows to occur. On large flat areas there are very few sampled points because KRay knows lighting won't change much there. On places around corner there are alot more samples to accurately compute shading.
The density of samples seems a little sparse in the above image so we will make them closer. We can do that with couple of advanced settings so this is the part where we will unlock "advanced settings". Select "custom" from the preset list and settings will get unlocked.
The setting that influences density of samples the most is "spatial tolerance". Right now is set to 0.2 but we'll set it to 0.1 and how density of samples changes this way.
You see how the samples are positioned much closer now. This will create more accurate shadows in those places. We can further tune samples with following settings:
Distance Min/Max = this controls minimun and maximum distance between samples. If min and max are exactly the same, samples will be distributed equaly appart across all surfaces (and we don't want that).
B/D = this value will add more samples but only to places with high light contrast (corners). This can further improve quality of shadows if needed. I like to keep this value between 0-100% depending on the scene.
This is image with B/D set to 0%. You can see how samples in corners are not as dense as before.
I will now turn B/D to 50% since default 100% seems a bit high...
This looks good to me, we're gonna turn off "show samples" now and tweak FG rays. Let's try this settings first and see if it's good enough: FG threshold 0.0001 FG rays min 100 FG max 600.
That looks pretty cool. You can see we get better shadows now than before when we used medium preset. I can't see any splotches either. I think I'm gonna try with even lower FG max to get faster results. Let's try... hmm.. max 300.
You can start seeing some artifacts in the corners and shadows start to fade away also... But we gained 2 minutes. So it's up to you to decide which way you want to go.
All there's left now is add some antialiasing. We'll cover Antialiasing in some other tutorial since that needs a bit more explanation. For this tutorial I'm just going to select a medium preset for a start and then customize some settings.
Upsample we can turn to 0 since this is used when you have fine details in your image that normal resolution cannot capture. Z distance is also a little bit low so I'm gonna turn it up a bit. That's it.
Here's our final image. (yea I know it needs some surfacing and lighting polishing but that's where you come in!)
Here's a final scene file if you wan't to test it yourself...
http://www.vizualizacije.com/kray_tut/final.lws
Hope you enjoyed this and I hope to hear your questions and comments!
FG or Final Gathering is the final stage of "photon mapping" rendering. What it does is it computes GI only at important points in an image. This points are selected more densly by Kray on places where it is most likely for a shadow to occur.
First we need to change Diffuse model on General tab to Photon mapping with cache irradiance turned on.
Then let's turn FG preset to medium
and see what we get.
Now that's not bad at all!
Thank you for your attention and happy rendering! just kidding...
The outcome is quite good but we'll do some optimizing just to show you what you can tweak.
From here on we'll go more deeply into how to optimize KRay.
One of the most important things with FG is correct density of samples. If the samples are spread too far appart the shadows will look blurred, if they're too close you'll need more rays to get clean rendering.
We have couple of controls to control this. The most important ones are:
FG threshold FG rays min and FG max.
- FG rays min is the minimum amount of rays Kray will use at specific point.
FG max is maximum number of rays at specific point.
FG Threshold is the difference between to sampled points. When the difference is bigger than specified value Kray will increase number of rays untill it reaches maximum number of rays (FG max).
We will first check where Kray computes FG points. To do this we need to turn prerender to 0%, next turn on show samples "All" and just for the sake of faster rendering let's turn FG rays max to 100. Also go to sampling tab and set Antialiasing to "none".
We get this render:
[/img]
You can see how Kray places samples (the pink dots) at "strategic" places where it expects shadows to occur. On large flat areas there are very few sampled points because KRay knows lighting won't change much there. On places around corner there are alot more samples to accurately compute shading.
The density of samples seems a little sparse in the above image so we will make them closer. We can do that with couple of advanced settings so this is the part where we will unlock "advanced settings". Select "custom" from the preset list and settings will get unlocked.
The setting that influences density of samples the most is "spatial tolerance". Right now is set to 0.2 but we'll set it to 0.1 and how density of samples changes this way.
You see how the samples are positioned much closer now. This will create more accurate shadows in those places. We can further tune samples with following settings:
Distance Min/Max = this controls minimun and maximum distance between samples. If min and max are exactly the same, samples will be distributed equaly appart across all surfaces (and we don't want that).
B/D = this value will add more samples but only to places with high light contrast (corners). This can further improve quality of shadows if needed. I like to keep this value between 0-100% depending on the scene.
This is image with B/D set to 0%. You can see how samples in corners are not as dense as before.
I will now turn B/D to 50% since default 100% seems a bit high...
This looks good to me, we're gonna turn off "show samples" now and tweak FG rays. Let's try this settings first and see if it's good enough: FG threshold 0.0001 FG rays min 100 FG max 600.
That looks pretty cool. You can see we get better shadows now than before when we used medium preset. I can't see any splotches either. I think I'm gonna try with even lower FG max to get faster results. Let's try... hmm.. max 300.
You can start seeing some artifacts in the corners and shadows start to fade away also... But we gained 2 minutes. So it's up to you to decide which way you want to go.
All there's left now is add some antialiasing. We'll cover Antialiasing in some other tutorial since that needs a bit more explanation. For this tutorial I'm just going to select a medium preset for a start and then customize some settings.
Upsample we can turn to 0 since this is used when you have fine details in your image that normal resolution cannot capture. Z distance is also a little bit low so I'm gonna turn it up a bit. That's it.
Here's our final image. (yea I know it needs some surfacing and lighting polishing but that's where you come in!)
Here's a final scene file if you wan't to test it yourself...
http://www.vizualizacije.com/kray_tut/final.lws
Hope you enjoyed this and I hope to hear your questions and comments!
Last edited by jure on Thu Feb 15, 2007 11:37 am, edited 2 times in total.
- Jure
- phile_forum
- Posts: 177
- Joined: Wed Aug 16, 2006 11:12 pm
- Location: UK
- Contact:
phile wrote:16 minutes for that render?
Time for me to hit my credit card.
Excellent tutorial Jure. Many thanks!
Phil
While you are searching your card here's my scene with a little bit different settings.
My "best lap" on an X2 4800+ is just under 4 min
--- thanks for this GREAT tutorial ---
- Attachments
-
- final_G1.lws
- (13.51 KiB) Downloaded 927 times
-
- 00700000.png (254.55 KiB) Viewed 12265 times
-
- Posts: 90
- Joined: Thu Nov 16, 2006 9:11 am
- Location: France
-
- Posts: 34
- Joined: Tue Oct 09, 2007 12:48 am
- Location: www.slapshothockey.co.uk