SimplyMaya Forums

Welcome to the forum, feel free to ask questions here.

Register FAQ Members List Calendar Mark Forums Read

New Thread
 
Thread Tools
Old 19-07-2003, 07:52 AM   #16
ragecgi
Super Moderator
 
ragecgi's Avatar
 
Join Date: Sep 2002
Location: Minnesota, USA
Posts: 3,709
Thanks: 0
Thanked 13 Times in 12 Posts
Default

Thanks again mind-raper!

..and to post another variant for randomly-created particle attributes per a request in the MATRIX BULLET TRAIL thread
on how to get emitted particle instances (or even just particles)
to emit at random scale values:

Quote:
Originally posted by Rage:

Try this in a creation expression:

NOTE: you MUST add a radiusPP attribute to your particleShape, and apply this expression to that for this to work as you intend

The BOLD one is the one to use first, as it is what you asked for.
The rest are variants to try for fun

particleShape1.radiusPP = rand(.5,1)

OR

particleShape1.radiusPP = sin(time)

OR

particleShape1.radiusPP = sin(age)
__________________
Israel "Izzy" Long
Motion and Title Design for Broadcast-Film-DS
izzylong.com
ragecgi is offline   Reply With Quote
Old 25-08-2003, 08:29 AM   #17
mind_raper
Registered User
 
Join Date: Nov 2002
Location: Pakistan
Posts: 57
Thanks: 0
Thanked 3 Times in 3 Posts
Default Controlling speed for instanced Object

when you have instanced an object to particle specially a moving geometry its sometime very difficult to handle cause sometime movement of particles is higher than your instanced object or the other way your object speed is higher then particles(e.g you have created a crown moving through the scene and when you have instanced it to particle they are moving (sliding). there are other manual ways to fix it but i will show you how to do it with expressions, And For this we use a matching script with it you can query how much fast is....particle/object is moving and then according to it you can plug that value into your instanced object/Particles.

A real good way while you are using instanced Geometry, is to use Custom Attributes and then write the expression on the custom attribute and then plug that custom attribute into your instanced geometry.

for a situation where let say you have (crowd) walking animation
you instanced it with particles first you instance like you do normally with basic cautions thats you take before instancing any geometry

create custom attibute from Particle Attribute

goto

ADD DYNAMIC ATTRIBUTE
and add a attribute with you desired setting

customAge
float and Per Particle Array

you will see a new attribute in per particle array attributes named customAge

we'll write a custom expression as follow:-

float $Speed = mag(particle2Shape.velocity);
particleShape1.customAge = particleShape1.age * $Speed /10 (this number can differ as per your need you have to keep playing untill your object is no longer sliding !) ;


mag is for Magnitude ! see documentation for it !

if you are not getting a very good try low down da lifespan of the particle through the scene

hope it helps

enjoy instancing
:bannana:
__________________
Learn the Rules|Then|
Burn the Rules Book

Last edited by mind_raper : 25-08-2003 at 08:34 AM.
mind_raper is offline   Reply With Quote
Old 25-08-2003, 02:28 PM   #18
ragecgi
Super Moderator
 
ragecgi's Avatar
 
Join Date: Sep 2002
Location: Minnesota, USA
Posts: 3,709
Thanks: 0
Thanked 13 Times in 12 Posts
Default

Rock on m8! That's a keeper!
__________________
Israel "Izzy" Long
Motion and Title Design for Broadcast-Film-DS
izzylong.com
ragecgi is offline   Reply With Quote
Old 25-08-2003, 10:24 PM   #19
Alan
Moderator
 
Alan's Avatar
 
Join Date: Oct 2002
Location: London, UK
Posts: 2,800
Thanks: 0
Thanked 5 Times in 5 Posts
Default

this one selects a random element from an array

proc int selectRandArrayVal(string $arr[])

{
int $randomInt = floor(rand(size($arr)))+1;
return $randomInt ;
}



Cool thread btw

Alan
__________________
Technical Director - Framestore

Currently working on: Your Highness

IMDB
Alan is offline   Reply With Quote
Old 09-09-2003, 09:54 AM   #20
PixelPost
Registered User
 
Join Date: Jun 2003
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hehe, I think mind_raper is raping all the gnomon video expressions
PixelPost is offline   Reply With Quote
Old 09-09-2003, 10:19 AM   #21
mind_raper
Registered User
 
Join Date: Nov 2002
Location: Pakistan
Posts: 57
Thanks: 0
Thanked 3 Times in 3 Posts
Default Hummmm

lolz
yeah..........
Cause not everyOne has the material so i think.....its helpfull ...!
but offcourse not all of them.....the are from different authors they are also mentioned !
__________________
Learn the Rules|Then|
Burn the Rules Book

Last edited by mind_raper : 09-09-2003 at 10:22 AM.
mind_raper is offline   Reply With Quote
Old 09-09-2003, 10:35 AM   #22
PixelPost
Registered User
 
Join Date: Jun 2003
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

its all cool
PixelPost is offline   Reply With Quote
Old 09-09-2003, 04:45 PM   #23
ragecgi
Super Moderator
 
ragecgi's Avatar
 
Join Date: Sep 2002
Location: Minnesota, USA
Posts: 3,709
Thanks: 0
Thanked 13 Times in 12 Posts
Default

Either way, an expression is an expression, so keep em coming guys!
__________________
Israel "Izzy" Long
Motion and Title Design for Broadcast-Film-DS
izzylong.com
ragecgi is offline   Reply With Quote
Old 11-09-2003, 07:26 PM   #24
kbrown
Moderator
 
kbrown's Avatar
 
Join Date: Sep 2002
Location: London, UK
Posts: 3,198
Thanks: 0
Thanked 8 Times in 8 Posts
Default

Ok here's one which I just figured out.

Driving a shader attribute with distance from camera

Let's dig in to this with an example:

1. Create a lambert shader
2. Create a ramp texture (delete the place2dTexture node if it is created)
3. Connect the ramp's output to the lambert's color channel
4. Create a sampler info node
5. Create an expression with following code:
Code:
// NOTE: I'm using default object names here

vector $vPw = << samplerInfo1.pointWorldX, samplerInfo1.pointWorldY, samplerInfo1.pointWorldZ >>;
vector $vCamPos = << persp.translateX, persp.translateY, persp.translateZ >>;

float $fDistance = mag($vPw - $vCamPos);

ramp1.vCoord = $fDistance / 50; // The divider (50) is acting like a max distance value. You may need to adjust it depending on your scene size.
To test this, create a nurbs plane. Scale it in X and Z by 20. Apply the new lambert shader to it and render from different angles. You should see that the plane is red at near distance, green in the middle and blue in far distance. If you get repeats and banding then you need to adjust the divider in the expression.
__________________
Kari
- My Website
- My IMDB

Do a lot, Fail a lot and Learn a lot!

Last edited by kbrown : 11-09-2003 at 07:33 PM.
kbrown is offline   Reply With Quote
Old 11-09-2003, 09:14 PM   #25
ragecgi
Super Moderator
 
ragecgi's Avatar
 
Join Date: Sep 2002
Location: Minnesota, USA
Posts: 3,709
Thanks: 0
Thanked 13 Times in 12 Posts
Default

WOW! Kinda like the Yuya Depth shader, only better!

Good one Kman!
__________________
Israel "Izzy" Long
Motion and Title Design for Broadcast-Film-DS
izzylong.com
ragecgi is offline   Reply With Quote
Old 13-09-2003, 09:58 PM   #26
kbrown
Moderator
 
kbrown's Avatar
 
Join Date: Sep 2002
Location: London, UK
Posts: 3,198
Thanks: 0
Thanked 8 Times in 8 Posts
Default

I just figured out that controlling things based on the distance from camera is really usefull. For example HW particles (mainly points and streaks) are sized in pixels. So no matter how far they are, they will be (HW) rendered the same size -> not exactly realistic looking. If you add a runtime expression which scales the opacityPP based on the distance from the current camera it will look a lot better.

Example:
Code:
vector $vPPos = lpos; // last position of the particle
vector $vCPos = << persp.tx, persp.ty, persp.tz >>; // current camera position
float $fDistance = mag($vPPos - $vCPos) / 20; // particle's distance from camera (scaled to be in range of 0 - 1)
opacityPP = 1.2 - $fDistance; // the opacity will be at least 0.2 but degrades when the distance increases from the cam
Again you need to play with the divider (20) to scale the opacity reduction to fit the size of your scene. The "1.2" on the last line determines the overall opacity level of all particles (you want to keep this greater than 1.0)...
__________________
Kari
- My Website
- My IMDB

Do a lot, Fail a lot and Learn a lot!

Last edited by kbrown : 13-09-2003 at 10:06 PM.
kbrown is offline   Reply With Quote
Old 14-09-2003, 05:10 AM   #27
ragecgi
Super Moderator
 
ragecgi's Avatar
 
Join Date: Sep 2002
Location: Minnesota, USA
Posts: 3,709
Thanks: 0
Thanked 13 Times in 12 Posts
Default

And with this expression, who says a lot of rain spoils a shot?

Good one again Kman!
__________________
Israel "Izzy" Long
Motion and Title Design for Broadcast-Film-DS
izzylong.com
ragecgi is offline   Reply With Quote
Old 14-09-2003, 01:56 PM   #28
mind_raper
Registered User
 
Join Date: Nov 2002
Location: Pakistan
Posts: 57
Thanks: 0
Thanked 3 Times in 3 Posts
Default

yeah that helps in densed(populated) particles scene where it need lots of camera adjustment will cut down lots of time !
__________________
Learn the Rules|Then|
Burn the Rules Book
mind_raper is offline   Reply With Quote
Old 06-01-2004, 04:45 AM   #29
tathu
Registered User
 
Join Date: Jan 2004
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default I don't care from where they come here

Hi.

Cool thread !
I'm new here and I'd learned alot from these expressions.
I don't care from where they come here, all of them are good for me. Thank mind_raper and everyone.

Why the thread had stoped ?

Sorry about my poor English.
tathu is offline   Reply With Quote
Old 06-01-2004, 03:56 PM   #30
ragecgi
Super Moderator
 
ragecgi's Avatar
 
Join Date: Sep 2002
Location: Minnesota, USA
Posts: 3,709
Thanks: 0
Thanked 13 Times in 12 Posts
Default

Hasn't really stopped, just slowed down a bit because folks are a little busy.
It is a "sticky" thread so that way it is always at the top for reference

Feel free to post any questions, and we will see if we can help
__________________
Israel "Izzy" Long
Motion and Title Design for Broadcast-Film-DS
izzylong.com
ragecgi is offline   Reply With Quote
New Thread

« Previous Thread | Next Thread »

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
exporting / importing expressions djb123 Technical Issues 2 10-04-2012 11:52 PM

1 Month

$34

Month-to-month billing
$34/month
Unlimited access to all videos
Project files to download
Easy to cancel at anytime
 
 

3 months

$87

Billing every 3 months
$29/month
Unlimited access to all videos
Project files to download
Easy to cancel at anytime
Save $5 per month or $15 in total compared to monthly billing with this package.

12 months

$288

Billing every 12 months
$24/month
Unlimited access to all videos
Project files to download
Easy to cancel at anytime
Save $10 per month or $120 in total compared to monthly billing with this package.

Your plan will automatically renew. You can cancel at any time via your PayPal account to avoid being charged again.

You can view the FAQ on our video plans here. You can contact us directly here. By clicking one of the buttons above, you agree to our Terms and Privacy Policy.