|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
I have an object that simulates a generic computer screen using the `cells`
texture to generate a grid of random-colored pixelated blocks. I'd like to make
an animation of this where the "screen pixels" gradually change in color based
on the `clock` variable. Is there a simple way to do this?
My current idea is to somehow interpolate between two `cells` textures (by
displacing them relative to each other by some random integral offset) and doing
the equivalent of pigment1*clock + pigment2*(1-clock). So basically interpolate
between two random cells patterns according to the value of clock (or some other
such derived variable). But I can't figure out how to express this in SDL? Can
anyone help?
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"tutki" <nomail@nomail> wrote:
> I have an object that simulates a generic computer screen using the `cells`
> texture to generate a grid of random-colored pixelated blocks. I'd like to make
> an animation of this where the "screen pixels" gradually change in color based
> on the `clock` variable. Is there a simple way to do this?
>
> My current idea is to somehow interpolate between two `cells` textures (by
> displacing them relative to each other by some random integral offset) and doing
> the equivalent of pigment1*clock + pigment2*(1-clock). So basically interpolate
> between two random cells patterns according to the value of clock (or some other
> such derived variable). But I can't figure out how to express this in SDL? Can
> anyone help?
Hmmm.
Assuming that your cells pattern has a pigment_map associated with it ...
Why don't you change the definition of the pigments in the map by interpolating
between two rgb values per map entry?
Probably best to do this around the HSV wheel, rather than directly in
rgb-space, otherwise you usually cross through a gray-region....
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On 2/2/2022 4:25 PM, tutki wrote:
> I have an object that simulates a generic computer screen using the `cells`
> texture to generate a grid of random-colored pixelated blocks. I'd like to make
> an animation of this where the "screen pixels" gradually change in color based
> on the `clock` variable. Is there a simple way to do this?
>
> My current idea is to somehow interpolate between two `cells` textures (by
> displacing them relative to each other by some random integral offset) and doing
> the equivalent of pigment1*clock + pigment2*(1-clock). So basically interpolate
> between two random cells patterns according to the value of clock (or some other
> such derived variable). But I can't figure out how to express this in SDL? Can
> anyone help?
>
>
The cells pattern can be updated with the phase keyword. Use a color map
that doesn't blend colors and you can simulate blinking of colors.
Uncle Josh
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Josh English <Jos### [at] joshuarenglishcom> wrote:
> On 2/2/2022 4:25 PM, tutki wrote:
> > I have an object that simulates a generic computer screen using the `cells`
> > texture to generate a grid of random-colored pixelated blocks. I'd like to make
> > an animation of this where the "screen pixels" gradually change in color based
> > on the `clock` variable. Is there a simple way to do this?
> >
> > My current idea is to somehow interpolate between two `cells` textures (by
> > displacing them relative to each other by some random integral offset) and doing
> > the equivalent of pigment1*clock + pigment2*(1-clock). So basically interpolate
> > between two random cells patterns according to the value of clock (or some other
> > such derived variable). But I can't figure out how to express this in SDL? Can
> > anyone help?
> >
> >
> The cells pattern can be updated with the phase keyword. Use a color map
> that doesn't blend colors and you can simulate blinking of colors.
[...]
Oh nice, I didn't know `phase` works with `cells`.
But it doesn't solve my problem though: it doesn't smoothly interpolate between
colors, it just jumps around randomly. What I want is a way to smoothly
interpolate between one cells state and another. Perhaps some kind of shifting
color_map?
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Bald Eagle" <cre### [at] netscapenet> wrote:
[...]
> Assuming that your cells pattern has a pigment_map associated with it ...
>
> Why don't you change the definition of the pigments in the map by interpolating
> between two rgb values per map entry?
>
> Probably best to do this around the HSV wheel, rather than directly in
> rgb-space, otherwise you usually cross through a gray-region....
Yes, I have a pigment_map, mainly to convert the greyscale (well, scalar) values
of `cells` to some colors. Currently I have:
------
color_map {
[0.00 color Red]
[0.17 color Yellow]
[0.33 color Green]
[0.50 color Cyan]
[0.66 color Blue]
[0.83 color Magenta]
[1.00 color Red]
}
------
Problem though, is how to vary the color_map entries by `clock`?
P.S. Oh nevermind, just realized povray allows the color part of each entry to
be variable. So I could do something like Red + Green*clock, Green + Blue*clock,
etc., to get what I want.
Thanks for the idea!
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"tutki" <nomail@nomail> wrote:
> P.S. Oh nevermind, just realized povray allows the color part of each entry to
> be variable. So I could do something like Red + Green*clock, Green + Blue*clock,
> etc., to get what I want.
>
> Thanks for the idea!
Yes, you've got the idea. :)
You _might_ also think about using the same static pigments in the map, but vary
the map indices using the clock value...
colors.inc has a macro called CHSV2RGB in case the direct rgb variation doesn't
provide what you want.
https://wiki.povray.org/content/Reference:Colors.inc
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Bald Eagle" <cre### [at] netscapenet> wrote:
> "tutki" <nomail@nomail> wrote:
>
> > P.S. Oh nevermind, just realized povray allows the color part of each entry to
> > be variable. So I could do something like Red + Green*clock, Green + Blue*clock,
> > etc., to get what I want.
> >
> > Thanks for the idea!
>
> Yes, you've got the idea. :)
>
> You _might_ also think about using the same static pigments in the map, but vary
> the map indices using the clock value...
Huh, the map indices are allowed to be variable too?? Wow my grasp of SDL is a
lot weaker than I thought. :-D
> colors.inc has a macro called CHSV2RGB in case the direct rgb variation doesn't
> provide what you want.
>
> https://wiki.povray.org/content/Reference:Colors.inc
Ohh, that looks very useful, thanks!
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"tutki" <nomail@nomail> wrote:
> Huh, the map indices are allowed to be variable too?? Wow my grasp of SDL is a
> lot weaker than I thought. :-D
Sure - they are just "values". You can use a variable name, or an equation for
the index.
I will often do things with "lines" or bands of color that I want to control the
spread of across the color map, and I'll define a half-width (hw) of that
region, and then use n-hw and n+hw as index entries.
> > colors.inc has a macro called CHSV2RGB in case the direct rgb variation doesn't
> > provide what you want.
> >
> > https://wiki.povray.org/content/Reference:Colors.inc
>
> Ohh, that looks very useful, thanks!
Sure - color interpolation has been discussed at some length a few times in the
past. I find the HSV space to be useful since it is continuous in "colors" and
doesn't dip down into the grayscale regions.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Bald Eagle" <cre### [at] netscapenet> wrote:
>
> Probably best to do this around the HSV wheel, rather than directly in
> rgb-space, otherwise you usually cross through a gray-region....
>
> colors.inc has a macro called CHSV2RGB in case the direct rgb
> variation doesn't provide what you want.
>
> https://wiki.povray.org/content/Reference:Colors.inc
>
> ...color interpolation has been discussed at some length a few times in the
> past. I find the HSV space to be useful since it is continuous in "colors" and
> doesn't dip down into the grayscale regions.
I didn't know this either. Will investigate!
Thanks.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |