disclaimer total novice here.
is there a way to create Fresnel falloff on the environmental map in the phong material in order to achieve a look such as the attached so that the reflections are stronger on the facing ratio away from the camera?
disclaimer total novice here.
is there a way to create Fresnel falloff on the environmental map in the phong material in order to achieve a look such as the attached so that the reflections are stronger on the facing ratio away from the camera?
There is no built-in way to do it, but you can customize the GLSL shader to do this. What you are asking for is very similar to the Alpha Falloff feature the Phong MAT has (where the alpha value is dependent on if the pixel is facing the camera or not). You can see this by changing the Alpha Front and Alpha Side parameters on the Alpha page of the Phong MAT. Once you have the Phong MAT doing an alpha falloff, you can output the shader to a GLSL MAT (Using the output shader button on the Phong MAT), and change the code that’s calculating the alpha value to instead control the contribution of the env map (which you’ll also see in the shader code).
Hope that helps.
yep exactly what i was looking for. not good with the code yet. will try to hack my way though modifying the glsl shader.
In the future, is there any chance of getting settings like AlphaFront/Side in the phong shader for the environment map? It would make the shader fairly complete for most uses. I can probably work out the GLSL code without too much problem, it would just be convenient is all. I think most people with a 3D/motion graphics background look for some sort of faked reflection immediately.
+1,
I think writing the glsl code is more or less simple (did’t try it) but even when finished it’s just not as convenient.
+1 also r.
I thought that was good idea to put a falloff on an environment map. Here is Malcolm’s suggestion.
Original shader code:[code] // Environment Mapping
outcol.rgb += envMapColor.rgb ;
// Apply fog, this does nothing if fog is disabled
outcol = TDFog(outcol, vVert.camSpaceVert);
// Alpha Calculation
float alpha = uDiffuseColor.a * vVert.color.a * getVaryingAlpha(dot(normal, camVec));[/code]
new code:[code]// Environment Mapping
outcol.rgb += envMapColor.rgb * getVaryingAlpha(dot(normal, camVec)) ;
// Apply fog, this does nothing if fog is disabled
outcol = TDFog(outcol, vVert.camSpaceVert);
// Alpha Calculation
float alpha = uDiffuseColor.a * vVert.color.a;[/code]
I didn’t change the uniform names for simplicity.
cheers
Keith
EnvFalloff.toe (7.55 KB)
Thanks Keith, works a treat!
(I still vote for this functionality in the default phong material though