Action:
|
Creates an environment map by rendering.
|
|
Filename:
|
rbase/rnd_scm/emap_scm.cxx
|
|
APIs:
|
api_rh_render_cube_environment
|
|
Syntax:
|
(environment-map:render entities=all
|
|
|
resolution position)
|
|
Arg Types:
|
entities
|
entity | (entity ... )
|
|
resolution
|
integer
|
|
position
|
position
|
|
Returns:
|
environment-map
|
|
Description:
|
This extension creates an environment map by rendering six images of the specified entities as viewed from the specified position.
|
|
|
Rendering an environment map takes as long as rendering the image normally, and the image must be re-rendered using the displayed environment map. Therefore,
environment-map:render is efficient only when the image is redisplayed many times from the same viewpoint.
|
|
|
Environment maps simulate reflections that cannot be viewed in the
Basic Rendering Componentflat or
gouraud render modes. Use the
Advanced Rendering Component to view reflections.
|
|
|
An environmental map is an entity associated with rendering reflections. It may be thought of as the six faces of a cube surrounding a model. Each of the inward facing faces contains an image that is wrapped onto reflective objects during rendering. Therefore, environmental maps only provide direction reflections. Reflections of reflections require ray tracing rendering methods. Environmental maps are saved when the part is saved. It is represented in the form
#[entity m n], where
m refers to the entity and
n to the part.
|
|
|
entities specifies the entity-list to render; the default is all entities.
|
|
|
resolution specifies the width and height in pixels for the generated images.
|
|
|
position specifies the position to render the images.
|
|
Example:
|
; environment-map:render
|
|
; Create an environment map.
|
|
(define emap1
|
|
|
(environment-map:render (part:entities)
|
|
|
256 (position 0 0 0)))
|
|
;; emap1
|
|
; Render the environment map.
|
|
(render:set-environment-map emap1)
|
|
;; ()
|
|
; Define a sphere.
|
|
(define sphere1 (solid:sphere (position 0 0 0) 30))
|
|
;; sphere1
|
|
; Define a material.
|
|
(define matter1 (material))
|
|
;; matter1
|
|
; Set the reflection of the material.
|
|
(material:set-reflection-type matter1 "environment")
|
|
;; ()
|
|
; Set the material onto the sphere.
|
|
(entity:set-material sphere1 matter1)
|
|
;; ()
|
|
; Set the render mode to full.
|
|
(render:set-mode "full")
|
|
;; ()
|
|
; Render the image.
|
|
(render)
|
|
;; ()
|