-1

I am making a simple simulation of the solar system in Ursina and I am trying to implement a shader. I haven't been able to set the sun to emanate light. I have already tried using point light and setting the location in the sun but this makes the sun turn black. I tried to disable the sun's collision box and set the shader to None but it didn't seem to work. If anybody can provide a solution it would be greatly appreciated.

Thanks!

  • 2
    Ursina doesn't seem to be talked about much on this site, and also this question doesn't have a [mre] or any code in it...it feels like this kind of question would be more appropriate, and would get more attention, on a forum or Q&A site dedicated to Ursina. Just saying that because it doesn't look like this post has gotten any attention thus far. – Random Davis May 10 '22 at 22:21
  • This question is already answered [here](https://stackoverflow.com/a/70351830/17675859) – Tanay May 18 '22 at 13:53
  • Does this answer your question? [Ursina Python Engine: Lighting, Shadows And Bloom Effects](https://stackoverflow.com/questions/70139918/ursina-python-engine-lighting-shadows-and-bloom-effects) – 0stone0 May 20 '22 at 15:11

2 Answers2

1

You can code a GLSL shader or use a built-in shader:

from ursina.prefans.shaders.basic_lighting_shader import basic_lighting_shader # using this one for example

Entity.default_shader = basic_lighting_shader
1

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()
Tanay
  • 561
  • 1
  • 3
  • 16
  • Please do not copy/paste answers. Rather mark the question as duplicate. – 0stone0 May 20 '22 at 15:12
  • You should mark it duplicate I have not as many reputation – Tanay May 20 '22 at 15:26
  • Please see [this page](https://stackoverflow.com/help/duplicates). You'll need some more rep to cast the vote, but leaving a comment saying it's a dupe will help other and keep it clean. – 0stone0 May 20 '22 at 15:26