Oysi
|
  |
| Joined: 06 Jul 2009 |
| Total Posts: 9058 |
|
| |
|
stravant
|
  |
 |
| Joined: 22 Oct 2007 |
| Total Posts: 2893 |
|
|
| 16 Jul 2013 12:05 PM |
| As for why it's not possible: Shaders are run in parallel: Therefor they can't really be recursive, because during the recursion, two different instances of the shader may diverge significantly, and that makes running lots of them in parallel really hard. |
|
|
| Report Abuse |
|
|
Oysi
|
  |
| Joined: 06 Jul 2009 |
| Total Posts: 9058 |
|
| |
|
Tenal
|
  |
| Joined: 15 May 2011 |
| Total Posts: 18684 |
|
|
| 16 Jul 2013 04:05 PM |
| sup stravant long time no see |
|
|
| Report Abuse |
|
|
|
| 16 Jul 2013 04:14 PM |
| Try hard coding only, say, 3 levels of reflection? Would that be that bad? |
|
|
| Report Abuse |
|
|
Oysi
|
  |
| Joined: 06 Jul 2009 |
| Total Posts: 9058 |
|
| |
|
Oysi
|
  |
| Joined: 06 Jul 2009 |
| Total Posts: 9058 |
|
| |
|
|
| 17 Jul 2013 05:40 AM |
I dont think you can loop a variable amount of times.
You either should loop a fixed amount of times and ignore the results of excess iterations, or use multiple passes somehow (lets say tile the screen so some areas of the screen loop more times, so you dont waste time on rendering sky) |
|
|
| Report Abuse |
|
|
Oysi
|
  |
| Joined: 06 Jul 2009 |
| Total Posts: 9058 |
|
| |
|
Aerideyn
|
  |
| Joined: 16 Jan 2010 |
| Total Posts: 1882 |
|
|
| 17 Jul 2013 06:42 PM |
Loops are fine, (for,while and what not) but even then the shader unrolls it into 1 big command so it that case it's effectively just syntactic sugar. But you can't unroll recursion because you can't really know how deep it will go at compile time.
So by just copying and pasting it you are just doing what the compiler does anyway if it knew how, shaders require thinking a little differently sometimes - perhaps you can refactor it in a way in where you don't need recursion at all? |
|
|
| Report Abuse |
|
|
|
| 17 Jul 2013 08:01 PM |
| Have you got dem fresnels going too? :) |
|
|
| Report Abuse |
|
|