|
|
I am fairly new to raytracing, although I did dabble in the days when it took a
week to render a sphere between two mirrors. I particularly wanted underwater
example images with the strong effect I wanted. Experimenting, I found that
enough photons to hopefully give a good effect quickly exhausted my RAM, while
few enough to be manageable gave no effect. Deciding that elephants need to be
eaten one bite at a time, I turned media interaction off on my main light, and
dimmed it so I could still see what was going on, and added a cylinder light
with media interaction (coming from behind in the picture). I was hoping to get
a single light beam with some caustics, to see if the effect was worth pursuing.
Not only did this work, but the other light (coming from the left in the
picture) magically started interacting with the media, and gave me just the
still needs 3Gb for the photons rendered at 512x384). How is this working? Is it
a bug (I am using V3.7), or am I missing something about how all this works?
Source:
// Persistence of Vision Ray Tracer Scene Description File
#version 3.7;
#include "colors.inc"
//Control
#declare Photons=on;
#declare Radiosity=on;
#declare Size=5;
//Global
global_settings {
assumed_gamma 1.0
max_trace_level 15
#if (Photons)
photons {
spacing 0.003
media 100
}
#end
#if(Radiosity)
radiosity {
pretrace_start 0.08
pretrace_end 0.01
count 150
nearest_count 10
error_bound 0.5
recursion_limit 3
low_error_factor 0.5
gray_threshold 0.0
minimum_reuse 0.005
maximum_reuse 0.2
brightness 1
adc_bailout 0.005
}
#end
}
//Declarations
#declare T_Pool = texture{
pigment { color rgb <0.9, 0.88, 0.85> }
finish {
#if(Radiosity)
phong 1
ambient 0.0
diffuse 0.6
specular 0.4
roughness 0.01
#else
ambient 0.07
#end
}
}
#declare M_Water = material {
texture {
pigment {
color rgbt <0.4,0.5,0.3, 0.9>
}
finish {
diffuse 0.3
ambient 0.0
reflection {
0.03, 1.0
fresnel on
}
conserve_energy
specular 0.4
roughness 0.003
}
}
interior {
ior 1.3
}
}
#declare fn_water_surface_pattern=
function {
pattern { bozo scale 0.025 }
}
//Camera
camera {
location <-2.0, -2.0, -0.25>
direction y
sky z
up z
right (4/3)*x
look_at <0.0, 0.0, -0.05>
angle 43
}
//Lights
light_source
{
<-8, 6.2, 4.5>, 0.3
media_interaction off
photons { reflection off }
}
light_source {
0*x
color rgb <1,1,1>
spotlight
cylinder
translate <-5, -5, 1>
point_at <-1, -1, 0>
radius 5
tightness 50
falloff 8
#if (Photons)
photons{
refraction on
reflection on
}
#end
}
//Object - water
height_field {
function 400, 400 { fn_water_surface_pattern(x, y, 0)*0.05 + 0.5 }
smooth
rotate -90*x
translate <-0.5,-0.5,0.4>
scale <5,5,1>
material {
M_Water
}
hollow on
#if (Photons)
photons{
target 1.0
refraction on
reflection on
}
#end
}
//Object - pool sides
difference {
box { < -(Size/2+0.2), -(Size/2+0.2),-1>, <(Size/2+0.2), (Size/2+0.2),0.05> }
box { < -(Size/2-0.1), -(Size/2-0.1),-0.99>, <(Size/2-0.1), (Size/2-0.1),0.2>
}
texture {T_Pool}
}
//Object - pillar
cylinder { -z, z*0.35, 0.2 translate <0.2, -0.2, 0>
texture {T_Pool}
}
//Object - pool floor
plane {
z, -1
texture {T_Pool}
hollow on
}
//Object - sky fog
fog{
fog_type 2
fog_alt 0.4
fog_offset 0.4
color rgbt <0.85,0.9,1.0, 0.0>
distance 300
up z
}
//Object - sky
sphere {
<0, 0, 0>, 1
texture {
pigment {
gradient z
color_map {
[0.0 color rgb < 0.680, 0.735, 0.976 >]
[0.2 color rgb < 0.350, 0.500, 0.950 >]
}
}
finish {
#if(Radiosity)
diffuse 1
ambient 0
#else
diffuse 0
ambient 1
#end
}
}
scale<1000, 1000, 200>
no_shadow
hollow on
}
//Object - ball
sphere {
<0,0,0>, 0.5
texture {
pigment {
radial color_map{[0.5 Red][0.5 Yellow]}
frequency 10
}
finish {
#if(Radiosity)
ambient 0.0 diffuse 1.0 phong 1
#else
phong 1 reflection{ 0.00 metallic 0.00}
#end
}
}
scale<.1,.1,.1> rotate<55,0,0> translate<-1.0,-1.0,-0.2>
}
//Object - media
box { < -(Size/2-0.1), -(Size/2-0.1),-0.99>, <(Size/2-0.1), (Size/2-0.1),0.2>
pigment { rgbt 1 }
hollow
interior{
media {
scattering { 1, 0.4 extinction 0.4 }
samples 30,100
}
}
photons { pass_through }
}
Post a reply to this message
Attachments:
Download 'underwater.png' (182 KB)
Preview of image 'underwater.png'
|
|