当前位置:网站首页>Preliminary understanding of Panda3D particle system
Preliminary understanding of Panda3D particle system
2022-07-25 05:07:00 【bcbobo21cn】
function panda3d Example Tut-Particle-Panel.py; A basic particle system appears as follows ;

At the same time, the particle system panel appears as follows ;
The programming principle of particle system should be to specify the emission position of particles 、 Number 、 Particle size 、 Color and other parameters , Then the engine makes it ;
Adjust the panel parameters , Basically no effect was found ;
I studied it , Its particle system configuration is *.ptf file ; Load different ptf file , Take a look at the effect ;
wait ;
Open one ptf Take a look at the document ; Is the plain text , It can be edited manually ; An example is as follows ;
self.reset()
self.setPos(0.000, 0.000, 0.000)
self.setHpr(0.000, 0.000, 0.000)
self.setScale(1.000, 1.000, 1.000)
p0 = Particles.Particles('particles-1')
# Particles parameters
p0.setFactory("PointParticleFactory")
p0.setRenderer("PointParticleRenderer")
p0.setEmitter("DiscEmitter")
p0.setPoolSize(10000)
p0.setBirthRate(0.0200)
p0.setLitterSize(300)
p0.setLitterSpread(100)
p0.setSystemLifespan(0.0000)
p0.setLocalVelocityFlag(1)
p0.setSystemGrowsOlderFlag(0)
# Factory parameters
p0.factory.setLifespanBase(0.5000)
p0.factory.setLifespanSpread(0.2500)
p0.factory.setMassBase(2.0000)
p0.factory.setMassSpread(0.0100)
p0.factory.setTerminalVelocityBase(400.0000)
p0.factory.setTerminalVelocitySpread(0.0000)
# Point factory parameters
# Renderer parameters
p0.renderer.setAlphaMode(BaseParticleRenderer.PRALPHAOUT)
p0.renderer.setUserAlpha(0.45)
# Point parameters
p0.renderer.setPointSize(3.00)
p0.renderer.setStartColor(Vec4(0.25, 0.90, 1.00, 1.00))
p0.renderer.setEndColor(Vec4(1.00, 1.00, 1.00, 1.00))
p0.renderer.setBlendType(PointParticleRenderer.PPONECOLOR)
p0.renderer.setBlendMethod(BaseParticleRenderer.PPNOBLEND)
# Emitter parameters
p0.emitter.setEmissionType(BaseParticleEmitter.ETCUSTOM)
p0.emitter.setAmplitude(1.0000)
p0.emitter.setAmplitudeSpread(0.0000)
p0.emitter.setOffsetForce(Vec3(0.0000, 0.0000, 4.0000))
p0.emitter.setExplicitLaunchVector(Vec3(1.0000, 0.0000, 0.0000))
p0.emitter.setRadiateOrigin(Point3(0.0000, 0.0000, 0.0000))
# Disc parameters
p0.emitter.setRadius(0.0500)
p0.emitter.setOuterAngle(356.1859)
p0.emitter.setInnerAngle(0.0000)
p0.emitter.setOuterMagnitude(2.0000)
p0.emitter.setInnerMagnitude(1.0000)
p0.emitter.setCubicLerping(0)
self.addParticles(p0)
f0 = ForceGroup.ForceGroup('gravity')
# Force parameters
force0 = LinearVectorForce(Vec3(0.0000, 0.0000, -1.0000), 25.0000, 1)
force0.setActive(1)
f0.addForce(force0)
force1 = LinearJitterForce(3.0000, 1)
force1.setActive(1)
f0.addForce(force1)
self.addForceGroup(f0)Display the... Of the particle system panel python The code is as follows ;
import sys
import direct.directbase.DirectStart
base.startTk()
from direct.tkpanels.ParticlePanel import ParticlePanel
pp = ParticlePanel() # Create the panel
base.disableMouse() # Disable camera control to place it
camera.setY(-10) # Place the camera
base.setBackgroundColor(0, 0, 0) # Most particle systems show up better on black backgrounds
run() Particle systems are usually superimposed on the model to make some effects , For example, simulate building fire ;
BaseParticleRenderer Is the base class of particle system ;
The categories of particle systems include : Geometric particles , Line segment particle , Point particles , Pyrotechnic particles , spirit ;
classBaseParticleRenderer
Bases:
Bases: ReferenceCount
Pure virtual particle renderer base class
This class is a pure virtual class ; When programming, use derived concrete classes ;
边栏推荐
- Compile ue5.0
- Deep understanding of pod
- Solve the problem that uni app applet obtains routes and route parameters
- 服务器防护的七个建议
- Style transfer -- CCPL: contrast coherence preserving loss for versatile style transfer
- 2、 Mysql database foundation
- [literature notes] pointmlp
- unity 3D物体添加 点击事件
- Li Kou 731. My schedule II
- Matter's Unified Smart Home connection standard enables local automatic interaction between smart devices
猜你喜欢
[small program practice] first day
![[untitled]](/img/6c/df2ebb3e39d1e47b8dd74cfdddbb06.gif)
[untitled]

基环树入门

When we talk about immutable infrastructure, what are we talking about

初步了解Panda3d粒子系统

2022-7-18 summary

推荐系统-协同过滤在Spark中的实现

rhcsa暑假第二天

Three must know and know problems of redis

Event cycle mechanism browser nodejs async await execution sequence promise execution sequence interview questions
随机推荐
JS common code questions array de duplication - Custom New throttling and anti shake - deep copy - instanceof URL parameter extraction - thousand separator - array to tree structure - array flattening
Ffmpeg download and installation
38 lines of PHP code free import database analysis Linux access log
How to test data in the process of data warehouse migration?
Docker builds MySQL master-slave replication
How to publish your own NPM package
An article takes you to understand the sentinel mode of redis
Event cycle mechanism browser nodejs async await execution sequence promise execution sequence interview questions
Redis集群搭建(Windows)
"Niuke | daily question" inverse Polish expression
教你三招从让性能从20s优化到500ms
Xiaohongshu joins hands with HMS core to enjoy HD vision and grow grass for a better life
Render Optimization: repaint and reflow
The 6th "Blue Hat Cup" National College Students' Cyber Security Skills Competition writeup
Most of the time, it's probability
基环树入门
four hundred and forty-four thousand one hundred and forty-one
Interviewer: explain the core principle of ThreadLocal
Why does the official not recommend using UUID as MySQL primary key
Small case of data analysis: visualize recruitment data and view the most needed technologies in the field~