View Full Version : Custom Lighting - Recreating Phong Spec
09-18-2010, 06:51 PM
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:
If anybody has any other resources or examples that they could show I'd really appreciate it.
09-18-2010, 07:35 PM
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.
09-18-2010, 07:46 PM
specular should be Dot(ReflVector,LightVector), make sure you clamp it, then pow
09-18-2010, 07:56 PM
Ah works perfect, thanks! I guess that should've been obvious, must've misread something in that equation.
09-19-2010, 04:21 AM
Moar info here: http://udn.epicgames.com/Three/CustomLighting.html
Has an example for transmission also, if you're interested.
09-19-2010, 06:56 AM
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?
09-19-2010, 07:50 AM
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."
vBulletin® v3.8.4, Copyright ©2000-2013, Jelsoft Enterprises Ltd.