Forums

You are not logged in.

#1 2012-07-19 03:47:07

duxttyiyi
Member
Registered: 2011-09-08
Posts: 51

sss with color and bump ,bump isn't correct ,how fix ?

hi ,i rewrite the shader simple_painted_ss now and i stoped !

one is the  bump is incorrect
seccond is  the  SS map i don't know how to add

here is the code

Code:

/******************************************************************************/
/*                                                                            */
/*    Copyright (c)The 3Delight Team.                                         */
/*    All Rights Reserved.                                                    */
/*                                                                            */
/******************************************************************************/

class 
simple_painted_sss(
    
    float specularcolor_weight = .2;
    float roughness = .1; 
    color specularcolor = 1;
    float ambientcolor_weight = .4;
    float Ka = .05;
    string ambient_color = "";
    float diffuse_weight=.4 ;
    string diffuse_color = "";
    float back_sss_weight =.1 ;
    string back_sss_color = "";
    float bump_weight = -.1;
    float bump_filter = 1;
    float bump_offset =.2;
    string bump_color = "";)
{

public void displacement(output point P; output normal N)
{
    if( bump_color != "") {
             point tempP;
        //point tempP =P - bump_weight * smoothstep ( 0, 1, texture(bump_color,s, t, "width", bump_filter )) * normalize(transform("object", N));
         tempP = P + bump_weight * (texture(bump_color,s, t, "width", bump_filter )-bump_offset) * normalize(transform("shader", N));
        P =tempP;
        N = calculatenormal(tempP);
        //N= tempP;
    }
}


public void surface(output color Ci, Oi)
    {
        normal Nf;
        vector V;
        color Ct;
        color Cmw;
        color Cbw;

        Nf = faceforward(normalize(N), I);
        V = normalize(-I);

        Ct = ( ambient_color != "" ) ?
        texture( ambient_color, "filter", "gaussian" ) : 1.0;
            Cmw = ( diffuse_color != "" ) ?
        texture( diffuse_color, "filter", "gaussian" ) : 1.0;
        Cbw    = ( back_sss_color != "" ) ?
        texture( back_sss_color, "filter", "gaussian" ) : 1.0;
        uniform string raytype = "unknown";
        
        rayinfo( "type", raytype );

        if( raytype == "subsurface" )
        {
        Ci = Ct*(Ka*ambient() + ambientcolor_weight*diffuse(Nf)) + Cmw * diffuse_weight * diffuse(Nf)+ Cbw * back_sss_weight * (1-diffuse(Nf)*(1-ambient()))+specularcolor_weight * specular(Nf, V, roughness);
        Ci =clamp(Ci,(0,0,0),(1,1,1));
        }
        else
        {
        Ci = subsurface(P) + specularcolor_weight * specular(Nf, V, roughness);        
        }

    }

    }

you should put the color to 1,2 tex
and put the sss back  to 3 and bump to 4

all map is tdl :)

Last edited by duxttyiyi (2012-07-19 03:50:18)

Offline

 

#2 2012-07-19 03:49:31

duxttyiyi
Member
Registered: 2011-09-08
Posts: 51

Re: sss with color and bump ,bump isn't correct ,how fix ?

Code:

test and  i take the sofa now !

my problem is the back_sss_color plus to the all the surface ,and i need it attenuate over the surface .
and while there have a light  the color will get more bright than i want

Last edited by duxttyiyi (2012-07-19 03:56:01)

Offline

 

#3 2012-07-19 19:46:12

duxttyiyi
Member
Registered: 2011-09-08
Posts: 51

Re: sss with color and bump ,bump isn't correct ,how fix ?

none have test my sl?

Offline

 

Board footer

PunBB is © Copyright 2002–2005 Rickard Andersson

You are here: Resources » Forums
Follow us on Twitter
© 2006-2011 dna research. All Rights Reserved.
Trademarks & Copyrights Notices