You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I use an orthographic the lens, the properties of the material are lost, as you can see, the specular glare has disappeared.
fromdirect.showbase.ShowBaseimportShowBasefrompanda3d.coreimportDirectionalLight, Material, NodePath, Camera, OrthographicLensimportsimplepbrclassMyApp(ShowBase):
def__init__(self):
super().__init__()
# Setting up a new node for rendering.my_aspect2d=NodePath("my_aspect2d")
my_lens=OrthographicLens()
my_lens.set_film_size(8, 8)
my_lens.set_near_far(-1000, 1000)
camera=Camera("camera_orthographic")
camera.set_lens(my_lens)
camera_np=NodePath(camera)
camera_np.set_scale(base.win.get_x_size()/base.win.get_y_size()*1.0, 1.0, 1.0)
camera_np.reparent_to(my_aspect2d)
display_region=base.cam.node().get_display_region(0)
display_region.camera=camera_np# PBR initializationpbr=simplepbr.init(render_node=my_aspect2d, camera_node=camera_np)
pbr.enable_shadows=True# Creating a scene.material=Material("test")
material.set_shininess(128)
plane=base.loader.load_model("plane.egg")
plane.set_material(material)
plane.reparent_to(my_aspect2d)
sphere=base.loader.load_model("sphere.egg")
sphere.set_material(material)
sphere.reparent_to(my_aspect2d)
light=DirectionalLight("sun")
light.set_shadow_caster(True, 512, 512)
light_np=NodePath(light)
light_np.set_hpr(35, -25, 0)
light_np.reparent_to(my_aspect2d)
my_aspect2d.set_light(light_np)
# Calculation of the bounding box for the shadow map.bmin, bmax=my_aspect2d.get_tight_bounds(light_np)
light_lens=light.get_lens()
light_lens.set_film_offset((bmin.xz+bmax.xz) *0.5)
light_lens.set_film_size(bmax.xz-bmin.xz)
light_lens.set_near_far(bmin.y, bmax.y)
app=MyApp()
app.run()
The test scene with the perspective lens works as expected.
fromdirect.showbase.ShowBaseimportShowBasefrompanda3d.coreimportDirectionalLight, Material, NodePathimportsimplepbrclassMyApp(ShowBase):
def__init__(self):
super().__init__()
# PBR initializationpbr=simplepbr.init()
pbr.enable_shadows=True# Creating a scene.material=Material("test")
material.set_shininess(128)
plane=base.loader.load_model("plane.egg")
plane.set_material(material)
plane.reparent_to(render)
sphere=base.loader.load_model("sphere.egg")
sphere.set_material(material)
sphere.reparent_to(render)
light=DirectionalLight("sun")
light.set_shadow_caster(True, 512, 512)
light_np=NodePath(light)
light_np.set_hpr(35, -25, 0)
light_np.reparent_to(render)
render.set_light(light_np)
# Calculation of the bounding box for the shadow map.bmin, bmax=render.get_tight_bounds(light_np)
light_lens=light.get_lens()
light_lens.set_film_offset((bmin.xz+bmax.xz) *0.5)
light_lens.set_film_size(bmax.xz-bmin.xz)
light_lens.set_near_far(bmin.y, bmax.y)
app=MyApp()
app.run()
The text was updated successfully, but these errors were encountered:
serkkz
changed the title
Use simplepbr and orthographic projection, causes a problem.
Use simplepbr and orthographic lens, causes a problem.
May 12, 2022
serkkz
changed the title
Use simplepbr and orthographic lens, causes a problem.
Using simplepbr and an orthographic lens causes a problem with the material.
May 12, 2022
simplepbr needs to use a different view vector when used with an orthographic camera. It would be nice to do this based on a pre-processor define. We could check projection type of the camera when setting up the shader, but then we would not be able to detect if the projection changed later. This might be "good enough" since the alternatives (checking in the shader, checking every frame via a task) would all add more runtime cost for a pretty uncommon use case.
When I use an orthographic the lens, the properties of the material are lost, as you can see, the specular glare has disappeared.
The test scene with the perspective lens works as expected.
The text was updated successfully, but these errors were encountered: