Particle color
Particle color
Anyone know how to change the color of a particle (emitter?)? I see LoG1 had something about creating FX effects but can't convert that usage over to how LoG2 does this, plus I don't want to create new effects anyways; I want to get, let's say, the flame from a torch and change it, dynamically with a script, to another color. Note: I'm not talking about the LightComponent
I don't want to use a predefined defineObject, I'd prefer to change the color, at-will, with code in script_entity. If no one knows, currently, can someone take a guess at what we're waiting for in the Predefined Assets section of the Modding page or is it doable now?
I don't want to use a predefined defineObject, I'd prefer to change the color, at-will, with code in script_entity. If no one knows, currently, can someone take a guess at what we're waiting for in the Predefined Assets section of the Modding page or is it doable now?
Re: Particle color
I'm not sure if you can change the color of a predefined particle effect (( As you said, changing light color is simple for an object possessing the class, but particle effects are just called by objects .... you can always can define your own particle effect, and change his light from the light class of the used object, that's only way that i see.
- QuintinStone
- Posts: 72
- Joined: Sat Nov 01, 2014 9:58 pm
Re: Particle color
Some particles are sprites pulled from a texture file. Like the hit effect on a green slime. Changing the color for these would involve making a new color-shifted texture.
Crypt of Zulfar
Re: Particle color
...So what exactly do you think color0, color1, color2, color3, and colorAnimation do?QuintinStone wrote:Some particles are sprites pulled from a texture file. Like the hit effect on a green slime. Changing the color for these would involve making a new color-shifted texture.
The color vectors multiply the RGB channels of the particle texture. You do not need to "make a new color-shifted texture" to change the colour of a particle system.
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Re: Particle color
There's a difference between colored particles and light color animation. Colored particles are "drawn" in a dds file, placed and animated in a particle system. colorAnimation is just a light wich gives you "supplement" to particle system. However, if particles are drawn in white/grey, there, you can effectively apply color to the particles by modifying light color.minmay wrote:...So what exactly do you think color0, color1, color2, color3, and colorAnimation do?
All depends of the material used in the particle system. More else, NutJob asked to "dynimacaly" changing color of a particle emitter, and actually, there's no way to modify a particle system, except by coding it in a script file.
In the torch example, under LoG1, flames are drawn in the torch_self_illum.dds file, so you can not modify it only by changing light color.
Re: Particle color
Ok, that helped me immensely wrap my head around what's going on, thank you! My incessant questions about the darn color of particles is mostly because I hate when I change a lantern, for example, to dimly light a room in green hue (from the light component) but the flames are still bright orange. Looks dumb, so I need to change the "flame" color.Doridion wrote:There's a difference between colored particles and light color animation. Colored particles are "drawn" in a dds file, placed and animated in a particle system. colorAnimation is just a light wich gives you "supplement" to particle system. However, if particles are drawn in white/grey, there, you can effectively apply color to the particles by modifying light color.minmay wrote:...So what exactly do you think color0, color1, color2, color3, and colorAnimation do?
All depends of the material used in the particle system. More else, NutJob asked to "dynimacaly" changing color of a particle emitter, and actually, there's no way to modify a particle system, except by coding it in a script file.
In the torch example, under LoG1, flames are drawn in the torch_self_illum.dds file, so you can not modify it only by changing light color.
Re: Particle color
As i said Nutjob, yep, you can change the flame color to grayscale, and after, just have to change light color ( to change the flame color ^^ ). But ... there's allways a but xD I seen that LoG2 have orange, blue, green, and most other flame colors .... more else, the push_block_trigger got the flare animation where color can ben changed. I would not be surprised that AH have already made most of their particle designs in grayscale, to just have to modify color by lightingNutJob wrote:Ok, that helped me immensely wrap my head around what's going on, thank you! My incessant questions about the darn color of particles is mostly because I hate when I change a lantern, for example, to dimly light a room in green hue (from the light component) but the flames are still bright orange. Looks dumb, so I need to change the "flame" color.
Re: Particle color
I'm not sure what you mean by your use of the word "light" here. Particle systems don't involve lights. As far as I can tell from experimentation, color0-3 are vectors that multiply the RGB channel values in the texture. For example, with a color0 of vec(1,0.5,1), the green channel's values will be halved (a pixel with a green value of 200 would end up with 100) and the other two will be unchanged. A color0 of vec(2,2,2) will double all the values in the texture, clamping them at 255 if necessary. colorAnimation is a boolean that, if true, makes the particles change from color0 to color1, then to color2, then to color3, over their lifetime. At no point is lighting involved, and indeed particles are never subject to lighting at all since, well, they're particles, not surfaces.Doridion wrote:There's a difference between colored particles and light color animation. Colored particles are "drawn" in a dds file, placed and animated in a particle system. colorAnimation is just a light wich gives you "supplement" to particle system. However, if particles are drawn in white/grey, there, you can effectively apply color to the particles by modifying light color.
Greyscale particle textures aren't necessarily better than colored ones. Yes, they allow you to pick any hue/saturation with the colour multipliers but you're stuck with that one hue for the entire texture. The torch flame particle effect, for example, is impossible with a greyscale texture because it contains multiple hues.
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
- AndakRainor
- Posts: 674
- Joined: Thu Nov 20, 2014 5:18 pm
Re: Particle color
So, it is not possible to dynamically update the color0 value of an emitter?
I am trying to adapt the color of some clouds particles to the time of day value in the game. How would you do that? (I use multiple predefined particle systems for now, but the transitions are too obvious, that's ugly)
I am trying to adapt the color of some clouds particles to the time of day value in the game. How would you do that? (I use multiple predefined particle systems for now, but the transitions are too obvious, that's ugly)
Re: Particle color
It is not. Regarding transitions, remember that you can use ParticleComponent:stop() and ParticleComponent:start() to make emitters start/stop emitting particles without destroying existing particles; using those with two (or more) ParticleComponents would give much smoother transitions than enabling/disabling the components or calling setParticleSystem() on one with extant particles. There are also ParticleComponent:fadeIn() and ParticleComponent:fadeOut().
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.