简体   繁体   中英

Ursina Python Engine: Lighting, Shadows And Bloom Effects

I Am New To Ursana Engine And I Don't Know It Properly. But I Can Make Games In It. But The Problem Is That My Game Doesn't Have Any <Shadows, Glow, Lighting or Bloom> . So My Game Looks Dead.

Is There Any Way To Make My Game Look Good Using <Shadows, Glow, Lighting and Bloom> In Ursana Engine?

You can use the cheat sheet from here , I have linked the exact one that you are looking for.

Sample:

from ursina.shaders import lit_with_shadows_shader # you have to apply this shader to enties for them to receive shadows.
EditorCamera()
Entity(model='plane', scale=10, color=color.gray, shader=lit_with_shadows_shader)
Entity(model='cube', y=1, shader=lit_with_shadows_shader)
pivot = Entity()
DirectionalLight(parent=pivot, y=2, z=3, shadows=True)

You have to import shaders from ursina and then apply directional light.

from ursina import *
from ursina.shaders import lit_with_shadows_shader 

app = Ursina()
EditorCamera()
Entity(model='plane', scale=10, color=color.gray, 
shader=lit_with_shadows_shader)
Entity(model='cube', y=1, shader=lit_with_shadows_shader)
pivot = Entity()
DirectionalLight(parent=pivot, y=2, z=3, shadows=True, rotation=(45, -45, 45))

app.run()

:display:gsg:dxgsg9(error): Tried to load GLSL shader, but GLSL shaders not supported by Direct3D 9.

getting this error.

You have to add lights and also apply lit_with_shadows_shader to entities that will receive shadow.

See more here: https://www.ursinaengine.org/cheat_sheet.html#DirectionalLight

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM