Sister blog of Physicists of the Caribbean. Shorter, more focused posts specialising in astronomy and data visualisation.

Monday 4 May 2020

Bringing wide open spaces indoors

My lockdown side-project is reaching the stage where I feel confident enough of finishing it that I can show what I've got so far.

Seven years ago (!) I made a model of Arecibo observatory, which became a pretty glass cube. Some time later this got heavily updated to the standards of having enough detail for a passable rendering (even if the materials were never that great) for a pre-rendered VR video. But wouldn't this be much cooler if it was an interactive game-like thing you could walk around in ? Answer : yes, yes it would.

After playing around with a few realtime data-based experiments of the amazing Blend4Web plugin, I decided it was time to take on the more laborious task of converting Arecibo to something people can explore for themselves. This is a lot more work than the previous experiments, which are largely a matter of tweaking Python scripts - essentially they're automatic except for some manual window-dressing. With Arecibo, everything has to be done manually.

A quick test proved that the plugin was easily capable of handling the mesh at an extremely high frame rate. But the materials were designed for the world of raytracing, and for various reasons they mostly look pretty horrendous in the realtime view. The easiest solution would be to remove them all and replace them with very simple plain colours, but this would look meh. So instead I learned about texture baking, which essentially does the rendering and stores the image on the mesh so it looks just like the rendered view but in real time.

Unfortunately this can't easily be scripted. Meshes have to have clean geometry and unwrapped in a reasonably decent way. Large parts of the mesh are, for reasons best known to my younger self, not clean at all. Large parts have had to be remodelled completely just so texture baking will work. Even then it isn't perfect, but I've decided that version 1.0 of Half Life Arecibo (working title) will be a quick(ish) learning experiment. For version 2 I'll learn the nice new materials available in Blender 2.8 and make everything look way better.

Anyway, screenshot time ! Here's the whole site. The landscape will be extended using a Blender plugin that automatically extracts textured terrain meshes from Google Earth (I actually already did that but I seem to have misplaced the landscape somewhere, as one does). The grey sky is what you see in Blender internally, although Blend4Web can replace this with something sensible.


The ground screen (that protects the beam from receiving the hot ground) was a particular challenge to re-texture. The baking isn't perfect, but I think it's probably good enough. The supporting struts do not yet have correct materials so they don't display nicely yet. 


The towers are all fully textured, though one of them has wrong material settings on the ladders and suchlike. Again, the cable materials are not yet correct.



The Gregorian dome was surprisingly easy to convert. For now, all textures are 4k resolution, even the really small objects, but this will probably change to save memory.


Having found a texture baking solution that generally works well, I was rather annoyed to find this method didn't work at all for the triangle. Then I found out the mesh has - lord knows why - far too many faces, so I completely remodelled it and it worked (there are a lot of minor defects, though I think they don't notice much). The same needs to be done for the azimuth arm. 


You can see a few rendering artifacts in a few places. These can probably be fixed, but for this first test I won't bother. In general they don't cause any serious problems.


Getting this building to work took up a good few hours and it still has some nasties. And the signs (not yet shown) are being particularly uncooperative. I don't know why this little shack is being such a pain, but I'll get there in the end.


That's for now. Most parts of the mesh are relatively straightforward. It's the few bits that don't work so easily that slow everything down. Still, if I can do a little bit every day, it shouldn't be too long before everyone can recreate Sean Bean's infamous death-by-telescope scene... well, maybe.

No comments:

Post a Comment

Back from the grave ?

I'd thought that the controversy over NGC 1052-DF2 and DF4 was at least partly settled by now, but this paper would have you believe ot...