Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Graphics expert

0 views
Skip to first unread message

Alexander Anderson

unread,
Jul 30, 1996, 3:00:00 AM7/30/96
to

Dear graphics expert,


I've just adapted a little applet that renders a textured 3D sphere
on the screen. This is for college work. I asked to do it in Java, and
here I am handing it in one semester late. It uses the "Phong" lighting
model, and wraps a JPEG or GIF around the sphere.


http://www.mdx.ac.uk/~alexander9/html/PhongSphere.html


I'm pretty sure this'll work for most anyone, but people have
reported that it sometimes runs out of memory on their systems.


If you look at this you'll notice that the Phong "shininess" and
diffuse reflection doesn't blend together realistically with the JPEG
image.


I just naively averaged the Phong colour value with the map
reference colour value:


static public Color
mergeColours (Color c1, Color c2) {
// average each gun...
// this is just not the right effect.
// what _is_ the right effect???

int r = ( c1.getRed() + c2.getRed() ) / 2;
int g = ( c1.getGreen() + c2.getGreen() ) / 2;
int b = ( c1.getBlue() + c2.getBlue() ) / 2;

return new Color(r, g, b);
}// mergeColours(Color,Color)


The full source code is off the applet page.


Everyone else did averaging, but it never looked right. Now that I
can hand it in, six months late, I thought I might as well get it bang
on. The books we used don't really talk about mixing colours, they just
talk of mapping. I know that merging colours is a difficult problem,
and although I can't explain color aliasing, I've seen the effects on my
Phong sphere. I might just used shades of grey in the end.


My question to you is: What is the most realistic fudge for merging
the Phong lighting with the texturing, without coping with "colour
aliasing"?


Sandy

P.S. Please reply by email as well.
--
// Alexander Anderson Computer Systems Student //
// sa...@almide.demon.co.uk Middlesex University //
// Home Fone: +44 (0) 171-794-4543 Bounds Green //
// http://www.mdx.ac.uk/~alexander9 London U.K. //

captain.sarcastic

unread,
Jul 30, 1996, 3:00:00 AM7/30/96
to

Alexander Anderson (sa...@almide.demon.co.uk) wrote:
| Dear graphics expert,
|
| I've just adapted a little applet that renders a textured 3D sphere
| on the screen. This is for college work. I asked to do it in Java, and
| here I am handing it in one semester late. It uses the "Phong" lighting
| model, and wraps a JPEG or GIF around the sphere.
|
| http://www.mdx.ac.uk/~alexander9/html/PhongSphere.html

ABORTED = 2
COMPLETE = 8
ERRORED = 4
LOADING = 1
mapStatus = 8
mapWidth = 256
mapHeight = 256
# Applet exception: exception: java.lang.ClassNotFoundException:
ALMIDE.util.Utility
java.lang.ClassNotFoundException: ALMIDE.util.Utility
at
netscape.applet.AppletClassLoader.findClass(AppletClassLoader.java:177)
at
netscape.applet.AppletClassLoader.loadClass(AppletClassLoader.java:128)
at ImageMap.<init>(PhongSphere.java:561)
at PhongSphere.init(PhongSphere.java:138)
at netscape.applet.EmbeddedAppletFrame.run(EmbeddedAppletFrame.java:321)
at java.lang.Thread.run(Thread.java:294)

--
captain.sarcastic -> on the www: http://www.sarcasm.com/ <-
mailto:ho...@sarcasm.com -> limited edition <-
news:alt.captain.sarcastic -> generated by vertigo's randsig v1.5.0 <-
Yield to temptation; it may not pass your way again.

Alexander Anderson

unread,
Jul 31, 1996, 3:00:00 AM7/31/96
to

In article <4tlfil$f...@panix.com>, "captain.sarcastic"
<kko...@panix.com> writes

>ABORTED = 2
>COMPLETE = 8
>ERRORED = 4
>LOADING = 1
>mapStatus = 8
>mapWidth = 256
>mapHeight = 256
># Applet exception: exception: java.lang.ClassNotFoundException:
>ALMIDE.util.Utility
>java.lang.ClassNotFoundException: ALMIDE.util.Utility
> at
>netscape.applet.AppletClassLoader.findClass(AppletClassLoader.java:177)
> at
>netscape.applet.AppletClassLoader.loadClass(AppletClassLoader.java:128)
> at ImageMap.<init>(PhongSphere.java:561)
> at PhongSphere.init(PhongSphere.java:138)
> at netscape.applet.EmbeddedAppletFrame.run(EmbeddedAppletFrame.java:321)
> at java.lang.Thread.run(Thread.java:294)

Aha.


I keep the classes in


http://www.mdx.ac.uk/~alexander9/classes/


I guess this means I also need a


http://www.mdx.ac.uk/~alexander9/classes/ALMIDE/util/

folder.


OK. It seems to work now, even when I don't have a local copy.
(And yes, I cleared Netcache.)


Sandy

0 new messages