![](/i/fill.gif) |
![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Howdy all! :-D
Right now I'm building a mame cabinet in POV-Ray and all is going well
so far.
I have the actual cabinet all pieced together in POV-Ray, but now I'm
going into the detail of things by adding joystick/buttons/etc.
What I'm having a problem with is getting an image mapped onto one of
the buttons properly. I just can't figure it out, so I'm kindly asking
if you could help me complete this small annoyance so that I may
continue to finish this project. On a side note, my friend and I are
actually building a mame cabinet, I'm just doing this in POV-Ray for fun :-)
So anyways...
I am trying to map
http://www.hostriot.com/072002/help-1.gif
onto the button as seen in this picture
http://www.hostriot.com/072002/help-2.gif
Here is the code snipplet.
#declare button =
union{
//base cylinder
cylinder{<0,0,0> <0,.5,0>,1.1 }
//rounded lower part of the button
difference{
sphere{<0,0,0>,1.2 }
box{<-5,.2,-5> <5,5,5>}
box{<-5,-5,-5> <5,0,5>}
translate .5*y
}
//The part of the button where finger is pushed on
difference{
cylinder{<0,.5,0> <0,1,0>,.9}
sphere{<0,2,0>,1.2 scale<1.1,1,1.1> }
}
//cutting a torus in half to make the round lip
difference{
torus{.8,.1 }
box{<-5,0,-5> <5,-5,5>}
translate 1*y
}
}
So where I have the cylinder being cut by the sphere (part where finger
is pushed on) I tried to map it there, but I couldn't figure out how to
make it show up correctly. Reading through the manual, very nicely done
for 3.5 by the way, I still couldn't get things working properly.
What I am trying to accomplish is getting that small player guy mapped
onto the button as to give it the appearance that it's been painted or
stickered on. While I do that, I'd prefer to keep the slightly dug out
rounded shape of the button.
This is a bit of a snag for me, and I'd appreciate the help you guys can
lend to me :-)
I can't wait for this project (both povray and real life) to be
completed. More so, I'd like to show it off when it's ready :-)
Thanks in advance :-)
-Jon
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Should just be a matter of using a planar image_map, unless you're seeing
too much distortion from curvature. And that's a real possibility since
your scene script shows the sphere isn't flattened out any.
Getting the image_map on there is simple enough, just needs centering,
scaling and rotating.
texture {
pigment {
image_map {
sys "help-1.bmp" // gif is not supported in v3.5
once // prevent tiling
interpolate 2 // smoother
}
translate -0.5
scale <1,1,1> // however needed to fit
rotate 90*x // to place onto y plane
}
}
This texture needs to overlay the underlying one, layered texture-style,
second place. You could put the texturing into the union of the whole object
since it is all centered on the y axis.
If you are going to need uv mapping or a uv warp, so that the surface is
conformed to better, I think someone else will have to advise you on that.
Or just look it up in the v3.5 scene help.
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
> sys "help-1.bmp" // gif is not supported in v3.5
gif is not supported for output but it is supported for input.
-tgq
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
You would probably be better to use an image_pattern texture than just an
image_map. Image map only applies to pigment, whereas image_pattern lets
you apply different textures for each part of the image, for example if you
wanted the man to have a bumpy normal and the rest to be smooth.
See 6.7.11.20 for information on how it works
Here is a sample for you. The first thing you need to do though is to
negative the image so the white part is black and the black part is white.
This is because image_pattern uses the greyscale value, anything outside the
image has a greyscale value of 0, so you want the area surrounding the man
to be the same so you don't have a square where the image is.
//start
#declare button =
union{
cylinder{<0,0,0> <0,.5,0>,1.1 }
difference{
sphere{<0,0,0>,1.2 }
box{<-5,.2,-5> <5,5,5>}
box{<-5,-5,-5> <5,0,5>}
translate .5*y
}
difference{
cylinder{<0,.5,0> <0,1,0>,.9}
sphere{<0,2,0>,1.2 scale<1.1,1,1.1> }
}
difference{
torus{.8,.1 }
box{<-5,0,-5> <5,-5,5>}
translate 1*y
}
texture{
image_pattern{gif "help-1.gif" once}//once to avoid repeating texture
texture_map{
[0 texture1] //texture where image is black and outside image
[1 texture2] //texture where image is white
}
rotate x*90
translate <-1/2,0,-1/2>
scale <1,1,1.3> //image originally mapped an x-y plane from <0,0> to
<1,1>, rotate translate and scale to suit
}
}
//end
-tgq
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
hughes b wrote:
> Should just be a matter of using a planar image_map, unless you're seeing
> too much distortion from curvature. And that's a real possibility since
> your scene script shows the sphere isn't flattened out any.
> Getting the image_map on there is simple enough, just needs centering,
> scaling and rotating.
>
> texture {
> pigment {
> image_map {
> sys "help-1.bmp" // gif is not supported in v3.5
> once // prevent tiling
> interpolate 2 // smoother
> }
> translate -0.5
> scale <1,1,1> // however needed to fit
> rotate 90*x // to place onto y plane
> }
> }
>
> This texture needs to overlay the underlying one, layered texture-style,
> second place. You could put the texturing into the union of the whole object
> since it is all centered on the y axis.
>
> If you are going to need uv mapping or a uv warp, so that the surface is
> conformed to better, I think someone else will have to advise you on that.
> Or just look it up in the v3.5 scene help.
>
>
>
Thank you so much for the guidence :-)
http://www.hostriot.com/072002/help-3.png
I used PNG transparency to get it out correctly and scaled it to the
right size so that that for the "Player 2" start button I can hopefully
figure out a way to get a second one in there (Maybe do another image
map but with another figure side by side).
Thanks a bunch, you've been more than just helpful :-D
-Jon
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
TinCanMan wrote:
> You would probably be better to use an image_pattern texture than just an
> image_map. Image map only applies to pigment, whereas image_pattern lets
> you apply different textures for each part of the image, for example if you
> wanted the man to have a bumpy normal and the rest to be smooth.
> See 6.7.11.20 for information on how it works
>
> Here is a sample for you. The first thing you need to do though is to
> negative the image so the white part is black and the black part is white.
> This is because image_pattern uses the greyscale value, anything outside the
> image has a greyscale value of 0, so you want the area surrounding the man
> to be the same so you don't have a square where the image is.
>
> //start
> #declare button =
> union{
> cylinder{<0,0,0> <0,.5,0>,1.1 }
> difference{
> sphere{<0,0,0>,1.2 }
> box{<-5,.2,-5> <5,5,5>}
> box{<-5,-5,-5> <5,0,5>}
> translate .5*y
> }
> difference{
> cylinder{<0,.5,0> <0,1,0>,.9}
> sphere{<0,2,0>,1.2 scale<1.1,1,1.1> }
> }
> difference{
> torus{.8,.1 }
> box{<-5,0,-5> <5,-5,5>}
> translate 1*y
> }
> texture{
> image_pattern{gif "help-1.gif" once}//once to avoid repeating texture
> texture_map{
> [0 texture1] //texture where image is black and outside image
> [1 texture2] //texture where image is white
> }
> rotate x*90
> translate <-1/2,0,-1/2>
> scale <1,1,1.3> //image originally mapped an x-y plane from <0,0> to
> <1,1>, rotate translate and scale to suit
> }
> }
> //end
>
> -tgq
>
>
Interesting, thank you for bringing this to my attention. The
suggestion given to me by hughes b has worked perfectly, so I do not
believe for this project I'll need to take the method you suggest.
Although, now that I am aware of it and it's potenial I'm sure I'll end
up using it sometime within this or another project. Thank you very
much for the feedback and the time you've spent helping me :-)
-Jon
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
> I used PNG transparency to get it out correctly and scaled it to the
> right size so that that for the "Player 2" start button I can hopefully
> figure out a way to get a second one in there (Maybe do another image
> map but with another figure side by side).
Don't do something silly like that ;)
You can just reuse the image and duplicate it. There are several ways to do
this. Here's one:
#declare button =
union{
cylinder{<0,0,0> <0,.5,0>,1.1 }
difference{
sphere{<0,0,0>,1.2 }
box{<-5,.2,-5> <5,5,5>}
box{<-5,-5,-5> <5,0,5>}
translate .5*y
}
difference{
cylinder{<0,.5,0> <0,1,0>,.9}
sphere{<0,2,0>,1.2 scale<1.1,1,1.1> }
}
difference{
torus{.8,.1 }
box{<-5,0,-5> <5,-5,5>}
translate 1*y
}
texture{
image_pattern{gif "help-1.gif" once}//once to avoid repeating texture
texture_map{
[0
image_pattern{gif "help-1.gif" once}//once to avoid repeating
texture
texture_map{
[0 texture1] //texture where image is black and outside image
[1 texture2] //texture where image is white
}
translate <1,0,0>
]
[1 texture2]
}
rotate x*90
translate <-1,0,-1/2>
scale <.6,1,1>
}
}
-tgq
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
> Interesting, thank you for bringing this to my attention. The
> suggestion given to me by hughes b has worked perfectly, so I do not
> believe for this project I'll need to take the method you suggest.
> Although, now that I am aware of it and it's potenial I'm sure I'll end
> up using it sometime within this or another project. Thank you very
> much for the feedback and the time you've spent helping me :-)
The difference between the image_map solution and image_pattern solution is
image_pattern allows you to apply different finishes and normals to each
part of the image map, but if this isn't needed than image_map may be all
you need.
-tgq
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
TinCanMan wrote:
> The difference between the image_map solution and image_pattern solution is
> image_pattern allows you to apply different finishes and normals to each
> part of the image map, but if this isn't needed than image_map may be all
> you need.
>
> -tgq
Ahh, yes yes, by your method I do understand that I would get the full
view of it interacting with my finish/normal statements. The image_map
method has proved to be very sucessful in this case. If for some reason
I'm not satisfied with the image_map method, I will definately follow
your image_pattern method. Thank you very much, both you guys :-)
Pretty much the finalized image of the start buttons.
http://www.hostriot.com/072002/help-4.png
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
"Jon B" <prm### [at] indecisions org> wrote in message
news:3D3### [at] indecisions org...
>
> Ahh, yes yes, by your method I do understand that I would get the full
> view of it interacting with my finish/normal statements. The image_map
> method has proved to be very sucessful in this case. If for some reason
> I'm not satisfied with the image_map method, I will definately follow
> your image_pattern method. Thank you very much, both you guys :-)
>
> Pretty much the finalized image of the start buttons.
>
> http://www.hostriot.com/072002/help-4.png
YW from me, glad that is all you wanted to get done. Thought it was more
complex a question. I agree that the image pattern would help distinguish
between the imprints and plastic, just that it might not seem neccessary for
this depending on the lighting angles and scale.
Looking at the button again I think you need the torus to drop lower on the
inside edge. Although it would then begin curving away from the central
depression requiring another torus to reverse the curve direction back
inward. In other words a second, smaller, clipped torus at the conjunction
of the first and the sphere.
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |