From f6107af4cf4d907495e2e9c18e5866fd1d420650 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 14 Feb 2018 14:32:38 +0100 Subject: Cycles: change Index output of Hair and Particle Info to Random, in 0..1 range. These are used for randomization, so it's convenient if the index is already hashed and consistent with the Object Info node. --- source/blender/gpu/intern/gpu_draw.c | 4 ++-- source/blender/gpu/shaders/gpu_shader_material.glsl | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'source/blender/gpu') diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c index 427e179f29a..d7e744951c4 100644 --- a/source/blender/gpu/intern/gpu_draw.c +++ b/source/blender/gpu/intern/gpu_draw.c @@ -41,11 +41,11 @@ #include "GPU_glew.h" #include "BLI_blenlib.h" +#include "BLI_hash.h" #include "BLI_linklist.h" #include "BLI_math.h" #include "BLI_threads.h" #include "BLI_utildefines.h" -#include "BLI_hash.h" #include "DNA_lamp_types.h" #include "DNA_material_types.h" @@ -1884,7 +1884,7 @@ static int gpu_get_particle_info(GPUParticleInfo *pi) if (ind >= 0) { ParticleData *p = &dob->particle_system->particles[ind]; - pi->scalprops[0] = ind; + pi->scalprops[0] = BLI_hash_int_01(ind); pi->scalprops[1] = GMS.gscene->r.cfra - p->time; pi->scalprops[2] = p->lifetime; pi->scalprops[3] = p->size; diff --git a/source/blender/gpu/shaders/gpu_shader_material.glsl b/source/blender/gpu/shaders/gpu_shader_material.glsl index d589c8765e6..5fe14e76a90 100644 --- a/source/blender/gpu/shaders/gpu_shader_material.glsl +++ b/source/blender/gpu/shaders/gpu_shader_material.glsl @@ -190,10 +190,10 @@ void geom( void particle_info( vec4 sprops, vec3 loc, vec3 vel, vec3 avel, - out float index, out float age, out float life_time, out vec3 location, + out float random, out float age, out float life_time, out vec3 location, out float size, out vec3 velocity, out vec3 angular_velocity) { - index = sprops.x; + random = sprops.x; age = sprops.y; life_time = sprops.z; size = sprops.w; -- cgit v1.2.3