POV-Ray : Newsgroups : povray.newusers : transmit question Server Time
5 Nov 2024 09:23:33 EST (-0500)
  transmit question (Message 1 to 10 of 11)  
Goto Latest 10 Messages Next 1 Messages >>>
From: Kneb
Subject: transmit question
Date: 29 Jan 2004 21:24:01
Message: <4019c041@news.povray.org>
If I have declared an object earlier in a file, how can I change the
object's transparency when I'm using it in a pov scene?  For example:
#include "colors.inc"
global_settings{assumed_gamma 1.0}
camera{location <2,3,-7> look_at 0}
light_source{<10,20,-10> rgb 1 parallel point_at 0}
plane{y,-2 pigment{color Green}}
#declare SillyObject=union {
   box{<-2,-2,-.5>,<2,2,.5> pigment{color Blue}}
   box{<-.5,-2,-2>,<.5,2,2> pigment{color Blue}}
   cylinder{y*2,y*2.5,.25 pigment{color Red}}
}
object{SillyObject //transmit .5 <==this is what I've been trying to use
}

I would define a variable for SillyObject's pigment, except in real life
SillyObject is defined in an include file, and also its components are
different colors, so it isn't convenient to make its transparency dependent
on a variable.  Can I change aspects of its color in the scene without
having a variable to refer to the color?
Thanks,
Kneb


Post a reply to this message

From: kurtz le pirate
Subject: Re: transmit question
Date: 30 Jan 2004 02:55:42
Message: <401a0dfe$1@news.povray.org>

news:4019c041@news.povray.org...
> If I have declared an object earlier in a file, how can I change the
> object's transparency when I'm using it in a pov scene?  For example:
> #include "colors.inc"
> global_settings{assumed_gamma 1.0}
> camera{location <2,3,-7> look_at 0}
> light_source{<10,20,-10> rgb 1 parallel point_at 0}
> plane{y,-2 pigment{color Green}}
> #declare SillyObject=union {
>    box{<-2,-2,-.5>,<2,2,.5> pigment{color Blue}}
>    box{<-.5,-2,-2>,<.5,2,2> pigment{color Blue}}
>    cylinder{y*2,y*2.5,.25 pigment{color Red}}
> }
> object{SillyObject //transmit .5 <==this is what I've been trying to use
> }
>
> I would define a variable for SillyObject's pigment, except in real life
> SillyObject is defined in an include file, and also its components are
> different colors, so it isn't convenient to make its transparency
dependent
> on a variable.  Can I change aspects of its color in the scene without
> having a variable to refer to the color?
> Thanks,
> Kneb

-- in the include file :
#if undefined(SillyObjectTransmitValue)
    #declare SillyObjectTransmitValue  = 0.0;
#end

#declare SillyObject=union {
    box{<-2,-2,-.5>,<2,2,.5> pigment { color Blue transmit
SillyObjectTransmitValue }}
    box{<-.5,-2,-2>,<.5,2,2> pigment { color Blue  transmit
SillyObjectTransmitValue }}
    cylinder{y*2,y*2.5,.25 pigment { color Red transmit
SillyObjectTransmitValue }}
    }


-- in the main pov scene :
#declare SillyObjectTransmitValue = 0.6;
#include "theSillyObjectIncludeFile.inc"


hope that help !


Post a reply to this message

From: Marvin Taylor
Subject: Re: transmit question
Date: 30 Jan 2004 11:13:27
Message: <401a82a7$1@news.povray.org>
Kneb wrote:
 > If I have declared an object earlier in a file, how can I change the
 > object's transparency when I'm using it in a pov scene?

<snip>

 > Can I change aspects of its color in the scene without having
 > a variable to refer to the color?

By using #macro rather than #define you can pass the parameter rather 
than using a variable; hopefully this works for you.

Also, see "Complex see-through objects" in p.advanced-users.

Cheers,
Marvin

//==============================================================
// In header file:
#macro SillyObject(xmit)
union {
    box{<-2,-2,-.5>,<2,2,.5> pigment{color Blue transmit xmit}}
    box{<-.5,-2,-2>,<.5,2,2> pigment{color Blue transmit xmit}}
    cylinder{y*2,y*2.5,.25 pigment{color Red transmit xmit}}
}
#end

//==============================================================
// The source file...
#include "colors.inc"

global_settings{assumed_gamma 1.0}
camera{location <2,3,-7> look_at 0}
light_source{<10,20,-10> rgb 1 parallel point_at 0}
plane{y,-2 pigment{color Green}}


SillyObject(0.5) //transmit .5 <==this is what I've been trying to use


Post a reply to this message

From: Kneb
Subject: Re: transmit question
Date: 30 Jan 2004 18:20:07
Message: <401ae6a7@news.povray.org>
"Marvin Taylor" <pov### [at] maltasoftcom> wrote...
> By using #macro rather than #define you can pass the parameter rather
> than using a variable; hopefully this works for you.

Are there any significant differences between (a) passing the transmittance
as a parameter to a macro and using #macro, and (b) defining the
transmittance in the scene file and using #define?
Thanks,
Kneb


Post a reply to this message

From: Dan P
Subject: Re: transmit question
Date: 30 Jan 2004 22:07:54
Message: <401b1c0a$1@news.povray.org>
I think you may have sparked an idea on this question. There currently isn't
a way to refer to an object's components by using dot notation. In your
case, it would have been possible if only we could do something like this:

color object.pigment transmit 0.5

- or -

color object.pigment.red object.pigment.green object.pigment.blue transmit
0.5

Currently,
color transmit 0.5

is equivalent to

color red 0 green 0 blue 0 transmit 0.5

And, after digging a lot, I couldn't find a way to get the pigment from the
object without using a #define or #macro value. Maybe the next version of
PovRay could provide some "object introspection" that will allow us to refer
to specific components of an object?

Actually, I'm going to download the code and look at that one this weekend.
I don't expect that to be hard to do.

Thoughts?


Post a reply to this message

From: Christopher James Huff
Subject: Re: transmit question
Date: 31 Jan 2004 11:55:09
Message: <cjameshuff-36B898.11551131012004@news.povray.org>
In article <401ae6a7@news.povray.org>, "Kneb" <cal### [at] yahoocom> 
wrote:

> Are there any significant differences between (a) passing the transmittance
> as a parameter to a macro and using #macro, and (b) defining the
> transmittance in the scene file and using #define?

It makes no difference whatsoever to the rendering. However, passing it 
as a macro parameter will allow you to make multiple versions with 
different amounts of transparency, defining it as a variable restricts 
you to that one transparency setting.

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: <chr### [at] tagpovrayorg>
http://tag.povray.org/


Post a reply to this message

From: Christopher James Huff
Subject: Re: transmit question
Date: 31 Jan 2004 12:04:39
Message: <cjameshuff-31C731.12044131012004@news.povray.org>
In article <401b1c0a$1@news.povray.org>,
 "Dan P" <dan### [at] yahoocom> wrote:

> Actually, I'm going to download the code and look at that one this weekend.
> I don't expect that to be hard to do.

It's a bit more difficult than you seem to think. Mainly because there 
are so many different objects. A sphere has a radius and center, but you 
can't get those from a box. To work this into the existing parser, you 
would have to write special cases for every object, pigment type, 
pattern, etc, etc, etc...

A better option might be a framework written in an object oriented 
language that overlays the POV language. I have been working on such a 
framework for Sapphire, my own experimental language. Because everything 
is just a language object until it's converted into a form POV can 
understand, you don't have to have special cases for every little thing. 
If an object has a radius member, you can access it...doesn't matter if 
its a sphere or cylinder, and there's no special code just for handling 
the radius member.

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: <chr### [at] tagpovrayorg>
http://tag.povray.org/


Post a reply to this message

From: Dan P
Subject: Re: transmit question
Date: 31 Jan 2004 15:27:17
Message: <401c0fa5$1@news.povray.org>
"Christopher James Huff" <cja### [at] earthlinknet> wrote in message
news:cjameshuff-31C731.12044131012004@news.povray.org...
> A better option might be a framework written in an object oriented
> language that overlays the POV language. I have been working on such a
> framework for Sapphire, my own experimental language. Because everything
> is just a language object until it's converted into a form POV can
> understand, you don't have to have special cases for every little thing.
> If an object has a radius member, you can access it...doesn't matter if
> its a sphere or cylinder, and there's no special code just for handling
> the radius member.

EXCELLENT! I look forward to seeing Sapphire.


Post a reply to this message

From: Christopher James Huff
Subject: Re: transmit question
Date: 31 Jan 2004 22:07:41
Message: <cjameshuff-F33787.22074431012004@news.povray.org>
In article <401c0fa5$1@news.povray.org>,
 "Dan P" <dan### [at] yahoocom> wrote:

> EXCELLENT! I look forward to seeing Sapphire.

You'd probably be better off implementing something similar in some 
other language...Sapphire is primarily an experimental language mainly 
created for me to have a nice language to prototype things in and to 
play with language design, and is unlikely to ever become popular. The 
next release will be a mostly functional alpha, though...whenever I 
finally get around to releasing it. I also have some patches I want to 
get out, some simulation projects (which depend on Sapphire, actually), 
a raytracer, and another language called Ember...not to mention college.

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: <chr### [at] tagpovrayorg>
http://tag.povray.org/


Post a reply to this message

From: Dan P
Subject: Re: transmit question
Date: 31 Jan 2004 22:18:10
Message: <401c6ff2$1@news.povray.org>
"Christopher James Huff" <cja### [at] earthlinknet> wrote in message
news:cjameshuff-F33787.22074431012004@news.povray.org...
> In article <401c0fa5$1@news.povray.org>,
>  "Dan P" <dan### [at] yahoocom> wrote:
>
> > EXCELLENT! I look forward to seeing Sapphire.
>
> You'd probably be better off implementing something similar in some
> other language...Sapphire is primarily an experimental language mainly
> created for me to have a nice language to prototype things in and to
> play with language design, and is unlikely to ever become popular. The
> next release will be a mostly functional alpha, though...whenever I
> finally get around to releasing it. I also have some patches I want to
> get out, some simulation projects (which depend on Sapphire, actually),
> a raytracer, and another language called Ember...not to mention college.

All great ideas have a start. Don't understimate yourself.


Post a reply to this message

Goto Latest 10 Messages Next 1 Messages >>>

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