POV-Ray : Newsgroups : povray.pov4.discussion.general : filter transmit only with 256 color depth : Re: filter transmit only with 256 color depth Server Time
6 Dec 2021 11:52:45 EST (-0500)
  Re: filter transmit only with 256 color depth  
From: Kenneth
Date: 20 Oct 2021 02:45:00
Message: <web.616fb90cde29d7324cef624e6e066e29@news.povray.org>
I happen to be working with 'transmit' and 'transmit all' at the moment, so I'll
try to help.

[I am running POV-ray v3.8.0 beta 1, but most of the following applies to v3.7
as well; I tested it.)

> So my question is, how can I specify a 256-bit PNG as the output file type?
> It looks like the option +Fxn,  +FP256   Am I on the right track here?

I'm a little confused about your question. If you want a 256-color PNG-- kind of
'like a GIF' with a very limited color palette-- then no, it would be 2, not
256. (I.e., 2 to the 8th power is 256.) But if you want the standard 256-bits
*per color*, then it should be 8, as JR mentioned.

> I'm simulating a color film transparency laid upon a surface or another
> transparency. Image maps with ambient <1.0 1.0 1.0>, viewed from overhead.
>
> So I have been struggling with poor results from "filter all 1.0" and
> "transmit all 1.0" after my pigment image_map of jpg or png with or without
> alpha channel.

Unfortunately, 'transmit all' has had problems in the past, particularly with
alpha-channel image_maps; that was during the early v3.7 days. But the problems
were fixed by one of the developers in 2016, in one of the 3.71-alpha versions.
For a discussion of that, see...

https://news.povray.org/povray.binaries.images/thread/%3Cweb.5690126895214779ad6fa18f0%40news.povray.org%3E/

But there is an interesting workaround for you variable-transparency problem, IF
I understand what you are trying to do. It does not use 'transmit all', but
instead uses a pigment_map with 'transmit --some value--' (assuming you are
using your original images, not GIFs, and that you have pre-#declared one of
your images):

Example:
#declare IMG_1 = // this will ultimately be the faded-out image
pigment{image_map{jpeg "my_image_1.jpg" interpolate 2}}

#declare MY_TEX_1 =
texture{
pigment{
      average
      pigment_map{
           [1 IMG_1]
           [.5 transmit 1]
                 }
       }
finish {...whatever...}
}

This makes the image_map 25% transparent (or maybe 33%?) because of the average
of the two pigment_map 'weights' of 1 and .5. It also works with alpha-channel
images. Surprisingly, 'transmit' can be successfully used here, even though your
image_map probably has the standard 16-million colors. And just as surprisingly,
'transmit all' does NOT work here.

You can vary the two weights to get some other translucency, of course.

Then for your simpler non-faded underlying image, #declare that one as a similar
texture, MY_TEX_2 (but no pigment_map or average for this one, of course.)

Then combine both textures on your box object, or whatever you are using for the
surface:

box{0, <1,1,0> // a zero-thickness box actually works
texture{MY_TEX_2} // the 'base' image and texture, opague
texture{MY_TEX_1} // the semi-transparent image texture
}

(you may have to rotate these by 90-deg, if you're aiming your camera downward).

I hope this helps; if it's unclear, just ask.

------
Strangely, I am getting inconsistent results with 'transmit all' even in v3.8.0
beta 1. It *should* work with any type of image_map-- JPEG, PNG, TIFF etc-- like
the documentation states in

3.6.2.6.3 The Filter and Transmit Bitmap Modifiers:
"You can give the entire image a filter or transmit value using filter all
Amount or transmit all Amount. For example:
image_map {
  gif "stnglass.gif"
  filter all 0.9
  }
"

However, *sometimes* it works, sometimes it does not, and I have no idea why.
I've used it successfully many times in somewhat older versions of POV-ray, so
my current results are rather strange.


Post a reply to this message

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