Page 1 of 3

Useful particle effects!

Posted: Thu Oct 25, 2012 4:23 pm
by Wolfrug
Hey everyone!

So, when making dungeons, you sometimes want to add some custom particle/lighting effects, right? Stuff like earthquake dust, custom teleporter effects, fog, candle smoke...and so on. I figured it could be a good idea to share these custom effects somewhere (like here), since the trial-and-error approach to particle making means there's usually a lot of effort put into them.

To start off, here's the fog particle effect I stole from Rotten Place (...speaking of effort...) and then edited to be the thick thing it is right now:

materials.lua

Code: Select all

defineParticleSystem{
	name = "fog",
	emitters = {

		
		-- fog
		{
			emissionRate = 1.5,
			emissionTime = 0,
			maxParticles = 200,
			boxMin = {-2, 0.1, -2},
			boxMax = { 2, 0.1,  2},
			sprayAngle = {0,30},
			velocity = {0,0},
			texture = "assets/textures/particles/smoke_01.tga",
			lifetime = {10,20},
			color0 = {0.5, 0.5, 0.5},
			opacity = 0.8,
			fadeIn = 9,
			fadeOut = 9,
			size = {4, 8},
			gravity = {0,0,0},
			airResistance = 0.1,
			rotationSpeed = 0.05,
			blendMode = "Translucent",
			objectSpace = false,
		}
	}
}


objects.lua

Code: Select all

defineObject{
	name = "fog_emitter",
	class = "LightSource",
	lightPosition = vec(1.2, 0.2, 0),
	lightRange = 6,
	lightColor = vec(1, 1, 1),
	brightness = 0,
	castShadow = true,
	particleSystem = "fog",
	placement = "floor",
	editorIcon = 88,
}
And finally, effect:
SpoilerShow
Image
Add your own (with or without an actual 'emitter' object)!

-Wolfrug

Re: Useful particle effects!

Posted: Thu Oct 25, 2012 6:50 pm
by HaunterV
exactly what I needed.

Re: Useful particle effects!

Posted: Thu Oct 25, 2012 7:03 pm
by IronMaiden
Nice wolf :) but help a script dummy here hehe, how do you choose what room you want this in? i pasted your script in the lua files you showed but there is no fog in my dungeon.

Thanks

Re: Useful particle effects!

Posted: Thu Oct 25, 2012 7:35 pm
by Wolfrug
IronMaiden wrote:Nice wolf :) but help a script dummy here hehe, how do you choose what room you want this in? i pasted your script in the lua files you showed but there is no fog in my dungeon.

Thanks
The fog_emitter object is what you're looking for - that's the second definition there. Simply place that one down wherever and it'll start producing fog from that location. You can always mess around with the materials to change the type of fog - opacity, size, etc. I made mine pretty small since they often have to fit into 4x4 rooms without spilling too much into neighbouring areas (this is the boxMin and boxMax parameters, just make them bigger and you'll have a larger fog-cloud).

-WOlfrug

Re: Useful particle effects!

Posted: Fri Oct 26, 2012 12:34 am
by Asteroth
This is AWESOME, almost exactly what I need. Could it easily be made black? I need floating corruption. Anyway kudos to you none the less, this cuts out the next question I was going to ask on the board.

Re: Useful particle effects!

Posted: Fri Oct 26, 2012 7:25 am
by Fhizban
very useful, thank you wolf rug

and once you understand everything, its so easy to use!

Re: Useful particle effects!

Posted: Fri Oct 26, 2012 7:53 am
by J. Trudel
Here is one very usefull for when you want to spawn a cave_in and hide it a bit : (sorry I don,t have an image yet)

material
SpoilerShow
defineParticleSystem{
name = "dust",
emitters = {


-- dust
{
emissionRate = 55,
emissionTime = 5,
maxParticles = 100,
boxMin = {-2, 0.1, -2},
boxMax = { 2, 1.4, 2},
sprayAngle = {0,45},
velocity = {0,0},
texture = "assets/textures/particles/fog.tga",
lifetime = {10,20},
color0 = {0.25, 0.2, 0.13},
opacity = 0.6,
fadeIn = 0.5,
fadeOut = 7,
size = {1, 5},
gravity = {0,-0.1,0},
airResistance = 0.1,
rotationSpeed = 0.3,
blendMode = "Translucent",
objectSpace = false,
},
{
emissionRate = 45,
emissionTime = 10,
maxParticles = 100,
boxMin = {-2, 0,1,-2},
boxMax = { 2, 3, 2},
sprayAngle = {30,30},
velocity = {0,0},
texture = "assets/textures/particles/fog.tga",
lifetime = {10,20},
color0 = {0.25, 0.2, 0.13},
opacity = 0.6,
fadeIn = 0.3,
fadeOut = 2,
size = {0.1, 0.2},
gravity = {0,-0.75,0},
airResistance = 0.1,
rotationSpeed = 0.3,
blendMode = "Translucent",
}
}
}
object
SpoilerShow
defineObject{
name = "dust_emitter",
class = "LightSource",
lightPosition = vec(1.2, 0.2, 0),
lightRange = 6,
lightColor = vec(1, 1, 1),
brightness = 0,
castShadow = true,
particleSystem = "dust",
placement = "floor",
editorIcon = 88,
}

Re: Useful particle effects!

Posted: Fri Oct 26, 2012 11:47 am
by Wolfrug
Asteroth wrote:This is AWESOME, almost exactly what I need. Could it easily be made black? I need floating corruption. Anyway kudos to you none the less, this cuts out the next question I was going to ask on the board.
I just stole it from the developers anyway, but this is exactly why I wanted to post it. ;) For others to use!

Black -> the color parameter changes the colour of the fog, in RGB (Red-Green-Blue) format. The 0.5 makes the grey fog..um...black fog might be 1,1,1. Try it. You can also make the opacity even higher (say 0.9) to make it truly impenetrable.


-Wolfrug

Re: Useful particle effects!

Posted: Fri Oct 26, 2012 1:39 pm
by Xanathar
black fog might be 1,1,1
Black fog would be 0,0,0

To create a color, take any colorpicker (like windows one) and divide each R, G, B component by 255.

0,0,0 => black
1,1,1 => white
1,0,0 => high intensity red
0,0.5,0 => medium green

and so on.

Re: Useful particle effects!

Posted: Fri Oct 26, 2012 11:14 pm
by J. Trudel
To help you choose your colors use Gimp or Inkscape (or photoshop, but I prefer free software) color wheel. You first select the color you want, then in the option you should see on a scale of 0-255 the amount of each chanel RGB you have. Divide by 255 and you have the Grimrock equivalent.