View Full Version : Particle Colour from Bitmap
DaveWortley 08-14-2008, 04:44 PM I'm sure i've seen a script around somewhere for this... Need it for a big proj test asap.
Cheers
DW
|
|
DaveWortley
08-14-2008, 04:53 PM
OK should have checked Lord Bobo's website before posting...
on ChannelsUsed pCont do
(
pCont.usePosition = true
pCont.useShape = true
pCont.useAge = true
pCont.useSpeed = true
)
on Init pCont do
(
global temp_emesh = $Temp_Emesh01
if temp_emesh == undefined do
(
temp_emesh = Editable_mesh()
temp_emesh.name = "Temp_Emesh01"
temp_emesh.renderable = false
)
)
on Proceed pCont do
(
count = pCont.NumParticles()
theChannel = 1
the_source = $Teapot01
for i in 1 to count do
(
pCont.particleIndex = i
if pCont.particleAge == 0 do
(
temp_emesh.mesh = pCont.particleShape
meshop.setMapSupport temp_emesh theChannel true
meshop.setNumMapVerts temp_emesh theChannel 1
tfcount = meshop.getNumMapFaces temp_emesh theChannel
pVel = pCont.particleSpeed
thePos = pCont.particlePosition + pVel
theRay = Ray thePos -pVel
arr = (intersectRayEx the_source theRay)
if arr != undefined do
(
tf = meshop.getMapFace the_source theChannel arr[2]
tv1 = meshop.getMapVert the_source theChannel tf.x
tv2 = meshop.getMapVert the_source theChannel tf.y
tv3 = meshop.getMapVert the_source theChannel tf.z
tv = tv1*arr[3].x + tv2*arr[3].y + tv3*arr[3].z
meshop.setMapVert temp_emesh theChannel 1 tv
for f = 1 to tfcount do
meshop.setMapFace temp_emesh theChannel f [1,1,1]
)
pCont.particleShape = temp_emesh.mesh
)--end if age
)--end i loop
)--end on
on Release pCont do
(
)
Next problem, I want this colour information to be transferred to textures....
So... in simple terms...
Have a Multisub of say 200 materials all different colours
If particle colour is in range of say rgb value [x, x, x] then use multisub material [y]
So can make something like this... http://www.aolej.com/mosaic/gallery/porsche2.jpg
CGTalk Moderation
08-14-2008, 04:53 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.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.