![Smile :)](./images/smilies/icon_smile.gif)
im rendering fractals with Alpha channel and i wanted to have controll over it.... that was the goal at least ... found some calculations and used max/jitter gen object to export the patch to shader code ...
http://http.developer.nvidia.com/GPUGem ... _ch22.html
the RGB_Black_In works well to a point but later it flips the colors / Help needed!!
maybe you can use it too in your work::
/*{
"DESCRIPTION": "exported jitter gen patch",
"CREDIT": "gen-C74",
"CATEGORIES": [
"GEN FX"
],
"INPUTS": [
{
"NAME": "RGB_Black_In",
"TYPE": "float",
"DEFAULT": 0.0,
"MIN": 0,
"MAX": 255
}
,
{
"NAME": "RGB_White_Out",
"TYPE": "float",
"DEFAULT": 255.0,
"MIN": 0,
"MAX": 255
}
,
{
"NAME": "RGB_Gama_In",
"TYPE": "float",
"DEFAULT": 2.0,
"MIN": 0.000001,
"MAX": 4
}
,
{
"NAME": "RGB_Blacks_Out",
"TYPE": "float",
"DEFAULT": 0.0,
"MIN": 0,
"MAX": 255
}
,
{
"NAME": "RGB_White_In",
"TYPE": "float",
"DEFAULT": 255.0,
"MIN": 0,
"MAX": 255
}
,
{
"NAME": "Alpha_Gama_In",
"TYPE": "float",
"DEFAULT": 2.0,
"MIN": 0.1,
"MAX": 4
}
,
{
"NAME": "Alpha_Blacks_In",
"TYPE": "float",
"DEFAULT": 0.0,
"MIN": 0,
"MAX": 255
}
,
{
"NAME": "Alpha_White_Out",
"TYPE": "float",
"DEFAULT": 255.0,
"MIN": 0,
"MAX": 255
}
,
{
"NAME": "Alpha_Blacks_Out",
"TYPE": "float",
"DEFAULT": 0.0,
"MIN": 0,
"MAX": 255
}
,
{
"NAME": "Alpha_White_In",
"TYPE": "float",
"DEFAULT": 255.0,
"MIN": 0,
"MAX": 255
}
,
{
"NAME": "inputImage",
"TYPE": "image"
}
]
}*/
#define hypot(x, y) sqrt(x*x+y*y)
#define xor(x, y) ((!(x&&y))&&(x||y))
#define sinh(x) (0.5*(exp(x) - exp(-x)))
#define cosh(x) (0.5*(exp(x) + exp(-x)))
#define tanh(x) ((sinh(x))/(cosh(x)))
#define asinh(x) (log(x) + sqrt(x*x+1.))
#define acosh(x) (log(x) + sqrt(x*x-1.))
#define atanh(x) (0.5*log((1.+x)/(1.-x)))
vec2 jit_wrap1(vec2 v) {
return mod(v, 1.);
}
vec2 jit_clamp1(vec2 v) {
return clamp(v, 0., 1.);
}
vec2 jit_mirror1(vec2 v) {
return 1.-abs((mod(v, 2.)-1.));
}
void main() {
vec4 in1 = IMG_NORM_PIXEL(inputImage, vv_FragNormCoord);
float swiz_38 = (in1.a);
float expr_52 = ((pow((swiz_38 * 255.0 - Alpha_Blacks_In) / (Alpha_White_In - Alpha_Blacks_In), Alpha_Gama_In) * (Alpha_White_Out - Alpha_Blacks_Out) + Alpha_Blacks_Out) / 255.0);
vec3 swiz_39 = (in1.rgb);
vec3 expr_40 = ((pow((swiz_39 * 255.0 - RGB_Black_In) / (RGB_White_In - RGB_Black_In), vec3(RGB_Gama_In)) * (RGB_White_Out - RGB_Blacks_Out) + RGB_Blacks_Out) / 255.0);
float swiz_45 = (expr_40.r);
float swiz_49 = (expr_40.g);
float swiz_48 = (expr_40.b);
vec4 vec_51 = (vec4(swiz_45, swiz_49, swiz_48, expr_52));
gl_FragColor = vec_51;
}