Lighting as in Blender


#1

Hi Guys,

I discovered panda3d a few days ago and I read all the manual of the site concerning the lighting, …
But I would like to know if anyone has tips concerning the lighting that Blender has.
I already tried to create some point lights looking to the center of the scene and linked to the render but the light reflection is not the same. Moreover, the light reflection seems buggy sometimes.


Concerning the material I use, it is the same one as in Blender. I converted my mesh using the YABEE exporter and recreated the material reading the egg file.

Cheers all!


#2

Hi, welcome to the community!

The first thing to note is that Blender uses sRGB by default; to get the same colours as you see in Blender, you have to also add framebuffer-srgb true to your Config.prc file (and enable sRGB on any textures).

Could you elaborate what you mean by “buggy”? It’s not clear what I’m looking at in the screenshot. Seeing a comparison between your set-up in Blender and Panda might help.

Note that by default Panda uses per-vertex lighting; you need to call render.setShaderAuto() to enable per-pixel lighting on your scene.


#3

Thanks for answering ^^

Is there a python command for setting framebuffer srgb to true?
What I meant by buggy was that the light reflection on the object sometimes was not appearing (kind of tilting when I was moving around the scene but it disappeared when I used the auto shader.
Now, does someone know how to setup light as in blender?

Cheers all!


#4

As a heads up pman’s basic renderer was setup to mimic Blender’s viewport rendering since it was built to be used as a rendered viewport via BlenderPanda.

The two things that I needed to do to match Blender are what @rdb already mentioned:

  • Use sRGB framebuffer (panda3d.core.load_prc_file_data('', 'framebuffer-srgb true'))
  • Enable the auto-shader (render.set_shader_auto())

You can also handle the sRGB framebuffer yourself, but it will be faster to have Panda do it. An incomplete example (it isn’t accurate for darker color values) can be found here.


#5

Hi Moguri,

Thanks for the reply, but do you know how Blender positions the lamps in the world view?
I’m still lost when I try to position them manually. ^^

Cheers all!


#6

If you use BlenderPanda/pman/blend2bam, you can output BAM files from Blender that have the lights in them.

If you want to stick with EGG, which is what I am assuming you’re using, you can tag some objects (the lights might work, but empties otherwise) via game properties that you can read in Panda. Then, you can find all objects with those tags and create lights at the same positions. I have not done this myself, so I may be have some of the details wrong.


#7

Hey,

I procedurally generated the objects with GeomNode, … But what do you mean by tagging the objects?
Do you mean getting the node object and create a lamp at the same position? (what would it do?)

Cheers all!


#8

Ah, I figured you were exporting scenes from Blender. You can add tags to objects that YABEE will put into EGG files.

For generating objects/lights, I don’t recall there being anything strange with Blender lights versus Panda lights. If you want to dig into what blend2bam does, you can look at this file for Blender -> glTF and this file for glTF -> BAM.