POV-Ray : Newsgroups : povray.programming : Implementing a new pigment Server Time
29 Mar 2024 09:06:03 EDT (-0400)
  Implementing a new pigment (Message 1 to 10 of 12)  
Goto Latest 10 Messages Next 2 Messages >>>
From: Nicolas Alvarez
Subject: Implementing a new pigment
Date: 28 Nov 2008 22:42:17
Message: <4930ba19@news.povray.org>
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've been reading 3.7 code. Congratulations and thanks on the new C++ified
structure of the primitive shapes, even if other stuff (like pigments) are
still C-ish :) I wonder what does the Post_Pigment function do? The 21-line
comment before it (like before every other function) is, as usual,
content-less, and I can't figure out its purpose (at least not at 1:30 am).


Post a reply to this message

From: Chambers
Subject: Re: Implementing a new pigment
Date: 28 Nov 2008 23:29:35
Message: <DDC568A49C774F7C91B4E481C946A2E3@HomePC>
> -----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?


...Ben Chambers
www.pacificwebguy.com


Post a reply to this message

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

Goto Latest 10 Messages Next 2 Messages >>>

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