anti-aliasing

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
  06 June 2005
anti-aliasing

hey, am trying to write a fairly simple RSL shader using thresholded noise. when i did a frame great, but when i did a bit of camera movement it gives artifacts. it was almost identical to the LGrustymetal shader, so i checked that out and it anti aliased in the rust and on the edges of the rust as well. it also happens with splatter.sl as well another fairly well estabhlised shader. i'm pretty sure that its not the way i'm using it. its not a shader space problem.
is this something inherent to these shaders??
if so can it be remedied?
I always thought that using the noise function wuold basically ensure against this kind of thing

anyway any ideas would be welcome

cheers

conor
 
  06 June 2005
think i know the problem....

i stripped down the spatter and lgrustymetal shaders and the version i had written to the very basics. it seems that if you want to say, in my case, use the noise function to define opacity, and

if (noise >= 0.5) {
Cgreater = colorgreater * (greaterKa*ambient() + greaterKd*diffuse(Nf));
}

if (noise < 0.5) {
Cless = Cs * (lessKa*ambient() + lessKs*specular(Nf,V,metalroughness));
}

Oi = Os;
Ci = Oi * mix (Cgreater, Cless, noise);

this will give artifacts. the only way i can i can figure this is cos i am using an edge defined by noise to creat a boundary between Cgreater and Cless. this strikes me as being similar to using any other mathematical function to define a boundary without using smoothstep to anti alias it!!!
however this is my best guess so i may not be right
if i am right then how can i blend this boundary
failing this has any one else managed to use similar function (ie LGrustymetal, spatter) with a moving camera without artifacts???

help

conor
 
  06 June 2005
You want to do this:


 Cgreater = colorgreater * (greaterKa*ambient() + greaterKd*diffuse(Nf));
 Cless = Cs * (lessKa*ambient() + lessKs*specular(Nf,V,metalroughness));
  
  Oi = Os;
  Ci = Oi * mix (Cgreater, Cless, filterstep( 0.5, noise) );
     
    


filterstep gives you a properly filtered edge that you can use to mix between the colours.

You should never, ever write an if() statement that depends on a varying variable. Always compute both paths and then blend between the two using filterstep.

There are certain exceptions to this rule (like where each path does raytracing and computing both would be very expensive), and you have to handle those cases individiually and with some clever blending to hide the aliasing.
__________________

You can have your characters photoreal, fast or cheap. Pick two.

Last edited by playmesumch00ns : 06 June 2005 at 10:03 AM.
 
  06 June 2005
cheers

yeah i just read up and came to a similar conclusion. will try this when i get home. cheers
again for the advice,
credit for numorous helpful posts, keep up the good work

conor
 
  06 June 2005
My pleasure
__________________

You can have your characters photoreal, fast or cheap. Pick two.
 
  06 June 2005
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 05:36 AM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.