PDA

View Full Version : TP Splash template


tofuji
07-12-2011, 04:55 AM
This is a template of TP which add "splash" at collision point.

sample movie
http://www2.11moon.com/sample_files/20110712/TP_splash.mp4

sample scene
http://www2.11moon.com/sample_files/20110712/TP_splash.zip


descriptions.

"number"
Change number of the particles.

"spread"
Change X Fov of the particles in degree. Y Fov is fixed to 360 degree.

"speed"
Change initial speed of the particles. Also you can set "s_variation" here.

"life"
Change life of the particles in second. Also you can set "l_variation" here.

"friction"
Change friction (brake) of the particles.

douwe
07-12-2011, 01:11 PM
Learning a lot from Part 2 and 3 of your COFFEE Node.

thanks.

tofuji
07-12-2011, 02:47 PM
var nn0= 0; //global variable, to memorize collision status

main()
{
//-------------part 1, switch on PStorm, if the status is changed to 1 from 0.
if(n_in > nn0) sw_out= TRUE;
else sw_out= FALSE;

nn0= n_in;

//-------------part 2, change particle number, by object speed, at collision.
n_out= int(abs(vv_in)*pn_in);

//-------------part 3, arrange particle emitter, along with "collide plane".
var mg= new(Matrix);

var vx= vnorm(vcross(vector(0,1,0),nv_in));
var vy= vnorm(vcross(nv_in,vx));

mg->SetV0(vector(0,0,0)); mg->SetV2(vx); mg->SetV3(vy); mg->SetV1(nv_in);
mg_out= mg;

}

I will add some more comments on my code. First, I am not professional programmer, so please do not believe my code as "orthodox".


1. Global variable.
If you define variables before "main()" function, it becomes global variable. And the global variable is not re-set (not initialized) at next execution of this COFFEE node. So it can keep old status and you can compare it to new status.

2. "var mg= mg_in;"
You can use also "var mg= new(Matrix);" here.

3. Direction of particle emitter.
Normally +Z is center axis of particle emitter in CINEMA 4D, and it emits particles to the +Z direction. However if I want to get "ring" like particles, there is no way to get it in X-Y plane ("dome" is possible though). It should become in Y-Z plane with "X Fov= 360, Y Fov= 0".

So I placed the particle emitter like that X axis (V1) as center, also Y (V2) and Z(V3) as vertical to it.
http://www2.11moon.com/sample_files/20110712/TP_splash2.mp4

4. The TP ignores position (V0) part in matrix, if it is connected to "arrangement" port.

5. "vcross()" is cross products function.
It takes 2 vectors (A,B) as input, then put 1 vector (C) which is perpendicular to both A and B.

6. "vector(0,1,0)" is a vector to world zenith.
It is used as "up vector", and in this case, +Z axis is along the up vector.

JoelOtron
07-13-2011, 04:18 AM
Very nice thank you.

Just as an aside, I remember going through your site years ago--always full of helpful tips.
Is there an English version of your website by any chance?

tofuji
07-13-2011, 05:39 AM
Hello Joel, and thanks for your interest on my pages.

Now I am writing many tutorials for CINEMA 4D seminar by MAXON Japan. I will translate it to English, but we need Japanese version first.

However, only for additional sample files, I have already pages written in both languages.
http://www2.11moon.com/index_as.html

The additional sample files are made mostly "while writing tutorials", "while having seminars" and "as an answer for questions from my students".


By the way, current my purpose to write tutorials is bit different from 10 years ago. At that time, I have made them for my study and fun. That is to say, for myself only. However, now I am making them for my students. So title or content of the tutorials may vary by requests or questions from them. And "useful" is my first priority.

So I have changed my style a bit, and started to post my sample files to 2 forums, here "CG talk (English)" and "Forum in MAXON Japan (Japanese)". This is for research and tuning of my tutorials.

As a result, the page above does not have explanation there. If you need detailed explanation on it, please refer to respective topics linked from the page.

Thanks.

JoelOtron
07-13-2011, 02:46 PM
Thank you tofuji! :)
Your students are lucky to have a teacher with your level of knowledge and experience.

CGTalk Moderation
07-13-2011, 02:46 PM
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.