Notifications
Clear all

[Closed] Particle Colour from Bitmap

I’m sure i’ve seen a script around somewhere for this… Need it for a big proj test asap.

Cheers

DW

1 Reply

OK should have checked Lord Bobo’s website before posting…

[b]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 
 (
 
 )[/b]

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…