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?

Moderators: ChrisHekman, aoktar
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);
}
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?jayroth2020 wrote:Create an OSL texture node, and paste the following OSL script into it. Then compile:
This is the exact OSL script I used for the image and the nodegraph you showed.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); }
any chance you'd upload that scene file? I'm still failing to get this working properlyjayroth2020 wrote:Create an OSL texture node, and paste the following OSL script into it. Then compile:
This is the exact OSL script I used for the image and the nodegraph you showed.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); }