POV-Ray : Newsgroups : povray.advanced-users : Advanced metals libraries needed : Re: Advanced metals libraries needed Server Time
6 Oct 2024 13:41:47 EDT (-0400)
  Re: Advanced metals libraries needed  
From: David Wallace
Date: 12 Jul 2006 21:54:11
Message: <44B5A7C9.1060701@earthlink.net>
Marvin wrote:
> Sorry if this it OT
> 
> I do a project to keep my job, and I need photorealistic parameters for
> laminate iron core for electromotor model. This far I have made an
> animation, or few of them, but either it is too much reflection to the
> level of confusion over what is reflected, or I get too dark metal with
> finish { reflection 0.2 } or less.
> 
> Anyone had experience willing to share on modelling irons?
> 
> Here are examples of motors, so you could see the problem for yourself (2 MB
> animation each)
> 
> http://161.53.83.3/~mtodorov/tesla/ind-320x240-2x-rot.gif
> 
> http://161.53.83.3/~mtodorov/tesla/sink-320x240-2x-rot.gif
> 
> You can also see I am not good at lighting. This is an academic volunteering
> project and I am few months at rendering, so please any good soul help.
> 
> Marvin
> 
> 
> 
I modified POV's metals.inc for my own purposes and included iron colors.  If 
one of them doesn't work, then experiment using the MetalCol macro.

I designed the macros to be used in the same manner as textures, in that
#declare texIron = texture { MetalTex("Iron",1,3) }
uses the same syntax as a predeclared texture.

#ifdef(Metals2_Inc_Temp)
// do nothing
#else
#declare Metals2_Inc_Temp=version;

#ifdef(View_POV_Include_Stack)
#   debug "including metals2.inc\n"
#end

/*
               Persistence of Vision Raytracer Version 3.1
                Metallic pigments, finishes, and textures.


*****************************************************************************
                      BASIC METAL COLORS, Macro form
*****************************************************************************
  Note: Describing metallic textures is difficult, at best.  The reflectivity
  and other qualities make them highly dependant on lighting and surroundings.

  The comments next to the definitions are intended as a rough guide only.

*/

#macro GoldCol(Type)
	#switch(Type)
		#case(1) color rgb <1.000, 0.675, 0.175> #break // Dim, nearly orange gold. 
Might pass for copper.
		#case(2) color rgb <1.000, 0.725, 0.275> #break // Lighter than Gold1 but 
still dim.
		#case(3) color rgb <1.000, 0.775, 0.375> #break // Mediam gold, close to 
goldenrod.
		#case(4) color rgb <1.000, 0.825, 0.475> #break // Slightly dimmer than Gold5 
but still bright.
		#case(5) color rgb <1.000, 0.875, 0.575> #break // Bright, yellow gold.
	#end
#end

#macro BrassCol(Type)
	#switch(Type)
		#case(1) color rgb <0.30, 0.20, 0.10> #break // Dark brown bronze.
		#case(2) color rgb <0.50, 0.35, 0.25> #break // Somewhat lighter brown than 
Brass4. Old penny, in soft finishes.
		#case(3) color rgb <0.58, 0.42, 0.20> #break // Used by Steve Anger's 
Polished_Brass. Slightly coppery.
		#case(4) color rgb <0.65, 0.50, 0.25> #break // A little yellower than Brass1.
		#case(5) color rgb <0.70, 0.55, 0.40> #break // Very light bronze, ranges from 
med tan to almost white.
	#end
#end

#macro ChromeCol(Type)
	#switch(Type)
		#case(1) color rgb <0.20, 0.20, 0.20> #break // 20% Gray. Used in Steve 
Anger's Polished_Chrome.
		#case(2) color rgb <0.39, 0.41, 0.43> #break // Slightly blueish 60% gray. 
Good steel w/finish #A.
		#case(3) color rgb <0.50, 0.50, 0.50> #break // 50% neutral gray.
		#case(4) color rgb <0.75, 0.75, 0.75> #break // 75% neutral gray.
		#case(5) color rgb <0.95, 0.95, 0.95> #break // 95% neutral gray.
	#end
#end

#macro CopperCol(Type)
	#switch(Type)
		#case(1) color rgb <0.40, 0.20, 0.15> #break // bronze-like.  Best in finish #C.
		#case(2) color rgb <0.50, 0.25, 0.15> #break // slightly brownish 
copper/bronze.  Best in finishes #B-#D.
		#case(3) color rgb <0.60, 0.30, 0.15> #break // reddish-brown copper.  Best in 
finishes #C-#E.
		#case(4) color rgb <0.70, 0.25, 0.15> #break // pink copper, like new tubing. 
  Best in finishes #C-#E.
		#case(5) color rgb <0.65, 0.35, 0.15> #break // Bronze in softer finishes, 
gold in harder finishes.
	#end
#end

#macro SilverCol(Type)
	#switch(Type)
		#case(1) color rgb <0.94, 0.93, 0.80> #break // Yellowish silverplate. 
Somewhat tarnished looking.
		#case(2) color rgb <0.94, 0.93, 0.85> #break // Not quite as yellowish as 
Silver1 but more so than Silver3.
		#case(3) color rgb <0.94, 0.93, 0.90> #break // Reasonably neutral silver.
		#case(4) color rgb <0.95, 0.91, 0.91> #break // REDUNDANT (unused)
		#case(5) color rgb <0.91, 0.95, 0.91> #break // REDUNDANT (unused)
	#end
#end

#macro IronCol(Type)
	#switch(Type)
		#case(1) color rgb <0.05, 0.05, 0.05> #break // Near-black, wrought iron.
		#case(2) color rgb <0.10, 0.10, 0.10> #break // Slightly lighter pig-iron.
		#case(3) color rgb <0.15, 0.15, 0.20> #break // Dim steel.
		#case(4) color rgb <0.10, 0.05, 0.05> #break // Somewhat rusted iron, reddish.
		#case(5) color rgb <0.20, 0.17, 0.15> #break // Somewhat rusted steel, orange.
	#end
#end

//*****************************************************************************
//                           BASIC METAL FINISHES
//*****************************************************************************

#macro MetFinish(Type)
	#switch(Type)
		#case(1) // Very soft and dull.
			ambient 0.00
			brilliance 2
			diffuse 1.0
			conserve_energy
			metallic
			specular 0.80
			roughness 1/20
			reflection { 0.05, 0.15 metallic }
		#break
		#case(2) // Fairly soft and dull.
			ambient 0.00
			brilliance 3
			diffuse 1.0
			conserve_energy
			metallic
			specular 0.70
			roughness 1/60
			reflection { 0.10, 0.25 metallic }
		#break
		#case(3) // Medium reflectivity. Holds color well.
			ambient 0.00
			brilliance 4
			diffuse 1.0
			conserve_energy
			metallic
			specular 0.80
			roughness 1/80
			reflection { 0.20, 0.50 metallic }
		#break
		#case(4) // Highly hard and polished. High reflectivity.
			ambient 0.00
			brilliance 5
			diffuse 1.0
			conserve_energy
			metallic
			specular 0.80
			roughness 1/100
			reflection { 0.25, 0.65 metallic }
		#break
		#case(5) // Very highly polished & reflective.
			ambient 0.00
			brilliance 6
			diffuse 1.0
			conserve_energy
			metallic
			specular 0.80
			roughness 1/120
			reflection { 0.30, 0.8 metallic }
		#break
	#end
#end


//*****************************************************************************
//                           METAL TEXTURES
//*****************************************************************************

//                        Standard Metals

#macro MetalTex(Type, Col, Fin)
	#if(strcmp(Type, "Gold")=0) pigment { GoldCol(Col) } #end
	#if(strcmp(Type, "Silver")=0) pigment { SilverCol(Col) } #end
	#if(strcmp(Type, "Brass")=0) pigment { BrassCol(Col) } #end
	#if(strcmp(Type, "Copper")=0) pigment { CopperCol(Col) } #end
	#if(strcmp(Type, "Chrome")=0) pigment { ChromeCol(Col) } #end
	#if(strcmp(Type, "Iron")=0) pigment { IronCol(Col) } #end
	finish { MetFinish(Fin) }
#end

//                        User-defined metallic texture

#macro MetalCol(Col, Fin)
	pigment { rgb Col }
	finish { MetFinish(Fin) }
#end

#version Metals2_Inc_Temp;
#end


-- 
--------------
David Wallace
TenArbor Consulting
"Just In Time Cash"
www.tenarbor.com
1-866-572-CASH


Post a reply to this message

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