Advertisement
DirectorGunner

Star Citizen - How to convert XML material blocks to MTL

Jun 9th, 2017
257
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 52.72 KB | None | 0 0
  1. Star Citizen - How to convert XML material blocks to MTL
  2. Star Citizen is a massively multiplayer, space trading and combat computer game for Microsoft Windows and Linux.
  3. The game's engine is based on heavily modified Cry Engine build and uses Lumberyard's AWS infrastructure.
  4.  
  5. Star Citizen sometimes has MTL files for material information that, for whatever reason, they decided not to contain within the CGA/CGAM files material data block. Usually, these MTL files are serialized. To unserialize, Alluran made a tool available here
  6. https://github.com/dolkensp/HoloXPLOR/releases/tag/2.6.0-ptu
  7.  
  8. Quick note / legend,
  9. here's what I have figured out so far
  10. Ka for indirect color values
  11. Kd for diffuse values
  12. Ks for specular values
  13. Ns for specular exponent value I believe
  14. Ke is for emission via mtl on lots of engines from doing some online research/reading
  15. d for transparency
  16. map_bump for ddna file
  17. map_Kd for diffuse map
  18. map_d for opacity texture map
  19. map_Ks for specular map
  20. map_Ns for specular map something.. usually is the exact same file as specular map with Markemp's cgf converter's outputs
  21. disp for displacement map
  22. decal for decal map
  23.  
  24. Let's take a look at the Aurora MTL file for the specific build Star Citizen 2.5 public release
  25.  
  26. The first unserialized XML sub-block looks like this
  27.  
  28. <Material Name="Exterior_Tile" MtlFlags="524416" MatTemplate="" MatSubTemplate="" Shader="Illum" GenMask="2000A040000000" StringGenMask="%NORMAL_MAP%SPECULAR_MAP%SUBSURFACE_SCATTERING%VERTCOLORS" SurfaceType="metal_dense" Diffuse="0.68668544,0.94730669,1" Specular="0.93868583,0.93011099,0.87136728" Emissive="0,0,0" Opacity="1" Shininess="255" vertModifType="0">
  29. <TimeOfDay>
  30. <Glow Time="0" Glow="0" />
  31. <Glow Time="0" Glow="0" />
  32. <Glow Time="1" Glow="0" />
  33. <Glow Time="1" Glow="0" />
  34. </TimeOfDay>
  35. <Textures>
  36. <Texture Map="Diffuse" File="objects/spaceships/ships/rsi/aurora/textures/white_panneling_diff.tif" />
  37. <Texture Map="Bumpmap" File="objects/spaceships/ships/rsi/aurora/textures/white_panneling_ddna.tif" />
  38. <Texture Map="Specular" File="objects/spaceships/ships/rsi/aurora/textures/white_panneling_spec.tif">
  39. <TexMod TexMod_RotateType="0" TexMod_TexGenType="0" TexMod_bTexGenProjected="0" TileU="2" TileV="2" />
  40. </Texture>
  41. </Textures>
  42. <PublicParams SSSIndex="0" IndirectColor="0.25,0.25,0.25" />
  43. </Material>
  44.  
  45.  
  46. This subblock can be translated like this, minus the tiling and a couple other values:
  47.  
  48. newmtl Exterior_Tile
  49. ka 0.25,0.25,0.25
  50. Kd 0.68668544 0.94730669 1
  51. Ks 0.93868583 0.93011099 0.87136728
  52. d 1.000000
  53. illum 2
  54. map_Kd A:\CREATED\StarCitizen\SC25\objects\spaceships\ships\rsi\aurora\textures\white_panneling_diff.tif
  55. map_bump A:\CREATED\StarCitizen\SC25\objects\spaceships\ships\rsi\aurora\textures\white_panneling_ddna.tif
  56. map_Ks A:\CREATED\StarCitizen\SC25\objects\spaceships\ships\rsi\aurora\textures\white_panneling_spec.tif
  57.  
  58. But make sure to change the paths to match yours (eg A:\CREATED\StarCitizen\SC25\ to whatever your root dir is).
  59.  
  60. MarkEmp has made a CGA/CGAM file converter that will output an OBJ and a MTL file that sometimes is empty due to material block info missing in the CGA/CGAM files.
  61. https://github.com/Markemp/Cryengine-Converter
  62. He has plans to update this converter to work with Star Citizen 3.0 assets
  63.  
  64. IF YOU USE ANY PRE SC3.0 CGF converter, DO RENAME ALL YOUR SERIALIZED OR UNSERIALIZED MTLs with a _old append or something that you prefer. The reason being your important source MTLs could get overwritten by the empty MTLs from the pre SC3.0 cgf converter.
  65. I recommend after renaming and conversions, to open your unserialized MTL and save over the empty MTL and save as you work your way down the file converting to proper MTL format.
  66.  
  67. If you have any question, you can ask in this CIG forum thread here
  68. https://robertsspaceindustries.com/spectrum/community/SC/forum/50172/thread/howto-create-your-own-art-using-game-assets
  69.  
  70. There are a few conversions not shown in the example above.
  71. But the rest are fairly easy to figure out.
  72. For reference material please see excerpts below,
  73. source links for references are included.
  74.  
  75. A script can be developed to do these conversions automatically for us,
  76. but I do not have the skill set to make one,
  77. hopefully community will make one available for us.
  78.  
  79. Important references:
  80. MTL brief
  81. Reference Source: http://nendowingsmirai.yuku.com/forum/viewtopic/id/1723#.WTrvC5DysuW
  82. Ns = Phong specular component. Ranges from 0 to 1000. (I've seen various statements about this range (see below))
  83. Kd = Diffuse color weighted by the diffuse coefficient.
  84. Ka = Ambient color weighted by the ambient coefficient.
  85. Ks = Specular color weighted by the specular coefficient.
  86. d = Dissolve factor (pseudo-transparency). Values are from 0-1. 0 is completely transparent, 1 is opaque.
  87. Ni = Refraction index. Values range from 1 upwards. A value of 1 will cause no refraction. A higher value implies refraction.
  88. illum = (0, 1, or 2) 0 to disable lighting, 1 for ambient & diffuse only (specular color set to black), 2 for full lighting (see below)
  89. sharpness = ? (see below)
  90. map_Kd = Diffuse color texture map.
  91. map_Ks = Specular color texture map.
  92. map_Ka = Ambient color texture map.
  93. map_Bump = Bump texture map.
  94. map_d = Opacity texture map.
  95. refl = reflection type and filename (?)
  96.  
  97. MTL Possible but (unofficial) extensions for PBR support
  98. Reference Source http://exocortex.com/blog/extending_wavefront_mtl_to_support_pbr
  99. To represent a PBR material, we suggest using these existing well defined Wavefront MTL material properties:
  100. Kd/map_Kd (base/diffuse) // reuse
  101. Ks/map_Ks (specular) // reuse
  102. d or Tr (opacity) // reuse
  103. map_d/map_Tr (opacitymap) // reuse
  104. Tf (translucency) // reuse
  105. bump/-bm (bump map) // reuse
  106. disp (displacement map) // reuse
  107.  
  108. And we propose adding these additional properties, which refer to PBR-specific parameters as defined by the Disney PBR paper (pdf):
  109. Pr/map_Pr (roughness) // new
  110. Pm/map_Pm (metallic) // new
  111. Ps/map_Ps (sheen) // new
  112. Pc (clearcoat thickness) // new
  113. Pcr (clearcoat roughness) // new
  114. Ke/map_Ke (emissive) // new
  115. aniso (anisotropy) // new
  116. anisor (anisotropy rotation) // new
  117. norm (normal map) // new
  118.  
  119. MTL detailed
  120. Reference Source http://paulbourke.net/dataformats/mtl/
  121. 5. Material Library File (.mtl)
  122.  
  123. Material library files contain one or more material definitions, each
  124. of which includes the color, texture, and reflection map of individual
  125. materials. These are applied to the surfaces and vertices of objects.
  126. Material files are stored in ASCII format and have the .mtl extension.
  127.  
  128. An .mtl file differs from other Alias|Wavefront property files, such as
  129. light and atmosphere files, in that it can contain more than one
  130. material definition (other files contain the definition of only one
  131. item).
  132.  
  133. An .mtl file is typically organized as shown below.
  134.  
  135.  
  136. newmtl my_red
  137. Material color
  138. & illumination
  139. statements
  140.  
  141. texture map
  142. statements
  143.  
  144. reflection map
  145. statement
  146.  
  147. newmtl my_blue
  148. Material color
  149. & illumination
  150. statements
  151.  
  152. texture map
  153. statements
  154.  
  155. reflection map
  156. statement
  157.  
  158. newmtl my_green
  159. Material color
  160. & illumination
  161. statements
  162.  
  163. texture map
  164. statements
  165.  
  166. reflection map
  167. statement
  168.  
  169. Figure 5-1. Typical organization of .mtl file
  170.  
  171.  
  172. Each material description in an .mtl file consists of the newmtl
  173. statement, which assigns a name to the material and designates the start
  174. of a material description. This statement is followed by the material
  175. color, texture map, and reflection map statements that describe the
  176. material. An .mtl file map contain many different material
  177. descriptions.
  178.  
  179. After you specify a new material with the "newmtl" statement, you can
  180. enter the statements that describe the materials in any order. However,
  181. when the Property Editor writes an .mtl file, it puts the statements in
  182. a system-assigned order. In this chapter, the statements are described
  183. in the system-assigned order.
  184.  
  185.  
  186. Format
  187.  
  188. The following is a sample format for a material definition in an .mtl
  189. file:
  190.  
  191. Material
  192. name
  193. statement:
  194. newmtl my_mtl
  195.  
  196. Material
  197. color and
  198. illumination
  199. statements:
  200. Ka 0.0435 0.0435 0.0435
  201. Kd 0.1086 0.1086 0.1086
  202. Ks 0.0000 0.0000 0.0000
  203. Tf 0.9885 0.9885 0.9885
  204. illum 6
  205. d -halo 0.6600
  206. Ns 10.0000
  207. sharpness 60
  208. Ni 1.19713
  209.  
  210. Texture
  211. map
  212. statements:
  213. map_Ka -s 1 1 1 -o 0 0 0 -mm 0 1 chrome.mpc
  214. map_Kd -s 1 1 1 -o 0 0 0 -mm 0 1 chrome.mpc
  215. map_Ks -s 1 1 1 -o 0 0 0 -mm 0 1 chrome.mpc
  216. map_Ns -s 1 1 1 -o 0 0 0 -mm 0 1 wisp.mps
  217. map_d -s 1 1 1 -o 0 0 0 -mm 0 1 wisp.mps
  218. disp -s 1 1 .5 wisp.mps
  219. decal -s 1 1 1 -o 0 0 0 -mm 0 1 sand.mps
  220. bump -s 1 1 1 -o 0 0 0 -bm 1 sand.mpb
  221.  
  222. Reflection
  223. map
  224. statement:
  225. refl -type sphere -mm 0 1 clouds.mpc
  226.  
  227.  
  228. Material Name
  229.  
  230. The material name statement assigns a name to the material description.
  231.  
  232. Syntax
  233. The folowing syntax describes the material name statement.
  234.  
  235. newmtl name
  236.  
  237. Specifies the start of a material description and assigns a name to the
  238. material. An .mtl file must have one newmtl statement at the start of
  239. each material description.
  240.  
  241. "name" is the name of the material. Names may be any length but
  242. cannot include blanks. Underscores may be used in material names.
  243.  
  244.  
  245. Material color and illumination
  246.  
  247. The statements in this section specify color, transparency, and
  248. reflectivity values.
  249.  
  250. Syntax
  251. The following syntax describes the material color and illumination
  252. statements that apply to all .mtl files.
  253.  
  254.  
  255. Ka r g b
  256. Ka spectral file.rfl factor
  257. Ka xyz x y z
  258.  
  259. To specify the ambient reflectivity of the current material, you can
  260. use the "Ka" statement, the "Ka spectral" statement, or the "Ka xyz"
  261. statement.
  262.  
  263. Tip These statements are mutually exclusive. They cannot be used
  264. concurrently in the same material.
  265.  
  266. Ka r g b
  267.  
  268. The Ka statement specifies the ambient reflectivity using RGB values.
  269.  
  270. "r g b" are the values for the red, green, and blue components of the
  271. color. The g and b arguments are optional. If only r is specified,
  272. then g, and b are assumed to be equal to r. The r g b values are
  273. normally in the range of 0.0 to 1.0. Values outside this range increase
  274. or decrease the relectivity accordingly.
  275.  
  276. Ka spectral file.rfl factor
  277.  
  278. The "Ka spectral" statement specifies the ambient reflectivity using a
  279. spectral curve.
  280.  
  281. "file.rfl" is the name of the .rfl file.
  282. "factor" is an optional argument.
  283. "factor" is a multiplier for the values in the .rfl file and defaults
  284. to 1.0, if not specified.
  285.  
  286. Ka xyz x y z
  287.  
  288. The "Ka xyz" statement specifies the ambient reflectivity using CIEXYZ
  289. values.
  290.  
  291. "x y z" are the values of the CIEXYZ color space. The y and z
  292. arguments are optional. If only x is specified, then y and z are
  293. assumed to be equal to x. The x y z values are normally in the range of
  294. 0 to 1. Values outside this range increase or decrease the reflectivity
  295. accordingly.
  296.  
  297.  
  298. Kd r g b
  299. Kd spectral file.rfl factor
  300. Kd xyz x y z
  301.  
  302. To specify the diffuse reflectivity of the current material, you can
  303. use the "Kd" statement, the "Kd spectral" statement, or the "Kd xyz"
  304. statement.
  305.  
  306. Tip These statements are mutually exclusive. They cannot be used
  307. concurrently in the same material.
  308.  
  309. Kd r g b
  310.  
  311. The Kd statement specifies the diffuse reflectivity using RGB values.
  312.  
  313. "r g b" are the values for the red, green, and blue components of the
  314. atmosphere. The g and b arguments are optional. If only r is
  315. specified, then g, and b are assumed to be equal to r. The r g b values
  316. are normally in the range of 0.0 to 1.0. Values outside this range
  317. increase or decrease the relectivity accordingly.
  318.  
  319. Kd spectral file.rfl factor
  320.  
  321. The "Kd spectral" statement specifies the diffuse reflectivity using a
  322. spectral curve.
  323.  
  324. "file.rfl" is the name of the .rfl file.
  325. "factor" is an optional argument.
  326. "factor" is a multiplier for the values in the .rfl file and defaults
  327. to 1.0, if not specified.
  328.  
  329. Kd xyz x y z
  330.  
  331. The "Kd xyz" statement specifies the diffuse reflectivity using CIEXYZ
  332. values.
  333.  
  334. "x y z" are the values of the CIEXYZ color space. The y and z
  335. arguments are optional. If only x is specified, then y and z are
  336. assumed to be equal to x. The x y z values are normally in the range of
  337. 0 to 1. Values outside this range increase or decrease the reflectivity
  338. accordingly.
  339.  
  340.  
  341. Ks r g b
  342. Ks spectral file.rfl factor
  343. Ks xyz x y z
  344.  
  345. To specify the specular reflectivity of the current material, you can
  346. use the "Ks" statement, the "Ks spectral" statement, or the "Ks xyz"
  347. statement.
  348.  
  349. Tip These statements are mutually exclusive. They cannot be used
  350. concurrently in the same material.
  351.  
  352. Ks r g b
  353.  
  354. The Ks statement specifies the specular reflectivity using RGB values.
  355.  
  356. "r g b" are the values for the red, green, and blue components of the
  357. atmosphere. The g and b arguments are optional. If only r is
  358. specified, then g, and b are assumed to be equal to r. The r g b values
  359. are normally in the range of 0.0 to 1.0. Values outside this range
  360. increase or decrease the relectivity accordingly.
  361.  
  362. Ks spectral file.rfl factor
  363.  
  364. The "Ks spectral" statement specifies the specular reflectivity using a
  365. spectral curve.
  366.  
  367. "file.rfl" is the name of the .rfl file.
  368. "factor" is an optional argument.
  369. "factor" is a multiplier for the values in the .rfl file and defaults
  370. to 1.0, if not specified.
  371.  
  372. Ks xyz x y z
  373.  
  374. The "Ks xyz" statement specifies the specular reflectivity using CIEXYZ
  375. values.
  376.  
  377. "x y z" are the values of the CIEXYZ color space. The y and z
  378. arguments are optional. If only x is specified, then y and z are
  379. assumed to be equal to x. The x y z values are normally in the range of
  380. 0 to 1. Values outside this range increase or decrease the reflectivity
  381. accordingly.
  382.  
  383.  
  384. Tf r g b
  385. Tf spectral file.rfl factor
  386. Tf xyz x y z
  387.  
  388. To specify the transmission filter of the current material, you can use
  389. the "Tf" statement, the "Tf spectral" statement, or the "Tf xyz"
  390. statement.
  391.  
  392. Any light passing through the object is filtered by the transmission
  393. filter, which only allows the specifiec colors to pass through. For
  394. example, Tf 0 1 0 allows all the green to pass through and filters out
  395. all the red and blue.
  396.  
  397. Tip These statements are mutually exclusive. They cannot be used
  398. concurrently in the same material.
  399.  
  400. Tf r g b
  401.  
  402. The Tf statement specifies the transmission filter using RGB values.
  403.  
  404. "r g b" are the values for the red, green, and blue components of the
  405. atmosphere. The g and b arguments are optional. If only r is
  406. specified, then g, and b are assumed to be equal to r. The r g b values
  407. are normally in the range of 0.0 to 1.0. Values outside this range
  408. increase or decrease the relectivity accordingly.
  409.  
  410. Tf spectral file.rfl factor
  411.  
  412. The "Tf spectral" statement specifies the transmission filterusing a
  413. spectral curve.
  414.  
  415. "file.rfl" is the name of the .rfl file.
  416. "factor" is an optional argument.
  417. "factor" is a multiplier for the values in the .rfl file and defaults
  418. to 1.0, if not specified.
  419.  
  420. Tf xyz x y z
  421.  
  422. The "Ks xyz" statement specifies the specular reflectivity using CIEXYZ
  423. values.
  424.  
  425. "x y z" are the values of the CIEXYZ color space. The y and z
  426. arguments are optional. If only x is specified, then y and z are
  427. assumed to be equal to x. The x y z values are normally in the range of
  428. 0 to 1. Values outside this range will increase or decrease the
  429. intensity of the light transmission accordingly.
  430.  
  431.  
  432. illum illum_#
  433.  
  434. The "illum" statement specifies the illumination model to use in the
  435. material. Illumination models are mathematical equations that represent
  436. various material lighting and shading effects.
  437.  
  438. "illum_#"can be a number from 0 to 10. The illumination models are
  439. summarized below; for complete descriptions see "Illumination models" on
  440. page 5-30.
  441.  
  442. Illumination Properties that are turned on in the
  443. model Property Editor
  444.  
  445. 0 Color on and Ambient off
  446. 1 Color on and Ambient on
  447. 2 Highlight on
  448. 3 Reflection on and Ray trace on
  449. 4 Transparency: Glass on
  450. Reflection: Ray trace on
  451. 5 Reflection: Fresnel on and Ray trace on
  452. 6 Transparency: Refraction on
  453. Reflection: Fresnel off and Ray trace on
  454. 7 Transparency: Refraction on
  455. Reflection: Fresnel on and Ray trace on
  456. 8 Reflection on and Ray trace off
  457. 9 Transparency: Glass on
  458. Reflection: Ray trace off
  459. 10 Casts shadows onto invisible surfaces
  460.  
  461.  
  462. d factor
  463.  
  464. Specifies the dissolve for the current material.
  465.  
  466. "factor" is the amount this material dissolves into the background. A
  467. factor of 1.0 is fully opaque. This is the default when a new material
  468. is created. A factor of 0.0 is fully dissolved (completely
  469. transparent).
  470.  
  471. Unlike a real transparent material, the dissolve does not depend upon
  472. material thickness nor does it have any spectral character. Dissolve
  473. works on all illumination models.
  474.  
  475. d -halo factor
  476.  
  477. Specifies that a dissolve is dependent on the surface orientation
  478. relative to the viewer. For example, a sphere with the following
  479. dissolve, d -halo 0.0, will be fully dissolved at its center and will
  480. appear gradually more opaque toward its edge.
  481.  
  482. "factor" is the minimum amount of dissolve applied to the material.
  483. The amount of dissolve will vary between 1.0 (fully opaque) and the
  484. specified "factor". The formula is:
  485.  
  486. dissolve = 1.0 - (N*v)(1.0-factor)
  487.  
  488. For a definition of terms, see "Illumination models" on page 5-30.
  489.  
  490.  
  491. Ns exponent
  492.  
  493. Specifies the specular exponent for the current material. This defines
  494. the focus of the specular highlight.
  495.  
  496. "exponent" is the value for the specular exponent. A high exponent
  497. results in a tight, concentrated highlight. Ns values normally range
  498. from 0 to 1000.
  499.  
  500.  
  501. sharpness value
  502.  
  503. Specifies the sharpness of the reflections from the local reflection
  504. map. If a material does not have a local reflection map defined in its
  505. material definition, sharpness will apply to the global reflection map
  506. defined in PreView.
  507.  
  508. "value" can be a number from 0 to 1000. The default is 60. A high
  509. value results in a clear reflection of objects in the reflection map.
  510.  
  511. Tip Sharpness values greater than 100 map introduce aliasing effects
  512. in flat surfaces that are viewed at a sharp angle
  513.  
  514.  
  515. Ni optical_density
  516.  
  517. Specifies the optical density for the surface. This is also known as
  518. index of refraction.
  519.  
  520. "optical_density" is the value for the optical density. The values can
  521. range from 0.001 to 10. A value of 1.0 means that light does not bend
  522. as it passes through an object. Increasing the optical_density
  523. increases the amount of bending. Glass has an index of refraction of
  524. about 1.5. Values of less than 1.0 produce bizarre results and are not
  525. recommended.
  526.  
  527.  
  528. Material texture map
  529.  
  530. Texture map statements modify the material parameters of a surface by
  531. associating an image or texture file with material parameters that can
  532. be mapped. By modifying existing parameters instead of replacing them,
  533. texture maps provide great flexibility in changing the appearance of an
  534. object's surface.
  535.  
  536. Image files and texture files can be used interchangeably. If you use
  537. an image file, that file is converted to a texture in memory and is
  538. discarded after rendering.
  539.  
  540. Tip Using images instead of textures saves disk space and setup time,
  541. however, it introduces a small computational cost at the beginning of a
  542. render.
  543.  
  544. The material parameters that can be modified by a texture map are:
  545.  
  546. - Ka (color)
  547. - Kd (color)
  548. - Ks (color)
  549. - Ns (scalar)
  550. - d (scalar)
  551.  
  552. In addition to the material parameters, the surface normal can be
  553. modified.
  554.  
  555.  
  556. Image file types
  557.  
  558. You can link any image file type that is currently supported.
  559. Supported image file types are listed in the chapter "About Image" in
  560. the "Advanced Visualizer User's Guide". You can also use the "im_info -
  561. a" command to list Image file types, among other things.
  562.  
  563.  
  564. Texture file types
  565.  
  566. The texture file types you can use are:
  567.  
  568. - mip-mapped texture files (.mpc, .mps, .mpb)
  569. - compiled procedural texture files (.cxc, .cxs, .cxb)
  570.  
  571.  
  572. Mip-mapped texture files
  573.  
  574. Mip-mapped texture files are created from images using the Create
  575. Textures panel in the Director or the "texture2D" program. There are
  576. three types of texture files:
  577.  
  578. - color texture files (.mpc)
  579. - scalar texture files (.mps)
  580. - bump texture files (.mpb)
  581.  
  582. Color textures. Color texture files are designated by an extension of
  583. ".mpc" in the filename, such as "chrome.mpc". Color textures modify the
  584. material color as follows:
  585.  
  586. - Ka - material ambient is multiplied by the texture value
  587. - Kd - material diffuse is multiplied by the texture value
  588. - Ks - material specular is multiplied by the texture value
  589.  
  590. Scalar textures. Scalar texture files are designated by an extension
  591. of ".mps" in the filename, such as "wisp.mps". Scalar textures modify
  592. the material scalar values as follows:
  593.  
  594. - Ns - material specular exponent is multiplied by the texture value
  595. - d - material dissolve is multiplied by the texture value
  596. - decal - uses a scalar value to deform the surface of an object to
  597. create surface roughness
  598.  
  599. Bump textures. Bump texture files are designated by an extension of
  600. ".mpb" in the filename, such as "sand.mpb". Bump textures modify
  601. surface normals. The image used for a bump texture represents the
  602. topology or height of the surface relative to the average surface. Dark
  603. areas are depressions and light areas are high points. The effect is
  604. like embossing the surface with the texture.
  605.  
  606.  
  607. Procedural texture files
  608.  
  609. Procedural texture files use mathematical formulas to calculate sample
  610. values of the texture. The procedural texture file is compiled, stored,
  611. and accessed by the Image program when rendering. for more information
  612. see chapter 9, "Procedural Texture Files (.cxc, .cxb. and .cxs)".
  613.  
  614. Syntax
  615.  
  616. The following syntax describes the texture map statements that apply to
  617. .mtl files. These statements can be used alone or with any combination
  618. of options. The options and their arguments are inserted between the
  619. keyword and the "filename".
  620.  
  621. map_Ka -options args filename
  622.  
  623. Specifies that a color texture file or a color procedural texture file
  624. is applied to the ambient reflectivity of the material. During
  625. rendering, the "map_Ka" value is multiplied by the "Ka" value.
  626.  
  627. "filename" is the name of a color texture file (.mpc), a color
  628. procedural texture file (.cxc), or an image file.
  629.  
  630. Tip To make sure that the texture retains its original look, use the
  631. .rfl file "ident" as the underlying material. This applies to the
  632. "map_Ka", "map_Kd", and "map_Ks" statements. For more information on
  633. .rfl files, see chapter 8, "Spectral Curve File (.rfl)".
  634.  
  635. The options for the "map_Ka" statement are listed below. These options
  636. are described in detail in "Options for texture map statements" on page
  637. 5-18.
  638.  
  639. -blendu on | off
  640. -blendv on | off
  641. -cc on | off
  642. -clamp on | off
  643. -mm base gain
  644. -o u v w
  645. -s u v w
  646. -t u v w
  647. -texres value
  648.  
  649.  
  650. map_Kd -options args filename
  651.  
  652. Specifies that a color texture file or color procedural texture file is
  653. linked to the diffuse reflectivity of the material. During rendering,
  654. the map_Kd value is multiplied by the Kd value.
  655.  
  656. "filename" is the name of a color texture file (.mpc), a color
  657. procedural texture file (.cxc), or an image file.
  658.  
  659. The options for the map_Kd statement are listed below. These options
  660. are described in detail in "Options for texture map statements" on page
  661. 5-18.
  662.  
  663. -blendu on | off
  664. -blendv on | off
  665. -cc on | off
  666. -clamp on | off
  667. -mm base gain
  668. -o u v w
  669. -s u v w
  670. -t u v w
  671. -texres value
  672.  
  673.  
  674. map_Ks -options args filename
  675.  
  676. Specifies that a color texture file or color procedural texture file is
  677. linked to the specular reflectivity of the material. During rendering,
  678. the map_Ks value is multiplied by the Ks value.
  679.  
  680. "filename" is the name of a color texture file (.mpc), a color
  681. procedural texture file (.cxc), or an image file.
  682.  
  683. The options for the map_Ks statement are listed below. These options
  684. are described in detail in "Options for texture map statements" on page
  685. 5-18.
  686.  
  687. -blendu on | off
  688. -blendv on | off
  689. -cc on | off
  690. -clamp on | off
  691. -mm base gain
  692. -o u v w
  693. -s u v w
  694. -t u v w
  695. -texres value
  696.  
  697.  
  698. map_Ns -options args filename
  699.  
  700. Specifies that a scalar texture file or scalar procedural texture file
  701. is linked to the specular exponent of the material. During rendering,
  702. the map_Ns value is multiplied by the Ns value.
  703.  
  704. "filename" is the name of a scalar texture file (.mps), a scalar
  705. procedural texture file (.cxs), or an image file.
  706.  
  707. The options for the map_Ns statement are listed below. These options
  708. are described in detail in "Options for texture map statements" on page
  709. 5-18.
  710.  
  711. -blendu on | off
  712. -blendv on | off
  713. -clamp on | off
  714. -imfchan r | g | b | m | l | z
  715. -mm base gain
  716. -o u v w
  717. -s u v w
  718. -t u v w
  719. -texres value
  720.  
  721.  
  722. map_d -options args filename
  723.  
  724. Specifies that a scalar texture file or scalar procedural texture file
  725. is linked to the dissolve of the material. During rendering, the map_d
  726. value is multiplied by the d value.
  727.  
  728. "filename" is the name of a scalar texture file (.mps), a scalar
  729. procedural texture file (.cxs), or an image file.
  730.  
  731. The options for the map_d statement are listed below. These options
  732. are described in detail in "Options for texture map statements" on page
  733. 5-18.
  734.  
  735. -blendu on | off
  736. -blendv on | off
  737. -clamp on | off
  738. -imfchan r | g | b | m | l | z
  739. -mm base gain
  740. -o u v w
  741. -s u v w
  742. -t u v w
  743. -texres value
  744.  
  745.  
  746. map_aat on
  747.  
  748. Turns on anti-aliasing of textures in this material without anti-
  749. aliasing all textures in the scene.
  750.  
  751. If you wish to selectively anti-alias textures, first insert this
  752. statement in the material file. Then, when rendering with the Image
  753. panel, choose the anti-alias settings: "shadows", "reflections
  754. polygons", or "polygons only". If using Image from the command line,
  755. use the -aa or -os options. Do not use the -aat option.
  756.  
  757. Image will anti-alias all textures in materials with the map_aat on
  758. statement, using the oversampling level you choose when you run Image.
  759. Textures in other materials will not be oversampled.
  760.  
  761. You cannot set a different oversampling level individually for each
  762. material, nor can you anti-alias some textures in a material and not
  763. others. To anti-alias all textures in all materials, use the -aat
  764. option from the Image command line. If a material with "map_aat on"
  765. includes a reflection map, all textures in that reflection map will be
  766. anti-aliased as well.
  767.  
  768. You will not see the effects of map_aat in the Property Editor.
  769.  
  770. Tip Some .mpc textures map exhibit undesirable effects around the
  771. edges of smoothed objects. The "map_aat" statement will correct this.
  772.  
  773.  
  774. decal -options args filename
  775.  
  776. Specifies that a scalar texture file or a scalar procedural texture
  777. file is used to selectively replace the material color with the texture
  778. color.
  779.  
  780. "filename" is the name of a scalar texture file (.mps), a scalar
  781. procedural texture file (.cxs), or an image file.
  782.  
  783. During rendering, the Ka, Kd, and Ks values and the map_Ka, map_Kd, and
  784. map_Ks values are blended according to the following formula:
  785.  
  786. result_color=tex_color(tv)*decal(tv)+mtl_color*(1.0-decal(tv))
  787.  
  788. where tv is the texture vertex.
  789.  
  790. "result_color" is the blended Ka, Kd, and Ks values.
  791.  
  792. The options for the decal statement are listed below. These options
  793. are described in detail in "Options for texture map statements" on page
  794. 5-18.
  795.  
  796. -blendu on | off
  797. -blendv on | off
  798. -clamp on | off
  799. -imfchan r | g | b | m | l | z
  800. -mm base gain
  801. -o u v w
  802. -s u v w
  803. -t u v w
  804. -texres value
  805.  
  806.  
  807. disp -options args filename
  808.  
  809. Specifies that a scalar texture is used to deform the surface of an
  810. object, creating surface roughness.
  811.  
  812. "filename" is the name of a scalar texture file (.mps), a bump
  813. procedural texture file (.cxb), or an image file.
  814.  
  815. The options for the disp statement are listed below. These options are
  816. described in detail in "Options for texture map statements" on page 5-
  817. 18.
  818.  
  819. -blendu on | off
  820. -blendv on | off
  821. -clamp on | off
  822. -imfchan r | g | b | m | l | z
  823. -mm base gain
  824. -o u v w
  825. -s u v w
  826. -t u v w
  827. -texres value
  828.  
  829.  
  830. bump -options args filename
  831.  
  832. Specifies that a bump texture file or a bump procedural texture file is
  833. linked to the material.
  834.  
  835. "filename" is the name of a bump texture file (.mpb), a bump procedural
  836. texture file (.cxb), or an image file.
  837.  
  838. The options for the bump statement are listed below. These options are
  839. described in detail in "Options for texture map statements" on page 5-
  840. 18.
  841.  
  842. -bm mult
  843. -clamp on | off
  844. -blendu on | off
  845. -blendv on | off
  846. -imfchan r | g | b | m | l | z
  847. -mm base gain
  848. -o u v w
  849. -s u v w
  850. -t u v w
  851. -texres value
  852.  
  853.  
  854. Options for texture map statements
  855.  
  856. The following options and arguments can be used to modify the texture
  857. map statements.
  858.  
  859. -blenu on | off
  860.  
  861. The -blendu option turns texture blending in the horizontal direction
  862. (u direction) on or off. The default is on.
  863.  
  864. -blenv on | off
  865.  
  866. The -blendv option turns texture blending in the vertical direction (v
  867. direction) on or off. The default is on.
  868.  
  869. -bm mult
  870.  
  871. The -bm option specifies a bump multiplier. You can use it only with
  872. the "bump" statement. Values stored with the texture or procedural
  873. texture file are multiplied by this value before they are applied to the
  874. surface.
  875.  
  876. "mult" is the value for the bump multiplier. It can be positive or
  877. negative. Extreme bump multipliers may cause odd visual results because
  878. only the surface normal is perturbed and the surface position does not
  879. change. For best results, use values between 0 and 1.
  880.  
  881. -boost value
  882.  
  883. The -boost option increases the sharpness, or clarity, of mip-mapped
  884. texture files -- that is, color (.mpc), scalar (.mps), and bump (.mpb)
  885. files. If you render animations with boost, you may experience some
  886. texture crawling. The effects of boost are seen when you render in
  887. Image or test render in Model or PreView; they aren't as noticeable in
  888. Property Editor.
  889.  
  890. "value" is any non-negative floating point value representing the
  891. degree of increased clarity; the greater the value, the greater the
  892. clarity. You should start with a boost value of no more than 1 or 2 and
  893. increase the value as needed. Note that larger values have more
  894. potential to introduce texture crawling when animated.
  895.  
  896. -cc on | off
  897.  
  898. The -cc option turns on color correction for the texture. You can use
  899. it only with the color map statements: map_Ka, map_Kd, and map_Ks.
  900.  
  901. -clamp on | off
  902.  
  903. The -clamp option turns clamping on or off. When clamping is on,
  904. textures are restricted to 0-1 in the uvw range. The default is off.
  905.  
  906. When clamping is turned on, one copy of the texture is mapped onto the
  907. surface, rather than repeating copies of the original texture across the
  908. surface of a polygon, which is the default. Outside of the origin
  909. texture, the underlying material is unchanged.
  910.  
  911. A postage stamp on an envelope or a label on a can of soup is an
  912. example of a texture with clamping turned on. A tile floor or a
  913. sidewalk is an example of a texture with clamping turned off.
  914.  
  915. Two-dimensional textures are clamped in the u and v dimensions; 3D
  916. procedural textures are clamped in the u, v, and w dimensions.
  917.  
  918. -imfchan r | g | b | m | l | z
  919.  
  920. The -imfchan option specifies the channel used to create a scalar or
  921. bump texture. Scalar textures are applied to:
  922.  
  923. transparency
  924. specular exponent
  925. decal
  926. displacement
  927.  
  928. The channel choices are:
  929.  
  930. r specifies the red channel.
  931. g specifies the green channel.
  932. b specifies the blue channel.
  933. m specifies the matte channel.
  934. l specifies the luminance channel.
  935. z specifies the z-depth channel.
  936.  
  937. The default for bump and scalar textures is "l" (luminance), unless you
  938. are building a decal. In that case, the default is "m" (matte).
  939.  
  940. -mm base gain
  941.  
  942. The -mm option modifies the range over which scalar or color texture
  943. values may vary. This has an effect only during rendering and does not
  944. change the file.
  945.  
  946. "base" adds a base value to the texture values. A positive value makes
  947. everything brighter; a negative value makes everything dimmer. The
  948. default is 0; the range is unlimited.
  949.  
  950. "gain" expands the range of the texture values. Increasing the number
  951. increases the contrast. The default is 1; the range is unlimited.
  952.  
  953. -o u v w
  954.  
  955. The -o option offsets the position of the texture map on the surface by
  956. shifting the position of the map origin. The default is 0, 0, 0.
  957.  
  958. "u" is the value for the horizontal direction of the texture
  959.  
  960. "v" is an optional argument.
  961. "v" is the value for the vertical direction of the texture.
  962.  
  963. "w" is an optional argument.
  964. "w" is the value used for the depth of a 3D texture.
  965.  
  966. -s u v w
  967.  
  968. The -s option scales the size of the texture pattern on the textured
  969. surface by expanding or shrinking the pattern. The default is 1, 1, 1.
  970.  
  971. "u" is the value for the horizontal direction of the texture
  972.  
  973. "v" is an optional argument.
  974. "v" is the value for the vertical direction of the texture.
  975.  
  976. "w" is an optional argument.
  977. "w" is a value used for the depth of a 3D texture.
  978. "w" is a value used for the amount of tessellation of the displacement
  979. map.
  980.  
  981. -t u v w
  982.  
  983. The -t option turns on turbulence for textures. Adding turbulence to a
  984. texture along a specified direction adds variance to the original image
  985. and allows a simple image to be repeated over a larger area without
  986. noticeable tiling effects.
  987.  
  988. turbulence also lets you use a 2D image as if it were a solid texture,
  989. similar to 3D procedural textures like marble and granite.
  990.  
  991. "u" is the value for the horizontal direction of the texture
  992. turbulence.
  993.  
  994. "v" is an optional argument.
  995. "v" is the value for the vertical direction of the texture turbulence.
  996.  
  997. "w" is an optional argument.
  998. "w" is a value used for the depth of the texture turbulence.
  999.  
  1000. By default, the turbulence for every texture map used in a material is
  1001. uvw = (0,0,0). This means that no turbulence will be applied and the 2D
  1002. texture will behave normally.
  1003.  
  1004. Only when you raise the turbulence values above zero will you see the
  1005. effects of turbulence.
  1006.  
  1007. -texres resolution
  1008.  
  1009. The -texres option specifies the resolution of texture created when an
  1010. image is used. The default texture size is the largest power of two
  1011. that does not exceed the original image size.
  1012.  
  1013. If the source image is an exact power of 2, the texture cannot be built
  1014. any larger. If the source image size is not an exact power of 2, you
  1015. can specify that the texture be built at the next power of 2 greater
  1016. than the source image size.
  1017.  
  1018. The original image should be square, otherwise, it will be scaled to
  1019. fit the closest square size that is not larger than the original.
  1020. Scaling reduces sharpness.
  1021.  
  1022.  
  1023. Material reflection map
  1024.  
  1025. A reflection map is an environment that simulates reflections in
  1026. specified objects. The environment is represented by a color texture
  1027. file or procedural texture file that is mapped on the inside of an
  1028. infinitely large, space. Reflection maps can be spherical or cubic. A
  1029. spherical reflection map requires only one texture or image file, while
  1030. a cubic reflection map requires six.
  1031.  
  1032. Each material description can contain one reflection map statement that
  1033. specifies a color texture file or a color procedural texture file to
  1034. represent the environment. The material itself must be assigned an
  1035. illumination model of 3 or greater.
  1036.  
  1037. The reflection map statement in the .mtl file defines a local
  1038. reflection map. That is, each material assigned to an object in a scene
  1039. can have an individual reflection map. In PreView, you can assign a
  1040. global reflection map to an object and specify the orientation of the
  1041. reflection map. Rotating the reflection map creates the effect of
  1042. animating reflections independently of object motion. When you replace
  1043. a global reflection map with a local reflection map, the local
  1044. reflection map inherits the transformation of the global reflection map.
  1045.  
  1046. Syntax
  1047.  
  1048. The following syntax statements describe the reflection map statement
  1049. for .mtl files.
  1050.  
  1051. refl -type sphere -options -args filename
  1052.  
  1053. Specifies an infinitely large sphere that casts reflections onto the
  1054. material. You specify one texture file.
  1055.  
  1056. "filename" is the color texture file, color procedural texture file, or
  1057. image file that will be mapped onto the inside of the shape.
  1058.  
  1059. refl -type cube_side -options -args filenames
  1060.  
  1061. Specifies an infinitely large sphere that casts reflections onto the
  1062. material. You can specify different texture files for the "top",
  1063. "bottom", "front", "back", "left", and "right" with the following
  1064. statements:
  1065.  
  1066. refl -type cube_top
  1067. refl -type cube_bottom
  1068. refl -type cube_front
  1069. refl -type cube_back
  1070. refl -type cube_left
  1071. refl -type cube_right
  1072.  
  1073. "filenames" are the color texture files, color procedural texture
  1074. files, or image files that will be mapped onto the inside of the shape.
  1075.  
  1076. The "refl" statements for sphere and cube can be used alone or with
  1077. any combination of the following options. The options and their
  1078. arguments are inserted between "refl" and "filename".
  1079.  
  1080. -blendu on | off
  1081. -blendv on | off
  1082. -cc on | off
  1083. -clamp on | off
  1084. -mm base gain
  1085. -o u v w
  1086. -s u v w
  1087. -t u v w
  1088. -texres value
  1089.  
  1090. The options for the reflection map statement are described in detail in
  1091. "Options for texture map statements" on page 18.
  1092.  
  1093.  
  1094. Examples
  1095.  
  1096. 1 Neon green
  1097.  
  1098. This is a bright green material. When applied to an object, it will
  1099. remain bright green regardless of any lighting in the scene.
  1100.  
  1101. newmtl neon_green
  1102. Kd 0.0000 1.0000 0.0000
  1103. illum 0
  1104.  
  1105. 2 Flat green
  1106.  
  1107. This is a flat green material.
  1108.  
  1109. newmtl flat_green
  1110. Ka 0.0000 1.0000 0.0000
  1111. Kd 0.0000 1.0000 0.0000
  1112. illum 1
  1113.  
  1114. 3 Dissolved green
  1115.  
  1116. This is a flat green, partially dissolved material.
  1117.  
  1118. newmtl diss_green
  1119. Ka 0.0000 1.0000 0.0000
  1120. Kd 0.0000 1.0000 0.0000
  1121. d 0.8000
  1122. illum 1
  1123.  
  1124. 4 Shiny green
  1125.  
  1126. This is a shiny green material. When applied to an object, it shows a
  1127. white specular highlight.
  1128.  
  1129. newmtl shiny_green
  1130. Ka 0.0000 1.0000 0.0000
  1131. Kd 0.0000 1.0000 0.0000
  1132. Ks 1.0000 1.0000 1.0000
  1133. Ns 200.0000
  1134. illum 1
  1135.  
  1136. 5 Green mirror
  1137.  
  1138. This is a reflective green material. When applied to an object, it
  1139. reflects other objects in the same scene.
  1140.  
  1141. newmtl green_mirror
  1142. Ka 0.0000 1.0000 0.0000
  1143. Kd 0.0000 1.0000 0.0000
  1144. Ks 0.0000 1.0000 0.0000
  1145. Ns 200.0000
  1146. illum 3
  1147.  
  1148. 6 Fake windshield
  1149.  
  1150. This material approximates a glass surface. Is it almost completely
  1151. transparent, but it shows reflections of other objects in the scene. It
  1152. will not distort the image of objects seen through the material.
  1153.  
  1154. newmtl fake_windsh
  1155. Ka 0.0000 0.0000 0.0000
  1156. Kd 0.0000 0.0000 0.0000
  1157. Ks 0.9000 0.9000 0.9000
  1158. d 0.1000
  1159. Ns 200
  1160. illum 4
  1161.  
  1162. 7 Fresnel blue
  1163.  
  1164. This material exhibits an effect known as Fresnel reflection. When
  1165. applied to an object, white fringes may appear where the object's
  1166. surface is viewed at a glancing angle.
  1167.  
  1168. newmtl fresnel_blu
  1169. Ka 0.0000 0.0000 0.0000
  1170. Kd 0.0000 0.0000 0.0000
  1171. Ks 0.6180 0.8760 0.1430
  1172. Ns 200
  1173. illum 5
  1174.  
  1175. 8 Real windshield
  1176.  
  1177. This material accurately represents a glass surface. It filters of
  1178. colorizes objects that are seen through it. Filtering is done according
  1179. to the transmission color of the material. The material also distorts
  1180. the image of objects according to its optical density. Note that the
  1181. material is not dissolved and that its ambient, diffuse, and specular
  1182. reflective colors have been set to black. Only the transmission color
  1183. is non-black.
  1184.  
  1185. newmtl real_windsh
  1186. Ka 0.0000 0.0000 0.0000
  1187. Kd 0.0000 0.0000 0.0000
  1188. Ks 0.0000 0.0000 0.0000
  1189. Tf 1.0000 1.0000 1.0000
  1190. Ns 200
  1191. Ni 1.2000
  1192. illum 6
  1193.  
  1194. 9 Fresnel windshield
  1195.  
  1196. This material combines the effects in examples 7 and 8.
  1197.  
  1198. newmtl fresnel_win
  1199. Ka 0.0000 0.0000 1.0000
  1200. Kd 0.0000 0.0000 1.0000
  1201. Ks 0.6180 0.8760 0.1430
  1202. Tf 1.0000 1.0000 1.0000
  1203. Ns 200
  1204. Ni 1.2000
  1205. illum 7
  1206.  
  1207. 10 Tin
  1208.  
  1209. This material is based on spectral reflectance samples taken from an
  1210. actual piece of tin. These samples are stored in a separate .rfl file
  1211. that is referred to by name in the material. Spectral sample files
  1212. (.rfl) can be used in any type of material as an alternative to RGB
  1213. values.
  1214.  
  1215. newmtl tin
  1216. Ka spectral tin.rfl
  1217. Kd spectral tin.rfl
  1218. Ks spectral tin.rfl
  1219. Ns 200
  1220. illum 3
  1221.  
  1222. 11 Pine Wood
  1223.  
  1224. This material includes a texture map of a pine pattern. The material
  1225. color is set to "ident" to preserve the texture's true color. When
  1226. applied to an object, this texture map will affect only the ambient and
  1227. diffuse regions of that object's surface.
  1228.  
  1229. The color information for the texture is stored in a separate .mpc file
  1230. that is referred to in the material by its name, "pine.mpc". If you use
  1231. different .mpc files for ambient and diffuse, you will get unrealistic
  1232. results.
  1233.  
  1234. newmtl pine_wood
  1235. Ka spectral ident.rfl 1
  1236. Kd spectral ident.rfl 1
  1237. illum 1
  1238. map_Ka pine.mpc
  1239. map_Kd pine.mpc
  1240.  
  1241. 12 Bumpy leather
  1242.  
  1243. This material includes a texture map of a leather pattern. The
  1244. material color is set to "ident" to preserve the texture's true color.
  1245. When applied to an object, it affects both the color of the object's
  1246. surface and its apparent bumpiness.
  1247.  
  1248. The color information for the texture is stored in a separate .mpc file
  1249. that is referred to in the material by its name, "brown.mpc". The bump
  1250. information is stored in a separate .mpb file that is referred to in the
  1251. material by its name, "leath.mpb". The -bm option is used to raise the
  1252. apparent height of the leather bumps.
  1253.  
  1254. newmtl bumpy_leath
  1255. Ka spectral ident.rfl 1
  1256. Kd spectral ident.rfl 1
  1257. Ks spectral ident.rfl 1
  1258. illum 2
  1259. map_Ka brown.mpc
  1260. map_Kd brown.mpc
  1261. map_Ks brown.mpc
  1262. bump -bm 2.000 leath.mpb
  1263.  
  1264. 13 Frosted window
  1265.  
  1266. This material includes a texture map used to alter the opacity of an
  1267. object's surface. The material color is set to "ident" to preserve the
  1268. texture's true color. When applied to an object, the object becomes
  1269. transparent in certain areas and opaque in others.
  1270.  
  1271. The variation between opaque and transparent regions is controlled by
  1272. scalar information stored in a separate .mps file that is referred to in
  1273. the material by its name, "window.mps". The "-mm" option is used to
  1274. shift and compress the range of opacity.
  1275.  
  1276. newmtl frost_wind
  1277. Ka 0.2 0.2 0.2
  1278. Kd 0.6 0.6 0.6
  1279. Ks 0.1 0.1 0.1
  1280. d 1
  1281. Ns 200
  1282. illum 2
  1283. map_d -mm 0.200 0.800 window.mps
  1284.  
  1285. 14 Shifted logo
  1286.  
  1287. This material includes a texture map which illustrates how a texture's
  1288. origin may be shifted left/right (the "u" direction) or up/down (the "v"
  1289. direction). The material color is set to "ident" to preserve the
  1290. texture's true color.
  1291.  
  1292. In this example, the original image of the logo is off-center to the
  1293. left. To compensate, the texture's origin is shifted back to the right
  1294. (the positive "u" direction) using the "-o" option to modify the origin.
  1295.  
  1296. Ka spectral ident.rfl 1
  1297. Kd spectral ident.rfl 1
  1298. Ks spectral ident.rfl 1
  1299. illum 2
  1300. map_Ka -o 0.200 0.000 0.000 logo.mpc
  1301. map_Kd -o 0.200 0.000 0.000 logo.mpc
  1302. map_Ks -o 0.200 0.000 0.000 logo.mpc
  1303.  
  1304. 15 Scaled logo
  1305.  
  1306. This material includes a texture map showing how a texture may be
  1307. scaled left or right (in the "u" direction) or up and down (in the "v"
  1308. direction). The material color is set to "ident" to preserve the
  1309. texture's true color.
  1310.  
  1311. In this example, the original image of the logo is too small. To
  1312. compensate, the texture is scaled slightly to the right (in the positive
  1313. "u" direction) and up (in the positive "v" direction) using the "-s"
  1314. option to modify the scale.
  1315.  
  1316. Ka spectral ident.rfl 1
  1317. Kd spectral ident.rfl 1
  1318. Ks spectral ident.rfl 1
  1319. illum 2
  1320. map_Ka -s 1.200 1.200 0.000 logo.mpc
  1321. map_Kd -s 1.200 1.200 0.000 logo.mpc
  1322. map_Ks -s 1.200 1.200 0.000 logo.mpc
  1323.  
  1324. 16 Chrome with spherical reflection map
  1325.  
  1326. This illustrates a common use for local reflection maps (defined in a
  1327. material).
  1328.  
  1329. this material is highly reflective with no diffuse or ambient
  1330. contribution. Its reflection map is an image with silver streaks that
  1331. yields a chrome appearance when viewed as a reflection.
  1332.  
  1333. ka 0 0 0
  1334. kd 0 0 0
  1335. ks .7 .7 .7
  1336. illum 1
  1337. refl -type sphere chrome.rla
  1338.  
  1339.  
  1340. Illumination models
  1341.  
  1342. The following list defines the terms and vectors that are used in the
  1343. illumination model equations:
  1344.  
  1345. Term Definition
  1346.  
  1347. Ft Fresnel reflectance
  1348. Ft Fresnel transmittance
  1349. Ia ambient light
  1350. I light intensity
  1351. Ir intensity from reflected direction
  1352. (reflection map and/or ray tracing)
  1353. It intensity from transmitted direction
  1354. Ka ambient reflectance
  1355. Kd diffuse reflectance
  1356. Ks specular reflectance
  1357. Tf transmission filter
  1358.  
  1359. Vector Definition
  1360.  
  1361. H unit vector bisector between L and V
  1362. L unit light vector
  1363. N unit surface normal
  1364. V unit view vector
  1365.  
  1366. The illumination models are:
  1367.  
  1368. 0 This is a constant color illumination model. The color is the
  1369. specified Kd for the material. The formula is:
  1370.  
  1371. color = Kd
  1372.  
  1373. 1 This is a diffuse illumination model using Lambertian shading. The
  1374. color includes an ambient constant term and a diffuse shading term for
  1375. each light source. The formula is
  1376.  
  1377. color = KaIa + Kd { SUM j=1..ls, (N * Lj)Ij }
  1378.  
  1379. 2 This is a diffuse and specular illumination model using Lambertian
  1380. shading and Blinn's interpretation of Phong's specular illumination
  1381. model (BLIN77). The color includes an ambient constant term, and a
  1382. diffuse and specular shading term for each light source. The formula
  1383. is:
  1384.  
  1385. color = KaIa
  1386. + Kd { SUM j=1..ls, (N*Lj)Ij }
  1387. + Ks { SUM j=1..ls, ((H*Hj)^Ns)Ij }
  1388.  
  1389. 3 This is a diffuse and specular illumination model with reflection
  1390. using Lambertian shading, Blinn's interpretation of Phong's specular
  1391. illumination model (BLIN77), and a reflection term similar to that in
  1392. Whitted's illumination model (WHIT80). The color includes an ambient
  1393. constant term and a diffuse and specular shading term for each light
  1394. source. The formula is:
  1395.  
  1396. color = KaIa
  1397. + Kd { SUM j=1..ls, (N*Lj)Ij }
  1398. + Ks ({ SUM j=1..ls, ((H*Hj)^Ns)Ij } + Ir)
  1399.  
  1400. Ir = (intensity of reflection map) + (ray trace)
  1401.  
  1402. 4 The diffuse and specular illumination model used to simulate glass
  1403. is the same as illumination model 3. When using a very low dissolve
  1404. (approximately 0.1), specular highlights from lights or reflections
  1405. become imperceptible.
  1406.  
  1407. Simulating glass requires an almost transparent object that still
  1408. reflects strong highlights. The maximum of the average intensity of
  1409. highlights and reflected lights is used to adjust the dissolve factor.
  1410. The formula is:
  1411.  
  1412. color = KaIa
  1413. + Kd { SUM j=1..ls, (N*Lj)Ij }
  1414. + Ks ({ SUM j=1..ls, ((H*Hj)^Ns)Ij } + Ir)
  1415.  
  1416. 5 This is a diffuse and specular shading models similar to
  1417. illumination model 3, except that reflection due to Fresnel effects is
  1418. introduced into the equation. Fresnel reflection results from light
  1419. striking a diffuse surface at a grazing or glancing angle. When light
  1420. reflects at a grazing angle, the Ks value approaches 1.0 for all color
  1421. samples. The formula is:
  1422.  
  1423. color = KaIa
  1424. + Kd { SUM j=1..ls, (N*Lj)Ij }
  1425. + Ks ({ SUM j=1..ls, ((H*Hj)^Ns)Ij Fr(Lj*Hj,Ks,Ns)Ij} +
  1426. Fr(N*V,Ks,Ns)Ir})
  1427.  
  1428.  
  1429. 6 This is a diffuse and specular illumination model similar to that
  1430. used by Whitted (WHIT80) that allows rays to refract through a surface.
  1431. The amount of refraction is based on optical density (Ni). The
  1432. intensity of light that refracts is equal to 1.0 minus the value of Ks,
  1433. and the resulting light is filtered by Tf (transmission filter) as it
  1434. passes through the object. The formula is:
  1435.  
  1436. color = KaIa
  1437. + Kd { SUM j=1..ls, (N*Lj)Ij }
  1438. + Ks ({ SUM j=1..ls, ((H*Hj)^Ns)Ij } + Ir)
  1439. + (1.0 - Ks) TfIt
  1440.  
  1441. 7 This illumination model is similar to illumination model 6, except
  1442. that reflection and transmission due to Fresnel effects has been
  1443. introduced to the equation. At grazing angles, more light is reflected
  1444. and less light is refracted through the object. The formula is:
  1445.  
  1446. color = KaIa
  1447. + Kd { SUM j=1..ls, (N*Lj)Ij }
  1448. + Ks ({ SUM j=1..ls, ((H*Hj)^Ns)Ij Fr(Lj*Hj,Ks,Ns)Ij} +
  1449. Fr(N*V,Ks,Ns)Ir})
  1450.  
  1451. + (1.0 - Kx)Ft (N*V,(1.0-Ks),Ns)TfIt
  1452.  
  1453. 8 This illumination model is similar to illumination model 3 without
  1454. ray tracing. The formula is:
  1455.  
  1456. color = KaIa
  1457. + Kd { SUM j=1..ls, (N*Lj)Ij }
  1458. + Ks ({ SUM j=1..ls, ((H*Hj)^Ns)Ij } + Ir)
  1459.  
  1460. Ir = (intensity of reflection map)
  1461.  
  1462. 9 This illumination model is similar to illumination model 4without
  1463. ray tracing. The formula is:
  1464.  
  1465.  
  1466. color = KaIa
  1467. + Kd { SUM j=1..ls, (N*Lj)Ij }
  1468. + Ks ({ SUM j=1..ls, ((H*Hj)^Ns)Ij } + Ir)
  1469.  
  1470. Ir = (intensity of reflection map)
  1471.  
  1472. 10 This illumination model is used to cast shadows onto an invisible
  1473. surface. This is most useful when compositing computer-generated
  1474. imagery onto live action, since it allows shadows from rendered objects
  1475. to be composited directly on top of video-grabbed images. The equation
  1476. for computation of a shadowmatte is formulated as follows.
  1477.  
  1478. color = Pixel color. The pixel color of a shadowmatte material is
  1479. always black.
  1480.  
  1481. color = black
  1482.  
  1483. M = Matte channel value. This is the image channel which typically
  1484. represents the opacity of the point on the surface. To store the shadow
  1485. in the matte channel of the image, it is calculated as:
  1486.  
  1487. M = 1 - W / P
  1488.  
  1489. where:
  1490.  
  1491. P = Unweighted sum. This is the sum of all S values for each light:
  1492.  
  1493. P = S1 + S2 + S3 + .....
  1494.  
  1495. W = Weighted sum. This is the sum of all S values, each weighted by
  1496. the visibility factor (Q) for the light:
  1497.  
  1498. W = (S1 * Q1) + (S2 * Q2) + .....
  1499.  
  1500. Q = Visibility factor. This is the amount of light from a particular
  1501. light source that reaches the point to be shaded, after traveling
  1502. through all shadow objects between the light and the point on the
  1503. surface. Q = 0 means no light reached the point to be shaded; it was
  1504. blocked by shadow objects, thus casting a shadow. Q = 1 means that
  1505. nothing blocked the light, and no shadow was cast. 0 < Q < 1 means that
  1506. the light was partially blocked by objects that were partially
  1507. dissolved.
  1508.  
  1509. S = Summed brightness. This is the sum of the spectral sample
  1510. intensities for a particular light. The samples are variable, but the
  1511. default is 3:
  1512.  
  1513. S = samp1 + samp2 + samp3.
  1514.  
  1515. Inspiration for this post is from Star Citizen Red_Raven
  1516. https://forums.robertsspaceindustries.com/discussion/comment/7613656/#Comment_7613656
  1517.  
  1518. Extra Notes:
  1519. Difference between Normal Map, Bump Map, Height Map
  1520. Source https://www.gamedev.net/topic/670621-normal-map-height-map-bump-map-are-all-the-same-thing/
  1521. "Normal maps and height maps are not the same thing. (Though it could be argued that bump map and height map are the same thing.) You could consider a normal map to instead be the derivative with respect to x (stored in red channel) and y (stored in green channel) of the bump map. Hence the reason that a bump map appears as a greyscale image and a normal map appears as the distinctive bluish-image (due to the blue component always being 1."
  1522.  
  1523. How to use Gloss maps in Cinema4D
  1524. Source https://forum.allegorithmic.com/index.php?topic=9757.0#msg48204
  1525. "
  1526. -delete the legacy specular layer
  1527. -create a new GGX layer
  1528. Specular:
  1529. -feed the specular into the Layer Color texture input
  1530. Glossiness:
  1531. -under the roughness bracket create a colorizer
  1532. -feed the glossiness map into the input
  1533. -invert the map by changing the gradient to white and black
  1534. GGX
  1535. -change the GGX properties, highlighted yellow on the image (see link above).
  1536. Tweak the roughness as well"
  1537. - MQ on allegorithmic forums.
  1538.  
  1539. Difference between Displacement Maps and Height Maps
  1540. Source https://gamedev.stackexchange.com/questions/65755/whats-the-difference-between-displacement-mapping-and-height-mapping
  1541. "Displacement Mapping: Is a technique that aims to render bumps as true geometry, in a very fine mesh. Unlike bump mapping, parallax, and relief mapping which tries to "fake" bumps using normal maps, Displacement mapping actually displaces the surface, creating triangles between the texels. .
  1542.  
  1543. Height Mapping: is the same thing, but it's usually used in the context where a displacement map (also called height map) is applied on a terrain where the value are only used to modify the vertex height."
  1544. -concept3D on gamedev stackexchange
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement