phill@med-image.compsci.bristol.ac.uk (Phill Everson) (01/29/90)
We're having a number of problems with Sun Phigs (v1.1) here running on SS1s and Sparc370's under SunOS4.03. Sun UK answer centre is baffled, but I'm sure someone somewhere can help ... If anyone could give any pointers to solutions or any sample code of greater complexity (and usefulness) than the demos included with the package please contact me. I will summarize to the net if there is significant reponse. 1. We are using polyhedron3 with a lighting model and don't see any apparent differences on the rendered model with the on or off. We use the following code to set up the light sources: Plightsrcbundl lrep[4]; lrep[0].type = PLIGHT_POSITIONAL; lrep[0].rec.positional.colour.type = PINDIRECT; lrep[0].rec.positional.colour.val.index = PYELLOW; lrep[0].rec.positional.pos.x = WC_MAX; lrep[0].rec.positional.pos.y = 0.0; lrep[0].rec.positional.pos.z = 0.0; lrep[0].rec.positional.coef[0] = 0.0; lrep[0].rec.positional.coef[1] = 1.0; lrep[1].type = PLIGHT_AMBIENT; lrep[1].rec.ambient.colour.type = PINDIRECT; lrep[1].rec.ambient.colour.val.index = PCYRAN; lrep[2].type = PLIGHT_POSITIONAL; lrep[2].rec.positional.colour.type = PINDIRECT; lrep[2].rec.positional.colour.val.index = PYELLOW; lrep[2].rec.positional.pos.x = WC_MAX * -1.0; lrep[2].rec.positional.pos.y = 5.0; lrep[2].rec.positional.pos.z = 0.0; lrep[2].rec.positional.coef[0] = 0.0; lrep[2].rec.positional.coef[1] = 1.0; popenws(WS, (Pconnid)canvas, canwst); psetlightsrcrep (WS, 1, &(lrep[0])); psetlightsrcrep (WS, 2, &(lrep[1])); psetlightsrcrep (WS, 3, &(lrep[2])); 2) Attenuation Coefficients. What are sensible values to plug in to get a noticable effect on the rendered model from the light source? 3) Rendering to pixrects. Is there *any* way of rendering a model into a pixrect directly rather than a workstation/canvas using Sun Phigs so that we can the do a pw_stencil() of that pixrect on top of another image? Any help, pointers, hints or sample code on any of the above problems would be deeply appreciated. Please email and I will summarize. Phillip G. Everson Senior Software Engineer Medical Imaging Philips Radiotherapy Systems Dept. Computer Science Horfield Road, Bristol, UK Bristol University, UK
dgehringer@sun.com (Doug Gehringer) (02/10/90)
In article <4530@brazos.Rice.edu> phill@med-image.compsci.bristol.ac.uk (Phill Everson) writes: >X-Sun-Spots-Digest: Volume 9, Issue 16, message 12 of 18 > >We're having a number of problems with Sun Phigs (v1.1) here running on >SS1s and Sparc370's under SunOS4.03. Sun UK answer centre is baffled, but >I'm sure someone somewhere can help ... > >If anyone could give any pointers to solutions or any sample code of >greater complexity (and usefulness) than the demos included with the >package please contact me. I will summarize to the net if there is >significant reponse. > > [... problems with lighting not working... } The on-line-tutorial, included with SunPHIGS has some nice examples of lighting (as well as all of the other PHIGS and PHIGS+ features). It has both FORTRAN and C examples and its a really good tool for learning how things work. Other things to try: make sure that you are using the correct workstation type (a true colour workstation, no indexed, see INTRO_PHIGS+), and the correct reflectance equation (ambient, diffuse, specular). >2) Attenuation Coefficients. What are sensible values to plug in to get a >noticable effect on the rendered model from the light source? The coefficients attenuate the affect of lights based on the distance from the light to the object. The attenuation is 1 / (c1 + c2 * d) where c1 and c2 are the coeficents, and d is the distance from the light to your object. c1= 1 and c2 = 0 gives no attenuation for distance. >3) Rendering to pixrects. Is there *any* way of rendering a model into a >pixrect directly rather than a workstation/canvas using Sun Phigs so that >we can the do a pw_stencil() of that pixrect on top of another image? Sorry, this is not possible with SunPHIGS 1.2. Doug Gehringer Sun Microsystems