Page 1 of 1
AOV OSL Fog Opacity node?
Posted: Fri May 13, 2022 10:16 pm
by GXGsynth
Following Lino Grandi's tutorial about using AOVs + Z-Depth for fog in Octane for Blender and trying to apply the same concept in the C4D Octane isn't quite as straightforward as I'd hoped
looking at the AOV section of the manual, the example it gives shows the use of an OSL Fog Opacity node to create a fast fog composite, where can I find the OSL script for this?
is this demo scene available for download somewhere?

Re: AOV OSL Fog Opacity node?
Posted: Fri May 13, 2022 11:03 pm
by jayroth2020
Create an OSL texture node, and paste the following OSL script into it. Then compile:
Code: Select all
shader OslTexture(
float density = 0.1 [[string label="Density", float min=0.01, float max=100]],
float maxDistance = 1000 [[string label="Max. distance", float min=0.01, float max=1000000, float slidermin=1, float slidermax=10000]],
output color c = 0)
{
float dist = clamp(length(transform("camera", P)), 0, maxDistance);
float opacity = clamp(1 - exp(-dist * density* 0.001), 0, 1);
c = color(opacity);
}
This is the exact OSL script I used for the image and the nodegraph you showed.
Re: AOV OSL Fog Opacity node?
Posted: Mon May 23, 2022 4:53 pm
by GXGsynth
jayroth2020 wrote:Create an OSL texture node, and paste the following OSL script into it. Then compile:
Code: Select all
shader OslTexture(
float density = 0.1 [[string label="Density", float min=0.01, float max=100]],
float maxDistance = 1000 [[string label="Max. distance", float min=0.01, float max=1000000, float slidermin=1, float slidermax=10000]],
output color c = 0)
{
float dist = clamp(length(transform("camera", P)), 0, maxDistance);
float opacity = clamp(1 - exp(-dist * density* 0.001), 0, 1);
c = color(opacity);
}
This is the exact OSL script I used for the image and the nodegraph you showed.
Thank you for this! any advice on getting it working? I can get the Global Tex AOV to show up correctly if the Composite AOV is disconnected, but as soon as I connect the Composite AOV, my Global Tex AOV disappears and I can't get the compositing to work at all. What blending modes do I need for the Composite AOV Output layers?
Re: AOV OSL Fog Opacity node?
Posted: Thu May 26, 2022 6:25 pm
by GXGsynth
jayroth2020 wrote:Create an OSL texture node, and paste the following OSL script into it. Then compile:
Code: Select all
shader OslTexture(
float density = 0.1 [[string label="Density", float min=0.01, float max=100]],
float maxDistance = 1000 [[string label="Max. distance", float min=0.01, float max=1000000, float slidermin=1, float slidermax=10000]],
output color c = 0)
{
float dist = clamp(length(transform("camera", P)), 0, maxDistance);
float opacity = clamp(1 - exp(-dist * density* 0.001), 0, 1);
c = color(opacity);
}
This is the exact OSL script I used for the image and the nodegraph you showed.
any chance you'd upload that scene file? I'm still failing to get this working properly
Re: AOV OSL Fog Opacity node?
Posted: Thu May 26, 2022 7:38 pm
by jayroth2020
I'll take a look at your file, if you like.