POV-Ray : Newsgroups : povray.programming : Implementing a new pigment Server Time
24 Apr 2024 04:15:49 EDT (-0400)
  Implementing a new pigment (Message 3 to 12 of 12)  
<<< Previous 2 Messages Goto Initial 10 Messages
From: Nicolas Alvarez
Subject: Re: Implementing a new pigment
Date: 29 Nov 2008 10:20:19
Message: <49315db3@news.povray.org>
Chambers wrote:
>> -----Original Message-----
>> From: Nicolas Alvarez [mailto:nic### [at] gmailcom]
>> I want to know how do I go about implementing a new pigment type. It's
>> not a pattern, and it's not a new bitmap file format for image_map; I
>> have to get a x,y,z point as input and return a rgbt color.
> 
> Have you implemented it as a function in SDL?

No. I haven't implemented it yet :) Although I will surely start my C++
hacking by implementing a *very* simple pigment that you could just do in
SDL!

My final goal is something that I don't think is possible at all from SDL.


Post a reply to this message

From: Reactor
Subject: Re: Implementing a new pigment
Date: 29 Nov 2008 14:20:00
Message: <web.4931952ef92217e5a731690@news.povray.org>
Nicolas Alvarez <nic### [at] gmailcom> wrote:
> Chambers wrote:
> >> -----Original Message-----
> >> From: Nicolas Alvarez [mailto:nic### [at] gmailcom]
> >> I want to know how do I go about implementing a new pigment type. It's
> >> not a pattern, and it's not a new bitmap file format for image_map; I
> >> have to get a x,y,z point as input and return a rgbt color.
> >
> > Have you implemented it as a function in SDL?
>
> No. I haven't implemented it yet :) Although I will surely start my C++
> hacking by implementing a *very* simple pigment that you could just do in
> SDL!
>
> My final goal is something that I don't think is possible at all from SDL.

I think what Chambers meant is have you tried using a pigment-related function
in SDL.  You can use a custom function as your pigment pattern, and it can take
an x,y,z point (or x,y,z,t,a,b,c,...) and spit out a value to be used with a
color map.  This value is a float, not a vector, but you could have variation
of your function for each channel.

Then, there are also pigment functions, in which you can specify an x,y,z
coordinate, and a the color vector associated with that coordinate is returned.

Can you describe what the desired end result is?


-Reactor


Post a reply to this message

From: Nicolas Alvarez
Subject: Re: Implementing a new pigment
Date: 29 Nov 2008 14:30:46
Message: <49319865@news.povray.org>
Reactor wrote:
> Can you describe what the desired end result is?

Hmm fine...

Ability to use a svg in a pigment, like an image_map, without first
rendering it as a fixed-resolution bitmap.

If you think that's possible from SDL, you're welcome to try :)


Post a reply to this message

From: Reactor
Subject: Re: Implementing a new pigment
Date: 29 Nov 2008 15:30:00
Message: <web.4931a5a6f92217108f18ce0@news.povray.org>
Nicolas Alvarez <nic### [at] gmailcom> wrote:
> Reactor wrote:
> > Can you describe what the desired end result is?
>
> Hmm fine...
>
> Ability to use a svg in a pigment, like an image_map, without first
> rendering it as a fixed-resolution bitmap.
>
> If you think that's possible from SDL, you're welcome to try :)

Offhand, I'd probably make a macro to read the SVG file and produce and object
for use with the an object pigment.  That way, you have the arbitrary
resolution that the SVG file permits, and you could, in theory, implement just
about all of the features that SVG 1.2 has.


-Reactor


Post a reply to this message

From: Nicolas Alvarez
Subject: Re: Implementing a new pigment
Date: 29 Nov 2008 16:03:08
Message: <4931ae0c@news.povray.org>
Reactor wrote:
> Offhand, I'd probably make a macro to read the SVG file and produce and
> object
> for use with the an object pigment.  That way, you have the arbitrary
> resolution that the SVG file permits, and you could, in theory, implement
> just about all of the features that SVG 1.2 has.

There is no object pigment, just an object pattern.

And I hope you didn't mean "macro" as in "POV-Ray #macro". It would be
*hell* to try parsing XML from SDL!


Post a reply to this message

From: Reactor
Subject: Re: Implementing a new pigment
Date: 29 Nov 2008 16:35:00
Message: <web.4931b488f92217108f18ce0@news.povray.org>
Nicolas Alvarez <nic### [at] gmailcom> wrote:
> Reactor wrote:
> > Offhand, I'd probably make a macro to read the SVG file and produce and
> > object
> > for use with the an object pigment.  That way, you have the arbitrary
> > resolution that the SVG file permits, and you could, in theory, implement
> > just about all of the features that SVG 1.2 has.
>
> There is no object pigment, just an object pattern.
>
> And I hope you didn't mean "macro" as in "POV-Ray #macro". It would be
> *hell* to try parsing XML from SDL!

Sorry, that is what I meant, object pattern.  Since you could use a full pigment
for list item A and B, you could, in theory, make it do whatever you need,
including use the colors from the SVG.

I did mean parsing from SDL, I only recommended it because I don't know what
other languages you know.  That being said, an SVG reading script would be very
nice for your purposes and others, if you add it to the library.  I know this
came up before when someone was using InkScape as a path editor for lathe and
prism objects by reading the SVG file.

-Reactor


Post a reply to this message

From: Nicolas Alvarez
Subject: Re: Implementing a new pigment
Date: 29 Nov 2008 17:42:12
Message: <4931c543@news.povray.org>
Reactor wrote:
> I did mean parsing from SDL, I only recommended it because I don't know
> what other languages you know.

I'm good at C++, not quite good enough at understanding foreign code, and
bad enough at maths to not understand most of POV-Ray code :D


Post a reply to this message

From: Nicolas Alvarez
Subject: Re: Implementing a new pigment
Date: 29 Nov 2008 23:33:01
Message: <4932177c@news.povray.org>
Nicolas Alvarez wrote:
> I want to know how do I go about implementing a new pigment type. It's not
> a pattern, and it's not a new bitmap file format for image_map; I have to
> get a x,y,z point as input and return a rgbt color.
> 
> Would be also good if someone could give me some basic pointers on where
> to start modifying the parser to read parameters for it (although that's
> kind of low priority, especially considering I have yet to look at the
> parser code).

I want to report I got a very basic pigment working in like 15 minutes.

sphere {
  <0,0.5,0>,0.5
  pigment {
    my_test
  }
}

Renders a green sphere. "my_test" is a new keyword, not a pre-#declared
pigment. The code that calculates the pigment color is pretty simple:

      case MY_PATTERN:
        Make_Colour(Colour, 0.0, 1.0, 0.0);
        Colour_Found = true;
        break;


Post a reply to this message

From: SharkD
Subject: Re: Implementing a new pigment
Date: 13 Jan 2009 04:35:00
Message: <web.496c5fa5f92217f88f00350@news.povray.org>
"Reactor" <rea### [at] hotmailcom> wrote:
> Sorry, that is what I meant, object pattern.  Since you could use a full pigment
> for list item A and B, you could, in theory, make it do whatever you need,
> including use the colors from the SVG.
>
> I did mean parsing from SDL, I only recommended it because I don't know what
> other languages you know.  That being said, an SVG reading script would be very
> nice for your purposes and others, if you add it to the library.  I know this
> came up before when someone was using InkScape as a path editor for lathe and
> prism objects by reading the SVG file.
>
> -Reactor

I would be very interested in such a macro or tool.

-Mike


Post a reply to this message

From: SharkD
Subject: Re: Implementing a new pigment
Date: 13 Jan 2009 04:45:01
Message: <web.496c6186f92217f88f00350@news.povray.org>
"SharkD" <nomail@nomail> wrote:
> I would be very interested in such a macro or tool.
>
> -Mike

In fact, it could be split up into two projects: a library of primitives/macros
that provide the same functionality as SVG, and a converter to convert between
the formats.

I would be willing to give it a go if you guys would be willing to get the ball
rolling by doing some brainstorming on how to create the primitives.

-Mike


Post a reply to this message

<<< Previous 2 Messages Goto Initial 10 Messages

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