/********************************************************************************** Persistence of Vision Ray Tracer Scene Description File File name : Jacquier sea.pov Version : 3.6 Description : Test scene to make foam at the shallow edges of an isosurface Date : February 2005 Author : Thomas A. M. de Groot E-mail : t.degroot@inter.nl.net **********************************************************************************/ #include "functions.inc" default { texture { pigment { rgb <1,0,0> } } } camera { location <0.0, 3.0, -40.0> direction 1.5*z right x*image_width/image_height look_at <0.0, 0.0, 0.0> } sky_sphere { pigment { gradient y color_map { [0.0 rgb <0.6,0.7,1.0>] [0.7 rgb <0.0,0.1,0.8>] } } } light_source { <0, 0, 0> // light's position (translated below) color rgb <1, 1, 1>*1.2 // light's color translate <-3000, 3000, 3000> } light_source { <0, 0, 0> // light's position (translated below) color rgb <1, 1, 1>*0.8 // light's color translate <3000, 3000, -3000> shadowless } // landscape produced by the geomorph macro: #declare Standalone = false; #include "Geomorph_mcr22.pov" // substrate: #declare HeteroInf = false; // in function, when true: y scaled infinitely #declare HetH = 0.8; #declare HetLac = 2; #declare HetOct = 1; #declare HetOff = 0; #declare HetT = 0.9; #declare HetNG = 3; #declare Noised = false; #declare Ridged = false; #declare RidgedInf = true; // in function, when true: y scaled infinitely #declare RidH = 1.2; #declare RidLac = 3; #declare RidOct = 6; #declare RidOff = 1.15; #declare RidG = 5; #declare RidNG = 2; #declare Fractal = false; #declare Mandelbrot = true; #declare Complex = <0.1, 0.2>; #declare Iterations = 10; #declare Exponent = 3; #declare Exterior = 1; #declare ExFactor = 1.0; #declare Interior = 0; #declare InFactor = 1.0; // noise: #declare Noise = 0.4; // controller for the f_noise3d function // patterns: #declare Wrinkled = true; #declare Rippled = false; #declare Waved = false; #declare Dented = false; #declare Isolated = false; // when true, generates an island or an isolated rock #declare Isolator = 1; #declare Crackled = false; #declare Hexed = false; #declare Honeycomb = true; // warp: #declare Wrinkleswarp = true; #declare Rippleswarp = false; #declare Waveswarp = false; #declare Dentswarp = false; #declare Cracklewarp = true; // gain: #declare Wrinklesgain = 0.9; #declare Ripplesgain = 0.2; #declare Wavesgain = 0.5; #declare Dentsgain = 0.5; #declare Cracklegain = 0.5; #declare Hexgain = 1.0; // warp turbulence: #declare Wrinklesturb = <0.5, 0.9, 0.9>; #declare Ripplesturb = <0.5, 2, 0.9>; #declare Wavesturb = <0.5, 0.9, 0.9>; #declare Dentsturb = <0.5, 0.9, 0.9>; #declare Crackleturb = <0.5, 0.2, 0.9>; // scale: #declare Substratescale = <5.0, 1.8, 5.0>; //<5.0, 5, 5.0>; #declare Ridgescale = <1.5, 0.5, 1.5>; #declare Fractalscale = <3, -1.5, 3>; #declare Wrinklescale = <10.0, 0.5, 10.0>; #declare Ripplescale = <0.1, 0.2, 0.1>; #declare Wavescale = <0.5, 0.2, 1.5>; #declare Dentscale = <0.5, 0.2, 0.5>; #declare Cracklescale = <0.5, 0.2, 0.5>; #declare Cracksize = 0.8; // multiplier for Cracklescale #declare Hexscale = <0.5, 1, 0.5>; // angle of rotation: #declare Fractalangle = <0, 0, 0>; #declare Wrinklesangle = <0, 0, 80>; #declare Ripplesangle = <0, 0, -30>; #declare Wavesangle = <0, 45, 60>; #declare Dentsangle = <0, 0, -10>; #declare Crackleangle = <0, 0, 0>; #declare Hexangle = <0, 0, 0>; // fractal translation: #declare Fractaltrans = <0, 0, 0>; // island: #declare IslandShearX = 0; // shear of the island function in the x direction #declare IslandShearZ = 0; // shear of the island function in the z direction #declare Islandgain = 0.9; #declare Diameter = 5; // diameter of the island function // isosurface: #declare UpperBound = 2; // Bounding box upper limit #declare LowerBound = -2; // Bounding box lower limit #declare MaxGrad = 11; // max_gradient of the isosurface (change according to need) #declare Xsize = 25; // increase size of the bounding box (not scale!) for X #declare Zsize = 25; // increase size of the bounding box (not scale!) for Z #declare Isoscale = <1, 1, 1>; // scale of the isosurface #declare Isorot = <0, 0, 3>; // rotation of the isosurface #declare Isotrans = <0, 0.0, 0>; // translation of the isosurface // texture: //#declare Landtex = // define your own texture here // for the internal textures, use: #declare Simpletex = false; // just a choice between two nice textures #declare Slope = true; // true = slope & altitude; false = gradient texture #declare SlopeValue = 0.8; // (0-1) higher values: more slope, less altitude, and vice versa // now call the macro: Geomorph() // ...and the landscape: object {Landscape} // My seawater texture macro: #macro TdG_NorthSeaWaterTex (Filter,Transparency,ScaleX,ScaleY,ScaleZ) texture { pigment { color rgbft <0.104167, 0.3125, 0.260417, Filter, Transparency> } normal { waves , 0.05 turbulence 0.5 frequency 100.0 phase 1.0 ramp_wave scale } finish { ambient 0.15 diffuse 0.0 brilliance 5.0 phong 1.0 phong_size 90.0 specular 0.4 roughness 0.01 conserve_energy reflection { .1, .9 falloff 2 } } } #end // end of macro /* Marc Jacquier wrote: I'm not quite sure but I believe conversion from image to function with .gray takes rgb but filter and transmit as well. And transmit is at 1 out of the image zone to make it transparent. What I do is crappy : invert the image in an image editor then multiply the function by a negative factor in the texturing process. But here you don't use bitmaps, do you? You are using functions. So the function factor in the texturing process should be positive. For my POVComp entry, I had only to evaluate distance from a central point (I won't spoil more ;-) I took the lazy path using cylindrical pattern but you can change for any function. Here is my sea material code (media set for 1 pov unit= 1 meter) */ // free (without foam) sea texture: #declare T_eau = TdG_NorthSeaWaterTex ( 0.9, // filter 0.25, // transparency 3, // ScaleX 2, // ScaleY 1, // ScaleZ ) // foam texture: #declare T_mousse = texture { pigment { color rgb 1 transmit .3 } finish{ ambient 0 diffuse 1 } normal{ bumps 0.1 scale 0.2 } } // transformation of the function coming from the Geomorph macro (FinalFunction) and used for the isosurface landscape, // into a pigment function: #declare P_img = pigment { function {FinalFunction(x/Xsize, y, z/Zsize)} //uses here the sizes of the isosurface (?) color_map { [0.0 rgb 1 ] [1.0 rgb 0 ] } warp {turbulence .02 lambda 7} scale Isoscale // uses here the transformations of the isosurface rotate Isorot translate Isotrans poly_wave 0.5 } #declare F_img = function {pigment {P_img}} #declare f_crackle_moi = function {pattern {crackle warp {turbulence 0.65 lambda 3} scale <1,2,1>*2}} //turb 0.7 //original distribution function: //#declare F_var_crackle = function {min(1, f_crackle_moi(x, y,z)*max(0,(F_img(x, y, z).gray)*40))} #declare Foam = 0.6; // controls the amount of foam // The distribution function from codesea.pov, to fill more or less the crackles (François Dispot): #declare F_var_crackle = function {min(1, f_crackle_moi(x, y, z)/max(min(1,(1-F_img(x, y, z).gray)*Foam),.001))} // fade_power and fade_distance for interior: #declare FD = 1.0; #declare FP = 3.0; #declare M_Iso_Sea = material { texture { function {F_var_crackle(x,y,z)} texture_map { // combinations: [.35 T_mousse] // .4 .35 [.50 T_eau] // .5 .85 } } interior { ior 1.33 fade_distance FD fade_power FP fade_color rgb <0.0, 0.437467, 0.0> media { samples 2,2 absorption rgb <1.0, 0.05, 0.05> } } } //---------------------------------------------------------- // Iso_Sea by Marc Jacquier (2003) // Originally: Isosurface plugin 1beta by S. Shonfield, morayplugin@yahoo.ca // adapted to left-handed orientation: #declare Scale_x = 7; #declare Scale_z = 5; #declare Damp = 1.2; #declare Lacunarity = 3; #declare Octave = 6; #declare Offset = 1.18; #declare Gain = 5; #declare Wave_Height = 1.0; isosurface { function { y +1-f_ridged_mf(x/Scale_x, 0, z/Scale_z,Damp,Lacunarity,Octave,Offset,Gain,2)*Wave_Height } contained_by {box{<-50,-11,-50>,<50,1,100>}} threshold 0 accuracy 0.001 max_gradient 5 //max_trace 1 //all_intersections material {M_Iso_Sea} scale <1,1,1> rotate <0,0,0> translate <0, 0, 0> } // end isosurface //Deep Water: plane { y, -10.0 pigment {color rgb <0.119608, 0.137255, 0.556863>*0.01}}