POV-Ray : Newsgroups : povray.newusers : How to declare a look_like light_source with various colors? Server Time
1 Jul 2024 00:48:46 EDT (-0400)
  How to declare a look_like light_source with various colors? (Message 1 to 3 of 3)  
From: JSmith
Subject: How to declare a look_like light_source with various colors?
Date: 27 Dec 2010 23:20:00
Message: <web.4d19644ee9c82239f14d496f0@news.povray.org>
Hi Users,

I would like to declare a light_source that looks_like a sphere.  My current
code is:

#declare flare =
    light_source {
        <0, 0, 0>
        color Yellow
        looks_like {
            sphere {
                <0, 0, 0>, 0.01
                texture {
                    pigment {color Yellow}
                    finish {ambient 1.0 diffuse 0.0}
                }
            }
        }
}

I would like to be able to do something like:

object { flare
         pigment { color Red }
}

and the color of the light_source and sphere be red.  How might I go about doing
this?

The idea is to use the flare object as the point like lights of a firework
burst.  Any hints or techniques would be greatly appreciated.

Thanks,
JS


Post a reply to this message

From: Warp
Subject: Re: How to declare a look_like light_source with various colors?
Date: 28 Dec 2010 02:55:20
Message: <4d1997e8@news.povray.org>
JSmith <nomail@nomail> wrote:
> I would like to be able to do something like:

> object { flare
>          pigment { color Red }
> }

  Make 'flare' a macro so that you can do it like:

object { flare(color Red) }

-- 
                                                          - Warp


Post a reply to this message

From: clipka
Subject: Re: How to declare a look_like light_source with various colors?
Date: 28 Dec 2010 03:53:14
Message: <4d19a57a$1@news.povray.org>
Am 28.12.2010 05:15, schrieb JSmith:
> Hi Users,
>
> I would like to declare a light_source that looks_like a sphere.  My current
> code is:
>
> #declare flare =
>      light_source {
>          <0, 0, 0>
>          color Yellow
>          looks_like {
>              sphere {
>                  <0, 0, 0>, 0.01
>                  texture {
>                      pigment {color Yellow}
>                      finish {ambient 1.0 diffuse 0.0}
>                  }
>              }
>          }
> }
>
> I would like to be able to do something like:
>
> object { flare
>           pigment { color Red }
> }
>
> and the color of the light_source and sphere be red.  How might I go about doing
> this?

Looks like a job for a macro:

#macro Flare(C)
   light_source {
     ...
     color C
     looks_like {
       ...
         color C
       ...
     }
   }
#end

object { Flare(Red) }

See the docs for more details on macros.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.