Thanks so far for your quick answer, I understand that the end of the day is not the best moment
Quote: "Actually I think the one where the specular reflection "moves" is correct"
Well, I do not think so really, because in the 'right' side (the Control key one), that specularity movement behaves differently, and much more natural.
On the wrong side (the Shift or 'left' side), the specularity skids to the dark side, until it eventually dissapears, while it should stay more or less in the bright side of the object.
If we raise up the specularity, this can be noticed. It can be seen clearly here, and even more using that RGB = (128, 128, 255) (I called it "neutral_normal.jpg", attached to this post):
angle# as float
set display mode 1024, 768, 32
sync on: sync rate 60: sync
Set Normalization On
null = make vector4(1)
rem Set light direction (X)
set vector4 1, 1.0, 0.0, 0.0, 0.0
load image "slate.png", 1
rem load image "test v10 oct3to7 nmp.png", 2
load image "neutral_normal.jpg", 2
load effect "ggbump01.fx", 1, 0
set effect constant vector 1, "lightDir", 1
rem Remark specularity
set effect constant float 1, "specLevel", 0.85
set effect constant float 1, "specExpon", 50.0
make object sphere 1, 500, 50,50
texture object 1, 0, 1
texture object 1, 1, 2
set object effect 1, 1
position object 1, 0, 0,200
rem start from 'left' side, no specularity at certain distances!
position camera 0, 0, -200
point camera 0,0,200
rem just to know which side we are. 1= left, 2=right
side=1
repeat
center text 512, 40, "Use Up & Down arrows to see specularity move"
center text 512, 60, "SHIFT = 'left' side"
center text 512, 80, "CONTROL = 'right' side"
if side=1
center text 170, 600, "No specularity here"
center text 170, 620, "(press 'Control' to change side,"
center text 170, 640, "or up & down to see strange effect)"
else
center text 854, 600, "Specularity is fine from this side"
center text 854, 620, "(press 'Shift' to change side,"
center text 854, 640, "up & down effect is fine here)"
endif
inc angle#, 0.1
yrotate object 1, angle#
Control Camera Using Arrowkeys 0, 5.0, 1.0
rem just to help view from the 'right' side
if ControlKey()
position camera 0, 0, 600
point camera 0,0,200
side=2
endif
rem just to help view from the 'left' side
if ShiftKey()
position camera 0, 0, -200
point camera 0,0,200
side=1
endif
sync
until spacekey()
end
Quote: "I agree there's a bug somewhere. I'll investigate. Thanks for pointing it out so convincingly."
No problem, thanks for your time. I thought it was hard to explain, besides I had to prove it
Regarding this, my suspects go for the 'CameraPosition':
float3 eyePos : CameraPosition;
or perhaps the auto-feeding of the matrices, oh well I have no idea
But I know that whis can give you some clues (or either know you out, lol):
angle# as float
set display mode 1024, 768, 32
sync on: sync rate 60: sync
Set Normalization On
null = make vector4(1)
rem Set light direction (X)
set vector4 1, 1.0, 0.0, 0.0, 0.0
load image "slate.png", 1
rem load image "test v10 oct3to7 nmp.png", 2
load image "neutral_normal.jpg", 2
load effect "ggbump01.fx", 1, 0
set effect constant vector 1, "lightDir", 1
rem Remark specularity
set effect constant float 1, "specLevel", 0.85
set effect constant float 1, "specExpon", 50.0
make object sphere 1, 500, 50,50
texture object 1, 0, 1
texture object 1, 1, 2
set object effect 1, 1
rem position object 1, 0, 0,200
position object 1, 0, 0,10
rem start from 'left' side, no specularity at certain distances!
position camera 0, 0, -590
point camera 0,0,10
rem just to know which side we are. 1= left, 2=right
side=1
repeat
center text 512, 40, "Use Up & Down arrows to see specularity move"
center text 512, 60, "SHIFT = 'left' side"
center text 512, 80, "CONTROL = 'right' side"
if side=1
center text 170, 600, "Specularity suddenly fine here!"
center text 170, 620, "(press 'Control' to change side,"
center text 170, 640, "up & down effect is fine here)"
else
center text 854, 600, "Specularity is fine from this side"
center text 854, 620, "(press 'Shift' to change side,"
center text 854, 640, "up & down effect is fine here)"
endif
inc angle#, 0.1
yrotate object 1, angle#
Control Camera Using Arrowkeys 0, 5.0, 1.0
rem just to help view from the 'right' side
if ControlKey()
position camera 0, 0, 600
point camera 0,0,10
side=2
endif
rem just to help view from the 'left' side
if ShiftKey()
position camera 0, 0, -590
point camera 0,0,10
side=1
endif
sync
until spacekey()
end
The basic difference is the position of the object:
position object 1, 0, 0,10
Now it is nearer the origin (0,0,0), and the specularity behaves much properly!
What do you think?