Logo by wmauzey - Contribute your own Logo!

END OF AN ERA, FRACTALFORUMS.COM IS CONTINUED ON FRACTALFORUMS.ORG

it was a great time but no longer maintainable by c.Kleinhuis contact him for any data retrieval,
thanks and see you perhaps in 10 years again

this forum will stay online for reference
News: Did you know ? you can use LaTex inside Postings on fractalforums.com!
 
*
Welcome, Guest. Please login or register. October 20, 2018, 04:12:20 PM


Login with username, password and session length


The All New FractalForums is now in Public Beta Testing! Visit FractalForums.org and check it out!


Pages: [1]   Go Down
  Print  
Share this topic on DiggShare this topic on FacebookShare this topic on GoogleShare this topic on RedditShare this topic on StumbleUponShare this topic on Twitter
Author Topic: How do I get anti-aliasing?  (Read 1100 times)
0 Members and 1 Guest are viewing this topic.
SCORPION
Conqueror
*******
Posts: 104


« on: March 22, 2014, 12:23:48 AM »

Hi everyone!
Faced with the problem. In fragmentarium anti aliasing does not work in the script of this type:

Code:
#include "Progressive2D.frag"

uniform float time;

vec2 CircleInversion(vec2 vPos, vec2 vOrigin, float fRadius)
{
vec2 vOP = vPos - vOrigin;

vOrigin = vOrigin - vOP * fRadius * fRadius / dot(vOP, vOP);


        vOrigin.x += sin(vOrigin.x * 0.001) / cos(vOrigin.y * 0.001);
        vOrigin.y += sin(vOrigin.x * 0.001) * cos(vOrigin.y * 0.001);

        return vOrigin;
}

float Parabola( float x, float n )
{
return pow( 3.0*x*(1.0-x), n );
}

vec3 color(vec2 v)
{
vec2 vPos = coord.xy / pixelSize.xy;
vPos = vPos - 0.5;

vPos.x *= pixelSize.x / pixelSize.y;

vec2 vScale = vec2(1.2);
vec2 vOffset = vec2( sin(time * 0.123), atan(time * 0.0567));

float l = 0.0;
float minl = 10000.0;

for(int i=0; i<48; i++)
{
vPos.x = abs(vPos.x);
vPos = vPos * vScale + vOffset;

vPos = CircleInversion(vPos, vec2(0.5, 0.5), 0.9);

l = length(vPos*vPos);
minl = min(l, minl);
}


float t = 2.1 + time * 0.025;
vec3 vBaseColour = normalize(vec3(sin(t * 1.790), sin(t * 1.345), sin(t * 1.123)) * 0.5 + 0.5);

//vBaseColour = vec3(1.0, 0.15, 0.05);

float fBrightness = 11.0;

vec3 vColour = vBaseColour * l * l * fBrightness;

minl = Parabola(minl, 5.0);

vColour *= minl + 0.14;

vColour = 1.0 - exp(-vColour);

return vColour;
}

#preset default
Center = 0.000708697,0.00168299
Zoom = 178.52
Gamma = 2.2
ToneMapping = 1
Exposure = 4.2858
Brightness = 0.6338
Contrast = 1
Saturation = 1
AARange = 2
AAExp = 1
GaussianAA = true
#endpreset

Guess it's because of the line

vec2 vPos = coord.xy / pixelSize.xy;

function vec3 color(vec2 v)

How can I fix that and make it work anti aliasing?
Logged
knighty
Fractal Iambus
***
Posts: 819


« Reply #1 on: March 22, 2014, 02:46:24 PM »

Just use v instead of defining and using vPos. "Progressive2D.frag" already do all the work needed for antialiasing. ("Reneder mode" have to be set to "progressive". The amount of antialiasing can be modified in the "subframe xx. max" control. There are also the three last controls in "post" tab)

Code:
#include "Progressive2D.frag"

uniform float time;
#group fractal
uniform vec2 vScale; slider[(1.1,1.1),(1.5,1.5),(3.,3.)]
uniform int Iterations;  slider[0,50,100]

vec2 CircleInversion(vec2 vPos, vec2 vOrigin, float fRadius)
{
vec2 vOP = vPos - vOrigin;

vOrigin = vOrigin - vOP * fRadius * fRadius / dot(vOP, vOP);


        vOrigin.x += sin(vOrigin.x * 0.001) / cos(vOrigin.y * 0.001);
        vOrigin.y += sin(vOrigin.x * 0.001) * cos(vOrigin.y * 0.001);

        return vOrigin;
}

float Parabola( float x, float n )
{
return pow( 3.0*x*(1.0-x), n );
}

vec3 color(vec2 v)
{
//vec2 vScale = vec2(1.5);
vec2 vOffset = vec2( sin(time * 0.123), atan(time * 0.0567));

float l = 0.0;
float minl = 10000.0;

for(int i=0; i<Iterations; i++)
{
v.x = abs(v.x);
v = v * vScale + vOffset;

v = CircleInversion(v, vec2(0.5, 0.5), 0.9);

l = length(v*v);
minl = min(l, minl);
}


float t = 2.1 + time * 0.025;
vec3 vBaseColour = normalize(vec3(sin(t * 1.790), sin(t * 1.345), sin(t * 1.123)) * 0.5 + 0.5);

//vBaseColour = vec3(1.0, 0.15, 0.05);

float fBrightness = 11.0;

vec3 vColour = vBaseColour * l * l * fBrightness;

minl = Parabola(minl, 5.0);

vColour *= minl + 0.14;

vColour = 1.0 - exp(-vColour);

return vColour;
}
NIce shader BTW.
Logged
SCORPION
Conqueror
*******
Posts: 104


« Reply #2 on: March 23, 2014, 03:50:22 AM »

Thank you very much for your help, knighty!
If you do not alter the script, you can do so:

vec3 color(vec2 v)
{
   vec2 vPos = v.xy / pixelSize.xy;

And it works too!
Logged
Pages: [1]   Go Down
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
aliasing vs anti-aliasing Non-Fractal related Chit-Chat teamfresh 4 1592 Last post November 29, 2010, 08:20:27 PM
by teamfresh
Anti-aliasing again Mandelbulber Ike1970 2 2362 Last post May 01, 2011, 06:20:40 PM
by Buddhi
Anti-Gravity Antennae anti-attract an anti-gravity sphere Mandelbulber Gallery mclarekin 0 545 Last post August 31, 2014, 01:15:13 AM
by mclarekin
anti-aliasing comparisons (super sampling) Images Showcase (Rate My Fractal) billtavis 2 411 Last post May 02, 2016, 04:39:18 PM
by quaz0r
Mandelbulber 2.07 anti aliasing question and Mandelbulb3d Help & Support Phil J 0 83 Last post July 28, 2016, 06:06:32 PM
by Phil J

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines

Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM
Page created in 0.12 seconds with 28 queries. (Pretty URLs adds 0.009s, 2q)