pouët.net

Go to bottom

Raymarching Beginners' Thread

category: code [glöplog]
[ur]http://www.dasprinzip.com/prinzipiell/2011/06/15/fog-me-fog-you/[/url]
Once again I am happy to find some of my code without any kind of reference or credits! :)
FOG YOU TOO... What the hell possed him?
added on the 2011-06-21 01:05:20 by las las
Fog him indeed. Btw, being pirated is a sign of success, it should make you happy at the same time as making you mad :D
added on the 2011-06-21 02:17:06 by psonice psonice
@las: Indeed! I recognised that shape of yours...
added on the 2011-06-21 02:18:25 by mrdoob mrdoob
Now.. could it be that Frank Reitberger is a lurker, or did he really came up with the same algorithm applied on the same shape with a very similar color scheme?

"the logical next step for me was to implement some noise for my WebGL stuff and add it to my raymarchers. However, my evil plan was to use this noise for generating smoke-like behaviours and what should I say - I think it worked pretty good…"

Thats kind of messed up for Frank if he is a poser...
added on the 2011-06-21 03:39:04 by T21 T21
las, i have find shaders of mine and formulas for plane deformations copied (up to the constants, spacing and semicolons) all over the internet, from blogs to "experiments" and even tools/software, without mention not to their source. Not that I mind, but at least, if you are just copying, at least do not publish/blog a tutorial as if it was your big discovery. Do not be surprised if for every new tutorial/demo a demoscener publishes, there is one replica in Chrome Experiments under a different author name (and perhaps with a web-code-color schema), or a js version of it. That's how it is. Yay the internets!!!
added on the 2011-06-21 05:27:03 by iq iq
I'm just wondering las, because he actually credited you and this thread in his article:

Quote:

(by strictly implementing Las´s sources & instructions from the ‘Raymarching Beginners‘ Thread which I recommended you reading a dozen times the last blogposts).


..so why bitching?
or is it a recent modification from his blog entry?

anyway, yes, when you post information on the net, it can be copied by anyone. even by people that you don't like, or know. if you don't want to be copied, then the best is maybe to not share information/sources in the first place. :)

but from ripping entirely something that you did and using a different name and bitching around that someone used your noise function, there are limits too...

On my side i've always considered that being copied is a sign of success. I'd find it personally very flattering to be copied. :)
added on the 2011-06-21 07:38:43 by nystep nystep
flattering, i think i'm doing frenglish here, i mean gratifying of course. :}
added on the 2011-06-21 07:40:31 by nystep nystep
ey guys,

already wearing sackcloth and ashes for not saying it right out in my post @dasprinzip. it shouldn´t sound like inventing 'fog' - but as always rely on that great thread like my posts before...

especially @las: Edited in the credits & clarifications - missing anything, just say...
added on the 2011-06-21 08:58:44 by _pwd_ _pwd_
@las You can contact me at mewler7 at gmail dot com :)
added on the 2011-06-21 10:17:23 by Mewler Mewler
Quote:
I'm just wondering las, because he actually credited you and this thread in his article.. so why bitching?

That's due to the bitching ;)
Everything is fine now - now he even has a pouet account to participate here! :D

pwd: Thank you.
added on the 2011-06-21 13:07:11 by las las
Yep, not crediting the code like this = bitching. Getting an account here and joining in = everyone wins :)
added on the 2011-06-21 13:18:48 by psonice psonice
Dunno if it's entirely relevant here, but it answers my question before about where to read up on shader scheduling and such (particularly on powervr SGX chips, which aren't all that commonly used with raymarching ;)

Imagination released the SGX architecture guide, which explains in a bit more detail how their chippery works. Very useful if you're working on this hardware! http://www.imgtec.com/powervr/insider/powervr-sdk-docs.asp

Is there some "fairly generalised" documentation like this somewhere that would apply to modern ati + nvidia cards? It would be well worth reading.
added on the 2011-06-22 03:12:07 by psonice psonice
I'd love to see the day when powervr chips will be powerful enough for raymarching. :) Maybe i don't even have so long to wait even, who knows?

psonice, i've learned quite a lot about nvidia architecture in the cuda documents..

pwd, welcome! :)

added on the 2011-06-22 11:53:20 by nystep nystep
nystep - how about now?

Nvidia used to do a gpu programming guide, but now it's mostly focused on compute.
added on the 2011-06-22 13:18:55 by hornet hornet
hornet: that GPU guide looks promising, thanks!

Anyone tried raymarching on that shader toy app? Is performance anywhere near acceptable?
added on the 2011-06-22 15:00:43 by psonice psonice
I have no idea honnestly. But honnestly, if anyone would want to send me an ipad2 for free, i'd try ;)
added on the 2011-06-22 17:21:47 by nystep nystep
psonice: One of the examples are a raymarcher, so yes. It's slow as fuck on my Samsung Galaxy SII at least ;)
added on the 2011-06-22 17:23:07 by kusma kusma
nystep: i'll be running some of my stuff on it at some point, no time lately (writing an ipad2 app, so any time spent on the ipad tends to be working time :( )

kusma: sounds about right. It's amazing how far you can squeeze stuff down for these mobile GPUs though, so I reckon it's still worth a try.
added on the 2011-06-22 17:39:33 by psonice psonice
You guys should have a look at FXAA3
http://timothylottes.blogspot.com/
That one might be pretty useful to get rid of raymarching artifacts.

Hmm for the current test scene there's for some reason only a slight difference between just bilinear sampling and FXAA3 - maybe I am doing it wrong (anyways - both look far better than doing nothing).
added on the 2011-06-22 22:59:14 by las las
Hmm.. looks interesting. No time to read it thoroughly just now unfortunately, work to do :(

But, quickly skimming the source did get me thinking a bit. I think something I wrote during the last week could be used for a similar effect with a small tweak, and it should be plenty fast enough. I'll try it out tomorrow.
added on the 2011-06-23 00:28:16 by psonice psonice
Talking about reflections I came across this idea: http://forum.beyond3d.com/showthread.php?t=56095
Has anyone here tried something similar?
added on the 2011-06-23 05:09:02 by xernobyl xernobyl
WOW! Thanks las. That FXAA thing works great. Really easy to set up and well documented. Took me like 20 mins. Also, heres a bonus: FXAA nicely compressed up and ready to plug in for GL raymarchers, just add rgbl ;)

Code:"vec4 FxaaPixelShader(" "vec2 pos," "vec4 posPos," "sampler2D tex," "vec2 rcpFrame," "vec4 rcpFrameOpt " ") { " "float lumaN = textureLodOffset(tex, pos.xy, 0.0, ivec2(0, -1)).w;" "float lumaW = textureLodOffset(tex, pos.xy, 0.0, ivec2(-1, 0)).w;" "vec4 rgbyM = textureLod(tex, pos.xy, 0.0);" "float lumaE = textureLodOffset(tex, pos.xy, 0.0, ivec2( 1, 0)).w;" "float lumaS = textureLodOffset(tex, pos.xy, 0.0, ivec2( 0, 1)).w;" "float lumaM = rgbyM.w;" "float rangeMin = min(lumaM, min(min(lumaN, lumaW), min(lumaS, lumaE)));" "float rangeMax = max(lumaM, max(max(lumaN, lumaW), max(lumaS, lumaE)));" "float range = rangeMax - rangeMin;" "if(range < max((1.0/12.0), rangeMax * (1.0/6.0)))" //#if (FXAA_DISCARD == 1) // discard; //#else "return rgbyM;" // #endif "float lumaNW = textureLodOffset(tex, pos.xy, 0.0, ivec2(-1,-1)).w;" "float lumaNE = textureLodOffset(tex, pos.xy, 0.0, ivec2( 1,-1)).w;" "float lumaSW = textureLodOffset(tex, pos.xy, 0.0, ivec2(-1, 1)).w;" "float lumaSE = textureLodOffset(tex, pos.xy, 0.0, ivec2( 1, 1)).w;" "float lumaL = (lumaN + lumaW + lumaE + lumaS) * 0.25;" "float rangeL = abs(lumaL - lumaM);" "float blendL = clamp((rangeL / range) - (1.0/4.0), 0.0, 1.0) * (1.0/(1.0 - (1.0/4.0))); " "blendL = min((3.0/4.0), blendL);" "float edgeVert = " "abs(lumaNW + (-2.0 * lumaN) + lumaNE) +" "2.0 * abs(lumaW + (-2.0 * lumaM) + lumaE ) +" "abs(lumaSW + (-2.0 * lumaS) + lumaSE);" "float edgeHorz = " "abs(lumaNW + (-2.0 * lumaW) + lumaSW) +" "2.0 * abs(lumaN + (-2.0 * lumaM) + lumaS ) +" "abs(lumaNE + (-2.0 * lumaE) + lumaSE);" "bool horzSpan = edgeHorz >= edgeVert;" "float lengthSign = horzSpan ? -rcpFrame.y : -rcpFrame.x;" "if(!horzSpan) lumaN = lumaW;" "if(!horzSpan) lumaS = lumaE;" "float gradientN = abs(lumaN - lumaM);" "float gradientS = abs(lumaS - lumaM);" "lumaN = (lumaN + lumaM) * 0.5;" "lumaS = (lumaS + lumaM) * 0.5;" "bool pairN = gradientN >= gradientS;" "if(!pairN) lumaN = lumaS;" "if(!pairN) gradientN = gradientS;" "if(!pairN) lengthSign *= -1.0;" "vec2 posN;" "posN.x = pos.x + (horzSpan ? 0.0 : lengthSign * 0.5);" "posN.y = pos.y + (horzSpan ? lengthSign * 0.5 : 0.0);" "gradientN *= (1.0/4.0);" "vec2 posP = posN;" "vec2 offNP = horzSpan ? " "vec2(rcpFrame.x, 0.0) :" "vec2(0.0f, rcpFrame.y);" "float lumaEndN;" "float lumaEndP;" "bool doneN = false;" "bool doneP = false;" "posN += offNP * (-1.5);" "posP += offNP * ( 1.5);" "for(int i = 0; i < 6; i++) {" "lumaEndN = textureLod(tex, posN.xy, 0.0).w;" "lumaEndP = textureLod(tex, posP.xy, 0.0).w;" "bool doneN2 = abs(lumaEndN - lumaN) >= gradientN;" "bool doneP2 = abs(lumaEndP - lumaN) >= gradientN;" "if(doneN2 && !doneN) posN += offNP;" "if(doneP2 && !doneP) posP -= offNP;" "if(doneN2 && doneP2) break;" "doneN = doneN2;" "doneP = doneP2;" "if(!doneN) posN -= offNP * 2.0;" "if(!doneP) posP += offNP * 2.0; }" "float dstN = horzSpan ? pos.x - posN.x : pos.y - posN.y;" "float dstP = horzSpan ? posP.x - pos.x : posP.y - pos.y;" "bool directionN = dstN < dstP;" "lumaEndN = directionN ? lumaEndN : lumaEndP;" "if(((lumaM - lumaN) < 0.0) == ((lumaEndN - lumaN) < 0.0))" "lengthSign = 0.0;" "float spanLength = (dstP + dstN);" "dstN = directionN ? dstN : dstP;" "float subPixelOffset = 0.5 + (dstN * (-1.0/spanLength));" "subPixelOffset += blendL * (1.0/8.0);" "subPixelOffset *= lengthSign;" "vec3 rgbF = textureLod(tex, vec2(" "pos.x + (horzSpan ? 0.0 : subPixelOffset)," "pos.y + (horzSpan ? subPixelOffset : 0.0)), 0.0).xyz;" // #if (FXAA_LINEAR == 1) // lumaL *= lumaL; //#endif "float lumaF = dot(rgbF, vec3(0.299, 0.587, 0.114)) + (1.0/(65536.0*256.0));" "float lumaB = mix(lumaF, lumaL, blendL);" "float scale = min(4.0, lumaB/lumaF);" "rgbF *= scale;" "return vec4(rgbF, lumaM); " "}"
added on the 2011-06-23 08:39:00 by Mewler Mewler
Also, would Smash's stencil + flip trick be useful for FXAA as well?
added on the 2011-06-23 08:41:34 by Mewler Mewler
xernobyl: As said in the forum: Probably really good for water-like stuff.
added on the 2011-06-23 10:30:29 by raer raer

login

Go to top