projecting a texture purely

   6134   9   1
User Avatar
Member
32 posts
Joined: July 2005
Offline
I'm trying to project a texture from a light onto a surface and want the texutre maps pure values to be used on the surface. The light affects the render with what ever shader I use. If I use constant I can't use the light. If I use lambert theres a gradient. How can I setup a projection for a texturemap that will 1to1 use the texturemaps values on the surface.

Like a very pure slide projecter.

Thanks much…
-mikey
User Avatar
Member
941 posts
Joined: July 2005
Offline
Hi there,

If using VOPs, then just connect the texture color directly to Cf (and don't use the lighting model VOP).

If using a pre-canned shader, then choose one that offers an “emittance” map, then feed your map as the emittance texture, set the emittance intensity to 1, and slam everything else (diffuse, ambient, specular, reflection, etc.) to zero/empty.

Cheers.
Mario Marengo
Senior Developer at Folks VFX [folksvfx.com] in Toronto, Canada.
User Avatar
Staff
2590 posts
Joined: July 2005
Offline
maddabbo
I'm trying to project a texture from a light onto a surface and want the texutre maps pure values to be used on the surface. The light affects the render with what ever shader I use. If I use constant I can't use the light. If I use lambert theres a gradient. How can I setup a projection for a texturemap that will 1to1 use the texturemaps values on the surface.

Like a very pure slide projecter.

Thanks much…
-mikey


surface
show_light()
{
vector nn = normalize(frontface(N, I));
Ci = 0;
illuminance (P, nn) {
Ci += Cl;
}
}
User Avatar
Member
941 posts
Joined: July 2005
Offline
OMG…

!!!*project*!!!

Duh! Sorry, missed that bit. I thought you were talking about a *surface* texture (but don't ask me where I got that from your post!, lol).

My brain is melting from too much modelling. We hatesss modelling, we hatesss it, my precioussss! :shock:
Mario Marengo
Senior Developer at Folks VFX [folksvfx.com] in Toronto, Canada.
User Avatar
Member
32 posts
Joined: July 2005
Offline
I'm not sure where to use this code.
Someone send me a VOP hip file I'll try that out.
Thanks guys. I'll let you know how it goes.
-mikey


surface
show_light()
{
vector nn = normalize(frontface(N, I));
Ci = 0;
illuminance (P, nn) {
Ci += Cl;
}
}
User Avatar
Member
32 posts
Joined: July 2005
Offline
Let me just tell you that I've got very limited experience with shaders. I don't see Ci as a global variable in the notes. What is Ci?
Thanks again.

-mikey

THOTH-> vcc -u m_project_light.vfl
“m_project_light.vfl” line 5 WARNING (2005) Implicit casting failed for set().
This is because there are multiple versions of the function
and the compiler cannot determine which version to use
based solely on the arguments given.
The compiler has chosen “int set(int)” instead of:
matrix3 set(int)
matrix set(int)
float set(int)
vector set(int)
vector4 set(int)
Ci = 0;

^
“m_project_light.vfl” line 7 WARNING (2005) Implicit casting failed for add).
The compiler has chosen “void add(vector &, vector)” instead of:
void add(vector4 &; vector)
Ci += Cl;

^
“m_project_light.vfl” line 5 ERROR (1008) Undefined symbol “Ci”
Ci = 0;

^
REMARK (3003) 1 error and 2 warnings encountered
REMARK (3007) No output is generated due to errors in the source code
Exit 1
User Avatar
Member
32 posts
Joined: July 2005
Offline
We changed Ci to Cf and are getting some results. I have to test this out but it looks promising. I think it's doing what I was asking for.

Thanks
-mikey
User Avatar
Member
32 posts
Joined: July 2005
Offline
Hmmm, it seems to only work if the camera and the light are lined up. As you move the camera off angel you get a darker render, not pure what the texture projected.

-mikey
User Avatar
Member
32 posts
Joined: July 2005
Offline
Okay correction, it seems to work if the light and the surface's normal are lined up if the camera moves in this case it works. When the light and the surface normal aren't lined up the image gets darker.

-mikey
User Avatar
Member
32 posts
Joined: July 2005
Offline
Okay I used vorigin and a point sop to get the surface's normals to point at the light. Now the camera off angle renders the texturemap colors pure even if the light isn't oriented flat with the object and the camera is off angle.

-mikey
  • Quick Links