HeapsIO / heaps

Heaps : Haxe Game Framework
http://heaps.io
MIT License
3.21k stars 339 forks source link

GpuParticles graphic glitch #782

Open NewKrok opened 4 years ago

NewKrok commented 4 years ago

I just added a smoke effect to my project with GpuParticles and I found this glitch - gif + screenshots are attached. pc, browser (chrome), nvidia gtx1070

Here is the code:

var parts = new h3d.parts.GpuParticles(s3d);

var g = new h3d.parts.GpuParticles.GpuPartGroup(parts);
g.emitMode = GpuEmitMode.VolumeBounds;
g.emitAngle = 0.5;
g.emitDist = 0;

g.gravity = 0;
g.size = 5;
g.sizeRand = 2;
g.sizeIncr = 3;

g.rotSpeed = 0.5;
g.rotSpeedRand = 0.5;

g.speed = 0.4;
g.speedRand = 0.6;

g.life = 1;
g.lifeRand = 2;
g.nparts = 10;

g.texture = texture;

g.sortMode = GpuSortMode.Dynamic;

parts.addGroup(g);

I have tried it with different sortModes and with different emitModes but it's mostly the same - with GpuSortMode.None it is much much worse. The texture is transparent but it looks it doesn't matter too.

ezgif-2-af320770d08e image image

It looks it has some strange effect on other textures too: image

ncannasse commented 4 years ago

Seems like an issue with sorting, where some particle might be draw before one other behind it. You can try disabling depth write on material to improve the result.

Le mer. 8 avr. 2020 à 23:54, Krisztian Somoracz notifications@github.com a écrit :

I just added a smoke effect to my project with GpuParticles and I found this glitch - gif + screenshots are attached. pc, browser (chrome), nvidia gtx1070

Here is the code:

var parts = new h3d.parts.GpuParticles(s3d);

var g = new h3d.parts.GpuParticles.GpuPartGroup(parts); g.emitMode = GpuEmitMode.VolumeBounds; g.emitAngle = 0.5; g.emitDist = 0;

g.gravity = 0; g.size = 5; g.sizeRand = 2; g.sizeIncr = 3;

g.rotSpeed = 0.5; g.rotSpeedRand = 0.5;

g.speed = 0.4; g.speedRand = 0.6;

g.life = 1; g.lifeRand = 2; g.nparts = 10;

g.texture = texture;

g.sortMode = GpuSortMode.Dynamic;

parts.addGroup(g);

I have tried it with different sortModes and with different emitModes but it's mostly the same - with GpuSortMode.None it is much much worse. The texture is transparent but it looks it doesn't matter too.

[image: ezgif-2-af320770d08e] https://user-images.githubusercontent.com/13141660/78835647-d4f29100-79f0-11ea-8571-73f3a0a34098.gif [image: image] https://user-images.githubusercontent.com/13141660/78835932-59451400-79f1-11ea-9138-ca8816f7d687.png [image: image] https://user-images.githubusercontent.com/13141660/78836070-9a3d2880-79f1-11ea-8469-7b1a0826032d.png

It looks it has some strange effect on other textures too: [image: image] https://user-images.githubusercontent.com/13141660/78837129-b3df6f80-79f3-11ea-8b18-70c180d6a70f.png

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/HeapsIO/heaps/issues/782, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHZXQD47Z777CP3XHLGZDTRLTXABANCNFSM4MEILS3Q .

NewKrok commented 4 years ago

Sadly it looks like the it's same with this: parts.material.mainPass.depthWrite = false;