grt-talk
[Top][All Lists]
Advanced

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

Re: [grt-talk] textures


From: Nikodemus Siivola
Subject: Re: [grt-talk] textures
Date: Tue, 15 Apr 2003 22:12:45 +0300 (EEST)

On Tue, 15 Apr 2003, Simon Adameit wrote:

> The current modell makes it rather difficult to define new shading types
> or do other things with the textures.
> I think we should somehow redesign it. This would probably require some
> big changes, so I wanted to ask what you think about it and if you have
> any ideas.

You bet I've thought about it -- se below. Tell me what you think!

My comments in the just-recently-committed object.lisp:

;; Object struct should probably look like:
;;
;; (defstruct object
;;      shape
;;      texture
;;      shape-matrix
;;      texture-matrix)
;;
;; (defstruct shape
;;      intersect-first
;;      intersect-all
;;      normal
;;      inside)
;;
;; and ditto for texture. This way eg. all spheres could share the same
;; shape-struct, which would be very handy for implementing particle
;; systems, etc with *lots* of objects.

Where

(defstruct texture
   normal
   pigment
   filter
   transmit
   ior
   ambient
   diffuse
   reflect)

Thats a first-level solution in my mind: it anables us to treat the
texturing aspects of an object as a whole, without yet changing the overall
desing all that much. Pigment function just becomes :

 (funcall (texture-pigment (object-texture object)) point)

in stead of:

 (funcall (object-pigment object) point)

Nice and simple.

The second level solution would be to pass the ray-structure to the various
texturing functions instead of just the point: voila, we have
view-dependant textures, something not very many raytracers have...

The third level solution is to make the actual rendering function part of
the texture: a full blown shader based architecture. This would mean that
the initial ray would be traced into the scene, first intersection found,
and then:

  (funcall (object-shader object) ray scene)

This just sounds too simple to be truly workable. ,)=

  -- Nikodemus





reply via email to

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