## ## Copyright (c) 2005 PIXAR. All rights reserved. This program or ## documentation contains proprietary confidential information and trade ## secrets of PIXAR. Reverse engineering of object code is prohibited. ## Use of copyright notice is precautionary and does not imply ## publication. ## ## RESTRICTED RIGHTS NOTICE ## ## Use, duplication, or disclosure by the Government is subject to the ## following restrictions: For civilian agencies, subparagraphs (a) through ## (d) of the Commercial Computer Software--Restricted Rights clause at ## 52.227-19 of the FAR; and, for units of the Department of Defense, DoD ## Supplement to the FAR, clause 52.227-7013 (c)(1)(ii), Rights in ## Technical Data and Computer Software. ## ## Pixar Animation Studios ## 1200 Park Ave ## Emeryville, CA 94608 ## ## ## Filter.slim ## A simple filtering funtion ## slim 1 extensions pixartt { extensions pixar pxsl { template float Filter { description { Perform the selected filtering operation on the input. } parameter float Input { detail mustvary description { Pattern to feed through smoothstep } default s } slimattribute string Operation { description "Operation to perform on input" subtype selector range { Clamp clamp Remap remap Smoothstep smoothstep } default smoothstep } parameter float MinVal { label "Min Value" description { Threshold below which the function will return 0 } default .2 range {0 1 .001} subtype slider } parameter float MaxVal { label "Max Value" description { Threshold above which the function will return 1 } default .8 range {0 1 .001} subtype slider } parameter float Scale { description { Scale to apply to the result } detail varying default 1 } parameter float result { access output display hidden } RSLSource DynamicFunction { proc primvars {} { } proc function {} { generateBody { switch [getval Operation] { clamp { output "/* clamp */" output "result = Scale * clamp(Input, MinVal, MaxVal);" } remap { output "/* remap */" output "result = Scale * (MinVal + Input * (MaxVal-MinVal));" } smoothstep { output "/* smoothstep */" output "result = Scale * smoothstep(MinVal, MaxVal, Input);" } default { output "/* unrecognized Operation: [getval Operation] */" output "result = 0;" } } } } } } } }