I am trying to setup a shader that is similar to a phong shader but with a couple of differences. I want to be able to add reflections, however I am running into some problems. My material looks fine if I add a Phong material and set the environment map, it works correctly, however if I make a custom shader and copy and paste the code for the phong shaders into my own shader, and set the environment map:
mesh.material.envMap = cubeCamera.renderTarget.texture;
exactly like I did for the phongshader
then my material turns black. I would greatly appreciate it if someone who has experience dealing with environment maps in custom shaders could shed some like on this for me. I was reading through the shader chunk code and I am not sure what could possibly be triggering this. My understanding is the env map is returning all 0s, however since the environment map is being passed in, I can’t imagine why it would be all 0s.
EDIT: Nevermind, I didn’t realize I had to define all of the parameters in the shader.