Reply
Reply
 
Thread Tools Display Modes
mheyman's Avatar
Old (#1)
I'm working on a shader that is utilizing a custom diffuse but now I'm trying to figure out how to create a specular term to go with it. Right now I'm trying to put this together:

http://en.wikipedia.org/wiki/Phong_shading

If anybody has any other resources or examples that they could show I'd really appreciate it.
Offline , triangle, 447 Posts, Join Date Apr 2009, Location Irvine, CA Send a message via AIM to mheyman  
   Reply With Quote

mheyman's Avatar
Old (#2)
Bit of an update. I got the Phong Specular and the lambert diffuse together, however the specular highlight only moves with the camera and not with the movement of light. Is this a problem? I know that Unreals Phong reacts to both light position and camera position.

Offline , triangle, 447 Posts, Join Date Apr 2009, Location Irvine, CA Send a message via AIM to mheyman  
   Reply With Quote

JordanW's Avatar
Old (#3)
specular should be Dot(ReflVector,LightVector), make sure you clamp it, then pow
Jordan Walker
ART BLOG
CGHUB
Twitter
Offline , dedicated polycounter, 1,437 Posts, Join Date Oct 2004, Location Cary, NC Send a message via ICQ to JordanW  
   Reply With Quote

mheyman's Avatar
Old (#4)
Ah works perfect, thanks! I guess that should've been obvious, must've misread something in that equation.
Offline , triangle, 447 Posts, Join Date Apr 2009, Location Irvine, CA Send a message via AIM to mheyman  
   Reply With Quote

Xendance's Avatar
Old (#5)
Moar info here: http://udn.epicgames.com/Three/CustomLighting.html
Has an example for transmission also, if you're interested.
Offline , triangle, 376 Posts, Join Date May 2010,  
   Reply With Quote

mheyman's Avatar
Old (#6)
Ha, I should've just looked for that from the start! Oh well glad to know I basically figured it out. Thanks for the link though, it did explain a lot about which nodes still work with custom lighting (opactiy etc).

I'll definitely try the transmission thing too.

Could someone explain the need for the constant clamps? What do they accomplish?
Offline , triangle, 447 Posts, Join Date Apr 2009, Location Irvine, CA Send a message via AIM to mheyman  
   Reply With Quote

Xendance's Avatar
Old (#7)
I believe this page will be a huge help

"The ConstantClamp expression performs the same function as Clamp but uses properties for the minimum and maximum values in the node itself for simplicity and ease of use. This expression works well when you have min and max clamp values (say clamping an output from 0 to 1) that do not need to be variable over time."

http://udn.epicgames.com/Three/Mater...#ConstantClamp
Offline , triangle, 376 Posts, Join Date May 2010,  
   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Copyright 1998-2012 A. Risch