Powder Toy + Compute Shaders (DirectX11)

  • HungryDoodles
    28th May 2014 Member 1 Permalink

    I'am from Russia, so sorry for my english. (I don't know how commas must be placed in english, so i placed tham like in russian language).

    Using Unity3d i can rewrite powder toy to Compute Shaders! I have enougth experience to use it. So i'am trying to write at least air component.

    Why this is so cool? It work hundreds times faster than CPU! If on CPU you have 4-8 cores 3Ghz, 1.6GHz memory bus, on GPU you have 500 - 2500 cores (!!!) 1GHz each, 5 GHz memory bus! Only the problem, that you need graphics card, that supports DirectX 11, but they usually costs $50.

    I have a little piece of code (of all possible), 130 lines, but i just started, so potentialy i can make it all.

    Developer info:
    -It is possible to push data from GPU to CPU, or backward, but it have low speed limit, about 2 GigaBits/sec (PCIe 2.0) or 4-5 GigaBits/sec (PCIe 3.0).

    -There is no syntax highlight for .compute files in MVS, i don't know why...

    -Finding errors in code is worst thing in the world: compiler always says wrong line.

    -No debug, only hardcore.

    -Ultrafast work speed!!!11!1

    -You need DirecX 11 graphics card and windows 7.

    -I don't sure directx 11 works in unity free or not because i'am a pirate! MWA-HA-HA-HA!!..

    -I can just learn you to work with compute shaders. It will be hard for me to write it alone... I'am too lonely... You can write it at your own. It is not so hard, just need to understand how to work with multithreading.

     

    Edited 3 times by HungryDoodles. Last: 28th May 2014
  • boxmein
    28th May 2014 Former Staff 0 Permalink
    Well you'll have a ton of issues with that: you can't really compute in parallel if every particle depends on the ones near to it or before it... Perhaps this is not an issue in Powder Toy but we're not sure. Besides, look at the amount of data an element has to have access to to properly operate. Pushing all that back and forth into the graphics card and back might not speed things up...
  • h4zardz1
    29th May 2014 Member 0 Permalink
    ...i think russian commas are like the english...
  • zBuilder
    29th May 2014 Member 0 Permalink

    if particles are handled the way they are now, it will be hard to compute them with a GPU.

    also the specs listed for graphics are not garunteed to be the same on every graphics card. using the speed of a particular card as a feature isn't too helpful as there's a lot of variation and trying to promise the speed of one graphics card as if they all were like that can be disapointing for users lured by that only to ealize it's system dependant. (that would be like saying "the loading time is only 2 seconds!" but the time being measured on a performance ssd,as apposed to saying "on xyz SSD the load time is only 2 seconds!")

  • mniip
    29th May 2014 Developer 1 Permalink
    @h4zardz1 (View Post)
    From my experience, commas are almost entirely optional in english, unlike russian.

    @HungryDoodles (View Post)
    1) Not everyone has a graphics card
    2) Not everyone has a graphics card that can do integral math that is needed for particle updates
    3) Almost every particle depends on its surroudings, and you want to remove the last bit of defined behavior - update order.
    4) Pushing an pulling 50 megabytes per frame isn't an option.
    5) Almost all gpu drivers are proprietary, and since TPT would depend on them, that makes TPT
    contrib
    and not
    free

    EDIT: 6) A lot of people don't have directx11 because it is proprietary, and a Windows-only software.
    Edited once by mniip. Last: 29th May 2014
  • Dibill
    29th May 2014 Member 0 Permalink

    @mniip (View Post)

     I have a GeForce GT610 :P

  • jenn4
    29th May 2014 Member 0 Permalink
    @Dibill (View Post)
    Which is related to the topic by... ?
  • HungryDoodles
    29th May 2014 Member 0 Permalink

    zBuilder:

    if particles are handled the way they are now, it will be hard to compute them with a GPU.

     

    boxmein:

    Well you'll have a ton of issues with that: you can't really compute in parallel if every particle depends on the ones near to it or before it...
     

    Phh... when that's was a problem!? In the first pass we calculatilng some numbers and only in second pass we move particles! I know that issue.

    The people, that don't have a graphics card, has awful CPU (mostly), so their FPS in game will be about 3-5 when nothing happens.

    50 megabytes per frame is more than enougth to dispatch kernels in GPU (Update frame, prepass or put particle  and t.c.), we no need in controling particle field by CPU, let's just give it to GPU itself!

    And GeForce GT610 maybe is not so powerful, but it will work like CPU for $150 (probably), when GT610 cost only $40 (in Russia, in other countries everything usualy costs 20-30% lesser. iPad 2 in it's "year of glory" on eBay was priced for 500$, when in Russia it was $1000).

    Some numbers: my old graphics card (ATI/AMD Radeon HD 5750 iCooler IV) can do 50 000 000 sin/cos operations in 3 ms!

    About windows-only: yes, works only under windows, but there is no way to speed it up! I thought about CUDA, but it nVidia-only graphics cards.

    But: DirectX11 in Unity3d works fine exept in free version, no need to buy it. But RenderTexture (rendering image on texture, then on a plane) in free version will not work... So maybe i need to put final image directly on the screen, sadly i don't know how to do it.

    Edited 4 times by HungryDoodles. Last: 29th May 2014
  • mniip
    29th May 2014 Developer 2 Permalink
    @HungryDoodles (View Post)
    Sines and consines are barely ever used in TPT. As I've already stated, TPT performs mostly integer math.
    Semaphoring updates from movement does not solve the issue of the update order.
    And once again, we will never ditch portability for speed.

    EDIT: In case you were confused, when I said "free" I meant free as in speech, open source.
    Edited once by mniip. Last: 29th May 2014
  • HungryDoodles
    30th May 2014 Member 0 Permalink

    Ofcourse it will be open source.