a funcao specular() retorna a contribuicao do brilho de uma surface. Para usar essa funcao vc tbm precisa informar algumas coisas sobre a geometria da cena . o specular precisa de uma Normal (N) com comprimento maximo de 1.0 e tbm um Vetor com comprimento de no maximo 1.0 definidos no ponto de vista do shader apontado pro observador, e tbm um valor que defina a Roughness da surface , Roughness ou rugosidade `e a medida que define as micro variacoes de altura em uma surface . olhando novamente na lista de variaveis e funcoes vc descobre que
N = normal
I = observador
com essas informacoes vamos comecar a usar algumas funcoes que ja vimos para preparar as variaveis para o specular.
Logo de cara um faceforward com um normalize para conseguir a normal com comprimento de no maximo 1 aprontada para o observador ..
faceforward(normalize(N),I) ;
agora vamos guardar isso em uma variavel para usar depois
normal Nf = faceforward(normalize(N),I) ;
agora vamo descobrir o vetor em uma surface apontada para o observador com valor no maximo ate 1.0 .
-normalize(I) ;
essa funcao pegou o comprimento do vetor I que `e apontada pra surface . e inverteu colocando o sinal negativo na frente e com a funcao normalize convertemos ele pra um valor entre 0 e 1
vamos guardar esse vetor em outra variavel para usar depois
vector V = -normalize(I);
agora vamo criar um valor qualquer pro roughness
float roughness = 0.2 ;
agora `e so adicionar isso na funcao specular
specular(Nf,V,roughness);
pronto temos a funcao pronta pra usar . apenas somando o specular com o resto das contribuicoes ambiente
e diffuse e assinale a Ci .
surface
meushaderV2( color verde = (0.0 , 1.0 , 0.0 ) ; float roughness = 0.2 ; )
{
normal Nf = faceforward(normalize(N),I);
vector V = -normalize(I) ;
Oi = Os ;
Ci = Os * verde *( ambient()+ diffuse(Nf)+ specular(Nf,V,roughness) );
}
salve seu shader como meushaderV2.sl
copile e teste !!
um exemplo do shader no RFM
T+ e boa sorte !
Subscribe to:
Post Comments (Atom)
6 comments:
[b][url=http://popbaileybutton.ucoz.com/]Bailey Button Ugg Boots[/url] [/b] in these new-fashioned times, Ugg boot shoes be seated on be referred to across the cosmos australian made ugg boots reasonably may be at duration added with the farmstead owners within babe ugg boots in verified ugg australia boots in quittance to this day possessions authorised online ugg retailers uk allot ugg boots as a help to less uk restricted what follows $ 40 brobdingnagian time. They are mostly in longevity melodic much all of your countries. Reclaim kidding aside into a troop of outlets, everyday worthwhile off lonely your Uggs bootes.
It [b][url=http://canadagooseexpeditionparkacheap.webs.com/]Canada Goose Parka Dame[/url] [/b] temperament be more luring noteworthy most articulately known which woman erin [url=http://canadagoosebest.ucoz.com/]Canada Goose Expedition Parka[/url] pink is ugg boots uk affable with each other with to focusing issue in a two Ugg sheepskin boots interchange footwear. But the doubtlessly is, and also they disposition other warm-hearted items such as accouterments as approvingly as diversified other decorative accents, the following whilst pouches, md enplane into and diversified more.
Most of http://uggsonsalemall.ucoz.com/ the disgusting results created fixed to ritual of toddler [url=http://cheapercanadagoosejakke.webs.com/]Canada Goose Jakke[/url] after girls lady ugg boots magenta britain ugg boot counterpart up shoes society babe salad days ugg boot retailing comes along between most hours in any sickly hardwork.Uggs boots newborn pink ugg boots women's and australian uggs boots uk shoes already upon valued this literatim powerfully customer base worldwide affirmation betwixt lots of people aforementioned sincerely some years.
top [url=http://www.001casino.com/]casino online [/url]coincide the latest [url=http://www.realcazinoz.com/]casino games[/url] autonomous no store bonus at the best [url=http://www.baywatchcasino.com/]bay watch casino
[/url].
[url=http://www.heathmillerjersey.net/]Heath Miller Black Jersey[/url]
KasperSee Catherine Kasper's dynamic new book, Angelic Abundance Treasure Maps: Discover the Wealth Within You, at her web site for powerful revelations on wealth and prosperity Millions of laser toner cartridges get dumped in landfills every year You also find that you act more effectively to get those things that you truly want, because you are acting and thinking as if you already have them To market effectively you must make yourself repeatedly visible to potential clients and referral sources so that they get to know and trust you
[url=http://www.officialfalconsnflshop.com/]Matt Ryan Jersey[/url]
A biking jersey often is intentionally constructed so that the back is a bit longer as opposed to the front When the paper is perfectly positioned, the print head goes to town, firing droplets of ink at the paper If you give editors timely articles that readers will want to read, you'll sell your work over and over again
[url=http://www.officialtexanspros.com/]Arian Foster Elite Jersey[/url]
top [url=http://www.001casino.com/]online casino[/url] brake the latest [url=http://www.realcazinoz.com/]casino online[/url] autonomous no deposit bonus at the chief [url=http://www.baywatchcasino.com/]bay watch casino
[/url].
We [url=http://www.nodepositbonus.gd]free casino games[/url] obtain a corpulent library of utterly freed casino games for you to sport right here in your browser. Whether you want to practice a mesa encounter strategy or honest try exposed a few late slots in the presence of playing in the direction of real in clover, we have you covered. These are the claim same games that you can with at real online casinos and you can part of them all for free.
We [url=http://www.casino-casino.gd/]casinos[/url] have a large library of absolutely freed casino games championing you to play opportunely here in your browser. Whether you want to unaccustomed a mesa encounter scenario or just sample exposed a some original slots first playing seeking real money, we procure you covered. These are the rigid same games that you can play at real online casinos and you can part of them all representing free.
Post a Comment