To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.cad.rayOpen lugnet.cad.ray in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 CAD / Ray-Tracing / 1585
1584  |  1586
Subject: 
Excellent rendering with MegaPov 0.7 (long post)
Newsgroups: 
lugnet.cad.ray
Date: 
Sun, 29 Dec 2002 19:47:48 GMT
Viewed: 
764 times
  
Hi all,

Since the code for photorealistic pictures where released (see
http://news.lugnet.com/cad/ray/?n=1398) a lot of people have been
experimenting with it. Allister McLaren for instance added light (see:
http://news.lugnet.com/cad/dev/org/ldraw/?n=2218) which not only looks
better but also removes some radiosity artifacts (more on that later).

I thought that these renderings only could be made with POV-Ray 3.5 but
that's not true! MegaPOV already had some of the options in it. Some have to
be changed and I will tell you how.

This is the a part from the original code:

#declare fin =
finish {
  ambient 0
  diffuse 1
  reflection {0.025,.7 falloff 4}
  brilliance 1.2
}

Now, the reflection part is intresting becase it has 3 paramerters, 2 for
reflection (minimum and maximum) and falloff. This is a variable angle
reflection, where the min-max parameter will change the reflection along
with the angle a object is in. The best way to see this is to apply this to
a sphere. The part of the sphere  you look straight at will have less
reflection than the edges of the sphere.
In Mega-POV you have the option between 3 sorts of reflection: standard,
variable angle and fresnel. The code for variable angle in MegaPov is like this

reflection_type 0
reflection_min 0.25
reflection_max 0.7
reflection_falloff 4

So implementing that in the excellent rendering code (ERC):

#declare fin =
finish {
  ambient 0
  diffuse 1
  reflection_type 0
  reflection_min 0.25
  reflection_max 0.7
  reflection_falloff 4
  brilliance 1.2
}

The radiosity settings are the same, but (taken from the POV-Ray manual) I
changed it a bit:

#declare RAD = on;

#declare AMB = 0;
#declare DIF = 1;

global_settings {
  assumed_gamma 1.8
  ambient_light 0
  max_trace_level 25
  adc_bailout 1/150
  #if(RAD)
    radiosity {
    pretrace_start 0.08
    pretrace_end 0.01
    count 300
    error_bound 0.1
    recursion_limit 1
  }
  #end
}

The "#declare RAD = on;" is a switch: if you replace on with off, radiosity
is turned off, which is nice for test renderings. Here the count is one of
the most important parameter. The higher the count, the better the
rendering, but also much much slower. If you lower the number (for example
10) you'll get a lot of artifacts; weird stains that can't be explained as
shadows or reflection. There is a option to loose the artifacts without
extreme high count numbers and that is by adding a light.
See also: http://www.povray.org/documentation/view/106/

The ERC is radiosity without conventional lighting so you'll get the nice
soft shadows. But adding a light won't do no harm and can make the picture
even more intresting.
I would recommend a soft light, something like:

light_source {
    <x,y,z>  // Latitude,Longitude,Radius
    color rgb 0.5
}

Even better is a nice area_light which will give a nice soft edge to the
shadows further away.

When you add a light it's also a nice touch to add some highlighting to the
LDraw-parts. The fin-code will look like this:

#declare fin =
finish {
    ambient rgb <0, 0, 0>
    reflection_type 0
    reflection_min 0.25
    reflection_max 0.7
    reflection_falloff 4
    diffuse 1
    brilliance 1.2
    specular 1
}

By adding diffuse 1 round parts and studs will get a soft highlight.

If you readly want the most out of your picture (and CPU/FPU!) you can add
refection blur; reflection_blur is the amount of blur (LEGO has some but
very little) and reflection_samples determins the quality: the lower the
samples the more grainy the blur.  Mind you this means extra calculations so
will slow down the rendering.
Here is the complete code I use now. It can also be used with the LGEO parts
(note that not all slope colors are made but they are fairly easy to do your
self). Paste it between ... and ...

// start Excellent Render Code
version unofficial MegaPov 0.7;
#declare RAD = on;

#declare AMB = 0;
#declare DIF = 1;
global_settings {
  assumed_gamma 1.8
  ambient_light 0
  max_trace_level 25
  adc_bailout 1/150
  #if(RAD)
    radiosity {
    pretrace_start 0.08
    pretrace_end 0.01
    count 30
    error_bound 0.1
    recursion_limit 1
  }
  #end
}

#declare fin =
finish {
    ambient rgb 0
    reflection_type 0
    reflection_min 0.25
    reflection_max 0.7
    reflection_falloff 4
    reflection_blur 1/100
    reflection_samples 200
    diffuse 1
    brilliance 1.2
    specular 1.0
}

#declare Color0  = // Black
material {
  texture {
    pigment {rgb 0.1}
    finish {fin}
    #if (BUMPS) normal { BUMPNORMAL } #end
  }
}

#declare Color0_slope  = // Black
material {
  texture {
    pigment {rgb 0.01}
    finish {fin}
  normal { bumps 0.3 scale 25*0.02 }
  }
}

#declare Color1  = // Blue
material {
  texture {
    pigment {rgb <0.02,0.2,0.9>}
    finish {fin}
    #if (BUMPS) normal { BUMPNORMAL } #end
  }
}

#declare Color1_slope  = // Blue
material {
  texture {
    pigment {rgb <0.02,0.2,0.9>}
    finish {fin}
    normal { bumps 0.3 scale 25*0.02 }
  }
}

#declare Color2  = // Green
material {
  texture {
    pigment {rgb <0.025,0.5,0.075>}
    finish {fin}
    #if (BUMPS) normal { BUMPNORMAL } #end
  }
}

#declare Color2_slope  = // Green
material {
  texture {
    pigment {rgb <0.025,0.5,0.075>}
    finish {fin}
    normal { bumps 0.3 scale 25*0.02 }
  }
}

#declare Color3  = // Dark-Cyan
material {
  texture {
    pigment {rgb <0,0.5,0.5>}
    finish {fin}
    #if (BUMPS) normal { BUMPNORMAL } #end
  }
}

#declare Color4  = // Red
material {
  texture {
    pigment {rgb <0.9,0.05,0>}
    finish {fin}
    #if (BUMPS) normal { BUMPNORMAL } #end
  }
}

#declare Color5  = // Magenta
material {
  texture {
    pigment {rgb <1,0,0.9>}
    finish {fin}
    #if (BUMPS) normal { BUMPNORMAL } #end
  }
}

#declare Color6  = // Brown
material {
  texture {
    pigment {rgb <0.25,0.05,0>}
    finish {fin}
    #if (BUMPS) normal { BUMPNORMAL } #end
  }
}

#declare Color7  = // Light-Grey
material {
  texture {
    pigment {rgb <0.51,0.51,0.48>}
    finish {fin}
    #if (BUMPS) normal { BUMPNORMAL } #end
  }
}

#declare Color7_slope  = // Light-Grey
material {
  texture {
    pigment {rgb <0.51,0.51,0.48>}
    finish {fin}
    normal { bumps 0.3 scale 25*0.02 }
  }
}

#declare Color8  = // Dark-Grey
material {
  texture {
    pigment {rgb <0.175,0.19,0.15>}
    finish {fin}
    #if (BUMPS) normal { BUMPNORMAL } #end
  }
}

#declare Color9  = // Light-Blue
material {
  texture {
    pigment {rgb <0.45,0.55,0.975>}
    finish {fin}
    #if (BUMPS) normal { BUMPNORMAL } #end
  }
}

#declare Color10  = // Light-Green
material {
  texture {
    pigment {rgb <0.2,1,0.4>}
    finish {fin}
    #if (BUMPS) normal { BUMPNORMAL } #end
  }
}

#declare Color11  = // Cyan
material {
  texture {
    pigment {rgb <0,1,1>}
    finish {fin}
    #if (BUMPS) normal { BUMPNORMAL } #end
  }
}

#declare Color12  = // Light-Red
material {
  texture {
    pigment {rgb <1,0.4,0.4>}
    finish {fin}
    #if (BUMPS) normal { BUMPNORMAL } #end
  }
}

#declare Color13  = // Pink
material {
  texture {
    pigment {rgb <1,0.5,0.8>}
    finish {fin}
    #if (BUMPS) normal { BUMPNORMAL } #end
  }
}

#declare Color14  = // Yellow
material {
  texture {
    pigment {rgb <1,0.85,0>}
    finish {fin}
    #if (BUMPS) normal { BUMPNORMAL } #end
  }
}

#declare Color14_slope  = // Yellow
material {
  texture {
    pigment {rgb <1,0.85,0>}
    finish {fin}
    normal { bumps 0.3 scale 25*0.02 }
  }
}

#declare Color15  = // White
material {
  texture {
    pigment {rgb <0.975,0.975,0.90>}
    finish {fin}
    #if (BUMPS) normal { BUMPNORMAL } #end
  }
}

#declare Color15_slope  = // White
material {
  texture {
    pigment {rgb <0.975,0.975,0.90>}
    finish {fin}
    normal { bumps 0.3 scale 25*0.02 }
  }
}

#declare Color17  = // Pastel-Green
material {
  texture {
    pigment {rgb <0.4,1,0.6>}
    finish {fin}
    #if (BUMPS) normal { BUMPNORMAL } #end
  }
}

#declare Color18  = // Light-Yellow
material {
  texture {
    pigment {rgb <1,0.95,0.4>}
    finish {fin}
    #if (BUMPS) normal { BUMPNORMAL } #end
  }
}

#declare Color19  = // Tan
material {
  texture {
    pigment {rgb <0.8,0.6666,0.4>*1.2}
    finish {fin}
    #if (BUMPS) normal { BUMPNORMAL } #end
  }
}

#declare Color20 = // Light-Purple
material {
  texture {
    pigment {rgb <0.875,0.8,0.9375>*0.9}
    finish {fin}
    #if (BUMPS) normal { BUMPNORMAL } #end
  }
}

#declare Color21 = // Glow-In-The-Dark
material {
  texture {
    pigment {rgb <0.875,1,0.6875>*0.95}
    finish {fin}
    #if (BUMPS) normal { BUMPNORMAL } #end
  }
}

#declare Color22 = // Purple
material {
  texture {
    pigment {rgb <0.6,0,0.6>*0.8}
    finish {fin}
    #if (BUMPS) normal { BUMPNORMAL } #end
  }
}

#declare Color23 = // Purple-Blue
material {
  texture {
    pigment {rgb <0.298,0,0.8>*0.9}
    finish {fin}
    #if (BUMPS) normal { BUMPNORMAL } #end
  }
}

#declare Color25 = // Solid-Orange
material {
  texture {
    pigment {rgb <1,0.2,0>}
    finish {fin}
    #if (BUMPS) normal { BUMPNORMAL } #end
  }
}

#declare Color26 = // Dark-Pink
material {
  texture {
    pigment {rgb <1,0.2,0.6>*0.95}
    finish {fin}
    #if (BUMPS) normal { BUMPNORMAL } #end
  }
}

#declare Color27 = // Lime-Green
material {
  texture {
    pigment {rgb <0.8,1,0.1>*1}
    finish {fin}
    #if (BUMPS) normal { BUMPNORMAL } #end
  }
}

#declare Color28  = // Solid-Tan
material {
  texture {
    pigment {rgb <0.8,0.6666,0.4>*1.2}
    finish {fin}
    #if (BUMPS) normal { BUMPNORMAL } #end
  }
}

#declare Color256  = // Rubber
material {
  texture { pigment { color rgb 0.1 }
    finish {
    ambient 0.05
    diffuse 1
    brilliance 10
    phong 1
    phong_size 4
//    reflection {0.001,0.05 falloff 4}
    reflection_type 0
    reflection_min 0.001
    reflection_max 0.05
    reflection_falloff 4
    } normal { bumps 0.15 scale 0.25 }
    }
  }

#declare Color383 = // chrome
material {
  texture {
    pigment { rgb <0.9,0.9,0.9> }
    finish {
        ambient 0
        diffuse 0.6
            brilliance 5
            metallic
            specular 0.80
            roughness 1/100
//          reflection {0.65,0.9 falloff 4}
                reflection_type 0
    reflection_min 0.65
    reflection_max 0.9
    reflection_falloff 4
    }
    #if (BUMPS) normal { BUMPNORMAL } #end
        }
}


#declare Color399 = // Santa Fe color
material {
  texture {
   pigment {
        marble   turbulence 2
        color_map {
        [ 0.0 rgb 0.70 ]
        [ 0.95 rgb 0.65 ]
        }
        } scale 24
   finish {
   ambient 0.1
   diffuse 1
   specular 1
    reflection_type 0
    reflection_min 0.25
    reflection_max 0.7
    reflection_falloff 4
   brilliance 5
   // metallic
   }
}
}

#ifndef (Color511) // Old Technics milk white
#declare Color511 = #if (version >= 3.1) material { #end texture {
    pigment { rgbf <1,1,0.975, 1/4 > }
    finish { ambient AMB diffuse DIF }
    #if (QUAL > 1)
        finish { phong 0.5 phong_size 40 reflection 0.08 refraction 1 ior 1.25 }
        #if (BUMPS) normal { BUMPNORMAL } #end
    #end
} #if (version >= 3.1) } #end
#end

// ----------------------------------------


sky_sphere {
pigment {
gradient -y
color_map {
[0.5 rgb 1.25]
[1 rgb <.5,.7,1>*1.1]
}
}
}

object {
    plane { y, xxx hollow }  // change xxx to desired height
    pigment {checker color rgb 1 color rgb 0.2 scale 2 rotate <0,67.4584,0> }
    finish {
            ambient 0.2
            diffuse 1
                    brilliance 5
                    metallic
                    specular 0.80
                    roughness 1/100
    reflection_type 0
    reflection_min 0.2
    reflection_max 0.65
    reflection_falloff 4
        }

}
// End of Excellent Render Code

Happy (and fast) rendering with MegaPov!

Jeroen



Message has 3 Replies:
  Re: Excellent rendering with MegaPov 0.7 (long post)
 
Hej Jeroen, a BIG thanks to you for this extensive and clear post about how to get 'excelent rendering results' (ERR...) with MegaPov 0.7 but(yes), me is one of those lazy guys... so, how about a comparison between Povray3.5 and MegaPov 0.7 in both (...) (22 years ago, 30-Dec-02, to lugnet.cad.ray)
  Re: Excellent rendering with MegaPov 0.7 (long post)
 
Hi Jeroen - This looks great! I plugged it into MegaPOV and replaced my color definitions in a POV file with your code. MegaPOV is having a hard time understanding your statements: #if (BUMPS) normal { BUMPNORMAL } #end Any tips? Thanks!! -Tim (...) (22 years ago, 30-Dec-02, to lugnet.cad.ray)
  Re: Excellent rendering with MegaPov 0.7 (long post)
 
I've downloaded Megapov and plugged in the extra code but all I get is a black image. For that matter, I get a black image for every file I run that has MegaPov enabled. Am I doing something wrong? Any help would be appreciated. -Orion (22 years ago, 14-Jan-03, to lugnet.cad.ray)

7 Messages in This Thread:



Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR