Added: 1 year ago
From: psonice
Views: 384
Sort by time | Sort by thread (beta)

Link to this comment:

Share to:

All Comments (3)

Sign In or Sign Up now to post a comment!
  • I think it was just a bunch of ifs. It was something like the distance functions all return a vec2 (distance, material), and the scene function just compares on distance. Then when the ray hits a surface, it uses a separate scene function with all the if()s to find the object it hit, and then gets the material/does relevant lighting, colour etc. At least this way the nasty if() nest is only hit once per pixel.

    There's probably a bunch of stuff on this in the 'raymarching toolbox' at pouet.net.

  • @psonice Thanks for the info , yup that's how I've done it now. I have a separate SceneColor(vec3 P) func for colours - which u can crazy colour fx with (ghosting, marble e.t..c). Shame u can't min/max a vec on only one of it's components - would be awesome then :)

  • Awesome stuff dood - how did you encode the colours? are u using a set of "if"s in your scene func or have you worked out a way to directly encode the colour into the distance? I tried this - finaldist=(dist*1024)-(frac(di­st*1024))+Material; - But I think the GPU floats normalize badly :(

Loading...
Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more