//********************************************************************************** // This work is licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License. // To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/3.0/ or send a // letter to Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA. /********************************************************************************** Persistence of Vision Ray Tracer Scene Description File File name : NAP.pov Author : somehow based on T.D.G. but modified to make sense. Version : 3.7+ **********************************************************************************/ // Render settings (right-click on a line below) - Note: doesn't work with 3.7 // +w640 +h640 +am2 +a0.3 +bm2 +bs8 +wt7 // +w640 +h640 +am3 +a0.01 +ac0.90 +r3 +wt7 #version 3.7; // or 3.8; #declare Rad = on; // Radiosity switch global_settings { assumed_gamma 1.0 max_trace_level 5 //default [5] #if (Rad) radiosity { // pretrace_start 0.08 // start pretrace at this size // pretrace_end 0.004 // end pretrace at this size // NO! This is not a good way of defining the pretrace phase. // This gives results with less artefacts faster: pretrace_start 16/max(image_width,image_height) pretrace_end 4/max(image_width,image_height) // And for really high quality and/or radiosity only scenes: // pretrace_start 8/max(image_width,image_height) // pretrace_end 1/max(image_width,image_height) count 200, 1000 // higher -> higher quality (1..1600) [35] nearest_count 10, 5 // higher -> higher quality (1..10) [5] error_bound 0.3 // higher -> smoother, less accurate [1.8] recursion_limit 2 // how much interreflections are calculated (1..5+) [2] low_error_factor .3 // reduce error_bound during last pretrace step gray_threshold 0.0 // increase for weakening colors (0..1) [0] minimum_reuse 0.015 // reuse of old radiosity samples [0.015] maximum_reuse 0.1 // new parameter 3.7 [0.2] brightness 1 // brightness of radiosity effects (0..1) [1] adc_bailout 0.01/2 normal on // take surface normals into account [off] media off // take media into account [off] always_sample off // turn sampling in final trace off [on] //max_sample 1.0 // maximum brightness of samples } #end //noise_generator 2 } #default { finish {ambient 0.2} } //======================================================================= //======================================================================= // // The "control center" within the scene file. // Use it *before* you actually include the file. // //======================================================================= //======================================================================= #declare G21_Specular_strength = 0.5; // Note: this 0.5 value is just my personal preference and taste becauce // people in the old times did have a tendency to overuse these faked // specular highlights way too much making everything look like plastic. // #include granites21.inc //======================================================================= //[snip here] // // This would be your granite include file. // // some include file header here... //======================================================================= //======================================================================= // Global settings that can be adjusted by the user. //======================================================================= // G_global_scale // // This defines the scaling the textures was originally designed for. // It is always rescaled to match 1 POV-unit equals 1 cm //======================================================================= #ifndef (G21_global_scale) #declare G21_global_scale = 1/2.54; // My gut feeling tells me that these textures are // designed for inches. // // When used for converting other old include files // this default value should be changed accordingly. // e,g. #declare G21_global_scale = 0.1; when // it was designed for 1 POV-Unit equals 10cm. #end // ********************************************************************** // NOTE !!! // // You should always but your best guess here depending on the originals // author intention. // Making it public has the only purpose to allow the user do define his // scene where e.g. 1 POV-unit equals 1 m and scale the materials for // this usage. // ********************************************************************** //======================================================================= // Global adjustment for specular and reflection values // // This allows for adjustment of the finishes depending on the scene and // lighting condition it is actually used for and makes e.g. radiosity // only scenes possible. //======================================================================= #ifndef (G21_Reflection_strength) #declare G21_Reflection_strength = 0.15; #end #ifndef (G21_Specular_strength) #declare G21_Specular_strength = 0.75; #end //======================================================================= // Global adjustment for fresnel ior // // This allows for adjustment of the fresnel reflections ior value. // As this specular reflection is usually the effect of some top coating // for any non-dielectric and non-metallic material the default value of // 1.52 should usually stay untouched. //======================================================================= #ifndef (G21_Fresnel_ior) #declare G21_Fresnel_ior = 1.52; #end //======================================================================= // Local settings. //======================================================================= // Deprecated_assumed_gamma // // This defines the global_settings{assumed_gamma} the texture was // *originally* designed for. // Early Mac and Amiga users did usually have a value of 1.8 but e.g. // Gilles Trans did also use 1.4 quite often. // // But in most cases this value should be 2.2 and if unsure this 2.2 // value should also be used. // // But in this case my gut feelings really tells me that the original // author did use an assumed_gamma value of 1.8. // //======================================================================= #ifndef (Deprecated_assumed_gamma) #local Deprecated_assumed_gamma = 1.8; #end // copy into local vars (mostly to avoid too much typing) #local G = Deprecated_assumed_gamma; #local Gft = 1.0; /* filter and transmit should /per definition/ always be linear. But as I don't know how - lets say POV-Ray version 2.2 - did work internally I made it a variable, just in case. Someone with more energy and interest in this matter might investigate! */ //======================================================================= // a set of gamma transfer functions //======================================================================= #macro G_rgb(C) color rgb #end #macro G_rgbf(C) color rgbf #end #macro G_rgbt(C) color rgbt #end #macro G_rgbft(C) color rgbft #end #macro CMap_Gamma() #if (version >= 3.8) // ********************************************************************** // IMPORTANT NOTES !!! // // As I have no 3.8 alpha version installed I do not know if Christoph // did implement this correctly but I know that he was aware of the // issue with color_maps and I have some confidence that he knew what // he was doing. // In case I do remember the keywords wrong (i.e. blend_mode, blend_gamma) // and it gives a parse error you should ask someone who can read the // sourcecode or maybe it is already mentioned in the wiki. // // ********************************************************************** blend_mode 3 blend_gamma G #else // ********************************************************************** // IMPORTANT NOTES !!! // // Using poly_wave is only a proper solution for color maps that run the // full range (e.g. color_map {[0 rgb <0.1, 0.2, 0.3>] [1 rgb <0.3, 0.2, 0.1>]} // for any values in between it is just a poor aproximation - but still better // than nothing. // There is a way to do it accurately by expanding every color map to lets say // 128 entries and calculating the exact value for each entry seperatly. // But I really do suggest that this is only done by someone who fully // understands why and how this is done. // And sorry, but I will not do it as I did already spend way too much time // in supporting a program that I rarely use myself. // // A different issue regarding poly_wave and "blend_gamma" is the value // used for it. I do use the Deprecated_assumed_gamma value and this makes // sense but there are other considerations possible. // The issue with the blending of colors is the non linear human perception // that is close to a x^3 function and as it happens old include files are // certainly written by people who used CRT monitors and those had also a // response curve close to the power of 3 - and not 2.2 as many people seem // to assume. // Also the CIE used a power of 3 function in its definition for L*a*b // which is meant to be close to human vision. // // So maybe using a constant value of 3 for both blend_gamma and poly_wave // might be worth investigating. // // ********************************************************************** poly_wave G #end #end //======================================================================= // Replacement texture for the obsolete crand in the finish block //======================================================================= #macro Crand(Intensity) texture { pigment { granite color_map { [1/3 rgb 0.001 transmit 1] [2/3 rgb 0.001 transmit max(0,1-Intensity) ] } scale 0.05/G21_global_scale } } #end // ********************************************************************** // NOTE !!! // // Using crand in the finish is a bad idea (I will not explain why at this // point this should be common knowledge) BUT many old textures heavily // rely on crand and without it they look dull and uninteresting. // This is my proposal for a replacement with a usage example below where // M_NAPFro is declared. // The value for intensity should be the same as the original author used // as his crand value. // ********************************************************************** //======================================================================= // Additional dull highlights for rough materials //======================================================================= #macro Dull_Highlights() specular 0.05 roughness 0.1 #end // ********************************************************************** // NOTE !!! // // Even if the original author did not use phong or specular adding a small // amount of *rough* highlights is // a) adding some visual realism // b) physical correct // c) not harming the authors original intensions // // usage example below at F_NAPFro // ********************************************************************** //------------------------------------------------------------------------ // North American Pink granite - polished surface // // Original Author: Daniel Meklenburg Jr (aka Code Warrior) // // Rewritten and modernized for the use with POV-Ray 3.7 and above - but // in the spirit of keeping the visual appearance the original author had // in mind. // // keep things local to prevent namespase waste #local F_NAPPol = finish { diffuse albedo 0.6 phong 0.9*G21_Specular_strength phong_size 80 #if (version >= 3.8) fresnel // NOTE!!! if this gives a parse error then I remember it wrong // and this #if expression should be removed - or modified by // someone who knows why and how. #end brilliance 1.5 reflection {0 G21_Reflection_strength fresnel} conserve_energy } #local T1_NAPPol = texture { pigment { granite turbulence 0.8 CMap_Gamma() color_map { [0.00 G_rgb(<0.380, 0.200, 0.247>)] [0.50 G_rgb(<0.698, 0.463, 0.337>)] [0.50 G_rgb(<0.675, 0.506, 0.455>)] [1.00 G_rgb(<0.922, 0.843, 0.804>)] } } finish {F_NAPPol} // for layered textures this gets ignored anyway } #local T2_NAPPol = texture { pigment { granite turbulence 0.8 CMap_Gamma() color_map { [0.00 G_rgbt(<1.000, 1.000, 1.000, 1.000>)] [0.60 G_rgbt(<1.000, 1.000, 1.000, 1.000>)] [0.60 G_rgbt(<0.098, 0.078, 0.078, 0.498>)] [1.00 G_rgb (<0.047, 0.039, 0.039>)] } scale 0.5 translate <20.0, 20.0, 20.0> rotate <30.0, 30.0, 30.0> } finish {F_NAPPol} } // the public declarations #declare M_NAPPol_1 = material { texture {T1_NAPPol} interior {ior G21_Fresnel_ior} scale G21_global_scale } #declare M_NAPPol_2 = material { texture {T1_NAPPol} texture {T2_NAPPol} interior {ior G21_Fresnel_ior} scale G21_global_scale } //------------------------------------------------------------------------ // North American Pink granite - frosted surface // // Original Author: Daniel Meklenburg Jr (aka Code Warrior) // // Rewritten and modernized for the use with POV-Ray 3.7 and above - but // in the spirit of keeping the visual appearance the original author had // in mind. // #local F_NAPFro = finish { diffuse albedo 0.6 Dull_Highlights() // a small amount of highlights for realism // crand 0.25 // use the Crand() macro in the material block } // ********************************************************************** // NOTE !!! // // The original author did use a diffuse 1.0 and ambient 0.5. This makes // no sense at all as it means 1.5 times the amount of light it receives // are reflected. To my knowledge no granite in the known universe does // such a thing. // The ambient term for every texture should always be removed so we can // rely on the ambient as used in the global_settings block. // But still a diffuse value of 1.0 is not a good idea. // // So I took the freedom to change it. // // In fact a good rule of thumb when doing this is as follows: // look for the brightest term in the color_map in the base layer. // In this case this would be 0.961. // Then make sure that this value multiplied by the diffuse value stays // well below 0.6. // // Therefor in this case 0.6 for diffuse works quite well. // // The reason this should be done (and can be done without disrespecting // the original authors intend) is in old times people had the tendency // to make the light sources way too dim and did compensate for this // by declare a too high diffuse value - or maybe the other way around // but the result - too much diffuse - is still the same. // ********************************************************************** #local N_NAPFro = normal { bumps 0.1 scale 0.2 } #local T_NAPFro = texture { pigment { granite turbulence 0.8 CMap_Gamma() color_map { [0.00 G_rgb(<0.576, 0.435, 0.482>)] [0.50 G_rgb(<0.635, 0.506, 0.455>)] [0.50 G_rgb(<0.675, 0.506, 0.455>)] [0.72 G_rgb(<0.961, 0.863, 0.843>)] [0.72 G_rgb(<0.275, 0.275, 0.275>)] [1.00 G_rgb(<0.196, 0.196, 0.196>)] } } normal {N_NAPFro} finish {F_NAPFro} } #declare M_NAPFro = material { texture {T_NAPFro} Crand(0.25) // replacement for the crand in the finsh block scale G21_global_scale } //======================================================================= //[snip here] // // This would be the end of the include file. //======================================================================= //========================================== //Apply to this object #declare Typ = 3; #declare TexObject = union { ovus {1.00, 0.65 scale 0.5 translate <0, 0.45, 0> } superellipsoid { <0.1, 0.1> scale 0.5 translate -0.5*y } #switch (Typ) #case (1) material {M_NAPPol_1} #break #case (2) material {M_NAPPol_2} #break #case (3) material {M_NAPFro} #break #else #debug "\nAttention! Typ should be 1 .. 3!\n" texture {pigment {rgb <1, 0, 0>}} #end } object {TexObject scale 40 rotate 35*y } //====================================================================== //====================================================================== //Scene environment camera { location <0.0, 0.5, -4.0>*40 direction 1.5*z angle 40 right x*image_width/image_height look_at <0.0, 0.0, 0.0> } // a sky sphere sphere { <0, 0, 0>, 1 pigment { gradient y color_map { [0.0 srgb 0.7] [0.7 srgb 0.4] } } finish {emission 1 diffuse 0} scale 5*10e4 inverse } #include "CGSphere_ground.inc" object {Ground} #declare Area = on; #declare Sun_alt = 45; #declare Sun_azm = 55; #declare Intensity = 1; #include "CIE.inc" #declare SunCol = Blackbody(6500)*Intensity; #declare SunPos = <0, 0, -2>*10e4; #declare SunDia = vlength(SunPos)*2/215; //apparent diameter of the Sun #if (Area) #debug "\nUsing an area_light for the Sun.\n" light_source{ <0, 0, 0> color SunCol area_light SunDia*x, SunDia*z, // lights spread out across this distance (x * z) 9, 9 // total number of lights in grid (4x*4z = 16 lights) adaptive 1 // 0,1,2,3... area_illumination on // full area diffuse and specular jitter // adds random softening of light circular // make the shape of the light circular orient // orient light translate SunPos rotate Sun_alt*x rotate Sun_azm*y parallel point_at <0, 0, 0> // NOTE: a looks_like statement would make it actually also work with // radiosity and radiosity only scenes. } #else light_source { <0, 0, 0> // light's position (translated below) color rgb SunCol // light's color translate SunPos rotate Sun_alt*x rotate Sun_azm*y parallel point_at <0, 0, 0> } #end