Version = 1.8.4.27161; CParticleEffect $LOCAL$/Resource { OnSpawn = "$LOCAL$/Spawner"; CustomAttributes = "$LOCAL$/_GlobalAttributes"; Autostart = true; } CCompilerSyntaxNodeExpression $LOCAL$/CCompilerSyntaxNodeExpression_D158FB1D { EditorInfosIsBlockMinimized = 0; Expression = "function void Eval() { Life = infinity; } "; } CActionFactoryWithChilds $LOCAL$/Spawner { ChildList = { "$LOCAL$/Source", }; } CParticleFieldDeclaration $LOCAL$/CParticleFieldDeclaration_67949F4D { FieldName = "ColorCoeff"; } CParticleSamplerCurve $LOCAL$/CParticleSamplerCurve_E7219408 { SamplerName = "DisplacementWeight"; Times = { 0.0000000e+000, 5.0000000e-001, 1.0000000e+000, }; FloatValues = { 3.5361910e-001, 1.7034520e+000, 3.5361910e-001, }; FloatTangents = { 0.0000000e+000, 1.3884330e+000, 0.0000000e+000, 0.0000000e+000, -9.6360749e-001, 0.0000000e+000, }; MinLimits = float4(0.0000000e+000, 0.0000000e+000, 0.0000000e+000, 0.0000000e+000); } CParticleEvolver_Script $LOCAL$/CParticleEvolver_Script_6DEC9E9F { Expression = "$LOCAL$/CCompilerSyntaxNodeExpression_E63D424E"; } CParticleAttributeList $LOCAL$/_GlobalAttributes { AttributeList = { "$LOCAL$/CParticleAttributeDeclaration_9BDD555E", "$LOCAL$/CParticleAttributeDeclaration_6085D8ED", "$LOCAL$/CParticleAttributeDeclaration_DC3BD88D", "$LOCAL$/CParticleAttributeDeclaration_AFD4EBD4", }; } CParticleDescriptor $LOCAL$/CParticleDescriptor_2830BC72 { CustomFields = { "$LOCAL$/CParticleFieldDeclaration_3D199BC4", }; SpawnEvaluator = "$LOCAL$/CCompilerSyntaxNodeExpression_D158FB1D"; States = { "$LOCAL$/CParticleState_37820737", }; } CParticleAttributeDeclaration $LOCAL$/CParticleAttributeDeclaration_6085D8ED { AttributeName = "Flux"; AttributeDescription = "Controls the amount of strokes\\nMultiplier of the \'Source\' layer\'s spawn-rate."; DefaultValueF4 = float4(1.0866141e+000, 0.0000000e+000, 0.0000000e+000, 0.0000000e+000); HasMin = true; HasMax = true; MaxValueF4 = float4(3.0000000e+000, 0.0000000e+000, 0.0000000e+000, 0.0000000e+000); } CParticleFieldDeclaration $LOCAL$/CParticleFieldDeclaration_F6A6C829 { FieldName = "PCoords"; FieldType = int3; } CShapeDescriptor $LOCAL$/CShapeDescriptor_1AAF32F4 { ShapeType = SPHERE; Radius = 5.0000000e-001; MeshResource = "Meshes/Path.pkmm"; MeshScale = float3(2.0000000e+000, 2.0000000e+000, 2.0000000e+000); } CParticleEvolver_Spawner $LOCAL$/LightningTrail { SpawnInterval = 2.0000000e-001; Descriptor = "$LOCAL$/CParticleDescriptor_EAA4F4AE"; } CParticleState $LOCAL$/CParticleState_48BA6F7F { StateName = "State_0"; Evolvers = { "$LOCAL$/CParticleEvolver_Script_6DEC9E9F", "$LOCAL$/CParticleEvolver_Physics_815F8FC3", "$LOCAL$/CParticleEvolver_Projection_52891911", "$LOCAL$/CParticleEvolver_Field_11EF5012", "$LOCAL$/CParticleEvolver_Field_25CAC61C", "$LOCAL$/CParticleEvolver_Script_1CA6C021", }; } CParticleDescriptor $LOCAL$/CParticleDescriptor_EAA4F4AE { Renderer = "$LOCAL$/CParticleRenderer_Ribbon_584734A8"; CustomFields = { "$LOCAL$/CParticleFieldDeclaration_342360F8", "$LOCAL$/CParticleFieldDeclaration_6ACE796C", "$LOCAL$/CParticleFieldDeclaration_F6A6C829", "$LOCAL$/CParticleFieldDeclaration_7F0885A0", "$LOCAL$/CParticleFieldDeclaration_67949F4D", }; Samplers = { "$LOCAL$/CParticleSamplerShape_627F92C7", "$LOCAL$/CParticleSamplerCurve_31F983E2", "$LOCAL$/CParticleSamplerProceduralTurbulence_E0F88948", "$LOCAL$/CParticleSamplerCurve_E7219408", "$LOCAL$/CParticleSamplerCurve_CD928515", }; SpawnEvaluator = "$LOCAL$/CCompilerSyntaxNodeExpression_A9553A09"; States = { "$LOCAL$/CParticleState_48BA6F7F", }; } CParticleFieldDeclaration $LOCAL$/CParticleFieldDeclaration_7F0885A0 { FieldName = "Color"; FieldType = float4; } CCompilerSyntaxNodeExpression $LOCAL$/CCompilerSyntaxNodeExpression_A9553A09 { Expression = "function void Eval() { Life = 0.25; // grab a random lightning texture from the atlas, for the ribbon. // there are 16 sub-frames, whose IDs go from 0 to 15 TextureID = rand(0,16); // color factor that we will apply to the sampled \'Color\' in an evolve script // make particles spawned at the end of the trail\'s life dimmer, to avoid hard-ending trails. ColorCoeff = ColorCoeffLookup.sample(spawner.LifeRatio); // save RealPosition (see the evolvers on why we need this) RealPosition = Position; // velocity goes upwards, faster at the center of the trail (see the curve\'s shape) Velocity = float3(0,1,0) * DisplacementWeight.sample(spawner.LifeRatio); } "; } CParticleSamplerProceduralTurbulence $LOCAL$/CParticleSamplerProceduralTurbulence_E0F88948 { SamplerName = "Noise3D"; Scale = 2.5000000e-001; Strength = 2.5000000e-002; TimeScale = 1.0000000e+000; TimeBase = 2.0000000e+000; } CParticleEvolver_Field $LOCAL$/CParticleEvolver_Field_11EF5012 { Name = "Color"; Evaluator = "$LOCAL$/CParticleSamplerCurve_870B473D"; } CParticleRenderer_Ribbon $LOCAL$/CParticleRenderer_Ribbon_584734A8 { EditorInfosIsBlockMinimized = 0; BillboardingMaterial = Additive_Soft; Diffuse = "Textures/FX/Lightning_05.dds"; AtlasDefinition = "Textures/FX/AtlasX4.pkat"; TextureIDField = "TextureID"; } CCompilerSyntaxNodeExpression $LOCAL$/CCompilerSyntaxNodeExpression_4DAC29C5 { Expression = "function void Eval() { // the other evolvers have computed a new Position, back it up in \'RealPosition\' // (see the comments in the first script evolver for details) RealPosition = Position; // the projection evolver filled \'PCoords\' with the meshe\'s parametric coordinates for us. // use this to grab the mesh normal where at the location we were reprojected on: float3 meshNormalAtLocation = ProjMesh.sampleNormal(PCoords) * 3; // sample the random procedural turbulent field to get a turbulent displacement: float3 turb = Noise3D.sample(RealPosition); // project this vector with the mesh normal, so that it becomes tangent to the triangle plane. // this will effectively convert it to a 2D tangent turbulence, because we don\'t want // the 3D turbulent vector to make the ribbon penetrate the mesh float3 projTurb = turb + meshNormalAtLocation * max(0,-dot(turb, meshNormalAtLocation)); // patch the Position by moving it slightly away from the mesh surface along the mesh normal, // and displace it by the turbulence vector. float distanceToMesh = 0; Position += meshNormalAtLocation * distanceToMesh + projTurb; // apply our color coefficient to the RGBA color sampled in the CParticleEvolver_Field that // was run before us: Color = float4(RGB.x, RGB.y, RGB.z, Color.w) * pow(Glow.sample(LifeRatio),Power); Color *= ColorCoeff; } "; } CParticleEvolver_Physics $LOCAL$/CParticleEvolver_Physics_815F8FC3 { } CParticleFieldDeclaration $LOCAL$/CParticleFieldDeclaration_342360F8 { FieldName = "TextureID"; } CParticleFieldDeclaration $LOCAL$/CParticleFieldDeclaration_6ACE796C { FieldName = "RealPosition"; FieldType = float3; TransformFilter = full; } CParticleEvolver_Projection $LOCAL$/CParticleEvolver_Projection_52891911 { EditorInfosIsBlockMinimized = 0; Shape = "ProjMesh"; OutputParametricCoordsField = "PCoords"; } CParticleSamplerCurve $LOCAL$/CParticleSamplerCurve_870B473D { ValueType = Float4; Times = { 0.0000000e+000, 1.8990910e-001, 1.0000000e+000, }; FloatValues = { 1.0000000e+000, 1.0000000e+000, 1.0000000e+000, 0.0000000e+000, 1.0000000e+000, 1.0000000e+000, 1.0000000e+000, 9.5917922e-001, 1.0000000e+000, 1.0000000e+000, 1.0000000e+000, 0.0000000e+000, }; FloatTangents = { 0.0000000e+000, 0.0000000e+000, 0.0000000e+000, 0.0000000e+000, 0.0000000e+000, 0.0000000e+000, 0.0000000e+000, 0.0000000e+000, 0.0000000e+000, 0.0000000e+000, 0.0000000e+000, 0.0000000e+000, 0.0000000e+000, 0.0000000e+000, 0.0000000e+000, 0.0000000e+000, 0.0000000e+000, 0.0000000e+000, 0.0000000e+000, 0.0000000e+000, 0.0000000e+000, 0.0000000e+000, 0.0000000e+000, 0.0000000e+000, }; MinLimits = float4(0.0000000e+000, 0.0000000e+000, 0.0000000e+000, 0.0000000e+000); } CCompilerSyntaxNodeExpression $LOCAL$/CCompilerSyntaxNodeExpression_E63D424E { Expression = "function void Eval() { // here, we have a problem: // we can\'t yet (in popcorn 1.5.4) tell the ribbon renderer to use a custom field // for position, and we want to manually shift the positions away from the mesh surface. // if we shift the positions used for reprojection, they will shift from frame to frame // and become dependent of the FPS. // Therefore, we\'ll use a trick where we will \'backup\' the simulated position into a custom // field named \'RealPosition\', then we\'ll shift the \'Position\' field to get it ready for rendering // at the start of the next frame, we\'ll restore \'Position\' to the one saved in \'RealPosition\', // so that simulation uses the correct value, not the one deformed for rendering. // here, restore the projected position saved in the previous frame Position = RealPosition; // all the next evolvers in the state will work on this restored \'Position\', // up to the last script evolver } "; } CParticleSamplerShape $LOCAL$/CParticleSamplerShape_627F92C7 { SamplerName = "ProjMesh"; Shape = "$LOCAL$/CShapeDescriptor_1AAF32F4"; SampleDimensionality = Vertex; } CParticleEvolver_Field $LOCAL$/CParticleEvolver_Field_25CAC61C { EditorInfosIsBlockMinimized = 0; Name = "Size"; Evaluator = "$LOCAL$/CParticleSamplerCurve_F033910F"; } CParticleSamplerCurve $LOCAL$/CParticleSamplerCurve_31F983E2 { EditorInfosIsBlockMinimized = 0; SamplerName = "ColorCoeffLookup"; Times = { 0.0000000e+000, 1.0000000e+000, }; FloatValues = { 1.0483411e+001, 1.3673043e-001, }; FloatTangents = { 0.0000000e+000, 0.0000000e+000, -1.5378418e+001, 0.0000000e+000, }; MinLimits = float4(0.0000000e+000, 0.0000000e+000, 0.0000000e+000, 0.0000000e+000); } CParticleSamplerCurve $LOCAL$/CParticleSamplerCurve_F033910F { Times = { 0.0000000e+000, 2.9870510e-001, 1.0000000e+000, }; FloatValues = { 1.2760758e-003, 1.2711254e-001, 1.3779700e-003, }; FloatTangents = { 0.0000000e+000, 2.1109976e-001, 0.0000000e+000, 0.0000000e+000, -5.6229483e-002, 0.0000000e+000, }; MinLimits = float4(0.0000000e+000, 0.0000000e+000, 0.0000000e+000, 0.0000000e+000); } CParticleEvolver_Script $LOCAL$/CParticleEvolver_Script_1CA6C021 { Expression = "$LOCAL$/CCompilerSyntaxNodeExpression_4DAC29C5"; } CParticleAttributeDeclaration $LOCAL$/CParticleAttributeDeclaration_9BDD555E { AttributeName = "ProbeVelocity"; AttributeDescription = "Initial velocity of lightning strokes\\nDirectly controls the stroke length."; DefaultValueF4 = float4(1.0000000e+002, 0.0000000e+000, 0.0000000e+000, 0.0000000e+000); HasMin = true; HasMax = true; MaxValueF4 = float4(5.0000000e+002, 0.0000000e+000, 0.0000000e+000, 0.0000000e+000); } CActionFactoryParticleSpawnerBase $LOCAL$/Source { Descriptor = "$LOCAL$/CParticleDescriptor_2830BC72"; DurationInSeconds = 1.0000000e-001; FluxFactorExpression = "Flux"; } CParticleSamplerCurve $LOCAL$/CParticleSamplerCurve_CD928515 { SamplerName = "Glow"; Times = { 0.0000000e+000, 1.6115850e-001, 1.7384709e-001, 2.0104469e-001, 5.6299138e-001, 1.0000000e+000, }; FloatValues = { 4.3323541e-001, 1.4717730e+000, 3.0183129e+000, 1.4834321e+000, 6.6818959e-001, 4.3290529e-001, }; FloatTangents = { 0.0000000e+000, 0.0000000e+000, 0.0000000e+000, 0.0000000e+000, 2.3728991e+000, -2.0313981e+000, 0.0000000e+000, 0.0000000e+000, -6.6506660e-001, -8.0299091e-001, 0.0000000e+000, 0.0000000e+000, }; MinLimits = float4(0.0000000e+000, 0.0000000e+000, 0.0000000e+000, 0.0000000e+000); } CParticleAttributeDeclaration $LOCAL$/CParticleAttributeDeclaration_DC3BD88D { AttributeName = "RGB"; AttributeType = float3; DefaultValueF4 = float4(9.9999998e-003, 1.3000000e-001, 9.4999999e-001, 0.0000000e+000); HasMin = true; HasMax = true; MaxValueF4 = float4(1.0000000e+000, 1.0000000e+000, 1.0000000e+000, 1.0000000e+000); MaxValueI4 = int4(10, 10, 10, 10); } CParticleAttributeDeclaration $LOCAL$/CParticleAttributeDeclaration_AFD4EBD4 { AttributeName = "Power"; DefaultValueF4 = float4(2.5000000e+000, 0.0000000e+000, 0.0000000e+000, 0.0000000e+000); HasMin = true; HasMax = true; MaxValueF4 = float4(1.0000000e+001, 1.0000000e+000, 1.0000000e+000, 1.0000000e+000); MaxValueI4 = int4(10, 10, 10, 10); } CParticleState $LOCAL$/CParticleState_37820737 { StateName = "State_0"; Evolvers = { "$LOCAL$/Script_1", "$LOCAL$/Emitter", }; } CParticleEvolver_Physics $LOCAL$/CParticleEvolver_Physics_4B0C0AC6 { } CParticleEvolver_Projection $LOCAL$/CParticleEvolver_Projection_F6C54DFB { Shape = "ProjMesh"; } CParticleEvolver_Spawner $LOCAL$/Emitter { SpawnMetric = Time; SpawnInterval = 9.9999998e-003; Descriptor = "$LOCAL$/CParticleDescriptor_8CDE14FE"; } CParticleState $LOCAL$/CParticleState_E7543A8F { StateName = "State_0"; Evolvers = { "$LOCAL$/CParticleEvolver_Physics_4B0C0AC6", "$LOCAL$/CParticleEvolver_Projection_F6C54DFB", "$LOCAL$/LightningTrail", }; } CParticleDescriptor $LOCAL$/CParticleDescriptor_8CDE14FE { Samplers = { "$LOCAL$/CParticleSamplerShape_F922C3D7", "$LOCAL$/CParticleSamplerShape_6ED04DA1", }; SpawnEvaluator = "$LOCAL$/CCompilerSyntaxNodeExpression_1189B899"; States = { "$LOCAL$/CParticleState_E7543A8F", }; } CCompilerSyntaxNodeExpression $LOCAL$/CCompilerSyntaxNodeExpression_1189B899 { Expression = "function void Eval() { Life = 0.4; // here, grab a random spawn location in the \'ProjSpawnVolume\' shape. // you can select that shape in the treeview and move it around in the viewport // to make lightning start at different locations Position = ProjSpawnVolume.samplePosition(); // next, reproject the start position on the mesh // (this is because otherwise the trail evolver will make a trail from the // original position to the projected position on the first frame) Position += ProjMesh.project(Position).xyz; // random velocity on a squased sphere whose height is // 0.3 times its equatorial radius. -> move faster horizontally Velocity = vrand() * float3(0.1,0.1,0.5)*ProbeVelocity; } "; } CParticleSamplerShape $LOCAL$/CParticleSamplerShape_F922C3D7 { SamplerName = "ProjSpawnVolume"; Shape = "$LOCAL$/CShapeDescriptor_FCC733E6"; SampleDimensionality = Volume; } CShapeDescriptor $LOCAL$/CShapeDescriptor_FCC733E6 { ShapeType = SPHERE; Radius = 5.0000000e-001; } CParticleSamplerShape $LOCAL$/CParticleSamplerShape_6ED04DA1 { SamplerName = "ProjMesh"; Shape = "$LOCAL$/CShapeDescriptor_A51D3C78"; SampleDimensionality = Vertex; } CShapeDescriptor $LOCAL$/CShapeDescriptor_A51D3C78 { ShapeType = SPHERE; Radius = 5.0000000e-001; } CParticleEvolver_Script $LOCAL$/Script_1 { Expression = "$LOCAL$/CCompilerSyntaxNodeExpression_0F7DFA91"; } CCompilerSyntaxNodeExpression $LOCAL$/CCompilerSyntaxNodeExpression_0F7DFA91 { Expression = "function void Eval() { //Position += float3(0.01,0,0); } "; } CParticleFieldDeclaration $LOCAL$/CParticleFieldDeclaration_3D199BC4 { FieldName = "Velocity"; FieldType = float3; TransformFilter = rotate; }