Improved SoftLight for Mental Ray

Plugins linking to this thread: (hide)

Advanced SoftlightAuthor: si-community user moin
This light shader adds number of options that can be very useful for mental ray lighting optimization:

A performance option to disable shadow softness for the finalgather prepass Gamma corrected light color for a correct preview of the light's color when using linear workflow Secondary falloff settings for more control over the falloff shape The »Soft Screen« feature that basically allows you to texture the light's sampling quality using a texture in screen space.

A comment from the author on »Soft Screen«: Since i discovered this feature about one and a half year ago i use it all the time. It is great! You just take a preview of your render in photoshop and paint with a white brush on a black background over the parts that you want sampled more intensively. For instance you can leave the background, and other areas in which soft shadows might not be noticed, black. it can save huge amounts of render time. Especially the feature to control the amount of lightsamples with a texture seems very interesting to me, so if anybody is interested he or she can download the compound. I just put it together and have not tested it to a great extent, so there might still be some issues/ bugs hidden somewhere.

Of course being a compound this plugin can be edited and customized at will. Usage screenshot. See the si-community thread for more details on this shader compound.

local backup: Advanced Softlight v1.00.xsirtcompound

Discussions about rendering in SOFTIMAGE©
Post Reply
moin
Posts: 8
Joined: 21 Jul 2013, 21:30
Location: berlin
Contact:

Improved SoftLight for Mental Ray

Post by moin » 17 Dec 2014, 16:27

I put together a compound to improve the usability and speed of the SoftLight Node of Mental Ray.

Mainly it has four new features:

1. The compound lets you decide if Raytraced Soft Shadows should be considered when precalculating finalgather points, or if during the finalgather calculation the light should have hard raytraced shadows
This has the potential to save quite some render time.

2. I added a gamma correction to the color input of the softlight. The color that you pick is now actually the color of the light in a linar workflow.

3. I added a second Light-Falloff which can be used together or instead the built in Falloff. It should give better control over the appearance of a light falloff.

4. You can add a texture to the light node to control the amount of samples that the raytraced softlight uses.
Since i discovered this feature about one and a half year ago i use it all the time. It is great! You just take a preview of your render in photoshop and paint with a white brush on a black background over the parts that you want sampled more intensively. For instance you can leave the background, and other areas in which soft shadows might not be noticed, black. it can save huge amounts of render time.


especially the feature to control the amount of lightsamples with a texture seems very interesting to me, so if anybody is interested he or she can download the compound. I just put it together and have not tested it to a great extent, so there might still be some issues/ bugs hidden somewhere.

to put it to work you have to change the soft_light spdl though.

it is most likely to be found: C:\Program Files\Autodesk\Softimage 2015\Application\phenolib\spdl\soft3d

by default the softness of the raytraced shadows of a softlight is not texturabel
you have to open the soft_light.spdl in a texteditor (with administrator rights) and change the text from "off" into "on" like here:

Parameter "rayshadow_softness" input
{
guid = "{0E473B1F-4BB1-4c78-A686-19ABD2A7E02A}";
type = scalar;
value = 0.0;
texturable = on;
value minimum = 0.0;
}
Parameter "rayshadow_samples" input
{
guid = "{3A64D60C-07F4-4923-944C-8F346935B21B}";
type = integer;
value = 0;
texturable = on;
value minimum = 0;
}

also:
Parameter "mode" input
{
title = "Light Mode";
guid = "{07C5EDED-52A4-11D0-8298-00A0243E366B}";
UI "mapping" = "{F237AC45-248E-4c19-A1B6-DBC3AD39B9B3}";
type = integer;
flags = 1;
value = 1;
animatable = off;
texturable = on;
}

edit:
i uploaded a new version of the compund
Attachments
Advanced Softlight v1.01.xsirtcompound
(34.54 KiB) Downloaded 107 times
Advanced Softlight v1.00.xsirtcompound
(34.69 KiB) Downloaded 107 times
Advanced_Soft_Light.jpg
Last edited by moin on 19 Feb 2015, 22:55, edited 3 times in total.

User avatar
rray
Moderator
Posts: 1775
Joined: 26 Sep 2009, 15:51
Location: Bonn, Germany
Contact:

Re: Improved SoftLight for Mental Ray

Post by rray » 17 Dec 2014, 16:38

Very nice thanks a lot for sharing. Would it be possible to create an alternative light shader that uses the modified spdl ?
softimage resources section updated Jan 5th 2024

moin
Posts: 8
Joined: 21 Jul 2013, 21:30
Location: berlin
Contact:

Re: Improved SoftLight for Mental Ray

Post by moin » 17 Dec 2014, 16:49

rray, i do not quite understand what you mean.

once you edit the soft_light.spdl and change the texturabele parameter of the rayshadow from "off" to "on", it lets you plug in textures to that parameter in the softlight node.
i myself stumbled over this by pure luck some time ago. i am more an artist and less a coder. i do know how to plug a few nodes together in the render tree but beyond that i know next to nothing about how shaders work in general.

User avatar
rray
Moderator
Posts: 1775
Joined: 26 Sep 2009, 15:51
Location: Bonn, Germany
Contact:

Re: Improved SoftLight for Mental Ray

Post by rray » 17 Dec 2014, 17:35

Just in case somebody can't/doesn't want to change the spdl file, I think it may be possible to make a new shader plugin out of your modded spdl. I'll have a try.
softimage resources section updated Jan 5th 2024

moin
Posts: 8
Joined: 21 Jul 2013, 21:30
Location: berlin
Contact:

Re: Improved SoftLight for Mental Ray

Post by moin » 17 Dec 2014, 19:55

rray, ah now i understand. i guess it is possible though i have never done such a thing and wouldnot know how to do it.

for the light itself:
i have done a test on an older scene of mine to measure the performance improvements of the features.

the renders have a simple light setup. 1 light (the sun) with soft raytraced shadows and a dome with a constant shader for the indirect light from the sky.

everything rendered with final gathering and unified sampling 1/10 quality 0,8 rendered at 1200x800
render A is with a default soft light, soft raytraced shadows 8 Samples . rendertime: 17:32 total including 9:38 for final gather calculations
render B ist the advanced softlight with "use simple FG" activated. rendertime 10:43 total including 2:55 for final gathering
render C has "use simple FG" activated also it uses "use Soft Screen" with image D as the texture: black means 2 samples for the soft raytraced shadows, white means 8 samples.
rendertime render C: 6:44 total including 2:55 for final gathering.

so 2 simple tricks speed up this rendering by about 260% (mostly because the soft shadows on the grass are really time consuming so other scenes might not be as impressive).
i had to scale the images down to 50% to be able to attach them to the post but in ful resolution it is very hard to notice any difference between them.
Attachments
Advanced_Soft_Light_Examples.jpg

Kzin
Posts: 432
Joined: 09 Jun 2009, 11:36

Re: Improved SoftLight for Mental Ray

Post by Kzin » 28 Dec 2014, 20:10

hehe, nice one!
handpainted light importance sampling, i really like the idea behind.

User avatar
rray
Moderator
Posts: 1775
Joined: 26 Sep 2009, 15:51
Location: Bonn, Germany
Contact:

Re: Improved SoftLight for Mental Ray

Post by rray » 19 Feb 2015, 18:36

It looks like it's working without the SPDL patches even, because the connections are already set up in the compound
softimage resources section updated Jan 5th 2024

User avatar
FXDude
Posts: 1129
Joined: 19 Jun 2012, 21:59

Re: Improved SoftLight for Mental Ray

Post by FXDude » 19 Feb 2015, 19:00

I remember doing that (making the light sampling pluggable) when making a "less bad flickering" FG technique.

Except I used sj_radio shaders to override the sampling of the light just for what FG rays saw.

But Even when looking at your tree, I have no Idea how you came around at doing the same thing without such shaders :)

Good work though!

moin
Posts: 8
Joined: 21 Jul 2013, 21:30
Location: berlin
Contact:

Re: Improved SoftLight for Mental Ray

Post by moin » 19 Feb 2015, 23:07

i uploaded a second version of the compound.
v1.00 had a wrong connection in the rendertree wich led to a wrong calculation of finalgather intensity if the alternative light falloff was beeing used.

rray wrote:It looks like it's working without the SPDL patches even, because the connections are already set up in the compound
if i remember correctly, i could use distributet renderings on computers on which i did not change the spdl, but i could not open scenes or load the compound correctly on those. i remember that i ended up changeing the spdl on all my workstations. anyway i might be mistaken.

Post Reply

Who is online

Users browsing this forum: No registered users and 14 guests