Got a smoke?

Weeee!

A self-shadowing smoke-simulator, with a crap framerate! ;D

Download the non-webstartable zipper

http://www.songprojector.com/temp/smoke_demo_0.png

http://www.songprojector.com/temp/smoke_demo_1.png

You need a fairly fast computer to get this running smooth, as it raytraces itself every frame. ::slight_smile:

P4 2.4GHz / ATi 9700pro -> 5fps (client vm 1.5) -> 10fps (server vm 1.5)

All raytracing, sorting, shading and lighting is done on the CPU. Argh!
Rendering the 2k sprites is done by the GPU.

The first versions did 10s / frame, I’m glad it is running at interactive framerates.
4 rays per sprite (every corner) are used for realistic shading.

You can poke a few keys to change the variables:
Q+A = specular
W+S = diffuse
D+E = ambient
R+F = light angle
T+G = transparancy

I wish the best of luck to all of those without a QWERTY keyboard

Looks really nice! Planning to use it in a game you’re working on? :wink:

On the client vm I also get around 5fps (P4 2.8Ghz / 6600GT)

It could be used in a game :slight_smile: when it is updated every once in a while, probably updating in some low-priority thread.

Even the fillrate is a problem, it is a 2k particle engine after all, so it should probably be rendered to an imposter.
The current version is clearly CPU limited so using the server-vm is the most important speedup.

Oh, and the new updated version takes advantage of multiple CPU-cores.

* darkprophet tsks…

No linux natives…

DP

engine running
engine -> main -> EngineSkeleton.initDisplay() [Requested DisplayMode: 800 x 600 @85Hz]
engine -> main -> EngineSkeleton.initDisplay() [Found DisplayMode: 800 x 600 x 32 @70Hz]
engine -> main -> EngineSkeleton.initDisplay() [Found DisplayMode: 800 x 600 x 32 @56Hz]
engine -> main -> EngineSkeleton.initDisplay() [Found DisplayMode: 800 x 600 x 32 @85Hz]
engine -> main -> EngineSkeleton.initDisplay() [Found DisplayMode: 800 x 600 x 32 @75Hz]
engine -> main -> EngineSkeleton.initDisplay() [Found DisplayMode: 800 x 600 x 32 @60Hz]
engine -> main -> EngineSkeleton.initDisplay() [Found DisplayMode: 800 x 600 x 32 @72Hz]
engine -> main -> EngineSkeleton.initDisplay() [Selected DisplayMode: 800 x 600 x 32 @85Hz]
engine -> main -> EngineSkeleton.initDisplay() [Using custom pixelformat: 0xFSAA, 24bit depth, 24bpp
]
engine -> main -> GLChecks.printStats() [Operation System: Windows XP 5.1 (x86, CPUs: 1)]
engine -> main -> GLChecks.printStats() [Java Platform: 1.5.0_06-b05 (Compiler: Java HotSpot(TM) Cli
ent VM)]
engine -> main -> GLChecks.printStats() [OpenGL: 2.0.1 (driver: 6.14.10.8194)]
engine -> main -> GLChecks.printStats() [GPU: GeForce 6600 GT/AGP/SSE/3DNOW! by NVIDIA Corporation]
engine -> main -> GLChecks.printStats() [Texture Support: 4 units, 4096^2 pixels]
engine -> main -> GLChecks.printStats() [[x] Shader Programs]
engine -> main -> GLChecks.printStats() [[x] HP occlusion]
engine -> main -> GLChecks.printStats() [[x] ARB occlusion]
engine -> main -> GLChecks.printStats() [[x] Vertex Buffer Objects]
engine -> main -> GLChecks.printStats() [[x] Frame Buffer Objects]

animating took 57ms
raytracing on 1 cores took 265ms

animating took 41ms
raytracing on 1 cores took 222ms

animating took 41ms
raytracing on 1 cores took 206ms

animating took 42ms
raytracing on 1 cores took 212ms

animating took 41ms
raytracing on 1 cores took 204ms

animating took 41ms
raytracing on 1 cores took 205ms

animating took 41ms
raytracing on 1 cores took 204ms

animating took 43ms
raytracing on 1 cores took 200ms

animating took 41ms
raytracing on 1 cores took 204ms

animating took 43ms
raytracing on 1 cores took 204ms

animating took 41ms
raytracing on 1 cores took 205ms

animating took 42ms
raytracing on 1 cores took 204ms

animating took 41ms
raytracing on 1 cores took 211ms

animating took 67ms
raytracing on 1 cores took 188ms

animating took 41ms
raytracing on 1 cores took 211ms

animating took 44ms
raytracing on 1 cores took 231ms

animating took 41ms
raytracing on 1 cores took 216ms

animating took 41ms
raytracing on 1 cores took 213ms

animating took 42ms
raytracing on 1 cores took 220ms

animating took 42ms
raytracing on 1 cores took 224ms

base -> main -> Ticker.loop() [null]
java.lang.NullPointerException
        at com.eyeriv.game.client.WorldRenderer.build(WorldRenderer.java:396)
        at com.eyeriv.game.client.WorldRenderer.display(WorldRenderer.java:454)
        at engine.opengl.RenderManager.render(RenderManager.java:48)
        at com.eyeriv.game.client.ClientEngine$2.tick(ClientEngine.java:96)
        at com.eyeriv.time.Ticker.loop(Ticker.java:123)
        at com.eyeriv.time.Ticker.start(Ticker.java:87)
        at com.eyeriv.game.client.ClientEngine.init(ClientEngine.java:66)
        at com.eyeriv.game.client.ClientEngine.main(ClientEngine.java:20)
java.lang.NullPointerException
        at com.eyeriv.game.client.WorldRenderer.build(WorldRenderer.java:396)
        at com.eyeriv.game.client.WorldRenderer.display(WorldRenderer.java:454)
        at engine.opengl.RenderManager.render(RenderManager.java:48)
        at com.eyeriv.game.client.ClientEngine$2.tick(ClientEngine.java:96)
        at com.eyeriv.time.Ticker.loop(Ticker.java:123)
        at com.eyeriv.time.Ticker.start(Ticker.java:87)
        at com.eyeriv.game.client.ClientEngine.init(ClientEngine.java:66)
        at com.eyeriv.game.client.ClientEngine.main(ClientEngine.java:20)

Runs for a few seconds, the quits with the above error. Looks really nice though (even at about two frames a second).

Oooh, sweet. :smiley:

This could be used to build sweet looking dynamic cloud billboards for wurm… is it open source or similar? :smiley:

Orangy Tang: That happens when some ‘blob’ moves outside the octtree, which I assumed was impossible. Oh well :slight_smile:

DarkProphet: I bet you’re skilled enough to drop the linux-binaries inthere, enjoy it!

Markus Persson: I dropped you a private message!

Thanks for the feedback!

…please? Pretty please?

Blahblahblah: I tried the easy way, but javagamesfactory.org is down :-\

I’ll add it tonight.

[quote="Riven,post:7,topic:28127"] Did you get my reply? :-)

Today I spent a bit too much time on optimising this thingy, and made it about 50% faster by changing the way the blobs are stored in blob-space :wink: will upload it later.

Markus:
I’ll drop you another private message in a few hours.

This is what I got:

Every animation cycle was about the same. It only ran for about 20 seconds then got the exception.

Pentium 4 2.66GHz
768MB RAM
Intel 82865G onboard graphics card
Windows 2000

This is my work machine, so not bad with the crap video card.

Yeah, nothing to be scared about, same error as OrangyTang got, the next version won’t have this bug, as I fixed the octtree

Slightly better on my home machine

Windows XP
AMD Athlon64 3000+
512MB
ASUS Radeon 9600PRO 128MB

g I haven’t uploaded it yet, will do it in a few minutes.

Update: updated :slight_smile:

Are you using only one white directional light? If so, have you considered using the cloud image to create a normal map and using a DOT3 combine mode to get the shading for free in the GPU?

Mike

New version started out nice:

But slowed down after about 15 seconds

Each corner of a sprite can be individually shadowed by another sprite, so it’s not only about the spherical appearance. It might be overkill, but that’s not the bottleneck of the code anyway. The part that spends 90% of the cycles is traveling through the octtree - which, although is has been optimised already, has enough room for improvement by changing the design all together. Maybe an order of magnitude, but we’ll see about that. :slight_smile:

Few renders of first version of clouds that might be used in a game, eventually :slight_smile:

It’s a long road ahead though, as these clouds still look a bit cartoonic.

[url=http://www.songprojector.com/temp/smoke_demo_3.png]

http://www.songprojector.com/temp/smoke_demo_3.png

[/url]

[url=http://www.songprojector.com/temp/smoke_demo_4.png]

http://www.songprojector.com/temp/smoke_demo_4.png

[/url]

http://www.agf.nl/info/bloemkool1.jpg

Renders on my laptop at 10fps too now. It’s a steady 100ms per frame on JDK 1.6. Looks very nice :slight_smile:

I lost the mouse cursor though during the demo, but maybe that is LWJGL specific.

Koen