POV-Ray : Newsgroups : povray.general : Texturing the inside of a hollow hemisphere Server Time
1 Nov 2024 23:14:08 EDT (-0400)
  Texturing the inside of a hollow hemisphere (Message 1 to 10 of 12)  
Goto Latest 10 Messages Next 2 Messages >>>
From: Jonsku
Subject: Texturing the inside of a hollow hemisphere
Date: 10 Sep 2010 10:10:01
Message: <web.4c8a3af487a9d0ce5dbcd8250@news.povray.org>
Hello, this is my first post here!

I'm working on a project to be displayed in a full-dome planetarium. I rendered
some test animation that I haven't had the opportunity to see in the planetarium
yet. However I tought it would be nice to create a simulation with our favorite
ray tracer.

What I have done so far is to write a macro to build a dome model like so :

#macro dome(position, rayon, insideTexture, outsideTexture)
    difference{
        difference{
            sphere{position, rayon*1.11 texture{outsideTexture}}
            sphere{position, rayon texture{insideTexture}}

        }
        box{position-<rayon*1.11,0,rayon*1.11>,
position+<rayon*1.11,rayon*1.11,rayon*1.11>}
    }
#end

As you can see it is made of a sphere hollowed out by another smaller one and
then cut in two by a box.

I'm calling this macro from inside an object so I can apply rotation, scalling,
etc.. if needed from there :

object {
    dome(<0,0,0>, 1, insideT, outsideT)
    rotate x*180
}

The outside texture declaration (a simple colour pigment):
#declare outsideT = texture{
    pigment{color Green}
}

This is working well, but now I'm having troubles figuring out how to texture
the inside of the dome. At the moment my texture declaration that I pass to the
macro as "insideTexture" is as follow :

#declare insideT = texture{
    pigment{
        uv_mapping
        image_map{png "data/FisheyeTest.png"}
    }
}

where FisheyeTest.png is a square image (ratio width/height = 1/1) rendered with
POV-Ray using the fisheye camera.

The texture shows up but it is not set up properly. I tried different rotation,
map_type, but no luck so far.

I'm really stuck, could someone please help me?

Best regards,
Jonsku


Post a reply to this message

From: Jim Holsenback
Subject: Re: Texturing the inside of a hollow hemisphere
Date: 10 Sep 2010 11:46:58
Message: <4c8a52f2$1@news.povray.org>
On 09/10/2010 11:04 AM, Jonsku wrote:
> Hello, this is my first post here!
> 
> I'm working on a project to be displayed in a full-dome planetarium. I rendered
> some test animation that I haven't had the opportunity to see in the planetarium
> yet. However I tought it would be nice to create a simulation with our favorite
> ray tracer.
> 
> What I have done so far is to write a macro to build a dome model like so :
> 
> #macro dome(position, rayon, insideTexture, outsideTexture)
>     difference{
>         difference{
>             sphere{position, rayon*1.11 texture{outsideTexture}}
>             sphere{position, rayon texture{insideTexture}}
> 
>         }
>         box{position-<rayon*1.11,0,rayon*1.11>,
> position+<rayon*1.11,rayon*1.11,rayon*1.11>}
>     }
> #end
> 
> As you can see it is made of a sphere hollowed out by another smaller one and
> then cut in two by a box.
> 
> I'm calling this macro from inside an object so I can apply rotation, scalling,
> etc.. if needed from there :
> 
> object {
>     dom, insideT, outsideT)
>     rotate x*180
> }
> 
> The outside texture declaration (a simple colour pigment):
> #declare outsideT = texture{
>     pigment{color Green}
> }
> 
> This is working well, but now I'm having troubles figuring out how to texture
> the inside of the dome. At the moment my texture declaration that I pass to the
> macro as "insideTexture" is as follow :
> 
> #declare insideT = texture{
>     pigment{
>         uv_mapping
>         image_map{png "data/FisheyeTest.png"}
>     }
> }
> 
> where FisheyeTest.png is a square image (ratio width/height = 1/1) rendered with
> POV-Ray using the fisheye camera.
> 
> The texture shows up but it is not set up properly. I tried different rotation,
> map_type, but no luck so far.
> 
> I'm really stuck, could someone please help me?
> 
> Best regards,
> Jonsku

If I'm understanding ... Instead of applying textures in the macro
(during the difference) I'd use interior_texture:

object {
  dome (parameters)
  texture {outsideT}
  interior_texture {insideT}
  }


Post a reply to this message

From: Kenneth
Subject: Re: Texturing the inside of a hollow hemisphere
Date: 10 Sep 2010 16:10:00
Message: <web.4c8a9005e8b7098e196b08580@news.povray.org>
Since you're trying to keep all of the textures as part of your macro (and not
added later), here's an idea (I haven't tried it though) that uses Jim's
suggestion of inside_texture, but done differently:

#macro dome(position, rayon, insideTexture, outsideTexture)
     difference{
       difference{
           sphere{position, rayon*1.11 texture{outsideTexture}}
           sphere{position, rayon
                texture{pigment{rgb .5}} // any color at all, for the 'outside'
                                         // of this dome shape
                texture{insideTexture}
         }
         box{position-<rayon*1.11,0,rayon*1.11>,
 position+<rayon*1.11,rayon*1.11,rayon*1.11>}
     }
 #end

Due to the fact that, for any object, an inside_texture needs a preceding
texture (an 'outside' one) to work at all, the idea is that the 'outside' of the
'inner' dome shape gets some kind of arbitrary texture first (which will not be
seen in your case--hopefully!), *then* an inside_texture can be applied to it.

Again, just a suggestion; I'd be curious to know if it works!

Ken W.


Post a reply to this message

From: Kenneth
Subject: Re: Texturing the inside of a hollow hemisphere
Date: 10 Sep 2010 16:20:01
Message: <web.4c8a9236e8b7098e196b08580@news.povray.org>
"Kenneth" <kdw### [at] earthlinknet> wrote:

Oops, I made a dumb mistake there. The macro textures should be like this...

#macro dome(position, rayon, insideTexture, outsideTexture)
     difference{
       difference{
           sphere{position, rayon*1.11 texture{outsideTexture}}
           sphere{position, rayon
                texture{pigment{rgb .5}} // any color at all, for the 'outside'
                                         // of this dome shape
                interior_texture{insideTexture}
                 }
         box{position-<rayon*1.11,0,rayon*1.11>,
 position+<rayon*1.11,rayon*1.11,rayon*1.11>}
     }
 #end


Post a reply to this message

From: Jonsku
Subject: Re: Texturing the inside of a hollow hemisphere
Date: 10 Sep 2010 18:30:01
Message: <web.4c8ab11be8b7098e7600f1860@news.povray.org>
>
> If I'm understanding ... Instead of applying textures in the macro
> (during the difference) I'd use interior_texture:
>
> object {
>   dome (parameters)
>   texture {outsideT}
>   interior_texture {insideT}
>   }

Thank you for your answer.
Unfortunately it does not work. The inside and the outside are now both textured
by outsideT.


Post a reply to this message

From: Jonsku
Subject: Re: Texturing the inside of a hollow hemisphere
Date: 10 Sep 2010 19:10:01
Message: <web.4c8ab6b5e8b7098e7600f1860@news.povray.org>
"Kenneth" <kdw### [at] earthlinknet> wrote:
> Since you're trying to keep all of the textures as part of your macro (and not
> added later), here's an idea (I haven't tried it though) that uses Jim's
> suggestion of inside_texture, but done differently:
>
> #macro dome(position, rayon, insideTexture, outsideTexture)
>      difference{
>        difference{
>            sphere{position, rayon*1.11 texture{outsideTexture}}
>            sphere{position, rayon
>                 texture{pigment{rgb .5}} // any color at all, for the 'outside'
>                                          // of this dome shape
>                 texture{insideTexture}
>          }
>          box{position-<rayon*1.11,0,rayon*1.11>,
>  position+<rayon*1.11,rayon*1.11,rayon*1.11>}
>      }
>  #end
>
> Due to the fact that, for any object, an inside_texture needs a preceding
> texture (an 'outside' one) to work at all, the idea is that the 'outside' of the
> 'inner' dome shape gets some kind of arbitrary texture first (which will not be
> seen in your case--hopefully!), *then* an inside_texture can be applied to it.
>
> Again, just a suggestion; I'd be curious to know if it works!
>
> Ken W.

Thanks, I gave it a try but this result in only the grey color (rgb .5) showing
up in the inside of the hemisphere...

I think my macro :
#macro dome(position, rayon, insideTexture, outsideTexture)
    difference{
        difference{
            sphere{position, rayon*1.11 texture{outsideTexture}}
            sphere{position, rayon texture{insideTexture}}

        }
        box{position-<rayon*1.11,0,rayon*1.11>,
position+<rayon*1.11,rayon*1.11,rayon*1.11>}
    }
#end

is not the problem because it does produce a dome with 2 different textures for
the outer surface and the inside surface.


I believe the problem is in the projection of the texture on the inside of the
dome. I should have made that clearer in the first post.

I can't find the proper texture definition. I tried different
parameters for the image_map but I'm going nowhere.

Pictures are worth thousands of words:

For instance, if I want to use this image as a texture:
http://imgur.com/C2fQp.gif

Here are some settings I tried :
NOTE: the black ring is the rim of the dome, the camera is looking straight into
the interior of the dome.

1)http://imgur.com/IGjYT.png
texture{
    pigment{
    uv_mapping
        image_map{gif "data/grid.gif"}
    }
}


and it produce the same result as

texture{
    pigment{
        image_map{gif "data/grid.gif" map_type 1}
    }
}

where map_type 1 is a spherical mapping.

2)http://imgur.com/Vna78.png
texture{
    pigment{
        image_map{gif "data/grid.gif"}
    }
}

3)http://imgur.com/7CPyk.png
texture{
    pigment{
        image_map{gif "data/grid.gif" once}
    }
}

In this case the texture doesn't show up, all you can see is the dark rim, which
I think is using data from the image_map. The green colour comes from the
outside part of the dome for some reason....



I hope this will make the problem clearer. I'm not very familiar with the
mathematics and the vocabulary involved here so please bare with me.

For reference : http://www.povray.org/documentation/view/3.6.1/408/

Regards,
Jonsku


Post a reply to this message

From: Kenneth
Subject: Re: Texturing the inside of a hollow hemisphere
Date: 11 Sep 2010 05:45:00
Message: <web.4c8b4ea7e8b7098e196b08580@news.povray.org>
"Jonsku" <nomail@nomail> wrote:


> 3)http://imgur.com/7CPyk.png
> texture{
>     pigment{
>         image_map{gif "data/grid.gif" once}
>     }
> }
>
> In this case the texture doesn't show up, all you can see is the dark rim,
> which I think is using data from the image_map. The green colour comes
> from the outside part of the dome for some reason....

Sorry for the mix-up; I re-read your original post and now understand what your
questions were.

Your 'once' example above leads me to think that the image_map may have been
translated *somewhere else* in space, no longer lining up with the dome. OR that
the dome was created in some location that doesn't match up with its applied
image_map. Looking at your macro in a more detailed way, I see a possible
problem (which may or may not be the cause of your troubles):

#macro dome(position, rayon, insideTexture, outsideTexture)
    difference{
        difference{
            sphere{position, rayon*1.11 texture{outsideTexture}}
            sphere{position, rayon texture{insideTexture}}
....etc.

Depending on what values you use for *position* and *rayon*, you could be
creating a dome that, right from the start, doesn't line up with your image_map
texture.  For example, let's say *position* is chosen to be <3,5,8> and *rayon*
is 2.3--in such a case, /neither/ of the two textures is going to line up with
the dome. That's because the dome has already been translated (and scaled),
whereas the textures are being applied at their 'default'
positions/projections/scalings. (Textures don't automatically follow an object
that's been *created* somewhere other than at the origin.) So you would likewise
need to translate and scale the textures as well, if they are to 'follow' the
dome.

A better way to code the macro would be *something* like this--creating a
default-sized dome, applying the textures, *then* scaling and translating
everything afterward:

difference{
        difference{
            sphere{<0,0,0>,1.1 texture{outsideTexture}}
            sphere{<0,0,0>, 1 texture{insideTexture}}
                  }
        box{.....}
    scale rayon
    translate position
........


Post a reply to this message

From: Jonsku
Subject: Re: Texturing the inside of a hollow hemisphere
Date: 11 Sep 2010 05:45:01
Message: <web.4c8b4f49e8b7098e7600f1860@news.povray.org>
> I hope this will make the problem clearer. I'm not very familiar with the
> mathematics and the vocabulary involved here so please bare with me.

I've probably been living too long in Finland and is too fond of the sauna, but
please don't get naked!
This is going to make me laugh for a while :D


Post a reply to this message

From: Jonsku
Subject: Re: Texturing the inside of a hollow hemisphere
Date: 11 Sep 2010 07:35:01
Message: <web.4c8b683ee8b7098e7600f1860@news.povray.org>
"Kenneth" <kdw### [at] earthlinknet> wrote:
> Your 'once' example above leads me to think that the image_map may have been
> translated *somewhere else* in space, no longer lining up with the dome. OR that
> the dome was created in some location that doesn't match up with its applied
> image_map. Looking at your macro in a more detailed way, I see a possible
> problem (which may or may not be the cause of your troubles):
>
> #macro dome(position, rayon, insideTexture, outsideTexture)
>     difference{
>         difference{
>             sphere{position, rayon*1.11 texture{outsideTexture}}
>             sphere{position, rayon texture{insideTexture}}
> ....etc.
>
> Depending on what values you use for *position* and *rayon*, you could be
> creating a dome that, right from the start, doesn't line up with your image_map
> texture.  For example, let's say *position* is chosen to be <3,5,8> and *rayon*
> is 2.3--in such a case, /neither/ of the two textures is going to line up with
> the dome. That's because the dome has already been translated (and scaled),
> whereas the textures are being applied at their 'default'
> positions/projections/scalings. (Textures don't automatically follow an object
> that's been *created* somewhere other than at the origin.) So you would likewise
> need to translate and scale the textures as well, if they are to 'follow' the
> dome.

This is a good point, but as a matter of fact I was calling the macro like this
dome(<0,0,0>, 1, insideT, outsideT)

So the dome would have its center at the origin and an inner hemisphere of
radius 1.

I anyway tried your suggestion and I get the same results as before. But thanks
for raising this issue since it could have lead to other problems. I'll use the
modified macro now.

I still think that the culprit here is the texture projection onto the
hemisphere.

It is very possible that I have a too simple understanding on how fisheye
projection works, thus it might be useful if I list some of my assumptions:

1)The planetarium dome is a full-dome, which I suppose is equivalent to a
perfect hemisphere.

2)The dome projection system takes square frames as input


the inner surface of the dome.
NOTE:
At the planetarium they have a small dome in their production studio which use

the shows are presented - uses a more complicated system of 2 projectors with 3
channels each but I don't think this is relevant to the discussion.

4)To create images that won't be deformed by the projection system, one should
either shoot pictures/video/film with a camera equipped with a fisheye lens (it
is also possible to 'stitch' images together using software to get the same
effect)
OR
If the images are computer generated, use a virtual camera that mimick the
fisheye lens.
In this particular case, I'm using the 2nd option. The polar grid in the
previous example has no fisheye projection applied to it. Its purpose is to make
the problem more obvious.
In any case, here is an image file rendered with POV-Ray
fisheye camera: http://imgur.com/ubuxW.png

5)Simulating projection in the planetarium with POV-Ray, or another 3D renderer
or
ray tracer can be done by applying a texture to the inside of an hemisphere
which will cause the source image to be distorted like it was projected through
a fisheye lens.

Maybe I should try this with Blender and see how it goes. However I like the
control that comes with writing POV-Ray scenes so it would be great if I can get
it working there also.

Thanks again for your time. I'll keep you posted on my findings.

Regards,

Jonsku


Post a reply to this message

From: Jaime Vives Piqueres
Subject: Re: Texturing the inside of a hollow hemisphere
Date: 11 Sep 2010 08:32:39
Message: <4c8b76e7$1@news.povray.org>

> This is working well, but now I'm having troubles figuring out how to
> texture the inside of the dome. At the moment my texture declaration that
> I pass to the macro as "insideTexture" is as follow :
>
> #declare insideT = texture{ pigment{ uv_mapping image_map{png
> "data/FisheyeTest.png"} } }
>
> where FisheyeTest.png is a square image (ratio width/height = 1/1)
> rendered with POV-Ray using the fisheye camera.
>
> The texture shows up but it is not set up properly. I tried different
> rotation, map_type, but no luck so far.
>

   As it seems you are rendering the projected image with POV-Ray, I think
you will be better creating an equirectangular projection with a spherical
camera, and then loading it as an image_map with map_type 1.


Post a reply to this message

Goto Latest 10 Messages Next 2 Messages >>>

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