Search Unity

Creating octtree on GPU

Discussion in 'Shaders' started by neginfinity, Dec 9, 2016.

Thread Status:
Not open for further replies.
  1. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,566
    Has anyone here tried to build an Octtree in a shader?

    Basically this requires syncrhonization and a simple attempt to implement a per-node mutex using InterlockedAdd or InterlockedCompareExchange causes shader to lock up and get killed by driver.

    Online sources seem to suggest using Morton codes and sorting them. Been wondering if this can be done without a sorting phase.
     
  2. Tangerinejuice

    Tangerinejuice

    Joined:
    Apr 23, 2020
    Posts:
    10
    Did you build an octree in shader?
    I am trying to build tree in shader and fail. When InterlockedCompareExchange is used, data read from RWBuffer are all 0. I wonder if InterlockedCompareExchange in unity is working properly.
     
  3. Tangerinejuice

    Tangerinejuice

    Joined:
    Apr 23, 2020
    Posts:
    10
    Never mind, InterlockedCompareExchange works.
     
  4. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,454
    Please don't necro threads like this. Create your own threads and ask a question please.
     
Thread Status:
Not open for further replies.