Not logged inOpenClonk Forum
Up Topic Development / Art Workshop / [Particles] Fire
1 2 3 Previous Next
Parent - - By Armin [de] Date 2015-02-04 13:36
Can you please test the current 15 again? There are 60 trees in a row, Gold Rush contains 30.

Ashes: I only forgot to draw tunnel as an underground material in the scenario.
Parent - - By Maikel Date 2015-02-04 14:30
Yes, 38 FPS for me now! But people with worse hardware should test it as well I guess.

The trees did not decay to ashes currently, so I could not test that. Also when my clonk is on fire and I stand in front of a tree that fire starts at the trees centre, I would expect it to start close to the clonk, this looks odd.

Also where did the fire bombs go? I think it would be nice to have something (which does not look like firestones) with the same functionality in OpenClonk.
Parent - - By Clonkonaut [de] Date 2015-02-04 16:07
Would have tested with the crappy Intel chip at work but oh no:

[16:04:20] WARNING (particle system): Your graphics card does not support glPrimitiveRestartIndex - a (slower) fallback will be used!
[16:04:20] Grafik wird geladen...
[16:04:21] FATALER FEHLER: Fehler beim Initialisieren der GLSL-Shader


Anyone interested in the OpenClonkShader.log? Although I think not. :)
Reply
Parent - - By Clonk-Karl [us] Date 2015-02-06 02:28

> Anyone interested in the OpenClonkShader.log?


Hm, there might be a more meaningful error message in there. If not, we should definitely log the shader compile/link error string as well...
Reply
Parent - - By Clonkonaut [de] Date 2015-02-06 17:20
Attached
Attachment: OpenClonkShaders.log (54k)
Reply
Parent - - By Clonk-Karl [us] Date 2015-02-07 01:56
So the error message is

ERROR: 0:74: '=' :  cannot convert from '3-component vector of float' to '2-component vector of float'

I think it relates to this line:

vec2 lightCoord = lightTransform * vec3(gl_FragCoord.xy, 1.0);

But it is not clear to me why it does not work. My Intel driver works with it. Can you try to replace this line by

vec2 lightCoord = (lightTransform * vec3(gl_FragCoord.xy, 1.0)).xy;

in Graphics.ocg/ObjectLightShader.glsl? Also, you'll have to replace

float ambient = texture2D(ambientTex, ambientTransform * vec3(gl_FragCoord.xy, 1.0)).r * ambientBrightness;

by

float ambient = texture2D(ambientTex, (ambientTransform * vec3(gl_FragCoord.xy, 1.0)).xy).r * ambientBrightness;

in Graphics.ocg/AmbientShader.glsl.
Reply
Parent - - By Clonkonaut [de] Date 2015-02-09 12:00
That did work! Both logs attached.
Attachment: OpenClonk.log (3k)
Attachment: OpenClonkShaders.log (54k)
Reply
Parent - By Clonk-Karl [us] Date 2015-02-10 02:10
Thanks, I have comitted this to the repository since it should not be harmful to modern video cards/drivers.
Reply
Parent - - By Sven2 [de] Date 2015-02-06 17:40
Do you have the full log showing Driver and GL version?
Parent - By Clonkonaut [de] Date 2015-02-06 19:53
On monday!
Reply
Parent - By Clonkonaut [de] Date 2015-02-09 11:48
Full log:

[16:04:20] OpenClonk
[16:04:20] Version: 6.0 win-x86 (a237caa4678c)
[16:04:20] ExePath: "C:\Dokumente und Einstellungen\frnv401\Eigene Dateien\oc snapshot\"
[16:04:20] SystemDataPath: "C:\Dokumente und Einstellungen\frnv401\Eigene Dateien\oc snapshot\"
[16:04:20] UserDataPath: "C:\Dokumente und Einstellungen\frnv401\Anwendungsdaten\OpenClonk\"
[16:04:20] Command line: openclonk.exe FireParticles_15.ocs --editor
[16:04:20] GL 3.0.0 - Build 6.14.10.5361 on Intel(R) HD Graphics Family (Intel)
[16:04:20] WARNING (particle system): Your graphics card does not support glPrimitiveRestartIndex - a (slower) fallback will be used!
[16:04:20] Grafik wird geladen...
[16:04:21] FATALER FEHLER: Fehler beim Initialisieren der GLSL-Shader
[16:04:21] Spiel deinitialisiert.
[16:04:21] Engine heruntergefahren.
Reply
Parent - By Marky [de] Date 2015-02-04 16:29

>I think it would be nice to have something (which does not look like firestones) with the same functionality in OpenClonk.


Make something that looks like the iron bomb, but from clay instead of iron. Would be perfect, imo.
Parent - By Anonymous [de] Date 2015-02-04 16:55
We had no fire bomb because we had no good fire yet :-)
Reply
Parent - - By Clonkonaut [de] Date 2015-02-09 12:07
My benchmark:

Core i3-2100 @ 3.10 Ghz
3,16 GB RAM
Intel(R) HD Graphics Family (Intel)

Game is running at 640x480, 32bit, no AA, no Highres Landscape

Runs at 38fps with only a few fires around, 20fps with the whole forest ablaze.
Reply
Parent - By Clonkonaut [de] Date 2015-02-09 12:29
Increasing settings, one step a time.

No noticable impact on performance:

- Highres Landscape
- 800x600

Crash after turning on AA and starting scenario (AA.zip)

Restarting works, AA is 4x but noticable: 32fps normal, 12 in front of burning trees.

Turning AA off again. Starting scenario crashes again (AA2.zip). Changing the AA setting crashes for me.

- 848x480 (weird because monitor doesn't handle very well, but 24 fps in front of burning trees; "ifobt")
- 1024x768: Framerate drop to 15fps (ifobt)
- 1280x960 / 1280x1024: 10fps (ifobt)
- 1600x1200: game itself drops to 30fps, 7fps ifobt; music starts skipping a lot
- 1920x1200: game still at 30, ifobt at 6 fps.

I hereby license the file AA2.zip under the CC-BY license

I hereby license the file AA.zip under the CC-BY license
Attachment: AA2.zip (11k)
Attachment: AA.zip (13k)
Reply
Parent - By Armin [de] Date 2015-02-09 20:15
Thanks for the information.
Parent - - By Armin [de] Date 2015-03-13 23:31
v16:
- The amount of particles is lower but the sizes of shap flames are bigger. Also, the script checks how many other burning objects are around only once. That increased the FPS a bit: When I have 420 burning trees in v15 I get 19/20FPS, in v16 I have 27FPS with the same number of burning trees.
- Smoke is darker if fire strenght is stronger than 50%. Thats how it is in the current OC I think.
- A few positions corrected again.
- I tried to make the fire (especially the objects coming from the fireflint) look more like in CR. For that, I changed the color of the FlameBorder particle. It makes the fire more yellow with very red borders. My original one is way more orange in all areas. See image.
- The fire graphic has a minimum size of 10%.
- The other particle, SharpFlame, got rounder bottoms in the graphics.
Parent - By Maikel Date 2015-03-13 23:36
Looks very nice the image. I will have a look after the 6.0 release and how we can get this into the game. It and some bugfixes could warrant a 6.1 release!
Parent - By Zapper [de] Date 2015-03-13 23:37
wow, the screenshot looks really cool
Parent - By Marky [de] Date 2015-03-14 08:36
I like it very much, it is also in the spirit of the original fire!
Parent - - By Maikel Date 2015-03-16 21:44
I don't like all the improvements you made, especially on smaller and moving objects the fire looks a bit odd.

The clonk needs to special behaviour I suppose, or the particles created at a bit more random positions. For objects smaller than the clonk I would add more alpha to the particles or rather create less particles.

Still I am not so happy with the performance (27 FPS for me as well) and that forest should burn with at least the 38 FPS on a machine with half the graphics power mine has (GTX750M, 1080p no AA).
Parent - By Zapper [de] Date 2015-03-16 22:20

>Still I am not so happy with the performance (27 FPS for me as well) and that forest should burn with at least the 38 FPS on a machine with half the graphics power mine has (GTX750M, 1080p no AA).


If the script for the fire effect still looks similar to the one in the first versions, there is probably a lot of potential for optimizations.

I really don't think the particle rendering is the bottleneck here
Parent - - By Armin [de] Date 2015-03-20 16:31
In the minimal version, I summarized the code and only 1 of the 5 sharp particles is created all 4 frames. But I have a bad feeling about making the fire so much less detailed.

Image:
Note that I had a small FPS drop to 35 FPS all ~5 seconds and I have 180 trees. With 120 trees constant 38 FPS. The 37 FPS with the 400 flames are constant, too.

GPU: NVIDIA GeForce 560
CPU: 3.4 ghz quad core intel core i7
Parent - - By Zapper [de] Date 2015-03-20 16:36
Really, I don't think the particle rendering is the problem.

Do you want to give me the code from the screenshot above and I'll try to optimize it?
Parent - By Armin [de] Date 2015-03-20 16:49
Sure everything below line 288 is new: http://pastebin.com/aEeNjdXS
Parent - - By Newton [de] Date 2015-03-20 17:54
Couldn't this just go into the repository already?
Parent - - By Maikel Date 2015-03-20 17:59
Not if it could still lag for slower hardware, it could be done briefly on a different branch though, I'd favour that.
Parent - - By Armin [de] Date 2015-03-20 18:47 Edited 2015-03-20 18:49
Even if you delete my SmokeReduction thingy (which reduces a few particles if other burning objects were around), my fire should be faster than the current OpenClonk fire. I can't find Smoke() but I think it spams more particles than I use for both smoke and fire...

Nevertheless, I agree that fire should be as fast as possible! Clonk Rage fire might be superior in terms of FPS.
Parent - - By Zapper [de] Date 2015-03-20 18:59 Edited 2015-03-20 19:51
The amount of particles is most likely NOT what makes this slower or faster..

PS: I tested it now:
500 trees: 37 FPS
500 trees with your fire: 8-10 FPS
500 trees on fire WITH EVERY CreateParticle removed: 10-12 FPS

PPS: I noticed I was a bit unfair there - I didn't have the graphics of your particles included and so they weren't rendered :D
But at least without graphics, I could raise the FPS from 8-10 to around 25. Let's see how it works with graphics..
Parent - By Sven2 [de] Date 2015-03-20 23:16
Just check the script profiler if there's anything heavy showing up?
Parent - By Zapper [de] Date 2015-03-20 20:22
I am burning 100 trees with 35 FPS and 500 trees with 16 FPS here now
Parent - - By Zapper [de] Date 2015-03-21 09:46
Should I send the optimized version to you to play around some more or push it to the repository?
Parent - By Armin [de] Date 2015-03-21 12:55 Edited 2015-03-21 12:58
Imo you can push it into repo. I uploaded a version with fixed fire dmg btw in the case you haven't deleted line 295 alrdy in your optimized version.
Parent - By Zapper [de] Date 2015-03-20 18:03
I will see whether I can push it to acceptable speed first!
Parent - - By Maikel Date 2015-03-20 19:13
Can you fix the fire looking odd for a diving or jumping clonk for example?
Parent - - By Matthias [de] Date 2015-03-20 19:22
There will always be objects with just such a shape that fire will look odd. I'm not sure how other games do it, but a general cg-attempt would be to spawn the particles from a random location on the mesh of the object. This is most likely rather tricky because the meshes - especially our buildings - can and will have areas where vertex density is really low and others where its rather high.
Reply
Parent - - By Maikel Date 2015-03-20 19:33
I would at least make a special case for the clonk, since that is the main character of the game and also has most different poses.

But yes you are right, this is not an easy issue to tackle.
Parent - By Armin [de] Date 2015-03-20 19:56
Fire is wider for the Clonk now. So it looks okay with jumping. That the center of the swimming Clonk graphic is not the center of his vertices is a bit related with this bug.
Parent - - By Pyrit Date 2015-03-20 19:46
Isn't there CreateParticleAtBone for that?
Parent - By Matthias [de] Date 2015-03-20 19:58
Yes, no: It might work okayish for the clonk, because he has bones and is a special case, but what about objects that only have bones in some parts of the model? What of those that have none at all?
The Clonk or other animals also will suffer from the fact that he has like, one bone in the head and at least 15 in each hand, so he might look more like a fire mage casting a spell than actually being on fire. Its the same problem like with the vertex density really.
One could of course solve that by specifying in the model where flames should come from. You could do so by adding special bones or submeshes or whatever. That would allow a great deal of control, but would again raise the bar for creating new objects.
Reply
Parent - - By Matthias [de] Date 2015-03-20 20:15
If one would want to spawn flames uniformly from the mesh, the easiest solution might be to randomly select a triangle by the cumulative area weight and spawn a particle somwhere inside that triangle. Cumulative area weight lists could be computed once at startup, I guess, assuming that bone animation doesn't do some funky kind of stretching (it shouldn't), and since they would be ordered already the lookup count is a log2(n) of the triangle count, so that could actually work out.
Reply
Parent - By Clonk-Karl [us] Date 2015-03-21 00:25 Edited 2015-03-21 00:29
In that case you would get a random location in three dimensions, but when projected to two dimensions (screen coordinates) it won't be uniform anymore. Not sure that's good or bad.

An alternative that would be uniform in 2D would be to repeatedly choose a random location within the projected bounding box of the mesh until a hit test with the mesh itself is fulfilled. Depending on the shape of the mesh, this could be much slower, though.
Reply
Parent - - By Zapper [de] Date 2015-03-22 10:28
Your fire effect has been added to the game! :)

Parent - - By Maikel Date 2015-03-23 12:28
That's very nice.

I think you left some dead code now: for example fctFire is not used any more and Fire.png could be deleted, or?

Also the lag must then have been caused by the trees? Did you test setting a lot of objects without graphics on fire?
Parent - - By Zapper [de] Date 2015-03-23 14:00

>Also the lag must then have been caused by the trees? Did you test setting a lot of objects without graphics on fire?


No, but I checked how fast the game would run with 500 trees that were NOT burning, of course :)

Did you check how performant this current version is for you?

>I think you left some dead code now: for example fctFire is not used any more and Fire.png could be deleted, or?


Yes, I was a little reluctant to just remove all of it when I removed drawing of the fire facet - maybe we want the facet as a background when the object's picture is rendered? For example for the crew icons in the top left
Parent - By Maikel Date 2015-03-23 18:22 Edited 2015-03-23 19:51
I did not test performance yet, but no problems on my machine so far.

I'd suggest to remove dead code, one can always look up what has been removed in the repository.

Found an error (when I threw a fire bomb):

ERROR: using removed object.
[18:19:31]  by: FxFireTimer(0,{FreqReduction = 4, Name = "Fire", blasted = false, border_active = false, caused_by = -1, chaoticspark = {...}, fire_height = 2, fire_width = 4, flameborder = {...}, height = 1, incinerating_obj = nil, maxhgt = 2, mode = 3, no_burn_decay = nil, pspeed = -1, redfiredense = {...}, sharpflame = {...}, smoke = {...}, strength = 100, width = 4},832) (/home/maikel/openclonk/repos/build/planet/System.ocg/Fire.c:430)
[18:19:35]
Parent - - By Maikel Date 2015-06-01 15:25
Fire should start burning either much faster or instantly on the Flame object, since this object is used by for example the firebomb (on which I am working) to cast flames. Those flames should not have a fade in of one to two seconds.
Parent - By Zapper [de] Date 2015-06-01 19:56
Did you try it? Does an object at 100% fire still start slowly?

If so, it should enough to call Fx*Timer a few times in Fx*Start when strength == 100 or something :)
Parent - - By Armin [de] Date 2015-06-28 20:48
One bug that Maikel addressed here is that some body parts of a running Clonk are too far away from the fire. Especially the legs in my opinion. Shortly before the clean version came into the game, I fixed that by merely adding "if (GetID() == Clonk) effect.fire_width += 3;" behind line 300. It is mb worth to add again.
Parent - - By Maikel Date 2015-06-28 20:51
Maybe a more general solution where an object can define a shape change in a callback would be better. In case I can have a look at it.
Up Topic Development / Art Workshop / [Particles] Fire
1 2 3 Previous Next

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill