Hi,
I've got a weird “problem” happening when using Lambertian lighting in the lighting model VOP. When I eliminate my ambient light there's no change to the image even though there's a call to ambient() in the VEX code.
H6.1.208 on WIN-XP
Any ideas why ambient() may not be returning a value?
TIA!
–Mark
ambient() call in lighting model VOP
3657 4 2- xiondebra
- Member
- 543 posts
- Joined: July 2005
- Offline
- 911Operator
- Member
- 19 posts
- Joined: July 2005
- Offline
- xiondebra
- Member
- 543 posts
- Joined: July 2005
- Offline
Hi,
The code looks correct to me, but when adjusting or deleting the ambient light in my scene, there's no change to the image. I also checked my light masks, they're set correctly. The code is being gen'd by the VEX builder, here's the section in question:
<SNIP>
if (0)
color12 = hsvtorgb(colormix(rgbtohsv(color10),
rgbtohsv(color11),
shaded_relief_amount, 1));
else
color12 = colormix(color10, color11, shaded_relief_amount, 1);
// Code produced by: lighting1
vector ii = 0 ? { 0.0, 0.0, 0.0 } : normalize(I);
vector nf = 0 ? { 0.0, 0.0, 0.0 } : normalize(N);
if (1) nf = frontface(nf, ii);
if (lmodel == “constant”)
{
color13 = color12;
}
else if (lmodel == “lambert”)
{
color13 = { 0, 0, 0 } * ambient()
+ color12 * diffuse(nf);
}
else if (lmodel == “headlight”)
{
color13 = color12*clamp(dot(nf, -ii), 0, 1);
}
else if (lmodel == “oren”)
{
color13 = { 0, 0, 0 } * ambient()
+ color12 * diffuse(nf, -ii, 0.05);
}
else if (lmodel == “phong”)
{
color13 = { 0, 0, 0 } * ambient()
+ color12 * diffuse(nf)
+ { 0, 0, 0 } * phong(nf, -ii, 1.0/0.05);
}
else if (lmodel == “blinn”)
{
color13 = { 0, 0, 0 } * ambient()
+ color12 * diffuse(nf)
+ { 0, 0, 0 } * blinn(nf, -ii, 0.05);
}
else if (lmodel == “anisotropic”)
{
color13 = { 0, 0, 0 } * ambient()
+ color12 * diffuse(nf)
+ { 0, 0, 0 } * anisotropic(nf, -ii, 0.05, 0.05);
}
else
{
color13 = { 0, 0, 0 } * ambient()
+ color12 * diffuse(nf)
+ { 0, 0, 0 } * specular(nf, -ii, 0.05);
}
// Code produced by: output1
Cf = color13;
}
The code looks correct to me, but when adjusting or deleting the ambient light in my scene, there's no change to the image. I also checked my light masks, they're set correctly. The code is being gen'd by the VEX builder, here's the section in question:
<SNIP>
if (0)
color12 = hsvtorgb(colormix(rgbtohsv(color10),
rgbtohsv(color11),
shaded_relief_amount, 1));
else
color12 = colormix(color10, color11, shaded_relief_amount, 1);
// Code produced by: lighting1
vector ii = 0 ? { 0.0, 0.0, 0.0 } : normalize(I);
vector nf = 0 ? { 0.0, 0.0, 0.0 } : normalize(N);
if (1) nf = frontface(nf, ii);
if (lmodel == “constant”)
{
color13 = color12;
}
else if (lmodel == “lambert”)
{
color13 = { 0, 0, 0 } * ambient()
+ color12 * diffuse(nf);
}
else if (lmodel == “headlight”)
{
color13 = color12*clamp(dot(nf, -ii), 0, 1);
}
else if (lmodel == “oren”)
{
color13 = { 0, 0, 0 } * ambient()
+ color12 * diffuse(nf, -ii, 0.05);
}
else if (lmodel == “phong”)
{
color13 = { 0, 0, 0 } * ambient()
+ color12 * diffuse(nf)
+ { 0, 0, 0 } * phong(nf, -ii, 1.0/0.05);
}
else if (lmodel == “blinn”)
{
color13 = { 0, 0, 0 } * ambient()
+ color12 * diffuse(nf)
+ { 0, 0, 0 } * blinn(nf, -ii, 0.05);
}
else if (lmodel == “anisotropic”)
{
color13 = { 0, 0, 0 } * ambient()
+ color12 * diffuse(nf)
+ { 0, 0, 0 } * anisotropic(nf, -ii, 0.05, 0.05);
}
else
{
color13 = { 0, 0, 0 } * ambient()
+ color12 * diffuse(nf)
+ { 0, 0, 0 } * specular(nf, -ii, 0.05);
}
// Code produced by: output1
Cf = color13;
}
========================================================
You are no age between space
You are no age between space
- Mario Marengo
- Member
- 941 posts
- Joined: July 2005
- Offline
Hi Mark,
The ambient() function is obviously being called. The problem is that you have “ambient tint” (or whatever it's called) in the lighting-model VOP set to {0,0,0}.
At least that's what this bit from your code-dump says:
else if (lmodel == “lambert”)
{
color13 = { 0, 0, 0 } * ambient()
+ color12 * diffuse(nf);
}
I'm talking about the {0,0,0} in the color13 = { 0, 0, 0 } * ambient() line
… and, of course, I'm also assuming that “lmodel” resolves to the string “lambert”.
Cheers!
The ambient() function is obviously being called. The problem is that you have “ambient tint” (or whatever it's called) in the lighting-model VOP set to {0,0,0}.
At least that's what this bit from your code-dump says:
else if (lmodel == “lambert”)
{
color13 = { 0, 0, 0 } * ambient()
+ color12 * diffuse(nf);
}
I'm talking about the {0,0,0} in the color13 = { 0, 0, 0 } * ambient() line
… and, of course, I'm also assuming that “lmodel” resolves to the string “lambert”.
Cheers!
- xiondebra
- Member
- 543 posts
- Joined: July 2005
- Offline
-
- Quick Links