Giter VIP home page Giter VIP logo

cesium-unreal-samples's People

Contributors

argallegos avatar baothientran avatar j9liu avatar joseph-kaile avatar kring avatar nithinp7 avatar shehzan10 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cesium-unreal-samples's Issues

Small updates to the Samples project for Cesium for Unreal v2.0

  • Disable "Enable World Bounds Check" in all levels. (See also #42)
  • Enable "Enable Large World Coordinates" in all levels (UE 5.0 only, it's on by default in UE 5.1 and 5.2)
  • Disable "World Composition" in the CesiumSublevels level.
  • Nest all Cesium tilesets and globe anchored objects under the CesiumGeoreference.
  • Update the metadata level for the new metadata API

Add material(s) for procedural windows on OSM buildings

A while ago, I was inspired by this forum post to make a procedural window material for OSM buildings. After some polish, it works well in most areas and I'd love to make it available for Cesium for Unreal users. This comment contains an overview of the material that I made. We can use this issue to discuss whether it's appropriate to add to the samples, as well as possible improvements, adjustments, or alternatives.

The assets have been added to the branch procedural-osm-material, and a pull request has been created here.

What is this material?

(There's actually two materials, one that uses metadata for randomization, and one that doesn't, but they are similar otherwise. The metadata version is shown in the initial images.)
These materials add a window-like effect along the sides of OSM Buildings meshes. It can work with any tileset, but is designed for the simpler OSM buildings rather than photogrammetry.
image

The windows are a darker color, and reflect the environment. They are also emissive, which can create a "city lights" effect in nighttime scenes.
image

The materials have adjustable parameters so that users can optimize them for their scenes. For example, you can adjust building colors, window size, emissive intensity, and roughness of both the building and the window.

The material only maps along the sides of buildings, and even works for slanted roofs. The angle at which it cuts off the windows can be adjusted.
image

There's two variants:

  • ProceduralWindowsMetadata
    • This version uses a CesiumEncodedMetadata component to randomize building colors based on each primitive's elementId parameter. It is a slightly more expensive and complex shader, but produces a more convincing visual effect.
    • This is the material used for the two above pictures.
    • It offers additional customization of night appearance, which can result in varied brightness between buildings or buildings with their lights off.
    • It requires that the CesiumOSMBuildings tileset has a CesiumEncodedMetadata component set to the appropriate Material Layer, with all attributes except elementId removed.
    • It does not appear to be currently compatible with Bing Maps Raster Overlays - Adding an imagery overlay consistently seemed to break the metadata styling.
  • ProceduralWindowsSimple
    • This version does NOT use metadata to influence color, and as a result each building is the same color. It does have all other features mentioned in the overview above.
    • image
    • This material can work with a Bing Maps Raster Overlay, which serves to add color variation.
    • image
    • Implementation note - I haven't been able to find a convincing solution for color variation for this version. Typical techniques that use noise to influence object color don't work in this case, because it's a 3D tileset. The actor itself can't recognize one building from another without using metadata. 2D or 3D noise textures are an option, but because it must be applied in world space, you will have clusters of buildings of the same color, and some buildings will be multicolored in a very non-building way.

These materials could be expanded upon for improved visual fidelity. For example, instead of blending between different colors, you could use metadata to choose between textures, like brick or stone.

Performance

These materials perform within the typical range for 3D Tileset materials. Neither significantly impacted FPS on my machine.
They both use a 1024x1024 texture, which introduces some overhead.
WindowAlpha_128

ProceduralWindowsSimple stats:

  • Base pass shader: 201 instructions
  • Base pass shader with Volumetric Lightmap: 289 instructions
  • Base Pass vertex shader: 71 instructions
  • Texture samplers: 8 (9 if using Bing Maps imagery)

ProceduralWindowsMetadata stats:

  • Base pass shader: 242 instructions
  • Base pass shader with Volumetric Lightmap: 329 instructions
  • Base Pass vertex shader: 71 instructions
  • Texture samplers: 8

To compare, here are the stats for MI_CesiumThreeOverlaysAndClipping, which is the default Cesium for Unreal material.

  • Base pass shader: 237 instructions
  • Base pass shader with Volumetric Lightmap: 325 instructions
  • Base Pass vertex shader: 71 instructions
  • Texture samplers: 12

Caveats

Note that this material is not intended for photorealism. It's useful for helping OSM Buildings read more as buildings in a scene, but it's not perfect.
The window pattern is projected in world space along the X and Y axes. Therefore, it's subject to all the drawbacks of a world-aligned texture.
Here's how it looks in various situations on various buildings.

  • The material can't know where the ground is, so each story of a building is aligned at the same Z height. Windows may appear to clip through the ground. image
  • The material is applied to all objects in the tileset, whether or not they're supposed to represent a building. For example, these are bridge towers. image
  • Since it's world-aligned, if you are far from the origin the windows will no longer be applied correctly. You can fix this with origin rebasing. image
  • The horizontal width of the windows will vary and possibly overlap depending on the building's alignment to the cardinal directions.
    image

Improve minimum exposure settings in post process

Unreal uses an auto-exposure system, so that while in bright sunlit areas, Unreal brings down the exposure to achieve an appropriate light level, and vice versa for dark shadowed areas. However, in certain scenarios, especially in cities, the auto-exposure will compensate too far in dark areas, and any visible sunlit objects will be extremely bright with clipped highlights.

We can fix this issue by setting a minimum Exposure Value (EV) to our scenes. This requires adding a PostProcessVolume with infinite extent in the level.

image
Default exposure in shadowed area with no minimum EV. Sunlit areas are over-exposed and have clipped highlights.

image
Minimum EV set to 13.0 using infinite post process volume.

image
Min EV setting in Post Process Volume

Inform user about expired sample tokens

The ion tokens that are distributed with the samples are usually valid for two months. With the monthly release, there is some grace period for people to have a chance to update, and receive new tokens. But when the tokens expire, the "end user experience" might just be that ~"nothing appears, everything is broken" (it just prints some error message on the console that doesn't tell much about the reason).

Users should be informed about the reason why "nothing appears", in a way that is easy to understand and accessible. We could go fancy there, and present that error to the user, maybe as a dialog with some link to the site for updating the samples (and of course, for registering on ion, so that fewer people rely on the sample tokens).

This affects all levels:

  • In cesium-native, there should be a mechanism for more detailed error messages. The point for starting to address this may be near Tileset::_handleAssetResponse, where we might check the return code (401 for "Unauthorized", I think) and somehow retain this information. This could be along the lines of some enum TilesetError (not using the HTTP codes, because we might need some PARSING_ERROR error types as well), and a Tileset::getLastError or so
  • In cesium-unreal, there should be a method for obtaining that information and making it available via the Cesium3DTileset (accessible via Blueprints and such)
  • In cesium-unreal-samples there might be a dedicated blueprint to handle the case of expired tokens.

The latter could make sense, because in the usual workflow, a 401 error would roughly mean that the user misconfigured his ionToken. A dedicated blueprint for the samples could capture this error, and identify it as the special case of "The sample token is expired" (because in the samples, there should be no other 401 errors).

All this is related to (and largely depends on) CesiumGS/cesium-unreal#542

Ensure compatibility with Cesium for Unreal 1.7.0

  • 1.7.0 update
    • Test all scenes for functionality
    • Ensure CesiumSunSky and DynamicPawn are properly connected to the Georeference in each level
    • Remove obsolete Georeference from the Paris sublevel
  • Update Readme to include new levels.

Update Cesium for Unreal Samples levels to show new features

We need to show off a few more features in the Samples:

  • Multiple view frustrums (multiple views rendering tiles at once, possibly using a minimap or something similar)
  • Clipping (clipping around Denver tileset)
  • Material editing (overlay streets? Custom watermask?)

Make `CesiumTileExcluder` material responsive

I think that 13_CesiumTileExcluder would be a more effective sample if the material actually accounted for the box size and position. (Rotation would be a cool plus, but perhaps is ambitious).

Currently, it discards fragments outside of a fixed world-position area. So if you move the trigger box (and therefore move the exclusion zone), you get this:

image

It's not a bug; the material is simply set up that way. But it would be more intuitive and powerful to make it account for changes in the box.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.