Map Sky Rendering and ReflectionTextureSampler

Users who are viewing this thread

xenoargh

Grandmaster Knight
Well... I'm sorry to report that I've hit a major, maybe-even-showstopping problem with my mod :facepalm:

Somewhere along the way, it appears I've deleted whatever-it-is that enables both map skyboxes and, more critically, the reflection-map is rendering to black. 

Just... black.  No crash, no error, no explanation from the ever-helpful RGL log.  I'd just go back to the last backups, but frankly, that was a while ago and goodness knows if it'd resolve the problems.

I just tested with Native, and whatever this is, it's happening only in the mod. 

I'm really not sure where to go with this, folks; the first issue could probably be worked around, but is mysterious and buggy... the second should be resulting in a broken game, but instead, everything merrily functions... other than reflections.  I'm really stuck; there's no obvious "reflection texture Material" or "map skybox material" and thus far, I'm batting 0% when I'm replacing old stuff with new stuff in module.ini or forcing TW's stuff to load first.

I'm in a serious pickle.  Any ideas?
 
Sometimes the engine refuses to load certain textures.
If that applies to your case, then there's a quick and dirty fix;
Switch between windowed- and full-screen mode (alt + enter), that re-renders the whole scene and might load in the missing texture(s).

Are you only experiencing this on the campaign-map, or within a scene as well?
Both share the same skybox materials, but not necessarily the same shaders, that's why I'm asking.
 
OK, I've got two issues here.

Both issues are not happening in Native, so I suspect I've stumbled into something rather nasty and hard-coded indeed.  Just not quite sure... where, yet, lol.

1.  Reflections just aren't rendering, period. 

I've tested my shader, and it's not the shader; if I, say, reference ScreenTextureSampler rather than ReflectionTextureSampler... it "works"- I get an output that's sensible, given the input (ScreenTextureSampler is, apparently, the screen, shot from the POV of the camera- how this differs from the ReflectionTextureSampler, I don't know- I always figured the latter was the same as the former, but we just rotated it with a matrix... but I digress).

I've tested getting rid of my shaders entirely, just to make sure I'm not nuts... and that also doesn't work.  So, whatever's happened here is 100% not shader-related.  But there's no "reflection" material, or anything else that's obvious.  Maybe a cubemap somewhere?

Theory: there's a Material somewhere that needs to exist, or a Texture that is actually used as the buffer, rather than this being internal to the engine.  Which is nuts, but frankly, I don't have many other options.

2.  The skybox shader shouldn't ever fail, but... hmm; I can see one idea to test. 

I've got a working theory there; I'll take a look at that and get back to you.
 
Nope, that didn't fix the skybox, unfortunately.

So... yeah, two unrelated problems.  The first one (reflections aren't rendering at all) ... IDK what's up with that, at all.

The map skybox... it's possible, if unlikely, that the issue is that the shader's doing something bizarre there.  I'll test forcing a Native skybox there.
 
Hmm.  That didn't work.  Neither did trying to force the shader.  So... yeah, the map skybox is using some variant shader, not skybox_shader (surprise, surprise).

Sooooo... yeah.  Is there some weird mesh that is used for the map skybox?
 
Show off the content of your Skyboxes.py ...
Check for all skybox meshes that are assigned within that skybox list.
Then check for the materials and textures for those skyboxes, there must be an issue.

The Skybox itself is used as the reflection map, as long as "Fast Water Reflections" is ticked.
 
All of the skyboxes are... using custom spheres... oh, snap, they aren't UV'd in the same way as the TW ones...

Oh, snap... if this is the problem, I'm going to kick myself, lol. 
 
Hmm.  The UVs on the TW ones are surely too, er, sloppy to be being used for some fancy reflection-map stuff, though?  I mean, the UVs are a little odd... basically just a cylindrical projection map, with off-center UVs.  So, IDK. I'll test this theory out, though I'm somewhat dubious.

The other possibility is that, when a skybox is rendered for simple reflections, it's rendered using a different shader than normal- probably one of the simplest diffuse ones.  Hmm.
 
The shape and UVs of the "skybox" doesn't really matter.

I used a fully shader driven and dynamic skydome in the latest BoE Dev-build and it all worked fine.
The engine seems to auto-generate a cube-map of it and uses it as reflection-map on the fly.
 
I just tried transmogrifying the UVs.  Nothing doing there, so yeah, your theory's correct; the UVs don't matter at all.

So the puzzle is... what's preventing it or anything else from being drawn to the reflection pass?  There must be something pretty simple that's Do Not Pass Go here.
 
Nothing changes, either way; the output's still black.

I'll try testing this out on a simple sphere mesh, just to make sure that it's not doing something odd in projection.
 
Is this relevant?

Vornne said:
Sir_Don_Quixote said:
But couldn't you develop a code that in every set amount of time, the skybox switches itself? Ie: It is a Sunny day, and in 4 hours it turns to moon with stars.
The skybox mesh is only changeable in the module system with the set_skybox operation, which only works before scene start. It is possible to make all the native skyboxes empty meshes using OpenBrf, then make a dummy item using a skybox mesh and move it around with the mission camera, client side; but the skybox mesh is coded into things like the water reflection shader, meaning that water will appear black unless every player uses the high quality reflections option, at a cost to performance. It might be possible to redo a bunch of shader code to compensate, or maybe not, but that would take longer to figure out than has seemed worthwhile so far, compared with other priorities.

Even then, only the skybox would be changed, without affecting any directional shadows, ambient lighting, sun flare effects, and so on. The M&B engine is just not designed for dynamic lighting or weather changes in scene.
 
Yes, I encountered this very problem after implementing your skyboxes/shaders in BFII recently Seb. Just entirely pitch black scenes. It's really weird, I found no real explanation for it.

Xenoargh, could you try forcing a set_skybox operation on ti_before_mission_start for just one certain mission template? Then load into a scene twice using the mission template and see if the scene is still black. If you 'reinitialise' and force this on the scenes they won't be black.

I have this prop in multiplayer that governs scene conditions picking up from Var1, all I had to do was literally reload each scene manually with the new prop and they were no longer black.
 
Hmm.  I'll look at that.  I'd sure like some sort of solution; this is, honestly, rather puzzling; seems like it should've broken everything, but nope, we're fine, other than not working as it's supposed to.
 
Hmm.  Hit another dead end.

The issue here's straightforward; whatever the reflection-rendering process is, it's simply not working right now.

Maybe the issue here is that this has been broken by the latest engine update; it's pretty clear that TW's moving to a GLSL-only setup, and maybe reflection rendering's been moved, but not the rest?  That might explain why it's not broken in Native, maybe.
 
Back
Top Bottom