Search code examples
pythonursina

Ursina - how to add fog correctly


I'm (once again!) asking about a problem with Ursina...

I know that Ursina has a scene.fog, and I'm kind of assuming it's for 3D games. I want to add fog to my game, but setting scene.fog_density and scene.fog_color does nothing.

Am I doing something wrong? How do I add fog to my game?

I'm using the (mostly) default FirstPersonController

My code:

app = Ursina(development_mode=False, show_ursina_splash_screen=True,fullscreen=True,title="Maze FPS")

random.seed(0)
### SHADERS ###
Entity.default_shader = lit_with_shadows_shader

scene.fog_density = .1
scene.fog_color = color.red

I've tried various fog densities (.1, 1, and 3) and colors (color.black, color.red, color.green). afaik it didn't have any effect


Solution

  • The lit_with_shadows_shader doesn't support fog at the moment. The default shader does however. The way you set fog color and fog density is correct.