Jump to content

Strange Shader Behaviour


Recommended Posts

I am having a problem with a shader i just started to write . The shader shows up fine in shops preview but only renders white in mantra . Maybe one of you knows a solution for that problem .

Screenshot :

post-535-1149706944_thumb.jpg

Source:

#define STEPMOD pow(dot(normalize(N),normalize(I)),4)
#define STEPS r*2/stepsize

float FalloffFunction(vector pivot,pos; float radius;) { return 1-pow(radius/distance(pivot,pos),4);} 

float DensityFunction(vector pos;)
{
float TotalDensity=anoise(pos*4,6,0.7,1)*4;
TotalDensity=clamp(TotalDensity,0,2);
return(TotalDensity);
}

surface
Cloud(
      float r=.5;
      float stepsize=.01;
      vector pivot={0,0,0};
     )
{

int    steps = STEPS*STEPMOD;
vector marchdir = normalize(P-Eye)*stepsize;
vector currentpos = P+nrandom()*stepsize;

vector Cv = 0,Ov = 0;
float TotalDensity=0;
float Density;
float Falloff;

if(dot(normalize(N),normalize(I))<0)
{
    int i;
    for (i=0;i<steps;i++)
    {
        Falloff = FalloffFunction(pivot,currentpos,r);
        Density = DensityFunction(currentpos);
        TotalDensity += Falloff*Density;
        currentpos += marchdir;
    } 
    TotalDensity=TotalDensity/(STEPS);
    Cf = Of = Af = TotalDensity;
}
else
{
    Cf=Of=Af=0;
}
}

Link to comment
Share on other sites

I haven't checked your code but I have come across this before when nothing was wrong but houdini just rendered white until I resaved the code into a different otl....

28414[/snapback]

i already tried that but it doesnt help :(

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...