We are about to switch to a new forum software. Until then we have removed the registration on this forum.
hi there, I'm currently working on a 3d game in processing 3. I am trying to use an ambient light at the camera position and light falloff to fake a fog falloff effect. it's working great except I want to be able to set the color of the "fog" instead of the world just fading off into infinite darkness. I'm not trying to make a horror game just trying to hide object culling. Is there something I'm missing?
Answers
Can you share a brief MCVE sketch to show the approach that you are currently using and attempting to alter? e.g. perhaps just your camera+falloff setup on a cube or a grid of cubes.
https://stackoverflow.com/help/mcve
sure, this should work? I wrote it in Processing 3.3.5.
Huh. The sketch looks the same to me whether I include the lightFalloff() line or not -- your demo doesn't look like "the world just fading off into infinite darkness," color aside. Maybe the wrong settings, or maybe I'm missing something?
I'm guessing that a simple background color won't work for you for "set the color of the fog"?
You could try lighting your scene on a PGraphics buffer against a black background, then applying the result (with an appropriate blendMode or masking) on top of a colored canvas -- with background(128), or 255,0,0, or whatever.