Why render.setShaderAuto() causes directional lighting not to work

ok, all sides have same brightness for some reason
ΠΈΠ·ΠΎΠ±Ρ€Π°ΠΆΠ΅Π½ΠΈΠ΅

Now I propose to look at the settings of the material of the Principled BSDF node. Maybe there’s something wrong there. Or you use a lot of ambient light…

Try applying custom material in Panda3D to the box.

mat = Material()
box.setMaterial(mat, 1)

Mysticism!!!, attach the model to the message, tomorrow I or someone else here will study it.

cube.blend (890.5 KB)
cube.glb (2.4 KB)
it happens with all models that i export from blender

obj export works better but i dont like this textures
ΠΈΠ·ΠΎΠ±Ρ€Π°ΠΆΠ΅Π½ΠΈΠ΅


I tested this with my example.

from direct.showbase.ShowBase import ShowBase
from panda3d.core import AmbientLight, DirectionalLight

class Game(ShowBase):
    def __init__(self):
        ShowBase.__init__(self)
        
        model = loader.loadModel("cube.glb")
        model.reparentTo(render)
        model.setPos(0, 0, 0.5)
        
        model1 = loader.loadModel("box")
        model1.reparentTo(render)
        model1.setScale(10, 10, 1)
        model1.setPos(-4, -4, -1)

        alight = AmbientLight("alight")
        alight.setColor((0.2, 0.2, 0.2, 1))
        alnp = render.attachNewNode(alight)

        slight = DirectionalLight('slight')
        slight.getLens().set_film_size(10)
        slight.getLens().set_near_far(0.1, 17)
        slight.setColor((1,1,1,1))
        slight.show_frustum()
        slight.setShadowCaster(True, 1024, 1024)
        
        slnp = render.attachNewNode(slight)
        slnp.setPos(0, 10, 5)
        slnp.setHpr(180, -20, 0)

        render.setShaderAuto()
        render.setLight(alnp)
        render.setLight(slnp)

game = Game()
game.run()

I think for prevention, you should not watch YouTube in order to acquire knowledge in the field of using the Panda3D engine.

i also tested in your example, code is exactly the same
i think problem in panda3d gltf?

Most likely, maybe it works for me since I don’t have a plugin. Assimp is used.

yes it is, ok, but how to make my texture not blurry
ΠΈΠ·ΠΎΠ±Ρ€Π°ΠΆΠ΅Π½ΠΈΠ΅

Alternatively, do not use filtering, but this is fraught with a moire pattern. Use anisotropic filtering. But the most valid way to make a texture in sufficient resolution. Perhaps another problem is that your texture is not a power of two.

In this case, you just need to set the texture filter mode for that texture to β€œnearest” to make it sharp, and disable mipmapping.

Increasing the resolution of the texture will also work.

2 Likes

Okay, so im suffering the same and yes using a diffierent importer works. We suggest blend2bam in the docs though, and this is a significant issue in there still. Ive had some break throughs, when i applied texture colors to my model and made sure it was twosided, it responded to directional light.

That suggests to me that the problem may in part be an issue with the model’s normals–it might be worth checking that they not pointing the wrong way.

Good suggestion, i did. And they are pointing outward!

1 Like

I suppose i could flip them for science!

Nope, didnt help. Youd probably very interested in the journey that has taken place, and maybe you could provide some insight, ill transfer my journey to this thread.

@Thaumaturge
@serega-kkz

You guys will probably be interested.

1 Like

@enricfur
You can consider this option as an alternative.

1 Like