Inside Sabertooth
Learn how Sabertooth uses 3ds Max to create 3D interactive projects, including HBO Go’s Game of Thrones interactive experience
  • 1/3
You are here: Forum Home / Autodesk® Maya® / Dynamics / How to Query Color Information from texture to particles?
  RSS 2.0 ATOM  

How to Query Color Information from texture to particles?
Rate this thread
 
39055
 
Permlink of this thread  
avatar
  • Karan
  • Posted: 24 January 2010 10:23 PM
  • Total Posts: 31
  • Joined: 28 July 2007 01:04 AM

hi guys,
just wondering how to query the colour information of a texture and pass it on to the particles.
Lets say i have an animated texture which changes colour over time mapped on a plane and i have a particle grid set as goal on the same plane,now i want particles to get the colours from the animated texture applied on that plane.hope i have made myself clear.

any suggestions??

Thanks,
Karan.



Replies: 0
avatar
  • THNKR
  • Posted: 25 January 2010 03:34 AM

Use the colorAtPoint command.



Replies: 1
/img/forum/dark/default_avatar.png

thanks for the reply buddy,but can you explain me the process as how to go bout it....

Karan..

Author: Karan

Replied: 25 January 2010 05:19 AM  
avatar
  • Karan
  • Posted: 26 January 2010 01:17 AM

can someone give me a detailed explanation on this one,really need to know the process.

Thanks,
Karan.



Replies: 0
avatar
  • THNKR
  • Posted: 26 January 2010 05:23 AM

There isn’t much to explain in terms of steps, if you have already set up the animation and you’ve got your goals working, which I’m going to assume you did alredy.

The example below assumes that the name of the animated texture on your goal object is ramp1. You need to change that to whatever it is that you’re using.

You need two expressions, the creation expression and the runtime expression. My creation expression had two lines in there to randomize the per particle goals, you may not need that, so I’ve commented it out. Apart from that, the runtime before dynamics expression is the same and all you have to do is copy/paste.

//particleShape1.goalU = rand(0,1)
//particleShape1.goalV = rand(0,1)

float $u particleShape1.goalU;
float $v particleShape1.goalV;
float $col[] = `colorAtPoint  -o RGB -u $u -v $v ramp1`;
particleShape1.rgbPP = <<$col[0]$col[1]$col[2]>>;


Replies: 1
/img/forum/dark/default_avatar.png

hey mate thanks alot,it worked…

Thanks,
Karan.

Author: Karan

Replied: 26 January 2010 05:53 AM  
avatar

I’m using this idea, but my particles need to remain in a perfect grid.  I’m goaling the particles to their birth coordinate, which is working, but when I make the varibles $u and $v to feed into the colorAtPoint command, the $u and $v are returing a value of 0.  Any idea what I’m doing wrong? 

//creation:
vector $partPos = particleShape2.position;

particleShape2.goalU = linstep(-35,35,$partPos.x);

particleShape2.goalV = linstep(-20,20,$partPos.z);

//runtime:
float $u = particleShape1.goalU;
float $v = particleShape1.goalV;

//print($u);
//print($v);
//print("\n");

float $col[] = `colorAtPoint -o RGB -u $u -v $v file1`;
particleShape2.rgbPP = <<$col[0], $col[1], $col[2]>>;



Replies: 0
avatar
  • THNKR
  • Posted: 21 August 2010 02:55 AM

float $u particleShape1.goalU;
float $v particleShape1.goalV;

should be

float $u particleShape2.goalU;
float $v particleShape2.goalV;


Replies: 0