Use of HDRI images for environmental backgrounds

I’m curious as to how to use HDRI images or images in general as environment backgrounds in Panda (if possible). If not, then I’d like to know how to implement that myself. Maybe a shader would work?

I’ve not worked with HDRI images, specifically, so I’m not in a position to speak to that part.

However, images can be used as backgrounds in a few different ways:

  • They can be placed on a “card” that’s rendered behind the scene. This gives the effect of a static backdrop that doesn’t change with the view.
  • They can be placed on geometry that surrounds the player and that moves with them, and which is rendered behind the scene. This gives the effect of a distant vista, as of lands surrounding the immediate area.
    • This has a few variations, primarily based around the shape of the geometry–generally either a box or a hemisphere/sphere, I believe.
  • And possibly other approaches that aren’t occurring to me right now!

That seems very useful now that i think about it, but wouldn’t it obscure say an object that is below the sphere in question. If the motion of the sphere is relative to the camera then objects that are beyond the sphere’s radius wouldn’t be visible - I think (haven’t tested out that theory)

HDRI images are supported with no problem. The OpenEXR format is most popular, but we also support the HDR format.

If you have a floating-point framebuffer, rendering it on a card should be no problem, but unless you are using a shader (that doesn’t clamp the output color), you may want to call card.setAttrib(LightRampAttrib.makeIdentity()) to disable the default color clamp of the built-in shader generator.

You can disable depth write on the object to prevent it from appearing in front of other objects.

2 Likes

Exactly: Put the object in the “background” culling-bin (so that it’s one of the first things rendered, and thus interacts properly with transparency), and turn off depth-writing on it. As a result subsequent objects will be rendered as though nothing had yet been rendered, allowing it to appear “behind” even things that are technically further away than it is.

TYSM for this! (Especially the quick response) @rdb

1 Like

how do set the terrain as your HDRI, likeee, wherever the model is located in the terrain(the subject) or I mean the character has the HDRI of wherever it is, say a car game like a car get the reflection on the glass and also the metal kind of, do you have to set something or use render pipeline, like this:


or this, like the car I’ve explained about

I’ve found these in the render pipeline photo samples.

see the metal.

I think this is what you want. However, the panda auto shader does not support this by default. You need to write your own shader.

it seems like their using C++ what about python?

There is no use of C++ in this example

ok, i understand that its python