N.B. This post is now obsolete because new version of Octane Render now supports X-Particles colors.
I have been wondering that is there a way to transfer color information from X-Particles to Octane? Well, today I started to messing around and I found some kind of solution or some kind of hack.
First thing to do is generate geometry to the particles. To do that I used polygon object that contains only single vertex point. Polygon object is put under the xpGenerator that generates vertex points to particles. To hook up xpGenerator into the MoGraph cloner xpGenerator need to be put under the connect object. Remember to turn welding off. Connect object is put to cloners object slot. Now we can clones to particles.
Next thing to do is the actual color data transformation. I used python effector (MoGraph) to transfer color data from particles to clones. I added support for the particle rotation. With this python effector this setup works already perfectly in C4D’s own render engine but for some weird reason it does not work Octane Render.
import c4d, xparticles from c4d.modules import mograph as mo from c4d import utils as u def main(): md = mo.GeGetMoData(op) # Get MoData if md is None: return False # If there is no MoData, stop processing emitter = xparticles.ToEmitter(op[c4d.ID_USERDATA,1]) # Xpemitter link (user data) cnt = md.GetCount() # Get clone count carr = md.GetArray(c4d.MODATA_COLOR) # Get MoData color marr = md.GetArray(c4d.MODATA_MATRIX) # Get MoData matrix fall = md.GetFalloffs() # Get falloffs for i in reversed(xrange(0, cnt)): # Iterate through clones m = marr[i] # Get clone's matrix particle = emitter.GetParticle(i) # Get particle carr[i] = particle.GetColor() # Get particle color if particle.GetRotation() != None: # If particle is rotating hpb = particle.GetRotation() # Get particle rotation marr[i] = marr[i] * u.HPBToMatrix(hpb) # Set clone rotation to match particle rotation md.SetArray(c4d.MODATA_COLOR, carr, True) # Set MoData color md.SetArray(c4d.MODATA_MATRIX, marr, True) # Set MoData matrix return True # Everyting is fine
To get it work in Octane I had to add empty shader effector with blending mode set to multiply or divide. Empty means that there is no any shader in shader effector, you only need to chance blending mode. Last thing to do to get this setup to work is to add material with MoGraph color shader to the cloner. Now everything should be working fine.
There’s one drawback with this hack and it’s that the colors are a little bit off from the original in the render but I can live with that. Note that X-Particles own material doesn’t work since it’s calculated separately in rendering process. Another drawback is that this setup gets really slow when you have a thousands of particles. But cool thing is that you can use MoGraph effectors with particles.