Mantis Bugtracker
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0000821 [Croquet] Jasmine minor always 01-11-05 21:25 01-12-05 18:53
Reporter elenzil View Status public  
Assigned To
Priority normal Resolution open  
Status new  
Summary 0000821: Specular highlight incorrect
Description I first noticed this in my recent TQuadSubdivided object
(http://bugs.impara.de/view.php?id=816) [^]
but have reproduced it here with a stock TSphere.

Basically it looks like the specular highlight calculation
is incorrectly making some use of the camera's orientation.

Shading & lighting should only depend on the camera's position,
without regard for the camera's orientation.

Attached are some screenshots which illustrate.

I'll poke around a bit in the rendering code,
but it might be too deep in there for me.
Additional Information
Attached Files  specular1.png [^] (122,593 bytes) 01-11-05 21:25
 specular2.png [^] (121,356 bytes) 01-11-05 21:26
 specular3.png [^] (124,250 bytes) 01-11-05 21:26
 specularplane1.png [^] (77,693 bytes) 01-11-05 21:31
 specularplane2.png [^] (59,677 bytes) 01-11-05 21:32
 directionallight.png [^] (89,126 bytes) 01-12-05 00:42

- Relationships

- Notes
(0001055 - 442 - 466 - 466 - 466 - 466 - 466)
elenzil
01-11-05 21:56

.. I've realized that this is happening at a lower level of the openGL library than what's in squeak, so i'm going to stop chasing it.

It's fairly mysterious.
Typically openGL handles the lighting calculations after you pass in the geometry,
and i wouldn't expect an error in openGL itself, so i presume that the lighting is being done outside openGL, which makes me wonder if we're getting the advantage of modern graphics card drivers.
 
(0001056 - 157 - 169 - 169 - 169 - 169 - 169)
Croqueteer
01-12-05 00:18

Check to see if these are point lights or directional. These have very different specular effects. Note that I only used directional as the defaults.

DAS
 
(0001057 - 961 - 1134 - 1134 - 1134 - 1134 - 1134)
elenzil
01-12-05 00:37

This is all with a point light,
but i see the same effect with a directional light.
(that is, the specular highlight involves the camera orientation)

here's some code which demonstrates with a directional light.
(There's probably some way to package such code into a nice file,
 but for now here's the cut-n-paste)

It basically just removes all lights,
creates a new directional light,
creates a sphere,
and sets the materials and such to convenient values.
Following is a screenshot of the result.

TeaTest new openInWorld.
space _ TSpace allInstances last.
TLight allInstances do: [:x| x removeSelf.].
light _ TLight new.
light type: #directional.
space addChild: light.
light translationX: 0 y: 3 z: 0.
light visible: true.
ball _ TSphere new.
ball segments: 100; boundsChanged.
space addChild: ball.
mat _ TMaterial new.
ball material: mat.
mat diffuseColor: #(1 0 0 1) asFloatArray.
mat specularColor: #(0 1 1 1) asFloatArray.
 
(0001059 - 310 - 310 - 310 - 310 - 310 - 310)
Croqueteer
01-12-05 01:04

OK. Then the problem may be with how the lights are set up. All of this IS going through OGL - we are certainly taking advantage of the hardware. We are probably just doing it incorrectly. I thought I had fixed a similar problem a while back. Either I was wrong, or the change didn't make it into this version.
 
(0001062 - 254 - 296 - 296 - 296 - 296 - 296)
elenzil
01-12-05 01:44

i've poked around a bit and i'm gonna stop looking,
i think this one goes too deep for me.
i don't see much to really fiddle with
except TLight >> enable,
and that's pretty straight forward.

i've never seen something like this, it's certainly odd.
 
(0001063 - 197 - 197 - 197 - 197 - 197 - 197)
Croqueteer
01-12-05 01:46

I should have been more specific. The light setup is fine. The problem may be the interaction of the lights with the camera - that is, the lights are being initialized in the wrong transform space.
 
(0001069 - 689 - 791 - 791 - 791 - 791 - 791)
Bob Arning
01-12-05 18:53

I don't see any difference in the sphere example. Maybe it's my eyes, maybe it's my computer (iMac with OSX 10.1.5), but if I change the sphere to a rectangle, I do see something odd. Simply rotating the avatar left and right causes the rectangle to change colors.
-----
TeaTest new openInWorld.
space _ TSpace allInstances last.
TLight allInstances do: [:x| x removeSelf.].
light _ TLight new.
light type: #directional.
space addChild: light.
light translationX: 0 y: 3 z: 0.
light visible: true.

mat _ TMaterial new.
mat diffuseColor: #(1 0 0 1) asFloatArray.
mat specularColor: #(0 1 1 1) asFloatArray.

wall _ TRectangle new.
space addChild: wall.
wall material: mat.
 

- Issue History
Date Modified Username Field Change
01-11-05 21:25 elenzil New Issue
01-11-05 21:25 elenzil File Added: specular1.png
01-11-05 21:26 elenzil File Added: specular2.png
01-11-05 21:26 elenzil File Added: specular3.png
01-11-05 21:31 elenzil File Added: specularplane1.png
01-11-05 21:32 elenzil File Added: specularplane2.png
01-11-05 21:56 elenzil Note Added: 0001055
01-12-05 00:18 Croqueteer Note Added: 0001056
01-12-05 00:37 elenzil Note Added: 0001057
01-12-05 00:42 elenzil File Added: directionallight.png
01-12-05 01:04 Croqueteer Note Added: 0001059
01-12-05 01:44 elenzil Note Added: 0001062
01-12-05 01:46 Croqueteer Note Added: 0001063
01-12-05 18:53 Bob Arning Note Added: 0001069


Mantis 1.0.8[^]
Copyright © 2000 - 2007 Mantis Group
69 total queries executed.
40 unique queries executed.
Powered by Mantis Bugtracker