grt-talk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[grt-talk] Shaders in 0.2


From: Nikodemus Siivola
Subject: [grt-talk] Shaders in 0.2
Date: Thu, 17 Jul 2003 12:02:13 +0300
User-agent: Mutt/1.5.4i

Hi,

Since I've been working on this mostly in isolation I figure that it's
about time I opened my mouth.

The role of shaders is most aptly illustrated by the new TRACE-RAY:

  (defun trace-ray (ray)
  (if (or (zerop (ray-depth ray))
          (> (scene-adaptive-limit *scene*) (ray-weight ray)))
      +black+
      (multiple-value-bind
            (object distance) (first-intersection ray)
        (cond (object
               (save-intersection ray object distance)
               (funcall (object-shader object) ray))
              (t
               (scene-background *scene*))))))


During the course of writing I've also discovered something I've
always wondered about:

 "Why are OpenGL and RenderMan so goddamn statefull?"

Unfortunately I cannot really verbalize by newfound understanding, but
must conclude that in this kind of a design it really is the way to
go.

And in case of Common Lisp this state is captured by special
variables, and mostly modified only stack-locally (with LET), which is
actually quite nice -- especially when contrasted by RenderMan's
*Begin() and *End() style.

I've been debating what to put in our graphics state and what
not. Since I do not trust my design skill and premonition as well as
some I have opeted for ad-hoc minimalism: keeping the state as small
as possible, containing what _seems_ to make sense.

I'm quite confident that the state won't survive as-is to 1.0, but I
am also equally confident that as we gain experience with it and our
new architecture we will end up with a much better design than we
would if I just daydreamed something that _looks_ complete.

Cheers,

 -- Nikodemus

Attachment: pgpn74dFcTs4U.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]