Re: [R] rgl lighting question

2008-11-22 Thread Duncan Murdoch

On 21/11/2008 2:30 PM, Rajarshi Guha wrote:
Hi, I'm using rgl to generate a 3D surface plot and I'm struggling to  
get the lighting correct. Currently the surface gets plotted, but is  
very 'shiny'. On rotating the view, I get to see parts of the surface  
- but overall I don't see much detail because of the spotlight like  
lighting.


I've played around with the specular, ambient and diffuse but I can't  
bring out the details of the surface. Could anybody point me to some  
examples of how to make a plain matte surface, which isn't obscured  
by specular reflections?


This gives the regular shiny surface:

library(rgl)
example(surface3d)

This gives one with no specular reflections, because the material 
doesn't do that:


open3d()
surface3d(x, y, z, color=col, back=lines, specular=black)

And here's another way to get no specular reflections.  This time 
there's no light to reflect that way:


open3d()
rgl.pop(lights)
light3d(specular=black)
surface3d(x, y, z, color=col, back=lines)

I suspect you missed the rgl.pop() call.  If you just call light3d or 
rgl.light() you'll add an additional light, you don't change the 
existing one.


Duncan Murdoch

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] rgl lighting question

2008-11-22 Thread Rajarshi Guha
Thanks a lot for the pointer to rgl.pop() - that works (as does  
looking at the examples!)


On Nov 22, 2008, at 10:28 AM, Duncan Murdoch wrote:


On 21/11/2008 2:30 PM, Rajarshi Guha wrote:
Hi, I'm using rgl to generate a 3D surface plot and I'm struggling  
to  get the lighting correct. Currently the surface gets plotted,  
but is  very 'shiny'. On rotating the view, I get to see parts of  
the surface  - but overall I don't see much detail because of the  
spotlight like  lighting.
I've played around with the specular, ambient and diffuse but I  
can't  bring out the details of the surface. Could anybody point  
me to some  examples of how to make a plain matte surface, which  
isn't obscured  by specular reflections?


This gives the regular shiny surface:

library(rgl)
example(surface3d)

This gives one with no specular reflections, because the material  
doesn't do that:


open3d()
surface3d(x, y, z, color=col, back=lines, specular=black)

And here's another way to get no specular reflections.  This time  
there's no light to reflect that way:


open3d()
rgl.pop(lights)
light3d(specular=black)
surface3d(x, y, z, color=col, back=lines)

I suspect you missed the rgl.pop() call.  If you just call light3d  
or rgl.light() you'll add an additional light, you don't change the  
existing one.


Duncan Murdoch


---
Rajarshi Guha  [EMAIL PROTECTED]
GPG Fingerprint: D070 5427 CC5B 7938 929C  DD13 66A1 922C 51E7 9E84
---
Paper or plastic?
Not 'Not paper AND not plastic!!'
 -- Augustus DeMorgan in a grocery store

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] rgl lighting question

2008-11-21 Thread Rajarshi Guha
Hi, I'm using rgl to generate a 3D surface plot and I'm struggling to  
get the lighting correct. Currently the surface gets plotted, but is  
very 'shiny'. On rotating the view, I get to see parts of the surface  
- but overall I don't see much detail because of the spotlight like  
lighting.


I've played around with the specular, ambient and diffuse but I can't  
bring out the details of the surface. Could anybody point me to some  
examples of how to make a plain matte surface, which isn't obscured  
by specular reflections?


Thanks,

---
Rajarshi Guha  [EMAIL PROTECTED]
GPG Fingerprint: D070 5427 CC5B 7938 929C  DD13 66A1 922C 51E7 9E84
---
If you don't get a good night kiss, you get Kafka dreams.
-Hobbes

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] rgl lighting question

2008-11-21 Thread Barry Rowlingson
2008/11/21 Rajarshi Guha [EMAIL PROTECTED]:
 Hi, I'm using rgl to generate a 3D surface plot and I'm struggling to get
 the lighting correct. Currently the surface gets plotted, but is very
 'shiny'. On rotating the view, I get to see parts of the surface - but
 overall I don't see much detail because of the spotlight like lighting.

 I've played around with the specular, ambient and diffuse but I can't bring
 out the details of the surface. Could anybody point me to some examples of
 how to make a plain matte surface, which isn't obscured by specular
 reflections?

 Have you tried lit=FALSE? This sphere is so unspecular it appears flat:

  spheres3d(0,0,0,color=red,lit=FALSE)

Barry

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.