pouët.net

Go to bottom

Problem with RayMarching using DistanceFunctions when applying Twist-Distortion.

category: general [glöplog]
6-18fps on gf285 =/
BB Image
added on the 2009-09-19 17:40:32 by xortdsc xortdsc
Ooh milky!
added on the 2009-09-19 21:44:06 by doomdoom doomdoom
so, do i get this lipschitz thing right, that if it is 1 (or less) for the applied function i dont need to shorten the step-distance ? genereally speaking, i divide the step-distance by the lipschitz-constant ?
added on the 2009-09-20 01:31:38 by xortdsc xortdsc
Quote:
casting shadow-rays seems to be especially slow since all the rays start very close to the surface. is there a cool trick to speed that up someone would be willing to share ? or maybe just a hint ? :)


Why don't you start the ray from the light instead of from the surface and traverse it backwards?
added on the 2009-09-20 02:02:27 by texel texel
Also, read the the Iq notes on the fake AO...
added on the 2009-09-20 02:03:58 by texel texel
Also, probably you can try this:

If you pass near an object by some distance, and then you get that distance bigger (you don't hit the object), if the distance is lower than some value, you might use it to do soft-shadows at a very low cost.

I suppose it is not that easy, and that you should calc it for all the ray traverse and that some distance to light and distance to surface should be take into account, but I think it is worth to try... Have any of you tried this? IQ?
added on the 2009-09-20 02:18:36 by texel texel
I thought about it (although I've never done ray marching with distance functions). But I imagine it's very tricky. What you want is to sum up rays from the surface point you're shading to all points on an area light source. Picture a cone with its tip at the surface point and the base covering the light source. So the ray you'd be tracing is through the middle of the cone, from the tip to the centre of the base.

You could probably do sort of a binary search to find points in the geometry that lie within the cone (thus obscuring part of the light source), but simply finding the closest of those points doesn't tell you how much of the light source is obscured. Consider that a very small particle halfway between the light source and the surface point you're shading wouldn't affect the shading of that point much, regardless of the particle's distance to the ray.

I guess maybe you could trace multiple rays with some kind of divide-and-conquer technique.
added on the 2009-09-20 03:09:48 by doomdoom doomdoom
doom, there are technics to get soft shadows (or look-alike) from a single ray, and they run realtime with distance fields now.. (it's like extracting the minimum angle cone you can cast in a direction.. quite simple).
added on the 2009-09-20 09:02:12 by nystep nystep
How does that work?
added on the 2009-09-20 10:53:55 by doomdoom doomdoom
nicestep, did you mean ambient occlusion rather than softshadows ?
added on the 2009-09-20 11:23:07 by Wiz Wiz
i meant soft shadows... why do you ask? and how it works is explained between parenthesis..
added on the 2009-09-20 11:49:55 by nystep nystep
I don't understand how casting a lot more rays for each pixel in order to determine the minimum angle could be realtime.
Or am I wrong ? I never tried, because I tough it would be too much expensive.
added on the 2009-09-20 12:13:43 by Wiz Wiz
I said it is from a single ray.. wait i can do a test for you if you want to know how it looks like..
added on the 2009-09-20 12:17:35 by nystep nystep
Hm. Isn't the problem sort of this:

BB Image

In situation A, the point is fully exposed to the light source. I bet you could identify it by finding the minimum distance to the cone (using some skewed distance metric).

In situation B there's an object inside the cone. But if all you do is determine the angle of the cone based on the shadow-casting object's distance to the ray, you would evaluate the exposure to be much too low.

Even worse, as indicated by C, you can't distinguish between a small object blocking only the centre of the cone (which should still let plenty of light past), and a larger object blocking the entire cone.
added on the 2009-09-20 12:43:56 by doomdoom doomdoom
true but if you have ANY better idea that runs *realtime*, really feel FREE to share with us... i think this effect is good enough visually.
added on the 2009-09-20 13:57:44 by nystep nystep
Quote:
Why don't you start the ray from the light instead of from the surface and traverse it backwards?

well, since i offset the shadow-ray-origin from the intersection-point by the "hit-epsilon" along the intersection-normal, the direction shouldn't make any difference, i think. do i miss something here ?
added on the 2009-09-20 23:46:47 by xortdsc xortdsc
just that you could hit sth earlier/faster if you travel beginning at the light !
depends on where your light and your objects are tho, so trying both for every scene is always worth a comparison !
true.

btw: if someone wanna see some progress in dynamic form:
http://www.youtube.com/watch?v=Al0QrHY6rpc

:)
added on the 2009-09-21 02:43:11 by xortdsc xortdsc
xortdsc, if you try that thing, could you tell us if it works? Thanks :)
added on the 2009-09-21 02:45:55 by texel texel
having a table of distances_to_objekts as hyde suggested would be very helpful to know which way is closer/faster !
just one small pre_sort ;)
length() comes to mind...i´m still pretty new to this technIQue as to coding_PCs_at_all,
but what i know so far is that the way i did it before was way faster in compiling_shader-times !
one last thing before i stop poueting for today:

dunno, which cluster you work on, but for average_peoples_PC it wont work out anyway with 2 light-sources and all that fancy stuff !
i know, getting the mirrored_colour of a cube_texture is on_the_fly so to say, but even this isnt designed for average PCs, i guess you agree on this !

so lemme ask: what is this for ? TV-advertisement ? saying: COMMERCIALS:NOW !!?
or wtf are you trying to do there ?
this is no flame,i´m even helping, just curious...maybe some diploma-work ?
average PCs equals 4ks ( no such a cubemap in 4ks ;) )
texel: yes, i'll tell, but first i wanted to try some other optimizations. i thought of having 2 distance-functions. one which is direction-dependent (whenever possible) for normal ray-casting and which is not for the ambient-occlusion stuff.

m0sh-r00m: i don't really get what "average pc" and "4k" have in common. i'm not planning on making it in 4k, so i guess looking up a cubemap is okay, at least for now ;)
it's not for tv or diploma either, it's rather just for fun. i heard of this stuff a few days ago and just wanted to see how far i can go with it. i pretty much didn't do any 3d-gfx for 7 years by now, because i got bored of it, but that made me start again. :)
added on the 2009-09-21 11:00:45 by xortdsc xortdsc
xortdsc, if you are not going to do a size limited thing, why don't you try with a precalc?

You know: fit the scene into a grid... let say 32x32x32 grid or something like that. precalc the minimum distance to object inside these cells, and use it for rendering until you need to use the distance funtion. This is probably a very good way to speed up rendering a lot... By the non very related tests I did with the scenes from IQ, it looks that spatial coherence could make 2x to 4x speed up depending on the level of detail you want (if your epsilon is too little, it will not speed up too much).

It would be fun to try wich grid size make it faster and that. Well, maybe if your function is not complex enough, it doesn't deserve the precalc... well, who knows... but if you try, tell us your results.

By other hand xortdsc, it looks that your account is new at pouet. Are you demoscener or just graphic coding hobbist (but not demoscener) and where are you from? It looks like if you know how to code. What you are doing is great.

If you ask, I'm from Spain, I've love graphic coding during the most of my life (I suppose I started playing with it about 20 years ago) and I don't have any interesting demoscene prod that I've coded... nothing worth to watch, but I use to have some coding fun and then I publish it at my blog.
added on the 2009-09-21 17:19:58 by texel texel
texel: thanks for the kind words. yes, i'm new to this forum and i'm just a graphic coding hobbist. i code for more than 15 years now starting at the age of 11 or so and have done plenty of 3d-stuff in the past because i wanted to make games. then i was cured from making games after i worked on farcry for over 2 years and learning new pixelshaders every week pissed me off, so i stopped 3d-shader-coding some years ago. ;)
now usually i'm more into cybernetics of all kinds (mostly physics- and ai-related) using cuda.
coding is still my profession, but not gfx-related anymore (working at native-instruments). i'm from (and still live in) berlin, germany.
i've been just a fan of the demoscene for a long time without releasing anything myself...

to the grid thing: i though of exactly this, just in a hierarchical manner. something like an octtree or so. then again, the tree-traversal might not be such a great idea with cuda, but i may give it a try. i havn't thought of it in detail, tho. i hope i can up with something...
also i wanna try that soft-shadowing, nicestep suggested. sounds like it could look nice, even tho in some (prolly rare) cases it will be completly wrong ;)
added on the 2009-09-21 17:49:04 by xortdsc xortdsc

login

Go to top