Using animated texture to create plasma charge!
Posted:
Sunday, 08.July 2012, 07:42
by Skinnytorus
Hey guys,
Here is another example how to create plasma. This time by using an animated texture. Enjoy!
Re: Using animated texture to create plasma charge!
Posted:
Sunday, 08.July 2012, 12:11
by erbsen
Nice, could anyone explain the meaning of the code in the rotate-Op (for non coders)?
- Code: Select all
gui
{
float r(-10..10 step 0.001);
}
import i:float;
Offset=1+2*sin(i*r);
Re: Using animated texture to create plasma charge!
Posted:
Sunday, 08.July 2012, 12:57
by Skinnytorus
hi, erbsen.
To tell the truth, I found this structure in the example file and adapted for my needs
I can understand most of the things going on unconsciously, but, I have too many blank spaces in my knowledge, so it would be better if a coder commented on that.
Re: Using animated texture to create plasma charge!
Posted:
Sunday, 08.July 2012, 23:04
by ikam
Hi
- Code: Select all
gui
{
float r(-10..10 step 0.001);
}
here we declare a new gui entry 'r' : a float variable with range from -10 to +10 with a step value of 0.001 (when you move mouse).
- Code: Select all
import i:float;
Tell that 'i' is a variable declared in another place but we want to use here, so we need to import it. (i is declared in loop operator)
- Code: Select all
Offset=1+2*sin(i*r);
and here we calculate offset with a math formula and our 2 variable i and r.
Is it ok ?
Re: Using animated texture to create plasma charge!
Posted:
Monday, 09.July 2012, 07:10
by Skinnytorus
Thanks. Very concise and to the point.
The most confusing part in this structure is the loop and atlas though.
I think Loop op creates some sort of cycle. What I don't understand is where is the counter then?
Is "i" the counter? What is "n" in Loops op?
As for Atlas, it seems to work as a frame recorder with buffer depending on 'i' variable .
It seems to record 'i' (declared in Loop op) frames, but doesn't show them all in preview (depends on the resolution).
Correct?
Re: Using animated texture to create plasma charge!
Posted:
Monday, 09.July 2012, 08:21
by erbsen
Very enlightening thank you very much ikam.
Re: Using animated texture to create plasma charge!
Posted:
Monday, 09.July 2012, 08:54
by ikam
Yes loop operator is a cycle.
"from 0 to n-1" is the loop end value, don't take care of 'n', it's not a variable, it's only represent the value you enter here. So your loop will repeat 'n-1' time. (In programming language most of loop start from 0, so end loop is endvalue-1, ex to repeat 10 times an action, loop is 0 to 9).
'i' is a variable containing the loop index, so it's start with 0 and finish with your value-1. So you can use 'i' in your script, his value will range from 0 to your endvalue-1.
For atlas, yes it use variable name declared in loop as counter.
Here another example:
In conclusion, just indicate in loop op the count you want to repeat an action (don't compute n-1)
Re: Using animated texture to create plasma charge!
Posted:
Monday, 09.July 2012, 09:01
by ikam
here an interesting example of what we can do with loop :
Re: Using animated texture to create plasma charge!
Posted:
Monday, 09.July 2012, 10:19
by Skinnytorus
many thanks, ikam.
i will check your files out this evening.
by and large, a fully fledged step-by-step tutorial based on some real task might come in handy for non-coders.
i will dig this deeper and maybe come up with something of that kind