Software

povray - "다양한 컴퓨터 플랫폼에서 사용할 수 있는 레이 트레이싱 프로그램" ?

crazyits 2022. 3. 30. 05:16
반응형

위 사진은 어딘가에서 본 사람도 있을 것이다. CPU 벤치마킹을 하는데 사용되어서 나오는 이미지이다.

pov-ray는 위키에는 "다양한 컴퓨터 플랫폼에서 사용할 수 있는 레이 트레이싱 프로그램"이라고 되어 있다.
이미지를 그리는 일반적인 방법은 마우스를 이용하거나 디지타이저(?) 같은 입력도구로 그린다.
하지만  pov-ray는 프로그래밍과 같은 방법을 취하고 있다.
SDL(Scene Description Language)이라는 언어를 가지고 조합하여 그림(?)을 그리고 랜더링하여 원하는 이미지를 만들게 된다.
C, C++과 비슷한 형태(?)를 가지고 있는 것 같지만 아니다.
유사하게만 보이고 실제 구조는 다르다.
C, C++은 중심이 되는 main()이라는 기준이 있지만 pov의 SDL에서는 그것이 없다.


#version 3.7;
// Includes a separate file defining a number of common colours
#include "colors.inc"
 global_settings { assumed_gamma 1.0 }

// Sets a background colour for the image (dark grey)
 background   { color rgb <0.25, 0.25, 0.25> }

// Places a camera
// direction: Sets, among other things, the field of view of the camera
// right: Sets the aspect ratio of the image
// look_at: Tells the camera where to look
 camera       { location  <0.0, 0.5, -4.0>
                direction 1.5*z
                right     x*image_width/image_height
                look_at   <0.0, 0.0, 0.0> }

// Places a light source
// color: Sets the color of the light source (white)
// translate: Moves the light source to a desired location
 light_source { <0, 0, 0>
                color rgb <1, 1, 1>
                translate <-5, 5, -5> }
// Places another light source
// color: Sets the color of the light source (dark grey)
// translate: Moves the light source to a desired location
 light_source { <0, 0, 0>
                color rgb <0.25, 0.25, 0.25>
                translate <6, -6, -6> }

// Sets a box
// pigment: Sets a color for the box ("Red" as defined in "colors.inc")
// finish: Sets how the surface of the box reflects light
// normal: Sets a bumpiness for the box using the "agate" in-built model
// rotate: Rotates the box
 box          { <-0.5, -0.5, -0.5>,
                <0.5, 0.5, 0.5>
                texture { pigment { color Red }
                          finish  { specular 0.6 }
                          normal  { agate 0.25 scale 1/2 }
                        }
                rotate <45,46,47> }

이미지를 그리는 구조는 간단(?) 하다.
카메라 배치
광원 배치
피사제 배치
그리고 랜더링을 하면 이미지를 생성하게 된다.
하지만 랜더링을 하기 전에 SDL에 대한 문법 검사를 하는데 이때 오류(error)가 있으면 랜더링을 할 수가 없다.
일반적인 그리기는 그냥 그리면 되는데 프로그래밍과 같은 방식이다 보니 '콤마' 하나만 잘 못 되어도 이미지가 나오지 않는다.

위에 있는 코드를 pov-ray에서 랜더링 하면 아래와 같은 이미지가 생성된다.


현재 버전은 윈도우 플랫폼은 인스톨러가 있어 그냥 설치를 하면 되고
다른 운영체제(linux, unix, mac)는 소스를 받아서 컴파일 하여 설치를 하여야 된다.
이전버전(3.6)은 컴파일된 버전이 있다.

pov-ray 3.7 윈도우 버전 다운로드
http://www.povray.org/ftp/pub/povray/Old-Versions/

반응형