POV-Ray : Newsgroups : povray.advanced-users : Speeding up (or faking) scattering media : Speeding up (or faking) scattering media Server Time
20 May 2024 07:09:35 EDT (-0400)
  Speeding up (or faking) scattering media  
From: Juergen
Date: 19 Jun 2023 17:40:00
Message: <web.6490ca4b9e00c62a74554476df9b2273@news.povray.org>
HelloI would like to extend my scene with the fake caustic to see the light rays
under water. With a scattered media this works, but the computation time
increases indisputably from 0.5 to almost 70s per frame (should become an
animation later).
In the concrete scene the samples have to be at least 50,100 for this to look
usable - so I can't turn the screw anymore.
What possibilities are there to speed up the process (I think that the
calculation time/image should not be more than double or triple, but not by a
factor of 100)?
Is there a way to fake this (similar to what I did with the caustics), but for
the scattering media I have no idea at the moment.


---------------------the scene----------------
// Testscene mit einer gefakten Caustik,
// indem eine helle light_source mit einer Kugel und entspr teiltransparenten
Textur umgeben wird
// Renderzeit: 1sek
#version 3.7;
global_settings {
  assumed_gamma 1.0
}

#declare InclMedia = 1;

#declare CausAdd    = 0.0;
#declare ScatterCol = 0.0004;

#include "colors.inc"
#include "textures.inc"

#declare PSize = 300;

//////// Caustics-Texture START /////////
#declare TxtS4b =
texture {  // "DunkelTextur"
  pigment { rgbf <1.0, 1.0, 1.0, 1*CausAdd> }
}
#declare TxtS4a1 =
texture { // "Helltextur"
  pigment { color rgbf <1.0, 1.0, 1.0, 1.0> }
  finish { diffuse 0.5 ambient 1 }
}
#declare TxtS4a2 =
texture {
  pigment { color rgbf <1.0, 1.0, 1.0, 0.2+0.8*CausAdd> }
}
#declare TxtS4c =

  bozo
  scale 1.5
  translate <752,74,62343>
  texture_map {
    [ 0.25 pigment { rgbf <1.0,1.0,1.0,0.0+CausAdd> } ]
    [ 0.5  pigment { rgbf <1.0,1.0,1.0,0.1+0.9*CausAdd> } ]
    [ 0.75 pigment { rgbf <1.0,1.0,1.0,0.0+CausAdd> } ]
  }
  //pigment { color rgbf <0.6, 0.6, 1.0, 1.0> }
}
#declare TxtS4a =
texture {  // 1. Layer mit Bozo (Hell-Dunke-Effekte innerbalb der Textur)
  bozo
  scale 0.5
  translate <1223,455,121>
  texture_map {
    [ 0.15 TxtS4b ]
    [ 0.4  TxtS4a2 ]
    [ 0.5  TxtS4a1 ]
    [ 0.6  TxtS4a2 ]
    [ 0.85 TxtS4b ]
  }
}
#declare CausticsTxt =
texture { // die eigentliche Caustic-Textur
  crackle
  turbulence 0.25
  omega 0
  scale 5
  texture_map {
    [ 0.0 TxtS4a ]
    [ 0.12 TxtS4c ]
    [ 0.5 TxtS4b ]
  }
  scale 0.075
}
//////// Caustics-Texture ENDE /////////


// Boden
difference {
  plane { y,0 }
  box { <-PSize,-250,-PSize><PSize,1,PSize> } // Pool

  pigment { Gray50 }
  //pigment { bozo scale 30}
}


//#declare adsasdas =
#ifdef(InclMedia)
  box { <-PSize,-250,-PSize><PSize,-50,PSize>
    pigment { rgbt 1 } // clear
    hollow
    interior{
      media{
        scattering{ 1, ScatterCol extinction 0.01 }
        //scattering{ 1, 0.17 extinction 0.01}
        samples 50, 100 // min, max
      } // end media
    } // end interior
  }
#end


// #declare adadas =
cylinder {
  <-25,0,0><25,0,0> 10
  pigment { Red }
  translate <100,-200,-50>
}
cylinder {
  <0,-300,0><0,100,0> 50
  pigment { Blue }
  translate <120,-200,70>
}
sphere {
  0,20
  pigment { Yellow }
  translate <120,-200,-150>
}


// Sonne
light_source {
  <-50,200, 0>
  color 5
}

// Caustics-sphere
#declare CausticsSpr =
sphere {
  0,10
  texture {
    CausticsTxt
    translate <clock*0.02  ,clock*0.1,  -clock*0.005>
  }
}

object {
  CausticsSpr
  translate <-50,200,0>
}


#declare Cam =
camera {
  location 0
  direction <0.0, 0.0, 1>
  up <0.0, 1.0, 0.0>
  right <4/3, 0.0, 0.0>
  look_at <0,0,1>
}
camera {
  Cam
  rotate 30*x
  rotate 30*y
  translate -70*y
  translate -PSize*z+10
}


Post a reply to this message


Attachments:
Download 'lightsource2m1.jpg' (113 KB)

Preview of image 'lightsource2m1.jpg'
lightsource2m1.jpg


 

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.