I have a problem with those particle systems, they have very inconsistent behavior. They can randomly disappear or twinkle while moving or mouse looking.
Code: Select all
defineParticleSystem{
name = "inter_clouds_effects",
emitters = {
-- fog under 1
{
emissionRate = 500,
emissionTime = 0,
maxParticles = 500,
spawnBurst = true,
boxMin = {-96*4, -175, -96*4},
boxMax = { 96*5, -150, 96*5},
sprayAngle = {0,360},
velocity = {0,0},
objectSpace = false,
--texture = "assets/textures/particles/fog.tga",
texture = "assets/textures/particles/ice_guardian_smoke.tga",
lifetime = {100,500},
color0 = {2,0.5,0.2},
opacity = 1,
fadeIn = 2.5,
fadeOut = 2.5,
size = {100, 150},
gravity = {0,0,0},
airResistance = 0.5,
rotationSpeed = -0.1,
randomInitialRotation = true,
blendMode = "Translucent",
},
-- fog under 2
{
emissionRate = 500,
emissionTime = 0,
maxParticles = 500,
spawnBurst = true,
boxMin = {-96*4, -175, -96*4},
boxMax = { 96*5, -150, 96*5},
sprayAngle = {0,360},
velocity = {0,0},
objectSpace = false,
--texture = "assets/textures/particles/fog.tga",
texture = "assets/textures/particles/ice_guardian_smoke.tga",
lifetime = {100,500},
color0 = {2,0.5,0.2},
opacity = 1,
fadeIn = 2.5,
fadeOut = 2.5,
size = {100, 150},
gravity = {0,0,0},
airResistance = 0.5,
rotationSpeed = 0.1,
randomInitialRotation = true,
blendMode = "Translucent",
},
-- fog under 3
{
emissionRate = 500,
emissionTime = 0,
maxParticles = 500,
spawnBurst = true,
boxMin = {-96*10, -125, -96*10},
boxMax = { 96*11, -100, 96*11},
sprayAngle = {0,360},
velocity = {0,0},
objectSpace = false,
--texture = "assets/textures/particles/fog.tga",
texture = "assets/textures/particles/ice_guardian_smoke.tga",
lifetime = {100,500},
color0 = {2,0.5,0.2},
opacity = 0.5,
fadeIn = 2.5,
fadeOut = 2.5,
size = {100, 150},
gravity = {0,0,0},
airResistance = 0.5,
rotationSpeed = -0.1,
randomInitialRotation = true,
blendMode = "Translucent",
},
-- fog under 4
{
emissionRate = 500,
emissionTime = 0,
maxParticles = 500,
spawnBurst = true,
boxMin = {-96*10, -175, -96*10},
boxMax = { 96*11, -150, 96*11},
sprayAngle = {0,360},
velocity = {0,0},
objectSpace = false,
--texture = "assets/textures/particles/fog.tga",
texture = "assets/textures/particles/ice_guardian_smoke.tga",
lifetime = {100,500},
color0 = {2,0.5,0.2},
opacity = 0.5,
fadeIn = 2.5,
fadeOut = 2.5,
size = {100, 150},
gravity = {0,0,0},
airResistance = 0.5,
rotationSpeed = 0.1,
randomInitialRotation = true,
blendMode = "Translucent",
},
}
}
Code: Select all
defineObject{
name = "temple_of_air_sky",
baseObject = "forest_day_sky",
components = {
{
class = "Sky",
farClip = 1000,
},
{
class = "Particle",
name = "daily",
particleSystem = "daily_clouds_effects",
},
{
class = "Particle",
name = "inter",
particleSystem = "inter_clouds_effects",
},
{
class = "Particle",
name = "night",
particleSystem = "night_clouds_effects",
},
{
class = "Timer",
timerInterval = 0,
triggerOnStart = true,
currentLevelOnly = true,
onActivate = function(self)
local d = {0.025, 0.100, 0.900, 0.975, 1.000, 1.025, 1.975}
local r = utils.script.timeOfDayRatio
local t = GameMode.getTimeOfDay()
self.go.daily:start()
self.go.inter:start()
self.go.night:start()
if t < d[1] then
self.go.daily:fadeOut(0)
self.go.inter:fadeIn(0)
self.go.night:fadeOut(0)
elseif t < d[2] then
self.go.daily:fadeIn((d[2]-t)*r)
self.go.inter:fadeOut((d[2]-t)*r)
self.go.night:fadeOut(0)
elseif t < d[3] then
self.go.daily:fadeIn(0)
self.go.inter:fadeOut(0)
self.go.night:fadeOut(0)
elseif t < d[4] then
self.go.daily:fadeOut((d[4]-t)*r)
self.go.inter:fadeIn((d[4]-t)*r)
self.go.night:fadeOut(0)
elseif t < d[5] then
self.go.daily:fadeOut(0)
self.go.inter:fadeIn(0)
self.go.night:fadeOut(0)
elseif t < d[6] then
self.go.daily:fadeOut(0)
self.go.inter:fadeOut((d[6]-t)*r)
self.go.night:fadeIn((d[6]-t)*r)
elseif t < d[7] then
self.go.daily:fadeOut(0)
self.go.inter:fadeOut(0)
self.go.night:fadeIn(0)
else
self.go.daily:fadeOut(0)
self.go.inter:fadeIn((2-t)*r)
self.go.night:fadeOut((2-t)*r)
end
print("time of day = "..t)
end,
},
},
}
Even after I added the start() calls each frame, it does not prevent them from disappearing randomly. The goal is to hide the "black hole" of a normal sky with clouds to simulate a map with no ground. Do I use too much particles? When I tried with not as many, the black hole was still visible...
Edit: also, the particle systems ignore the fadeIn and fadeOut commands while the party is resting...