Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Stockner <lukas.stockner@freenet.de>2018-06-15 12:03:29 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2018-06-15 23:16:06 +0300
commit799779d432309e518922d23e3a1d1b5baaece71d (patch)
treedf190f684ce9b86f412913bc0dc4b8dd07491e57 /intern/cycles/kernel/shaders
parent2b9edbc98becb540f1f907b7c31d7971b1603079 (diff)
Cycles: change Ambient Occlusion shader to output colors.
This means the shader can now be used for procedural texturing. New settings on the node are Samples, Inside, Local Only and Distance. Original patch by Lukas with further changes by Brecht. Differential Revision: https://developer.blender.org/D3479
Diffstat (limited to 'intern/cycles/kernel/shaders')
-rw-r--r--intern/cycles/kernel/shaders/node_ambient_occlusion.osl19
1 files changed, 14 insertions, 5 deletions
diff --git a/intern/cycles/kernel/shaders/node_ambient_occlusion.osl b/intern/cycles/kernel/shaders/node_ambient_occlusion.osl
index 5f056122bbe..d7ffa3c1606 100644
--- a/intern/cycles/kernel/shaders/node_ambient_occlusion.osl
+++ b/intern/cycles/kernel/shaders/node_ambient_occlusion.osl
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2013 Blender Foundation
+ * Copyright 2011-2018 Blender Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,10 +17,19 @@
#include "stdosl.h"
shader node_ambient_occlusion(
- normal NormalIn = N,
- color Color = 0.8,
- output closure color AO = 0)
+ color ColorIn = color(0.8, 0.8, 0.8),
+ int samples = 8,
+ float Distance = 1.0,
+ normal Normal = N,
+ int inside = 0,
+ int only_local = 1,
+ output color ColorOut = color(0.8, 0.8, 0.8),
+ output float AO = 1.0)
{
- AO = Color * ambient_occlusion();
+ int global_radius = (Distance == 0.0 && !isconnected(Distance));
+
+ /* Abuse texture call with special @ao token. */
+ AO = texture("@ao", samples, Distance, Normal[0], Normal[1], Normal[2], inside, "sblur", only_local, "tblur", global_radius);
+ ColorOut = ColorIn * AO;
}