Coder Social home page Coder Social logo

alchemist0823 / three.quarks Goto Github PK

View Code? Open in Web Editor NEW
442.0 442.0 19.0 9.3 MB

Three.quarks is a general purpose particle system / VFX engine for three.js

Home Page: https://quarks.art

License: MIT License

TypeScript 99.33% JavaScript 0.67%
editor particles webgl

three.quarks's People

Contributors

alchemist0823 avatar benferns avatar cygnusfear avatar d8h avatar danielbelmes avatar dependabot[bot] avatar hybridherbst avatar marwie avatar tracyhenry avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

three.quarks's Issues

Intended to be compatible with logarithmic depth?

I get the following error in BatchedParticleRenderer materials when switching the threejs renderer to logarithmic depth:

THREE.WebGLProgram: Shader Error 0 - VALIDATE_STATUS false Program Info Log: Vertex shader is not compiled. VERTEX ERROR: 0:123: 'isPerspectiveMatrix' : no matching overloaded function found

Changelog out of date and no release tags

Hello,

do you think you could update the changelog and push release tags to github? It would help with knowing when to update to which version / when new features are available 😊

Last release: 13 days ago, version 0.10.0
Changelog: almost a year ago, version 0.7.0

how to start particle more than 1 time without looping

I would like to create an effect such as we currently have on the three.quark website - i.e. pressing a button triggers an effect, the next press triggers another, etc.

image

Currently, using addSystem will simply add an effect to me that executes once (if it is not looped)

this.quarksRenderer.addSystem(child.system);

but calling the function again and creating a new object will not trigger the effect a second time - only loading it and downloading the asset again will allow this.

So, how do you trigger effect after effect depending on the will of the user? (effect read from json file)

RenderMode ?

Hello,

could you clarify what you mean by localspace in the RenderMode enum?

export declare enum RenderMode {
    BillBoard = 0,
    StretchedBillBoard = 1,
    LocalSpace = 2,
    Trail = 3
}

was expecting something like this

export enum ParticleSystemRenderMode {
    Billboard = 0,
    //   Stretch = 1,
    //   HorizontalBillboard = 2,
    //   VerticalBillboard = 3,
    Mesh = 4,
    //   None = 5,
}

Horizontal- & Vertical billboards

Hello,

prior to 0.10.6 (in version 0.7.3) we could create horizontal and vertical billboarding by modifying the mesh geometry. This doesn't work anymore. Is there a way to add this behaviour again?

Old code:

if (renderMode === ParticleSystemRenderMode.HorizontalBillboard) {
            geo = new THREE.BoxGeometry(1, 1, 0);
        }
        else if (renderMode === ParticleSystemRenderMode.VerticalBillboard) {
            geo = new THREE.BoxGeometry(1, 0, 1);
        }

JSM file

Hello! My project does not use TS nor compiling, it would be very convinient to have a jsm version where, similar to threejs, you can just drop the file in and import what you need, would it be possible to have such release downloadable for convenience ?

Particle opacity behavior

I could not find a way to control the opacity of particles by analogy with ColorOverLife.
Are you planning to add this functionality?

Three.js is used as dependency, not peer dependency

I was investigating why we always get double versions of three in some applications. Turns out that three.quarks is the only package in the chain that is pulling in an actual version of three and not a peerDependency, which would correctly resolve to the actual intended three version.

Are you open to changing this? Should just be moving three from "dependency" to "peerDependency".
Thanks!

image

ReadMe example code seems outdated

In the code example from README.md, should the curly brackets be removed?

Existing code:

muzzle1 = new ParticleSystem({muzzle});

Proposition:

muzzle1 = new ParticleSystem(muzzle);

Trail Particle Performance on Quest

Hello,

I recently noticed a huge performance difference on Quest using trail particles - trail particles are currently very slow on Quest to the point where I can't really use them easily in my scenario.

Could that be related to the default maxParticles size being 10x the size of a normal sprite batch? I'm also wondering why the max size is hardcoded for both of these cases? Would it be possible to expose this with the VFXBatchSettings interface?
E.g. in my case i want to render a single particle trail following an arrow so I surely don't need that many particles. Also in most cases I'm dealing with particle counts < 100 or < 200

this.maxParticles = 10000;

this.maxParticles = 1000;

Usage of ``ParticleSystem.emit``

Hello,

I have a case where I have a one-shot effect with a duration of 1 and not looping. I still want to be able to call emit on this effect and have the system emit the provided amount of particles that frame. Currently the internal emitEnded flag prevents that.

What would you suggest on how to make this still work and force it to emit particles?

Here's a short video where I set emitEnded to false before calling emit in a 1 sec interval

20221111-124820_Made_with_Needle_-_Google_Chrome.mp4

the system is setup like this:
image

Change the map doesn't work

createParticleSystem = () => {
		this.batchSystem = new BatchedParticleRenderer();
		const texture = new TextureLoader().load("textures/star.png");
		texture.encoding = sRGBEncoding;
		const param = {
			shape: new DonutEmitter({
				radius: 2,
				angle: Math.PI / 4,
				arc: Math.PI,
			}),
			renderMode: RenderMode.BillBoard,
			worldSpace: false,
			renderOrder: 2,
			looping: true,
			duration: 5,
			emissionOverTime: new ConstantValue(100),
			startLife: new ConstantValue(5),
			startSize: new IntervalValue(10, 15),
			startSpeed: new ConstantValue(5),
			material: new MeshBasicMaterial({ transparent: true, color: 0xff0000, map: texture, blending: AdditiveBlending, depthTest: false }),
			onlyUsedByOther: false,
		};

		setTimeout(() => {
			const texture = new TextureLoader().load("textures/1.jpg");
			this.muzzle.texture = texture;
		}, 5000);

		this.muzzle = new ParticleSystem(param);

		this.muzzle.addBehavior(new SizeOverLife(new PiecewiseBezier([[new Bezier(.3, .5, .6, .3), 0]])));
		this.muzzle.addBehavior(new ColorOverLife(new ColorRange(new Vector4(0, 0, 0, 1), new Vector4(1, 1, 1, .3))));
		this.muzzle.emitter.name = 'muzzle1';
		this.batchSystem.addSystem(this.muzzle);

		this.muzzle.emitter.rotateX(-Math.PI / 2);
		this.scene.add(this.muzzle.emitter);
		this.scene.add(this.batchSystem);
	};

The above dynamic modify texture is not effective, Version is 0.10.2 ,Where I do wrong?

Improvement: Offload Physics to Thread

The system will reach a CPU bottleneck pretty fast when using complex effects, way sooner than any GPU bottleneck.

Implement a way to offload the physics calculations to a worker. Ideally, when a particle is first created the first couple frames are calculated on the main thread while calculations of multiple frames are requested to the worker which can generate the simulation in advance.

Obviously requesting the calculations every frame to the worker would not be possible since you would be bottlenecked by the transfer between threads so the only way i see this working is if the worker calculates multiple frames in advance per request.

Particle died event

Hello,

is there a good way to get the died state of a particle from a behaviour? How should events be implemented that happen on particle death?

My workaround for now is adding the current delta time and checking if it is above the life.
But that is quite hacky and unstable I would say :)

const willDie = particle.age + delta >= particle.life

Support for cutout / alpha clipping

Right now it seems either "transparent" or "opaque" are supported. In some cases "opaque + alphaClip" would be desirable, e.g. to have circular or bokeh particles that properly render depth.

looping property in particle system configuration doesn't work (?)

hello,

does looping property in particle system configuration work well?
In example muzzleFlashDemo animation, effect is constantly looping on the demo, even though each instance of the System has looping on false.

*but if we read effect from .json file, then looping work well

also you should remove console.log(this.subEmissions.length, this.subParticleSystem.system.particleNum);

Json import and world space scale not working

Importing a json that has world space effects, then applying a scale to the container of the particle systems does not reflect on the object. This can also be verified in the visual editor by changing the scale of the “plasma projectile” example and observing it does nothing

Adjust log messaging

Follow-up to #63

We've had a few people voice confusion as to why their entire website is "powered by three.quarks" according to the logs.
Would it be possible to adjust the messaging to read "Particle Systems powered by three.quarks" or similar?

Thank you!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.