Jump to content

renderNodesTexture2D()


photo

Recommended Posts

This is a sample project to show a couple of problems I've been having with my scheme to render terrain to a texture and insert it back as a transparency. (the inserting it back is not the real version, I've changed it to show the pre-rendered terrain inverted in the sky for easy comparison with the real terrain) It's a modification from the GBufferRead sample, with a lot of things copy-pasted from the ortho_01 decal sample. You'll need to copy in the "samples/common/terrains/" directory from that sample because it was too big to fit in the zip.

First problem: where are the decals in the pre-rendered terrain? In theory, I didn't think I'd even need to feed them to renderNodesTexture2D() because they're children of the terrain.

Second problem: Why isn't the lighting the same in the mirrored terrain? Since the lighting in the sample setup isn't the same as in our real project, please think of _all_ the things that could be necessary to make the lighting match between the two renders, even if it's not a problem in this particular sample.

GBufferRead.zip

Link to comment

Hello Greg,

1. Looks like a bug that decals are not rendered with renderNodesTexture2D. We'll investigate the issue. Everything is fine when using renderTexture2D though, but viewport masks need to be set to separate objects for different viewports.

2. setNodeLightUsage(Unigine::Viewport::USAGE_WORLD_LIGHT); needs to be set to use same lighting for renderNodesTexture2D, but it leads to crash which seams to be another bug. It works with renderTexture2D again.

Also SKIP_POSTEFFECTS doesn't skip exposure and white balance so they need to be disabled manually before renderTexture2D and restored after.

I attached source code with the modifications. I also set viewport masks to provide an example (note that lights have 1 as a viewport mask by default)

 

Link to comment

Terrific! Thank you.

I guess I should have mentioned that we're using 2.6.1, which might be why I just see worse lighting with USAGE_WORLD_LIGHT but not a crash. It also means that if you find simple enough patches for the renderNodeTexture2D bugs in the near future then we'd appreciate you seeing if they can be backported.

Link to comment
×
×
  • Create New...