PDA

View Full Version : rat question


kithng
09-27-2004, 05:51 PM
Hi,

I have 2 question.

1. I want to loop a 100 frames texture sequence over a 300 frames animation, how can I do that in Slim ?

I know I can use %F4 to tell Slim use a 4 digit padding sequence, but how can I tell it to loop it ?


2. If I use Maya's particle sprite and attach a shader to it, and this shader use the above texture sequence, how can I tell Mtor to randomize the start frame?

Thanks in advance for all your help.

Kith

Andrew W
09-27-2004, 06:06 PM
if you use the fmod() function it will do what you want e.g. fmod($f,100) which returns the remainder of the division of the 2 numbers.

For the second bit you could use the rand() function with the sprite particle number as its seed value. I think this should work.

All the best,

Andrew

rendermaniac
09-28-2004, 12:38 AM
And make sure you put $f rather than $F -it makes quite a bit of difference. Tcl inerprets the first padded zero to think it's using octal (base 8) instead of decimal (base ten) so every 9th and 10th frame will mysteriously go wrong. You can use [format %f4 ] around your expression to get the padding back. You can also use the modulus symbol % eg $f % 100.

Simon

kithng
10-06-2004, 06:12 PM
thanks andrew and rendermaniac.

one more question. I want to animate a displacement map along a surface UV ( water flowing along a river ). Currently I'm attached a world point manifold to my displacement, but it doesn't following along the surface, what kind of manifold should I use to make the texture following along the surface UV ?


any idea ?

thanks a lot.

shehbahn
10-06-2004, 06:38 PM
tried animating the offset in a ST manifold ?

scottiedoo
10-10-2004, 01:47 AM
thanks andrew and rendermaniac.

one more question. I want to animate a displacement map along a surface UV ( water flowing along a river ). Currently I'm attached a world point manifold to my displacement, but it doesn't following along the surface, what kind of manifold should I use to make the texture following along the surface UV ?


any idea ?

thanks a lot. Using MTOR, you can create a coordinate system and assign the shader to that, then you can animated that coordinate system in any direction or path you would like.

For a project, I created a water displacement with using two coordinate systems I made.
Check it out here (http://www.scottenglert.com/projects/rman_water.html)

any questions, just ask

kithng
10-10-2004, 11:11 AM
Using MTOR, you can create a coordinate system and assign the shader to that, then you can animated that coordinate system in any direction or path you would like.

For a project, I created a water displacement with using two coordinate systems I made.
Check it out here (http://www.scottenglert.com/projects/rman_water.html)

any questions, just ask
Hi scott,

thanks for your reply, I will try your suggestion.

I just visited your project website and your water shader look amazing, do you think it's possible to create a similar water displacement by just using Slim ? if so, can U give me a brief explanation on how ? Or if it is possible for you to send me your shader so I can take a look on how you create it ?

Thanks a lot.

scottiedoo
10-10-2004, 09:09 PM
I think you could make it in a slim template.

Yeah I think I can help you out by explaining my code a little bit. It is probably not all that advanced than you think it is. It was like 90% just tweaking the values for so long to get the effect. Note that all the look was a displacement shader and the actual color on the water was a simple enviromental shader in slim to create the reflections a little.

I don't see any harm in posting my shader online, it may or may not work the way you want but it may give you some ideas of your own.

Here is my water displacement shader (http://www.scottenglert.com/media/renderman/watershaderfinal.sl)

I put in some comments in the shader to help you see what is going on. but it is pretty easy code. just took time to do the timing and the scale.. it's mostly about just tweaking the values little by little.

For the maya scene, the shader was applyed to a single polygon with one light and have the camera right up to the surface. I used MTOR to create two coordinate systems and then animated them in maya to move the direction, speed, and movement up and down for both the ripples and the waves.

I through on an enviromental shader on the polygon to give it some reflections. all it was was a small cloud image really. could be whatever you want it to be.

Thats it!

I really haven't played too much with making a slim file out of this, but it's pretty much the same thing from my understanding. Just organized a little differently with more control on the interface I think.

If you have any questions let me know, I hope this helps you and anyone else who views this thread. Let me know how you like it.

I'll post this as well on my website so you can get it from there as well.

scottiedoo
10-12-2004, 07:20 AM
did this information help you at all?

let me know

kithng
10-12-2004, 04:36 PM
Hi Scott,

sorry for my late reply, been busy at work.

Yes, your explanation and shader really help me understand more about how to create my own ocean shader in RAT.

I'm now studying your shader and hope I can write the same quality shader in the near furture.

one problem I'm still not sure how to do is the FOAM at the top of a big wave.

any idea ?

Anyway, really thanks for all your help.

Kith

scottiedoo
10-13-2004, 01:44 AM
hmmm that is another challenge, you could do it maya if you are skilled to find out the peak of some of the waves and do another displacement with a shader .. but I dont' know off the top of my head to get something that well done.. its tough


good luck

playmesumch00ns
10-13-2004, 09:15 AM
Actually. looking at the code in the shader it's quite easy
assuming that ripple1 is the sort of wave you want to have foam on top of, you just do this:


/* first pass at the ripples, apply a large scale ripples */
float ripple1 = noise(pp * RippleFreq * 0.3) * RippleHT * 1.2;
float foam = gain( foamSpread, bias( foamAmount, ripple1 ) );


Then use that foam value for mixing in an extra foam displacement, or mixing between the water shading model and a foam shading model. A good starting value for foamAmount might be 0.1, with say 0.05 for foamSpread.

Bias and gain are, imho, the most useful functions in shader writing aside from the dot product. Bias shifts a function towards one end or the other. So your sine wave will become "thinner" with a bias of 0.25 and "fatter" with a bias of 0.75. So you can use a low bias for getting at just the highest points of your waves. Gain changes the "acceleration" of your function. Without it your foamy patches will have very soft edges, whereas you probably want to have a sharp distinction between foam and water. A low gain value will give you this.

If you're using RAT, you can use the pxslFloatBias and pxslFloatGain functions in pxslRemap.h

CGTalk Moderation
01-19-2006, 10:00 AM
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.