Particle Info node for Cycles. This can be used to access particle information in material shaders for dupli objects. For now only the particle Age and individual Lifetime (in frames) are supported, more attributes can be added when needed.
The particle data is stored in a separate texture if any of the dupli objects uses particle info nodes in shaders. To map dupli objects onto particles the store an additional particle_index value, which is different from the simple dupli object index (only visible particles, also works for particle dupli groups mode). Some simple use cases on the code.blender.org blog: http://code.blender.org/index.php/2012/05/particle-info-node/
This commit is contained in:
@@ -35,6 +35,11 @@ struct Transform;
|
||||
|
||||
/* Object */
|
||||
|
||||
struct Particle {
|
||||
float age;
|
||||
float lifetime;
|
||||
};
|
||||
|
||||
class Object {
|
||||
public:
|
||||
Mesh *mesh;
|
||||
@@ -49,6 +54,9 @@ public:
|
||||
bool use_motion;
|
||||
bool use_holdout;
|
||||
|
||||
int particle_id;
|
||||
vector<Particle> particles;
|
||||
|
||||
Object();
|
||||
~Object();
|
||||
|
||||
@@ -69,6 +77,7 @@ public:
|
||||
|
||||
void device_update(Device *device, DeviceScene *dscene, Scene *scene, Progress& progress);
|
||||
void device_update_transforms(Device *device, DeviceScene *dscene, Scene *scene, Progress& progress);
|
||||
void device_update_particles(Device *device, DeviceScene *dscene, Scene *scene, Progress& progress);
|
||||
void device_free(Device *device, DeviceScene *dscene);
|
||||
|
||||
void tag_update(Scene *scene);
|
||||
|
Reference in New Issue
Block a user