Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Graphics > RenderMan interface > Problem with di...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 2 Topic 723 of 788
Post > Topic >>

Problem with displacement shader

by dave@[EMAIL PROTECTED] May 15, 2007 at 10:22 AM

Hey all

I have written this displacement shader and am having problems getting
it to do what I want it too. Its  about 70% way there, which is
annoying.

when I render, I am getting flat planes where there should be risers
and some of the risers are also inverted.

Here is the code below. Any help with this would be really
appreciated.

Thanx Dave Robinson



#define oddtile(x)  (mod(x, 2) == 1)
#define eventile(x) (mod(x, 2) == 0)
#define whichtile(x,freq) (floor((x) * (freq)))

displacement CsDisplace(	float Km = 0.3;
							string texFile = "";
							float modcontrol = 3.0;)

{

normal n = normalize(N);

float dispval = 0;
float row;
float col;

float ss = mod(s * modcontrol, 1);
float tt = mod(t * modcontrol, 1);

row = whichtile(s, modcontrol);
col = whichtile(t, modcontrol);

if(oddtile(col)){

	if(oddtile(row)){

		if (texFile != "")
			dispval =  texture(texFile, ss, tt);
	}else{
		dispval = texture(texFile, tt, ss);
}
}else{

	if(oddtile(row)){
		if (texFile != ""){
			dispval = texture(texFile, t, s);
		}else{
			dispval = texture(texFile, s, t);
		}
	}
}

P = P - n * dispval * Km;

N = calculatenormal(P);
}
 




 2 Posts in Topic:
Problem with displacement shader
dave@[EMAIL PROTECTED]   2007-05-15 10:22:48 
Re: Problem with displacement shader
Olivier3001@[EMAIL PROTEC  2007-05-16 06:39:39 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Nov 22 0:50:35 CST 2008.